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 mindustry.ctype.*;
import mindustry.game.*;
import mindustry.graphics.*;
import mindustry.graphics.g3d.*;
import mindustry.graphics.g3d.PlanetGrid.*;
import mindustry.maps.generators.*;
@@ -51,19 +50,23 @@ public class Planets implements ContentList{
atmosphereRadIn = 0.02f;
atmosphereRadOut = 0.3f;
tidalLock = true;
orbitSpacing = 0.5f;
totalRadius += 2.4f;
orbitSpacing = 0.45f;
totalRadius += 2.6f;
}};
float[] offsets = {40, 0, 0, 20};
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;
//for testing only!
alwaysUnlocked = true;
updateLighting = false;
sectors.add(new Sector(this, Ptile.empty));
camRadius = 0.43f;
orbitOffset = 0f;
camRadius = 0.68f;
minZoom = 0.6f;
drawOrbit = false;
orbitOffset = offsets[fi];
//new SectorPreset(name + "-sector", this, 0){{
@@ -89,12 +92,14 @@ public class Planets implements ContentList{
meshLoader = () -> {
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));
int am = Mathf.random(3, 6);
meshes.add(new NoiseMesh(this, 0, 2, color, radius, 2, 0.55f, 0.45f, 14f));
int am = rand.random(3, 7);
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));

View File

@@ -178,7 +178,7 @@ public class PlanetRenderer implements Disposable{
}
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;
float radius = planet.orbitRadius;

View File

@@ -35,6 +35,10 @@ public class Planet extends UnlockableContent{
public float radius;
/** Camera radius offset. */
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. */
public float atmosphereRadIn = 0, atmosphereRadOut = 0.3f;
/** 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 -> {
zoom = Mathf.clamp(zoom + value / 10f, 0.5f, 2f);
zoom = Mathf.clamp(zoom + value / 10f, planets.planet.minZoom, 2f);
});
addCaptureListener(new ElementGestureListener(){
@@ -133,7 +133,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
lastZoom = zoom;
}
zoom = (Mathf.clamp(initialDistance / distance * lastZoom, 0.5f, 2f));
zoom = (Mathf.clamp(initialDistance / distance * lastZoom, planets.planet.minZoom, 2f));
}
@Override
@@ -931,7 +931,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
from.removeItems(universe.getLaunchResources());
launching = true;
zoom = 0.5f;
zoom = planets.planet.minZoom;
ui.hudfrag.showLaunchDirect();
Time.runTask(launchDuration, () -> control.playSector(from, sector));