28 if (
tap.isDiscoverable())
return;
29 if (!
tap.getMemoryWithoutUpdate().contains(
"$usable"))
return;
30 if (!
tap.isInCurrentLocation())
return;
33 spawn =
new IntervalUtil(0.05f, 0.1f);
36 float days = Misc.getDays(amount);
37 spawn.advance(days * 5f);
38 if (
spawn.intervalElapsed()) {
50 if ((
float) Math.random() < 0.01f) {
51 ZigLeashAssignmentAI.spawnMote(
tap);
56 List<PlanetAPI> stars =
new ArrayList<PlanetAPI>();
57 PlanetAPI closest =
null;
58 float minDist = Float.MAX_VALUE;
59 for (PlanetAPI star :
tap.getContainingLocation().getPlanets()) {
60 if (!star.isStar())
continue;
62 float ctcDist = Misc.getDistance(
tap.getLocation(), star.getLocation());
63 float dist = ctcDist - star.getRadius() -
tap.getRadius();
64 if (dist > 2000)
continue;
66 if (ctcDist < minDist) {
88 for (PlanetAPI star : stars) {
89 float dirToTap = Misc.getAngleInDegrees(star.getLocation(),
tap.getLocation());
90 Vector2f unitToTap = Misc.getUnitVectorAtDegreeAngle(dirToTap);
91 Vector2f focusLoc =
new Vector2f(unitToTap);
92 focusLoc.scale(100f + star.getRadius() +
tap.getRadius());
93 Vector2f.add(star.getLocation(), focusLoc, focusLoc);
97 float ctcDist = Misc.getDistance(focusLoc, star.getLocation());
98 float dist = ctcDist - star.getRadius() -
tap.getRadius();
101 float minRadius = dist + (star.getRadius() * 0.2f);
102 float maxRadius = dist + (star.getRadius() * 0.4f);
104 Color color = star.getSpec().getCoronaColor();
106 float colorScale = 0.25f;
107 colorScale = 0.1f + 0.15f / (float) stars.size();
108 if (closest == star) colorScale = 0.25f;
109 color = Misc.scaleColor(color, colorScale);
112 float dirToStar = Misc.getAngleInDegrees(focusLoc, star.getLocation());
113 float arc = star.getRadius() / ((float) Math.PI * (ctcDist -
tap.getRadius())) * 360f;
115 for (
int i = 0; i < glows; i++) {
116 float radius = minRadius + (float) Math.random() * (maxRadius - minRadius);
118 float angle = dirToStar - arc / 2f + arc * (float) Math.random();
120 Vector2f unit = Misc.getUnitVectorAtDegreeAngle(angle);
121 float x = unit.x * radius + focusLoc.x;
122 float y = unit.y * radius + focusLoc.y;
124 Vector2f loc =
new Vector2f(x, y);
127 Vector2f vel = Misc.getUnitVectorAtDegreeAngle(Misc.getAngleInDegrees(loc, focusLoc));
128 float travelDist = Misc.getDistance(loc, focusLoc) -
tap.getRadius() * 0.7f - 100f;
129 travelDist = Math.min(travelDist, maxRadius - minRadius + 100f);
133 float speed = 100f + 100f * (float) Math.random();
134 float dur = travelDist / speed;
138 float size = minSize + (float) Math.random() * (maxSize - minSize);
143 tap.getContainingLocation().addParticle(loc, vel,
144 size, 0.4f, rampUp, dur, color);
145 tap.getContainingLocation().addParticle(loc, vel,
146 size * 0.25f, 0.4f, rampUp, dur, color);