Move Lynx trap ejection to its own mini-step
This commit is contained in:
parent
7e210de5e7
commit
097a4b04d8
38
js/game.js
38
js/game.js
@ -929,6 +929,7 @@ export class Level extends LevelInterface {
|
||||
continue;
|
||||
|
||||
this._do_actor_cooldown(actor, cooldown);
|
||||
this._do_actor_trap_ejection(actor);
|
||||
}
|
||||
for (let i = this.actors.length - 1; i >= 0; i--) {
|
||||
let actor = this.actors[i];
|
||||
@ -953,6 +954,7 @@ export class Level extends LevelInterface {
|
||||
continue;
|
||||
|
||||
this._do_actor_cooldown(actor, cooldown);
|
||||
this._do_actor_trap_ejection(actor);
|
||||
this._do_actor_idle(actor);
|
||||
}
|
||||
}
|
||||
@ -1108,6 +1110,21 @@ export class Level extends LevelInterface {
|
||||
|
||||
// Play step sound when the player completes a move
|
||||
if (actor === this.player) {
|
||||
this._play_footstep(actor);
|
||||
}
|
||||
|
||||
if (! this.compat.actors_move_instantly) {
|
||||
this.step_on_cell(actor, actor.cell);
|
||||
}
|
||||
// Note that we don't erase the movement bookkeeping until next decision phase, because
|
||||
// the renderer interpolates back in time and needs to know to draw us finishing the
|
||||
// move; this should be fine since everything checks for "in motion" by looking at
|
||||
// movement_cooldown, which is already zero. (Also saves some undo budget, since
|
||||
// movement_speed is never null for an actor in constant motion.)
|
||||
}
|
||||
}
|
||||
|
||||
_play_footstep(actor) {
|
||||
let terrain = actor.cell.get_terrain();
|
||||
if (actor.is_sliding && terrain.type.slide_mode === 'ice') {
|
||||
this.sfx.play_once('slide-ice');
|
||||
@ -1144,14 +1161,21 @@ export class Level extends LevelInterface {
|
||||
}
|
||||
}
|
||||
|
||||
if (! this.compat.actors_move_instantly) {
|
||||
this.step_on_cell(actor, actor.cell);
|
||||
// Lynx: Actors standing on brown buttons perform trap ejection immediately after their
|
||||
// cooldown, in actor order. This causes a lot of double movement and there's not really any
|
||||
// way to simulate it other than to just do this awkward pseudo-phase
|
||||
_do_actor_trap_ejection(actor) {
|
||||
if (! this.compat.traps_like_lynx)
|
||||
return;
|
||||
if (actor.movement_cooldown > 0)
|
||||
return;
|
||||
|
||||
let terrain = actor.cell.get_terrain();
|
||||
if (terrain.type.name === 'button_brown' && terrain.connection) {
|
||||
let trapped = terrain.connection.cell.get_actor();
|
||||
if (trapped) {
|
||||
this.attempt_out_of_turn_step(trapped, trapped.direction);
|
||||
}
|
||||
// Note that we don't erase the movement bookkeeping until next decision phase, because
|
||||
// the renderer interpolates back in time and needs to know to draw us finishing the
|
||||
// move; this should be fine since everything checks for "in motion" by looking at
|
||||
// movement_cooldown, which is already zero. (Also saves some undo budget, since
|
||||
// movement_speed is never null for an actor in constant motion.)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1608,12 +1608,6 @@ const TILE_TYPES = {
|
||||
level._set_tile_prop(me, 'presses', 0);
|
||||
}
|
||||
},
|
||||
on_stand(me, level, other, just_arrived) {
|
||||
// Lynx: open traps eject their contents at the end of each tic
|
||||
if (level.compat.traps_like_lynx && ! just_arrived) {
|
||||
level.attempt_out_of_turn_step(other, other.direction);
|
||||
}
|
||||
},
|
||||
add_press_ready(me, level, other) {
|
||||
// Same as below, but without ejection
|
||||
level._set_tile_prop(me, 'presses', (me.presses ?? 0) + 1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user