mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-12-04 13:51:30 +00:00
Fix error when running out of power
This commit is contained in:
parent
ef5b38d67b
commit
5dc4b4eaae
1 changed files with 6 additions and 3 deletions
|
@ -870,9 +870,12 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
if (Decimal.lt(energy.value, 0)) {
|
if (Decimal.lt(energy.value, 0)) {
|
||||||
// Uh oh, time to de-power machines!
|
// Uh oh, time to de-power machines!
|
||||||
energy.value = 0;
|
energy.value = 0;
|
||||||
poweredMachines.forEach(machine => {
|
poweredMachines
|
||||||
(machine.value?.state as { powered: boolean }).powered = false;
|
.map(m => m.value)
|
||||||
});
|
.filter(machine => machine != null)
|
||||||
|
.forEach(machine => {
|
||||||
|
(machine?.state as { powered: boolean }).powered = false;
|
||||||
|
});
|
||||||
Object.values(portalNodes.value).forEach(portal => {
|
Object.values(portalNodes.value).forEach(portal => {
|
||||||
(portal.state as { powered: boolean }).powered = false;
|
(portal.state as { powered: boolean }).powered = false;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue