Planet constructor tweaks
This commit is contained in:
@@ -15,7 +15,7 @@ public class Planets implements ContentList{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(){
|
public void load(){
|
||||||
sun = new Planet("sun", null, 0, 2){{
|
sun = new Planet("sun", null, 2){{
|
||||||
bloom = true;
|
bloom = true;
|
||||||
accessible = false;
|
accessible = false;
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ public class Planets implements ContentList{
|
|||||||
);
|
);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
erekir = new Planet("erekir", sun, 2, 1){{
|
erekir = new Planet("erekir", sun, 1, 2){{
|
||||||
generator = new ErekirPlanetGenerator();
|
generator = new ErekirPlanetGenerator();
|
||||||
meshLoader = () -> new HexMesh(this, 4);
|
meshLoader = () -> new HexMesh(this, 4);
|
||||||
atmosphereColor = Color.valueOf("f07218");
|
atmosphereColor = Color.valueOf("f07218");
|
||||||
@@ -42,7 +42,7 @@ public class Planets implements ContentList{
|
|||||||
tidalLock = true;
|
tidalLock = true;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
tantros = new Planet("tantros", sun, 2, 1){{
|
tantros = new Planet("tantros", sun, 1, 2){{
|
||||||
generator = new TantrosPlanetGenerator();
|
generator = new TantrosPlanetGenerator();
|
||||||
meshLoader = () -> new HexMesh(this, 4);
|
meshLoader = () -> new HexMesh(this, 4);
|
||||||
atmosphereColor = Color.valueOf("3db899");
|
atmosphereColor = Color.valueOf("3db899");
|
||||||
@@ -51,7 +51,7 @@ public class Planets implements ContentList{
|
|||||||
atmosphereRadOut = 0.3f;
|
atmosphereRadOut = 0.3f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
serpulo = new Planet("serpulo", sun, 3, 1){{
|
serpulo = new Planet("serpulo", sun, 1, 3){{
|
||||||
generator = new SerpuloPlanetGenerator();
|
generator = new SerpuloPlanetGenerator();
|
||||||
meshLoader = () -> new HexMesh(this, 6);
|
meshLoader = () -> new HexMesh(this, 6);
|
||||||
atmosphereColor = Color.valueOf("3c1b8f");
|
atmosphereColor = Color.valueOf("3c1b8f");
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class Planet extends UnlockableContent{
|
|||||||
/** Generator that will make the planet. Can be null for planets that don't need to be landed on. */
|
/** Generator that will make the planet. Can be null for planets that don't need to be landed on. */
|
||||||
public @Nullable PlanetGenerator generator;
|
public @Nullable PlanetGenerator generator;
|
||||||
/** Array of sectors; directly maps to tiles in the grid. */
|
/** Array of sectors; directly maps to tiles in the grid. */
|
||||||
public Seq<Sector> sectors;
|
public Seq<Sector> sectors = new Seq<>();
|
||||||
/** Radius of this planet's sphere. Does not take into account satellites. */
|
/** Radius of this planet's sphere. Does not take into account satellites. */
|
||||||
public float radius;
|
public float radius;
|
||||||
/** Atmosphere radius adjustment parameters. */
|
/** Atmosphere radius adjustment parameters. */
|
||||||
@@ -72,25 +72,12 @@ public class Planet extends UnlockableContent{
|
|||||||
/** Loads the mesh. Clientside only. Defaults to a boring sphere mesh. */
|
/** Loads the mesh. Clientside only. Defaults to a boring sphere mesh. */
|
||||||
protected Prov<PlanetMesh> meshLoader = () -> new ShaderSphereMesh(this, Shaders.unlit, 2);
|
protected Prov<PlanetMesh> meshLoader = () -> new ShaderSphereMesh(this, Shaders.unlit, 2);
|
||||||
|
|
||||||
public Planet(String name, Planet parent, int sectorSize, float radius){
|
public Planet(String name, Planet parent, float radius){
|
||||||
super(name);
|
super(name);
|
||||||
|
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
|
||||||
if(sectorSize > 0){
|
|
||||||
grid = PlanetGrid.create(sectorSize);
|
|
||||||
|
|
||||||
sectors = new Seq<>(grid.tiles.length);
|
|
||||||
for(int i = 0; i < grid.tiles.length; i++){
|
|
||||||
sectors.add(new Sector(this, grid.tiles[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
sectorApproxRadius = sectors.first().tile.v.dst(sectors.first().tile.corners[0].v);
|
|
||||||
}else{
|
|
||||||
sectors = new Seq<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
//total radius is initially just the radius
|
//total radius is initially just the radius
|
||||||
totalRadius += radius;
|
totalRadius += radius;
|
||||||
|
|
||||||
@@ -110,6 +97,21 @@ public class Planet extends UnlockableContent{
|
|||||||
for(solarSystem = this; solarSystem.parent != null; solarSystem = solarSystem.parent);
|
for(solarSystem = this; solarSystem.parent != null; solarSystem = solarSystem.parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Planet(String name, Planet parent, float radius, int sectorSize){
|
||||||
|
this(name, parent, radius);
|
||||||
|
|
||||||
|
if(sectorSize > 0){
|
||||||
|
grid = PlanetGrid.create(sectorSize);
|
||||||
|
|
||||||
|
sectors.ensureCapacity(grid.tiles.length);
|
||||||
|
for(int i = 0; i < grid.tiles.length; i++){
|
||||||
|
sectors.add(new Sector(this, grid.tiles[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
sectorApproxRadius = sectors.first().tile.v.dst(sectors.first().tile.corners[0].v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public @Nullable Sector getLastSector(){
|
public @Nullable Sector getLastSector(){
|
||||||
if(sectors.isEmpty()){
|
if(sectors.isEmpty()){
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user