Barotrauma Server Doc
Barotrauma.AIController Class Referenceabstract
Inheritance diagram for Barotrauma.AIController:
Barotrauma.ISteerable Barotrauma.EnemyAIController Barotrauma.HumanAIController

Public Member Functions

bool HasValidPath (bool requireNonDirty=true, bool requireUnfinished=true, Func< WayPoint, bool > nodePredicate=null)
 Is the current path valid, using the provided parameters. More...
 
 AIController (Character c)
 
virtual void OnHealed (Character healer, float healAmount)
 
virtual void OnAttacked (Character attacker, AttackResult attackResult)
 
virtual void SelectTarget (AITarget target)
 
virtual void Update (float deltaTime)
 
virtual void Reset ()
 
void FaceTarget (ISpatialEntity target)
 
virtual bool SteerThroughGap (Structure wall, WallSection section, Vector2 targetWorldPos, float deltaTime)
 
virtual bool SteerThroughGap (Gap gap, Vector2 targetWorldPos, float deltaTime, float maxDistance=-1)
 
bool CanPassThroughHole (Structure wall, int sectionIndex, int requiredHoleCount)
 
bool TakeItem (Item item, CharacterInventory targetInventory, bool equip, bool wear=false, bool dropOtherIfCannotMove=true, bool allowSwapping=false, bool storeUnequipped=false, IEnumerable< Identifier > targetTags=null)
 
void UnequipEmptyItems (Item parentItem, bool avoidDroppingInSea=true)
 
void UnequipContainedItems (Item parentItem, Func< Item, bool > predicate=null, bool avoidDroppingInSea=true, int? unequipMax=null)
 
void ReequipUnequipped ()
 
abstract bool Escape (float deltaTime)
 
void ResetEscape ()
 

Static Public Member Functions

static void UnequipEmptyItems (Character character, Item parentItem, bool avoidDroppingInSea=true)
 
static void UnequipContainedItems (Character character, Item parentItem, Func< Item, bool > predicate, bool avoidDroppingInSea=true, int? unequipMax=null)
 

Public Attributes

bool Enabled
 
readonly Character Character
 

Protected Member Functions

void ResetAITarget ()
 
bool IsWallDisabled (Structure wall)
 
bool UpdateEscape (float deltaTime, bool canAttackDoors)
 
virtual void OnStateChanged (AIState from, AIState to)
 
virtual void OnTargetChanged (AITarget previousTarget, AITarget newTarget)
 

Protected Attributes

AITarget _lastAiTarget
 
AITarget _previousAiTarget
 
AITarget _selectedAiTarget
 
SteeringManager steeringManager
 
readonly float colliderWidth
 
readonly float minGapSize
 
readonly float colliderLength
 
readonly float avoidLookAheadDistance
 
bool allGapsSearched
 
readonly HashSet< GapunreachableGaps = new HashSet<Gap>()
 

Properties

AITarget SelectedAiTarget [get, protected set]
 
SteeringManager SteeringManager [get]
 
Vector2 Steering [get, set]
 
Vector2 SimPosition [get]
 
Vector2 WorldPosition [get]
 
Vector2 Velocity [get]
 
virtual bool CanEnterSubmarine [get]
 
virtual bool CanFlip [get]
 
virtual bool IsMentallyUnstable [get]
 
IEnumerable< HullVisibleHulls [get]
 Returns hulls that are visible to the character, including the current hull. Note that this is not an accurate visibility check, it only checks for open gaps between the adjacent and linked hulls. More...
 
bool IsCurrentPathNullOrUnreachable [get]
 
bool IsCurrentPathUnreachable [get]
 
bool IsCurrentPathFinished [get]
 
bool IsSteeringThroughGap [get, protected set]
 
bool IsTryingToSteerThroughGap [get, protected set]
 
Gap EscapeTarget [get]
 
- Properties inherited from Barotrauma.ISteerable
Vector2 Steering [get, set]
 
Vector2 Velocity [get]
 
Vector2 SimPosition [get]
 
Vector2 WorldPosition [get]
 

Detailed Description

Definition at line 11 of file AIController.cs.

Constructor & Destructor Documentation

◆ AIController()

Barotrauma.AIController.AIController ( Character  c)

Definition at line 142 of file AIController.cs.

Member Function Documentation

◆ CanPassThroughHole()

bool Barotrauma.AIController.CanPassThroughHole ( Structure  wall,
int  sectionIndex,
int  requiredHoleCount 
)

Definition at line 226 of file AIController.cs.

◆ Escape()

abstract bool Barotrauma.AIController.Escape ( float  deltaTime)
pure virtual

◆ FaceTarget()

