mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-10 02:37:12 +07:00
Save building enabled state
This commit is contained in:
parent
462a5b941e
commit
0a5a301573
@ -46,7 +46,7 @@ public class FormationAI extends AIController implements FormationMember{
|
||||
unit.lookAt(unit.vel.angle());
|
||||
}
|
||||
|
||||
Vec2 realtarget = vec.set(target).add(leader.vel.x, leader.vel.y);
|
||||
Vec2 realtarget = vec.set(target).add(leader.vel);
|
||||
|
||||
float speed = unit.realSpeed() * unit.floorSpeedMultiplier() * Time.delta;
|
||||
unit.approach(Mathf.arrive(unit.x, unit.y, realtarget.x, realtarget.y, unit.vel, speed, 0f, speed, 1f).scl(1f / Time.delta));
|
||||
|
@ -147,7 +147,8 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
write.f(health);
|
||||
write.b(rotation | 0b10000000);
|
||||
write.b(team.id);
|
||||
write.b(0); //extra padding for later use
|
||||
write.b(1); //version
|
||||
write.b(enabled ? 1 : 0);
|
||||
if(items != null) items.write(write);
|
||||
if(power != null) power.write(write);
|
||||
if(liquids != null) liquids.write(write);
|
||||
@ -162,7 +163,14 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
rotation = rot & 0b01111111;
|
||||
boolean legacy = true;
|
||||
if((rot & 0b10000000) != 0){
|
||||
read.b(); //padding
|
||||
byte ver = read.b(); //version of entity save
|
||||
if(ver == 1){
|
||||
byte on = read.b();
|
||||
this.enabled = on == 1;
|
||||
if(!this.enabled){
|
||||
enabledControlTime = timeToUncontrol;
|
||||
}
|
||||
}
|
||||
legacy = false;
|
||||
}
|
||||
|
||||
@ -1376,7 +1384,8 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
timeScale = 1f;
|
||||
}
|
||||
|
||||
if(block.autoResetEnabled){
|
||||
if(!enabled && block.autoResetEnabled){
|
||||
noSleep();
|
||||
enabledControlTime -= Time.delta;
|
||||
|
||||
if(enabledControlTime <= 0){
|
||||
|
@ -529,7 +529,6 @@ public class LogicBlock extends Block{
|
||||
read.b(bytes);
|
||||
readCompressed(bytes, false);
|
||||
}else{
|
||||
|
||||
code = read.str();
|
||||
links.clear();
|
||||
short total = read.s();
|
||||
@ -568,17 +567,4 @@ public class LogicBlock extends Block{
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static class LogicConfig{
|
||||
public String code;
|
||||
public IntSeq connections;
|
||||
|
||||
public LogicConfig(String code, IntSeq connections){
|
||||
this.code = code;
|
||||
this.connections = connections;
|
||||
}
|
||||
|
||||
public LogicConfig(){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user