diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index bcb64901f8..9b3a8136b5 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1563,6 +1563,7 @@ lenum.len = Length of vector. lenum.sin = Sine, in degrees. lenum.cos = Cosine, in degrees. lenum.tan = Tangent, in degrees. +#not a typo, look up 'range notation' lenum.rand = Random number in range [0, value). lenum.log = Natural logarithm (ln). lenum.log10 = Base 10 logarithm. diff --git a/core/assets/maps/mudFlats.msav b/core/assets/maps/mudFlats.msav index 1ba2e25ceb..adca422b83 100644 Binary files a/core/assets/maps/mudFlats.msav and b/core/assets/maps/mudFlats.msav differ diff --git a/core/src/mindustry/ai/BlockIndexer.java b/core/src/mindustry/ai/BlockIndexer.java index 683d04cc78..ca945b67a9 100644 --- a/core/src/mindustry/ai/BlockIndexer.java +++ b/core/src/mindustry/ai/BlockIndexer.java @@ -269,7 +269,6 @@ public class BlockIndexer{ public Building findTile(Team team, float x, float y, float range, Boolf pred, boolean usePriority){ Building closest = null; float dst = 0; - float range2 = range * range; for(int rx = Math.max((int)((x - range) / tilesize / quadrantSize), 0); rx <= (int)((x + range) / tilesize / quadrantSize) && rx < quadWidth(); rx++){ for(int ry = Math.max((int)((y - range) / tilesize / quadrantSize), 0); ry <= (int)((y + range) / tilesize / quadrantSize) && ry < quadHeight(); ry++){ @@ -282,13 +281,13 @@ public class BlockIndexer{ if(e == null || e.team != team || !pred.get(e) || !e.block.targetable || e.team == Team.derelict) continue; - float ndst = e.dst2(x, y); - if(ndst < range2 && (closest == null || + float bdst = e.dst(x, y) - e.hitSize() / 2f; + if(bdst < range && (closest == null || //this one is closer, and it is at least of equal priority - (ndst < dst && (!usePriority || closest.block.priority.ordinal() <= e.block.priority.ordinal())) || + (bdst < dst && (!usePriority || closest.block.priority.ordinal() <= e.block.priority.ordinal())) || //priority is used, and new block has higher priority regardless of range (usePriority && closest.block.priority.ordinal() < e.block.priority.ordinal()))){ - dst = ndst; + dst = bdst; closest = e; } } diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index e73ffc89db..e9f8abf2a4 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -2047,6 +2047,7 @@ public class Blocks implements ContentList{ hasPower = true; consumes.power(10f); buildCostMultiplier = 0.5f; + health = size * size * 80; }}; //endregion campaign diff --git a/core/src/mindustry/entities/Units.java b/core/src/mindustry/entities/Units.java index cd602327a6..3d73faebd6 100644 --- a/core/src/mindustry/entities/Units.java +++ b/core/src/mindustry/entities/Units.java @@ -6,6 +6,7 @@ import arc.math.geom.*; import arc.struct.*; import mindustry.annotations.Annotations.*; import mindustry.content.*; +import mindustry.entities.comp.*; import mindustry.game.*; import mindustry.game.Teams.*; import mindustry.gen.*; @@ -93,7 +94,7 @@ public class Units{ * @return whether the target is invalid */ public static boolean invalidateTarget(Posc target, Team team, float x, float y, float range){ - return target == null || (range != Float.MAX_VALUE && !target.within(x, y, range)) || (target instanceof Teamc && ((Teamc)target).team() == team) || (target instanceof Healthc && !((Healthc)target).isValid()); + return target == null || (range != Float.MAX_VALUE && !target.within(x, y, range + (target instanceof Sized hb ? hb.hitSize()/2f : 0f))) || (target instanceof Teamc t && t.team() == team) || (target instanceof Healthc h && !h.isValid()); } /** See {@link #invalidateTarget(Posc, Team, float, float, float)} */ @@ -217,7 +218,7 @@ public class Units{ cdist = 0f; nearbyEnemies(team, x - range, y - range, range*2f, range*2f, e -> { - if(e.dead() || !predicate.get(e) || !e.within(x, y, range)) return; + if(e.dead() || !predicate.get(e) || !e.within(x, y, range + e.hitSize/2f)) return; float cost = sort.cost(e, x, y); if(result == null || cost < cdist){ @@ -292,7 +293,7 @@ public class Units{ /** Iterates over all units in a circle around this position. */ public static void nearby(Team team, float x, float y, float radius, Cons cons){ nearby(team, x - radius, y - radius, radius*2f, radius*2f, unit -> { - if(unit.within(x, y, radius)){ + if(unit.within(x, y, radius + unit.hitSize/2f)){ cons.get(unit); } }); diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 747defe555..b368d060e0 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -43,7 +43,7 @@ import static mindustry.Vars.*; @EntityDef(value = {Buildingc.class}, isFinal = false, genio = false, serialize = false) @Component(base = true) -abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, QuadTreeObject, Displayable, Senseable, Controllable{ +abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, QuadTreeObject, Displayable, Senseable, Controllable, Sized{ //region vars and initialization static final float timeToSleep = 60f * 1, timeToUncontrol = 60f * 6; static final ObjectSet tmpTiles = new ObjectSet<>(); @@ -1277,6 +1277,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, return tile.build == self() && !dead(); } + @Override + public float hitSize(){ + return tile.block().size * tilesize; + } + @Replace @Override public void kill(){ diff --git a/core/src/mindustry/entities/comp/HitboxComp.java b/core/src/mindustry/entities/comp/HitboxComp.java index f44270ebed..82576686fe 100644 --- a/core/src/mindustry/entities/comp/HitboxComp.java +++ b/core/src/mindustry/entities/comp/HitboxComp.java @@ -8,7 +8,7 @@ import mindustry.annotations.Annotations.*; import mindustry.gen.*; @Component -abstract class HitboxComp implements Posc, QuadTreeObject{ +abstract class HitboxComp implements Posc, Sized, QuadTreeObject{ @Import float x, y; transient float lastX, lastY, deltaX, deltaY, hitSize; @@ -28,6 +28,11 @@ abstract class HitboxComp implements Posc, QuadTreeObject{ updateLastPosition(); } + @Override + public float hitSize(){ + return hitSize; + } + void getCollisions(Cons consumer){ } diff --git a/core/src/mindustry/entities/comp/Sized.java b/core/src/mindustry/entities/comp/Sized.java new file mode 100644 index 0000000000..5fd73efa42 --- /dev/null +++ b/core/src/mindustry/entities/comp/Sized.java @@ -0,0 +1,5 @@ +package mindustry.entities.comp; + +public interface Sized{ + float hitSize(); +} diff --git a/gradle.properties b/gradle.properties index fbe236418e..88888d07c9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=8b6d59e004463585b333c8cda9ea91dd66f3bcee +archash=5b04a94d53e279e3af3a2654978fff5ab16e7cb8 diff --git a/ios/robovm.xml b/ios/robovm.xml index e792b258a8..c82b246fad 100644 --- a/ios/robovm.xml +++ b/ios/robovm.xml @@ -2,7 +2,6 @@ ${app.executable} ${app.mainclass} ios - thumbv7 ios Info.plist.xml