Fixed load block command not arriving on target

This commit is contained in:
Anuken 2023-10-21 15:18:57 -04:00
parent e391434dc9
commit 3c6fc363f3
2 changed files with 5 additions and 2 deletions

View File

@ -29,6 +29,8 @@ public class UnitCommand extends MappableContent{
public boolean drawTarget = false;
/** Whether to reset targets when switching to or from this command. */
public boolean resetTarget = true;
/** */
public boolean exactArrival = false;
/** Key to press for this command. */
public @Nullable Binding keybind = null;
@ -101,6 +103,7 @@ public class UnitCommand extends MappableContent{
switchToMove = false;
drawTarget = true;
resetTarget = false;
exactArrival = true;
}};
unloadPayloadCommand = new UnitCommand("unloadPayload", "download", Binding.unit_command_unload_payload, null){{
switchToMove = false;

View File

@ -40,7 +40,7 @@ public class CommandAI extends AIController{
/** Stance, usually related to firing mode. */
public UnitStance stance = UnitStance.shoot;
/** Current command this unit is following. */
public @Nullable UnitCommand command;
public UnitCommand command = UnitCommand.moveCommand;
/** Current controller instance based on command. */
protected @Nullable AIController commandController;
/** Last command type assigned. Used for detecting command changes. */
@ -291,7 +291,7 @@ public class CommandAI extends AIController{
}
//reached destination, end pathfinding
if(attackTarget == null && unit.within(vecMovePos, Math.max(5f, unit.hitSize / 2f))){
if(attackTarget == null && unit.within(vecMovePos, command.exactArrival && commandQueue.size == 0 ? 1f : Math.max(5f, unit.hitSize / 2f))){
finishPath();
}