Mega repair AI
This commit is contained in:
@@ -12,14 +12,6 @@ public class FlyingAI extends AIController{
|
||||
|
||||
@Override
|
||||
public void updateMovement(){
|
||||
if(unit.moving()){
|
||||
unit.lookAt(unit.vel.angle());
|
||||
}
|
||||
|
||||
if(unit.isFlying()){
|
||||
unit.wobble();
|
||||
}
|
||||
|
||||
if(target != null && unit.hasWeapons() && command() == UnitCommand.attack){
|
||||
if(unit.type().weapons.first().rotate){
|
||||
moveTo(target, unit.range() * 0.8f);
|
||||
|
||||
@@ -15,14 +15,6 @@ public class MinerAI extends AIController{
|
||||
|
||||
@Override
|
||||
protected void updateMovement(){
|
||||
if(unit.moving()){
|
||||
unit.lookAt(unit.vel.angle());
|
||||
}
|
||||
|
||||
if(unit.isFlying()){
|
||||
unit.wobble();
|
||||
}
|
||||
|
||||
Building core = unit.closestCore();
|
||||
|
||||
if(!(unit instanceof Minerc) || core == null) return;
|
||||
|
||||
32
core/src/mindustry/ai/types/RepairAI.java
Normal file
32
core/src/mindustry/ai/types/RepairAI.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package mindustry.ai.types;
|
||||
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.world.blocks.ConstructBlock.*;
|
||||
|
||||
//note that repair AI doesn't attack anything even if it theoretically can
|
||||
public class RepairAI extends AIController{
|
||||
|
||||
@Override
|
||||
protected void updateMovement(){
|
||||
boolean shoot = false;
|
||||
|
||||
if(target != null){
|
||||
if(!target.within(unit, unit.type().range)){
|
||||
moveTo(target, unit.type().range * 0.9f);
|
||||
}else{
|
||||
unit.aim(target);
|
||||
shoot = true;
|
||||
}
|
||||
}
|
||||
|
||||
unit.controlWeapons(shoot);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateTargeting(){
|
||||
target = Units.findDamagedTile(unit.team, unit.x, unit.y);
|
||||
|
||||
if(target instanceof ConstructBuild) target = null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user