Checks to prevent uncaptureable sectors

This commit is contained in:
Anuken
2020-10-17 10:10:29 -04:00
parent c3d0819cc1
commit be394c4b33
6 changed files with 25 additions and 6 deletions
+2
View File
@@ -106,6 +106,8 @@ public class Rules{
public boolean ai;
/** TODO Tier of blocks/designs that the AI uses for building. [0, 1]*/
public float aiTier = 0f;
/** Whether, when AI is enabled, ships should be spawned from the core. */
public boolean aiCoreSpawn = true;
/** If true, blocks don't require power or resources. */
public boolean cheat;
/** If true, resources are not consumed when building. */
+11 -2
View File
@@ -101,6 +101,17 @@ public class SectorInfo{
/** Write contents of meta into main storage. */
public void write(){
//enable attack mode when there's a core.
if(state.rules.waveTeam.core() != null){
attack = true;
winWave = 0;
}
//if there are infinite waves and no win wave, add a win wave.
if(waves && winWave <= 0 && !attack){
winWave = 30;
}
state.wave = wave;
state.rules.waves = waves;
state.rules.waveSpacing = waveSpacing;
@@ -114,8 +125,6 @@ public class SectorInfo{
//ensure capacity.
entity.items.each((i, a) -> entity.items.set(i, Math.min(a, entity.storageCapacity)));
}
//TODO write items.
}
/** Prepare data for writing to a save. */