Planet launch candidate system

This commit is contained in:
Anuken
2022-01-08 22:21:59 -05:00
parent 39cb353b13
commit c788f4a7f8
5 changed files with 42 additions and 9 deletions
@@ -256,6 +256,13 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
this.listener = listener;
launchSector = sector;
//automatically select next planets; TODO pan!
if(sector.planet.launchCandidates.size == 1){
state.planet = sector.planet.launchCandidates.first();
}
//TODO pan over to correct planet
//update view to sector
zoom = 1f;
state.zoom = 1f;
@@ -292,7 +299,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
boolean canSelect(Sector sector){
if(mode == select) return sector.hasBase();
//cannot launch to existing sector w/ accelerator
//cannot launch to existing sector w/ accelerator TODO test
if(mode == planetLaunch) return !sector.hasBase();
if(sector.hasBase() || sector.id == sector.planet.startSector) return true;
//preset sectors can only be selected once unlocked
@@ -452,7 +459,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
boolean selectable(Planet planet){
//TODO what if any sector is selectable?
//TODO launch criteria - which planets can be launched to? Where should this be defined? Should planets even be selectable?
if(mode == planetLaunch) return launchSector != null && planet != launchSector.planet;
if(mode == planetLaunch) return launchSector != null && planet != launchSector.planet && launchSector.planet.launchCandidates.contains(planet);
return planet == state.planet || (planet.alwaysUnlocked && planet.isLandable()) || planet.sectors.contains(Sector::hasBase);
}