diff --git a/core/src/mindustry/Vars.java b/core/src/mindustry/Vars.java index dbd8e9cc42..4d5042ad68 100644 --- a/core/src/mindustry/Vars.java +++ b/core/src/mindustry/Vars.java @@ -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; diff --git a/core/src/mindustry/ai/types/BuilderAI.java b/core/src/mindustry/ai/types/BuilderAI.java index 3f171df120..1152361a38 100644 --- a/core/src/mindustry/ai/types/BuilderAI.java +++ b/core/src/mindustry/ai/types/BuilderAI.java @@ -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 diff --git a/core/src/mindustry/ai/types/DefenderAI.java b/core/src/mindustry/ai/types/DefenderAI.java index 3f7915e68e..528f2baec2 100644 --- a/core/src/mindustry/ai/types/DefenderAI.java +++ b/core/src/mindustry/ai/types/DefenderAI.java @@ -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){ diff --git a/core/src/mindustry/ai/types/FlyingAI.java b/core/src/mindustry/ai/types/FlyingAI.java index db5ae84dab..225ace963d 100644 --- a/core/src/mindustry/ai/types/FlyingAI.java +++ b/core/src/mindustry/ai/types/FlyingAI.java @@ -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)){ diff --git a/core/src/mindustry/ai/types/LogicAI.java b/core/src/mindustry/ai/types/LogicAI.java index d33d5ad372..25809d7a3a 100644 --- a/core/src/mindustry/ai/types/LogicAI.java +++ b/core/src/mindustry/ai/types/LogicAI.java @@ -44,7 +44,7 @@ public class LogicAI extends AIController{ private ObjectSet 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; diff --git a/core/src/mindustry/ai/types/MinerAI.java b/core/src/mindustry/ai/types/MinerAI.java index 64bddbd5f0..1c1a564c38 100644 --- a/core/src/mindustry/ai/types/MinerAI.java +++ b/core/src/mindustry/ai/types/MinerAI.java @@ -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; diff --git a/core/src/mindustry/ai/types/RepairAI.java b/core/src/mindustry/ai/types/RepairAI.java index 23feb2a0eb..4879f673c8 100644 --- a/core/src/mindustry/ai/types/RepairAI.java +++ b/core/src/mindustry/ai/types/RepairAI.java @@ -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; diff --git a/core/src/mindustry/ai/types/SuicideAI.java b/core/src/mindustry/ai/types/SuicideAI.java index 8f2a04c2dc..1db94b95b0 100644 --- a/core/src/mindustry/ai/types/SuicideAI.java +++ b/core/src/mindustry/ai/types/SuicideAI.java @@ -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 } diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index 10c64ac923..03ce1e64e4 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -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 -> { diff --git a/core/src/mindustry/entities/Effect.java b/core/src/mindustry/entities/Effect.java index 492ab9af0f..f2bc5e95d5 100644 --- a/core/src/mindustry/entities/Effect.java +++ b/core/src/mindustry/entities/Effect.java @@ -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 all = new Seq<>(); + + public static final Seq all = new Seq<>(); private boolean initialized; diff --git a/core/src/mindustry/entities/units/AIController.java b/core/src/mindustry/entities/units/AIController.java index 0af7565424..583691adaa 100644 --- a/core/src/mindustry/entities/units/AIController.java +++ b/core/src/mindustry/entities/units/AIController.java @@ -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); diff --git a/core/src/mindustry/world/blocks/defense/turrets/LaserTurret.java b/core/src/mindustry/world/blocks/defense/turrets/LaserTurret.java index 704cb6f5d5..299b457388 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/LaserTurret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/LaserTurret.java @@ -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(){