From adb7264bc4745894eaab3897232681f17f9a4450 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 16 May 2025 14:14:09 -0400 Subject: [PATCH 1/4] Fixed #10815 --- .../src/mindustry/server/ServerControl.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/server/src/mindustry/server/ServerControl.java b/server/src/mindustry/server/ServerControl.java index 6dea071c9f..453c73e9a4 100644 --- a/server/src/mindustry/server/ServerControl.java +++ b/server/src/mindustry/server/ServerControl.java @@ -381,24 +381,28 @@ public class ServerControl implements ApplicationListener{ } }else{ result = maps.getShuffleMode().next(preset, state.map); - info("Randomized next map to be @.", result.plainName()); + if(result != null){ + info("Randomized next map to be @.", result.plainName()); + } } info("Loading map..."); logic.reset(); - lastMode = preset; - Core.settings.put("lastServerMode", lastMode.name()); - try{ - world.loadMap(result, result.applyRules(lastMode)); - state.rules = result.applyRules(preset); - logic.play(); + if(result != null){ + lastMode = preset; + Core.settings.put("lastServerMode", lastMode.name()); + try{ + world.loadMap(result, result.applyRules(lastMode)); + state.rules = result.applyRules(preset); + logic.play(); - info("Map loaded."); + info("Map loaded."); - netServer.openServer(); - }catch(MapException e){ - err("@: @", e.map.plainName(), e.getMessage()); + netServer.openServer(); + }catch(MapException e){ + err("@: @", e.map.plainName(), e.getMessage()); + } } }); From 5bcaff0694a630e3b1a174d5b9a081f6bc2f4d59 Mon Sep 17 00:00:00 2001 From: ity Date: Sat, 17 May 2025 02:17:32 +0800 Subject: [PATCH 2/4] Update InputHandler.java (#10813) --- core/src/mindustry/input/InputHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index 05424e8a1f..4fc380d240 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -606,7 +606,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ @Remote(targets = Loc.client, called = Loc.server) public static void dropItem(Player player, float angle){ - if(player == null) return; + if(player == null || player.unit() == null) return; if(net.server() && player.unit().stack.amount <= 0){ throw new ValidateException(player, "Player cannot drop an item."); From 11db431e95b97c290f110fa979bb401ce0ed45ae Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 16 May 2025 14:23:50 -0400 Subject: [PATCH 3/4] Fixed #10812 --- core/src/mindustry/type/Weather.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/src/mindustry/type/Weather.java b/core/src/mindustry/type/Weather.java index e70e0af9af..0800964bca 100644 --- a/core/src/mindustry/type/Weather.java +++ b/core/src/mindustry/type/Weather.java @@ -22,6 +22,7 @@ import static mindustry.Vars.*; public class Weather extends UnlockableContent{ /** Global random variable used for rendering. */ public static final Rand rand = new Rand(); + private static final float boundMax = 10000 * 8f; /** Default duration of this weather event in ticks. */ public float duration = 10f * Time.toMinutes; @@ -129,8 +130,8 @@ public class Weather extends UnlockableContent{ float scl = rand.random(0.5f, 1f); float scl2 = rand.random(0.5f, 1f); float size = rand.random(sizeMin, sizeMax); - float x = (rand.random(0f, world.unitWidth()) + Time.time * windx * scl2); - float y = (rand.random(0f, world.unitHeight()) + Time.time * windy * scl); + float x = (rand.random(0f, boundMax) + Time.time * windx * scl2); + float y = (rand.random(0f, boundMax) + Time.time * windy * scl); float alpha = rand.random(minAlpha, maxAlpha); float rotation = randomParticleRotation ? rand.random(0f, 360f) : 0f; @@ -168,8 +169,8 @@ public class Weather extends UnlockableContent{ float scl = rand.random(0.5f, 1f); float scl2 = rand.random(0.5f, 1f); float size = rand.random(sizeMin, sizeMax); - float x = (rand.random(0f, world.unitWidth()) + Time.time * xspeed * scl2); - float y = (rand.random(0f, world.unitHeight()) - Time.time * yspeed * scl); + float x = (rand.random(0f, boundMax) + Time.time * xspeed * scl2); + float y = (rand.random(0f, boundMax) - Time.time * yspeed * scl); float tint = rand.random(1f) * alpha; x -= Tmp.r1.x; @@ -202,8 +203,8 @@ public class Weather extends UnlockableContent{ int pos = (int)((time)); float life = time % 1f; - float x = (rand.random(0f, world.unitWidth()) + pos*953); - float y = (rand.random(0f, world.unitHeight()) - pos*453); + float x = (rand.random(0f, boundMax) + pos*953); + float y = (rand.random(0f, boundMax) - pos*453); x -= Tmp.r1.x; y -= Tmp.r1.y; From 0a046f8fa5abe4fb1797f802ce5fb7f91c330e85 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 17 May 2025 10:33:45 -0400 Subject: [PATCH 4/4] Don't show mining stances for wall ores when irrelevant --- core/src/mindustry/type/UnitType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 071c5f923b..6fa30baea5 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -601,7 +601,7 @@ public class UnitType extends UnlockableContent implements Senseable{ if(unit.controller() instanceof CommandAI ai && ai.currentCommand() == UnitCommand.mineCommand){ out.add(UnitStance.mineAuto); for(Item item : indexer.getAllPresentOres()){ - if(unit.canMine(item)){ + if(unit.canMine(item) && ((mineFloor && indexer.hasOre(item)) || (mineWalls && indexer.hasWallOre(item)))){ var itemStance = ItemUnitStance.getByItem(item); if(itemStance != null){ out.add(itemStance);