From e5fd2b67da6a9480a1b1ec91088053efa995ea59 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Sun, 7 Mar 2021 00:42:19 -0700 Subject: [PATCH] Make turntables eject their contents --- js/game.js | 2 ++ js/tiletypes.js | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/js/game.js b/js/game.js index fabf587..cba76b2 100644 --- a/js/game.js +++ b/js/game.js @@ -1930,6 +1930,8 @@ export class Level extends LevelInterface { // Curious special-case red teleporter behavior: if you pass through a wired but // inactive one, you keep sliding indefinitely. Players can override out of it, but // other actors cannot. (Normally, a teleport slide ends after one decision phase.) + // XXX this is useful when the exit is briefly blocked, but it can also get monsters + // stuck forever :( this.make_slide(actor, 'teleport-forever'); // Also, there's no sound and whatnot, so everything else is skipped outright. return; diff --git a/js/tiletypes.js b/js/tiletypes.js index 61783fe..d007cfe 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -713,16 +713,19 @@ const TILE_TYPES = { turntable_cw: { layer: LAYERS.terrain, wire_propagation_mode: 'all', + // Not actually a teleporter, but we use the same slide type + teleport_allow_override: true, on_begin(me, level) { update_wireable(me, level); }, on_arrive(me, level, other) { if (! me.is_active) return; - other.direction = DIRECTIONS[other.direction].right; + level.set_actor_direction(other, DIRECTIONS[other.direction].right); if (other.type.on_rotate) { other.type.on_rotate(other, level, 'right'); } + level.make_slide(other, 'teleport-forever'); }, on_power(me, level) { if (me.is_wired) { @@ -741,16 +744,19 @@ const TILE_TYPES = { turntable_ccw: { layer: LAYERS.terrain, wire_propagation_mode: 'all', + // Not actually a teleporter, but we use the same slide type + teleport_allow_override: true, on_begin(me, level) { update_wireable(me, level); }, on_arrive(me, level, other) { if (! me.is_active) return; - other.direction = DIRECTIONS[other.direction].left; + level.set_actor_direction(other, DIRECTIONS[other.direction].left); if (other.type.on_rotate) { other.type.on_rotate(other, level, 'left'); } + level.make_slide(other, 'teleport-forever'); }, on_power(me, level) { if (me.is_wired) { @@ -1569,7 +1575,7 @@ const TILE_TYPES = { me.arrows = 0; // bitmask of glowing arrows (visual, no gameplay impact) }, on_ready(me, level) { - me.arrows ??= 0; + me.arrows = me.arrows ?? 0; }, traps(me, actor) { return ! actor._clone_release;