From 7cc0cbb132b38c589308facc2035c19a0f2d9269 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 13 Feb 2022 15:59:02 -0500 Subject: [PATCH] More tech tree requirements --- .../src/mindustry/content/ErekirTechTree.java | 4 ++-- .../mindustry/entities/comp/BuildingComp.java | 20 +++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/core/src/mindustry/content/ErekirTechTree.java b/core/src/mindustry/content/ErekirTechTree.java index 5d23138469..710fabe7ba 100644 --- a/core/src/mindustry/content/ErekirTechTree.java +++ b/core/src/mindustry/content/ErekirTechTree.java @@ -152,13 +152,13 @@ public class ErekirTechTree{ }); - node(atmosphericConcentrator, () -> { + node(atmosphericConcentrator, Seq.with(new OnSector(four)), () -> { node(cyanogenSynthesizer, () -> { }); }); - node(carbideCrucible, () -> { + node(carbideCrucible, Seq.with(tmpNever), () -> { node(surgeCrucible, () -> { node(phaseSynthesizer, () -> { node(phaseHeater, () -> { diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index c8325fa438..86cae71489 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -71,10 +71,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, transient String lastAccessed; transient boolean wasDamaged; //used only by the indexer - PowerModule power; - ItemModule items; - LiquidModule liquids; - ConsumeModule cons; + @Nullable PowerModule power; + @Nullable ItemModule items; + @Nullable LiquidModule liquids; + @Nullable ConsumeModule cons; public transient float healSuppressionTime = -1f; public transient float lastHealTime = -120f * 10f; @@ -477,6 +477,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, return 0f; } + /** @return whether this block is allowed to update based on team/environment */ + public boolean shouldUpdate(){ + return team != Team.derelict && block.supportsEnv(state.rules.environment); + } + public BlockStatus status(){ return cons.status(); } @@ -1703,9 +1708,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, afterDestroyed(); } + //TODO awful method and should be benchmarked @Final @Override public void update(){ + //TODO should just avoid updating buildings instead if(state.isEditor()) return; //TODO refactor to timestamp-based system @@ -1729,7 +1736,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, enabled = false; } - //TODO separate system for sound? + //TODO separate system for sound? AudioSource, etc if(!headless){ if(sound != null){ sound.update(x, y, shouldActiveSound()); @@ -1745,11 +1752,12 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, cons.update(); } + //TODO just handle per-block instead if(enabled || !block.noUpdateDisabled){ updateTile(); } - //TODO unnecessary updates? + //TODO unnecessary updates for everything below if(items != null){ items.update(updateFlow); }