void Barotrauma.AIController.FaceTarget ( ISpatialEntity  target)

◆ HasValidPath()

bool Barotrauma.AIController.HasValidPath ( bool  requireNonDirty = true,
bool  requireUnfinished = true,
Func< WayPoint, bool >  nodePredicate = null 
)

Is the current path valid, using the provided parameters.

Parameters
requireNonDirty
requireUnfinished
nodePredicate
Returns
When nodePredicate is defined, returns false if any of the nodes fails to match the predicate.

Definition at line 119 of file AIController.cs.

◆ IsWallDisabled()

bool Barotrauma.AIController.IsWallDisabled ( Structure  wall)
protected

Definition at line 255 of file AIController.cs.

◆ OnAttacked()

virtual void Barotrauma.AIController.OnAttacked ( Character  attacker,
AttackResult  attackResult 
)
virtual

Reimplemented in Barotrauma.HumanAIController, and Barotrauma.EnemyAIController.

Definition at line 156 of file AIController.cs.

◆ OnHealed()

virtual void Barotrauma.AIController.OnHealed ( Character  healer,
float  healAmount 
)
virtual

Reimplemented in Barotrauma.HumanAIController.

Definition at line 154 of file AIController.cs.

◆ OnStateChanged()

virtual void Barotrauma.AIController.OnStateChanged ( AIState  from,
AIState  to 
)
protectedvirtual

Reimplemented in Barotrauma.EnemyAIController.

Definition at line 532 of file AIController.cs.

◆ OnTargetChanged()

virtual void Barotrauma.AIController.OnTargetChanged ( AITarget  previousTarget,
AITarget  newTarget 
)
protectedvirtual

Reimplemented in Barotrauma.EnemyAIController.

Definition at line 533 of file AIController.cs.

◆ ReequipUnequipped()

void Barotrauma.AIController.ReequipUnequipped ( )

Definition at line 386 of file AIController.cs.

◆ Reset()

virtual void Barotrauma.AIController.Reset ( )
virtual

Reimplemented in Barotrauma.HumanAIController.

Definition at line 173 of file AIController.cs.

◆ ResetAITarget()

void Barotrauma.AIController.ResetAITarget ( )
protected

Definition at line 178 of file AIController.cs.

◆ ResetEscape()

void Barotrauma.AIController.ResetEscape ( )

Definition at line 523 of file AIController.cs.

◆ SelectTarget()

virtual void Barotrauma.AIController.SelectTarget ( AITarget  target)
virtual

Reimplemented in Barotrauma.HumanAIController, and Barotrauma.EnemyAIController.

Definition at line 158 of file AIController.cs.

◆ SteerThroughGap() [1/2]

virtual bool Barotrauma.AIController.SteerThroughGap ( Gap  gap,
Vector2  targetWorldPos,
float  deltaTime,
float  maxDistance = -1 
)
virtual

Reimplemented in Barotrauma.EnemyAIController.

Definition at line 210 of file AIController.cs.

◆ SteerThroughGap() [2/2]

virtual bool Barotrauma.AIController.SteerThroughGap ( Structure  wall,
WallSection  section,
Vector2  targetWorldPos,
float  deltaTime 
)
virtual

Reimplemented in Barotrauma.EnemyAIController.

Definition at line 189 of file AIController.cs.

◆ TakeItem()

bool Barotrauma.AIController.TakeItem ( Item  item,
CharacterInventory  targetInventory,
bool  equip,
bool  wear = false,
bool  dropOtherIfCannotMove = true,
bool  allowSwapping = false,
bool  storeUnequipped = false,
IEnumerable< Identifier targetTags = null 
)

Definition at line 270 of file AIController.cs.

◆ UnequipContainedItems() [1/2]

static void Barotrauma.AIController.UnequipContainedItems ( Character  character,
Item  parentItem,
Func< Item, bool >  predicate,
bool  avoidDroppingInSea = true,
int?  unequipMax = null 
)
static

Definition at line 358 of file AIController.cs.

◆ UnequipContainedItems() [2/2]

void Barotrauma.AIController.UnequipContainedItems ( Item  parentItem,
Func< Item, bool >  predicate = null,
bool  avoidDroppingInSea = true,
int?  unequipMax = null 
)

◆ UnequipEmptyItems() [1/2]

static void Barotrauma.AIController.UnequipEmptyItems ( Character  character,
Item  parentItem,
bool  avoidDroppingInSea = true 
)
static

◆ UnequipEmptyItems() [2/2]

void Barotrauma.AIController.UnequipEmptyItems ( Item  parentItem,
bool  avoidDroppingInSea = true 
)

