Package com.fs.starfarer.api.mission
Interface MissionDefinitionAPI
public interface MissionDefinitionAPI
Used by the MissionDefinition.java script to create the contents of a mission.
- Author:
- Alex Mosolov Copyright 2012 Fractal Softworks, LLC
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAsteroidField
(float x, float y, float angle, float width, float minSpeed, float maxSpeed, int quantity) Add an asteroid field to the map.void
addBriefingItem
(String item) Adds a line to the bulleted list under "Tactical Objectives" in the mission description.void
addFleetMember
(FleetSide side, FleetMemberAPI member) void
addNebula
(float x, float y, float radius) Adds a circular nebula to the map.void
addObjective
(float x, float y, String type) Add a battlefield objective to the map.void
addObjective
(float x, float y, String type, BattleObjectiveAPI.Importance importance) Deprecated.void
addPlanet
(float x, float y, float radius, PlanetAPI planet, float gravity, boolean backgroundPlanet) Bases the look of the planet on the PlanetAPI passed in.void
Add a planet or star to the map.void
Add a planet or star to the map.void
addPlugin
(EveryFrameCombatPlugin plugin) void
addRingAsteroids
(float x, float y, float angle, float width, float minSpeed, float maxSpeed, int quantity) addToFleet
(FleetSide side, String variantId, FleetMemberType type, boolean isFlagship) Add a ship variant to a fleet.addToFleet
(FleetSide side, String variantId, FleetMemberType type, String shipName, boolean isFlagship) Same as the other addToFleet method, except you can specify the ship's name.void
defeatOnShipLoss
(String shipName) Indicates that losing the named ship causes immediate defeat for that side.getDefaultCommander
(FleetSide side) int
Returns the fleet point cost of a fighter wing or ship variant.boolean
void
Set various parameters for a fleet.void
initFleet
(FleetSide side, String shipNamePrefix, FleetGoal goal, boolean useDefaultAI, int commandRating) Set various parameters for a fleet.void
initFleet
(FleetSide side, String shipNamePrefix, FleetGoal goal, boolean useDefaultAI, int commandRating, int allyCommandRating) void
initMap
(float minX, float maxX, float minY, float maxY) Initialize map with the given size.void
setBackgroundGlowColor
(Color backgroundGlowColor) void
setBackgroundSpriteName
(String background) void
setFleetTagline
(FleetSide side, String tagline) Set a small blurb for the fleet that shows up on the mission detail and mission results screens to identify it.void
setHyperspaceMode
(boolean hyperspaceMode) Make the background animate the same way it does in hyperspace.void
setNebulaMapTex
(String nebulaMapTex) void
setNebulaTex
(String nebulaTex) void
setPlanetBgSize
(float bgWidth, float bgHeight) Background planets at 0,0 get rendered at the center of the screen when the view is at the center of the map.
-
Method Details
-
initFleet
Set various parameters for a fleet. Must be called once each for FleetSide.PLAYER and FleetSide.ENEMY. Must be called before any ships are added to the fleet.- Parameters:
side
-shipNamePrefix
- Prepended to any randomly picked ship names. "ISS", "HSS", etc.goal
-useDefaultAI
- For now, set true for side = ENEMY and false for side = PLAYER. Later, may supply custom AI.
-
initFleet
void initFleet(FleetSide side, String shipNamePrefix, FleetGoal goal, boolean useDefaultAI, int commandRating) Set various parameters for a fleet. Must be called once each for FleetSide.PLAYER and FleetSide.ENEMY. Must be called before any ships are added to the fleet.- Parameters:
side
-shipNamePrefix
- Prepended to any randomly picked ship names. "ISS", "HSS", etc.goal
-useDefaultAI
- For now, set true for side = ENEMY and false for side = PLAYER. Later, may supply custom AI.commandRating
- Added to the pool of available command points.
-
addToFleet
FleetMemberAPI addToFleet(FleetSide side, String variantId, FleetMemberType type, boolean isFlagship) Add a ship variant to a fleet. The variant ID refers to one of the variants found in data/variants and data/variants/fighters.- Parameters:
side
-variantId
-type
-isFlagship
- Set to true for the player's ship, false otherwise.
-
addToFleet
FleetMemberAPI addToFleet(FleetSide side, String variantId, FleetMemberType type, String shipName, boolean isFlagship) Same as the other addToFleet method, except you can specify the ship's name.- Parameters:
side
-variantId
-type
-shipName
- Full ship name, including prefix.isFlagship
- Set to true for the player's ship, false otherwise.
-
defeatOnShipLoss
Indicates that losing the named ship causes immediate defeat for that side. Ship must have been added with an explicit name.- Parameters:
shipName
-
-
addBriefingItem
Adds a line to the bulleted list under "Tactical Objectives" in the mission description.- Parameters:
item
- Text, with no leading dash.
-
setFleetTagline
Set a small blurb for the fleet that shows up on the mission detail and mission results screens to identify it.- Parameters:
side
-tagline
-
-
initMap
void initMap(float minX, float maxX, float minY, float maxY) Initialize map with the given size. By convention, 0,0 should be at the center. In other words, -minX = maxX and -minY = maxY.- Parameters:
minX
- in pixels.maxX
- in pixels.minY
- in pixels.maxY
- in pixels.
-
addNebula
void addNebula(float x, float y, float radius) Adds a circular nebula to the map. The shape is slightly randomized.- Parameters:
x
-y
-radius
- in pixels.
-
addObjective
@Deprecated void addObjective(float x, float y, String type, BattleObjectiveAPI.Importance importance) Deprecated.Add a battlefield objective to the map.- Parameters:
x
-y
-type
- one of "comm_relay", "nav_buoy", or "sensor_array".importance
-
-
addObjective
Add a battlefield objective to the map.- Parameters:
x
-y
-type
- one of "comm_relay", "nav_buoy", or "sensor_array".
-
addPlanet
Add a planet or star to the map.- Parameters:
x
-y
-radius
-type
- available types are defined in data/config/planets.jsongravity
- Equal to maximum speed boost the planet provides to nearby ships.
-
addPlanet
void addPlanet(float x, float y, float radius, String type, float gravity, boolean backgroundPlanet) Add a planet or star to the map.- Parameters:
x
-y
-radius
-type
- available types are defined in data/config/planets.jsongravity
- Equal to maximum speed boost the planet provides to nearby ships.backgroundPlanet
- If true, planet is in the "background" and doesn't exert gravity or move relative to the viewport. x and y are then screen coordinates.
-
addPlanet
void addPlanet(float x, float y, float radius, PlanetAPI planet, float gravity, boolean backgroundPlanet) Bases the look of the planet on the PlanetAPI passed in. The look may have been altered dynamically using PlanetAPI.getSpec(), which would not be reflected by the planet's base type, as defined in planets.json.- Parameters:
x
-y
-radius
-planet
-gravity
-backgroundPlanet
-
-
setPlanetBgSize
void setPlanetBgSize(float bgWidth, float bgHeight) Background planets at 0,0 get rendered at the center of the screen when the view is at the center of the map. The bgWidth and bgHeight determine how much off-center the planet moves at the edges of the map.- Parameters:
bgWidth
-bgHeight
-
-
addAsteroidField
void addAsteroidField(float x, float y, float angle, float width, float minSpeed, float maxSpeed, int quantity) Add an asteroid field to the map. An asteroid field is a band of asteroids moving in a direction across the map.- Parameters:
x
- x coordinate of any point along the middle of the belt.y
- y coordinate of any point along the middle of the belt.angle
- direction, with 0 being to the right and 90 being up.width
- width of belt in pixels.minSpeed
- minimum speed of spawned asteroids.maxSpeed
- maximum speed of spawned asteroids.quantity
- approximate number of asteroids to keep in play as they're destroyed/move off map.
-
addRingAsteroids
void addRingAsteroids(float x, float y, float angle, float width, float minSpeed, float maxSpeed, int quantity) -
getFleetPointCost
Returns the fleet point cost of a fighter wing or ship variant.- Parameters:
id
-- Returns:
-
addPlugin
-
setBackgroundSpriteName
-
addFleetMember
-
setHyperspaceMode
void setHyperspaceMode(boolean hyperspaceMode) Make the background animate the same way it does in hyperspace.- Parameters:
hyperspaceMode
-
-
setNebulaTex
-
setNebulaMapTex
-
setBackgroundGlowColor
-
initFleet
-
getContext
BattleCreationContext getContext() -
getDefaultCommander
-
hasNebula
boolean hasNebula()
-