Barotrauma Client Doc
Barotrauma.AIObjectiveGetItem Class Reference
Inheritance diagram for Barotrauma.AIObjectiveGetItem:
Barotrauma.AIObjective

Public Member Functions

 AIObjectiveGetItem (Character character, Item targetItem, AIObjectiveManager objectiveManager, bool equip=true, float priorityModifier=1)
 
 AIObjectiveGetItem (Character character, Identifier identifierOrTag, AIObjectiveManager objectiveManager, bool equip=true, bool checkInventory=true, float priorityModifier=1, bool spawnItemIfNotFound=false)
 
 AIObjectiveGetItem (Character character, IEnumerable< Identifier > identifiersOrTags, AIObjectiveManager objectiveManager, bool equip=true, bool checkInventory=true, float priorityModifier=1, bool spawnItemIfNotFound=false)
 
override void Reset ()
 
- Public Member Functions inherited from Barotrauma.AIObjective
IEnumerable< AIObjectiveGetSubObjectivesRecursive (bool includingSelf=false)
 
AIObjective GetActiveObjective ()
 
 AIObjective (Character character, AIObjectiveManager objectiveManager, float priorityModifier, Identifier option=default)
 
void TryComplete (float deltaTime)
 Makes the character act according to the objective, or according to any subobjectives that need to be completed before this one More...
 
void AddSubObjective (AIObjective objective, bool addFirst=false)
 
void RemoveSubObjective< T > (ref T objective)
 
void SortSubObjectives ()
 
bool IsIgnoredAtOutpost ()
 Returns true only when at a friendly outpost and when the order is set to be ignored there. Note that even if this returns false, the objective can be disallowed, because AllowInFriendlySubs is false. More...
 
float CalculatePriority ()
 Call this only when the priority needs to be recalculated. Use the cached Priority property when you don't need to recalculate. More...
 
virtual bool IsDuplicate< T > (T otherObjective)
 
virtual void Update (float deltaTime)
 
virtual void OnSelected ()
 
virtual void OnDeselected ()
 
virtual void SpeakAfterOrderReceived ()
 
Sprite GetSprite ()
 

Static Public Member Functions

static IEnumerable< IdentifierParseGearTags (IEnumerable< Identifier > identifiersOrTags)
 
static IEnumerable< IdentifierParseIgnoredTags (IEnumerable< Identifier > identifiersOrTags)
 
static Func< PathNode, bool > CreateEndNodeFilter (ISpatialEntity targetEntity)
 
- Static Public Member Functions inherited from Barotrauma.AIObjective
static Sprite GetSprite (Identifier identifier, Identifier option, Entity targetEntity)
 

Public Attributes

HashSet< ItemignoredItems = new HashSet<Item>()
 
Func< Item, float > GetItemPriority
 
Func< Item, bool > ItemFilter
 
readonly ImmutableHashSet< IdentifierIdentifiersOrTags
 
ImmutableHashSet< IdentifierignoredContainerIdentifiers
 
ImmutableHashSet< IdentifierignoredIdentifiersOrTags
 
- Public Attributes inherited from Barotrauma.AIObjective
readonly Character character
 
readonly AIObjectiveManager objectiveManager
 
readonly Identifier Option
 
Func< AIObjective, bool > AbortCondition
 Aborts the objective when this condition is true. More...
 

Static Public Attributes

const float DefaultReach = 100
 
const float MaxReach = 150
 

Protected Member Functions

override void Act (float deltaTime)
 
override bool CheckObjectiveSpecific ()
 
override void OnAbandon ()
 
- Protected Member Functions inherited from Barotrauma.AIObjective
void HandleNonAllowed ()
 
virtual float GetPriority ()
 
void SyncRemovedObjectives< T1, T2 > (Dictionary< T1, T2 > dictionary, IEnumerable< T1 > collection)
 Checks if the subobjectives in the given collection are removed from the subobjectives. And if so, removes it also from the dictionary. More...
 
bool TryAddSubObjective< T > (ref T objective, Func< T > constructor, Action onCompleted=null, Action onAbandon=null)
 Checks if the objective already is created and added in subobjectives. If not, creates it. Handles objectives that cannot be completed. If the objective has been removed form the subobjectives, a null value is assigned to the reference. Returns true if the objective was created and successfully added. More...
 
virtual void OnCompleted ()
 
bool CanEquip (Item item, bool allowWearing)
 

Properties

