94 AbyssalEPData data = (AbyssalEPData) point.
custom;
97 StarSystemAPI system = sector.createStarSystem(
"Deep Space");
98 system.setProcgen(
true);
100 system.setName(
"Deep Space");
101 system.setOptionalUniqueId(Misc.genUID());
102 system.setType(StarSystemType.DEEP_SPACE);
103 system.addTag(Tags.THEME_HIDDEN);
104 system.addTag(Tags.THEME_SPECIAL);
105 system.addTag(Tags.TEMPORARY_LOCATION);
106 system.addTag(Tags.SYSTEM_ABYSSAL);
108 if (data.random.nextFloat() < 0.5f) {
109 system.setBackgroundTextureFilename(
"graphics/backgrounds/background4.jpg");
111 system.setBackgroundTextureFilename(
"graphics/backgrounds/background5.jpg");
114 system.getLocation().set(point.
loc.x, point.
loc.y);
116 SectorEntityToken center = system.initNonStarCenter();
118 system.setLightColor(GateHaulerLocation.ABYSS_AMBIENT_LIGHT_COLOR);
119 center.addTag(Tags.AMBIENT_LS);
122 if (objectType ==
null)
return;
124 WeightedRandomPicker<StarAge> agePicker =
new WeightedRandomPicker<StarAge>(data.random);
125 agePicker.add(StarAge.OLD, 10f);
126 agePicker.add(StarAge.AVERAGE, 5f);
127 agePicker.add(StarAge.YOUNG, 3f);
129 StarAge age = agePicker.pick();
130 String nebulaId = Planets.NEBULA_CENTER_OLD;
131 if (age == StarAge.AVERAGE) {
132 nebulaId = Planets.NEBULA_CENTER_AVERAGE;
133 }
else if (age == StarAge.YOUNG) {
134 nebulaId = Planets.NEBULA_CENTER_YOUNG;
138 StarGenDataSpec starData = (StarGenDataSpec)
141 CustomConstellationParams params =
new CustomConstellationParams(age);
142 Random prev = StarSystemGenerator.random;
143 StarSystemGenerator.random = data.random;
145 StarSystemGenerator gen =
new StarSystemGenerator(params);
146 gen.init(system, age);
148 GenContext context =
new GenContext(gen, system, system.getCenter(), starData,
149 null, 0, age.name(), 0, 1000,
null, -1);
151 context.lagrangeParent =
new GeneratedPlanet(
null,
null,
false, 0, 0, 0);
153 context.excludeCategories.add(StarSystemGenerator.CAT_HAB5);
154 context.excludeCategories.add(StarSystemGenerator.CAT_HAB4);
155 context.excludeCategories.add(StarSystemGenerator.CAT_HAB3);
156 context.excludeCategories.add(StarSystemGenerator.CAT_HAB2);
158 PlanetAPI main =
null;
161 if (objectType == RogueStellarObjectType.BLACK_HOLE) {
165 system.setStar(main);
166 system.setCenter(main);
167 system.removeEntity(center);
171 context.starData = (StarGenDataSpec)
173 StarSystemGenerator.addOrbitingEntities(system, main, age, 1, 3, 500, 0,
false,
false);
178 if (objectType == RogueStellarObjectType.PLANETOID) {
185 PlanetGenDataSpec planetData = (PlanetGenDataSpec)
Global.
getSettings().
getSpec(PlanetGenDataSpec.class, planetType,
false);
187 GenResult result = gen.addPlanet(context, planetData,
false,
true);
188 if (result ==
null || result.entities.isEmpty() ||
189 !(result.entities.get(0) instanceof PlanetAPI))
return;
190 main = (PlanetAPI) result.entities.get(0);
193 if (main ==
null)
return;
196 main.setLocation(0, 0);
198 boolean multiple = context.generatedPlanets.size() > 1;
199 int index = data.random.nextInt(20);
207 List<PlanetAPI> sorted =
new ArrayList<PlanetAPI>(system.getPlanets());
208 Collections.sort(sorted,
new Comparator<PlanetAPI>() {
209 public int compare(PlanetAPI o1, PlanetAPI o2) {
210 return (
int) Math.signum(o2.getRadius() - o1.getRadius());
216 for (PlanetAPI planet : sorted) {
217 CatalogEntryType type = CatalogEntryType.PLANET;
218 if (planet.isGasGiant()) type = CatalogEntryType.GIANT;
219 if (planet.getSpec().isBlackHole()) type = CatalogEntryType.BLACK_HOLE;
221 String firstChar =
null;
223 firstChar =
"" + Character.valueOf((
char) (
'A' + (index % 26)));
227 String name = Misc.genEntityCatalogId(firstChar, -1, -1, -1, type);
228 planet.setName(name);
229 if (planet.getMarket() !=
null) {
230 planet.getMarket().setName(name);
232 planet.getMarket().removeCondition(Conditions.RUINS_SCATTERED);
233 planet.getMarket().removeCondition(Conditions.RUINS_WIDESPREAD);
234 planet.getMarket().removeCondition(Conditions.RUINS_EXTENSIVE);
235 planet.getMarket().removeCondition(Conditions.RUINS_VAST);
236 planet.getMarket().removeCondition(Conditions.DECIVILIZED);
237 planet.getMarket().removeCondition(Conditions.DECIVILIZED_SUBPOP);
238 planet.getMarket().removeCondition(Conditions.POLLUTION);
242 if (planet.getSpec().getDescriptionId().equals(Planets.BARREN)) {
243 planet.setDescriptionIdOverride(
"barren_deep_space");
249 StarSystemGenerator.random = prev;
251 system.autogenerateHyperspaceJumpPoints(
true,
false,
false);
307 public PlanetAPI
addBlackHole(StarSystemAPI system, GenContext context, AbyssalEPData data) {
309 StarGenDataSpec starData = (StarGenDataSpec)
312 system.setLightColor(starData.getLightColorMin());
314 float radius = starData.getMinRadius() +
315 (starData.getMaxRadius() - starData.getMinRadius()) * data.random.nextFloat();
317 PlanetAPI planet = system.addPlanet(
null,
null,
null, StarTypes.BLACK_HOLE, 0, radius, 0, 0);
321 StarCoronaTerrainPlugin coronaPlugin = Misc.getCoronaFor(planet);
322 if (coronaPlugin !=
null) {
323 system.removeEntity(coronaPlugin.getEntity());
326 starData = (StarGenDataSpec)
Global.
getSettings().
getSpec(StarGenDataSpec.class, planet.getSpec().getPlanetType(),
false);
327 float corona = planet.getRadius() * (starData.getCoronaMult() + starData.getCoronaVar() * (data.random.nextFloat() - 0.5f));
328 if (corona < starData.getCoronaMin()) corona = starData.getCoronaMin();
330 SectorEntityToken eventHorizon = system.addTerrain(Terrain.EVENT_HORIZON,
331 new CoronaParams(planet.getRadius() + corona, (planet.getRadius() + corona) / 2f,
332 planet, starData.getSolarWind(),
333 (float) (starData.getMinFlare() + (starData.getMaxFlare() - starData.getMinFlare()) * data.random.nextFloat()),
334 starData.getCrLossMult()));
335 eventHorizon.setCircularOrbit(planet, 0, 0, 100);
341 TerrainGenDataSpec terrainData =
null;
342 for (TerrainGenDataSpec curr : terrainDataSpecs) {
343 if (curr.getId().equals(Tags.ACCRETION_DISK)) {
349 if (terrainData !=
null) {
350 AccretionDiskGenPlugin diskGen =
new AccretionDiskGenPlugin();
351 context.parent = planet;
352 context.currentRadius = 500f + data.random.nextFloat() * 1000f;
353 diskGen.generate(terrainData, context);
356 GeneratedPlanet p =
new GeneratedPlanet(
null, planet,
false, 0, 0, 0);
357 context.generatedPlanets.add(p);