Interface LocationAPI

All Known Subinterfaces:
StarSystemAPI

public interface LocationAPI
Author:
Alex Mosolov Copyright 2012 Fractal Softworks, LLC
  • 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

      void setBackgroundTextureFilename(String backgroundTextureFilename)
    • addSpawnPoint

      void addSpawnPoint(SpawnPointPlugin point)
    • removeSpawnPoint

      void removeSpawnPoint(SpawnPointPlugin point)
    • getSpawnPoints

      List<SpawnPointPlugin> getSpawnPoints()
    • spawnFleet

      void spawnFleet(SectorEntityToken anchor, float xOffset, float yOffset, CampaignFleetAPI fleet)
    • createToken

      SectorEntityToken createToken(float x, float y)
      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

      SectorEntityToken createToken(org.lwjgl.util.vector.Vector2f loc)
    • addEntity

      void addEntity(SectorEntityToken entity)
    • removeEntity

      void removeEntity(SectorEntityToken entity)
    • 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.json
      key - id within category
      bandWidthInTexture -
      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

      CustomCampaignEntityAPI addCustomEntity(String id, String name, String type, String factionId)
      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 null
      type - id in custom_entities.json
      factionId - 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 null
      type - id in custom_entities.json
      factionId - defaults to "neutral" if not specified
      radius -
      spriteWidth -
      spriteHeight -
      Returns:
    • addTerrain

      SectorEntityToken addTerrain(String terrainId, Object param)
    • getEntities

      List getEntities(Class implementedClassOrInterface)
      Examples: getEntities(JumpPointAPI.class) - gets all jump points getEntities(CampaignFleetAPI.class) - gets all fleets General version of getFleets(), getPlanets(), etc
      Parameters:
      implementedClassOrInterface -
      Returns:
    • getEntitiesWithTag

      List<SectorEntityToken> getEntitiesWithTag(String tag)
    • getFleets

      List<CampaignFleetAPI> getFleets()
    • getPlanets

      List<PlanetAPI> getPlanets()
    • getOrbitalStations

      @Deprecated List<SectorEntityToken> 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 SectorEntityToken getEntityByName(String name)
      Deprecated.
      Use getEntityById() instead
      Parameters:
      name -
      Returns:
    • getEntityById

      SectorEntityToken getEntityById(String id)
    • getLocation

      org.lwjgl.util.vector.Vector2f getLocation()
    • isHyperspace

      boolean isHyperspace()
    • addScript

      void addScript(EveryFrameScript script)
      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

      void removeScriptsOfClass(Class c)
    • removeScript

      void removeScript(EveryFrameScript script)
    • getName

      String getName()
    • setName

      void setName(String name)
    • 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

      Map<String,Object> getPersistentData()
    • addAsteroid

      AsteroidAPI addAsteroid(float radius)
    • setBackgroundOffset

      void setBackgroundOffset(float x, float y)
    • addRadioChatter

      SectorEntityToken addRadioChatter(SectorEntityToken entity, float extraRadius)
    • updateAllOrbits

      void updateAllOrbits()
    • isNebula

      boolean isNebula()
    • getNameWithLowercaseType

      String getNameWithLowercaseType()
    • getFleetStubs

      List<FleetStubAPI> getFleetStubs()
    • removeFleetStub

      void removeFleetStub(FleetStubAPI stub)
    • addFleetStub

      void addFleetStub(FleetStubAPI stub)
    • getConstellation

      Constellation getConstellation()
    • isInConstellation

      boolean isInConstellation()
    • getNameWithTypeIfNebula

      String getNameWithTypeIfNebula()
    • getTags

      Collection<String> getTags()
    • hasTag

      boolean hasTag(String tag)
    • addTag

      void addTag(String tag)
    • removeTag

      void removeTag(String tag)
    • clearTags

      void clearTags()
    • addCustomEntity

      CustomCampaignEntityAPI addCustomEntity(String id, String name, String type, String factionId, float radius, float spriteWidth, float spriteHeight, Object pluginParams)
    • addCustomEntity

      CustomCampaignEntityAPI addCustomEntity(String id, String name, String type, String factionId, Object pluginParams)
    • getJumpPoints

      List<SectorEntityToken> getJumpPoints()
    • getLastPlayerVisitTimestamp

      long getLastPlayerVisitTimestamp()
    • getDaysSinceLastPlayerVisit

      float getDaysSinceLastPlayerVisit()
    • getCustomEntitiesWithTag

      List<CustomCampaignEntityAPI> getCustomEntitiesWithTag(String tag)
      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

      void renderingLayersUpdated(SectorEntityToken entity)
    • 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()