override Identifier Identifier = "get item".ToIdentifier() [get, set]
 
override bool AbandonWhenCannotCompleteSubjectives [get]
 
override bool AllowMultipleInstances [get]
 
override bool AllowWhileHandcuffed [get]
 
float TargetCondition = 1 [get, set]
 
bool AllowDangerousPressure [get, set]
 
Item TargetItem [get]
 
bool AllowToFindDivingGear = true [get, set]
 
bool MustBeSpecificItem [get, set]
 
bool AllowStealing [get, set]
 Is the character allowed to take the item from somewhere else than their own sub (e.g. an outpost) More...
 
bool TakeWholeStack [get, set]
 
bool AllowVariants [get, set]
 Are variants of the specified item allowed More...
 
bool Equip [get, set]
 
bool Wear [get, set]
 
bool RequireNonEmpty [get, set]
 
bool EvaluateCombatPriority [get, set]
 
bool CheckPathForEachItem [get, set]
 
bool SpeakIfFails [get, set]
 
string CannotFindDialogueIdentifierOverride [get, set]
 
Func< bool > CannotFindDialogueCondition [get, set]
 
int ItemCount [get, set]
 
InvSlotTypeEquipSlotType [get, set]
 
- Properties inherited from Barotrauma.AIObjective
virtual float Devotion [get]
 
abstract Identifier Identifier [get, set]
 
virtual string DebugTag [get]
 
virtual bool ForceRun [get]
 
virtual bool IgnoreUnsafeHulls [get]
 
virtual bool AbandonWhenCannotCompleteSubjectives [get]
 
virtual bool AllowSubObjectiveSorting [get]
 
virtual bool PrioritizeIfSubObjectivesActive [get]
 
virtual bool AllowMultipleInstances [get]
 Can there be multiple objective instaces of the same type? More...
 
virtual bool ConcurrentObjectives [get]
 Run the main objective with all subobjectives concurrently? If false, the main objective will continue only when all the subobjectives have been removed (done). More...
 
virtual bool KeepDivingGearOn [get]
 
virtual bool KeepDivingGearOnAlsoWhenInactive [get]
 
virtual bool AllowAutomaticItemUnequipping [get]
 There's a separate property for diving suit and mask: KeepDivingGearOn. More...
 
virtual bool AllowOutsideSubmarine [get]
 
virtual bool AllowInFriendlySubs [get]
 
virtual bool AllowInAnySub [get]
 
virtual bool AllowWhileHandcuffed [get]
 
float CumulatedDevotion [get, set]
 
virtual float MaxDevotion [get]
 
float Priority [get, set]
 Final priority value after all calculations. More...
 
float BasePriority [get, set]
 
float PriorityModifier = 1 [get]
 
bool ForceHighestPriority [get, set]
 
bool ForceWalk [get, set]
 
bool IgnoreAtOutpost [get, set]
 
bool Abandon [get, set]
 
virtual bool CanBeCompleted [get]
 
virtual bool IsLoop [get, set]
 When true, the objective is never completed, unless CanBeCompleted returns false. More...
 
IEnumerable< AIObjectiveSubObjectives [get]
 
AIObjective CurrentSubObjective [get]
 
HumanAIController HumanAIController [get]
 
IndoorsSteeringManager PathSteering [get]
 
SteeringManager SteeringManager [get]
 
bool IsAllowed [get]
 
bool IsCompleted [get, protected set]
 
static Color ObjectiveIconColor [get]
 

Additional Inherited Members

- Static Protected Member Functions inherited from Barotrauma.AIObjective
static bool CanEquip (Character character, Item item, bool allowWearing)
 
- Protected Attributes inherited from Barotrauma.AIObjective
readonly List< AIObjectivesubObjectives = new List<AIObjective>()
 
- Events inherited from Barotrauma.AIObjective
Action Completed
 A single shot event. Automatically cleared after launching. Use OnCompleted method for implementing (internal) persistent behavior. More...
 
Action Abandoned
 A single shot event. Automatically cleared after launching. Use OnAbandoned method for implementing (internal) persistent behavior. More...
 
Action Selected
 A single shot event. Automatically cleared after launching. Use OnSelected method for implementing (internal) persistent behavior. More...
 
Action Deselected
 A single shot event. Automatically cleared after launching. Use OnDeselected method for implementing (internal) persistent behavior. More...
 

Detailed Description

Definition at line 12 of file AIObjectiveGetItem.cs.

