Merge branch 'master' into cleanup-2
This commit is contained in:
@@ -79,7 +79,7 @@ public class BuilderAI extends AIController{
|
||||
float dist = Math.min(cons.dst(unit) - buildingRange, 0);
|
||||
|
||||
//make sure you can reach the request in time
|
||||
if(dist / unit.type.speed < cons.buildCost * 0.9f){
|
||||
if(dist / unit.speed() < cons.buildCost * 0.9f){
|
||||
following = b;
|
||||
found = true;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class FlyingAI extends AIController{
|
||||
vec.setAngle(Mathf.slerpDelta(unit.vel().angle(), vec.angle(), 0.6f));
|
||||
}
|
||||
|
||||
vec.setLength(unit.type.speed);
|
||||
vec.setLength(unit.speed());
|
||||
|
||||
unit.moveAt(vec);
|
||||
}
|
||||
|
||||
@@ -2,17 +2,13 @@ package mindustry.ai.types;
|
||||
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.ai.formations.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.storage.CoreBlock.*;
|
||||
|
||||
public class FormationAI extends AIController implements FormationMember{
|
||||
private static Seq<Tile> tiles = new Seq<>();
|
||||
public Unit leader;
|
||||
|
||||
private Vec3 target = new Vec3();
|
||||
@@ -30,9 +26,8 @@ public class FormationAI extends AIController implements FormationMember{
|
||||
|
||||
@Override
|
||||
public void updateUnit(){
|
||||
UnitType type = unit.type;
|
||||
|
||||
if(leader.dead){
|
||||
if(leader == null || leader.dead){
|
||||
unit.resetController();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -104,9 +104,7 @@ public class LogicAI extends AIController{
|
||||
|
||||
//look where moving if there's nothing to aim at
|
||||
if(!shoot){
|
||||
if(unit.moving()){
|
||||
unit.lookAt(unit.vel().angle());
|
||||
}
|
||||
unit.lookAt(unit.prefRotation());
|
||||
}else if(unit.hasWeapons()){ //if there is, look at the object
|
||||
unit.lookAt(unit.mounts[0].aimX, unit.mounts[0].aimY);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class SuicideAI extends GroundAI{
|
||||
if(!blocked){
|
||||
moveToTarget = true;
|
||||
//move towards target directly
|
||||
unit.moveAt(vec.set(target).sub(unit).limit(unit.type.speed));
|
||||
unit.moveAt(vec.set(target).sub(unit).limit(unit.speed()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user