diff --git a/core/src/mindustry/world/blocks/power/PowerGenerator.java b/core/src/mindustry/world/blocks/power/PowerGenerator.java index fb77b987a1..9b0ef63732 100644 --- a/core/src/mindustry/world/blocks/power/PowerGenerator.java +++ b/core/src/mindustry/world/blocks/power/PowerGenerator.java @@ -102,7 +102,7 @@ public class PowerGenerator extends PowerDistributor{ @Override public float warmup(){ - return productionEfficiency; + return enabled ? productionEfficiency : 0f; } @Override @@ -154,7 +154,7 @@ public class PowerGenerator extends PowerDistributor{ @Override public float getPowerProduction(){ - return powerProduction * productionEfficiency; + return enabled ? powerProduction * productionEfficiency : 0f; } @Override diff --git a/core/src/mindustry/world/blocks/power/ThermalGenerator.java b/core/src/mindustry/world/blocks/power/ThermalGenerator.java index 9195205a9f..9c71e77ca8 100644 --- a/core/src/mindustry/world/blocks/power/ThermalGenerator.java +++ b/core/src/mindustry/world/blocks/power/ThermalGenerator.java @@ -88,6 +88,11 @@ public class ThermalGenerator extends PowerGenerator{ } } + @Override + public float totalProgress(){ + return enabled ? super.totalProgress() : 0f; + } + @Override public void drawLight(){ Drawf.light(x, y, (40f + Mathf.absin(10f, 5f)) * Math.min(productionEfficiency, 2f) * size, Color.scarlet, 0.4f); diff --git a/core/src/mindustry/world/blocks/sandbox/PowerSource.java b/core/src/mindustry/world/blocks/sandbox/PowerSource.java index 3a8685bb5e..0e011c9bac 100644 --- a/core/src/mindustry/world/blocks/sandbox/PowerSource.java +++ b/core/src/mindustry/world/blocks/sandbox/PowerSource.java @@ -11,11 +11,20 @@ public class PowerSource extends PowerNode{ maxNodes = 100; outputsPower = true; consumesPower = false; + drawDisabled = true; //TODO maybe don't? envEnabled = Env.any; } public class PowerSourceBuild extends PowerNodeBuild{ + @Override + public void onProximityUpdate(){ + super.onProximityUpdate(); + if(!allowUpdate()){ + enabled = false; + } + } + @Override public float getPowerProduction(){ return enabled ? powerProduction : 0f; diff --git a/core/src/mindustry/world/blocks/units/UnitAssembler.java b/core/src/mindustry/world/blocks/units/UnitAssembler.java index f77f2119ac..2d2a40115e 100644 --- a/core/src/mindustry/world/blocks/units/UnitAssembler.java +++ b/core/src/mindustry/world/blocks/units/UnitAssembler.java @@ -373,12 +373,12 @@ public class UnitAssembler extends PayloadBlock{ units.clear(); } - float powerStatus = power == null ? 1f : power.status; + float powerStatus = !enabled ? 0f : power == null ? 1f : power.status; powerWarmup = Mathf.lerpDelta(powerStatus, powerStatus > 0.0001f ? 1f : 0f, 0.1f); droneWarmup = Mathf.lerpDelta(droneWarmup, units.size < dronesCreated ? powerStatus : 0f, 0.1f); totalDroneProgress += droneWarmup * delta(); - if(units.size < dronesCreated && (droneProgress += delta() * state.rules.unitBuildSpeed(team) * powerStatus / droneConstructTime) >= 1f){ + if(units.size < dronesCreated && enabled && (droneProgress += delta() * state.rules.unitBuildSpeed(team) * powerStatus / droneConstructTime) >= 1f){ if(!net.client()){ var unit = droneType.create(team); if(unit instanceof BuildingTetherc bt){