Constructor & Destructor Documentation

◆ AIObjectiveGetItem() [1/3]

Barotrauma.AIObjectiveGetItem.AIObjectiveGetItem ( Character  character,
Item  targetItem,
AIObjectiveManager  objectiveManager,
bool  equip = true,
float  priorityModifier = 1 
)

Definition at line 80 of file AIObjectiveGetItem.cs.

◆ AIObjectiveGetItem() [2/3]

Barotrauma.AIObjectiveGetItem.AIObjectiveGetItem ( Character  character,
Identifier  identifierOrTag,
AIObjectiveManager  objectiveManager,
bool  equip = true,
bool  checkInventory = true,
float  priorityModifier = 1,
bool  spawnItemIfNotFound = false 
)

Definition at line 90 of file AIObjectiveGetItem.cs.

◆ AIObjectiveGetItem() [3/3]

Barotrauma.AIObjectiveGetItem.AIObjectiveGetItem ( Character  character,
IEnumerable< Identifier identifiersOrTags,
AIObjectiveManager  objectiveManager,
bool  equip = true,
bool  checkInventory = true,
float  priorityModifier = 1,
bool  spawnItemIfNotFound = false 
)

Definition at line 93 of file AIObjectiveGetItem.cs.

Member Function Documentation

◆ Act()

override void Barotrauma.AIObjectiveGetItem.Act ( float  deltaTime)
protectedvirtual

Implements Barotrauma.AIObjective.

Definition at line 160 of file AIObjectiveGetItem.cs.

◆ CheckObjectiveSpecific()

override bool Barotrauma.AIObjectiveGetItem.CheckObjectiveSpecific ( )
protectedvirtual

Implements Barotrauma.AIObjective.

Definition at line 645 of file AIObjectiveGetItem.cs.

◆ CreateEndNodeFilter()

static Func<PathNode, bool> Barotrauma.AIObjectiveGetItem.CreateEndNodeFilter ( ISpatialEntity  targetEntity)
static

Definition at line 130 of file AIObjectiveGetItem.cs.

◆ OnAbandon()

override void Barotrauma.AIObjectiveGetItem.OnAbandon ( )
protectedvirtual

Reimplemented from Barotrauma.AIObjective.

Definition at line 700 of file AIObjectiveGetItem.cs.

◆ ParseGearTags()

static IEnumerable<Identifier> Barotrauma.AIObjectiveGetItem.ParseGearTags ( IEnumerable< Identifier identifiersOrTags)
static

Definition at line 104 of file AIObjectiveGetItem.cs.

◆ ParseIgnoredTags()

static IEnumerable<Identifier> Barotrauma.AIObjectiveGetItem.ParseIgnoredTags ( IEnumerable< Identifier identifiersOrTags)
static

Definition at line 117 of file AIObjectiveGetItem.cs.

◆ Reset()

override void Barotrauma.AIObjectiveGetItem.Reset ( )
virtual

Reimplemented from Barotrauma.AIObjective.

Definition at line 681 of file AIObjectiveGetItem.cs.

Member Data Documentation

◆ DefaultReach

const float Barotrauma.AIObjectiveGetItem.DefaultReach = 100
static

Definition at line 44 of file AIObjectiveGetItem.cs.

◆ GetItemPriority

Func<Item, float> Barotrauma.AIObjectiveGetItem.GetItemPriority

Definition at line 22 of file AIObjectiveGetItem.cs.

◆ IdentifiersOrTags

readonly ImmutableHashSet<Identifier> Barotrauma.AIObjectiveGetItem.IdentifiersOrTags

Definition at line 27 of file AIObjectiveGetItem.cs.

◆ ignoredContainerIdentifiers

ImmutableHashSet<Identifier> Barotrauma.AIObjectiveGetItem.ignoredContainerIdentifiers

Definition at line 38 of file AIObjectiveGetItem.cs.

◆ ignoredIdentifiersOrTags

ImmutableHashSet<Identifier> Barotrauma.AIObjectiveGetItem.ignoredIdentifiersOrTags

Definition at line 39 of file AIObjectiveGetItem.cs.

◆ ignoredItems

HashSet<Item> Barotrauma.AIObjectiveGetItem.ignoredItems = new HashSet<Item>()

Definition at line 20 of file AIObjectiveGetItem.cs.

◆ ItemFilter

Func<Item, bool> Barotrauma.AIObjectiveGetItem.ItemFilter

