Added difficulty modifier for clearing sectors upon loss

This commit is contained in:
Anuken
2025-09-29 08:47:59 -04:00
parent 72ce49a753
commit 32b9ff9f5d
6 changed files with 17 additions and 5 deletions

View File

@@ -420,7 +420,10 @@ public class Control implements ApplicationListener, Loadable{
ui.planet.hide();
SaveSlot slot = sector.save;
sector.planet.setLastSector(sector);
if(slot != null && !clearSectors && (!sector.planet.clearSectorOnLose || sector.info.hasCore)){
boolean clearSave = sector.planet.clearSectorOnLose || sector.planet.campaignRules.clearSectorOnLose;
if(slot != null && !clearSectors && (!clearSave || sector.info.hasCore)){
try{
boolean hadNoCore = !sector.info.hasCore;
@@ -435,7 +438,7 @@ public class Control implements ApplicationListener, Loadable{
if(state.rules.defaultTeam.cores().isEmpty() || hadNoCore){
//don't carry over the spawn position and plans if the sector preset name or map size changed
if(sector.planet.clearSectorOnLose || sector.info.spawnPosition == 0 || !sector.info.sectorDataMatches(sector)){
if(clearSave || sector.info.spawnPosition == 0 || !sector.info.sectorDataMatches(sector)){
playNewSector(origin, sector, reloader);
}else{
int spawnPos = sector.info.spawnPosition;

View File

@@ -12,6 +12,7 @@ public class CampaignRules{
public boolean randomWaveAI;
public boolean legacyLaunchPads;
public boolean rtsAI;
public boolean clearSectorOnLose;
public void apply(Planet planet, Rules rules){
rules.staticFog = rules.fog = fog;

View File

@@ -74,6 +74,10 @@ public class CampaignRulesDialog extends BaseDialog{
check("@rules.rtsai.campaign", b -> rules.rtsAI = b, () -> rules.rtsAI);
}
if(!planet.clearSectorOnLose){
check("@rules.clearsectoronloss", b -> rules.clearSectorOnLose = b, () -> rules.clearSectorOnLose);
}
//TODO: this is intentionally hidden until the new mechanics have been well-tested. I don't want people immediately switching to the old mechanics
if(planet.allowLegacyLaunchPads){
// check("@rules.legacylaunchpads", b -> rules.legacyLaunchPads = b, () -> rules.legacyLaunchPads);