fix various Circuit Block cases

This commit is contained in:
Timothy Stiles 2021-02-15 15:37:03 +11:00
parent 3c6bff77d6
commit 1bd165ad35

View File

@ -529,6 +529,7 @@ export class Level extends LevelInterface {
this.connect_button(connectable); this.connect_button(connectable);
} }
this.force_next_wire_phase = false;
this.recalculate_circuitry(true); this.recalculate_circuitry(true);
// Finally, let all tiles do custom init behavior... but backwards, to match actor order // Finally, let all tiles do custom init behavior... but backwards, to match actor order
@ -674,7 +675,7 @@ export class Level extends LevelInterface {
continue; continue;
let circuit = { let circuit = {
is_powered: false, is_powered: first_time ? false : null,
tiles: new Map, tiles: new Map,
inputs: new Map, inputs: new Map,
}; };
@ -739,8 +740,14 @@ export class Level extends LevelInterface {
} }
this.wired_outputs = Array.from(wired_outputs); this.wired_outputs = Array.from(wired_outputs);
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)); 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) {
this.force_next_wire_phase = true;
}
} }
can_accept_input() { can_accept_input() {
// We can accept input anytime the player can move, i.e. when they're not already moving and // We can accept input anytime the player can move, i.e. when they're not already moving and
// not in an un-overrideable slide. // not in an un-overrideable slide.
@ -2012,8 +2019,14 @@ export class Level extends LevelInterface {
} }
} }
if (! any_changed) if (! any_changed) {
return; if (this.force_next_wire_phase) {
this.force_next_wire_phase = false;
}
else {
return;
}
}
for (let tile of this.wired_outputs) { for (let tile of this.wired_outputs) {
// This is only used within this function, no need to undo // This is only used within this function, no need to undo