Package com.fs.starfarer.api.campaign
Interface LocationAPI
- All Known Subinterfaces:
StarSystemAPI
public interface LocationAPI
- Author:
- Alex Mosolov Copyright 2012 Fractal Softworks, LLC
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Whether the location's advance() method was/will be called this frame.addAsteroid
(float radius) addAsteroidBelt
(SectorEntityToken focus, int numAsteroids, float orbitRadius, float width, float minOrbitDays, float maxOrbitDays) addAsteroidBelt
(SectorEntityToken focus, int numAsteroids, float orbitRadius, float width, float minOrbitDays, float maxOrbitDays, String terrainId, String optionalName) addCorona
(SectorEntityToken star, float extraRadius, float windBurnLevel, float flareProbability, float crLossMult) addCorona
(SectorEntityToken star, String terrainType, float extraRadius, float windBurnLevel, float flareProbability, float crLossMult) addCustomEntity
(String id, String name, String type, String factionId) Adds a custom entity.addCustomEntity
(String id, String name, String type, String factionId, float radius, float spriteWidth, float spriteHeight) Adds a custom entity with a radius/spritWidth/spriteHeight different than those defined for this entity type in custom_entities.json.addCustomEntity
(String id, String name, String type, String factionId, float radius, float spriteWidth, float spriteHeight, Object pluginParams) void
addEntity
(SectorEntityToken entity) void
addFleetStub
(FleetStubAPI stub) void
addHitParticle
(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float brightness, float duration, Color color) void
addOrbitalJunk
(SectorEntityToken focus, String junkType, int num, float minSize, float maxSize, float orbitRadius, float width, float minOrbitDays, float maxOrbitDays, float minSpin, float maxSpin) addParticle
(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float brightness, float rampUp, float duration, Color color) addPlanet
(String id, SectorEntityToken focus, String name, String type, float angle, float radius, float orbitRadius, float orbitDays) addRadioChatter
(SectorEntityToken entity, float extraRadius) addRingBand
(SectorEntityToken focus, String category, String key, float bandWidthInTexture, int bandIndex, Color color, float bandWidthInEngine, float middleRadius, float orbitDays) Texture must have vertical, equal width bands in it.addRingBand
(SectorEntityToken focus, String category, String key, float bandWidthInTexture, int bandIndex, Color color, float bandWidthInEngine, float middleRadius, float orbitDays, String terrainId, String optionalName) Same as above, but with a "terrain" ring also being added.void
addScript
(EveryFrameScript script) Will run every time this location's advance() is called.void
addSpawnPoint
(SpawnPointPlugin point) void
addTerrain
(String terrainId, Object param) void
createToken
(float x, float y) Not actually added to the location, and doesn't need to be.createToken
(org.lwjgl.util.vector.Vector2f loc) Similar to getEntitiesWithTag(), but for custom entities only.float
getEntities
(Class implementedClassOrInterface) Examples: getEntities(JumpPointAPI.class) - gets all jump points getEntities(CampaignFleetAPI.class) - gets all fleets General version of getFleets(), getPlanets(), etcgetEntitiesWithTag
(String tag) getEntityById
(String id) getEntityByName
(String name) Deprecated.getId()
long
org.lwjgl.util.vector.Vector2f
getName()
Deprecated.getTags()
boolean
boolean
boolean
boolean
boolean
boolean
isNebula()
void
removeEntity
(SectorEntityToken entity) void
removeFleetStub
(FleetStubAPI stub) void
removeScript
(EveryFrameScript script) void
void
removeSpawnPoint
(SpawnPointPlugin point) void
void
void
setBackgroundOffset
(float x, float y) void
setBackgroundTextureFilename
(String backgroundTextureFilename) void
void
spawnFleet
(SectorEntityToken anchor, float xOffset, float yOffset, CampaignFleetAPI fleet) void
-
Method Details
-
getId
String getId() -
activeThisFrame
boolean activeThisFrame()Whether the location's advance() method was/will be called this frame. Always returns true for the current location.- Returns:
-
getBackgroundTextureFilename
String getBackgroundTextureFilename() -
setBackgroundTextureFilename
-
addSpawnPoint
-
removeSpawnPoint
-
getSpawnPoints
List<SpawnPointPlugin> getSpawnPoints() -
spawnFleet
-
createToken
Not actually added to the location, and doesn't need to be. Can be added via addEntity if it needs to have an orbit.- Parameters:
x
-y
-- Returns:
-
createToken
-
addEntity
-
removeEntity
-
addPlanet
PlanetAPI addPlanet(String id, SectorEntityToken focus, String name, String type, float angle, float radius, float orbitRadius, float orbitDays) -
addAsteroidBelt
SectorEntityToken addAsteroidBelt(SectorEntityToken focus, int numAsteroids, float orbitRadius, float width, float minOrbitDays, float maxOrbitDays) -
addAsteroidBelt
SectorEntityToken addAsteroidBelt(SectorEntityToken focus, int numAsteroids, float orbitRadius, float width, float minOrbitDays, float maxOrbitDays, String terrainId, String optionalName) -
addOrbitalJunk
void addOrbitalJunk(SectorEntityToken focus, String junkType, int num, float minSize, float maxSize, float orbitRadius, float width, float minOrbitDays, float maxOrbitDays, float minSpin, float maxSpin) -
addRingBand
RingBandAPI addRingBand(SectorEntityToken focus, String category, String key, float bandWidthInTexture, int bandIndex, Color color, float bandWidthInEngine, float middleRadius, float orbitDays) Texture must have vertical, equal width bands in it. Each band must tile vertically with itself. Returns a RingBandAPI - i.e. the visuals.- Parameters:
focus
-category
- graphics category in settings.jsonkey
- id within categorybandWidthInTexture
-bandIndex
-color
-bandWidthInEngine
-orbitDays
-middleRadius
-- Returns:
-
addRingBand
SectorEntityToken addRingBand(SectorEntityToken focus, String category, String key, float bandWidthInTexture, int bandIndex, Color color, float bandWidthInEngine, float middleRadius, float orbitDays, String terrainId, String optionalName) Same as above, but with a "terrain" ring also being added. If there are multiple rings occupying the same location, it's best to only have one of them add terrain. Returns the terrain entity, NOT the RingBandAPI visuals.- Parameters:
focus
-category
-key
-bandWidthInTexture
-bandIndex
-color
-bandWidthInEngine
-middleRadius
-orbitDays
-terrainId
-optionalName
-- Returns:
-
addCustomEntity
Adds a custom entity. Use SectorEntityToken.setFixedLocation() or .setCircularOrbit (or setOrbit) to set its location and/or orbit.- Parameters:
id
- unique id. autogenerated if null.name
- default name for entity used if this is nulltype
- id in custom_entities.jsonfactionId
- defaults to "neutral" if not specified- Returns:
-
addCustomEntity
CustomCampaignEntityAPI addCustomEntity(String id, String name, String type, String factionId, float radius, float spriteWidth, float spriteHeight) Adds a custom entity with a radius/spritWidth/spriteHeight different than those defined for this entity type in custom_entities.json. Use SectorEntityToken.setFixedLocation() or .setCircularOrbit (or setOrbit) to set its location and/or orbit.- Parameters:
id
- unique id. autogenerated if null.name
- default name for entity used if this is nulltype
- id in custom_entities.jsonfactionId
- defaults to "neutral" if not specifiedradius
-spriteWidth
-spriteHeight
-- Returns:
-
addTerrain
-
getEntities
Examples: getEntities(JumpPointAPI.class) - gets all jump points getEntities(CampaignFleetAPI.class) - gets all fleets General version of getFleets(), getPlanets(), etc- Parameters:
implementedClassOrInterface
-- Returns:
-
getEntitiesWithTag
-
getFleets
List<CampaignFleetAPI> getFleets() -
getPlanets
-
getOrbitalStations
Deprecated.Use getEntitiesWithTag(Tags.STATION) instead, in order to pick up custom entities that are acting as stations. Regular stations also have this tag and will also be picked up by that method.- Returns:
-
getAsteroids
List<SectorEntityToken> getAsteroids() -
getEntityByName
Deprecated.Use getEntityById() instead- Parameters:
name
-- Returns:
-
getEntityById
-
getLocation
org.lwjgl.util.vector.Vector2f getLocation() -
isHyperspace
boolean isHyperspace() -
addScript
Will run every time this location's advance() is called. Note that locations that are not "current" may run at a lower number of "frames" per second.- Parameters:
script
-
-
removeScriptsOfClass
-
removeScript
-
getName
String getName() -
setName
-
getAllEntities
List<SectorEntityToken> getAllEntities() -
addCorona
SectorEntityToken addCorona(SectorEntityToken star, float extraRadius, float windBurnLevel, float flareProbability, float crLossMult) -
addCorona
SectorEntityToken addCorona(SectorEntityToken star, String terrainType, float extraRadius, float windBurnLevel, float flareProbability, float crLossMult) -
getTerrainCopy
List<CampaignTerrainAPI> getTerrainCopy() -
getPersistentData
-
addAsteroid
-
setBackgroundOffset
void setBackgroundOffset(float x, float y) -
addRadioChatter
-
updateAllOrbits
void updateAllOrbits() -
isNebula
boolean isNebula() -
getNameWithLowercaseType
String getNameWithLowercaseType() -
getFleetStubs
List<FleetStubAPI> getFleetStubs() -
removeFleetStub
-
addFleetStub
-
getConstellation
Constellation getConstellation() -
isInConstellation
boolean isInConstellation() -
getNameWithTypeIfNebula
String getNameWithTypeIfNebula() -
getTags
Collection<String> getTags() -
hasTag
-
addTag
-
removeTag
-
clearTags
void clearTags() -
addCustomEntity
-
addCustomEntity
-
getJumpPoints
List<SectorEntityToken> getJumpPoints() -
getLastPlayerVisitTimestamp
long getLastPlayerVisitTimestamp() -
getDaysSinceLastPlayerVisit
float getDaysSinceLastPlayerVisit() -
getCustomEntitiesWithTag
Similar to getEntitiesWithTag(), but for custom entities only. More performant since there are less entities to iterate through.- Parameters:
tag
-- Returns:
-
getScripts
List<EveryFrameScript> getScripts() -
addHitParticle
void addHitParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float brightness, float duration, Color color) -
renderingLayersUpdated
-
getMemoryWithoutUpdate
MemoryAPI getMemoryWithoutUpdate() -
addParticle
ParticleControllerAPI addParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float brightness, float rampUp, float duration, Color color) -
getNameWithNoType
String getNameWithNoType() -
isCurrentLocation
boolean isCurrentLocation() -
getNameWithLowercaseTypeShort
String getNameWithLowercaseTypeShort() -
getNameWithTypeShort
String getNameWithTypeShort() -
getGravityWells
List<NascentGravityWellAPI> getGravityWells() -
getCustomEntities
List<CustomCampaignEntityAPI> getCustomEntities() -
getBackgroundColorShifter
ColorShifterAPI getBackgroundColorShifter() -
getBackgroundParticleColorShifter
ColorShifterAPI getBackgroundParticleColorShifter() -
isDeepSpace
boolean isDeepSpace()
-