Package com.fs.starfarer.api
Interface ModPlugin
- All Known Implementing Classes:
BaseModPlugin
,CoreLifecyclePluginImpl
public interface ModPlugin
NOTE: Instead of implementing this interface, extend BaseModPlugin instead.
A new instance of a mod's modPlugin class will be created when the game starts.
- Author:
- Alex Mosolov Copyright 2012 Fractal Softworks, LLC
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Called after a game is saved.void
Called before a game is saved.void
configureXStream
(com.thoughtworks.xstream.XStream x) void
void
void
Called after all the core loading has finished and all the scripts have finished being compiled.void
void
Called after F8 is pressed in combat while in devMode.void
onEnabled
(boolean wasEnabledBefore) Called before onGameLoad() and only if this mod was not previously enabled for the loaded saved game, or if this is a new game.void
onGameLoad
(boolean newGame) Called after a game has been loaded.void
Called if saving the game failed for some reason, such as running out of memory.void
Called when a new game is being created.void
Called after the economy is loaded from economy.json and the initial steps are taken.void
void
After the new game has stepped through its initial 2 months.pickDroneAI
(ShipAPI drone, ShipAPI mothership, DroneLauncherShipSystemAPI system) Called to pick drone AI implementation.pickMissileAI
(MissileAPI missile, ShipAPI launchingShip) Called to pick missile AI implementation.pickShipAI
(FleetMemberAPI member, ShipAPI ship) Called to pick an AI implementation for a specific ship.pickWeaponAutofireAI
(WeaponAPI weapon) Called to pick an AI implementation for a specific weapon.
-
Method Details
-
onApplicationLoad
Called after all the core loading has finished and all the scripts have finished being compiled. Gives the mod an opportunity to load its own data using the relevant SettingsAPI methods.- Throws:
Exception
-
onNewGame
void onNewGame()Called when a new game is being created. This is the preferred way to generate the contents of the Sector, and is meant to replace generators.csv (which remains used for backwards compatibility). -
onEnabled
void onEnabled(boolean wasEnabledBefore) Called before onGameLoad() and only if this mod was not previously enabled for the loaded saved game, or if this is a new game.- Parameters:
wasEnabledBefore
- true if the mod was enabled for this saved game at some point in the past, though not immediately prior (or this method wouldn't be called at all).
-
onGameLoad
void onGameLoad(boolean newGame) Called after a game has been loaded. Also called when a new game is created, after the onNewGame() plugins for all the mods have been called. -
beforeGameSave
void beforeGameSave()Called before a game is saved. -
afterGameSave
void afterGameSave()Called after a game is saved. -
onGameSaveFailed
void onGameSaveFailed()Called if saving the game failed for some reason, such as running out of memory. -
onNewGameAfterProcGen
void onNewGameAfterProcGen() -
onNewGameAfterEconomyLoad
void onNewGameAfterEconomyLoad()Called after the economy is loaded from economy.json and the initial steps are taken. At this point, calling get getMarket() on entities will return the proper market. The sequence of calls is: onNewGame(); // can add markets to the economy here programmatically //load economy and step it onNewGameAfterEconomyLoad(); -
onNewGameAfterTimePass
void onNewGameAfterTimePass()After the new game has stepped through its initial 2 months. -
onDevModeF8Reload
void onDevModeF8Reload()Called after F8 is pressed in combat while in devMode. Note: the game becomes potentially unstable after an F8-dev mode reload. That is, crashes may occur that would not have occured otherwise and are not indicative of bugs. -
pickShipAI
Called to pick an AI implementation for a specific ship. Here instead of in CampaignPlugin to support custom AI for missions.- Parameters:
member
- Can be null.ship
- Can not be null. Could be a ship or a fighter.- Returns:
- null, or a custom AI implementation.
-
pickWeaponAutofireAI
Called to pick an AI implementation for a specific weapon.- Parameters:
weapon
-- Returns:
-
pickDroneAI
PluginPick<ShipAIPlugin> pickDroneAI(ShipAPI drone, ShipAPI mothership, DroneLauncherShipSystemAPI system) Called to pick drone AI implementation.- Parameters:
drone
-mothership
-system
- use getSpecJson() to get at the system spec, if needed.- Returns:
-
pickMissileAI
Called to pick missile AI implementation.- Parameters:
drone
-launchingShip
-- Returns:
-
configureXStream
void configureXStream(com.thoughtworks.xstream.XStream x) -
onAboutToStartGeneratingCodex
void onAboutToStartGeneratingCodex() -
onAboutToLinkCodexEntries
void onAboutToLinkCodexEntries() -
onCodexDataGenerated
void onCodexDataGenerated()
-