79 if (ability.
getFleet() ==
null || ability.
getFleet().getContainingLocation() ==
null)
return;
86 Iterator<GSPing> iter = pings.iterator();
87 while (iter.hasNext()) {
88 GSPing ping = iter.next();
120 planetInterval.advance(days);
121 if (planetInterval.intervalElapsed()) {
125 specialInterval.advance(days);
126 if (specialInterval.intervalElapsed()) {
140 data =
new float[resolution];
144 float incr = 360f / (float) resolution;
145 for (GSPing ping : pings) {
147 float b = ping.fader.getBrightness();
148 if (b <= 0)
continue;
153 float arc = ping.arc;
154 float mid = ping.angle;
155 float half = (float) Math.ceil(0.5f * arc / incr);
156 for (
float i = -half; i <= half; i++) {
157 float curr = mid + incr * i;
160 float intensity = 1f - Math.abs(i / half);
161 intensity *= intensity;
162 float value = ping.grav * intensity * b;
163 data[index] += value;
190 CampaignFleetAPI fleet = ability.
getFleet();
191 boolean abyss = Misc.isInAbyss(fleet);
193 if (fleet.isInHyperspace() && !abyss)
return;
195 Vector2f loc = fleet.getLocation();
196 LocationAPI location = fleet.getContainingLocation();
198 float neutrinoLowSkipProb = 0.8f;
199 if (special.isEmpty()) {
203 for (Object
object : location.getEntities(CustomCampaignEntityAPI.class)) {
204 if (
object instanceof SectorEntityToken) {
205 SectorEntityToken entity = (SectorEntityToken)
object;
207 boolean neutrinoHigh = entity.hasTag(Tags.NEUTRINO_HIGH);
208 if (neutrinoHigh)
continue;
210 if (abyss && !Misc.isInAbyss(entity))
continue;
212 boolean neutrino = entity.hasTag(Tags.NEUTRINO);
213 boolean neutrinoLow = entity.hasTag(Tags.NEUTRINO_LOW);
214 boolean station = entity.hasTag(Tags.STATION);
218 if (!neutrino && !neutrinoLow && !station)
continue;
219 if (neutrinoLow && (
float) Math.random() < neutrinoLowSkipProb)
continue;
230 for (CampaignFleetAPI curr : location.getFleets()) {
231 if (fleet == curr)
continue;
233 boolean neutrinoHigh = curr.hasTag(Tags.NEUTRINO_HIGH);
234 if (neutrinoHigh)
continue;
236 if (abyss && !Misc.isInAbyss(fleet))
continue;
238 if ((
float) Math.random() < neutrinoLowSkipProb)
continue;
242 initialCount = special.size();
245 int batch = (int) Math.ceil(initialCount / 1f);
246 for (
int i = 0; i < batch; i++) {
247 if (special.isEmpty())
break;
249 SectorEntityToken curr = special.remove(0);
251 float dist = Misc.getDistance(loc, curr.getLocation());
253 float arc = Misc.computeAngleSpan(curr.getRadius(), dist);
255 if (arc < 15) arc = 15;
256 if (arc > 150f) arc = 150f;
258 float angle = Misc.getAngleInDegrees(loc, curr.getLocation());
263 float in = 0.05f + 0.1f * (float) Math.random();
267 GSPing ping =
new GSPing(angle, arc, g, in, out);
268 ping.withSound =
true;
273 long seed = (long) (location.getLocation().x * 1300000 + location.getLocation().y * 3700000 + 1213324234234L);
274 Random random =
new Random(seed);
276 int numFalse = random.nextInt(5);
279 for (
int i = 0; i < numFalse; i++) {
281 boolean constant = random.nextFloat() > 0.25f;
282 if (!constant && (
float) Math.random() < neutrinoLowSkipProb) {
289 float angle = random.nextFloat() * 360f;
290 float in = 0.05f + 0.1f * (float) Math.random();
295 float g = 80 + random.nextFloat() * 60;
297 GSPing ping =
new GSPing(angle, arc, g, in, out);
298 ping.withSound =
true;
318 CampaignFleetAPI fleet = ability.
getFleet();
319 Vector2f loc = fleet.getLocation();
320 LocationAPI location = fleet.getContainingLocation();
324 if (Misc.isInsideSlipstream(fleet) || Misc.isInAbyss(fleet))
return;
326 for (CampaignTerrainAPI ter : location.getTerrainCopy()) {
327 if (ter.getPlugin() instanceof SlipstreamTerrainPlugin2) {
328 SlipstreamTerrainPlugin2 plugin = (SlipstreamTerrainPlugin2) ter.getPlugin();
329 if (plugin.containsEntity(fleet))
continue;
330 List<SlipstreamSegment> inRange =
new ArrayList<SlipstreamSegment>();
331 List<SlipstreamSegment> near = plugin.getSegmentsNear(loc, range);
333 for (SlipstreamSegment curr : near) {
338 if (curr.bMult <= 0)
continue;
339 float dist = Misc.getDistance(loc, curr.loc);
345 if (!inRange.isEmpty()) {
346 for (SlipstreamSegment curr : inRange) {
347 float dist = Misc.getDistance(loc, curr.loc);
349 float arc = Misc.computeAngleSpan(curr.width, dist);
351 if (arc > 150f) arc = 150f;
352 if (arc < 20) arc = 20;
354 float angle = Misc.getAngleInDegrees(loc, curr.loc);
358 float in = planetInterval.getIntervalDuration() * 5f;
360 GSPing ping =
new GSPing(angle, arc, g, in, out);
371 CampaignFleetAPI fleet = ability.
getFleet();
372 Vector2f loc = fleet.getLocation();
373 LocationAPI location = fleet.getContainingLocation();
377 boolean abyss = Misc.isInAbyss(fleet);
378 if (fleet.isInHyperspace() && !abyss) {
385 List<SectorEntityToken> all =
new ArrayList<SectorEntityToken>(location.getPlanets());
386 for (Object
object : location.getEntities(CustomCampaignEntityAPI.class)) {
387 if (
object instanceof SectorEntityToken) {
388 SectorEntityToken entity = (SectorEntityToken)
object;
389 if (abyss && !Misc.isInAbyss(entity))
continue;
391 boolean neutrinoHigh = entity.hasTag(Tags.NEUTRINO_HIGH);
397 for (CampaignFleetAPI curr : location.getFleets()) {
398 if (fleet == curr)
continue;
399 if (abyss && !Misc.isInAbyss(fleet))
continue;
400 boolean neutrinoHigh = curr.hasTag(Tags.NEUTRINO_HIGH);
406 for (Object
object : location.getEntities(OrbitalStationAPI.class)) {
407 if (
object instanceof SectorEntityToken) {
408 SectorEntityToken entity = (SectorEntityToken)
object;
409 if (abyss && !Misc.isInAbyss(entity))
continue;
414 for (Object
object : location.getJumpPoints()) {
415 if (
object instanceof SectorEntityToken) {
416 SectorEntityToken entity = (SectorEntityToken)
object;
417 if (abyss && !Misc.isInAbyss(entity))
continue;
423 for (SectorEntityToken entity : all) {
424 if (entity instanceof PlanetAPI) {
425 PlanetAPI planet = (PlanetAPI) entity;
426 if (planet.getSpec().isNebulaCenter())
continue;
428 if (entity.getRadius() <= 0)
continue;
430 float dist = Misc.getDistance(loc, entity.getLocation());
432 float arc = Misc.computeAngleSpan(entity.getRadius(), dist);
434 if (arc > 150f) arc = 150f;
435 if (arc < 20) arc = 20;
437 float angle = Misc.getAngleInDegrees(loc, entity.getLocation());
443 if (entity.hasTag(Tags.NEUTRINO_HIGH) || entity instanceof OrbitalStationAPI) {
455 float in = planetInterval.getIntervalDuration() * 5f;
457 GSPing ping =
new GSPing(angle, arc, g, in, out);
493 float g = entity.getRadius();
495 if (entity instanceof PlanetAPI) {
496 PlanetAPI planet = (PlanetAPI) entity;
501 if (planet.getSpec().isBlackHole()) {
506 if (entity instanceof OrbitalStationAPI) {
508 if (g > 200) g = 200;
511 if (entity instanceof CustomCampaignEntityAPI) {
513 if (g > 200) g = 200;
516 if (entity instanceof CampaignFleetAPI) {
518 if (g > 200) g = 200;