Made various fields/methods public

This commit is contained in:
Anuken
2021-08-17 17:23:02 -04:00
parent ada6ef229c
commit e4742133ca
12 changed files with 47 additions and 50 deletions

View File

@@ -16,9 +16,9 @@ public class BuilderAI extends AIController{
public static float buildRadius = 1500, retreatDst = 110f, fleeRange = 370f, retreatDelay = Time.toSeconds * 2f;
boolean found = false;
float retreatTimer;
@Nullable Unit following;
@Nullable Teamc enemy;
float retreatTimer;
@Nullable BlockPlan lastPlan;
@Override

View File

@@ -21,12 +21,12 @@ public class DefenderAI extends AIController{
}
@Override
protected void updateTargeting(){
public void updateTargeting(){
if(retarget()) target = findTarget(unit.x, unit.y, unit.range(), true, true);
}
@Override
protected Teamc findTarget(float x, float y, float range, boolean air, boolean ground){
public Teamc findTarget(float x, float y, float range, boolean air, boolean ground){
//find unit to follow if not in rally mode
if(command() != UnitCommand.rally){

View File

@@ -32,7 +32,7 @@ public class FlyingAI extends AIController{
}
@Override
protected Teamc findTarget(float x, float y, float range, boolean air, boolean ground){
public Teamc findTarget(float x, float y, float range, boolean air, boolean ground){
var result = findMainTarget(x, y, range, air, ground);
//if the main target is in range, use it, otherwise target whatever is closest
@@ -40,7 +40,7 @@ public class FlyingAI extends AIController{
}
@Override
protected Teamc findMainTarget(float x, float y, float range, boolean air, boolean ground){
public Teamc findMainTarget(float x, float y, float range, boolean air, boolean ground){
var core = targetFlag(x, y, BlockFlag.core, true);
if(core != null && Mathf.within(x, y, core.getX(), core.getY(), range)){

View File

@@ -44,7 +44,7 @@ public class LogicAI extends AIController{
private ObjectSet<Object> radars = new ObjectSet<>();
@Override
protected void updateMovement(){
public void updateMovement(){
if(itemTimer >= 0) itemTimer -= Time.delta;
if(payTimer >= 0) payTimer -= Time.delta;
@@ -114,7 +114,7 @@ public class LogicAI extends AIController{
}
@Override
protected void moveTo(Position target, float circleLength, float smooth){
public void moveTo(Position target, float circleLength, float smooth){
if(target == null) return;
vec.set(target).sub(unit);
@@ -141,29 +141,29 @@ public class LogicAI extends AIController{
}
@Override
protected boolean checkTarget(Teamc target, float x, float y, float range){
public boolean checkTarget(Teamc target, float x, float y, float range){
return false;
}
//always retarget
@Override
protected boolean retarget(){
public boolean retarget(){
return true;
}
@Override
protected boolean invalid(Teamc target){
public boolean invalid(Teamc target){
return false;
}
@Override
protected boolean shouldShoot(){
public boolean shouldShoot(){
return shoot && !(unit.type.canBoost && boost);
}
//always aim for the main target
@Override
protected Teamc target(float x, float y, float range, boolean air, boolean ground){
public Teamc target(float x, float y, float range, boolean air, boolean ground){
return switch(aimControl){
case target -> posTarget;
case targetp -> mainTarget;

View File

@@ -14,7 +14,7 @@ public class MinerAI extends AIController{
Tile ore;
@Override
protected void updateMovement(){
public void updateMovement(){
Building core = unit.closestCore();
if(!(unit.canMine()) || core == null) return;

View File

@@ -13,7 +13,7 @@ public class RepairAI extends AIController{
float retreatTimer;
@Override
protected void updateMovement(){
public void updateMovement(){
if(target instanceof Building){
boolean shoot = false;
@@ -56,7 +56,7 @@ public class RepairAI extends AIController{
}
@Override
protected void updateTargeting(){
public void updateTargeting(){
Building target = Units.findDamagedTile(unit.team, unit.x, unit.y);
if(target instanceof ConstructBuild) target = null;

View File

@@ -111,7 +111,7 @@ public class SuicideAI extends GroundAI{
}
@Override
protected Teamc target(float x, float y, float range, boolean air, boolean ground){
public Teamc target(float x, float y, float range, boolean air, boolean ground){
return Units.closestTarget(unit.team, x, y, range, u -> u.checkTarget(air, ground), t -> ground &&
!(t.block instanceof Conveyor || t.block instanceof Conduit)); //do not target conveyors/conduits
}