diff --git a/README.md b/README.md index b2756d1ed1..ce534d7c63 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ See [CONTRIBUTING](CONTRIBUTING.md). Bleeding-edge builds are generated automatically for every commit. You can see them [here](https://github.com/Anuken/MindustryBuilds/releases). If you'd rather compile on your own, follow these instructions. -First, make sure you have [JDK 16-17](https://adoptopenjdk.net/archive.html?variant=openjdk16&jvmVariant=hotspot) installed. **Other JDK versions will not work.** Open a terminal in the Mindustry directory and run the following commands: +First, make sure you have [JDK 16-17](https://adoptium.net/archive.html?variant=openjdk17&jvmVariant=hotspot) installed. **Other JDK versions will not work.** Open a terminal in the Mindustry directory and run the following commands: ### Windows diff --git a/core/src/mindustry/ai/Pathfinder.java b/core/src/mindustry/ai/Pathfinder.java index de447c3a59..9652c73d07 100644 --- a/core/src/mindustry/ai/Pathfinder.java +++ b/core/src/mindustry/ai/Pathfinder.java @@ -54,9 +54,9 @@ public class Pathfinder implements Runnable{ (PathTile.solid(tile) ? 5 : 0), //water - (team, tile) -> PathTile.solid(tile) || !PathTile.liquid(tile) ? 200 : 2 + + (team, tile) -> (PathTile.solid(tile) || !PathTile.liquid(tile) ? 6000 : 1) + (PathTile.nearGround(tile) || PathTile.nearSolid(tile) ? 14 : 0) + - (PathTile.deep(tile) ? -1 : 0) + + (PathTile.deep(tile) ? 0 : 1) + (PathTile.damages(tile) ? 35 : 0) ); diff --git a/core/src/mindustry/core/NetServer.java b/core/src/mindustry/core/NetServer.java index 39ddb35bb9..9a72f7ad51 100644 --- a/core/src/mindustry/core/NetServer.java +++ b/core/src/mindustry/core/NetServer.java @@ -757,6 +757,8 @@ public class NetServer implements ApplicationListener{ player.add(); + Events.fire(new PlayerConnectionConfirmed(player)); + if(player.con == null || player.con.hasConnected) return; player.con.hasConnected = true; diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index 7e515281bb..8836c6b5cd 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -359,8 +359,9 @@ public class BulletType extends Content implements Cloneable{ //home in on allies if possible if(healPercent > 0){ target = Units.closestTarget(null, b.x, b.y, homingRange, - e -> e.checkTarget(collidesAir, collidesGround) && e.team != b.team, - t -> collidesGround && (t.team != b.team || t.damaged())); + e -> e.checkTarget(collidesAir, collidesGround) && e.team != b.team && !b.hasCollided(e.id), + t -> collidesGround && (t.team != b.team || t.damaged()) && !b.hasCollided(t.id) + ); }else{ target = Units.closestTarget(b.team, b.x, b.y, homingRange, e -> e.checkTarget(collidesAir, collidesGround) && !b.hasCollided(e.id), t -> collidesGround && !b.hasCollided(t.id)); } diff --git a/core/src/mindustry/game/EventType.java b/core/src/mindustry/game/EventType.java index 452f07c3e6..26d7dcb740 100644 --- a/core/src/mindustry/game/EventType.java +++ b/core/src/mindustry/game/EventType.java @@ -480,7 +480,19 @@ public class EventType{ } } - /** Called after connecting; when a player receives world data and is ready to play.*/ + /** + * Called after player confirmed it has received world data and is ready to play. + * Note that if this is the first world receival, then player.con.hasConnected is false. + */ + public static class PlayerConnectionConfirmed{ + public final Player player; + + public PlayerConnectionConfirmed(Player player){ + this.player = player; + } + } + + /** Called after connecting; when a player receives world data and is ready to play. Fired only once, after initial connection. */ public static class PlayerJoin{ public final Player player; diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index 3ce9851aaf..0bcc17727e 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -696,9 +696,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ }); //flip rotation - if(x == (req.rotation % 2 == 0)){ - req.rotation = Mathf.mod(req.rotation + 2, 4); - } + req.block.flipRotation(req, x); }); } diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 0327c36ab0..167f7e8b4b 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -468,7 +468,7 @@ public class Block extends UnlockableContent{ if(hasItems && configurable){ bars.add("items", entity -> new Bar(() -> Core.bundle.format("bar.items", entity.items.total()), () -> Pal.items, () -> (float)entity.items.total() / itemCapacity)); } - + if(unitCapModifier != 0){ stats.add(Stat.maxUnits, (unitCapModifier < 0 ? "-" : "+") + Math.abs(unitCapModifier)); } @@ -824,7 +824,7 @@ public class Block extends UnlockableContent{ } clipSize = Math.max(clipSize, size * tilesize); - + //only kept to ensure compatibility with v6 mods. if(expanded){ clipSize += tilesize * 10f; @@ -989,4 +989,9 @@ public class Block extends UnlockableContent{ packer.add(PageType.editor, name + "-icon-editor", editorBase); } + public void flipRotation(BuildPlan req, boolean x){ + if(x == (req.rotation % 2 == 0)){ + req.rotation = Mathf.mod(req.rotation + 2, 4); + } + } }