Automatic planet detection for content
This commit is contained in:
@@ -62,7 +62,9 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
|
|||||||
}
|
}
|
||||||
long ram = Runtime.getRuntime().maxMemory();
|
long ram = Runtime.getRuntime().maxMemory();
|
||||||
boolean gb = ram >= 1024 * 1024 * 1024;
|
boolean gb = ram >= 1024 * 1024 * 1024;
|
||||||
Log.info("[RAM] Available: @ @", Strings.fixed(gb ? ram / 1024f / 1024 / 1024f : ram / 1024f / 1024f, 1), gb ? "GB" : "MB");
|
if(!OS.isIos){
|
||||||
|
Log.info("[RAM] Available: @ @", Strings.fixed(gb ? ram / 1024f / 1024 / 1024f : ram / 1024f / 1024f, 1), gb ? "GB" : "MB");
|
||||||
|
}
|
||||||
|
|
||||||
Time.setDeltaProvider(() -> {
|
Time.setDeltaProvider(() -> {
|
||||||
float result = Core.graphics.getDeltaTime() * 60f;
|
float result = Core.graphics.getDeltaTime() * 60f;
|
||||||
|
|||||||
@@ -1513,27 +1513,23 @@ public class Blocks{
|
|||||||
requirements(Category.defense, with(Items.copper, 6));
|
requirements(Category.defense, with(Items.copper, 6));
|
||||||
health = 80 * wallHealthMultiplier;
|
health = 80 * wallHealthMultiplier;
|
||||||
researchCostMultiplier = 0.1f;
|
researchCostMultiplier = 0.1f;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
copperWallLarge = new Wall("copper-wall-large"){{
|
copperWallLarge = new Wall("copper-wall-large"){{
|
||||||
requirements(Category.defense, ItemStack.mult(copperWall.requirements, 4));
|
requirements(Category.defense, ItemStack.mult(copperWall.requirements, 4));
|
||||||
health = 80 * 4 * wallHealthMultiplier;
|
health = 80 * 4 * wallHealthMultiplier;
|
||||||
size = 2;
|
size = 2;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
titaniumWall = new Wall("titanium-wall"){{
|
titaniumWall = new Wall("titanium-wall"){{
|
||||||
requirements(Category.defense, with(Items.titanium, 6));
|
requirements(Category.defense, with(Items.titanium, 6));
|
||||||
health = 110 * wallHealthMultiplier;
|
health = 110 * wallHealthMultiplier;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
titaniumWallLarge = new Wall("titanium-wall-large"){{
|
titaniumWallLarge = new Wall("titanium-wall-large"){{
|
||||||
requirements(Category.defense, ItemStack.mult(titaniumWall.requirements, 4));
|
requirements(Category.defense, ItemStack.mult(titaniumWall.requirements, 4));
|
||||||
health = 110 * wallHealthMultiplier * 4;
|
health = 110 * wallHealthMultiplier * 4;
|
||||||
size = 2;
|
size = 2;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
plastaniumWall = new Wall("plastanium-wall"){{
|
plastaniumWall = new Wall("plastanium-wall"){{
|
||||||
@@ -1542,7 +1538,6 @@ public class Blocks{
|
|||||||
insulated = true;
|
insulated = true;
|
||||||
absorbLasers = true;
|
absorbLasers = true;
|
||||||
schematicPriority = 10;
|
schematicPriority = 10;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
plastaniumWallLarge = new Wall("plastanium-wall-large"){{
|
plastaniumWallLarge = new Wall("plastanium-wall-large"){{
|
||||||
@@ -1552,20 +1547,17 @@ public class Blocks{
|
|||||||
insulated = true;
|
insulated = true;
|
||||||
absorbLasers = true;
|
absorbLasers = true;
|
||||||
schematicPriority = 10;
|
schematicPriority = 10;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
thoriumWall = new Wall("thorium-wall"){{
|
thoriumWall = new Wall("thorium-wall"){{
|
||||||
requirements(Category.defense, with(Items.thorium, 6));
|
requirements(Category.defense, with(Items.thorium, 6));
|
||||||
health = 200 * wallHealthMultiplier;
|
health = 200 * wallHealthMultiplier;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
thoriumWallLarge = new Wall("thorium-wall-large"){{
|
thoriumWallLarge = new Wall("thorium-wall-large"){{
|
||||||
requirements(Category.defense, ItemStack.mult(thoriumWall.requirements, 4));
|
requirements(Category.defense, ItemStack.mult(thoriumWall.requirements, 4));
|
||||||
health = 200 * wallHealthMultiplier * 4;
|
health = 200 * wallHealthMultiplier * 4;
|
||||||
size = 2;
|
size = 2;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
phaseWall = new Wall("phase-wall"){{
|
phaseWall = new Wall("phase-wall"){{
|
||||||
@@ -1573,7 +1565,6 @@ public class Blocks{
|
|||||||
health = 150 * wallHealthMultiplier;
|
health = 150 * wallHealthMultiplier;
|
||||||
chanceDeflect = 10f;
|
chanceDeflect = 10f;
|
||||||
flashHit = true;
|
flashHit = true;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
phaseWallLarge = new Wall("phase-wall-large"){{
|
phaseWallLarge = new Wall("phase-wall-large"){{
|
||||||
@@ -1582,14 +1573,12 @@ public class Blocks{
|
|||||||
size = 2;
|
size = 2;
|
||||||
chanceDeflect = 10f;
|
chanceDeflect = 10f;
|
||||||
flashHit = true;
|
flashHit = true;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
surgeWall = new Wall("surge-wall"){{
|
surgeWall = new Wall("surge-wall"){{
|
||||||
requirements(Category.defense, with(Items.surgeAlloy, 6));
|
requirements(Category.defense, with(Items.surgeAlloy, 6));
|
||||||
health = 230 * wallHealthMultiplier;
|
health = 230 * wallHealthMultiplier;
|
||||||
lightningChance = 0.05f;
|
lightningChance = 0.05f;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
surgeWallLarge = new Wall("surge-wall-large"){{
|
surgeWallLarge = new Wall("surge-wall-large"){{
|
||||||
@@ -1597,13 +1586,11 @@ public class Blocks{
|
|||||||
health = 230 * 4 * wallHealthMultiplier;
|
health = 230 * 4 * wallHealthMultiplier;
|
||||||
size = 2;
|
size = 2;
|
||||||
lightningChance = 0.05f;
|
lightningChance = 0.05f;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
door = new Door("door"){{
|
door = new Door("door"){{
|
||||||
requirements(Category.defense, with(Items.titanium, 6, Items.silicon, 4));
|
requirements(Category.defense, with(Items.titanium, 6, Items.silicon, 4));
|
||||||
health = 100 * wallHealthMultiplier;
|
health = 100 * wallHealthMultiplier;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
doorLarge = new Door("door-large"){{
|
doorLarge = new Door("door-large"){{
|
||||||
@@ -1612,14 +1599,12 @@ public class Blocks{
|
|||||||
closefx = Fx.doorcloselarge;
|
closefx = Fx.doorcloselarge;
|
||||||
health = 100 * 4 * wallHealthMultiplier;
|
health = 100 * 4 * wallHealthMultiplier;
|
||||||
size = 2;
|
size = 2;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
scrapWall = new Wall("scrap-wall"){{
|
scrapWall = new Wall("scrap-wall"){{
|
||||||
requirements(Category.defense, BuildVisibility.sandboxOnly, with(Items.scrap, 6));
|
requirements(Category.defense, BuildVisibility.sandboxOnly, with(Items.scrap, 6));
|
||||||
health = 60 * wallHealthMultiplier;
|
health = 60 * wallHealthMultiplier;
|
||||||
variants = 5;
|
variants = 5;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
scrapWallLarge = new Wall("scrap-wall-large"){{
|
scrapWallLarge = new Wall("scrap-wall-large"){{
|
||||||
@@ -1627,7 +1612,6 @@ public class Blocks{
|
|||||||
health = 60 * 4 * wallHealthMultiplier;
|
health = 60 * 4 * wallHealthMultiplier;
|
||||||
size = 2;
|
size = 2;
|
||||||
variants = 4;
|
variants = 4;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
scrapWallHuge = new Wall("scrap-wall-huge"){{
|
scrapWallHuge = new Wall("scrap-wall-huge"){{
|
||||||
@@ -1635,21 +1619,18 @@ public class Blocks{
|
|||||||
health = 60 * 9 * wallHealthMultiplier;
|
health = 60 * 9 * wallHealthMultiplier;
|
||||||
size = 3;
|
size = 3;
|
||||||
variants = 3;
|
variants = 3;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
scrapWallGigantic = new Wall("scrap-wall-gigantic"){{
|
scrapWallGigantic = new Wall("scrap-wall-gigantic"){{
|
||||||
requirements(Category.defense, BuildVisibility.sandboxOnly, ItemStack.mult(scrapWall.requirements, 16));
|
requirements(Category.defense, BuildVisibility.sandboxOnly, ItemStack.mult(scrapWall.requirements, 16));
|
||||||
health = 60 * 16 * wallHealthMultiplier;
|
health = 60 * 16 * wallHealthMultiplier;
|
||||||
size = 4;
|
size = 4;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
thruster = new Thruster("thruster"){{
|
thruster = new Thruster("thruster"){{
|
||||||
requirements(Category.defense, BuildVisibility.sandboxOnly, with(Items.scrap, 96));
|
requirements(Category.defense, BuildVisibility.sandboxOnly, with(Items.scrap, 96));
|
||||||
health = 55 * 16 * wallHealthMultiplier;
|
health = 55 * 16 * wallHealthMultiplier;
|
||||||
size = 4;
|
size = 4;
|
||||||
envDisabled |= Env.scorching;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
berylliumWall = new Wall("beryllium-wall"){{
|
berylliumWall = new Wall("beryllium-wall"){{
|
||||||
@@ -5755,51 +5736,43 @@ public class Blocks{
|
|||||||
requirements(Category.power, BuildVisibility.sandboxOnly, with());
|
requirements(Category.power, BuildVisibility.sandboxOnly, with());
|
||||||
powerProduction = 1000000f / 60f;
|
powerProduction = 1000000f / 60f;
|
||||||
alwaysUnlocked = true;
|
alwaysUnlocked = true;
|
||||||
allDatabaseTabs = true;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
powerVoid = new PowerVoid("power-void"){{
|
powerVoid = new PowerVoid("power-void"){{
|
||||||
requirements(Category.power, BuildVisibility.sandboxOnly, with());
|
requirements(Category.power, BuildVisibility.sandboxOnly, with());
|
||||||
alwaysUnlocked = true;
|
alwaysUnlocked = true;
|
||||||
allDatabaseTabs = true;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
itemSource = new ItemSource("item-source"){{
|
itemSource = new ItemSource("item-source"){{
|
||||||
requirements(Category.distribution, BuildVisibility.sandboxOnly, with());
|
requirements(Category.distribution, BuildVisibility.sandboxOnly, with());
|
||||||
alwaysUnlocked = true;
|
alwaysUnlocked = true;
|
||||||
allDatabaseTabs = true;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
itemVoid = new ItemVoid("item-void"){{
|
itemVoid = new ItemVoid("item-void"){{
|
||||||
requirements(Category.distribution, BuildVisibility.sandboxOnly, with());
|
requirements(Category.distribution, BuildVisibility.sandboxOnly, with());
|
||||||
alwaysUnlocked = true;
|
alwaysUnlocked = true;
|
||||||
allDatabaseTabs = true;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
liquidSource = new LiquidSource("liquid-source"){{
|
liquidSource = new LiquidSource("liquid-source"){{
|
||||||
requirements(Category.liquid, BuildVisibility.sandboxOnly, with());
|
requirements(Category.liquid, BuildVisibility.sandboxOnly, with());
|
||||||
alwaysUnlocked = true;
|
alwaysUnlocked = true;
|
||||||
allDatabaseTabs = true;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
liquidVoid = new LiquidVoid("liquid-void"){{
|
liquidVoid = new LiquidVoid("liquid-void"){{
|
||||||
requirements(Category.liquid, BuildVisibility.sandboxOnly, with());
|
requirements(Category.liquid, BuildVisibility.sandboxOnly, with());
|
||||||
alwaysUnlocked = true;
|
alwaysUnlocked = true;
|
||||||
allDatabaseTabs = true;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
payloadSource = new PayloadSource("payload-source"){{
|
payloadSource = new PayloadSource("payload-source"){{
|
||||||
requirements(Category.units, BuildVisibility.sandboxOnly, with());
|
requirements(Category.units, BuildVisibility.sandboxOnly, with());
|
||||||
size = 5;
|
size = 5;
|
||||||
alwaysUnlocked = true;
|
alwaysUnlocked = true;
|
||||||
allDatabaseTabs = true;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
payloadVoid = new PayloadVoid("payload-void"){{
|
payloadVoid = new PayloadVoid("payload-void"){{
|
||||||
requirements(Category.units, BuildVisibility.sandboxOnly, with());
|
requirements(Category.units, BuildVisibility.sandboxOnly, with());
|
||||||
size = 5;
|
size = 5;
|
||||||
alwaysUnlocked = true;
|
alwaysUnlocked = true;
|
||||||
allDatabaseTabs = true;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
heatSource = new HeatProducer("heat-source"){{
|
heatSource = new HeatProducer("heat-source"){{
|
||||||
@@ -5953,7 +5926,6 @@ public class Blocks{
|
|||||||
size = 1;
|
size = 1;
|
||||||
maxInstructionsPerTick = 1000;
|
maxInstructionsPerTick = 1000;
|
||||||
range = Float.MAX_VALUE;
|
range = Float.MAX_VALUE;
|
||||||
allDatabaseTabs = true;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
worldCell = new MemoryBlock("world-cell"){{
|
worldCell = new MemoryBlock("world-cell"){{
|
||||||
@@ -5963,7 +5935,6 @@ public class Blocks{
|
|||||||
privileged = true;
|
privileged = true;
|
||||||
memoryCapacity = 128;
|
memoryCapacity = 128;
|
||||||
forceDark = true;
|
forceDark = true;
|
||||||
allDatabaseTabs = true;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
worldMessage = new MessageBlock("world-message"){{
|
worldMessage = new MessageBlock("world-message"){{
|
||||||
@@ -5971,7 +5942,6 @@ public class Blocks{
|
|||||||
|
|
||||||
targetable = false;
|
targetable = false;
|
||||||
privileged = true;
|
privileged = true;
|
||||||
allDatabaseTabs = true;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
worldSwitch = new SwitchBlock("world-switch"){{
|
worldSwitch = new SwitchBlock("world-switch"){{
|
||||||
@@ -5979,7 +5949,6 @@ public class Blocks{
|
|||||||
|
|
||||||
targetable = false;
|
targetable = false;
|
||||||
privileged = true;
|
privileged = true;
|
||||||
allDatabaseTabs = true;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ public class ContentLoader{
|
|||||||
/** Calls Content#init() on everything. Use only after all modules have been created. */
|
/** Calls Content#init() on everything. Use only after all modules have been created. */
|
||||||
public void init(){
|
public void init(){
|
||||||
initialize(Content::init);
|
initialize(Content::init);
|
||||||
|
initialize(Content::postInit);
|
||||||
if(logicVars != null) logicVars.init();
|
if(logicVars != null) logicVars.init();
|
||||||
Events.fire(new ContentInitEvent());
|
Events.fire(new ContentInitEvent());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class GameState{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable Planet getPlanet(){
|
public @Nullable Planet getPlanet(){
|
||||||
return rules.sector != null ? rules.sector.planet : null;
|
return rules.sector != null ? rules.sector.planet : rules.planet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEditor(){
|
public boolean isEditor(){
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ public abstract class Content implements Comparable<Content>{
|
|||||||
/** Called after all content and modules are created. Do not use to load regions or texture data! */
|
/** Called after all content and modules are created. Do not use to load regions or texture data! */
|
||||||
public void init(){}
|
public void init(){}
|
||||||
|
|
||||||
|
/** Called after init(). */
|
||||||
|
public void postInit(){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after all content is created, only on non-headless versions.
|
* Called after all content is created, only on non-headless versions.
|
||||||
* Use for loading regions or other image data.
|
* Use for loading regions or other image data.
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import arc.scene.ui.layout.*;
|
|||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.content.*;
|
|
||||||
import mindustry.content.TechTree.*;
|
import mindustry.content.TechTree.*;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
@@ -47,7 +46,7 @@ public abstract class UnlockableContent extends MappableContent{
|
|||||||
/** If true, this content will appear in all database tabs. */
|
/** If true, this content will appear in all database tabs. */
|
||||||
public boolean allDatabaseTabs = false;
|
public boolean allDatabaseTabs = false;
|
||||||
/**
|
/**
|
||||||
* Planets that this content is made for. If empty, it is shown on all planets.
|
* Planets that this content is made for. If empty, a planet is decided based on item requirements.
|
||||||
* Currently, this is only meaningful for blocks.
|
* Currently, this is only meaningful for blocks.
|
||||||
* */
|
* */
|
||||||
public ObjectSet<Planet> shownPlanets = new ObjectSet<>();
|
public ObjectSet<Planet> shownPlanets = new ObjectSet<>();
|
||||||
@@ -55,7 +54,6 @@ public abstract class UnlockableContent extends MappableContent{
|
|||||||
* Content - usually a planet - that dictates which database tab(s) this content will appear in.
|
* Content - usually a planet - that dictates which database tab(s) this content will appear in.
|
||||||
* If nothing is defined, it will use the values in shownPlanets.
|
* If nothing is defined, it will use the values in shownPlanets.
|
||||||
* If shownPlanets is also empty, it will use Serpulo as the "default" tab.
|
* If shownPlanets is also empty, it will use Serpulo as the "default" tab.
|
||||||
* Note: When reading, use {@link #getDatabaseTabs} instead.
|
|
||||||
* */
|
* */
|
||||||
public ObjectSet<UnlockableContent> databaseTabs = new ObjectSet<>();
|
public ObjectSet<UnlockableContent> databaseTabs = new ObjectSet<>();
|
||||||
/** The tech tree node for this content, if applicable. Null if not part of a tech tree. */
|
/** The tech tree node for this content, if applicable. Null if not part of a tech tree. */
|
||||||
@@ -64,7 +62,6 @@ public abstract class UnlockableContent extends MappableContent{
|
|||||||
public Seq<TechNode> techNodes = new Seq<>();
|
public Seq<TechNode> techNodes = new Seq<>();
|
||||||
/** Unlock state. Loaded from settings. Do not modify outside the constructor. */
|
/** Unlock state. Loaded from settings. Do not modify outside the constructor. */
|
||||||
protected boolean unlocked;
|
protected boolean unlocked;
|
||||||
private boolean initializedDatabaseTabs;
|
|
||||||
|
|
||||||
public UnlockableContent(String name){
|
public UnlockableContent(String name){
|
||||||
super(name);
|
super(name);
|
||||||
@@ -75,18 +72,11 @@ public abstract class UnlockableContent extends MappableContent{
|
|||||||
this.unlocked = Core.settings != null && Core.settings.getBool(this.name + "-unlocked", false);
|
this.unlocked = Core.settings != null && Core.settings.getBool(this.name + "-unlocked", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObjectSet<UnlockableContent> getDatabaseTabs(){
|
@Override
|
||||||
//the problem here is that the planet hasn't initialized yet in init(), which means it hasn't assigned the shownPlanets yet.
|
public void postInit(){
|
||||||
//initialization has to be deferred to a getter
|
super.postInit();
|
||||||
if(!initializedDatabaseTabs){
|
|
||||||
initializedDatabaseTabs = true;
|
|
||||||
|
|
||||||
databaseTabs.addAll(shownPlanets);
|
databaseTabs.addAll(shownPlanets);
|
||||||
if(databaseTabs.isEmpty()){
|
|
||||||
databaseTabs.add(Planets.serpulo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return databaseTabs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class DatabaseDialog extends BaseDialog{
|
|||||||
for(var contents : allContent){
|
for(var contents : allContent){
|
||||||
for(var content : contents){
|
for(var content : contents){
|
||||||
if(content instanceof UnlockableContent u){
|
if(content instanceof UnlockableContent u){
|
||||||
all.addAll(u.getDatabaseTabs());
|
all.addAll(u.databaseTabs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ public class DatabaseDialog extends BaseDialog{
|
|||||||
ContentType type = ContentType.all[j];
|
ContentType type = ContentType.all[j];
|
||||||
|
|
||||||
Seq<UnlockableContent> array = allContent[j]
|
Seq<UnlockableContent> array = allContent[j]
|
||||||
.select(c -> c instanceof UnlockableContent u && !u.isHidden() && (tab == Planets.sun || u.allDatabaseTabs || u.getDatabaseTabs().contains(tab)) &&
|
.select(c -> c instanceof UnlockableContent u && !u.isHidden() && (tab == Planets.sun || u.allDatabaseTabs || u.databaseTabs.contains(tab)) &&
|
||||||
(text.isEmpty() || u.localizedName.toLowerCase().contains(text))).as();
|
(text.isEmpty() || u.localizedName.toLowerCase().contains(text))).as();
|
||||||
|
|
||||||
if(array.size == 0) continue;
|
if(array.size == 0) continue;
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
|||||||
Cons<Schematic> handler = s -> {
|
Cons<Schematic> handler = s -> {
|
||||||
if(s.tiles.contains(tile -> !tile.block.supportsEnv(sector.planet.defaultEnv) ||
|
if(s.tiles.contains(tile -> !tile.block.supportsEnv(sector.planet.defaultEnv) ||
|
||||||
//make sure block can be built here.
|
//make sure block can be built here.
|
||||||
tile.block.isOnPlanet(sector.planet))){
|
!tile.block.isOnPlanet(sector.planet))){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1160,6 +1160,22 @@ public class Block extends UnlockableContent implements Senseable{
|
|||||||
return buildVisibility != BuildVisibility.hidden;
|
return buildVisibility != BuildVisibility.hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postInit(){
|
||||||
|
//usually, an empty set of planets is a configuration error. auto-assign based on requirements
|
||||||
|
if(requirements.length > 0 && shownPlanets.isEmpty()){
|
||||||
|
for(Planet planet : content.planets()){
|
||||||
|
if(planet.isLandable()){
|
||||||
|
if(!Structs.contains(requirements, s -> !s.item.isOnPlanet(planet))){
|
||||||
|
shownPlanets.add(planet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
super.postInit();
|
||||||
|
}
|
||||||
|
|
||||||
/** Called after all blocks are created. */
|
/** Called after all blocks are created. */
|
||||||
@Override
|
@Override
|
||||||
@CallSuper
|
@CallSuper
|
||||||
|
|||||||
Reference in New Issue
Block a user