From 1fe5055a960f2f4d0402a8c0f621d0e745a08f75 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 17 Aug 2025 10:22:22 -0400 Subject: [PATCH] Fixed #11144 --- core/src/mindustry/core/Control.java | 6 +++++- core/src/mindustry/core/GameState.java | 2 ++ core/src/mindustry/ui/dialogs/GameOverDialog.java | 1 + core/src/mindustry/ui/dialogs/PausedDialog.java | 2 +- core/src/mindustry/ui/fragments/HudFragment.java | 5 +++++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index 5e72549a30..90bf9be3c6 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -675,10 +675,14 @@ public class Control implements ApplicationListener, Loadable{ state.set(State.playing); } - if(!net.client() && Core.input.keyTap(Binding.pause) && !renderer.isCutscene() && !scene.hasDialog() && !scene.hasKeyboard() && !ui.restart.isShown() && (state.is(State.paused) || state.is(State.playing))){ + if(!net.client() && Core.input.keyTap(Binding.pause) && !(state.isCampaign() && state.afterGameOver) && !renderer.isCutscene() && !scene.hasDialog() && !scene.hasKeyboard() && !ui.restart.isShown() && (state.is(State.paused) || state.is(State.playing))){ state.set(state.isPaused() ? State.playing : State.paused); } + if(state.isCampaign() && state.afterGameOver){ + state.set(State.paused); + } + if(Core.input.keyTap(Binding.menu) && !ui.restart.isShown() && !ui.minimapfrag.shown()){ if(ui.chatfrag.shown()){ ui.chatfrag.hide(); diff --git a/core/src/mindustry/core/GameState.java b/core/src/mindustry/core/GameState.java index 1066e6d2a6..1058c84de0 100644 --- a/core/src/mindustry/core/GameState.java +++ b/core/src/mindustry/core/GameState.java @@ -22,6 +22,8 @@ public class GameState{ public long updateId; /** Whether the game is in game over state. */ public boolean gameOver = false; + /** For the campaign, this is whether the map is in a "after game over" state. In this state, the game is always paused. */ + public boolean afterGameOver = false; /** Whether the player's team won the match. */ public boolean won = false; /** Server ticks/second. Only valid in multiplayer. */ diff --git a/core/src/mindustry/ui/dialogs/GameOverDialog.java b/core/src/mindustry/ui/dialogs/GameOverDialog.java index 107726b6cc..343ae3afa8 100644 --- a/core/src/mindustry/ui/dialogs/GameOverDialog.java +++ b/core/src/mindustry/ui/dialogs/GameOverDialog.java @@ -39,6 +39,7 @@ public class GameOverDialog extends BaseDialog{ public void show(Team winner){ this.winner = winner; + state.afterGameOver = true; show(); if(winner == player.team()){ Events.fire(new WinEvent()); diff --git a/core/src/mindustry/ui/dialogs/PausedDialog.java b/core/src/mindustry/ui/dialogs/PausedDialog.java index 2ff15e272b..e21b119102 100644 --- a/core/src/mindustry/ui/dialogs/PausedDialog.java +++ b/core/src/mindustry/ui/dialogs/PausedDialog.java @@ -57,7 +57,7 @@ public class PausedDialog extends BaseDialog{ .visible(() -> state.rules.sector != null && state.rules.sector.preset != null && state.rules.sector.preset.description != null).padTop(-60f); cont.button("@abandon", Icon.cancel, () -> ui.planet.abandonSectorConfirm(state.rules.sector, this::hide)).padTop(-60f) - .disabled(b -> net.client()).visible(() -> state.rules.sector != null).row(); + .disabled(b -> net.client() || state.gameOver).visible(() -> state.rules.sector != null).row(); cont.button("@back", Icon.left, this::hide).name("back"); cont.button("@settings", Icon.settings, ui.settings::show).name("settings"); diff --git a/core/src/mindustry/ui/fragments/HudFragment.java b/core/src/mindustry/ui/fragments/HudFragment.java index 2e7f555830..538cbfa5c2 100644 --- a/core/src/mindustry/ui/fragments/HudFragment.java +++ b/core/src/mindustry/ui/fragments/HudFragment.java @@ -918,6 +918,11 @@ public class HudFragment{ return builder; } + //do not show status after game over + if(state.afterGameOver && state.isCampaign()){ + return builder; + } + if(!state.rules.waves && state.isCampaign()){ builder.append("[lightgray]").append(Core.bundle.get("sector.curcapture")); }