70 StarSystemAPI system = context.system;
71 SectorEntityToken parent = context.center;
72 if (context.parent !=
null) parent = context.parent;
74 float orbitRadius = context.currentRadius;
80 float bandWidth = 256f;
82 RingGenData data =
getData(context);
87 List<SectorEntityToken> rings =
new ArrayList<SectorEntityToken>();
88 float totalWidth = 0f;
92 totalWidth = bandWidth * 2f + spacing;
96 rings.add(system.addRingBand(parent,
"misc", tex.tex, 256f, tex.index, color, bandWidth,
97 orbitRadius + bandWidth / 2f, orbitDays, Terrain.RING,
null));
99 orbitDays = (orbitRadius + bandWidth / 2f + spacing + bandWidth / 2f) / (15f + 5f *
StarSystemGenerator.
random.nextFloat());
101 rings.add(system.addRingBand(parent,
"misc", tex.tex, 256f, tex.index, color, bandWidth,
102 orbitRadius + bandWidth / 2f + spacing + bandWidth / 2f, orbitDays * 1.2f, Terrain.RING,
null));
112 float startingRadius = orbitRadius + bandWidth/2f;
113 float spacing = bandWidth * 0.5f;
114 for (
float i = 0; i < numBands; i++) {
115 float currentRadius = startingRadius + i * spacing;
122 rings.add(system.addRingBand(parent,
"misc", tex.tex, 256f, tex.index, color, bandWidth,
123 currentRadius, orbitDays * 1.2f, Terrain.RING,
null));
129 rings.add(system.addRingBand(parent,
"misc", tex.tex, 256f, tex.index, color, bandWidth,
130 currentRadius, orbitDays * 1.4f, Terrain.RING,
null));
134 totalWidth = (numBands - 1f) * spacing + bandWidth;
138 if (context.orbitIndex > 0 && data.lastOrbitAddedAt == context.orbitIndex - 1) {
139 float spacing = bandWidth * 0.5f;
140 for (
float currRadius = data.endOfLastRingRadius; currRadius <= orbitRadius; currRadius += spacing) {
143 rings.add(system.addRingBand(parent,
"misc", tex.tex, 256f, tex.index, color, bandWidth,
144 currRadius, orbitDays, Terrain.RING,
null));
147 if (data.lastBatch !=
null) {
148 rings.addAll(data.lastBatch);
151 for (SectorEntityToken ring : rings) {
152 context.gen.getAllEntitiesAdded().remove(ring);
157 data.lastOrbitAddedAt = context.orbitIndex;
158 data.endOfLastRingRadius = orbitRadius + bandWidth;
159 data.lastBatch =
new ArrayList<SectorEntityToken>(rings);
162 GenResult result =
new GenResult();
163 result.onlyIncrementByWidth =
false;
164 result.orbitalWidth = totalWidth;
165 result.entities.addAll(rings);