Asteroid progress

This commit is contained in:
Anuken
2021-06-11 21:51:49 -04:00
parent c4b1bf3e55
commit ae52eaab19
5 changed files with 23 additions and 14 deletions

View File

@@ -7,7 +7,6 @@ import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.ctype.*; import mindustry.ctype.*;
import mindustry.game.*; import mindustry.game.*;
import mindustry.graphics.*;
import mindustry.graphics.g3d.*; import mindustry.graphics.g3d.*;
import mindustry.graphics.g3d.PlanetGrid.*; import mindustry.graphics.g3d.PlanetGrid.*;
import mindustry.maps.generators.*; import mindustry.maps.generators.*;
@@ -51,19 +50,23 @@ public class Planets implements ContentList{
atmosphereRadIn = 0.02f; atmosphereRadIn = 0.02f;
atmosphereRadOut = 0.3f; atmosphereRadOut = 0.3f;
tidalLock = true; tidalLock = true;
orbitSpacing = 0.5f; orbitSpacing = 0.45f;
totalRadius += 2.4f; totalRadius += 2.6f;
}}; }};
float[] offsets = {40, 0, 0, 20};
for(int i = 0; i < 4; i++){ for(int i = 0; i < 4; i++){
new Planet("gier-" + i, erekir, 0.1f){{ int fi = i;
new Planet("gier-" + i, erekir, 0.12f){{
hasAtmosphere = false; hasAtmosphere = false;
//for testing only! //for testing only!
alwaysUnlocked = true; alwaysUnlocked = true;
updateLighting = false; updateLighting = false;
sectors.add(new Sector(this, Ptile.empty)); sectors.add(new Sector(this, Ptile.empty));
camRadius = 0.43f; camRadius = 0.68f;
orbitOffset = 0f; minZoom = 0.6f;
drawOrbit = false;
orbitOffset = offsets[fi];
//new SectorPreset(name + "-sector", this, 0){{ //new SectorPreset(name + "-sector", this, 0){{
@@ -89,12 +92,14 @@ public class Planets implements ContentList{
meshLoader = () -> { meshLoader = () -> {
Seq<GenericMesh> meshes = new Seq<>(); Seq<GenericMesh> meshes = new Seq<>();
Color color = Color.valueOf("57504b");
Rand rand = new Rand(2);
meshes.add(new NoiseMesh(this, 0, 2, Pal.gray, radius, 2, 0.55f, 0.45f, 14f)); meshes.add(new NoiseMesh(this, 0, 2, color, radius, 2, 0.55f, 0.45f, 14f));
int am = Mathf.random(3, 6); int am = rand.random(3, 7);
for(int j = 0; j < am; j++){ for(int j = 0; j < am; j++){
meshes.add(new MatMesh(new NoiseMesh(this, j + 1, 1, Pal.gray, 0.025f + Mathf.random(0.046f), 2, 0.6f, 0.38f, 20f), new Mat3D().setToTranslation(Tmp.v31.setToRandomDirection().setLength(Mathf.random(0.3f, 1.3f))))); meshes.add(new MatMesh(new NoiseMesh(this, j + 1, 1, color, 0.022f + rand.random(0.039f), 2, 0.6f, 0.38f, 20f), new Mat3D().setToTranslation(Tmp.v31.setToRandomDirection(rand).setLength(rand.random(0.44f, 1.4f)))));
} }
return new MultiMesh(meshes.toArray(GenericMesh.class)); return new MultiMesh(meshes.toArray(GenericMesh.class));

View File

@@ -178,7 +178,7 @@ public class PlanetRenderer implements Disposable{
} }
public void renderOrbit(Planet planet){ public void renderOrbit(Planet planet){
if(planet.parent == null || !planet.visible() || orbitAlpha <= 0.02f) return; if(planet.parent == null || !planet.visible() || orbitAlpha <= 0.02f || !planet.drawOrbit) return;
Vec3 center = planet.parent.position; Vec3 center = planet.parent.position;
float radius = planet.orbitRadius; float radius = planet.orbitRadius;

View File

@@ -35,6 +35,10 @@ public class Planet extends UnlockableContent{
public float radius; public float radius;
/** Camera radius offset. */ /** Camera radius offset. */
public float camRadius; public float camRadius;
/** Minimum camera zoom value. */
public float minZoom = 0.5f;
/** Whether to draw the orbital circle. */
public boolean drawOrbit = true;
/** Atmosphere radius adjustment parameters. */ /** Atmosphere radius adjustment parameters. */
public float atmosphereRadIn = 0, atmosphereRadOut = 0.3f; public float atmosphereRadIn = 0, atmosphereRadOut = 0.3f;
/** Orbital radius around the sun. Do not change unless you know exactly what you are doing.*/ /** Orbital radius around the sun. Do not change unless you know exactly what you are doing.*/

View File

@@ -121,7 +121,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
}); });
scrolled(value -> { scrolled(value -> {
zoom = Mathf.clamp(zoom + value / 10f, 0.5f, 2f); zoom = Mathf.clamp(zoom + value / 10f, planets.planet.minZoom, 2f);
}); });
addCaptureListener(new ElementGestureListener(){ addCaptureListener(new ElementGestureListener(){
@@ -133,7 +133,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
lastZoom = zoom; lastZoom = zoom;
} }
zoom = (Mathf.clamp(initialDistance / distance * lastZoom, 0.5f, 2f)); zoom = (Mathf.clamp(initialDistance / distance * lastZoom, planets.planet.minZoom, 2f));
} }
@Override @Override
@@ -931,7 +931,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
from.removeItems(universe.getLaunchResources()); from.removeItems(universe.getLaunchResources());
launching = true; launching = true;
zoom = 0.5f; zoom = planets.planet.minZoom;
ui.hudfrag.showLaunchDirect(); ui.hudfrag.showLaunchDirect();
Time.runTask(launchDuration, () -> control.playSector(from, sector)); Time.runTask(launchDuration, () -> control.playSector(from, sector));

View File

@@ -9,4 +9,4 @@ kapt.use.worker.api=true
kapt.include.compile.classpath=false kapt.include.compile.classpath=false
# I don't need to use the kotlin stdlib yet, so remove it to prevent extra bloat & method count issues # I don't need to use the kotlin stdlib yet, so remove it to prevent extra bloat & method count issues
kotlin.stdlib.default.dependency=false kotlin.stdlib.default.dependency=false
archash=ea70a34cc621c2c75d0aef5511c7f5aa4ced0d46 archash=3926b785320fea0cd9ca597f6bfa9071263a5464