1package com.fs.starfarer.api.impl.campaign.ghosts;
3import java.util.ArrayList;
6import org.lwjgl.util.vector.Vector2f;
8import com.fs.starfarer.api.EveryFrameScript;
9import com.fs.starfarer.api.Global;
10import com.fs.starfarer.api.campaign.CampaignTerrainAPI;
11import com.fs.starfarer.api.impl.campaign.ids.Tags;
12import com.fs.starfarer.api.impl.campaign.ids.Terrain;
13import com.fs.starfarer.api.impl.campaign.velfield.SlipstreamTerrainPlugin2;
14import com.fs.starfarer.api.impl.campaign.velfield.SlipstreamTerrainPlugin2.SlipstreamParams2;
15import com.fs.starfarer.api.impl.campaign.velfield.SlipstreamTerrainPlugin2.SlipstreamSegment;
16import com.fs.starfarer.api.util.Misc;
20 public static interface GhostBehaviorWithSlipstream {
72 protected Vector2f
prev =
null;
85 boolean forceAdd =
false;
87 SlipstreamParams2 params =
new SlipstreamParams2();
94 params.lineLengthFractionOfSpeed = 0.25f * Math.max(0.25f, Math.min(1f, 30f / (
float) params.burnLevel));
101 prev =
new Vector2f(loc);
104 if (
behavior instanceof GhostBehaviorWithSlipstream) {
105 GhostBehaviorWithSlipstream b = (GhostBehaviorWithSlipstream)
behavior;
113 float distPerSegment = 300f;
116 if (dist >= distPerSegment || forceAdd) {
127 prev =
new Vector2f(loc);
130 if (segments.size() == 1) {
131 segments.get(0).bMult = 0f;
132 segments.get(0).fader.forceOut();
134 segments.get(segments.size() - 1).fader.forceOut();
138 List<SlipstreamSegment>
remove =
new ArrayList<SlipstreamSegment>();
139 for (
int i = 0; i < segments.size() -
maxSegments - 1; i++) {
140 SlipstreamSegment curr = segments.get(i);
141 SlipstreamSegment next = segments.get(i + 1);
156 for (
int i = Math.max(0, segments.size() -
maxSegments); i < segments.size() - 1; i++) {
157 SlipstreamSegment curr = segments.get(i);
158 SlipstreamSegment next = segments.get(i + 1);
162 float b = dist / fadeInDist;
171 if (durIn > 2f) durIn = 2f;
static SectorAPI getSector()
void advance(float amount, SensorGhost ghost, GhostBehavior behavior)
boolean shouldInterruptBehavior(SensorGhost ghost, GhostBehavior behavior)
GBIGenerateSlipstream(float minWidth, float maxWidth, int burnLevel, float widenRate, int maxSegments, float duration)
CampaignTerrainAPI slipstream
SlipstreamTerrainPlugin2 plugin
void advance(float amount)
static final String SLIPSTREAM
void addSegment(Vector2f loc, float width)
void setDynamic(boolean dynamic)
void despawn(float despawnDelay, float despawnDays, Random random)
List< SlipstreamSegment > getSegments()
void setDurationOut(float durationOut)
void setDurationIn(float durationIn)
static float getDistance(SectorEntityToken from, SectorEntityToken to)
static float getSpeedForBurnLevel(float burnLevel)
float convertToDays(float realSeconds)
CampaignTerrainPlugin getPlugin()
SectorEntityToken addTerrain(String terrainId, Object param)
CampaignClockAPI getClock()
LocationAPI getContainingLocation()
void addScript(EveryFrameScript script)
void setLocation(float x, float y)
CustomCampaignEntityAPI getEntity()