mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-09 20:29:06 +07:00
Made various fields/methods public
This commit is contained in:
parent
ada6ef229c
commit
e4742133ca
@ -87,7 +87,7 @@ public class Vars implements Loadable{
|
||||
public static final int maxNameLength = 40;
|
||||
/** displayed item size when ingame. */
|
||||
public static final float itemSize = 5f;
|
||||
/** units outside of this bound will die instantly */
|
||||
/** units outside this bound will die instantly */
|
||||
public static final float finalWorldBounds = 250;
|
||||
/** range for building */
|
||||
public static final float buildingRange = 220f;
|
||||
|
@ -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
|
||||
|
@ -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){
|
||||
|
@ -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)){
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -393,12 +393,6 @@ public class Fx{
|
||||
Lines.circle(e.x, e.y, 2f + e.finpow() * 7f);
|
||||
}),
|
||||
|
||||
healDenamic = new Effect(11, e -> {
|
||||
color(Pal.heal);
|
||||
stroke(e.fout() * 2f);
|
||||
Lines.circle(e.x, e.y, 2f + e.finpow() * e.rotation);
|
||||
}),
|
||||
|
||||
shieldWave = new Effect(22, e -> {
|
||||
color(e.color, 0.7f);
|
||||
stroke(e.fout() * 2f);
|
||||
@ -1000,7 +994,9 @@ public class Fx{
|
||||
float length = 20f * e.finpow();
|
||||
float size = 7f * e.fout();
|
||||
|
||||
rect(((Item)e.data).fullIcon, e.x + trnsx(e.rotation, length), e.y + trnsy(e.rotation, length), size, size);
|
||||
if(!(e.data instanceof Item item)) return;
|
||||
|
||||
rect(item.fullIcon, e.x + trnsx(e.rotation, length), e.y + trnsy(e.rotation, length), size, size);
|
||||
}),
|
||||
|
||||
shockwave = new Effect(10f, 80f, e -> {
|
||||
|
@ -19,7 +19,8 @@ import static mindustry.Vars.*;
|
||||
public class Effect{
|
||||
private static final float shakeFalloff = 10000f;
|
||||
private static final EffectContainer container = new EffectContainer();
|
||||
private static final Seq<Effect> all = new Seq<>();
|
||||
|
||||
public static final Seq<Effect> all = new Seq<>();
|
||||
|
||||
private boolean initialized;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -38,8 +38,8 @@ public class LaserTurret extends PowerTurret{
|
||||
}
|
||||
|
||||
public class LaserTurretBuild extends PowerTurretBuild{
|
||||
Bullet bullet;
|
||||
float bulletLife;
|
||||
public Bullet bullet;
|
||||
public float bulletLife;
|
||||
|
||||
@Override
|
||||
protected void updateCooling(){
|
||||
|
Loading…
Reference in New Issue
Block a user