This commit is contained in:
Anuken
2022-02-14 00:36:17 -05:00
parent ff7e87b33d
commit a274fe3047
2 changed files with 20 additions and 6 deletions

View File

@@ -1779,10 +1779,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
timeScale = 1f;
}
if(!allowUpdate()){
enabled = false;
}
//TODO unacceptable overhead?
if(!enabled && block.autoResetEnabled){
noSleep();
@@ -1793,6 +1789,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
}
}
if(!allowUpdate()){
enabled = false;
}
//TODO separate system for sound? AudioSource, etc
if(!headless){
if(sound != null){

View File

@@ -17,6 +17,7 @@ import mindustry.entities.units.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.logic.*;
import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.*;
@@ -34,7 +35,7 @@ public class UnitAssembler extends PayloadBlock{
public int areaSize = 11;
public UnitType droneType = UnitTypes.assemblyDrone;
public int dronesCreated = 4;
public float droneConstructTime = 60f * 3f;
public float droneConstructTime = 60f * 4f;
public Seq<AssemblerUnitPlan> plans = new Seq<>(4);
@@ -312,9 +313,16 @@ public class UnitAssembler extends PayloadBlock{
units.removeAll(u -> !u.isAdded() || u.dead || !(u.controller() instanceof AssemblerAI));
//unsupported
if(!allowUpdate()){
progress = 0f;
units.each(Unit::kill);
units.clear();
}
powerWarmup = Mathf.lerpDelta(powerWarmup, efficiency() > 0.0001f ? 1f : 0f, 0.1f);
droneWarmup = Mathf.lerpDelta(droneWarmup, units.size < dronesCreated ? efficiency() : 0f, 0.1f);
totalDroneProgress += droneWarmup * Time.delta;
totalDroneProgress += droneWarmup * delta();
if(units.size < dronesCreated && (droneProgress += edelta() / droneConstructTime) >= 1f){
if(!net.client()){
@@ -516,6 +524,12 @@ public class UnitAssembler extends PayloadBlock{
Fx.payloadDeposit.at(payload.x(), payload.y(), rot, new YeetData(spawn.cpy(), payload.block()));
}
@Override
public double sense(LAccess sensor){
if(sensor == LAccess.progress) return progress;
return super.sense(sensor);
}
@Override
public BlockSeq getBlockPayloads(){
return blocks;