Barotrauma Server
Loading...
Searching...
No Matches
Barotrauma.RelatedItem Class Reference

Used by various features to define different kinds of relations between items: for example, which item a character must have equipped to interact with some item in some way, which items can go inside a container, or which kind of item the target of a status effect must have for the effect to execute. More...

Public Types

enum  RelationType {
  None , Contained , Equipped , Picked ,
  Container , Invalid
}
 

Public Member Functions

bool MatchesItem (Item item)
 
bool MatchesItem (ItemPrefab itemPrefab)
 
 RelatedItem (Identifier[] identifiers, Identifier[] excludedIdentifiers)
 
 RelatedItem (ContentXElement element, string parentDebugName)
 
bool CheckRequirements (Character character, Item parentItem)
 
void Save (XElement element)
 

Static Public Member Functions

static RelatedItem Load (ContentXElement element, bool returnEmpty, string parentDebugName)
 

Public Attributes

List< StatusEffectStatusEffects = new List<StatusEffect>()
 
LocalizedString Msg
 Only valid for the RequiredItems of an ItemComponent. A message displayed if the required item isn't found (e.g. a notification about lack of ammo or fuel).
 
Identifier MsgTag
 Only valid for the RequiredItems of an ItemComponent. The localization tag of a message displayed if the required item isn't found (e.g. a notification about lack of ammo or fuel).
 
int TargetSlot = -1
 Index of the slot the target must be in when targeting a Contained item.
 
InvSlotType CharacterInventorySlotType
 The slot type the target must be in when targeting an item contained inside a character's inventory.
 
Vector2ItemPos
 Overrides the position defined in ItemContainer. Only valid when used in the Containable definitions of an ItemContainer.
 
bool Hide
 Only valid when used in the Containable definitions of an ItemContainer. Only affects when ItemContainer.hideItems is false. Doesn't override the value.
 
float Rotation
 Only valid when used in the Containable definitions of an ItemContainer. Can be used to override the rotation of specific items in the container.
 
bool SetActive
 Only valid when used in the Containable definitions of an ItemContainer. Can be used to force specific items to stay active inside the container (such as flashlights attached to a gun).
 
bool BlameEquipperForDeath
 Only valid when used in the Containable definitions of an ItemContainer. Should the character who equipped the item be blamed if the wearer / character who's inventory the item is in dies?
 

Properties

bool MatchOnEmpty [get, set]
 Should an empty inventory (or an empty inventory slot if TargetSlot is set) be considered valid? Can be used to, for example, make an item do something if there's a specific item, or nothing, inside it.
 
bool RequireEmpty [get, set]
 Should only an empty inventory (or an empty inventory slot if TargetSlot is set) be considered valid? Can be used to, for example, make an item do something when there's nothing inside it.
 
bool IgnoreInEditor [get, set]
 Only valid for the RequiredItems of an ItemComponent. Can be used to ignore the requirement in the submarine editor, making it easier to for example make rewire things that require some special tool to rewire.
 
ImmutableHashSet< Identifier > ExcludedIdentifiers [get]
 Identifier(s) or tag(s) of the items that are NOT considered valid. Can be used to, for example, exclude some specific items when using tags that apply to multiple items.
 
bool ExcludeBroken [get]
 Should broken (0 condition) items be excluded?
 
bool ExcludeFullCondition [get]
 Should full condition (100%) items be excluded?
 
bool AllowVariants = true [get]
 Are item variants considered valid?
 
RelationType Type [get]
 
bool IsOptional [get, set]
 Only valid for the RequiredItems of an ItemComponent. Can be used to make the requirement optional, meaning that you don't need to have the item to interact with something, but having it may still affect what the interaction does (such as using a crowbar on a door).
 
string JoinedIdentifiers [get, set]
 
ImmutableHashSet< Identifier > Identifiers [get]
 Identifier(s) or tag(s) of the items that are considered valid.
 
string JoinedExcludedIdentifiers [get, set]
 

Detailed Description

Used by various features to define different kinds of relations between items: for example, which item a character must have equipped to interact with some item in some way, which items can go inside a container, or which kind of item the target of a status effect must have for the effect to execute.

Member Enumeration Documentation

◆ RelationType

Enumerator
None 
Contained 

The item must be contained inside the item this relation is defined in. Can for example by used to make an item usable only when there's a specific kind of item inside it.

Equipped 

The user must have equipped the item (i.e. held or worn).

Picked 

The user must have picked up the item (i.e. the item needs to be in the user's inventory).

Container 

The item this relation is defined in must be inside a specific kind of container. Can for example by used to make an item do something when it's inside some other type of item.

Invalid 

Signifies an error (type could not be parsed)

Constructor & Destructor Documentation

◆ RelatedItem() [1/2]

Barotrauma.RelatedItem.RelatedItem ( Identifier[] identifiers,
Identifier[] excludedIdentifiers )

◆ RelatedItem() [2/2]

Barotrauma.RelatedItem.RelatedItem ( ContentXElement element,
string parentDebugName )

Member Function Documentation

◆ CheckRequirements()

bool Barotrauma.RelatedItem.CheckRequirements ( Character character,
Item parentItem )

◆ Load()

static RelatedItem Barotrauma.RelatedItem.Load ( ContentXElement element,
bool returnEmpty,
string parentDebugName )
static

◆ MatchesItem() [1/2]

bool Barotrauma.RelatedItem.MatchesItem ( Item item)

◆ MatchesItem() [2/2]

bool Barotrauma.RelatedItem.MatchesItem ( ItemPrefab itemPrefab)

◆ Save()

void Barotrauma.RelatedItem.Save ( XElement element)

Member Data Documentation

◆ BlameEquipperForDeath

bool Barotrauma.RelatedItem.BlameEquipperForDeath

Only valid when used in the Containable definitions of an ItemContainer. Should the character who equipped the item be blamed if the wearer / character who's inventory the item is in dies?

◆ CharacterInventorySlotType

InvSlotType Barotrauma.RelatedItem.CharacterInventorySlotType

The slot type the target must be in when targeting an item contained inside a character's inventory.

◆ Hide

bool Barotrauma.RelatedItem.Hide

Only valid when used in the Containable definitions of an ItemContainer. Only affects when ItemContainer.hideItems is false. Doesn't override the value.

◆ ItemPos

Vector2? Barotrauma.RelatedItem.ItemPos

Overrides the position defined in ItemContainer. Only valid when used in the Containable definitions of an ItemContainer.

◆ Msg

LocalizedString Barotrauma.RelatedItem.Msg

Only valid for the RequiredItems of an ItemComponent. A message displayed if the required item isn't found (e.g. a notification about lack of ammo or fuel).

◆ MsgTag

Identifier Barotrauma.RelatedItem.MsgTag

Only valid for the RequiredItems of an ItemComponent. The localization tag of a message displayed if the required item isn't found (e.g. a notification about lack of ammo or fuel).

◆ Rotation

float Barotrauma.RelatedItem.Rotation

Only valid when used in the Containable definitions of an ItemContainer. Can be used to override the rotation of specific items in the container.

◆ SetActive

bool Barotrauma.RelatedItem.SetActive

Only valid when used in the Containable definitions of an ItemContainer. Can be used to force specific items to stay active inside the container (such as flashlights attached to a gun).

◆ StatusEffects

List<StatusEffect> Barotrauma.RelatedItem.StatusEffects = new List<StatusEffect>()

◆ TargetSlot

int Barotrauma.RelatedItem.TargetSlot = -1

Index of the slot the target must be in when targeting a Contained item.

Property Documentation

◆ AllowVariants

bool Barotrauma.RelatedItem.AllowVariants = true
get

Are item variants considered valid?

◆ ExcludeBroken

bool Barotrauma.RelatedItem.ExcludeBroken
get

Should broken (0 condition) items be excluded?

◆ ExcludedIdentifiers

ImmutableHashSet<Identifier> Barotrauma.RelatedItem.ExcludedIdentifiers
get

Identifier(s) or tag(s) of the items that are NOT considered valid. Can be used to, for example, exclude some specific items when using tags that apply to multiple items.

◆ ExcludeFullCondition

bool Barotrauma.RelatedItem.ExcludeFullCondition
get

Should full condition (100%) items be excluded?

◆ Identifiers

ImmutableHashSet<Identifier> Barotrauma.RelatedItem.Identifiers
get

Identifier(s) or tag(s) of the items that are considered valid.

◆ IgnoreInEditor

bool Barotrauma.RelatedItem.IgnoreInEditor
getset

Only valid for the RequiredItems of an ItemComponent. Can be used to ignore the requirement in the submarine editor, making it easier to for example make rewire things that require some special tool to rewire.

◆ IsOptional

bool Barotrauma.RelatedItem.IsOptional
getset

Only valid for the RequiredItems of an ItemComponent. Can be used to make the requirement optional, meaning that you don't need to have the item to interact with something, but having it may still affect what the interaction does (such as using a crowbar on a door).

◆ JoinedExcludedIdentifiers

string Barotrauma.RelatedItem.JoinedExcludedIdentifiers
getset

◆ JoinedIdentifiers

string Barotrauma.RelatedItem.JoinedIdentifiers
getset

◆ MatchOnEmpty

bool Barotrauma.RelatedItem.MatchOnEmpty
getset

Should an empty inventory (or an empty inventory slot if TargetSlot is set) be considered valid? Can be used to, for example, make an item do something if there's a specific item, or nothing, inside it.

◆ RequireEmpty

bool Barotrauma.RelatedItem.RequireEmpty
getset

Should only an empty inventory (or an empty inventory slot if TargetSlot is set) be considered valid? Can be used to, for example, make an item do something when there's nothing inside it.

◆ Type

RelationType Barotrauma.RelatedItem.Type
get

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