1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-11 08:15:35 +03:00

Fixed sector gameover ghost bug

This commit is contained in:
Anuken 2020-11-20 12:38:16 -05:00
parent aa2783a885
commit 1372fc4079
8 changed files with 20 additions and 7 deletions

View File

@ -35,7 +35,7 @@ dependencies{
natives "com.github.Anuken.Arc:natives-box2d-android:${getArcHash()}"
//android dependencies magically disappear during compilation, thanks gradle!
def sdkFile = new File((String)System.getenv("ANDROID_HOME"), "/platforms/android-29/android.jar")
def sdkFile = new File((String)findSdkDir(), "/platforms/android-29/android.jar")
if(sdkFile.exists()) compileOnly files(sdkFile.absolutePath)
}

View File

@ -99,6 +99,17 @@ allprojects{
return project.ext.mainClassName.substring(0, project.ext.mainClassName.indexOf("desktop") - 1)
}
findSdkDir = {
//null because IntelliJ doesn't get env variables
def v = System.getenv("ANDROID_HOME")
if(v != null) return v
//rootDir is null here, amazing. brilliant.
def file = new File("local.properties")
if(!file.exists()) file = new File("../local.properties")
def props = new Properties().with{p -> p.load(file.newReader()); return p }
return props.get("sdk.dir")
}
generateLocales = {
def output = 'en\n'
def bundles = new File(project(':core').projectDir, 'assets/bundles/')

View File

@ -549,6 +549,7 @@ sectors.nonelaunch = [lightgray]none (sun)
sectors.rename = Rename Sector
sector.curcapture = Sector Captured
sector.curlost = Sector Lost
sector.missingresources = [scarlet]Insufficient Core Resources
sector.attacked = Sector [accent]{0}[white] under attack!
sector.lost = Sector [accent]{0}[white] lost!

View File

@ -69,7 +69,7 @@ public class GameState{
}
public boolean isPaused(){
return (is(State.paused) && !net.active()) || (gameOver && !net.active()) || (serverPaused && !isMenu());
return (is(State.paused) && !net.active()) || (gameOver && (!net.active() || isCampaign())) || (serverPaused && !isMenu());
}
public boolean isPlaying(){

View File

@ -98,7 +98,7 @@ public class Sector{
/** @return whether the player has a base here. */
public boolean hasBase(){
return save != null && info.hasCore;
return save != null && info.hasCore && !(Vars.state.isGame() && Vars.state.rules.sector == this && state.gameOver);
}
/** @return whether the enemy has a generated base here. */

View File

@ -31,13 +31,13 @@ public class GameOverDialog extends BaseDialog{
}
void rebuild(){
title.setText("@gameover");
title.setText(state.isCampaign() ? "@sector.curlost" : "@gameover");
buttons.clear();
cont.clear();
buttons.margin(10);
if(state.rules.pvp){
if(state.rules.pvp && winner != null){
cont.add(Core.bundle.format("gameover.pvp", winner.localized())).pad(6);
buttons.button("@menu", () -> {
hide();

View File

@ -239,6 +239,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
}
Sector findLauncher(Sector to){
Sector launchSector = this.launchSector != null && this.launchSector.hasBase() ? this.launchSector : null;
//directly nearby.
if(to.near().contains(launchSector)) return launchSector;
@ -711,7 +712,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
if((sector.hasBase() && mode == look) || canSelect(sector) || (sector.preset != null && sector.preset.alwaysUnlocked) || debugSelect){
stable.button(mode == select ? "@sectors.select" : sector.hasBase() ? "@sectors.resume" : "@sectors.launch", Icon.play, () -> {
if(state.rules.sector == sector && !state.isMenu()){
if(sector.isBeingPlayed()){
//already at this sector
hide();
return;

View File

@ -90,7 +90,7 @@ public class HudFragment extends Fragment{
parent.fill(t -> {
t.name = "paused";
t.top().visible(() -> state.isPaused() && shown).touchable = Touchable.disabled;
t.table(Styles.black5, top -> top.add("@paused").style(Styles.outlineLabel).pad(8f)).growX();
t.table(Styles.black5, top -> top.label(() -> state.gameOver && state.isCampaign() ? "@sector.curlost" : "@paused").style(Styles.outlineLabel).pad(8f)).growX();
});
//minimap + position