From 56f3dac3d25547734c72ef2d388c796371b7a330 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 23 Sep 2024 22:51:14 -0400 Subject: [PATCH] Sectors with world processors get reset on gameover --- core/src/mindustry/core/Control.java | 4 ++-- core/src/mindustry/game/SectorInfo.java | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index 045b96d9a2..db1ccc68c3 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -404,7 +404,7 @@ 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)){ + if(slot != null && !clearSectors && (!(sector.planet.clearSectorOnLose || sector.info.hasWorldProcessor) || sector.info.hasCore)){ try{ 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(state.rules.defaultTeam.cores().isEmpty() || hadNoCore){ - if(sector.planet.clearSectorOnLose){ + if(sector.planet.clearSectorOnLose || sector.info.hasWorldProcessor){ playNewSector(origin, sector, reloader); }else{ //no spawn set -> delete the sector save diff --git a/core/src/mindustry/game/SectorInfo.java b/core/src/mindustry/game/SectorInfo.java index e0b18826fd..00ff253867 100644 --- a/core/src/mindustry/game/SectorInfo.java +++ b/core/src/mindustry/game/SectorInfo.java @@ -38,6 +38,8 @@ public class SectorInfo{ public int storageCapacity = 0; /** Whether a core is available here. */ 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. */ public boolean wasCaptured = false; /** Sector that was launched from. */ @@ -175,6 +177,7 @@ public class SectorInfo{ spawnPosition = entity.pos(); } + hasWorldProcessor = state.teams.present.contains(t -> t.getBuildings(Blocks.worldProcessor).any()); waveSpacing = state.rules.waveSpacing; wave = state.wave; winWave = state.rules.winWave;