Class BaseModPlugin

java.lang.Object
com.fs.starfarer.api.BaseModPlugin
All Implemented Interfaces:
ModPlugin
Direct Known Subclasses:
CoreLifecyclePluginImpl

public class BaseModPlugin extends Object implements ModPlugin
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 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 interface ModPlugin
    • beforeGameSave

      public void beforeGameSave()
      Description copied from interface: ModPlugin
      Called before a game is saved.
      Specified by:
      beforeGameSave in interface ModPlugin
    • 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 interface ModPlugin
    • onApplicationLoad

      public void onApplicationLoad() throws Exception
      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 interface ModPlugin
      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.
      Specified by:
      onEnabled in interface ModPlugin
      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

      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 interface ModPlugin
    • 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).
      Specified by:
      onNewGame in interface ModPlugin
    • 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 interface ModPlugin
    • pickShipAI

      public PluginPick<ShipAIPlugin> pickShipAI(FleetMemberAPI member, ShipAPI ship)
      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 interface ModPlugin
      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

      public PluginPick<AutofireAIPlugin> pickWeaponAutofireAI(WeaponAPI weapon)
      Description copied from interface: ModPlugin
      Called to pick an AI implementation for a specific weapon.
      Specified by:
      pickWeaponAutofireAI in interface ModPlugin
      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 interface ModPlugin
      system - use getSpecJson() to get at the system spec, if needed.
      Returns:
    • pickMissileAI

      public PluginPick<MissileAIPlugin> pickMissileAI(MissileAPI missile, ShipAPI launchingShip)
      Description copied from interface: ModPlugin
      Called to pick missile AI implementation.
      Specified by:
      pickMissileAI in interface ModPlugin
      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 interface ModPlugin
    • configureXStream

      public void configureXStream(com.thoughtworks.xstream.XStream x)
      Specified by:
      configureXStream in interface ModPlugin
    • onNewGameAfterProcGen

      public void onNewGameAfterProcGen()
      Specified by:
      onNewGameAfterProcGen in interface ModPlugin
    • 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 interface ModPlugin
    • onAboutToStartGeneratingCodex

      public void onAboutToStartGeneratingCodex()
      Specified by:
      onAboutToStartGeneratingCodex in interface ModPlugin
    • onAboutToLinkCodexEntries

      public void onAboutToLinkCodexEntries()
      Specified by:
      onAboutToLinkCodexEntries in interface ModPlugin
    • onCodexDataGenerated

      public void onCodexDataGenerated()
      Specified by:
      onCodexDataGenerated in interface ModPlugin