More tech tree requirements

This commit is contained in:
Anuken
2022-02-13 15:59:02 -05:00
parent 50cb6b91e3
commit 7cc0cbb132
2 changed files with 16 additions and 8 deletions

View File

@@ -152,13 +152,13 @@ public class ErekirTechTree{
}); });
node(atmosphericConcentrator, () -> { node(atmosphericConcentrator, Seq.with(new OnSector(four)), () -> {
node(cyanogenSynthesizer, () -> { node(cyanogenSynthesizer, () -> {
}); });
}); });
node(carbideCrucible, () -> { node(carbideCrucible, Seq.with(tmpNever), () -> {
node(surgeCrucible, () -> { node(surgeCrucible, () -> {
node(phaseSynthesizer, () -> { node(phaseSynthesizer, () -> {
node(phaseHeater, () -> { node(phaseHeater, () -> {

View File

@@ -71,10 +71,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
transient String lastAccessed; transient String lastAccessed;
transient boolean wasDamaged; //used only by the indexer transient boolean wasDamaged; //used only by the indexer
PowerModule power; @Nullable PowerModule power;
ItemModule items; @Nullable ItemModule items;
LiquidModule liquids; @Nullable LiquidModule liquids;
ConsumeModule cons; @Nullable ConsumeModule cons;
public transient float healSuppressionTime = -1f; public transient float healSuppressionTime = -1f;
public transient float lastHealTime = -120f * 10f; public transient float lastHealTime = -120f * 10f;
@@ -477,6 +477,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
return 0f; 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(){ public BlockStatus status(){
return cons.status(); return cons.status();
} }
@@ -1703,9 +1708,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
afterDestroyed(); afterDestroyed();
} }
//TODO awful method and should be benchmarked
@Final @Final
@Override @Override
public void update(){ public void update(){
//TODO should just avoid updating buildings instead
if(state.isEditor()) return; if(state.isEditor()) return;
//TODO refactor to timestamp-based system //TODO refactor to timestamp-based system
@@ -1729,7 +1736,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
enabled = false; enabled = false;
} }
//TODO separate system for sound? //TODO separate system for sound? AudioSource, etc
if(!headless){ if(!headless){
if(sound != null){ if(sound != null){
sound.update(x, y, shouldActiveSound()); sound.update(x, y, shouldActiveSound());
@@ -1745,11 +1752,12 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
cons.update(); cons.update();
} }
//TODO just handle per-block instead
if(enabled || !block.noUpdateDisabled){ if(enabled || !block.noUpdateDisabled){
updateTile(); updateTile();
} }
//TODO unnecessary updates? //TODO unnecessary updates for everything below
if(items != null){ if(items != null){
items.update(updateFlow); items.update(updateFlow);
} }