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

@@ -46,19 +46,19 @@ public class AIController implements UnitController{
}
@Nullable
protected AIController fallback(){
public AIController fallback(){
return null;
}
protected boolean useFallback(){
public boolean useFallback(){
return false;
}
protected UnitCommand command(){
public UnitCommand command(){
return unit.team.data().command;
}
protected void updateVisuals(){
public void updateVisuals(){
if(unit.isFlying()){
unit.wobble();
@@ -66,21 +66,21 @@ public class AIController implements UnitController{
}
}
protected void updateMovement(){
public void updateMovement(){
}
protected void updateTargeting(){
public void updateTargeting(){
if(unit.hasWeapons()){
updateWeapons();
}
}
protected boolean invalid(Teamc target){
public boolean invalid(Teamc target){
return Units.invalidateTarget(target, unit.team, unit.x, unit.y);
}
protected void pathfind(int pathTarget){
public void pathfind(int pathTarget){
int costType = unit.pathType();
Tile tile = unit.tileOn();
@@ -92,7 +92,7 @@ public class AIController implements UnitController{
unit.moveAt(vec.trns(unit.angleTo(targetTile.worldx(), targetTile.worldy()), unit.speed()));
}
protected void updateWeapons(){
public void updateWeapons(){
float rotation = unit.rotation - 90;
boolean ret = retarget();
@@ -146,45 +146,45 @@ public class AIController implements UnitController{
}
}
protected boolean checkTarget(Teamc target, float x, float y, float range){
public boolean checkTarget(Teamc target, float x, float y, float range){
return Units.invalidateTarget(target, unit.team, x, y, range);
}
protected boolean shouldShoot(){
public boolean shouldShoot(){
return true;
}
protected Teamc targetFlag(float x, float y, BlockFlag flag, boolean enemy){
public Teamc targetFlag(float x, float y, BlockFlag flag, boolean enemy){
if(unit.team == Team.derelict) return null;
Tile target = Geometry.findClosest(x, y, enemy ? indexer.getEnemy(unit.team, flag) : indexer.getAllied(unit.team, flag));
return target == null ? null : target.build;
}
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);
}
protected boolean retarget(){
public boolean retarget(){
return timer.get(timerTarget, target == null ? 40 : 90);
}
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){
return findTarget(x, y, range, air, ground);
}
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){
return target(x, y, range, air, ground);
}
protected void init(){
public void init(){
}
protected @Nullable Tile getClosestSpawner(){
public @Nullable Tile getClosestSpawner(){
return Geometry.findClosest(unit.x, unit.y, Vars.spawner.getSpawns());
}
protected void unloadPayloads(){
public void unloadPayloads(){
if(unit instanceof Payloadc pay && pay.hasPayload() && target instanceof Building && pay.payloads().peek() instanceof UnitPayload){
if(target.within(unit, Math.max(unit.type().range + 1f, 75f))){
pay.dropLastPayload();
@@ -192,11 +192,11 @@ public class AIController implements UnitController{
}
}
protected void circle(Position target, float circleLength){
public void circle(Position target, float circleLength){
circle(target, circleLength, unit.speed());
}
protected void circle(Position target, float circleLength, float speed){
public void circle(Position target, float circleLength, float speed){
if(target == null) return;
vec.set(target).sub(unit);
@@ -210,11 +210,11 @@ public class AIController implements UnitController{
unit.moveAt(vec);
}
protected void moveTo(Position target, float circleLength){
public void moveTo(Position target, float circleLength){
moveTo(target, circleLength, 100f);
}
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);