Automatic planet detection for content

This commit is contained in:
Anuken
2024-08-22 06:54:07 -04:00
parent 4cab03a1ba
commit f888b3b77e
9 changed files with 32 additions and 51 deletions

View File

@@ -1160,6 +1160,22 @@ public class Block extends UnlockableContent implements Senseable{
return buildVisibility != BuildVisibility.hidden;
}
@Override
public void postInit(){
//usually, an empty set of planets is a configuration error. auto-assign based on requirements
if(requirements.length > 0 && shownPlanets.isEmpty()){
for(Planet planet : content.planets()){
if(planet.isLandable()){
if(!Structs.contains(requirements, s -> !s.item.isOnPlanet(planet))){
shownPlanets.add(planet);
}
}
}
}
super.postInit();
}
/** Called after all blocks are created. */
@Override
@CallSuper