mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-25 22:17:59 +07:00
Less aggressive AI pursuit
This commit is contained in:
parent
9def4b8d88
commit
2014d066e5
@ -228,7 +228,8 @@ public class RtsAI{
|
||||
if(defendPos != null){
|
||||
unit.command().commandPosition(defendPos);
|
||||
}else{
|
||||
unit.command().commandTarget(defendTarget == null ? build : defendTarget);
|
||||
//TODO stopAtTarget parameter could be false, could be tweaked
|
||||
unit.command().commandTarget(defendTarget == null ? build : defendTarget, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ public class CommandAI extends AIController{
|
||||
public @Nullable Vec2 targetPos;
|
||||
public @Nullable Teamc attackTarget;
|
||||
|
||||
private boolean stopAtTarget;
|
||||
private Vec2 lastTargetPos;
|
||||
private int pathId = -1;
|
||||
private Seq<Unit> local = new Seq<>(false);
|
||||
@ -86,6 +87,11 @@ public class CommandAI extends AIController{
|
||||
//calculateFlock().limit(unit.speed() * flockMult)
|
||||
}
|
||||
|
||||
//if stopAtTarget is set, stop trying to move to the target once it is reached - used for defending
|
||||
if(attackTarget != null && stopAtTarget && unit.within(attackTarget, engageRange - 1f)){
|
||||
attackTarget = null;
|
||||
}
|
||||
|
||||
if(unit.isFlying()){
|
||||
unit.lookAt(targetPos);
|
||||
}else{
|
||||
@ -194,8 +200,12 @@ public class CommandAI extends AIController{
|
||||
}
|
||||
|
||||
public void commandTarget(Teamc moveTo){
|
||||
//TODO
|
||||
commandTarget(moveTo, false);
|
||||
}
|
||||
|
||||
public void commandTarget(Teamc moveTo, boolean stopAtTarget){
|
||||
attackTarget = moveTo;
|
||||
this.stopAtTarget = stopAtTarget;
|
||||
pathId = Vars.controlPath.nextTargetId();
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import static mindustry.Vars.*;
|
||||
* general implementation:
|
||||
*
|
||||
* caching:
|
||||
* 1. create fixed-size float array fpr rendering into
|
||||
* 1. create fixed-size float array for rendering into
|
||||
* 2. for each chunk, cache each layer into buffer; record layer boundary indices (alternatively, create mesh per layer for fast recache)
|
||||
* 3. create mesh for this chunk based on buffer size, copy buffer into mesh
|
||||
*
|
||||
|
@ -25,4 +25,4 @@ org.gradle.caching=true
|
||||
#used for slow jitpack builds; TODO see if this actually works
|
||||
org.gradle.internal.http.socketTimeout=100000
|
||||
org.gradle.internal.http.connectionTimeout=100000
|
||||
archash=faf0ac24dd
|
||||
archash=f21eb00d2e
|
||||
|
Loading…
Reference in New Issue
Block a user