This commit is contained in:
Anuken
2020-06-26 14:27:26 -04:00
parent eabc5c15c7
commit fdf7c88083
228 changed files with 1219 additions and 1163 deletions

View File

@@ -14,7 +14,7 @@ public class AIController implements UnitController{
protected static final Vec2 vec = new Vec2();
protected static final int timerTarget = 0;
protected Unitc unit;
protected Unit unit;
protected Teamc target;
protected Interval timer = new Interval(4);
@@ -23,12 +23,12 @@ public class AIController implements UnitController{
}
protected void targetClosestAllyFlag(BlockFlag flag){
Tile target = Geometry.findClosest(unit.x(), unit.y(), indexer.getAllied(unit.team(), flag));
Tile target = Geometry.findClosest(unit.x, unit.y, indexer.getAllied(unit.team, flag));
if(target != null) this.target = target.entity;
}
protected void targetClosestEnemyFlag(BlockFlag flag){
Tile target = Geometry.findClosest(unit.x(), unit.y(), indexer.getEnemy(unit.team(), flag));
Tile target = Geometry.findClosest(unit.x, unit.y, indexer.getEnemy(unit.team, flag));
if(target != null) this.target = target.entity;
}
@@ -37,7 +37,7 @@ public class AIController implements UnitController{
}
protected void targetClosest(){
Teamc newTarget = Units.closestTarget(unit.team(), unit.x(), unit.y(), Math.max(unit.range(), unit.type().range), u -> (unit.type().targetAir && u.isFlying()) || (unit.type().targetGround && !u.isFlying()));
Teamc newTarget = Units.closestTarget(unit.team, unit.x, unit.y, Math.max(unit.range(), unit.type().range), u -> (unit.type().targetAir && u.isFlying()) || (unit.type().targetGround && !u.isFlying()));
if(newTarget != null){
target = newTarget;
}
@@ -48,7 +48,7 @@ public class AIController implements UnitController{
}
@Override
public void unit(Unitc unit){
public void unit(Unit unit){
if(this.unit == unit) return;
this.unit = unit;
@@ -56,7 +56,7 @@ public class AIController implements UnitController{
}
@Override
public Unitc unit(){
public Unit unit(){
return unit;
}
}

View File

@@ -3,8 +3,8 @@ package mindustry.entities.units;
import mindustry.gen.*;
public interface UnitController{
void unit(Unitc unit);
Unitc unit();
void unit(Unit unit);
Unit unit();
default void command(UnitCommand command){
@@ -14,11 +14,11 @@ public interface UnitController{
}
default void removed(Unitc unit){
default void removed(Unit unit){
}
default boolean isBeingControlled(Unitc player){
default boolean isBeingControlled(Unit player){
return false;
}
}