Planet selection for mods

This commit is contained in:
Anuken
2020-10-13 18:50:18 -04:00
parent 3bd3dcf03b
commit 1554fd0394
9 changed files with 50 additions and 24 deletions

View File

@@ -19,7 +19,7 @@ import static mindustry.Vars.*;
public class Planet extends UnlockableContent{
/** Default spacing between planet orbits in world units. */
private static final float orbitSpacing = 6f;
private static final float orbitSpacing = 8f;
/** intersect() temp var. */
private static final Vec3 intersectResult = new Vec3();
/** Mesh used for rendering. Created on load() - will be null on the server! */
@@ -46,6 +46,8 @@ public class Planet extends UnlockableContent{
public float sectorApproxRadius;
/** Whether this planet is tidally locked relative to its parent - see https://en.wikipedia.org/wiki/Tidal_locking */
public boolean tidalLock = false;
/** Whether or not this planet is listed in the planet access UI. **/
public boolean accessible = true;
/** The default starting sector displayed to the map dialog. */
public int startSector = 0;
/** Whether the bloom render effect is enabled. */

View File

@@ -266,6 +266,27 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
//TODO localize
t.top();
t.label(() -> mode == select ? "@sectors.select" : mode == launch ? "Select Launch Sector" : "").style(Styles.outlineLabel).color(Pal.accent);
}),
new Table(t -> {
t.right();
if(content.planets().count(p -> p.accessible) > 1) {
t.table(Styles.black6, pt -> {
//TODO localize
pt.add("[accent]Planets[]");
pt.row();
pt.image().growX().height(4f).pad(6f).color(Pal.accent);
pt.row();
for(int i = 0; i < content.planets().size; i++){
Planet planet = content.planets().get(i);
if(planet.accessible){
pt.button(planet.localizedName, Styles.clearTogglet, () -> {
renderer.planets.planet = planet;
}).width(200).height(40).growX().update(bb -> bb.setChecked(renderer.planets.planet == planet));
pt.row();
}
}
});
}
})).grow();
}