This commit is contained in:
Anuken
2019-09-25 13:55:31 -04:00
parent 4c244e836b
commit 29bf181a08

View File

@@ -35,6 +35,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
protected static final int timerShootLeft = timerIndex++; protected static final int timerShootLeft = timerIndex++;
protected static final int timerShootRight = timerIndex++; protected static final int timerShootRight = timerIndex++;
protected boolean loaded;
protected UnitType type; protected UnitType type;
protected Interval timer = new Interval(5); protected Interval timer = new Interval(5);
protected StateMachine state = new StateMachine(); protected StateMachine state = new StateMachine();
@@ -338,7 +339,9 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
public void added(){ public void added(){
state.set(getStartState()); state.set(getStartState());
health(maxHealth()); if(!loaded){
health(maxHealth());
}
if(isCommanded()){ if(isCommanded()){
onCommand(getCommand()); onCommand(getCommand());
@@ -375,6 +378,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
@Override @Override
public void readSave(DataInput stream, byte version) throws IOException{ public void readSave(DataInput stream, byte version) throws IOException{
super.readSave(stream, version); super.readSave(stream, version);
loaded = true;
byte type = stream.readByte(); byte type = stream.readByte();
this.spawner = stream.readInt(); this.spawner = stream.readInt();