Package com.fs.starfarer.api.characters
Interface AbilityPlugin
- All Known Implementing Classes:
BaseAbilityPlugin
,BaseDurationAbility
,BaseToggleAbility
,DistressCallAbility
,DurationAbilityWithCost2
,EmergencyBurnAbility
,FractureJumpAbility
,GenerateSlipsurgeAbility
,GoDarkAbility
,GraviticScanAbility
,InterdictionPulseAbility
,RemoteSurveyAbility
,ReversePolarityToggle
,ScavengeAbility
,SensorBurstAbility
,SustainedBurnAbility
,ToggleAbilityWithCost
,TransponderAbility
public interface AbilityPlugin
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activate()
Programmatic way to activate the ability.void
cleanup()
After this method is called, it should be possible to remove the ability from the entity without any after-effects.void
createTooltip
(TooltipMakerAPI tooltip, boolean expanded) Will be called every frame the tooltip is shown, so the tooltip can be dynamic.void
Toggleable or interruptable abilities should implement this method so that other abilities may turn them off or interrupt them if needed.void
fleetJoinedBattle
(BattleAPI battle) void
fleetLeftBattle
(BattleAPI battle, boolean engagedInHostilities) void
fleetOpenedMarket
(MarketAPI market) Only called for the player fleet.void
Make this ability unusable for 1-2 frames after this call.float
0 at start of cooldown, 1 at end.float
getId()
float
getLevel()
float
0 at start of progress, 1 at end.getSpec()
float
boolean
boolean
void
init
(String id, SectorEntityToken entity) boolean
isActive()
Whether a toggle-style ability is turned on.boolean
Should return (isActive() || getProgressFraction() > 0).boolean
boolean
boolean
boolean
boolean
isUsable()
Whether the ability can be activated / the UI button corresponding to it is enabled.void
Called from the UI when the button for this ability is pressed.void
render
(CampaignEngineLayers layer, ViewportAPI viewport) void
setCooldownLeft
(float days) boolean
boolean
boolean
-
Method Details
-
init
-
pressButton
void pressButton()Called from the UI when the button for this ability is pressed. Should not be called by the AI for other ability-using fleets, for example. -
activate
void activate()Programmatic way to activate the ability. Expected behavior: if (!isActiveOrInProgress()) {} -
deactivate
void deactivate()Toggleable or interruptable abilities should implement this method so that other abilities may turn them off or interrupt them if needed. Expected behavior: if (isActiveOrInProgress()) {} -
cleanup
void cleanup()After this method is called, it should be possible to remove the ability from the entity without any after-effects. -
showActiveIndicator
boolean showActiveIndicator() -
showProgressIndicator
boolean showProgressIndicator() -
showCooldownIndicator
boolean showCooldownIndicator() -
isUsable
boolean isUsable()Whether the ability can be activated / the UI button corresponding to it is enabled.- Returns:
-
isActive
boolean isActive()Whether a toggle-style ability is turned on. Duration abilities will always return false here; use isInProgress() to get their status.- Returns:
-
isInProgress
boolean isInProgress() -
isOnCooldown
boolean isOnCooldown() -
isActiveOrInProgress
boolean isActiveOrInProgress()Should return (isActive() || getProgressFraction() > 0).- Returns:
-
getCooldownFraction
float getCooldownFraction()0 at start of cooldown, 1 at end.- Returns:
-
getProgressFraction
float getProgressFraction()0 at start of progress, 1 at end.- Returns:
-
getProgressColor
Color getProgressColor() -
getActiveColor
Color getActiveColor() -
getCooldownColor
Color getCooldownColor() -
isCooldownRenderingAdditive
boolean isCooldownRenderingAdditive() -
hasCustomButtonPressSounds
boolean hasCustomButtonPressSounds() -
getSpriteName
String getSpriteName() -
getEntity
SectorEntityToken getEntity() -
getId
String getId() -
createTooltip
Will be called every frame the tooltip is shown, so the tooltip can be dynamic.- Parameters:
tooltip
-expanded
-
-
hasTooltip
boolean hasTooltip() -
isTooltipExpandable
boolean isTooltipExpandable() -
getTooltipWidth
float getTooltipWidth() -
forceDisable
void forceDisable()Make this ability unusable for 1-2 frames after this call. -
fleetJoinedBattle
-
fleetLeftBattle
-
fleetOpenedMarket
Only called for the player fleet.- Parameters:
market
-
-
getSpec
AbilitySpecAPI getSpec() -
render
-
getActiveLayers
EnumSet<CampaignEngineLayers> getActiveLayers() -
setCooldownLeft
void setCooldownLeft(float days) -
getCooldownLeft
float getCooldownLeft() -
getLevel
float getLevel()
-