Beryllium floor ore

This commit is contained in:
Anuken
2022-02-18 15:40:17 -05:00
parent f9c0065a99
commit 406d2b949b
8 changed files with 24 additions and 6 deletions

View File

@@ -1,6 +1,8 @@
package mindustry.ai.types;
import arc.math.*;
import arc.math.geom.*;
import arc.struct.*;
import arc.util.*;
import mindustry.*;
import mindustry.ai.*;
@@ -9,12 +11,14 @@ import mindustry.gen.*;
import mindustry.world.*;
public class CommandAI extends AIController{
static Vec2 vecOut = new Vec2();
private static final float localInterval = 30f;
private static final Vec2 vecOut = new Vec2();
public @Nullable Vec2 targetPos;
public @Nullable Teamc attackTarget;
private int pathId = -1;
private Seq<Unit> local = new Seq<>(false);
@Override
public void updateUnit(){
@@ -26,6 +30,17 @@ public class CommandAI extends AIController{
targetPos = null;
}
if(targetPos != null){
if(timer.get(timerTarget3, localInterval)){
local.clear();
float size = unit.hitSize * 3f;
unit.team.data().tree().intersect(unit.x - size / 2f, unit.y - size/2f, size, size, local);
}
}else{
//make sure updates are staggered randomly
timer.reset(timerTarget3, Mathf.random(localInterval));
}
if(attackTarget != null){
if(targetPos == null) targetPos = new Vec2();
targetPos.set(attackTarget);