Barotrauma Client Doc
|
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 class | 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 | |
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. More... | |
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. More... | |
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? More... | |
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. More... | |
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. More... | |
readonly float | SeverLimbsProbability |
The probability of severing a limb damaged by this status effect. Only valid when targeting characters or limbs. More... | |
PhysicsBody | sourceBody |
readonly bool | OnlyInside |
If enabled, this effect can only execute inside a hull. More... | |
readonly bool | OnlyOutside |
If enabled, this effect can only execute outside hulls. More... | |
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. More... | |
readonly bool | AllowWhenBroken = false |
Can the StatusEffect be applied when the item applying it is broken? More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
string | Tags [get, set] |
bool | Disabled [get] |
IEnumerable< RoundSound > | Sounds [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>
Definition at line 70 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
strong |
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. |
Definition at line 79 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
protected |
Definition at line 761 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
void Barotrauma.StatusEffect.AddNearbyTargets | ( | Vector2 | worldPosition, |
List< ISerializableEntity > | targets | ||
) |
Definition at line 1167 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
void Barotrauma.StatusEffect.AddTag | ( | Identifier | tag | ) |
Definition at line 2591 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
virtual |
Reimplemented in Barotrauma.DelayedEffect.
Definition at line 1444 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
virtual |
Reimplemented in Barotrauma.DelayedEffect.
Definition at line 1419 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
protected |
Definition at line 1544 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
bool Barotrauma.StatusEffect.HasRequiredAfflictions | ( | AttackResult | attackResult | ) |
Definition at line 1139 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
bool Barotrauma.StatusEffect.HasRequiredConditions | ( | IReadOnlyList< ISerializableEntity > | targets | ) |
Definition at line 1222 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
virtual |
Definition at line 1150 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
bool Barotrauma.StatusEffect.HasTag | ( | Identifier | tag | ) |
Definition at line 2597 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
bool Barotrauma.StatusEffect.HasTargetType | ( | TargetType | targetType | ) |
Definition at line 1098 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
bool Barotrauma.StatusEffect.IncreasesItemCondition | ( | ) |
Definition at line 1115 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
protected |
Definition at line 1376 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
protected |
Definition at line 1331 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
protected |
Definition at line 1366 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
protected |
Definition at line 1355 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
static |
Definition at line 751 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
bool Barotrauma.StatusEffect.MatchesTagConditionals | ( | ItemPrefab | itemPrefab | ) |
Definition at line 1127 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
bool Barotrauma.StatusEffect.ReducesItemCondition | ( | ) |
Definition at line 1103 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
void Barotrauma.StatusEffect.SetUser | ( | Character | user | ) |
Definition at line 1389 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
bool Barotrauma.StatusEffect.ShouldWaitForInterval | ( | Entity | entity, |
float | deltaTime | ||
) |
Definition at line 1400 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
static |
Definition at line 2584 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
static |
Definition at line 2398 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
float Barotrauma.StatusEffect.AfflictionMultiplier = 1.0f |
Definition at line 682 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
readonly bool Barotrauma.StatusEffect.AllowWhenBroken = false |
Can the StatusEffect be applied when the item applying it is broken?
Definition at line 665 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
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.
Definition at line 555 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
protected |
Definition at line 1443 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
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.
Definition at line 715 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
static |
Definition at line 547 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
readonly float Barotrauma.StatusEffect.FireSize |
Definition at line 633 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
readonly List<GiveTalentInfo> Barotrauma.StatusEffect.giveTalentInfos |
Definition at line 597 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
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.
Definition at line 567 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
readonly bool Barotrauma.StatusEffect.OnlyInside |
If enabled, this effect can only execute inside a hull.
Definition at line 650 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
readonly bool Barotrauma.StatusEffect.OnlyOutside |
If enabled, this effect can only execute outside hulls.
Definition at line 654 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
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.
Definition at line 660 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
readonly ImmutableArray<(Identifier propertyName, object value)> Barotrauma.StatusEffect.PropertyEffects |
Definition at line 508 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
readonly List<(Identifier AfflictionIdentifier, float ReduceAmount)> Barotrauma.StatusEffect.ReduceAffliction = new List<(Identifier affliction, float amount)>() |
Definition at line 702 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
readonly float Barotrauma.StatusEffect.SeverLimbsProbability |
The probability of severing a limb damaged by this status effect. Only valid when targeting characters or limbs.
Definition at line 643 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
PhysicsBody Barotrauma.StatusEffect.sourceBody |
Definition at line 645 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
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?
Definition at line 560 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
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.
Definition at line 670 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
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.
Definition at line 676 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
readonly LimbType [] Barotrauma.StatusEffect.targetLimbs |
Which types of limbs this effect can target? Only valid when targeting characters or limbs.
Definition at line 638 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
int Barotrauma.StatusEffect.TargetSlot = -1 |
Index of the slot the target must be in. Only valid when targeting a Contained item.
Definition at line 504 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
readonly ActionType Barotrauma.StatusEffect.type = ActionType.OnActive |
Definition at line 581 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
get |
Definition at line 684 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
get |
Definition at line 749 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
get |
Definition at line 584 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
get |
Definition at line 512 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
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.
Definition at line 730 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
get |
How close to the entity executing the effect the targets must be. Only applicable if targeting NearbyCharacters or NearbyItems.
Definition at line 720 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
get |
Definition at line 18 of file BarotraumaClient/ClientSource/StatusEffects/StatusEffect.cs.
|
get |
Definition at line 697 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.
|
getset |
Definition at line 732 of file BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs.