New avert sprite / Fixed loading of CommandAI positions

This commit is contained in:
Anuken
2022-04-06 10:37:26 -04:00
parent cf25836d76
commit 047c284e48
5 changed files with 13 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -98,8 +98,8 @@ public class CommandAI extends AIController{
}else if(local.size > 1){ }else if(local.size > 1){
int count = 0; int count = 0;
for(var near : local){ for(var near : local){
//has arrived //has arrived - no current command, but last one is equal
if(near.isCommandable() && !near.command().hasCommand() && targetPos.equals(near.command().lastTargetPos)){ if(near.isCommandable() && !near.command().hasCommand() && targetPos.epsilonEquals(near.command().lastTargetPos, 0.001f)){
count ++; count ++;
} }
} }
@@ -181,6 +181,11 @@ public class CommandAI extends AIController{
return targetPos != null; return targetPos != null;
} }
public void setupLastPos(){
lastTargetPos = targetPos;
}
public void commandPosition(Vec2 pos){ public void commandPosition(Vec2 pos){
targetPos = pos; targetPos = pos;
lastTargetPos = pos; lastTargetPos = pos;

View File

@@ -3149,8 +3149,9 @@ public class UnitTypes{
itemCapacity = 0; itemCapacity = 0;
setEnginesMirror( setEnginesMirror(
new UnitEngine(34 / 4f, 31 / 4f, 3f, 45f), //new UnitEngine(34 / 4f, 31 / 4f, 3f, 45f),
new UnitEngine(35 / 4f, -38 / 4f, 3f, 315f) new UnitEngine(35 / 4f, -38 / 4f, 3f, 315f),
new UnitEngine(39 / 4f, -16 / 4f, 3f, 315f)
); );
weapons.add(new Weapon("avert-weapon"){{ weapons.add(new Weapon("avert-weapon"){{

View File

@@ -490,6 +490,7 @@ public class TypeIO{
}else{ }else{
ai.targetPos = null; ai.targetPos = null;
} }
ai.setupLastPos();
if(hasAttack){ if(hasAttack){
byte entityType = read.b(); byte entityType = read.b();

View File

@@ -518,8 +518,8 @@ public class Block extends UnlockableContent implements Senseable{
addBar("liquid-" + liq.name, entity -> new Bar( addBar("liquid-" + liq.name, entity -> new Bar(
() -> liq.localizedName, () -> liq.localizedName,
liq::barColor, liq::barColor,
() -> entity.liquids.get(liq) / liquidCapacity) () -> entity.liquids.get(liq) / liquidCapacity
); ));
} }
/** Adds a liquid bar that dynamically displays a liquid type. */ /** Adds a liquid bar that dynamically displays a liquid type. */