Minor sound tweaks / Limited launches to not-in-progress sectors

This commit is contained in:
Anuken
2025-12-15 21:17:22 -05:00
parent a0fdf07f1e
commit 2c6a650856
19 changed files with 14 additions and 10 deletions
+1
View File
@@ -814,6 +814,7 @@ sectors.wave = Wave:
sectors.stored = Stored: sectors.stored = Stored:
sectors.resume = Resume sectors.resume = Resume
sectors.launch = Launch sectors.launch = Launch
sectors.nolaunchcandidate = No Launch Sector
sectors.viewsubmission = \ue80d View Submission sectors.viewsubmission = \ue80d View Submission
sectors.select = Select sectors.select = Select
sectors.launchselect = Select Launch Destination sectors.launchselect = Select Launch Destination
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -69,25 +69,24 @@ public abstract class PlanetGenerator extends BasicGenerator implements HexMeshe
} }
//currently played (selected) sector has all the resources //currently played (selected) sector has all the resources
if(selected != null && selected.planet == destination.planet && selected.hasBase() && selected.items().has(tmpItems)){ if(selected != null && selected.planet == destination.planet && selected.hasBase() && selected.items().has(tmpItems) && !selected.isAttacked()){
return selected; return selected;
}else{ }else{
//find the closest sector that has resources (ranked by distance, not item quantity) //find the closest sector that has resources (ranked by distance, not item quantity)
return destination.planet.sectors.min(s -> s.hasBase() && s.items().has(tmpItems), s -> s.tile.v.dst(destination.tile.v)); return destination.planet.sectors.min(s -> s.hasBase() && !s.isAttacked() && s.items().has(tmpItems), s -> s.tile.v.dst(destination.tile.v));
} }
}else{ }else{
Sector launchSector = selected != null && selected.planet == destination.planet && selected.hasBase() ? selected : null; Sector launchSector = selected != null && selected.planet == destination.planet && selected.hasBase() && !selected.isAttacked() ? selected : null;
//directly nearby. //directly nearby.
if(destination.near().contains(launchSector)) return launchSector; if(destination.near().contains(launchSector)) return launchSector;
Sector launchFrom = launchSector; Sector launchFrom = launchSector;
if(launchFrom == null || destination.preset == null){ if(launchFrom == null || destination.preset == null){
//TODO pick one with the most resources //TODO pick one with the most resources
launchFrom = destination.near().find(Sector::hasBase); launchFrom = destination.near().find(s -> s.hasBase() && !s.isAttacked());
if(launchFrom == null && destination.preset != null){ if(launchFrom == null && destination.preset != null){
if(launchSector != null) return launchSector; if(launchSector != null) return launchSector;
launchFrom = destination.planet.sectors.min(s -> !s.hasBase() ? Float.MAX_VALUE : s.tile.v.dst2(destination.tile.v)); launchFrom = destination.planet.sectors.min(s -> s.hasBase() && !s.isAttacked(), s -> s.tile.v.dst2(destination.tile.v));
if(!launchFrom.hasBase()) launchFrom = null;
} }
} }
@@ -88,7 +88,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
} }
public boolean allowNumberedLaunch(Sector s){ public boolean allowNumberedLaunch(Sector s){
return s.hasBase() && (s.info.bestCoreType.size >= 4 || s.isBeingPlayed() && state.rules.defaultTeam.cores().contains(b -> b.block.size >= 4)); return s.hasBase() && !s.isAttacked() && (s.info.bestCoreType.size >= 4 || s.isBeingPlayed() && state.rules.defaultTeam.cores().contains(b -> b.block.size >= 4));
} }
@Override @Override
@@ -434,7 +434,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
if(mode == planetLaunch || to.planet.generator == null) return launchSector; if(mode == planetLaunch || to.planet.generator == null) return launchSector;
Sector candidate = to.planet.generator.findLaunchCandidate(to, launchSector); Sector candidate = to.planet.generator.findLaunchCandidate(to, launchSector);
return candidate == null ? launchSector : candidate; return candidate == null && launchSector != null && (mode == planetLaunch || !launchSector.isAttacked()) ? launchSector : candidate;
} }
boolean showing(){ boolean showing(){
@@ -1316,12 +1316,16 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
} }
} }
boolean noCandidate = sector != sector.planet.getStartSector() && !sector.hasBase() && findLauncher(sector) == null;
stable.button( stable.button(
mode == select ? "@sectors.select" : mode == select ? "@sectors.select" :
sector.isBeingPlayed() ? "@sectors.resume" : sector.isBeingPlayed() ? "@sectors.resume" :
sector.hasBase() ? "@sectors.go" : sector.hasBase() ? "@sectors.go" :
locked ? "@locked" : "@sectors.launch", locked ? "@locked" :
locked ? Icon.lock : Icon.play, this::playSelected).growX().height(54f).minWidth(170f).padTop(4).disabled(locked); noCandidate ? "@sectors.nolaunchcandidate" :
"@sectors.launch",
locked ? Icon.lock : Icon.play, this::playSelected).growX().height(54f).minWidth(170f).padTop(4).disabled(locked || noCandidate);
} }
stable.pack(); stable.pack();