From 2df4dc582943154ebfd8ae067bf0a613416601cb Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Thu, 18 Nov 2021 18:39:46 +1100 Subject: [PATCH] fix 'blowing up electric floors doesn't remove the wiring' regression --- js/game.js | 6 ++++++ js/tiletypes.js | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/js/game.js b/js/game.js index 3e69630..f30e1f0 100644 --- a/js/game.js +++ b/js/game.js @@ -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); } @@ -2804,6 +2805,11 @@ export class Level extends LevelInterface { // to destroy it 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]; diff --git a/js/tiletypes.js b/js/tiletypes.js index 9f10185..4303337 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -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;