Starsector API
Loading...
Searching...
No Matches
StarCoronaAkaMainyuTerrainPlugin.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.terrain;
2
3import java.awt.Color;
4
5import org.lwjgl.util.vector.Vector2f;
6
7import com.fs.starfarer.api.Global;
8import com.fs.starfarer.api.campaign.PlanetAPI;
9import com.fs.starfarer.api.campaign.SectorEntityToken;
10import com.fs.starfarer.api.loading.Description.Type;
11import com.fs.starfarer.api.ui.Alignment;
12import com.fs.starfarer.api.ui.TooltipMakerAPI;
13import com.fs.starfarer.api.util.Misc;
14
16
17 public static final float ARC = 100f;
18
19 @Override
20 public float getAuroraAlphaMultForAngle(float angle) {
21 SectorEntityToken star = params.relatedEntity.getLightSource();
22 if (star != null) {
23 float toStar = Misc.getAngleInDegrees(params.relatedEntity.getLocation(), star.getLocation());
24 float diff = Misc.getAngleDiff(toStar, angle);
25 float max = ARC / 2f;
26 if (diff < max) {
27 return Math.max(0, 1f - diff / max);
28 }
29 return 0f;
30 }
31
32 return 1f;
33 }
34
35 @Override
36 public Color getAuroraColorForAngle(float angle) {
37 if (color == null) {
38 if (params.relatedEntity instanceof PlanetAPI) {
39 color = ((PlanetAPI)params.relatedEntity).getSpec().getAtmosphereColor();
40 //color = Misc.interpolateColor(color, Color.white, 0.25f);
41 } else {
42 color = Color.white;
43 }
44 color = Misc.setAlpha(color, 155);
45 }
47 return flareManager.getColorForAngle(color, angle);
48 }
49 return super.getAuroraColorForAngle(angle);
50 }
51
52 @Override
53 public boolean containsPoint(Vector2f point, float radius) {
54 SectorEntityToken star = params.relatedEntity.getLightSource();
55 if (star != null) {
56 float toStar = Misc.getAngleInDegrees(params.relatedEntity.getLocation(), star.getLocation());
57 if (!Misc.isInArc(toStar, ARC, params.relatedEntity.getLocation(), point)) {
58 return false;
59 }
60 }
61 return super.containsPoint(point, radius);
62 }
63
64 @Override
65 public String getTerrainName() {
66 return "Ion Storm";
67 }
68
69 @Override
70 public void createTooltip(TooltipMakerAPI tooltip, boolean expanded) {
71 float pad = 10f;
72 float small = 5f;
73 tooltip.addTitle("Ion Storm");
74 tooltip.addPara(Global.getSettings().getDescription(getTerrainId(), Type.TERRAIN).getText1(), pad);
75 float nextPad = pad;
76 if (expanded) {
77 tooltip.addSectionHeading("Travel", Alignment.MID, small);
78 nextPad = small;
79 }
80 tooltip.addPara("The intense heat and radiation reduce the combat readiness of " +
81 "all ships in the magnetotail at a steady pace.", nextPad);
82 tooltip.addPara("The ionized gas being ejected from the atmosphere makes the planet difficult to approach.", pad);
83
84 if (expanded) {
85 tooltip.addSectionHeading("Combat", Alignment.MID, pad);
86 tooltip.addPara("Reduces the peak performance time of ships and increases the rate of combat readiness degradation in protracted engagements.", small);
87 }
88 }
89
90
91
92
93
94
95
96}
static SettingsAPI getSettings()
Definition Global.java:51
Color getColorForAngle(Color baseColor, float angle)
Description getDescription(String id, Type type)