mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-26 06:22:17 -08:00
Merge branch 'master' of https://github.com/Anuken/Mindustry into adjacent-campaign-sectors
This commit is contained in:
commit
b64dc0badd
4 changed files with 24 additions and 19 deletions
|
|
@ -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.");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue