fix 'blowing up electric floors doesn't remove the wiring' regression

This commit is contained in:
Timothy Stiles 2021-11-18 18:39:46 +11:00
parent 42d543b235
commit 2df4dc5829
2 changed files with 8 additions and 2 deletions

View File

@ -2637,6 +2637,7 @@ export class Level extends LevelInterface {
return;
}
//only used for glass block atm
if (actor.type.on_death) {
actor.type.on_death(actor, this);
}
@ -2805,6 +2806,11 @@ export class Level extends LevelInterface {
return;
}
//only used for electrified floor atm
if (tile.type.on_death && !tile.type.is_actor) {
tile.type.on_death(tile, this);
}
let old_type = tile.type;
let new_type = TILE_TYPES[name];
if (old_type.layer !== new_type.layer) {

View File

@ -1278,7 +1278,7 @@ const TILE_TYPES = {
return other.cell.get_item() !== null && me.encased_item !== null;
},
on_death(me, level) {
//needs to be called by transmute_tile to ttl and by lit_dynamite before remove_tile
//needs to be called by transmute_tile to ttl and by dynamite_lit before remove_tile
if (me.encased_item !== null) {
level._place_dropped_item(me.encased_item, me.cell ?? me.previous_cell, me);
level._set_tile_prop(me, 'encased_item', null);
@ -1995,7 +1995,7 @@ const TILE_TYPES = {
level._set_tile_prop(me, 'is_active', false);
},
on_death(me, level) {
// FIXME i probably broke this lol
//needs to be called by transmute_tile to ttl and by dynamite_lit before remove_tile
//need to remove our wires since they're an implementation detail
level._set_tile_prop(me, 'wire_directions', 0);
level.recalculate_circuitry_next_wire_phase = true;