◆ Update()

virtual void Barotrauma.AIController.Update ( float  deltaTime)
virtual

Reimplemented in Barotrauma.HumanAIController, and Barotrauma.EnemyAIController.

Definition at line 160 of file AIController.cs.

◆ UpdateEscape()

bool Barotrauma.AIController.UpdateEscape ( float  deltaTime,
bool  canAttackDoors 
)
protected

Definition at line 407 of file AIController.cs.

Member Data Documentation

◆ _lastAiTarget

AITarget Barotrauma.AIController._lastAiTarget
protected

Definition at line 18 of file AIController.cs.

◆ _previousAiTarget

AITarget Barotrauma.AIController._previousAiTarget
protected

Definition at line 20 of file AIController.cs.

◆ _selectedAiTarget

AITarget Barotrauma.AIController._selectedAiTarget
protected

Definition at line 21 of file AIController.cs.

◆ allGapsSearched

bool Barotrauma.AIController.allGapsSearched
protected

Definition at line 405 of file AIController.cs.

◆ avoidLookAheadDistance

readonly float Barotrauma.AIController.avoidLookAheadDistance
protected

Definition at line 140 of file AIController.cs.

◆ Character

readonly Character Barotrauma.AIController.Character

Definition at line 15 of file AIController.cs.

◆ colliderLength

readonly float Barotrauma.AIController.colliderLength
protected

Definition at line 139 of file AIController.cs.

◆ colliderWidth

readonly float Barotrauma.AIController.colliderWidth
protected

Definition at line 137 of file AIController.cs.

◆ Enabled

bool Barotrauma.AIController.Enabled

Definition at line 13 of file AIController.cs.

◆ minGapSize

readonly float Barotrauma.AIController.minGapSize
protected

Definition at line 138 of file AIController.cs.

◆ steeringManager

SteeringManager Barotrauma.AIController.steeringManager
protected

Definition at line 51 of file AIController.cs.

◆ unreachableGaps

readonly HashSet<Gap> Barotrauma.AIController.unreachableGaps = new HashSet<Gap>()
protected

Definition at line 406 of file AIController.cs.

Property Documentation

◆ CanEnterSubmarine

virtual bool Barotrauma.AIController.CanEnterSubmarine
get

Definition at line 79 of file AIController.cs.

◆ CanFlip

virtual bool Barotrauma.AIController.CanFlip
get

Definition at line 84 of file AIController.cs.

◆ EscapeTarget

Gap Barotrauma.AIController.EscapeTarget
get

Definition at line 401 of file AIController.cs.

◆ IsCurrentPathFinished

bool Barotrauma.AIController.IsCurrentPathFinished
get

Definition at line 135 of file AIController.cs.

◆ IsCurrentPathNullOrUnreachable

bool Barotrauma.AIController.IsCurrentPathNullOrUnreachable
get

Definition at line 133 of file AIController.cs.

◆ IsCurrentPathUnreachable

bool Barotrauma.AIController.IsCurrentPathUnreachable
get

Definition at line 134 of file AIController.cs.

◆ IsMentallyUnstable

virtual bool Barotrauma.AIController.IsMentallyUnstable
get

Definition at line 89 of file AIController.cs.

◆ IsSteeringThroughGap

bool Barotrauma.AIController.IsSteeringThroughGap
getprotected set

Definition at line 186 of file AIController.cs.

◆ IsTryingToSteerThroughGap

bool Barotrauma.AIController.IsTryingToSteerThroughGap
getprotected set

Definition at line 187 of file AIController.cs.

◆ SelectedAiTarget

AITarget Barotrauma.AIController.SelectedAiTarget
getprotected set

Definition at line 22 of file AIController.cs.

◆ SimPosition

Vector2 Barotrauma.AIController.SimPosition
get

Definition at line 64 of file AIController.cs.

◆ Steering

Vector2 Barotrauma.AIController.Steering
getset

Definition at line 58 of file AIController.cs.

◆ SteeringManager

SteeringManager Barotrauma.AIController.SteeringManager
get

Definition at line 53 of file AIController.cs.

◆ Velocity

Vector2 Barotrauma.AIController.Velocity
get

Definition at line 74 of file AIController.cs.

◆ VisibleHulls

IEnumerable<Hull> Barotrauma.AIController.VisibleHulls
get

Returns hulls that are visible to the character, including the current hull. Note that this is not an accurate visibility check, it only checks for open gaps between the adjacent and linked hulls.

Definition at line 99 of file AIController.cs.

◆ WorldPosition

Vector2 Barotrauma.AIController.WorldPosition
get

Definition at line 69 of file AIController.cs.