Barotrauma Client
Loading...
Searching...
No Matches
Barotrauma.AIObjectiveCombat Class Reference
Inheritance diagram for Barotrauma.AIObjectiveCombat:
Barotrauma.AIObjective

Public Types

enum  CombatMode {
  Defensive , Offensive , Arrest , Retreat ,
  None
}
 

Public Member Functions

 AIObjectiveCombat (Character character, Character enemy, CombatMode mode, AIObjectiveManager objectiveManager, float priorityModifier=1, float coolDown=DefaultCoolDown)
 
override void Update (float deltaTime)
 
override void OnDeselected ()
 
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.
 
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.
 
float CalculatePriority ()
 Call this only when the priority needs to be recalculated. Use the cached Priority property when you don't need to recalculate.
 
virtual bool IsDuplicate< T > (T otherObjective)
 
virtual void OnSelected ()
 
virtual void SpeakAfterOrderReceived ()
 

Static Public Member Functions

static float GetLethalDamage (ItemComponent weapon)
 
- Static Public Member Functions inherited from Barotrauma.AIObjective
static float GetDistanceFactor (Vector2 selfPos, Vector2 targetWorldPos, float factorAtMaxDistance, float verticalDistanceMultiplier=3, float maxDistance=10000.0f, float factorAtMinDistance=1.0f)
 Get a normalized value representing how close the target position is. The value is a rough estimation, where vertical movement is assumed to be more costly than horizontal.
 

Public Attributes

bool AllowHoldFire
 
bool SpeakWarnings
 
Func< bool > holdFireCondition
 Don't start using a weapon if this condition is true.
 
- Public Attributes inherited from Barotrauma.AIObjective
EventAction SourceEventAction
 Which event action (if any) created this objective.
 
AIObjective SourceObjective
 Which objective (if any) created this objective. When this is a subobjective, the parent objective is used by default.
 
readonly Character character
 
readonly AIObjectiveManager objectiveManager
 
readonly Identifier Option
 
Func< AIObjective, bool > AbortCondition
 Aborts the objective when this condition is true.
 

Protected Member Functions

override float GetPriority ()
 
override bool CheckObjectiveSpecific ()
 
override void Act (float deltaTime)
 
override void OnCompleted ()
 
override void OnAbandon ()
 
- Protected Member Functions inherited from Barotrauma.AIObjective
void HandleDisallowed ()
 
float GetDistanceFactor (Vector2 targetWorldPos, float factorAtMaxDistance, float verticalDistanceMultiplier=3, float maxDistance=10000.0f, float factorAtMinDistance=1.0f)
 Get a normalized value representing how close the target position is. The value is a rough estimation, where vertical movement is assumed to be more costly than horizontal.
 
virtual 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.
 
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.
 
void Act (float deltaTime)
 
bool CheckObjectiveSpecific ()
 Should return whether the objective is completed or not.
 
bool CanEquip (Item item, bool allowWearing)
 

Properties

override Identifier Identifier = "combat".ToIdentifier() [get, set]
 
override bool KeepDivingGearOn [get]
 
override bool IgnoreUnsafeHulls [get]
 
override bool AllowOutsideSubmarine [get]
 
override bool AllowInAnySub [get]
 
Character Enemy [get]
 
bool HoldPosition [get, set]
 
override bool ConcurrentObjectives [get]
 
override bool AbandonWhenCannotCompleteSubObjectives [get]
 
float ArrestHoldFireTime = 10 [get]
 
CombatMode Mode [get]
 
- Properties inherited from Barotrauma.AIObjective
virtual float Devotion [get]
 
Identifier Identifier [get, set]
 
virtual string DebugTag [get]
 
virtual bool ForceRun [get]
 
virtual bool IgnoreUnsafeHulls [get]
 
virtual bool AbandonWhenCannotCompleteSubObjectives [get]
 
virtual bool AllowSubObjectiveSorting [get]
 Should subobjectives be sorted according to their priority?
 
virtual bool PrioritizeIfSubObjectivesActive [get]
 
virtual bool AllowMultipleInstances [get]
 Can there be multiple objective instaces of the same type?
 
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).
 
virtual bool KeepDivingGearOn [get]
 
virtual bool KeepDivingGearOnAlsoWhenInactive [get]
 
virtual bool AllowAutomaticItemUnequipping [get]
 There's a separate property for diving suit and mask: KeepDivingGearOn.
 
virtual bool AllowOutsideSubmarine [get]
 
virtual bool AllowInFriendlySubs [get]
 When true, the objective is allowed in the player subs (when in the same team) and on friendly outposts (regardless of the alignment). Note: ignored when AllowInAnySub is true.
 
virtual bool AllowInAnySub [get]
 
virtual bool AllowWhileHandcuffed [get]
 
virtual bool AbandonIfDisallowed [get]
 Should the objective abandon when it's not allowed in the current context or should it just stay inactive with 0 priority? Abandoned automatic objectives are removed and recreated automatically (when new orders are assigned or after a cooldown period). Abandoned orders are removed, but the most recent order can be reissued by clicking the small order icon with the arrow in the crew manager panel.
 
virtual bool CanBeCompleted [get]
 
