From 98f17e15aed077c38f9c6e032d4fb8ca16255de2 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 28 Jan 2022 14:58:22 -0500 Subject: [PATCH] Fixed cross-planet hidden items --- core/src/mindustry/content/Planets.java | 3 +++ core/src/mindustry/core/Logic.java | 4 ++++ core/src/mindustry/core/World.java | 2 ++ core/src/mindustry/maps/planet/ErekirPlanetGenerator.java | 4 ---- core/src/mindustry/type/Planet.java | 2 ++ 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/content/Planets.java b/core/src/mindustry/content/Planets.java index 0e44eb9aca..e286b82c94 100644 --- a/core/src/mindustry/content/Planets.java +++ b/core/src/mindustry/content/Planets.java @@ -61,6 +61,7 @@ public class Planets{ totalRadius += 2.6f; lightSrcTo = 0.5f; lightDstFrom = 0.2f; + hiddenItems.addAll(Items.serpuloItems).removeAll(Items.erekirItems); unlockedOnLand.add(Blocks.coreBastion); }}; @@ -98,12 +99,14 @@ public class Planets{ new HexSkyMesh(this, 11, 0.15f, 0.13f, 5, new Color().set(Pal.spore).mul(0.9f).a(0.75f), 2, 0.45f, 0.9f, 0.38f), new HexSkyMesh(this, 1, 0.6f, 0.16f, 5, Color.white.cpy().lerp(Pal.spore, 0.55f).a(0.75f), 2, 0.45f, 1f, 0.41f) ); + atmosphereColor = Color.valueOf("3c1b8f"); atmosphereRadIn = 0.02f; atmosphereRadOut = 0.3f; startSector = 15; alwaysUnlocked = true; landCloudColor = Pal.spore.cpy().a(0.5f); + hiddenItems.addAll(Items.erekirItems).removeAll(Items.serpuloItems); }}; verilus = makeAsteroid("verlius", sun, Blocks.stoneWall, Blocks.iceWall, 0.5f, 12, 2f, gen -> { diff --git a/core/src/mindustry/core/Logic.java b/core/src/mindustry/core/Logic.java index 08df9cfeec..2da3ea9b4b 100644 --- a/core/src/mindustry/core/Logic.java +++ b/core/src/mindustry/core/Logic.java @@ -125,6 +125,10 @@ public class Logic implements ApplicationListener{ core.items.set(item, core.block.itemCapacity); } } + + //set up hidden items + state.rules.hiddenBuildItems.clear(); + state.rules.hiddenBuildItems.addAll(state.rules.sector.planet.hiddenItems); } //save settings diff --git a/core/src/mindustry/core/World.java b/core/src/mindustry/core/World.java index c168caf6d1..69921a72ef 100644 --- a/core/src/mindustry/core/World.java +++ b/core/src/mindustry/core/World.java @@ -304,6 +304,8 @@ public class World{ } state.rules.cloudColor = sector.planet.landCloudColor; + state.rules.hiddenBuildItems.clear(); + state.rules.hiddenBuildItems.addAll(sector.planet.hiddenItems); sector.info.resources = content.toSeq(); sector.info.resources.sort(Structs.comps(Structs.comparing(Content::getContentType), Structs.comparingInt(c -> c.id))); sector.saveInfo(); diff --git a/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java b/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java index 7aa0e05c89..e8bf77dbcb 100644 --- a/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java @@ -400,10 +400,6 @@ public class ErekirPlanetGenerator extends PlanetGenerator{ decoration(0.017f); - //not allowed - //TODO use Items.serpuloItems - state.rules.hiddenBuildItems.addAll(Items.copper, Items.titanium, Items.coal, Items.lead, Items.blastCompound, Items.pyratite, Items.sporePod, Items.metaglass, Items.plastanium); - //it is very hot state.rules.attributes.set(Attribute.heat, 0.8f); state.rules.environment = sector.planet.defaultEnv; diff --git a/core/src/mindustry/type/Planet.java b/core/src/mindustry/type/Planet.java index c6fde63745..183771839a 100644 --- a/core/src/mindustry/type/Planet.java +++ b/core/src/mindustry/type/Planet.java @@ -98,6 +98,8 @@ public class Planet extends UnlockableContent{ public @Nullable TechNode techTree; /** Planets that can be launched to from this one. Made mutual in init(). */ public Seq launchCandidates = new Seq<>(); + /** Items not available on this planet. */ + public Seq hiddenItems = new Seq<>(); /** Content (usually planet-specific) that is unlocked upon landing here. */ public Seq unlockedOnLand = new Seq<>(); /** Loads the mesh. Clientside only. Defaults to a boring sphere mesh. */