Package com.fs.starfarer.api
Class BaseModPlugin
java.lang.Object
com.fs.starfarer.api.BaseModPlugin
- All Implemented Interfaces:
ModPlugin
- Direct Known Subclasses:
CoreLifecyclePluginImpl
Extend this class instead of implementing ModPlugin for convenience if you do not
intend to implement all the methods. This will also help avoid your mod breaking
when new methods are added to ModPlugin, since default implemenations will be
added here and your implementation will inherit them.
- Author:
- Alex Mosolov Copyright 2013 Fractal Softworks, LLC
-
Constructor Summary
Constructors -
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.
-
Constructor Details
-
BaseModPlugin
public BaseModPlugin()
-
-
Method Details
-
afterGameSave
public void afterGameSave()Description copied from interface:ModPlugin
Called after a game is saved.- Specified by:
afterGameSave
in interfaceModPlugin
-
beforeGameSave
public void beforeGameSave()Description copied from interface:ModPlugin
Called before a game is saved.- Specified by:
beforeGameSave
in interfaceModPlugin
-
onGameSaveFailed
public void onGameSaveFailed()Description copied from interface:ModPlugin
Called if saving the game failed for some reason, such as running out of memory.- Specified by:
onGameSaveFailed
in interfaceModPlugin
-
onApplicationLoad
Description copied from interface:ModPlugin
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.- Specified by:
onApplicationLoad
in interfaceModPlugin
- Throws:
Exception
-
onEnabled
public void onEnabled(boolean wasEnabledBefore) Description copied from interface:ModPlugin
Called before onGameLoad() and only if this mod was not previously enabled for the loaded saved game, or if this is a new game. -
onGameLoad
public void onGameLoad(boolean newGame) Description copied from interface:ModPlugin
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.- Specified by:
onGameLoad
in interfaceModPlugin
-
onNewGame
public void onNewGame()Description copied from interface:ModPlugin
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). -
onNewGameAfterEconomyLoad
public void onNewGameAfterEconomyLoad()Description copied from interface:ModPlugin
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();- Specified by:
onNewGameAfterEconomyLoad
in interfaceModPlugin
-
pickShipAI
Description copied from interface:ModPlugin
Called to pick an AI implementation for a specific ship. Here instead of in CampaignPlugin to support custom AI for missions.- Specified by:
pickShipAI
in interfaceModPlugin
- 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
Description copied from interface:ModPlugin
Called to pick an AI implementation for a specific weapon.- Specified by:
pickWeaponAutofireAI
in interfaceModPlugin
- Returns:
-
pickDroneAI
public PluginPick<ShipAIPlugin> pickDroneAI(ShipAPI drone, ShipAPI mothership, DroneLauncherShipSystemAPI system) Description copied from interface:ModPlugin
Called to pick drone AI implementation.- Specified by:
pickDroneAI
in interfaceModPlugin
system
- use getSpecJson() to get at the system spec, if needed.- Returns:
-
pickMissileAI
Description copied from interface:ModPlugin
Called to pick missile AI implementation.- Specified by:
pickMissileAI
in interfaceModPlugin
- Returns:
-
onNewGameAfterTimePass
public void onNewGameAfterTimePass()Description copied from interface:ModPlugin
After the new game has stepped through its initial 2 months.- Specified by:
onNewGameAfterTimePass
in interfaceModPlugin
-
configureXStream
public void configureXStream(com.thoughtworks.xstream.XStream x) - Specified by:
configureXStream
in interfaceModPlugin
-
onNewGameAfterProcGen
public void onNewGameAfterProcGen()- Specified by:
onNewGameAfterProcGen
in interfaceModPlugin
-
onDevModeF8Reload
public void onDevModeF8Reload()Description copied from interface:ModPlugin
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.- Specified by:
onDevModeF8Reload
in interfaceModPlugin
-
onAboutToStartGeneratingCodex
public void onAboutToStartGeneratingCodex()- Specified by:
onAboutToStartGeneratingCodex
in interfaceModPlugin
-
onAboutToLinkCodexEntries
public void onAboutToLinkCodexEntries()- Specified by:
onAboutToLinkCodexEntries
in interfaceModPlugin
-
onCodexDataGenerated
public void onCodexDataGenerated()- Specified by:
onCodexDataGenerated
in interfaceModPlugin
-