Planet launch candidate system
This commit is contained in:
@@ -18,7 +18,10 @@ public class Planets{
|
|||||||
sun,
|
sun,
|
||||||
erekir,
|
erekir,
|
||||||
tantros,
|
tantros,
|
||||||
serpulo;
|
serpulo,
|
||||||
|
gier,
|
||||||
|
notva,
|
||||||
|
verilus;
|
||||||
|
|
||||||
public static void load(){
|
public static void load(){
|
||||||
sun = new Planet("sun", null, 4f){{
|
sun = new Planet("sun", null, 4f){{
|
||||||
@@ -52,7 +55,8 @@ public class Planets{
|
|||||||
lightDstFrom = 0.2f;
|
lightDstFrom = 0.2f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
makeAsteroid("gier", erekir, Blocks.ferricStoneWall, Blocks.carbonWall, 0.4f, 7, 1f, gen -> {
|
//TODO names
|
||||||
|
gier = makeAsteroid("gier", erekir, Blocks.ferricStoneWall, Blocks.carbonWall, 0.4f, 7, 1f, gen -> {
|
||||||
gen.min = 25;
|
gen.min = 25;
|
||||||
gen.max = 35;
|
gen.max = 35;
|
||||||
gen.carbonChance = 0.6f;
|
gen.carbonChance = 0.6f;
|
||||||
@@ -60,7 +64,7 @@ public class Planets{
|
|||||||
gen.berylChance = 0.1f;
|
gen.berylChance = 0.1f;
|
||||||
});
|
});
|
||||||
|
|
||||||
makeAsteroid("notva", sun, Blocks.ferricStoneWall, Blocks.beryllicStoneWall, 0.55f, 9, 1.3f, gen -> {
|
notva = makeAsteroid("notva", sun, Blocks.ferricStoneWall, Blocks.beryllicStoneWall, 0.55f, 9, 1.3f, gen -> {
|
||||||
gen.berylChance = 0.8f;
|
gen.berylChance = 0.8f;
|
||||||
gen.iceChance = 0f;
|
gen.iceChance = 0f;
|
||||||
gen.carbonChance = 0.01f;
|
gen.carbonChance = 0.01f;
|
||||||
@@ -91,16 +95,20 @@ public class Planets{
|
|||||||
landCloudColor = Pal.spore.cpy().a(0.5f);
|
landCloudColor = Pal.spore.cpy().a(0.5f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
makeAsteroid("verlius", sun, Blocks.stoneWall, Blocks.iceWall, 0.5f, 12, 2f, gen -> {
|
verilus = makeAsteroid("verlius", sun, Blocks.stoneWall, Blocks.iceWall, 0.5f, 12, 2f, gen -> {
|
||||||
gen.berylChance = 0f;
|
gen.berylChance = 0f;
|
||||||
gen.iceChance = 0.6f;
|
gen.iceChance = 0.6f;
|
||||||
gen.carbonChance = 0.1f;
|
gen.carbonChance = 0.1f;
|
||||||
gen.ferricChance = 0f;
|
gen.ferricChance = 0f;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//define launch candidates after all planets initialize
|
||||||
|
serpulo.launchCandidates.add(gier);
|
||||||
|
gier.launchCandidates.add(erekir);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void makeAsteroid(String name, Planet parent, Block base, Block tint, float tintThresh, int pieces, float scale, Cons<AsteroidGenerator> cgen){
|
private static Planet makeAsteroid(String name, Planet parent, Block base, Block tint, float tintThresh, int pieces, float scale, Cons<AsteroidGenerator> cgen){
|
||||||
new Planet(name, parent, 0.12f){{
|
return new Planet(name, parent, 0.12f){{
|
||||||
hasAtmosphere = false;
|
hasAtmosphere = false;
|
||||||
updateLighting = false;
|
updateLighting = false;
|
||||||
sectors.add(new Sector(this, Ptile.empty));
|
sectors.add(new Sector(this, Ptile.empty));
|
||||||
|
|||||||
@@ -109,8 +109,9 @@ public class AsteroidGenerator extends BlankPlanetGenerator{
|
|||||||
//copper only generates on ferric stone
|
//copper only generates on ferric stone
|
||||||
ore(Blocks.oreCopper, Blocks.ferricStone, 5f, 0.8f * copperScale);
|
ore(Blocks.oreCopper, Blocks.ferricStone, 5f, 0.8f * copperScale);
|
||||||
|
|
||||||
//thorium only generates on beryllic stone
|
//thorium only generates on beryllic stone and graphitic stone
|
||||||
ore(Blocks.oreThorium, Blocks.beryllicStone, 4f, 0.9f * thoriumScl);
|
ore(Blocks.oreThorium, Blocks.beryllicStone, 4f, 0.9f * thoriumScl);
|
||||||
|
ore(Blocks.oreThorium, Blocks.carbonStone, 4f, 0.9f * thoriumScl);
|
||||||
|
|
||||||
wallOre(Blocks.carbonWall, Blocks.graphiticWall, 35f, 0.57f * graphiteScale);
|
wallOre(Blocks.carbonWall, Blocks.graphiticWall, 35f, 0.57f * graphiteScale);
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ public class Planet extends UnlockableContent{
|
|||||||
public Seq<Planet> children = new Seq<>();
|
public Seq<Planet> children = new Seq<>();
|
||||||
/** Default root node shown when the tech tree is opened here. */
|
/** Default root node shown when the tech tree is opened here. */
|
||||||
public @Nullable TechNode techTree;
|
public @Nullable TechNode techTree;
|
||||||
|
/** Planets that can be launched to from this one. Made mutual in init(). */
|
||||||
|
public Seq<Planet> launchCandidates = new Seq<>();
|
||||||
/** Loads the mesh. Clientside only. Defaults to a boring sphere mesh. */
|
/** Loads the mesh. Clientside only. Defaults to a boring sphere mesh. */
|
||||||
protected Prov<GenericMesh> meshLoader = () -> new ShaderSphereMesh(this, Shaders.unlit, 2), cloudMeshLoader = () -> null;
|
protected Prov<GenericMesh> meshLoader = () -> new ShaderSphereMesh(this, Shaders.unlit, 2), cloudMeshLoader = () -> null;
|
||||||
|
|
||||||
@@ -265,6 +267,17 @@ public class Planet extends UnlockableContent{
|
|||||||
updateBaseCoverage();
|
updateBaseCoverage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//make planet launch candidates mutual.
|
||||||
|
var candidates = launchCandidates.copy();
|
||||||
|
|
||||||
|
for(Planet planet : content.planets()){
|
||||||
|
if(planet.launchCandidates.contains(this)){
|
||||||
|
candidates.addUnique(planet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
launchCandidates = candidates;
|
||||||
|
|
||||||
clipRadius = Math.max(clipRadius, radius + atmosphereRadOut + 0.5f);
|
clipRadius = Math.max(clipRadius, radius + atmosphereRadOut + 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,6 +126,10 @@ public class Sector{
|
|||||||
|
|
||||||
public String name(){
|
public String name(){
|
||||||
if(preset != null && info.name == null) return preset.localizedName;
|
if(preset != null && info.name == null) return preset.localizedName;
|
||||||
|
//single-sector "planets" use their own name for the sector name.
|
||||||
|
if(info.name == null && planet.sectors.size == 1){
|
||||||
|
return planet.localizedName;
|
||||||
|
}
|
||||||
return info.name == null ? id + "" : info.name;
|
return info.name == null ? id + "" : info.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -256,6 +256,13 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
launchSector = sector;
|
launchSector = sector;
|
||||||
|
|
||||||
|
//automatically select next planets; TODO pan!
|
||||||
|
if(sector.planet.launchCandidates.size == 1){
|
||||||
|
state.planet = sector.planet.launchCandidates.first();
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO pan over to correct planet
|
||||||
|
|
||||||
//update view to sector
|
//update view to sector
|
||||||
zoom = 1f;
|
zoom = 1f;
|
||||||
state.zoom = 1f;
|
state.zoom = 1f;
|
||||||
@@ -292,7 +299,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
|
|
||||||
boolean canSelect(Sector sector){
|
boolean canSelect(Sector sector){
|
||||||
if(mode == select) return sector.hasBase();
|
if(mode == select) return sector.hasBase();
|
||||||
//cannot launch to existing sector w/ accelerator
|
//cannot launch to existing sector w/ accelerator TODO test
|
||||||
if(mode == planetLaunch) return !sector.hasBase();
|
if(mode == planetLaunch) return !sector.hasBase();
|
||||||
if(sector.hasBase() || sector.id == sector.planet.startSector) return true;
|
if(sector.hasBase() || sector.id == sector.planet.startSector) return true;
|
||||||
//preset sectors can only be selected once unlocked
|
//preset sectors can only be selected once unlocked
|
||||||
@@ -452,7 +459,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
boolean selectable(Planet planet){
|
boolean selectable(Planet planet){
|
||||||
//TODO what if any sector is selectable?
|
//TODO what if any sector is selectable?
|
||||||
//TODO launch criteria - which planets can be launched to? Where should this be defined? Should planets even be selectable?
|
//TODO launch criteria - which planets can be launched to? Where should this be defined? Should planets even be selectable?
|
||||||
if(mode == planetLaunch) return launchSector != null && planet != launchSector.planet;
|
if(mode == planetLaunch) return launchSector != null && planet != launchSector.planet && launchSector.planet.launchCandidates.contains(planet);
|
||||||
return planet == state.planet || (planet.alwaysUnlocked && planet.isLandable()) || planet.sectors.contains(Sector::hasBase);
|
return planet == state.planet || (planet.alwaysUnlocked && planet.isLandable()) || planet.sectors.contains(Sector::hasBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user