Skip to content

Commit 3a0662f

Browse files
author
BuildTools
committed
Fix ladder handling
The dialogue callback wasn't being handled due to ann incorrect subscription. This patch resolves
1 parent 173be5d commit 3a0662f

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/game-engine/world/actor/player/dialogue-action.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ export class DialogueAction {
140140
this.p.interfaceState.openWidget(widgetId, {
141141
slot: 'chatbox'
142142
})
143-
144-
const sub = this.p.dialogueInteractionEvent.subscribe(action => {
143+
const sub = this.p.interfaceState.closed.subscribe(action => {
145144
sub.unsubscribe();
146145
this._action = action;
147146
resolve(this);

src/plugins/objects/ladders/ladder.plugin.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const validate: (level: number) => boolean = (level) => {
1111

1212
export const action: objectInteractionActionHandler = (details) => {
1313
const { player, option } = details;
14-
1514
if (option === 'climb') {
1615
dialogueAction(player)
1716
.then(async d => d.options(
@@ -22,20 +21,18 @@ export const action: objectInteractionActionHandler = (details) => {
2221
]))
2322
.then(d => {
2423
d.close();
25-
switch (d.action) {
24+
switch (d._action.data) {
2625
case 1:
2726
case 2:
28-
action({ ...details, option: `climb-${(d.action === 1 ? 'up' : 'down')}` });
27+
action({ ...details, option: `climb-${(d._action.data === 1 ? 'up' : 'down')}` });
2928
return;
3029
}
3130
});
3231
return;
3332
}
34-
3533
const up = option === 'climb-up';
3634
const { position } = player;
3735
const level = position.level + (up ? 1 : -1);
38-
3936
if (!validate(level)) return;
4037
if (!details.objectConfig.name.startsWith('Stair')) {
4138
player.playAnimation(up ? 828 : 827);

0 commit comments

Comments
 (0)