Definition at line 23 of file AIObjectiveGetItem.cs.

◆ MaxReach

const float Barotrauma.AIObjectiveGetItem.MaxReach = 150
static

Definition at line 45 of file AIObjectiveGetItem.cs.

Property Documentation

◆ AbandonWhenCannotCompleteSubjectives

override bool Barotrauma.AIObjectiveGetItem.AbandonWhenCannotCompleteSubjectives
get

Definition at line 16 of file AIObjectiveGetItem.cs.

◆ AllowDangerousPressure

bool Barotrauma.AIObjectiveGetItem.AllowDangerousPressure
getset

Definition at line 25 of file AIObjectiveGetItem.cs.

◆ AllowMultipleInstances

override bool Barotrauma.AIObjectiveGetItem.AllowMultipleInstances
get

Definition at line 17 of file AIObjectiveGetItem.cs.

◆ AllowStealing

bool Barotrauma.AIObjectiveGetItem.AllowStealing
getset

Is the character allowed to take the item from somewhere else than their own sub (e.g. an outpost)

Definition at line 53 of file AIObjectiveGetItem.cs.

◆ AllowToFindDivingGear

bool Barotrauma.AIObjectiveGetItem.AllowToFindDivingGear = true
getset

Definition at line 47 of file AIObjectiveGetItem.cs.

◆ AllowVariants

bool Barotrauma.AIObjectiveGetItem.AllowVariants
getset

Are variants of the specified item allowed

Definition at line 58 of file AIObjectiveGetItem.cs.

◆ AllowWhileHandcuffed

override bool Barotrauma.AIObjectiveGetItem.AllowWhileHandcuffed
get

Definition at line 18 of file AIObjectiveGetItem.cs.

◆ CannotFindDialogueCondition

Func<bool> Barotrauma.AIObjectiveGetItem.CannotFindDialogueCondition
getset

Definition at line 66 of file AIObjectiveGetItem.cs.

◆ CannotFindDialogueIdentifierOverride

string Barotrauma.AIObjectiveGetItem.CannotFindDialogueIdentifierOverride
getset

Definition at line 65 of file AIObjectiveGetItem.cs.

◆ CheckPathForEachItem

bool Barotrauma.AIObjectiveGetItem.CheckPathForEachItem
getset

Definition at line 63 of file AIObjectiveGetItem.cs.

◆ Equip

bool Barotrauma.AIObjectiveGetItem.Equip
getset

Definition at line 59 of file AIObjectiveGetItem.cs.

◆ EquipSlotType

InvSlotType? Barotrauma.AIObjectiveGetItem.EquipSlotType
getset

Definition at line 78 of file AIObjectiveGetItem.cs.

◆ EvaluateCombatPriority

bool Barotrauma.AIObjectiveGetItem.EvaluateCombatPriority
getset

Definition at line 62 of file AIObjectiveGetItem.cs.

◆ Identifier

override Identifier Barotrauma.AIObjectiveGetItem.Identifier = "get item".ToIdentifier()
getset

Definition at line 14 of file AIObjectiveGetItem.cs.

◆ ItemCount

int Barotrauma.AIObjectiveGetItem.ItemCount
getset

Definition at line 69 of file AIObjectiveGetItem.cs.

◆ MustBeSpecificItem

bool Barotrauma.AIObjectiveGetItem.MustBeSpecificItem
getset

Definition at line 48 of file AIObjectiveGetItem.cs.

◆ RequireNonEmpty

bool Barotrauma.AIObjectiveGetItem.RequireNonEmpty
getset

Definition at line 61 of file AIObjectiveGetItem.cs.

◆ SpeakIfFails

bool Barotrauma.AIObjectiveGetItem.SpeakIfFails
getset

Definition at line 64 of file AIObjectiveGetItem.cs.

◆ TakeWholeStack

bool Barotrauma.AIObjectiveGetItem.TakeWholeStack
getset

Definition at line 54 of file AIObjectiveGetItem.cs.

◆ TargetCondition

float Barotrauma.AIObjectiveGetItem.TargetCondition = 1
getset

Definition at line 24 of file AIObjectiveGetItem.cs.

◆ TargetItem

Item Barotrauma.AIObjectiveGetItem.TargetItem
get

Definition at line 36 of file AIObjectiveGetItem.cs.

◆ Wear

bool Barotrauma.AIObjectiveGetItem.Wear
getset

Definition at line 60 of file AIObjectiveGetItem.cs.