Make turntables eject their contents

This commit is contained in:
Eevee (Evelyn Woods) 2021-03-07 00:42:19 -07:00
parent 0be59c21eb
commit e5fd2b67da
2 changed files with 11 additions and 3 deletions

View File

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

View File

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