package mindustry.content; import arc.func.*; import arc.graphics.*; import arc.math.*; import arc.math.geom.*; import arc.struct.*; import arc.util.*; import mindustry.graphics.*; import mindustry.graphics.g3d.*; import mindustry.graphics.g3d.PlanetGrid.*; import mindustry.maps.planet.*; import mindustry.type.*; import mindustry.world.*; public class Planets{ public static Planet sun, erekir, tantros, serpulo; public static void load(){ sun = new Planet("sun", null, 4f){{ bloom = true; accessible = false; meshLoader = () -> new SunMesh( this, 4, 5, 0.3, 1.7, 1.2, 1, 1.1f, Color.valueOf("ff7a38"), Color.valueOf("ff9638"), Color.valueOf("ffc64c"), Color.valueOf("ffc64c"), Color.valueOf("ffe371"), Color.valueOf("f4ee8e") ); }}; erekir = new Planet("erekir", sun, 1f, 2){{ generator = new ErekirPlanetGenerator(); meshLoader = () -> new HexMesh(this, 5); atmosphereColor = Color.valueOf("f07218"); startSector = 10; atmosphereRadIn = 0.02f; atmosphereRadOut = 0.3f; tidalLock = true; orbitSpacing = 2f; totalRadius += 2.6f; lightSrcTo = 0.5f; lightDstFrom = 0.2f; //TODO alwaysUnlocked = true; }}; makeAsteroid("gier", erekir, Blocks.ferricStoneWall, Blocks.carbonWall, 0.4f, 7, 1f, gen -> { gen.min = 25; gen.max = 35; gen.carbonChance = 0.6f; gen.iceChance = 0f; gen.berylChance = 0.1f; }); makeAsteroid("notva", sun, Blocks.ferricStoneWall, Blocks.beryllicStoneWall, 0.55f, 9, 1.3f, gen -> { gen.berylChance = 0.8f; gen.iceChance = 0f; gen.carbonChance = 0.01f; gen.max += 2; }); tantros = new Planet("tantros", sun, 1f, 2){{ generator = new TantrosPlanetGenerator(); meshLoader = () -> new HexMesh(this, 4); atmosphereColor = Color.valueOf("3db899"); startSector = 10; atmosphereRadIn = -0.01f; atmosphereRadOut = 0.3f; alwaysUnlocked = true; }}; serpulo = new Planet("serpulo", sun, 1f, 3){{ generator = new SerpuloPlanetGenerator(); meshLoader = () -> new HexMesh(this, 6); cloudMeshLoader = () -> new MultiMesh( new HexSkyMesh(this, 11, 0.15f, 0.13f, 5, new Color().set(Pal.spore).mul(0.9f).a(0.75f), 2, 0.45f, 0.9f, 0.38f), 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) ); atmosphereColor = Color.valueOf("3c1b8f"); atmosphereRadIn = 0.02f; atmosphereRadOut = 0.3f; startSector = 15; alwaysUnlocked = true; landCloudColor = Pal.spore.cpy().a(0.5f); }}; makeAsteroid("verlius", sun, Blocks.stoneWall, Blocks.iceWall, 0.5f, 12, 2f, gen -> { gen.berylChance = 0f; gen.iceChance = 0.6f; gen.carbonChance = 0.1f; gen.ferricChance = 0f; }); } private static void makeAsteroid(String name, Planet parent, Block base, Block tint, float tintThresh, int pieces, float scale, Cons cgen){ new Planet(name, parent, 0.12f){{ hasAtmosphere = false; alwaysUnlocked = true; //for testing only! updateLighting = false; sectors.add(new Sector(this, Ptile.empty)); camRadius = 0.68f * scale; minZoom = 0.6f; drawOrbit = false; clipRadius = 2f; generator = new AsteroidGenerator(); cgen.get((AsteroidGenerator)generator); meshLoader = () -> { Color tinted = tint.mapColor.cpy().a(1f - tint.mapColor.a); Seq meshes = new Seq<>(); Color color = base.mapColor; Rand rand = new Rand(id + 2); meshes.add(new NoiseMesh( this, 0, 2, radius, 2, 0.55f, 0.45f, 14f, color, tinted, 3, 0.6f, 0.38f, tintThresh )); for(int j = 0; j < pieces; j++){ meshes.add(new MatMesh( new NoiseMesh(this, j + 1, 1, 0.022f + rand.random(0.039f) * scale, 2, 0.6f, 0.38f, 20f, color, tinted, 3, 0.6f, 0.38f, tintThresh), new Mat3D().setToTranslation(Tmp.v31.setToRandomDirection(rand).setLength(rand.random(0.44f, 1.4f) * scale))) ); } return new MultiMesh(meshes.toArray(GenericMesh.class)); }; }}; } }