This commit is contained in:
Anuken
2024-04-15 17:20:48 -04:00
parent 8eb6a1068b
commit b8c6781004
4 changed files with 18 additions and 4 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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;

View File

@@ -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){