diff --git a/core/src/mindustry/maps/generators/BasicGenerator.java b/core/src/mindustry/maps/generators/BasicGenerator.java index 57cd4a583b..ee279ff30c 100644 --- a/core/src/mindustry/maps/generators/BasicGenerator.java +++ b/core/src/mindustry/maps/generators/BasicGenerator.java @@ -21,12 +21,10 @@ public abstract class BasicGenerator implements WorldGenerator{ protected Rand rand = new Rand(); protected int width, height; - protected Tiles tiles; + protected @Nullable Tiles tiles; //for drawing - protected Block floor; - protected Block block; - protected Block ore; + protected @Nullable Block floor, block, ore; @Override public void generate(Tiles tiles){ diff --git a/core/src/mindustry/maps/generators/PlanetGenerator.java b/core/src/mindustry/maps/generators/PlanetGenerator.java index 55f2159ea1..3b67cd13c1 100644 --- a/core/src/mindustry/maps/generators/PlanetGenerator.java +++ b/core/src/mindustry/maps/generators/PlanetGenerator.java @@ -3,6 +3,7 @@ package mindustry.maps.generators; import arc.math.geom.*; import arc.struct.*; import arc.struct.ObjectIntMap.*; +import arc.util.*; import arc.util.noise.*; import mindustry.content.*; import mindustry.ctype.*; @@ -20,7 +21,7 @@ public abstract class PlanetGenerator extends BasicGenerator implements HexMeshe public int seed = 0; protected IntSeq ints = new IntSeq(); - protected Sector sector; + protected @Nullable Sector sector; /** Should generate sector bases for a planet. */ public void generateSector(Sector sector){ diff --git a/core/src/mindustry/maps/planet/AsteroidGenerator.java b/core/src/mindustry/maps/planet/AsteroidGenerator.java index 8b632af9a9..09112f83f3 100644 --- a/core/src/mindustry/maps/planet/AsteroidGenerator.java +++ b/core/src/mindustry/maps/planet/AsteroidGenerator.java @@ -2,6 +2,7 @@ package mindustry.maps.planet; import arc.math.*; import arc.math.geom.*; +import arc.util.*; import arc.util.noise.*; import mindustry.content.*; import mindustry.game.*; @@ -21,7 +22,7 @@ public class AsteroidGenerator extends BlankPlanetGenerator{ public float thoriumScl = 1f, copperScale = 1f, leadScale = 1f, graphiteScale = 1f, berylliumScale = 1f; - Rand rand; + @Nullable Rand rand; int seed; void asteroid(int ax, int ay, int radius){ diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index 7f8c7873d7..a31a132b57 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -32,6 +32,7 @@ import mindustry.game.Objectives.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.graphics.g3d.*; +import mindustry.graphics.g3d.PlanetGrid.*; import mindustry.io.*; import mindustry.maps.generators.*; import mindustry.maps.planet.*; @@ -499,6 +500,7 @@ public class ContentParser{ SectorPreset out = new SectorPreset(name, locate(ContentType.planet, value.getString("planet", "serpulo")), value.getInt("sector")); value.remove("sector"); value.remove("planet"); + currentContent = out; read(() -> readFields(out, value)); return out; }, @@ -508,12 +510,14 @@ public class ContentParser{ Planet parent = locate(ContentType.planet, value.getString("parent")); Planet planet = new Planet(name, parent, value.getFloat("radius", 1f), value.getInt("sectorSize", 0)); - //TODO unimplemented; still needs generator + mesh if(value.has("mesh")){ planet.meshLoader = () -> parser.readValue(GenericMesh.class, value.get("mesh")); } - //TODO unimplemented!! + //always one sector right now... + planet.sectors.add(new Sector(planet, Ptile.empty)); + + currentContent = planet; read(() -> readFields(planet, value)); return planet; }