virtual float MaxDevotion [get]
 
float CumulatedDevotion [get, set]
 
float Priority [get, set]
 Final priority value after all calculations.
 
float BasePriority [get, set]
 
float PriorityModifier = 1 [get]
 
bool ForceHighestPriority [get, set]
 
bool ForceWalk [get, set]
 
bool IgnoreAtOutpost [get, set]
 
bool Abandon [get, set]
 
IEnumerable< AIObjectiveSubObjectives [get]
 
AIObjective CurrentSubObjective [get]
 
HumanAIController HumanAIController [get]
 
IndoorsSteeringManager PathSteering [get]
 
SteeringManager SteeringManager [get]
 
bool IsAllowed [get]
 
bool IsCompleted [get, protected set]
 

Additional Inherited Members

- Static Protected Member Functions inherited from Barotrauma.AIObjective
static bool CanPutInInventory (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.
 
Action Abandoned
 A single shot event. Automatically cleared after launching. Use OnAbandoned method for implementing (internal) persistent behavior.
 
Action Selected
 A single shot event. Automatically cleared after launching. Use OnSelected method for implementing (internal) persistent behavior.
 
Action Deselected
 A single shot event. Automatically cleared after launching. Use OnDeselected method for implementing (internal) persistent behavior.
 

Member Enumeration Documentation

◆ CombatMode

Enumerator
Defensive 

Use weapons against the enemy, but try to retreat to a safe place.

Offensive 

Engage the enemy and keep attacking it.

Arrest 

Try to arrest the enemy without using lethal weapons (stunning + handcuffs).

Retreat 

Attempt to retreat to a safe place. Unlike in the Defensive mode, the character won't try to attack the enemy.

None 

Does nothing.

Constructor & Destructor Documentation

◆ AIObjectiveCombat()

Barotrauma.AIObjectiveCombat.AIObjectiveCombat ( Character character,
Character enemy,
CombatMode mode,
AIObjectiveManager objectiveManager,
float priorityModifier = 1,
float coolDown = DefaultCoolDown )

Member Function Documentation

◆ Act()

override void Barotrauma.AIObjectiveCombat.Act ( float deltaTime)
protected

◆ CheckObjectiveSpecific()

override bool Barotrauma.AIObjectiveCombat.CheckObjectiveSpecific ( )
protected

◆ GetLethalDamage()

static float Barotrauma.AIObjectiveCombat.GetLethalDamage ( ItemComponent weapon)
static

◆ GetPriority()

override float Barotrauma.AIObjectiveCombat.GetPriority ( )
protectedvirtual

Reimplemented from Barotrauma.AIObjective.

◆ OnAbandon()

override void Barotrauma.AIObjectiveCombat.OnAbandon ( )
protectedvirtual

Reimplemented from Barotrauma.AIObjective.

◆ OnCompleted()

override void Barotrauma.AIObjectiveCombat.OnCompleted ( )
protectedvirtual

Reimplemented from Barotrauma.AIObjective.

◆ OnDeselected()

override void Barotrauma.AIObjectiveCombat.OnDeselected ( )
virtual

Reimplemented from Barotrauma.AIObjective.

◆ Reset()

override void Barotrauma.AIObjectiveCombat.Reset ( )
virtual

Reimplemented from Barotrauma.AIObjective.

◆ Update()

override void Barotrauma.AIObjectiveCombat.Update ( float deltaTime)
virtual

Reimplemented from Barotrauma.AIObjective.

Member Data Documentation

◆ AllowHoldFire

bool Barotrauma.AIObjectiveCombat.AllowHoldFire

◆ holdFireCondition

Func<bool> Barotrauma.AIObjectiveCombat.holdFireCondition

Don't start using a weapon if this condition is true.

◆ SpeakWarnings

bool Barotrauma.AIObjectiveCombat.SpeakWarnings

Property Documentation

◆ AbandonWhenCannotCompleteSubObjectives

override bool Barotrauma.AIObjectiveCombat.AbandonWhenCannotCompleteSubObjectives
get

◆ AllowInAnySub

override bool Barotrauma.AIObjectiveCombat.AllowInAnySub
getprotected

◆ AllowOutsideSubmarine

override bool Barotrauma.AIObjectiveCombat.AllowOutsideSubmarine
getprotected

◆ ArrestHoldFireTime

float Barotrauma.AIObjectiveCombat.ArrestHoldFireTime = 10
get

◆ ConcurrentObjectives

override bool Barotrauma.AIObjectiveCombat.ConcurrentObjectives
getprotected

◆ Enemy

Character Barotrauma.AIObjectiveCombat.Enemy
get

◆ HoldPosition

bool Barotrauma.AIObjectiveCombat.HoldPosition
getset

◆ Identifier

override Identifier Barotrauma.AIObjectiveCombat.Identifier = "combat".ToIdentifier()
getset

◆ IgnoreUnsafeHulls

override bool Barotrauma.AIObjectiveCombat.IgnoreUnsafeHulls
get

◆ KeepDivingGearOn

override bool Barotrauma.AIObjectiveCombat.KeepDivingGearOn
get

◆ Mode

CombatMode Barotrauma.AIObjectiveCombat.Mode
get

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