Barotrauma Server
|
StatusEffects can be used to execute various kinds of effects: modifying the state of some entity in some way, spawning things, playing sounds, emitting particles, creating fire and explosions, increasing a characters' skill. They are a crucial part of modding Barotrauma: all kinds of custom behaviors of an item or a creature for example are generally created using StatusEffects. More...
Classes | |
class | AbilityStatusEffectIdentifier |
Can be used by AbilityConditionStatusEffectIdentifier to check whether some specific StatusEffect is running. More... | |
class | AITrigger |
Can be used to trigger a behavior change of some kind on an AI character. Only applicable for enemy characters, not humans. More... | |
class | CharacterSpawnInfo |
Defines characters spawned by the effect, and where and how they're spawned. More... | |
class | GiveSkill |
Increases a character's skills when the effect executes. Only valid if the target is a character or a limb. More... | |
class | GiveTalentInfo |
Unlocks a talent, or multiple talents when the effect executes. Only valid if the target is a character or a limb. More... | |
Public Types | |
enum | TargetType { This = 1 , Parent = 2 , Character = 4 , Contained = 8 , NearbyCharacters = 16 , NearbyItems = 32 , UseTarget = 64 , Hull = 128 , Limb = 256 , AllLimbs = 512 , LastLimb = 1024 } |
Public Member Functions | |
readonly record struct | AnimLoadInfo (AnimationType Type, Either< string, ContentPath > File, float Priority, ImmutableArray< Identifier > ExpectedSpeciesNames) |
bool | HasTargetType (TargetType targetType) |
bool | ReducesItemCondition () |
bool | IncreasesItemCondition () |
bool | MatchesTagConditionals (ItemPrefab itemPrefab) |
bool | HasRequiredAfflictions (AttackResult attackResult) |
virtual bool | HasRequiredItems (Entity entity) |
void | AddNearbyTargets (Vector2 worldPosition, List< ISerializableEntity > targets) |
bool | HasRequiredConditions (IReadOnlyList< ISerializableEntity > targets) |
void | SetUser (Character user) |
bool | ShouldWaitForInterval (Entity entity, float deltaTime) |
virtual void | Apply (ActionType type, float deltaTime, Entity entity, ISerializableEntity target, Vector2? worldPosition=null) |
virtual void | Apply (ActionType type, float deltaTime, Entity entity, IReadOnlyList< ISerializableEntity > targets, Vector2? worldPosition=null) |
void | AddTag (Identifier tag) |
bool | HasTag (Identifier tag) |
Static Public Member Functions | |
static StatusEffect | Load (ContentXElement element, string parentDebugName) |
static void | UpdateAll (float deltaTime) |
static void | StopAll () |
Public Attributes | |
int | TargetSlot = -1 |
Index of the slot the target must be in. Only valid when targeting a Contained item. | |
readonly ImmutableArray<(Identifier propertyName, object value)> | PropertyEffects |
readonly bool | CheckConditionalAlways |
Only applicable for StatusEffects with a duration or delay. Should the conditional checks only be done when the effect triggers, or for the whole duration it executes / when the delay runs out and the effect executes? In other words, if false, the conditionals are only checked once when the effect triggers, but after that it can keep running for the whole duration, or is guaranteed to execute after the delay. | |
readonly bool | Stackable = true |
Only valid if the effect has a duration or delay. Can the effect be applied on the same target(s) if the effect is already being applied? | |
readonly float | Interval |
The interval at which the effect is executed. The difference between delay and interval is that effects with a delay find the targets, check the conditions, etc immediately when Apply is called, but don't apply the effects until the delay has passed. Effects with an interval check if the interval has passed when Apply is called and apply the effects if it has, otherwise they do nothing. | |
readonly ActionType | type = ActionType.OnActive |
readonly List< GiveTalentInfo > | giveTalentInfos |
readonly float | FireSize |
readonly LimbType[] | targetLimbs |
Which types of limbs this effect can target? Only valid when targeting characters or limbs. | |
readonly float | SeverLimbsProbability |
The probability of severing a limb damaged by this status effect. Only valid when targeting characters or limbs. | |
PhysicsBody | sourceBody |
readonly bool | OnlyInside |
If enabled, this effect can only execute inside a hull. | |
readonly bool | OnlyOutside |
If enabled, this effect can only execute outside hulls. | |
readonly bool | OnlyWhenDamagedByPlayer |
If enabled, the effect only executes when the entity receives damage from a player character (a character controlled by a human player). Only valid for characters, and effects of the type OnDamaged. | |
readonly bool | AllowWhenBroken = false |
Can the StatusEffect be applied when the item applying it is broken? | |
readonly ImmutableHashSet< Identifier > | TargetIdentifiers |
Identifier(s), tag(s) or species name(s) of the entity the effect can target. Null if there's no identifiers. | |
readonly string | TargetItemComponent |
If set to the name of one of the target's ItemComponents, the effect is only applied on that component. Only works on items. | |
float | AfflictionMultiplier = 1.0f |
readonly List<(Identifier AfflictionIdentifier, float ReduceAmount)> | ReduceAffliction = new List<(Identifier affliction, float amount)>() |
readonly float | Duration |
How long the effect runs (in seconds). Note that if Stackable is true, there can be multiple instances of the effect running at a time. In other words, if the effect has a duration and executes every frame, you probably want to make it non-stackable or it'll lead to a large number of overlapping effects running at the same time. | |
Static Public Attributes | |
static readonly List< DurationListElement > | DurationList = new List<DurationListElement>() |
Protected Member Functions | |
StatusEffect (ContentXElement element, string parentDebugName) | |
bool | IsValidTarget (ISerializableEntity entity) |
bool | IsValidTarget (ItemComponent itemComponent) |
bool | IsValidTarget (Item item) |
bool | IsValidTarget (Character character) |
void | Apply (float deltaTime, Entity entity, IReadOnlyList< ISerializableEntity > targets, Vector2? worldPosition=null) |
Protected Attributes | |
readonly List< ISerializableEntity > | currentTargets = new List<ISerializableEntity>() |
Properties | |
bool | HasConditions [get] |
IEnumerable< Explosion > | Explosions [get] |
List< Affliction > | Afflictions = new List<Affliction>() [get] |
IEnumerable< CharacterSpawnInfo > | SpawnCharacters [get] |
float | Range [get] |
How close to the entity executing the effect the targets must be. Only applicable if targeting NearbyCharacters or NearbyItems. | |
Vector2 | Offset [get] |
An offset added to the position of the effect is executed at. Only relevant if the effect does something where position matters, for example emitting particles or explosions, spawning something or playing sounds. | |
string | Tags [get, set] |
bool | Disabled [get] |
StatusEffects can be used to execute various kinds of effects: modifying the state of some entity in some way, spawning things, playing sounds, emitting particles, creating fire and explosions, increasing a characters' skill. They are a crucial part of modding Barotrauma: all kinds of custom behaviors of an item or a creature for example are generally created using StatusEffects.
<doc> <Field identifier="delay" type="float" defaultValue="0.0"> Can be used to delay the execution of the effect. For example, you could have an effect that triggers when a character receives damage, but takes 5 seconds before it starts to do anything. </Field> <Field identifier="tags" type="string[]" defaultValue=""> An arbitrary tag (or a list of tags) that describe the status effect and can be used by Conditionals to check whether some StatusEffect is running. For example, an item could execute a StatusEffect with the tag "poisoned" on some character, and the character could have an effect that makes the character do something when an effect with that tag is active. </Field>
<Field identifier="conditionalComparison" type="Comparison" defaultValue="Or"> And/Or. Do all of the Conditionals defined in the effect be true for the effect to execute, or should the effect execute when any of them is true? </Field> <Field identifier="Any property of the target" type="Any" defaultValue=""> These are the meat of the StatusEffects. You can set, increment or decrement any value of the target, be it an item, character, limb or hull. By default, the value is added to the existing value. If you want to instead set the value, use the setValue attribute. For example, Condition="-5" would decrease the condition of the item the effect is targeting by 5 per second. If the target has no property with the specified name, the attribute does nothing. </Field> </doc>
Enumerator | |
---|---|
This | The entity (item, character, limb) the StatusEffect is defined in. |
Parent | In the context of items, the container the item is inside (if any). In the context of limbs, the character the limb belongs to. |
Character | The character the StatusEffect is defined in. In the context of items and attacks, the character using the item/attack. |
Contained | The item(s) contained in the inventory of the entity the StatusEffect is defined in. |
NearbyCharacters | Characters near the entity the StatusEffect is defined in. The range is defined using Range. |
NearbyItems | Items near the entity the StatusEffect is defined in. The range is defined using Range. |
UseTarget | The entity the item/attack is being used on. |
Hull | The hull the entity is inside. |
Limb | The entity the item/attack is being used on. In the context of characters, one of the character's limbs (specify which one using targetLimbs). |
AllLimbs | All limbs of the character the effect is being used on. |
LastLimb | Last limb of the character the effect is being used on. |
|
protected |
void Barotrauma.StatusEffect.AddNearbyTargets | ( | Vector2 | worldPosition, |
List< ISerializableEntity > | targets ) |
void Barotrauma.StatusEffect.AddTag | ( | Identifier | tag | ) |
readonly record struct Barotrauma.StatusEffect.AnimLoadInfo | ( | AnimationType | Type, |
Either< string, ContentPath > | File, | ||
float | Priority, | ||
ImmutableArray< Identifier > | ExpectedSpeciesNames ) |
|
virtual |
Reimplemented in Barotrauma.DelayedEffect.
|
virtual |
Reimplemented in Barotrauma.DelayedEffect.
|
protected |
bool Barotrauma.StatusEffect.HasRequiredAfflictions | ( | AttackResult | attackResult | ) |
bool Barotrauma.StatusEffect.HasRequiredConditions | ( | IReadOnlyList< ISerializableEntity > | targets | ) |
|
virtual |
bool Barotrauma.StatusEffect.HasTag | ( | Identifier | tag | ) |
bool Barotrauma.StatusEffect.HasTargetType | ( | TargetType | targetType | ) |
bool Barotrauma.StatusEffect.IncreasesItemCondition | ( | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
bool Barotrauma.StatusEffect.MatchesTagConditionals | ( | ItemPrefab | itemPrefab | ) |
bool Barotrauma.StatusEffect.ReducesItemCondition | ( | ) |
void Barotrauma.StatusEffect.SetUser | ( | Character | user | ) |
bool Barotrauma.StatusEffect.ShouldWaitForInterval | ( | Entity | entity, |
float | deltaTime ) |
|
static |
|
static |
float Barotrauma.StatusEffect.AfflictionMultiplier = 1.0f |
readonly bool Barotrauma.StatusEffect.AllowWhenBroken = false |
Can the StatusEffect be applied when the item applying it is broken?
readonly bool Barotrauma.StatusEffect.CheckConditionalAlways |
Only applicable for StatusEffects with a duration or delay. Should the conditional checks only be done when the effect triggers, or for the whole duration it executes / when the delay runs out and the effect executes? In other words, if false, the conditionals are only checked once when the effect triggers, but after that it can keep running for the whole duration, or is guaranteed to execute after the delay.
|
protected |
readonly float Barotrauma.StatusEffect.Duration |
How long the effect runs (in seconds). Note that if Stackable is true, there can be multiple instances of the effect running at a time. In other words, if the effect has a duration and executes every frame, you probably want to make it non-stackable or it'll lead to a large number of overlapping effects running at the same time.
|
static |
readonly float Barotrauma.StatusEffect.FireSize |
readonly List<GiveTalentInfo> Barotrauma.StatusEffect.giveTalentInfos |
readonly float Barotrauma.StatusEffect.Interval |
The interval at which the effect is executed. The difference between delay and interval is that effects with a delay find the targets, check the conditions, etc immediately when Apply is called, but don't apply the effects until the delay has passed. Effects with an interval check if the interval has passed when Apply is called and apply the effects if it has, otherwise they do nothing.
readonly bool Barotrauma.StatusEffect.OnlyInside |
If enabled, this effect can only execute inside a hull.
readonly bool Barotrauma.StatusEffect.OnlyOutside |
If enabled, this effect can only execute outside hulls.
readonly bool Barotrauma.StatusEffect.OnlyWhenDamagedByPlayer |
If enabled, the effect only executes when the entity receives damage from a player character (a character controlled by a human player). Only valid for characters, and effects of the type OnDamaged.
readonly ImmutableArray<(Identifier propertyName, object value)> Barotrauma.StatusEffect.PropertyEffects |
readonly List<(Identifier AfflictionIdentifier, float ReduceAmount)> Barotrauma.StatusEffect.ReduceAffliction = new List<(Identifier affliction, float amount)>() |
readonly float Barotrauma.StatusEffect.SeverLimbsProbability |
The probability of severing a limb damaged by this status effect. Only valid when targeting characters or limbs.
PhysicsBody Barotrauma.StatusEffect.sourceBody |
readonly bool Barotrauma.StatusEffect.Stackable = true |
Only valid if the effect has a duration or delay. Can the effect be applied on the same target(s) if the effect is already being applied?
readonly ImmutableHashSet<Identifier> Barotrauma.StatusEffect.TargetIdentifiers |
Identifier(s), tag(s) or species name(s) of the entity the effect can target. Null if there's no identifiers.
readonly string Barotrauma.StatusEffect.TargetItemComponent |
If set to the name of one of the target's ItemComponents, the effect is only applied on that component. Only works on items.
readonly LimbType [] Barotrauma.StatusEffect.targetLimbs |
Which types of limbs this effect can target? Only valid when targeting characters or limbs.
int Barotrauma.StatusEffect.TargetSlot = -1 |
Index of the slot the target must be in. Only valid when targeting a Contained item.
readonly ActionType Barotrauma.StatusEffect.type = ActionType.OnActive |
|
get |
|
get |
|
get |
|
get |
|
get |
An offset added to the position of the effect is executed at. Only relevant if the effect does something where position matters, for example emitting particles or explosions, spawning something or playing sounds.
|
get |
How close to the entity executing the effect the targets must be. Only applicable if targeting NearbyCharacters or NearbyItems.
|
get |
|
getset |