Barotrauma Client
Loading...
Searching...
No Matches
Barotrauma.PropertyConditional Class Referencesealed

Conditionals are used by some in-game mechanics to require one or more conditions to be met for those mechanics to be active. For example, some StatusEffects use Conditionals to only trigger if the affected character is alive. More...

Public Types

enum  ConditionType {
  PropertyValueOrAffliction , SkillRequirement , Name , SpeciesName ,
  SpeciesGroup , HasTag , HasStatusTag , HasSpecifierTag ,
  EntityType , LimbType , WorldHostility
}
 Category of properties to check against. More...
 
enum  LogicalOperatorType { And , Or }
 
enum  ComparisonOperatorType {
  None , Equals , NotEquals , LessThan ,
  LessThanEquals , GreaterThan , GreaterThanEquals
}
 There are several ways to compare properties to values. The comparison operator to use can be specified by placing one of the following before the value to compare against. More...
 

Public Member Functions

bool Matches (ISerializableEntity? target)
 
bool TargetTagMatchesTagCondition (Identifier targetTag)
 

Static Public Member Functions

static IEnumerable< PropertyConditionalFromXElement (ContentXElement element, Predicate< XAttribute >? predicate=null)
 
static ComparisonOperatorType string ConditionStr ExtractComparisonOperatorFromConditionString (string str)
 
static ComparisonOperatorType GetComparisonOperatorType (string op)
 
static bool CompareFloat (float val1, float val2, ComparisonOperatorType op)
 
static bool Compare< T > (T leftValue, T rightValue, ComparisonOperatorType comparisonOperator)
 

Public Attributes

readonly ConditionType Type
 
readonly ComparisonOperatorType ComparisonOperator
 
readonly Identifier AttributeName
 
readonly string AttributeValue
 
readonly ImmutableArray< Identifier > AttributeValueAsTags
 
readonly? float FloatValue
 
readonly string TargetItemComponent
 If set to the name of one of the target's ItemComponents, the conditionals defined by this element check against the properties of that component. Only works on items.
 
readonly bool TargetSelf
 If set to true, the conditionals defined by this element check against the attacking character instead of the attacked character. Only applies to a character's attacks and targeting parameters.
 
readonly bool TargetContainer
 If set to true, the conditionals defined by this element check against the entity containing the target.
 
readonly bool TargetGrandParent
 If this and TargetContainer are set to true, the conditionals defined by this element check against the entity containing the target's container. For example, diving suits have a status effect that targets contained oxygen tanks, with a conditional that only passes if the locker containing the suit is powered.
 
readonly bool TargetContainedItem
 If set to true, the conditionals defined by this element check against the items contained by the target. Only works with items.
 

Static Public Attributes

static ComparisonOperatorType ComparisonOperator
 

Detailed Description

Conditionals are used by some in-game mechanics to require one or more conditions to be met for those mechanics to be active. For example, some StatusEffects use Conditionals to only trigger if the affected character is alive.

Member Enumeration Documentation

◆ ComparisonOperatorType

There are several ways to compare properties to values. The comparison operator to use can be specified by placing one of the following before the value to compare against.

Enumerator
None 
Equals 

Require that the property being checked equals the given value.

This is the default operator used if none is specified.

NotEquals 

Require that the property being checked doesn't equal the given value.

LessThan 

Require that the property being checked is less than the given value.

This can only be used to compare with numeric object properties, affliction strengths and skill levels.

LessThanEquals 

Require that the property being checked is less than or equal to the given value.

This can only be used to compare with numeric object properties, affliction strengths and skill levels.

GreaterThan 

Require that the property being checked is greater than the given value.

This can only be used to compare with numeric object properties, affliction strengths and skill levels.

GreaterThanEquals 

Require that the property being checked is greater than or equal to the given value.

This can only be used to compare with numeric object properties, affliction strengths and skill levels.

◆ ConditionType

Category of properties to check against.

Enumerator
PropertyValueOrAffliction 

If there exists an affliction with an identifier that matches the given key, check against the strength of that affliction. Otherwise, check against the value of one of the target's properties.

The target object's available properties depend on how that object is defined in the source code.

This is not applicable if the element contains the attribute SkillRequirement="true".

<AutoDocEntryName value="Property or affliction identifier" >

<Conditional WatchersGaze="gt 0" > <Conditional IsDead="true" >

SkillRequirement 

Check against the target character's skill with the same name as the attribute.

This is only applicable if the element contains the attribute SkillRequirement="true".

<AutoDocEntryName value="Skill identifier" >

<Conditional SkillRequirement="true" weapons="lt 50" >

Name 

Check against the name of the target.

SpeciesName 

Check against the species identifier of the target. Only works on characters.

SpeciesGroup 

Check against the species group of the target. Only works on characters.

HasTag 

Check against the target's tags. Only works on items.

Several tags can be checked against by using a comma-separated list.

HasStatusTag 

Check against the tags of the target's active status effects.

Several tags can be checked against by using a comma-separated list.

HasSpecifierTag 

Check against the target's specifier tags. In the vanilla game, these are the head index and gender. See human.xml for more details.

Several tags can be checked against by using a comma-separated list.

EntityType 

Check against the target's entity type.

The currently supported values are "character", "limb", "item", "structure" and "null".

LimbType 

Check against the target's limb type. See Barotrauma.LimbType.

WorldHostility 

Check against the current World Hostility setting (previously known as "Difficulty").

◆ LogicalOperatorType

Member Function Documentation

◆ Compare< T >()

static bool Barotrauma.PropertyConditional.Compare< T > ( T leftValue,
T rightValue,
ComparisonOperatorType comparisonOperator )
static
Type Constraints
T :IComparable 

◆ CompareFloat()

static bool Barotrauma.PropertyConditional.CompareFloat ( float val1,
float val2,
ComparisonOperatorType op )
static

◆ ExtractComparisonOperatorFromConditionString()

static ComparisonOperatorType string ConditionStr Barotrauma.PropertyConditional.ExtractComparisonOperatorFromConditionString ( string str)
static

◆ FromXElement()

static IEnumerable< PropertyConditional > Barotrauma.PropertyConditional.FromXElement ( ContentXElement element,
Predicate< XAttribute >? predicate = null )
static

◆ GetComparisonOperatorType()

static ComparisonOperatorType Barotrauma.PropertyConditional.GetComparisonOperatorType ( string op)
static

◆ Matches()

bool Barotrauma.PropertyConditional.Matches ( ISerializableEntity? target)

◆ TargetTagMatchesTagCondition()

bool Barotrauma.PropertyConditional.TargetTagMatchesTagCondition ( Identifier targetTag)

Member Data Documentation

◆ AttributeName

readonly Identifier Barotrauma.PropertyConditional.AttributeName

◆ AttributeValue

readonly string Barotrauma.PropertyConditional.AttributeValue

◆ AttributeValueAsTags

readonly ImmutableArray<Identifier> Barotrauma.PropertyConditional.AttributeValueAsTags

◆ ComparisonOperator [1/2]

readonly ComparisonOperatorType Barotrauma.PropertyConditional.ComparisonOperator

◆ ComparisonOperator [2/2]

ComparisonOperatorType Barotrauma.PropertyConditional.ComparisonOperator
static

◆ FloatValue

readonly? float Barotrauma.PropertyConditional.FloatValue

◆ TargetContainedItem

readonly bool Barotrauma.PropertyConditional.TargetContainedItem

If set to true, the conditionals defined by this element check against the items contained by the target. Only works with items.

◆ TargetContainer

readonly bool Barotrauma.PropertyConditional.TargetContainer

If set to true, the conditionals defined by this element check against the entity containing the target.

◆ TargetGrandParent

readonly bool Barotrauma.PropertyConditional.TargetGrandParent

If this and TargetContainer are set to true, the conditionals defined by this element check against the entity containing the target's container. For example, diving suits have a status effect that targets contained oxygen tanks, with a conditional that only passes if the locker containing the suit is powered.

◆ TargetItemComponent

readonly string Barotrauma.PropertyConditional.TargetItemComponent

If set to the name of one of the target's ItemComponents, the conditionals defined by this element check against the properties of that component. Only works on items.

◆ TargetSelf

readonly bool Barotrauma.PropertyConditional.TargetSelf

If set to true, the conditionals defined by this element check against the attacking character instead of the attacked character. Only applies to a character's attacks and targeting parameters.

◆ Type

readonly ConditionType Barotrauma.PropertyConditional.Type

The documentation for this class was generated from the following file: