diff --git a/core/src/io/anuke/mindustry/core/Logic.java b/core/src/io/anuke/mindustry/core/Logic.java index d5f60f9d32..1904b713b5 100644 --- a/core/src/io/anuke/mindustry/core/Logic.java +++ b/core/src/io/anuke/mindustry/core/Logic.java @@ -7,6 +7,7 @@ import io.anuke.arc.Events; import io.anuke.arc.collection.ObjectSet.ObjectSetIterator; import io.anuke.arc.util.Time; import io.anuke.mindustry.content.Fx; +import io.anuke.mindustry.content.Items; import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.entities.*; import io.anuke.mindustry.entities.type.Player; @@ -15,7 +16,6 @@ import io.anuke.mindustry.game.EventType.*; import io.anuke.mindustry.game.*; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.type.Item; -import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.world.Tile; import static io.anuke.mindustry.Vars.*; @@ -66,9 +66,7 @@ public class Logic implements ApplicationListener{ for(Team team : Team.all){ if(state.teams.isActive(team)){ for(Tile core : state.teams.get(team).cores){ - for(ItemStack stack : state.rules.startingItems){ - core.entity.items.add(stack.item, stack.amount); - } + core.entity.items.add(Items.copper, 200); } } } diff --git a/core/src/io/anuke/mindustry/editor/MapView.java b/core/src/io/anuke/mindustry/editor/MapView.java index 68bef8dec8..a332dd3adc 100644 --- a/core/src/io/anuke/mindustry/editor/MapView.java +++ b/core/src/io/anuke/mindustry/editor/MapView.java @@ -183,8 +183,7 @@ public class MapView extends Element implements GestureListener{ public void act(float delta){ super.act(delta); - if(Core.scene.getKeyboardFocus() == null || !(Core.scene.getKeyboardFocus() instanceof TextField) && - !Core.input.keyDown(KeyCode.CONTROL_LEFT)){ + if(Core.scene.getKeyboardFocus() == null || !(Core.scene.getKeyboardFocus() instanceof TextField) && !Core.input.keyDown(KeyCode.CONTROL_LEFT)){ float ax = Core.input.axis(Binding.move_x); float ay = Core.input.axis(Binding.move_y); offsetx -= ax * 15f / zoom; diff --git a/core/src/io/anuke/mindustry/game/Rules.java b/core/src/io/anuke/mindustry/game/Rules.java index 90b6521a55..63babc963b 100644 --- a/core/src/io/anuke/mindustry/game/Rules.java +++ b/core/src/io/anuke/mindustry/game/Rules.java @@ -2,9 +2,7 @@ package io.anuke.mindustry.game; import io.anuke.annotations.Annotations.Serialize; import io.anuke.arc.collection.Array; -import io.anuke.mindustry.content.Items; import io.anuke.mindustry.io.JsonIO; -import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.Zone; /** @@ -65,8 +63,6 @@ public class Rules{ public boolean attackMode = false; /** Whether this is the editor gamemode. */ public boolean editor = false; - /** Items that the player starts with here. Not applicable to zones.*/ - public Array startingItems = Array.with(new ItemStack(Items.copper, 200)); /** Copies this ruleset exactly. Not very efficient at all, do not use often. */ public Rules copy(){ diff --git a/core/src/io/anuke/mindustry/io/JsonIO.java b/core/src/io/anuke/mindustry/io/JsonIO.java index bb3a642a66..3c1ce9520c 100644 --- a/core/src/io/anuke/mindustry/io/JsonIO.java +++ b/core/src/io/anuke/mindustry/io/JsonIO.java @@ -12,7 +12,6 @@ public class JsonIO{ private static Json json = new Json(){{ setIgnoreUnknownFields(true); setElementType(Rules.class, "spawns", SpawnGroup.class); - setElementType(Rules.class, "startingItems", ItemStack.class); setSerializer(Zone.class, new Serializer(){ @Override diff --git a/core/src/io/anuke/mindustry/net/CrashSender.java b/core/src/io/anuke/mindustry/net/CrashSender.java index 89a38ed5a5..11bb870905 100644 --- a/core/src/io/anuke/mindustry/net/CrashSender.java +++ b/core/src/io/anuke/mindustry/net/CrashSender.java @@ -100,19 +100,25 @@ public class CrashSender{ ex(() -> value.addChild("os", new JsonValue(System.getProperty("os.name")))); ex(() -> value.addChild("trace", new JsonValue(parseException(exception)))); + boolean[] sent = {false}; + Log.info("Sending crash report."); //post to crash report URL Net.http(Vars.crashReportURL, "POST", value.toJson(OutputType.json), r -> { Log.info("Crash sent successfully."); + sent[0] = true; System.exit(1); }, t -> { t.printStackTrace(); + sent[0] = true; System.exit(1); }); - //sleep for 10 seconds or until crash report is sent + //sleep until report is sent try{ - Thread.sleep(10000); + while(!sent[0]){ + Thread.sleep(30); + } }catch(InterruptedException ignored){ } }catch(Throwable death){ diff --git a/core/src/io/anuke/mindustry/world/blocks/units/MechPad.java b/core/src/io/anuke/mindustry/world/blocks/units/MechPad.java index 8f521349b6..b3effe50ed 100644 --- a/core/src/io/anuke/mindustry/world/blocks/units/MechPad.java +++ b/core/src/io/anuke/mindustry/world/blocks/units/MechPad.java @@ -72,10 +72,12 @@ public class MechPad extends Block{ if(entity.player == null) return; Mech mech = ((MechPad)tile.block()).mech; + boolean resetSpawner = !entity.sameMech && entity.player.mech == mech; entity.player.mech = !entity.sameMech && entity.player.mech == mech ? Mechs.starter : mech; entity.progress = 0; entity.player.onRespawn(tile); + if(resetSpawner) entity.player.lastSpawner = null; entity.player = null; }