No erekir launch schems / Tech tree fix

This commit is contained in:
Anuken
2022-01-28 15:52:06 -05:00
parent 98f17e15ae
commit 0579c9e6c9
6 changed files with 46 additions and 26 deletions

View File

@ -40,15 +40,15 @@ public class ErekirTechTree{
});
});
node(reinforcedContainer, () -> {
node(overflowDuct, () -> {
node(overflowDuct, () -> {
node(reinforcedContainer, () -> {
node(ductUnloader, () -> {
});
});
node(reinforcedVault, () -> {
node(reinforcedVault, () -> {
});
});
});
});

View File

@ -100,6 +100,7 @@ public class Planets{
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)
);
allowLaunchSchematics = true;
atmosphereColor = Color.valueOf("3c1b8f");
atmosphereRadIn = 0.02f;
atmosphereRadOut = 0.3f;

View File

@ -58,6 +58,7 @@ public class Schematics implements Loadable{
private OrderedMap<Schematic, FrameBuffer> previews = new OrderedMap<>();
private ObjectSet<Schematic> errored = new ObjectSet<>();
private ObjectMap<CoreBlock, Seq<Schematic>> loadouts = new ObjectMap<>();
private ObjectMap<CoreBlock, Schematic> defaultLoadouts = new ObjectMap<>();
private FrameBuffer shadowBuffer;
private Texture errorTexture;
private long lastClearTime;
@ -288,19 +289,28 @@ public class Schematics implements Loadable{
return loadouts;
}
public @Nullable Schematic getDefaultLoadout(CoreBlock block){
return defaultLoadouts.get(block);
}
/** Checks a schematic for deployment validity and adds it to the cache. */
private void checkLoadout(Schematic s, boolean validate){
private void checkLoadout(Schematic s, boolean customSchem){
Stile core = s.tiles.find(t -> t.block instanceof CoreBlock);
if(core == null) return;
int cores = s.tiles.count(t -> t.block instanceof CoreBlock);
int maxSize = getMaxLaunchSize(core.block);
//make sure a core exists, and that the schematic is small enough.
if((validate && (s.width > maxSize || s.height > maxSize
if((customSchem && (s.width > maxSize || s.height > maxSize
|| s.tiles.contains(t -> t.block.buildVisibility == BuildVisibility.sandboxOnly || !t.block.unlocked()) || cores > 1))) return;
//place in the cache
loadouts.get((CoreBlock)core.block, Seq::new).add(s);
//save non-custom loadout
if(!customSchem){
defaultLoadouts.put((CoreBlock)core.block, s);
}
}
public int getMaxLaunchSize(Block block){

View File

@ -17,7 +17,7 @@ import mindustry.world.meta.*;
import static mindustry.Vars.*;
public class ErekirPlanetGenerator extends PlanetGenerator{
public float scl = 2f;
//public float scl = 2f;
public float heightScl = 0.9f, octaves = 8, persistence = 0.7f, heightPow = 3f, heightMult = 1.6f;
//TODO inline/remove
@ -71,7 +71,7 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
float height = rawHeight(position);
Tmp.v31.set(position);
position = Tmp.v33.set(position).scl(scl);
//position = Tmp.v33.set(position).scl(scl);
//float temp = Simplex.noise3d(seed, 8, 0.6, 1f/2f, 10f + position.x, 10f + position.y + 99f, 10f + position.z);
//Mathf.clamp((int)(temp * arr.length), 0, arr[0].length - 1)
height *= 1.2f;

View File

@ -88,6 +88,8 @@ public class Planet extends UnlockableContent{
public Color atmosphereColor = new Color(0.3f, 0.7f, 1.0f);
/** Whether this planet has an atmosphere. */
public boolean hasAtmosphere = true;
/** Whether to allow users to specify a custom launch schematic for this map. */
public boolean allowLaunchSchematics = false;
/** Parent body that this planet orbits around. If null, this planet is considered to be in the middle of the solar system.*/
public @Nullable Planet parent;
/** The root parent of the whole solar system this planet is in. */

View File

@ -115,31 +115,38 @@ public class LaunchLoadoutDialog extends BaseDialog{
cont.add(Core.bundle.format("launch.from", sector.name())).row();
cont.pane(t -> {
int i = 0;
int[] i = {0};
for(var entry : schematics.getLoadouts()){
if(entry.key.size <= core.size){
for(Schematic s : entry.value){
if(s.tiles.contains(tile -> !tile.block.supportsEnv(sector.planet.defaultEnv) ||
//make sure block can be built here.
(!state.rules.hiddenBuildItems.isEmpty() && Structs.contains(tile.block.requirements, stack -> state.rules.hiddenBuildItems.contains(stack.item))))){
continue;
}
Cons<Schematic> handler = s -> {
if(s.tiles.contains(tile -> !tile.block.supportsEnv(sector.planet.defaultEnv) ||
//make sure block can be built here.
(!state.rules.hiddenBuildItems.isEmpty() && Structs.contains(tile.block.requirements, stack -> state.rules.hiddenBuildItems.contains(stack.item))))){
return;
}
t.button(b -> b.add(new SchematicImage(s)), Styles.togglet, () -> {
selected = s;
update.run();
rebuildItems.run();
}).group(group).pad(4).checked(s == selected).size(200f);
t.button(b -> b.add(new SchematicImage(s)), Styles.togglet, () -> {
selected = s;
update.run();
rebuildItems.run();
}).group(group).pad(4).checked(s == selected).size(200f);
if(++i % cols == 0){
t.row();
if(++i[0] % cols == 0){
t.row();
}
};
if(sector.planet.allowLaunchSchematics || schematics.getDefaultLoadout(core) == null){
for(var entry : schematics.getLoadouts()){
if(entry.key.size <= core.size){
for(Schematic s : entry.value){
handler.get(s);
}
}
}
}else{
//only allow launching with the standard loadout schematic
handler.get(schematics.getDefaultLoadout(core));
}
}).growX().scrollX(false);
cont.row();