Class SourceBasedFleetManager
java.lang.Object
com.fs.starfarer.api.impl.campaign.fleets.SourceBasedFleetManager
- All Implemented Interfaces:
FleetEventListener
,EveryFrameScript
- Direct Known Subclasses:
RemnantStationFleetManager
,RogueMinerMiscFleetManager
public abstract class SourceBasedFleetManager
extends Object
implements FleetEventListener, EveryFrameScript
Up to a configurable number of fleets. Instant despawn when player is far enough.
New fleets generated after respawnDelay if some are destroyed.
- Author:
- Alex Mosolov Copyright 2017 Fractal Softworks, LLC
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic boolean
static float
static float
protected float
protected List<CampaignFleetAPI>
protected int
protected int
protected float
protected SectorEntityToken
protected org.lwjgl.util.vector.Vector2f
protected float
-
Constructor Summary
ConstructorsConstructorDescriptionSourceBasedFleetManager
(SectorEntityToken source, float thresholdLY, int minFleets, int maxFleets, float respawnDelay) -
Method Summary
Modifier and TypeMethodDescriptionvoid
advance
(float amount) Use SectorAPI.getClock() to convert to campaign days.float
boolean
isDone()
void
reportBattleOccurred
(CampaignFleetAPI fleet, CampaignFleetAPI primaryWinner, BattleAPI battle) "fleet" will be null if the listener is registered with the ListenerManager, and non-null if the listener is added directly to a fleet.void
reportFleetDespawnedToListener
(CampaignFleetAPI fleet, CampaignEventListener.FleetDespawnReason reason, Object param) boolean
void
setDone
(boolean done) protected abstract CampaignFleetAPI
-
Field Details
-
DESPAWN_THRESHOLD_PAD_LY
public static float DESPAWN_THRESHOLD_PAD_LY -
DESPAWN_MIN_DIST_LY
public static float DESPAWN_MIN_DIST_LY -
fleets
-
thresholdLY
protected float thresholdLY -
source
-
DEBUG
public static boolean DEBUG -
minFleets
protected int minFleets -
maxFleets
protected int maxFleets -
respawnDelay
protected float respawnDelay -
destroyed
protected float destroyed -
sourceLocation
protected org.lwjgl.util.vector.Vector2f sourceLocation
-
-
Constructor Details
-
SourceBasedFleetManager
public SourceBasedFleetManager(SectorEntityToken source, float thresholdLY, int minFleets, int maxFleets, float respawnDelay)
-
-
Method Details
-
getThresholdLY
public float getThresholdLY() -
getSource
-
spawnFleet
-
advance
public void advance(float amount) Description copied from interface:EveryFrameScript
Use SectorAPI.getClock() to convert to campaign days.- Specified by:
advance
in interfaceEveryFrameScript
- Parameters:
amount
- seconds elapsed during the last frame.
-
isDone
public boolean isDone()- Specified by:
isDone
in interfaceEveryFrameScript
- Returns:
- true when the script is finished and can be cleaned up by the engine.
-
setDone
public void setDone(boolean done) -
runWhilePaused
public boolean runWhilePaused()- Specified by:
runWhilePaused
in interfaceEveryFrameScript
- Returns:
- whether advance() should be called while the campaign engine is paused.
-
reportFleetDespawnedToListener
public void reportFleetDespawnedToListener(CampaignFleetAPI fleet, CampaignEventListener.FleetDespawnReason reason, Object param) - Specified by:
reportFleetDespawnedToListener
in interfaceFleetEventListener
-
reportBattleOccurred
public void reportBattleOccurred(CampaignFleetAPI fleet, CampaignFleetAPI primaryWinner, BattleAPI battle) Description copied from interface:FleetEventListener
"fleet" will be null if the listener is registered with the ListenerManager, and non-null if the listener is added directly to a fleet.- Specified by:
reportBattleOccurred
in interfaceFleetEventListener
-