diff --git a/core/src/mindustry/ai/types/FormationAI.java b/core/src/mindustry/ai/types/FormationAI.java index 8a4f351b4e..49ca55c68b 100644 --- a/core/src/mindustry/ai/types/FormationAI.java +++ b/core/src/mindustry/ai/types/FormationAI.java @@ -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)); diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 37a5775124..2067c328db 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -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){ diff --git a/core/src/mindustry/world/blocks/logic/LogicBlock.java b/core/src/mindustry/world/blocks/logic/LogicBlock.java index 8a74a1d575..e37492de30 100644 --- a/core/src/mindustry/world/blocks/logic/LogicBlock.java +++ b/core/src/mindustry/world/blocks/logic/LogicBlock.java @@ -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(){ - } - } }