Merge branch 'master' of https://github.com/Anuken/Mindustry into adjacent-campaign-sectors

This commit is contained in:
Anuken
2025-05-18 15:42:42 -04:00
4 changed files with 24 additions and 19 deletions

View File

@@ -606,7 +606,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
@Remote(targets = Loc.client, called = Loc.server) @Remote(targets = Loc.client, called = Loc.server)
public static void dropItem(Player player, float angle){ 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){ if(net.server() && player.unit().stack.amount <= 0){
throw new ValidateException(player, "Player cannot drop an item."); throw new ValidateException(player, "Player cannot drop an item.");

View File

@@ -601,7 +601,7 @@ public class UnitType extends UnlockableContent implements Senseable{
if(unit.controller() instanceof CommandAI ai && ai.currentCommand() == UnitCommand.mineCommand){ if(unit.controller() instanceof CommandAI ai && ai.currentCommand() == UnitCommand.mineCommand){
out.add(UnitStance.mineAuto); out.add(UnitStance.mineAuto);
for(Item item : indexer.getAllPresentOres()){ 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); var itemStance = ItemUnitStance.getByItem(item);
if(itemStance != null){ if(itemStance != null){
out.add(itemStance); out.add(itemStance);

View File

@@ -22,6 +22,7 @@ import static mindustry.Vars.*;
public class Weather extends UnlockableContent{ public class Weather extends UnlockableContent{
/** Global random variable used for rendering. */ /** Global random variable used for rendering. */
public static final Rand rand = new Rand(); public static final Rand rand = new Rand();
private static final float boundMax = 10000 * 8f;
/** Default duration of this weather event in ticks. */ /** Default duration of this weather event in ticks. */
public float duration = 10f * Time.toMinutes; public float duration = 10f * Time.toMinutes;
@@ -129,8 +130,8 @@ public class Weather extends UnlockableContent{
float scl = rand.random(0.5f, 1f); float scl = rand.random(0.5f, 1f);
float scl2 = rand.random(0.5f, 1f); float scl2 = rand.random(0.5f, 1f);
float size = rand.random(sizeMin, sizeMax); float size = rand.random(sizeMin, sizeMax);
float x = (rand.random(0f, world.unitWidth()) + Time.time * windx * scl2); float x = (rand.random(0f, boundMax) + Time.time * windx * scl2);
float y = (rand.random(0f, world.unitHeight()) + Time.time * windy * scl); float y = (rand.random(0f, boundMax) + Time.time * windy * scl);
float alpha = rand.random(minAlpha, maxAlpha); float alpha = rand.random(minAlpha, maxAlpha);
float rotation = randomParticleRotation ? rand.random(0f, 360f) : 0f; 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 scl = rand.random(0.5f, 1f);
float scl2 = rand.random(0.5f, 1f); float scl2 = rand.random(0.5f, 1f);
float size = rand.random(sizeMin, sizeMax); float size = rand.random(sizeMin, sizeMax);
float x = (rand.random(0f, world.unitWidth()) + Time.time * xspeed * scl2); float x = (rand.random(0f, boundMax) + Time.time * xspeed * scl2);
float y = (rand.random(0f, world.unitHeight()) - Time.time * yspeed * scl); float y = (rand.random(0f, boundMax) - Time.time * yspeed * scl);
float tint = rand.random(1f) * alpha; float tint = rand.random(1f) * alpha;
x -= Tmp.r1.x; x -= Tmp.r1.x;
@@ -202,8 +203,8 @@ public class Weather extends UnlockableContent{
int pos = (int)((time)); int pos = (int)((time));
float life = time % 1f; float life = time % 1f;
float x = (rand.random(0f, world.unitWidth()) + pos*953); float x = (rand.random(0f, boundMax) + pos*953);
float y = (rand.random(0f, world.unitHeight()) - pos*453); float y = (rand.random(0f, boundMax) - pos*453);
x -= Tmp.r1.x; x -= Tmp.r1.x;
y -= Tmp.r1.y; y -= Tmp.r1.y;

View File

@@ -381,12 +381,15 @@ public class ServerControl implements ApplicationListener{
} }
}else{ }else{
result = maps.getShuffleMode().next(preset, state.map); result = maps.getShuffleMode().next(preset, state.map);
if(result != null){
info("Randomized next map to be @.", result.plainName()); info("Randomized next map to be @.", result.plainName());
} }
}
info("Loading map..."); info("Loading map...");
logic.reset(); logic.reset();
if(result != null){
lastMode = preset; lastMode = preset;
Core.settings.put("lastServerMode", lastMode.name()); Core.settings.put("lastServerMode", lastMode.name());
try{ try{
@@ -400,6 +403,7 @@ public class ServerControl implements ApplicationListener{
}catch(MapException e){ }catch(MapException e){
err("@: @", e.map.plainName(), e.getMessage()); err("@: @", e.map.plainName(), e.getMessage());
} }
}
}); });
handler.register("maps", "[all/custom/default]", "Display available maps. Displays only custom maps by default.", arg -> { handler.register("maps", "[all/custom/default]", "Display available maps. Displays only custom maps by default.", arg -> {