Internal support for legacy launch pads (hidden)
This commit is contained in:
@@ -1432,6 +1432,9 @@ rules.title.planet = Planet
|
|||||||
rules.lighting = Lighting
|
rules.lighting = Lighting
|
||||||
rules.fog = Fog of War
|
rules.fog = Fog of War
|
||||||
rules.invasions = Enemy Sector Invasions
|
rules.invasions = Enemy Sector Invasions
|
||||||
|
rules.legacylaunchpads = Legacy Launch Pad Mechanics
|
||||||
|
rules.legacylaunchpads.info = Allows using launch pads without landing pads, as in 7.0.
|
||||||
|
landingpad.legacy.disabled = [scarlet]\ue815 Disabled[lightgray] (Legacy Launch Pads enabled)
|
||||||
rules.showspawns = Show Enemy Spawns
|
rules.showspawns = Show Enemy Spawns
|
||||||
rules.randomwaveai = Unpredictable Wave AI
|
rules.randomwaveai = Unpredictable Wave AI
|
||||||
rules.fire = Fire
|
rules.fire = Fire
|
||||||
|
|||||||
@@ -6354,7 +6354,7 @@ public class Blocks{
|
|||||||
//region campaign
|
//region campaign
|
||||||
|
|
||||||
launchPad = new LaunchPad("launch-pad"){{
|
launchPad = new LaunchPad("launch-pad"){{
|
||||||
requirements(Category.effect, BuildVisibility.debugOnly, with(Items.copper, 350, Items.silicon, 140, Items.lead, 200, Items.titanium, 150));
|
requirements(Category.effect, BuildVisibility.legacyLaunchPadOnly, with(Items.copper, 350, Items.silicon, 140, Items.lead, 200, Items.titanium, 150));
|
||||||
size = 3;
|
size = 3;
|
||||||
itemCapacity = 100;
|
itemCapacity = 100;
|
||||||
launchTime = 60f * 20;
|
launchTime = 60f * 20;
|
||||||
@@ -6364,7 +6364,7 @@ public class Blocks{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
advancedLaunchPad = new LaunchPad("advanced-launch-pad"){{
|
advancedLaunchPad = new LaunchPad("advanced-launch-pad"){{
|
||||||
requirements(Category.effect, BuildVisibility.campaignOnly, with(Items.copper, 350, Items.silicon, 250, Items.lead, 300, Items.titanium, 200));
|
requirements(Category.effect, BuildVisibility.notLegacyLaunchPadOnly, with(Items.copper, 350, Items.silicon, 250, Items.lead, 300, Items.titanium, 200));
|
||||||
size = 4;
|
size = 4;
|
||||||
itemCapacity = 100;
|
itemCapacity = 100;
|
||||||
launchTime = 60f * 30;
|
launchTime = 60f * 30;
|
||||||
@@ -6376,14 +6376,14 @@ public class Blocks{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
landingPad = new LandingPad("landing-pad"){{
|
landingPad = new LandingPad("landing-pad"){{
|
||||||
requirements(Category.effect, BuildVisibility.campaignOnly, with(Items.copper, 200, Items.graphite, 100, Items.titanium, 100));
|
requirements(Category.effect, BuildVisibility.notLegacyLaunchPadOnly, with(Items.copper, 200, Items.graphite, 100, Items.titanium, 100));
|
||||||
size = 4;
|
size = 4;
|
||||||
|
|
||||||
itemCapacity = 100;
|
itemCapacity = 100;
|
||||||
|
|
||||||
coolingEffect = new RadialEffect(Fx.steamCoolSmoke, 4, 90f, 9.5f, 180f);
|
coolingEffect = new RadialEffect(Fx.steamCoolSmoke, 4, 90f, 9.5f, 180f);
|
||||||
liquidCapacity = 4000f;
|
liquidCapacity = 3000f;
|
||||||
consumeLiquidAmount = 2000f;
|
consumeLiquidAmount = 1500f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
interplanetaryAccelerator = new Accelerator("interplanetary-accelerator"){{
|
interplanetaryAccelerator = new Accelerator("interplanetary-accelerator"){{
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ public class Planets{
|
|||||||
launchCapacityMultiplier = 0.5f;
|
launchCapacityMultiplier = 0.5f;
|
||||||
sectorSeed = 2;
|
sectorSeed = 2;
|
||||||
allowWaves = true;
|
allowWaves = true;
|
||||||
|
allowLegacyLaunchPads = true;
|
||||||
allowWaveSimulation = true;
|
allowWaveSimulation = true;
|
||||||
allowSectorInvasion = true;
|
allowSectorInvasion = true;
|
||||||
allowLaunchSchematics = true;
|
allowLaunchSchematics = true;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ public class CampaignRules{
|
|||||||
public boolean showSpawns;
|
public boolean showSpawns;
|
||||||
public boolean sectorInvasion;
|
public boolean sectorInvasion;
|
||||||
public boolean randomWaveAI;
|
public boolean randomWaveAI;
|
||||||
|
public boolean legacyLaunchPads;
|
||||||
|
|
||||||
public void apply(Planet planet, Rules rules){
|
public void apply(Planet planet, Rules rules){
|
||||||
rules.staticFog = rules.fog = fog;
|
rules.staticFog = rules.fog = fog;
|
||||||
|
|||||||
@@ -92,6 +92,9 @@ public class SectorInfo{
|
|||||||
public ObjectFloatMap<Item> importCooldownTimers = new ObjectFloatMap<>();
|
public ObjectFloatMap<Item> importCooldownTimers = new ObjectFloatMap<>();
|
||||||
public @Nullable transient float[] importRateCache;
|
public @Nullable transient float[] importRateCache;
|
||||||
|
|
||||||
|
/** Temporary seq for last imported items. Do not use. */
|
||||||
|
public transient ItemSeq lastImported = new ItemSeq();
|
||||||
|
|
||||||
/** Counter refresh state. */
|
/** Counter refresh state. */
|
||||||
private transient Interval time = new Interval();
|
private transient Interval time = new Interval();
|
||||||
/** Core item storage input/output deltas. */
|
/** Core item storage input/output deltas. */
|
||||||
|
|||||||
@@ -168,6 +168,33 @@ public class Universe{
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(planet.campaignRules.legacyLaunchPads){
|
||||||
|
//first pass: clear import stats
|
||||||
|
for(Sector sector : planet.sectors){
|
||||||
|
if(sector.hasBase() && !sector.isBeingPlayed()){
|
||||||
|
sector.info.lastImported.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//second pass: update export & import statistics
|
||||||
|
for(Sector sector : planet.sectors){
|
||||||
|
if(sector.hasBase() && !sector.isBeingPlayed()){
|
||||||
|
|
||||||
|
//export to another sector
|
||||||
|
if(sector.info.destination != null){
|
||||||
|
Sector to = sector.info.destination;
|
||||||
|
if(to.hasBase() && to.planet == planet){
|
||||||
|
ItemSeq items = new ItemSeq();
|
||||||
|
//calculated exported items to this sector
|
||||||
|
sector.info.export.each((item, stat) -> items.add(item, (int)(stat.mean * newSecondsPassed * sector.getProductionScale())));
|
||||||
|
to.addItems(items);
|
||||||
|
to.info.lastImported.add(items);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//third pass: everything else
|
//third pass: everything else
|
||||||
for(Sector sector : planet.sectors){
|
for(Sector sector : planet.sectors){
|
||||||
if(sector.hasBase()){
|
if(sector.hasBase()){
|
||||||
@@ -229,13 +256,15 @@ public class Universe{
|
|||||||
//add production, making sure that it's capped
|
//add production, making sure that it's capped
|
||||||
sector.info.production.each((item, stat) -> sector.info.items.add(item, Math.min((int)(stat.mean * newSecondsPassed * scl), sector.info.storageCapacity - sector.info.items.get(item))));
|
sector.info.production.each((item, stat) -> sector.info.items.add(item, Math.min((int)(stat.mean * newSecondsPassed * scl), sector.info.storageCapacity - sector.info.items.get(item))));
|
||||||
|
|
||||||
sector.info.export.each((item, stat) -> {
|
if(planet.campaignRules.legacyLaunchPads){
|
||||||
if(sector.info.items.get(item) <= 0 && sector.info.production.get(item, ExportStat::new).mean < 0 && stat.mean > 0){
|
sector.info.export.each((item, stat) -> {
|
||||||
//cap export by import when production is negative.
|
if(sector.info.items.get(item) <= 0 && sector.info.production.get(item, ExportStat::new).mean < 0 && stat.mean > 0){
|
||||||
//TODO remove
|
//cap export by import when production is negative.
|
||||||
stat.mean = Math.min(0f, stat.mean);
|
//TODO remove
|
||||||
}
|
stat.mean = Math.min(sector.info.lastImported.get(item) / (float)newSecondsPassed, stat.mean);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//prevent negative values with unloaders
|
//prevent negative values with unloaders
|
||||||
sector.info.items.checkNegative();
|
sector.info.items.checkNegative();
|
||||||
|
|||||||
@@ -116,6 +116,8 @@ public class Planet extends UnlockableContent{
|
|||||||
public boolean allowWaveSimulation = false;
|
public boolean allowWaveSimulation = false;
|
||||||
/** Whether to simulate sector invasions from enemy bases. */
|
/** Whether to simulate sector invasions from enemy bases. */
|
||||||
public boolean allowSectorInvasion = false;
|
public boolean allowSectorInvasion = false;
|
||||||
|
/** If true, legacy launch pads can be enabled. */
|
||||||
|
public boolean allowLegacyLaunchPads = false;
|
||||||
/** If true, sectors saves are cleared when lost. */
|
/** If true, sectors saves are cleared when lost. */
|
||||||
public boolean clearSectorOnLose = false;
|
public boolean clearSectorOnLose = false;
|
||||||
/** Multiplier for enemy rebuild speeds; only applied in campaign (not standard rules) */
|
/** Multiplier for enemy rebuild speeds; only applied in campaign (not standard rules) */
|
||||||
|
|||||||
@@ -68,6 +68,11 @@ public class CampaignRulesDialog extends BaseDialog{
|
|||||||
check("@rules.fog", b -> rules.fog = b, () -> rules.fog);
|
check("@rules.fog", b -> rules.fog = b, () -> rules.fog);
|
||||||
check("@rules.showspawns", b -> rules.showSpawns = b, () -> rules.showSpawns);
|
check("@rules.showspawns", b -> rules.showSpawns = b, () -> rules.showSpawns);
|
||||||
check("@rules.randomwaveai", b -> rules.randomWaveAI = b, () -> rules.randomWaveAI);
|
check("@rules.randomwaveai", b -> rules.randomWaveAI = b, () -> rules.randomWaveAI);
|
||||||
|
|
||||||
|
//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);
|
||||||
|
}
|
||||||
}).growY();
|
}).growY();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ public class LandingPad extends Block{
|
|||||||
cooldown = Mathf.clamp(cooldown);
|
cooldown = Mathf.clamp(cooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config != null && state.isCampaign()){
|
if(config != null && state.isCampaign() && !state.getPlanet().campaignRules.legacyLaunchPads){
|
||||||
|
|
||||||
if(cooldown <= 0f && efficiency > 0f && items.total() == 0 && state.rules.sector.info.getImportRate(state.getPlanet(), config) > 0f && state.rules.sector.info.importCooldownTimers.get(config, 0f) >= 1f){
|
if(cooldown <= 0f && efficiency > 0f && items.total() == 0 && state.rules.sector.info.getImportRate(state.getPlanet(), config) > 0f && state.rules.sector.info.importCooldownTimers.get(config, 0f) >= 1f){
|
||||||
|
|
||||||
@@ -344,9 +344,14 @@ public class LandingPad extends Block{
|
|||||||
|
|
||||||
table.row();
|
table.row();
|
||||||
table.label(() -> {
|
table.label(() -> {
|
||||||
if(config == null || !state.isCampaign()){
|
if(!state.isCampaign()) return "";
|
||||||
return "";
|
|
||||||
|
if(state.getPlanet().campaignRules.legacyLaunchPads){
|
||||||
|
return Core.bundle.get("landingpad.legacy.disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(config == null) return "";
|
||||||
|
|
||||||
int sources = 0;
|
int sources = 0;
|
||||||
float perSecond = 0f;
|
float perSecond = 0f;
|
||||||
for(var s : state.getPlanet().sectors){
|
for(var s : state.getPlanet().sectors){
|
||||||
|
|||||||
@@ -296,7 +296,9 @@ public class LaunchPad extends Block{
|
|||||||
Events.fire(new LaunchItemEvent(stack));
|
Events.fire(new LaunchItemEvent(stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
destsec.addItems(dest);
|
if(state.getPlanet().campaignRules.legacyLaunchPads){
|
||||||
|
destsec.addItems(dest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ public class BuildVisibility{
|
|||||||
worldProcessorOnly = new BuildVisibility(() -> Vars.state.rules.editor || Vars.state.rules.allowEditWorldProcessors),
|
worldProcessorOnly = new BuildVisibility(() -> Vars.state.rules.editor || Vars.state.rules.allowEditWorldProcessors),
|
||||||
sandboxOnly = new BuildVisibility(() -> Vars.state == null || Vars.state.rules.infiniteResources),
|
sandboxOnly = new BuildVisibility(() -> Vars.state == null || Vars.state.rules.infiniteResources),
|
||||||
campaignOnly = new BuildVisibility(() -> Vars.state == null || Vars.state.isCampaign()),
|
campaignOnly = new BuildVisibility(() -> Vars.state == null || Vars.state.isCampaign()),
|
||||||
|
legacyLaunchPadOnly = new BuildVisibility(() -> (Vars.state == null || Vars.state.isCampaign() && Vars.state.getPlanet().campaignRules.legacyLaunchPads) && Blocks.advancedLaunchPad != null && Blocks.advancedLaunchPad.unlocked()),
|
||||||
|
notLegacyLaunchPadOnly = new BuildVisibility(() -> (Vars.state == null || Vars.state.isCampaign() && !Vars.state.getPlanet().campaignRules.legacyLaunchPads)),
|
||||||
lightingOnly = new BuildVisibility(() -> Vars.state == null || Vars.state.rules.lighting || Vars.state.isCampaign()),
|
lightingOnly = new BuildVisibility(() -> Vars.state == null || Vars.state.rules.lighting || Vars.state.isCampaign()),
|
||||||
ammoOnly = new BuildVisibility(() -> Vars.state == null || Vars.state.rules.unitAmmo),
|
ammoOnly = new BuildVisibility(() -> Vars.state == null || Vars.state.rules.unitAmmo),
|
||||||
fogOnly = new BuildVisibility(() -> Vars.state == null || Vars.state.rules.fog || Vars.state.rules.editor);
|
fogOnly = new BuildVisibility(() -> Vars.state == null || Vars.state.rules.fog || Vars.state.rules.editor);
|
||||||
|
|||||||
Reference in New Issue
Block a user