Class SlipstreamEntityPlugin2
java.lang.Object
com.fs.starfarer.api.impl.campaign.BaseCustomEntityPlugin
com.fs.starfarer.api.impl.campaign.velfield.SlipstreamEntityPlugin2
- All Implemented Interfaces:
CustomCampaignEntityPlugin
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<BoundingBox>
protected FaderUtil
protected int
protected int[]
static int
protected boolean
protected List<SlipstreamEntityPlugin2.SlipstreamParticle>
protected int
static float
protected List<SlipstreamEntityPlugin2.SlipstreamSegment>
protected int
protected float
Fields inherited from class com.fs.starfarer.api.impl.campaign.BaseCustomEntityPlugin
entity
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addSegment
(org.lwjgl.util.vector.Vector2f loc, float width) void
advance
(float amount) protected void
advanceNearbySegments
(float amount) void
advanceParticles
(float amount) void
applyEffect
(SectorEntityToken other, float days) void
applyEffectToFleets
(float amount) float
getFaderBrightness
(float distAlong) float
getIntensity
(float yOff) float[]
getLengthAndWidthFractionWithinStream
(org.lwjgl.util.vector.Vector2f loc) result[0] = actual distance along the length of the slipstream result[1] = offset along the width of the slipstream, 0 = on center, 1 = on edge along normal, -1 = on edge along negative of normal null if outside stream Assumes rectangular, non-tapered streamorg.lwjgl.util.vector.Vector2f
getNormalAt
(float lengthAlongStream) org.lwjgl.util.vector.Vector2f
getNoWobblePointAt
(float lengthAlongStream, float offset) org.lwjgl.util.vector.Vector2f
getPointAt
(float lengthAlongStream, float offset) float
How far away from the viewport the center of this entity can be before it stops being rendered.getSegmentForDist
(float distAlongStream) getSegmentsNear
(org.lwjgl.util.vector.Vector2f loc, float range) float
getWidthBasedSpeedMult
(float distAlong) void
init
(SectorEntityToken entity, Object pluginParams) void
void
void
render
(CampaignEngineLayers layer, ViewportAPI viewport) Should only render for specified layer.void
renderSegments
(SpriteAPI sprite, SpriteAPI edge, float alpha, List<SlipstreamEntityPlugin2.SlipstreamSegment> segments) static org.lwjgl.util.vector.Vector2f
rotateAroundOrigin
(org.lwjgl.util.vector.Vector2f v, float cos, float sin) void
protected void
void
Methods inherited from class com.fs.starfarer.api.impl.campaign.BaseCustomEntityPlugin
appendToCampaignTooltip, createMapTooltip, getMapTooltipWidth, hasCustomMapTooltip, isMapTooltipExpandable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.fs.starfarer.api.campaign.CustomCampaignEntityPlugin
isRenderWhenViewportAlphaMultIsZero
-
Field Details
-
MAX_PARTICLES_ADD_PER_FRAME
public static int MAX_PARTICLES_ADD_PER_FRAME -
RAD_PER_DEG
public static float RAD_PER_DEG -
params
-
segments
-
totalLength
protected float totalLength -
particles
-
lengthToIndexMap
protected transient int[] lengthToIndexMap -
lengthDivisor
protected transient int lengthDivisor -
needsRecompute
protected boolean needsRecompute -
bounds
-
segmentsPerBox
protected int segmentsPerBox -
fader
-
playerWasInSlipstreamFramesAgo
protected int playerWasInSlipstreamFramesAgo
-
-
Constructor Details
-
SlipstreamEntityPlugin2
public SlipstreamEntityPlugin2()
-
-
Method Details
-
rotateAroundOrigin
public static org.lwjgl.util.vector.Vector2f rotateAroundOrigin(org.lwjgl.util.vector.Vector2f v, float cos, float sin) -
setNeedsRecompute
public void setNeedsRecompute() -
updateLengthToIndexMap
public void updateLengthToIndexMap() -
getSegmentForDist
-
addSegment
public void addSegment(org.lwjgl.util.vector.Vector2f loc, float width) -
init
- Specified by:
init
in interfaceCustomCampaignEntityPlugin
- Overrides:
init
in classBaseCustomEntityPlugin
-
getRenderRange
public float getRenderRange()Description copied from interface:CustomCampaignEntityPlugin
How far away from the viewport the center of this entity can be before it stops being rendered. Should at least be the radius of the entity; sometimes more may be necessary depending on the visual effect desired.- Specified by:
getRenderRange
in interfaceCustomCampaignEntityPlugin
- Overrides:
getRenderRange
in classBaseCustomEntityPlugin
- Returns:
-
advance
public void advance(float amount) - Specified by:
advance
in interfaceCustomCampaignEntityPlugin
- Overrides:
advance
in classBaseCustomEntityPlugin
- Parameters:
amount
- in seconds. Use SectorAPI.getClock() to figure out how many campaign days that is.
-
recomputeIfNeeded
public void recomputeIfNeeded() -
recompute
public void recompute() -
updateBoundingBoxes
protected void updateBoundingBoxes() -
advanceNearbySegments
protected void advanceNearbySegments(float amount) -
addParticles
public void addParticles() -
advanceParticles
public void advanceParticles(float amount) -
getWidthBasedSpeedMult
public float getWidthBasedSpeedMult(float distAlong) -
getIntensity
public float getIntensity(float yOff) -
getFaderBrightness
public float getFaderBrightness(float distAlong) -
render
Description copied from interface:CustomCampaignEntityPlugin
Should only render for specified layer. Will be called once per each layer, per frame. Needs to respect viewport.getAlphaMult() - i.e. use that alpha value for rendering. Needs to render at the entity's location - there's no translation before this method call. If a sprite is specified, it will be rendered in the bottommost layer of the layers this entity renders for. This method will be called after the sprite has rendered.- Specified by:
render
in interfaceCustomCampaignEntityPlugin
- Overrides:
render
in classBaseCustomEntityPlugin
-
renderSegments
public void renderSegments(SpriteAPI sprite, SpriteAPI edge, float alpha, List<SlipstreamEntityPlugin2.SlipstreamSegment> segments) -
getRandomColor
-
getLengthAndWidthFractionWithinStream
public float[] getLengthAndWidthFractionWithinStream(org.lwjgl.util.vector.Vector2f loc) result[0] = actual distance along the length of the slipstream result[1] = offset along the width of the slipstream, 0 = on center, 1 = on edge along normal, -1 = on edge along negative of normal null if outside stream Assumes rectangular, non-tapered stream- Parameters:
loc
-- Returns:
-
applyEffectToFleets
public void applyEffectToFleets(float amount) -
applyEffect
-
getPointAt
public org.lwjgl.util.vector.Vector2f getPointAt(float lengthAlongStream, float offset) -
getNoWobblePointAt
public org.lwjgl.util.vector.Vector2f getNoWobblePointAt(float lengthAlongStream, float offset) -
getNormalAt
public org.lwjgl.util.vector.Vector2f getNormalAt(float lengthAlongStream) -
getSegmentsNear
public List<SlipstreamEntityPlugin2.SlipstreamSegment> getSegmentsNear(org.lwjgl.util.vector.Vector2f loc, float range)
-