From 4943759cd39f8b4c6a8934c5b1c7095655fd0753 Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Tue, 16 Feb 2021 13:06:45 +1100 Subject: [PATCH] wireables wire/unwire whenever circuitry recalculates e.g. move a circuit block pointing to a transmogrifier: the transmogrifier stops moving unless it's powered move it away: it goes back to always-on behaviour --- js/game.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/js/game.js b/js/game.js index 42cbe4f..81680d9 100644 --- a/js/game.js +++ b/js/game.js @@ -743,6 +743,19 @@ export class Level extends LevelInterface { this.wired_outputs.sort((a, b) => this.coords_to_scalar(a.cell.x, a.cell.y) - this.coords_to_scalar(b.cell.x, b.cell.y)); if (!first_time) { + //update wireables + for (var i = 0; i < this.width; ++i) + { + for (var j = 0; j < this.height; ++j) + { + let terrain = this.cell(i, j).get_terrain(); + if (terrain.is_wired !== undefined) + { + terrain.type.on_begin(terrain, this); + } + } + } + this.force_next_wire_phase = true; if (!undoing) { this._push_pending_undo(() => this.undid_past_recalculate_circuitry = true);