Skip to content

Commit

Permalink
Fixed Anuken#9750
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed Apr 15, 2024
1 parent 8eb6a10 commit b8c6781
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/src/mindustry/world/blocks/power/PowerGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void draw(){

@Override
public float warmup(){
return productionEfficiency;
return enabled ? productionEfficiency : 0f;
}

@Override
Expand Down Expand Up @@ -154,7 +154,7 @@ public float ambientVolume(){

@Override
public float getPowerProduction(){
return powerProduction * productionEfficiency;
return enabled ? powerProduction * productionEfficiency : 0f;
}

@Override
Expand Down
5 changes: 5 additions & 0 deletions core/src/mindustry/world/blocks/power/ThermalGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ public void updateTile(){
}
}

@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);
Expand Down
9 changes: 9 additions & 0 deletions core/src/mindustry/world/blocks/sandbox/PowerSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,20 @@ public PowerSource(String name){
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;
Expand Down
4 changes: 2 additions & 2 deletions core/src/mindustry/world/blocks/units/UnitAssembler.java
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,12 @@ public void updateTile(){
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){
Expand Down

0 comments on commit b8c6781

Please sign in to comment.