Fix Lynx force floor compat switch; ensure monsters can't turn in traps
This commit is contained in:
parent
9369b2b167
commit
fc1f85dac9
@ -181,8 +181,8 @@ export const COMPAT_FLAGS = [
|
|||||||
label: "Player can't override backwards on a force floor",
|
label: "Player can't override backwards on a force floor",
|
||||||
rulesets: new Set(['lynx']),
|
rulesets: new Set(['lynx']),
|
||||||
}, {
|
}, {
|
||||||
key: 'force_floor_only_on_arrive',
|
key: 'force_floors_inert_on_first_tic',
|
||||||
label: "Force floors only affect actors when stepped on",
|
label: "Force floors don't trigger on the first tic",
|
||||||
rulesets: new Set(['lynx', 'ms']),
|
rulesets: new Set(['lynx', 'ms']),
|
||||||
}, {
|
}, {
|
||||||
key: 'traps_like_lynx',
|
key: 'traps_like_lynx',
|
||||||
|
|||||||
15
js/game.js
15
js/game.js
@ -837,13 +837,13 @@ export class Level extends LevelInterface {
|
|||||||
// only be made every third frame
|
// only be made every third frame
|
||||||
_advance_tic_lynx60() {
|
_advance_tic_lynx60() {
|
||||||
this._do_decision_phase(true);
|
this._do_decision_phase(true);
|
||||||
this._do_combined_action_phase(1, true);
|
this._do_combined_action_phase(1);
|
||||||
this._do_post_actor_phase();
|
this._do_post_actor_phase();
|
||||||
this._do_wire_phase();
|
this._do_wire_phase();
|
||||||
|
|
||||||
this.frame_offset = 1;
|
this.frame_offset = 1;
|
||||||
this._do_decision_phase(true);
|
this._do_decision_phase(true);
|
||||||
this._do_combined_action_phase(1, true);
|
this._do_combined_action_phase(1);
|
||||||
this._do_post_actor_phase();
|
this._do_post_actor_phase();
|
||||||
this._do_wire_phase();
|
this._do_wire_phase();
|
||||||
|
|
||||||
@ -869,7 +869,7 @@ export class Level extends LevelInterface {
|
|||||||
let is_decision_frame = this.frame_offset === 2;
|
let is_decision_frame = this.frame_offset === 2;
|
||||||
|
|
||||||
this._do_decision_phase(! is_decision_frame);
|
this._do_decision_phase(! is_decision_frame);
|
||||||
this._do_combined_action_phase(1, ! is_decision_frame);
|
this._do_combined_action_phase(1);
|
||||||
this._do_post_actor_phase();
|
this._do_post_actor_phase();
|
||||||
this._do_wire_phase();
|
this._do_wire_phase();
|
||||||
|
|
||||||
@ -996,7 +996,7 @@ export class Level extends LevelInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Lynx's combined action phase: each actor attempts to move, then cools down, in order
|
// Lynx's combined action phase: each actor attempts to move, then cools down, in order
|
||||||
_do_combined_action_phase(cooldown, forced_only = false) {
|
_do_combined_action_phase(cooldown) {
|
||||||
for (let i = this.actors.length - 1; i >= 0; i--) {
|
for (let i = this.actors.length - 1; i >= 0; i--) {
|
||||||
let actor = this.actors[i];
|
let actor = this.actors[i];
|
||||||
if (! actor.cell)
|
if (! actor.cell)
|
||||||
@ -1332,7 +1332,7 @@ export class Level extends LevelInterface {
|
|||||||
return null;
|
return null;
|
||||||
if (! terrain.type.get_slide_direction)
|
if (! terrain.type.get_slide_direction)
|
||||||
return null;
|
return null;
|
||||||
if (! actor.is_pending_slide && ! (terrain.type.slide_automatically && ! this.compat.force_floor_only_on_arrive))
|
if (! (actor.is_pending_slide || terrain.type.slide_automatically))
|
||||||
return null;
|
return null;
|
||||||
if (actor.ignores(terrain.type.name))
|
if (actor.ignores(terrain.type.name))
|
||||||
return null;
|
return null;
|
||||||
@ -1525,6 +1525,11 @@ export class Level extends LevelInterface {
|
|||||||
// go back into the trap. this is consistent with CC2 but not ms/lynx
|
// go back into the trap. this is consistent with CC2 but not ms/lynx
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (this.compat.traps_like_lynx && terrain.type.name === 'trap') {
|
||||||
|
// Lynx traps don't allow actors to turn even while open; instead they get ejected
|
||||||
|
// during their idle step
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (actor.type.decide_movement) {
|
if (actor.type.decide_movement) {
|
||||||
direction_preference = actor.type.decide_movement(actor, this);
|
direction_preference = actor.type.decide_movement(actor, this);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,13 +60,13 @@ function _define_force_floor(direction, opposite_type) {
|
|||||||
slide_automatically: true,
|
slide_automatically: true,
|
||||||
allow_player_override: true,
|
allow_player_override: true,
|
||||||
get_slide_direction(me, level, other) {
|
get_slide_direction(me, level, other) {
|
||||||
|
if (level.compat.force_floors_inert_on_first_tic && level.tic_counter === 0) {
|
||||||
|
// Lynx: Force floors don't push on the first tic
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return direction;
|
return direction;
|
||||||
},
|
},
|
||||||
force_floor_direction: direction,
|
force_floor_direction: direction,
|
||||||
on_arrive(me, level, other) {
|
|
||||||
// Necessary for compat.force_floor_only_on_arrive, which disables slide_automatically
|
|
||||||
level._set_tile_prop(other, 'is_pending_slide', true);
|
|
||||||
},
|
|
||||||
activate(me, level) {
|
activate(me, level) {
|
||||||
level.transmute_tile(me, opposite_type);
|
level.transmute_tile(me, opposite_type);
|
||||||
},
|
},
|
||||||
@ -983,16 +983,16 @@ const TILE_TYPES = {
|
|||||||
speed_factor: 2,
|
speed_factor: 2,
|
||||||
allow_player_override: true,
|
allow_player_override: true,
|
||||||
get_slide_direction(me, level, _other) {
|
get_slide_direction(me, level, _other) {
|
||||||
|
if (level.compat.force_floors_inert_on_first_tic && level.tic_counter === 0) {
|
||||||
|
// Lynx: Force floors don't push on the first tic
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return level.get_force_floor_direction();
|
return level.get_force_floor_direction();
|
||||||
},
|
},
|
||||||
blocks(me, level, other) {
|
blocks(me, level, other) {
|
||||||
return (level.compat.rff_blocks_monsters &&
|
return (level.compat.rff_blocks_monsters &&
|
||||||
(other.type.collision_mask & COLLISION.monster_typical));
|
(other.type.collision_mask & COLLISION.monster_typical));
|
||||||
},
|
},
|
||||||
on_arrive(me, level, other) {
|
|
||||||
// Necessary for compat.force_floor_only_on_arrive, which disables slide_automatically
|
|
||||||
level._set_tile_prop(other, 'is_pending_slide', true);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
slime: {
|
slime: {
|
||||||
layer: LAYERS.terrain,
|
layer: LAYERS.terrain,
|
||||||
@ -1528,6 +1528,11 @@ const TILE_TYPES = {
|
|||||||
level.attempt_out_of_turn_step(other, other.direction);
|
level.attempt_out_of_turn_step(other, other.direction);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
on_stand(me, level, other) {
|
||||||
|
if (level.compat.traps_like_lynx) {
|
||||||
|
level.attempt_out_of_turn_step(other, other.direction);
|
||||||
|
}
|
||||||
|
},
|
||||||
add_press_ready(me, level, other) {
|
add_press_ready(me, level, other) {
|
||||||
// Same as below, but without ejection
|
// Same as below, but without ejection
|
||||||
level._set_tile_prop(me, 'presses', (me.presses ?? 0) + 1);
|
level._set_tile_prop(me, 'presses', (me.presses ?? 0) + 1);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user