From 576f0be4ab191c18bf916f7cf86143e358b7f973 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 29 Jun 2019 11:02:27 -0400 Subject: [PATCH] Fixed incorrect game-overs on zone attack maps --- core/src/io/anuke/mindustry/core/Logic.java | 11 ++++++++++- core/src/io/anuke/mindustry/type/Zone.java | 3 ++- .../io/anuke/mindustry/ui/fragments/HudFragment.java | 8 ++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/core/src/io/anuke/mindustry/core/Logic.java b/core/src/io/anuke/mindustry/core/Logic.java index b4a2fd9b76..1e398ceb8b 100644 --- a/core/src/io/anuke/mindustry/core/Logic.java +++ b/core/src/io/anuke/mindustry/core/Logic.java @@ -15,6 +15,7 @@ import io.anuke.mindustry.game.EventType.*; import io.anuke.mindustry.game.*; import io.anuke.mindustry.game.Teams.TeamData; import io.anuke.mindustry.gen.BrokenBlock; +import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.world.Block; @@ -130,8 +131,13 @@ public class Logic implements ApplicationListener{ } if(alive != null && !state.gameOver){ + if(world.isZone() && alive == defaultTeam){ + //in attack maps, a victorious game over is equivalent to a launch + Call.launchZone(); + }else{ + Events.fire(new GameOverEvent(alive)); + } state.gameOver = true; - Events.fire(new GameOverEvent(alive)); } } } @@ -154,6 +160,9 @@ public class Logic implements ApplicationListener{ world.removeBlock(tile); } state.launched = true; + state.gameOver = true; + //manually fire game over event now + Events.fire(new GameOverEvent(defaultTeam)); }); } diff --git a/core/src/io/anuke/mindustry/type/Zone.java b/core/src/io/anuke/mindustry/type/Zone.java index f0e936ae72..4dc4b95f7b 100644 --- a/core/src/io/anuke/mindustry/type/Zone.java +++ b/core/src/io/anuke/mindustry/type/Zone.java @@ -121,7 +121,8 @@ public class Zone extends UnlockableContent{ /** Whether this zone has met its condition; if true, the player can leave. */ public boolean metCondition(){ - return state.wave >= conditionWave; + //players can't leave in attack mode. + return state.wave >= conditionWave && !state.rules.attackMode; } public boolean canConfigure(){ diff --git a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java index 4941a731c9..ef1093f733 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java @@ -359,10 +359,10 @@ public class HudFragment extends Fragment{ button.getStyle().disabledFontColor = Color.WHITE; button.margin(16f); button.visible(() -> - world.isZone() && - world.getZone().metCondition() && - !Net.client() && - state.wave % world.getZone().launchPeriod == 0 && !world.spawner.isSpawning()); + world.isZone() && + world.getZone().metCondition() && + !Net.client() && + state.wave % world.getZone().launchPeriod == 0 && !world.spawner.isSpawning()); button.update(() -> { if(world.getZone() == null){