From a7cdadf65c00ec86475b872f054133b96f280dad Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 21 Dec 2025 18:21:49 -0500 Subject: [PATCH] prebuildBase is now true for Serpulo --- core/src/mindustry/content/Planets.java | 2 -- core/src/mindustry/core/Control.java | 27 ++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/content/Planets.java b/core/src/mindustry/content/Planets.java index c4d642957b..01f266abea 100644 --- a/core/src/mindustry/content/Planets.java +++ b/core/src/mindustry/content/Planets.java @@ -137,8 +137,6 @@ public class Planets{ allowLaunchSchematics = true; enemyCoreSpawnReplace = true; allowLaunchLoadout = true; - //doesn't play well with configs - prebuildBase = false; ruleSetter = r -> { r.waveTeam = Team.crux; r.placeRangeCheck = false; diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index b47359f111..432b681e0e 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -31,6 +31,7 @@ import mindustry.net.*; import mindustry.type.*; import mindustry.ui.dialogs.*; import mindustry.world.*; +import mindustry.world.blocks.power.PowerNode.*; import mindustry.world.blocks.storage.CoreBlock.*; import java.io.*; @@ -56,6 +57,7 @@ public class Control implements ApplicationListener, Loadable{ private boolean hiscore = false; private boolean wasPaused = false, backgroundPaused = false; private Seq toBePlaced = new Seq<>(false); + private Seq toBePlacedConfigs = new Seq<>(); public Control(){ saves = new Saves(); @@ -119,6 +121,7 @@ public class Control implements ApplicationListener, Loadable{ Events.on(ResetEvent.class, event -> { player.reset(); toBePlaced.clear(); + toBePlacedConfigs.clear(); indicators.clear(); hiscore = false; @@ -239,6 +242,15 @@ public class Control implements ApplicationListener, Loadable{ //TODO if the save is unloaded or map is hosted, these blocks do not get built. boolean anyBuilds = false; + float maxDelay = 0f; + + for(var build : state.rules.defaultTeam.data().buildings){ + //power nodes need to be configured later once everything is built + if(build instanceof PowerNodeBuild){ + toBePlacedConfigs.add(new Object[]{build, build.config()}); + } + } + for(var build : state.rules.defaultTeam.data().buildings.copy()){ if(!(build instanceof CoreBuild) && !build.block.privileged){ var ccore = build.closestCore(); @@ -251,8 +263,10 @@ public class Control implements ApplicationListener, Loadable{ build.tile.remove(); toBePlaced.add(build); + float delay = build.dst(ccore) / unitsPerTick + coreDelay; + maxDelay = Math.max(delay, maxDelay); - Time.run(build.dst(ccore) / unitsPerTick + coreDelay, () -> { + Time.run(delay, () -> { if(build.tile.build != build){ placeLandBuild(build); @@ -269,6 +283,7 @@ public class Control implements ApplicationListener, Loadable{ } if(anyBuilds){ + Time.run(maxDelay + 1f, this::configurePlaced); for(var ccore : state.rules.defaultTeam.data().cores){ Time.run(coreDelay, () -> { Fx.coreBuildShockwave.at(ccore.x, ccore.y, buildRadius); @@ -292,9 +307,19 @@ public class Control implements ApplicationListener, Loadable{ placeLandBuild(build); } + configurePlaced(); toBePlaced.clear(); } + private void configurePlaced(){ + for(Object[] obj : toBePlacedConfigs){ + Building build = (Building)obj[0]; + Object config = obj[1]; + build.configureAny(config); + } + toBePlacedConfigs.clear(); + } + private void placeLandBuild(Building build){ build.tile.setBlock(build.block, build.team, build.rotation, () -> build); build.dropped();