Sector abandon button

This commit is contained in:
Anuken
2022-04-07 03:00:14 -04:00
parent 68a12b37c6
commit 018b2bb94b
4 changed files with 31 additions and 4 deletions

View File

@@ -890,6 +890,32 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
});
dialog.addCloseButton();
if(sector.hasBase()){
dialog.buttons.button("@sector.abandon", Icon.cancel, () -> {
ui.showConfirm("@sector.abandon.confirm", () -> {
dialog.hide();
if(sector.isBeingPlayed()){
hide();
//after dialog is hidden
Time.runTask(7f, () -> {
//force game over in a more dramatic fashion
for(var core : player.team().cores().copy()){
core.kill();
}
});
}else{
if(sector.save != null){
sector.save.delete();
}
sector.save = null;
}
updateSelected();
});
});
}
dialog.show();
}
@@ -1080,7 +1106,6 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
}
//make sure there are no under-attack sectors (other than this one)
//TODO abandon button?
for(Planet planet : content.planets()){
if(!planet.allowWaveSimulation && !debugSelect){
int attackedCount = planet.sectors.count(s -> s.isAttacked() && s != sector);