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.
This commit is contained in:
Eevee (Evelyn Woods) 2021-03-07 18:05:55 -07:00
parent 59d26e6a00
commit db34ca72f9
3 changed files with 32 additions and 58 deletions

View File

@ -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);

View File

@ -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],

View File

@ -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';
},
},