No erekir launch schems / Tech tree fix
This commit is contained in:
@@ -40,15 +40,15 @@ public class ErekirTechTree{
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
node(reinforcedContainer, () -> {
|
node(overflowDuct, () -> {
|
||||||
node(overflowDuct, () -> {
|
node(reinforcedContainer, () -> {
|
||||||
node(ductUnloader, () -> {
|
node(ductUnloader, () -> {
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
node(reinforcedVault, () -> {
|
node(reinforcedVault, () -> {
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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)
|
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");
|
atmosphereColor = Color.valueOf("3c1b8f");
|
||||||
atmosphereRadIn = 0.02f;
|
atmosphereRadIn = 0.02f;
|
||||||
atmosphereRadOut = 0.3f;
|
atmosphereRadOut = 0.3f;
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public class Schematics implements Loadable{
|
|||||||
private OrderedMap<Schematic, FrameBuffer> previews = new OrderedMap<>();
|
private OrderedMap<Schematic, FrameBuffer> previews = new OrderedMap<>();
|
||||||
private ObjectSet<Schematic> errored = new ObjectSet<>();
|
private ObjectSet<Schematic> errored = new ObjectSet<>();
|
||||||
private ObjectMap<CoreBlock, Seq<Schematic>> loadouts = new ObjectMap<>();
|
private ObjectMap<CoreBlock, Seq<Schematic>> loadouts = new ObjectMap<>();
|
||||||
|
private ObjectMap<CoreBlock, Schematic> defaultLoadouts = new ObjectMap<>();
|
||||||
private FrameBuffer shadowBuffer;
|
private FrameBuffer shadowBuffer;
|
||||||
private Texture errorTexture;
|
private Texture errorTexture;
|
||||||
private long lastClearTime;
|
private long lastClearTime;
|
||||||
@@ -288,19 +289,28 @@ public class Schematics implements Loadable{
|
|||||||
return loadouts;
|
return loadouts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public @Nullable Schematic getDefaultLoadout(CoreBlock block){
|
||||||
|
return defaultLoadouts.get(block);
|
||||||
|
}
|
||||||
|
|
||||||
/** Checks a schematic for deployment validity and adds it to the cache. */
|
/** 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);
|
Stile core = s.tiles.find(t -> t.block instanceof CoreBlock);
|
||||||
if(core == null) return;
|
if(core == null) return;
|
||||||
int cores = s.tiles.count(t -> t.block instanceof CoreBlock);
|
int cores = s.tiles.count(t -> t.block instanceof CoreBlock);
|
||||||
int maxSize = getMaxLaunchSize(core.block);
|
int maxSize = getMaxLaunchSize(core.block);
|
||||||
|
|
||||||
//make sure a core exists, and that the schematic is small enough.
|
//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;
|
|| s.tiles.contains(t -> t.block.buildVisibility == BuildVisibility.sandboxOnly || !t.block.unlocked()) || cores > 1))) return;
|
||||||
|
|
||||||
//place in the cache
|
//place in the cache
|
||||||
loadouts.get((CoreBlock)core.block, Seq::new).add(s);
|
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){
|
public int getMaxLaunchSize(Block block){
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import mindustry.world.meta.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class ErekirPlanetGenerator extends PlanetGenerator{
|
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;
|
public float heightScl = 0.9f, octaves = 8, persistence = 0.7f, heightPow = 3f, heightMult = 1.6f;
|
||||||
|
|
||||||
//TODO inline/remove
|
//TODO inline/remove
|
||||||
@@ -71,7 +71,7 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
|
|
||||||
float height = rawHeight(position);
|
float height = rawHeight(position);
|
||||||
Tmp.v31.set(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);
|
//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)
|
//Mathf.clamp((int)(temp * arr.length), 0, arr[0].length - 1)
|
||||||
height *= 1.2f;
|
height *= 1.2f;
|
||||||
|
|||||||
@@ -88,6 +88,8 @@ public class Planet extends UnlockableContent{
|
|||||||
public Color atmosphereColor = new Color(0.3f, 0.7f, 1.0f);
|
public Color atmosphereColor = new Color(0.3f, 0.7f, 1.0f);
|
||||||
/** Whether this planet has an atmosphere. */
|
/** Whether this planet has an atmosphere. */
|
||||||
public boolean hasAtmosphere = true;
|
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.*/
|
/** 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;
|
public @Nullable Planet parent;
|
||||||
/** The root parent of the whole solar system this planet is in. */
|
/** The root parent of the whole solar system this planet is in. */
|
||||||
|
|||||||
@@ -115,31 +115,38 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
|||||||
cont.add(Core.bundle.format("launch.from", sector.name())).row();
|
cont.add(Core.bundle.format("launch.from", sector.name())).row();
|
||||||
|
|
||||||
cont.pane(t -> {
|
cont.pane(t -> {
|
||||||
int i = 0;
|
int[] i = {0};
|
||||||
|
|
||||||
for(var entry : schematics.getLoadouts()){
|
Cons<Schematic> handler = s -> {
|
||||||
if(entry.key.size <= core.size){
|
if(s.tiles.contains(tile -> !tile.block.supportsEnv(sector.planet.defaultEnv) ||
|
||||||
for(Schematic s : entry.value){
|
//make sure block can be built here.
|
||||||
if(s.tiles.contains(tile -> !tile.block.supportsEnv(sector.planet.defaultEnv) ||
|
(!state.rules.hiddenBuildItems.isEmpty() && Structs.contains(tile.block.requirements, stack -> state.rules.hiddenBuildItems.contains(stack.item))))){
|
||||||
//make sure block can be built here.
|
return;
|
||||||
(!state.rules.hiddenBuildItems.isEmpty() && Structs.contains(tile.block.requirements, stack -> state.rules.hiddenBuildItems.contains(stack.item))))){
|
}
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
t.button(b -> b.add(new SchematicImage(s)), Styles.togglet, () -> {
|
t.button(b -> b.add(new SchematicImage(s)), Styles.togglet, () -> {
|
||||||
selected = s;
|
selected = s;
|
||||||
update.run();
|
update.run();
|
||||||
rebuildItems.run();
|
rebuildItems.run();
|
||||||
}).group(group).pad(4).checked(s == selected).size(200f);
|
}).group(group).pad(4).checked(s == selected).size(200f);
|
||||||
|
|
||||||
if(++i % cols == 0){
|
if(++i[0] % cols == 0){
|
||||||
t.row();
|
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);
|
}).growX().scrollX(false);
|
||||||
|
|
||||||
cont.row();
|
cont.row();
|
||||||
|
|||||||
Reference in New Issue
Block a user