Starsector API
Loading...
Searching...
No Matches
StarCoronaJetTerrainPlugin.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 = 30f;
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 toStar += 180f;
25 float diff = Misc.getAngleDiff(toStar, angle);
26 float max = ARC / 2f;
27 if (diff < max) {
28 return Math.max(0, 1f - diff / max);
29 }
30 return 0f;
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 toStar += 180f;
58 if (!Misc.isInArc(toStar, ARC, params.relatedEntity.getLocation(), point)) {
59 return false;
60 }
61 }
62 return super.containsPoint(point, radius);
63 }
64
65 @Override
66 public String getTerrainName() {
67 return "Coronal Jet";
68 }
69
70 @Override
71 public void createTooltip(TooltipMakerAPI tooltip, boolean expanded) {
72 float pad = 10f;
73 float small = 5f;
74 tooltip.addTitle(getTerrainName());
75 tooltip.addPara(Global.getSettings().getDescription(getTerrainId(), Type.TERRAIN).getText1(), pad);
76 float nextPad = pad;
77 if (expanded) {
78 tooltip.addSectionHeading("Travel", Alignment.MID, small);
79 nextPad = small;
80 }
81 tooltip.addPara("The intense heat and radiation reduce the combat readiness of " +
82 "all ships in the magnetotail at a steady pace.", nextPad);
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)