diff --git a/core/assets-raw/sprites/blocks/environment/ice-snow1.png b/core/assets-raw/sprites/blocks/environment/ice-snow1.png index ee593e9f64..d2010a0106 100644 Binary files a/core/assets-raw/sprites/blocks/environment/ice-snow1.png and b/core/assets-raw/sprites/blocks/environment/ice-snow1.png differ diff --git a/core/assets-raw/sprites/blocks/environment/ice-snow2.png b/core/assets-raw/sprites/blocks/environment/ice-snow2.png index a9ffcf1088..5a0d5458d4 100644 Binary files a/core/assets-raw/sprites/blocks/environment/ice-snow2.png and b/core/assets-raw/sprites/blocks/environment/ice-snow2.png differ diff --git a/core/assets-raw/sprites/blocks/environment/ice-snow3.png b/core/assets-raw/sprites/blocks/environment/ice-snow3.png index f38d778b29..4375ee7139 100644 Binary files a/core/assets-raw/sprites/blocks/environment/ice-snow3.png and b/core/assets-raw/sprites/blocks/environment/ice-snow3.png differ diff --git a/core/src/mindustry/ai/types/DefenderAI.java b/core/src/mindustry/ai/types/DefenderAI.java index 04cc59435d..f59b476add 100644 --- a/core/src/mindustry/ai/types/DefenderAI.java +++ b/core/src/mindustry/ai/types/DefenderAI.java @@ -2,7 +2,7 @@ package mindustry.ai.types; import arc.math.*; import mindustry.entities.*; -import mindustry.entities.Units.*; +import mindustry.entities.comp.*; import mindustry.entities.units.*; import mindustry.gen.*; import mindustry.world.meta.*; @@ -12,23 +12,29 @@ public class DefenderAI extends AIController{ @Override public void updateMovement(){ if(target != null){ - moveTo(target, unit.range(), 5f); + moveTo(target, (target instanceof Sized s ? s.hitSize()/2f * 1.1f : 0f) + unit.hitSize/2f + 15f, 50f); unit.lookAt(target); - }else{ - Teamc block = targetFlag(unit.x, unit.y, BlockFlag.rally, false); - if(block == null) block = unit.closestCore(); - moveTo(block, 60f); } } @Override protected void updateTargeting(){ - if(retarget()) target = findTarget(unit.x, unit.y, 0f, true, true); + 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){ - //Sort by max health and closer target. - return Units.closest(unit.team, x, y, u -> !u.dead() && u.type != unit.type, (u, tx, ty) -> -u.maxHealth + Mathf.dst2(u.x, u.y, tx, ty) / 800f); + //find unit to follow if not in rally mode + if(command() != UnitCommand.rally){ + //Sort by max health and closer target. + var result = Units.closest(unit.team, x, y, Math.max(range, 400f), u -> !u.dead() && u.type != unit.type, (u, tx, ty) -> -u.maxHealth + Mathf.dst2(u.x, u.y, tx, ty) / 800f); + if(result != null) return result; + } + + //find rally point + var block = targetFlag(unit.x, unit.y, BlockFlag.rally, false); + if(block != null) return block; + //return core if found + return unit.closestCore(); } } diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 7f4ae97766..ed966e869d 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -405,13 +405,14 @@ public class UnitTypes implements ContentList{ rotateSpeed = 1.6f; canDrown = false; mechFrontSway = 1f; + buildSpeed = 3f; mechStepParticles = true; mechStepShake = 0.15f; ammoType = AmmoTypes.powerHigh; - speed = 0.36f; - boostMultiplier = 2.1f; + speed = 0.38f; + boostMultiplier = 2.2f; engineOffset = 12f; engineSize = 6f; lowAltitude = true; diff --git a/core/src/mindustry/entities/Units.java b/core/src/mindustry/entities/Units.java index 0b0538adb6..49e33ec06b 100644 --- a/core/src/mindustry/entities/Units.java +++ b/core/src/mindustry/entities/Units.java @@ -266,20 +266,20 @@ public class Units{ return result; } - /** Returns the closest ally of this team using a custom comparison function. Filter by predicate. */ - public static Unit closest(Team team, float x, float y, Boolf predicate, Sortf sort){ + /** Returns the closest ally of this team in a range. Filter by predicate. */ + public static Unit closest(Team team, float x, float y, float range, Boolf predicate, Sortf sort){ result = null; cdist = 0f; - for(Unit e : Groups.unit){ - if(!predicate.get(e) || e.team() != team) continue; + nearby(team, x, y, range, e -> { + if(!predicate.get(e)) return; - float cost = sort.cost(e, x, y); - if(result == null || cost < cdist){ + float dist = sort.cost(e, x, y); + if(result == null || dist < cdist){ result = e; - cdist = cost; + cdist = dist; } - } + }); return result; }