From 23b431acae950e8d363faf72c6266c2a4dfe6eb6 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 16 May 2020 17:02:43 -0400 Subject: [PATCH] Sector fixes --- core/src/mindustry/core/Control.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index 4bdd36626f..b0a14daeba 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -109,14 +109,6 @@ public class Control implements ApplicationListener, Loadable{ Effects.shake(5, 6, Core.camera.position.x, Core.camera.position.y); //the restart dialog can show info for any number of scenarios Call.onGameOver(event.winner); - //TODO set meta to indicate game over - /* - if(state.rules.zone != null && !net.client()){ - //remove zone save on game over - if(saves.getZoneSlot() != null && !state.rules.tutorial){ - saves.getZoneSlot().delete(); - } - }*/ }); //autohost for pvp maps @@ -274,10 +266,22 @@ public class Control implements ApplicationListener, Loadable{ //if there is no base, simulate a new game and place the right loadout at the spawn position if(state.rules.defaultTeam.cores().isEmpty()){ + + //kill all friendly units, since they should be dead anwyay + for(Unitc unit : Groups.unit){ + if(unit.team() == state.rules.defaultTeam){ + unit.remove(); + } + } + Tile spawn = world.tile(sector.getSpawnPosition()); //TODO PLACE CORRECT LOADOUT Schematics.placeLoadout(Loadouts.advancedShard, spawn.x, spawn.y); + //set up camera/player locations + player.set(spawn.x * tilesize, spawn.y * tilesize); + camera.position.set(player); + Events.fire(Trigger.newGame); }