From db34ca72f9c03bbd60c7fe14d168f0b7aee33bf0 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Sun, 7 Mar 2021 18:05:55 -0700 Subject: [PATCH] Make turntables slide actors out of them and toggle on edge flip Also fix the default display of unpowered tiles while I'm in here. --- js/game.js | 10 +++++++++ js/tileset.js | 24 ++++++++------------- js/tiletypes.js | 56 ++++++++++++------------------------------------- 3 files changed, 32 insertions(+), 58 deletions(-) diff --git a/js/game.js b/js/game.js index cba76b2..49e2d7c 100644 --- a/js/game.js +++ b/js/game.js @@ -1159,6 +1159,10 @@ export class Level extends LevelInterface { if (actor.pending_push) { this._set_tile_prop(actor, 'pending_push', null); } + // Turntable slide wears off after a single /attempted/ move + if (actor.slide_mode === 'turntable') { + this.make_slide(actor, null); + } // Actor is allowed to move, so do so let success = this.attempt_step(actor, direction); @@ -1719,6 +1723,12 @@ export class Level extends LevelInterface { } attempt_out_of_turn_step(actor, direction, frameskip = 0) { + if (actor.slide_mode === 'turntable') { + // Something is (e.g.) pushing a block that just landed on a turntable and is waiting to + // slide out of it. Ignore the push direction and move in its current direction; + // otherwise a player will push a block straight through, then turn, which sucks + direction = actor.direction; + } let success = this.attempt_step(actor, direction, frameskip); if (success) { this._do_extra_cooldown(actor); diff --git a/js/tileset.js b/js/tileset.js index 3e259ab..bcfcdd9 100644 --- a/js/tileset.js +++ b/js/tileset.js @@ -1274,7 +1274,7 @@ export const LL_TILESET_LAYOUT = { swivel_nw: [7, 14], dash_floor: { __special__: 'animated', - duration: 16, + duration: 24, all: [[0, 15], [1, 15], [2, 15], [3, 15], [4, 15], [5, 15], [6, 15], [7, 15]], }, @@ -1415,26 +1415,20 @@ export const LL_TILESET_LAYOUT = { __special__: 'wires', base: [0, 2], wired: { - __special__: 'visual-state', - active: { - __special__: 'animated', - duration: 16, - all: [[8, 21], [9, 21], [10, 21], [11, 21]], - }, - inactive: [8, 21], + __special__: 'animated', + duration: 12, + cc2_duration: 16, + all: [[8, 21], [9, 21], [10, 21], [11, 21]], } }, turntable_ccw: { __special__: 'wires', base: [0, 2], wired: { - __special__: 'visual-state', - active: { - __special__: 'animated', - duration: 16, - all: [[8, 22], [9, 22], [10, 22], [11, 22]], - }, - inactive: [8, 22], + __special__: 'animated', + duration: 12, + cc2_duration: 16, + all: [[8, 22], [9, 22], [10, 22], [11, 22]], } }, flame_jet_off: [12, 21], diff --git a/js/tiletypes.js b/js/tiletypes.js index 4911205..569b151 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -713,64 +713,34 @@ 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; 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'); + level.make_slide(other, 'turntable'); }, - on_power(me, level) { - if (me.is_wired) { - level._set_tile_prop(me, 'is_active', true); - } - }, - on_depower(me, level) { - if (me.is_wired) { - level._set_tile_prop(me, 'is_active', false); - } - }, - visual_state(me) { - return ! me || me.is_active ? 'active' : 'inactive'; + activate(me, level) { + level.transmute_tile(me, 'turntable_ccw'); }, + on_gray_button: activate_me, + on_power: activate_me, }, 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; 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'); + level.make_slide(other, 'turntable'); }, - on_power(me, level) { - if (me.is_wired) { - level._set_tile_prop(me, 'is_active', true); - } - }, - on_depower(me, level) { - if (me.is_wired) { - level._set_tile_prop(me, 'is_active', false); - } - }, - visual_state(me) { - return ! me || me.is_active ? 'active' : 'inactive'; + activate(me, level) { + level.transmute_tile(me, 'turntable_cw'); }, + on_gray_button: activate_me, + on_power: activate_me, }, // Hazards @@ -1738,7 +1708,7 @@ const TILE_TYPES = { } }, visual_state(me) { - return ! me || me.is_active ? 'active' : 'inactive'; + return me && me.is_active === false ? 'inactive' : 'active'; }, }, teleport_blue: { @@ -1876,7 +1846,7 @@ const TILE_TYPES = { } }, visual_state(me) { - return ! me || me.is_active ? 'active' : 'inactive'; + return me && me.is_active === false ? 'inactive' : 'active'; }, }, teleport_green: { @@ -2006,7 +1976,7 @@ const TILE_TYPES = { level.recalculate_circuitry_next_wire_phase = true; }, visual_state(me) { - return ! me || me.is_active ? 'active' : 'inactive'; + return me && me.is_active === false ? 'inactive' : 'active'; }, },