Sectors with world processors get reset on gameover

This commit is contained in:
Anuken 2024-09-23 22:51:14 -04:00
parent 8e1df180bc
commit 56f3dac3d2
2 changed files with 5 additions and 2 deletions

View File

@ -404,7 +404,7 @@ public class Control implements ApplicationListener, Loadable{
ui.planet.hide(); ui.planet.hide();
SaveSlot slot = sector.save; SaveSlot slot = sector.save;
sector.planet.setLastSector(sector); sector.planet.setLastSector(sector);
if(slot != null && !clearSectors && (!sector.planet.clearSectorOnLose || sector.info.hasCore)){ if(slot != null && !clearSectors && (!(sector.planet.clearSectorOnLose || sector.info.hasWorldProcessor) || sector.info.hasCore)){
try{ try{
boolean hadNoCore = !sector.info.hasCore; boolean hadNoCore = !sector.info.hasCore;
@ -417,7 +417,7 @@ 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 there is no base, simulate a new game and place the right loadout at the spawn position
if(state.rules.defaultTeam.cores().isEmpty() || hadNoCore){ if(state.rules.defaultTeam.cores().isEmpty() || hadNoCore){
if(sector.planet.clearSectorOnLose){ if(sector.planet.clearSectorOnLose || sector.info.hasWorldProcessor){
playNewSector(origin, sector, reloader); playNewSector(origin, sector, reloader);
}else{ }else{
//no spawn set -> delete the sector save //no spawn set -> delete the sector save

View File

@ -38,6 +38,8 @@ public class SectorInfo{
public int storageCapacity = 0; public int storageCapacity = 0;
/** Whether a core is available here. */ /** Whether a core is available here. */
public boolean hasCore = true; public boolean hasCore = true;
/** Whether a world processor is on this map - implies that the map will get cleared. */
public boolean hasWorldProcessor;
/** Whether this sector was ever fully captured. */ /** Whether this sector was ever fully captured. */
public boolean wasCaptured = false; public boolean wasCaptured = false;
/** Sector that was launched from. */ /** Sector that was launched from. */
@ -175,6 +177,7 @@ public class SectorInfo{
spawnPosition = entity.pos(); spawnPosition = entity.pos();
} }
hasWorldProcessor = state.teams.present.contains(t -> t.getBuildings(Blocks.worldProcessor).any());
waveSpacing = state.rules.waveSpacing; waveSpacing = state.rules.waveSpacing;
wave = state.wave; wave = state.wave;
winWave = state.rules.winWave; winWave = state.rules.winWave;