Starsector API
Loading...
Searching...
No Matches
com.fs.starfarer.api.ModPlugin Interface Reference
Inheritance diagram for com.fs.starfarer.api.ModPlugin:
[legend]

Public Member Functions

void onApplicationLoad () throws Exception
 
void onNewGame ()
 
void onEnabled (boolean wasEnabledBefore)
 
void onGameLoad (boolean newGame)
 
void beforeGameSave ()
 
void afterGameSave ()
 
void onGameSaveFailed ()
 
void onNewGameAfterProcGen ()
 
void onNewGameAfterEconomyLoad ()
 
void onNewGameAfterTimePass ()
 
void onDevModeF8Reload ()
 
PluginPick< ShipAIPlugin > pickShipAI (FleetMemberAPI member, ShipAPI ship)
 
PluginPick< AutofireAIPlugin > pickWeaponAutofireAI (WeaponAPI weapon)
 
PluginPick< ShipAIPlugin > pickDroneAI (ShipAPI drone, ShipAPI mothership, DroneLauncherShipSystemAPI system)
 
PluginPick< MissileAIPlugin > pickMissileAI (MissileAPI missile, ShipAPI launchingShip)
 
void configureXStream (XStream x)
 

Detailed Description

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

Definition at line 22 of file ModPlugin.java.

Member Function Documentation

◆ afterGameSave()

void com.fs.starfarer.api.ModPlugin.afterGameSave ( )

◆ beforeGameSave()

void com.fs.starfarer.api.ModPlugin.beforeGameSave ( )

◆ configureXStream()

void com.fs.starfarer.api.ModPlugin.configureXStream ( XStream  x)

◆ onApplicationLoad()

void com.fs.starfarer.api.ModPlugin.onApplicationLoad ( ) throws Exception

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.

Exceptions
Exception

Implemented in com.fs.starfarer.api.BaseModPlugin.

◆ onDevModeF8Reload()

void com.fs.starfarer.api.ModPlugin.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.

Implemented in com.fs.starfarer.api.BaseModPlugin.

◆ onEnabled()

void com.fs.starfarer.api.ModPlugin.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
wasEnabledBeforetrue 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).

Implemented in com.fs.starfarer.api.BaseModPlugin.

◆ onGameLoad()

void com.fs.starfarer.api.ModPlugin.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.

Implemented in com.fs.starfarer.api.BaseModPlugin, and com.fs.starfarer.api.impl.campaign.CoreLifecyclePluginImpl.

◆ onGameSaveFailed()

void com.fs.starfarer.api.ModPlugin.onGameSaveFailed ( )

Called if saving the game failed for some reason, such as running out of memory.

Implemented in com.fs.starfarer.api.BaseModPlugin, and com.fs.starfarer.api.impl.campaign.CoreLifecyclePluginImpl.

◆ onNewGame()

void com.fs.starfarer.api.ModPlugin.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).

Implemented in com.fs.starfarer.api.BaseModPlugin, and com.fs.starfarer.api.impl.campaign.CoreLifecyclePluginImpl.

◆ onNewGameAfterEconomyLoad()

void com.fs.starfarer.api.ModPlugin.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();

Implemented in com.fs.starfarer.api.BaseModPlugin, and com.fs.starfarer.api.impl.campaign.CoreLifecyclePluginImpl.

◆ onNewGameAfterProcGen()

void com.fs.starfarer.api.ModPlugin.onNewGameAfterProcGen ( )

◆ onNewGameAfterTimePass()

void com.fs.starfarer.api.ModPlugin.onNewGameAfterTimePass ( )

After the new game has stepped through its initial 2 months.

Implemented in com.fs.starfarer.api.BaseModPlugin, and com.fs.starfarer.api.impl.campaign.CoreLifecyclePluginImpl.

◆ pickDroneAI()

PluginPick< ShipAIPlugin > com.fs.starfarer.api.ModPlugin.pickDroneAI ( ShipAPI  drone,
ShipAPI  mothership,
DroneLauncherShipSystemAPI  system 
)

Called to pick drone AI implementation.

Parameters
drone
mothership
systemuse getSpecJson() to get at the system spec, if needed.
Returns

Implemented in com.fs.starfarer.api.BaseModPlugin.

◆ pickMissileAI()

PluginPick< MissileAIPlugin > com.fs.starfarer.api.ModPlugin.pickMissileAI ( MissileAPI  missile,
ShipAPI  launchingShip 
)

Called to pick missile AI implementation.

Parameters
drone
launchingShip
Returns

Implemented in com.fs.starfarer.api.BaseModPlugin.

◆ pickShipAI()

PluginPick< ShipAIPlugin > com.fs.starfarer.api.ModPlugin.pickShipAI ( FleetMemberAPI  member,
ShipAPI  ship 
)

Called to pick an AI implementation for a specific ship. Here instead of in CampaignPlugin to support custom AI for missions.

Parameters
memberCan be null.
shipCan not be null. Could be a ship or a fighter.
Returns
null, or a custom AI implementation.

Implemented in com.fs.starfarer.api.BaseModPlugin, and com.fs.starfarer.api.impl.campaign.CoreLifecyclePluginImpl.

◆ pickWeaponAutofireAI()

PluginPick< AutofireAIPlugin > com.fs.starfarer.api.ModPlugin.pickWeaponAutofireAI ( WeaponAPI  weapon)

Called to pick an AI implementation for a specific weapon.

Parameters
weapon
Returns

Implemented in com.fs.starfarer.api.BaseModPlugin.


The documentation for this interface was generated from the following file: