20 if (context.lagrangeParent ==
null || context.lagrangePointType ==
null)
return null;
24 SectorEntityToken parent = context.center;
25 if (context.parent !=
null) parent = context.parent;
26 if (context.lagrangeParent !=
null) parent = context.center;
30 for (
int i = 5; i <= 15; i++) {
31 sizePicker.add(i, 20 - i);
34 int size = sizePicker.pick();
36 float radius = NebulaTerrainPlugin.TILE_SIZE * (float) size / 2f;
38 StarSystemAPI system = context.system;
39 float orbitRadius = context.currentRadius + radius;
43 if (context.lagrangeParent !=
null) {
44 orbitRadius = context.lagrangeParent.orbitRadius;
45 orbitDays = context.lagrangeParent.orbitDays;
48 angle = context.lagrangeParent.orbitAngle + angleOffset;
51 if (radius > orbitRadius * 0.5f) {
52 radius = orbitRadius * 0.5f;
55 StringBuilder sb =
new StringBuilder();
56 for (
int i = 0; i < size * size; i++) {
59 String initStr = sb.toString();
63 SectorEntityToken nebula = system.addTerrain(Terrain.NEBULA,
new BaseTiledTerrain.TileParams(
66 "terrain", nebulaType, 4, 4,
null));
67 nebula.setCircularOrbit(parent, angle, orbitRadius, orbitDays);
69 NebulaTerrainPlugin nebulaPlugin = (NebulaTerrainPlugin)((CampaignTerrainAPI)nebula).getPlugin();
73 editor.
clearArc(nebula.getLocation().x, nebula.getLocation().y, radius * 0.8f, radius * 3f, 0, 360f);
75 GenResult result =
new GenResult();
76 result.onlyIncrementByWidth =
false;
77 result.orbitalWidth = radius * 2f;
78 result.entities.add(nebula);