Barotrauma Server Doc
Barotrauma.Ragdoll Class Reference
Inheritance diagram for Barotrauma.Ragdoll:
Barotrauma.AnimController Barotrauma.FishAnimController Barotrauma.HumanoidAnimController

Public Member Functions

bool TryGetCollider (int index, out PhysicsBody collider)
 
void SubtractMass (Limb limb)
 
virtual void Recreate (RagdollParams ragdollParams=null)
 Call this to create the ragdoll from the RagdollParams. More...
 
 Ragdoll (Character character, string seed, RagdollParams ragdollParams=null)
 
void SaveRagdoll (string fileNameWithoutExtension=null)
 Saves all serializable data in the currently selected ragdoll params. This method should properly handle character flipping. More...
 
void ResetRagdoll (bool forceReload=false)
 Resets the serializable data to the currently selected ragdoll params. Force reloading always loads the xml stored on the disk. More...
 
void ResetJoints ()
 Resets the current joint values to the serialized joint params. More...
 
void ResetLimbs ()
 Resets the current limb values to the serialized limb params. More...
 
void AddJoint (JointParams jointParams)
 
void AddLimb (Limb limb)
 
void RemoveLimb (Limb limb)
 
bool OnLimbCollision (Fixture f1, Fixture f2, Contact contact)
 
float GetImpactDamage (float impact, float? impactTolerance=null)
 
bool SeverLimbJoint (LimbJoint limbJoint)
 
virtual void Flip ()
 
Vector2 GetCenterOfMass ()
 
void MoveLimb (Limb limb, Vector2 pos, float amount, bool pullFromCenter=false)
 
Parameters
pullFromCenterif false, force is applied to the position of pullJoint
More...
 
void ResetPullJoints (Func< Limb, bool > condition=null)
 
void FindHull (Vector2? worldPosition=null, bool setSubmarine=true)
 
void Teleport (Vector2 moveAmount, Vector2 velocityChange, bool detachProjectiles=true)
 
void Update (float deltaTime, Camera cam)
 
void ForceRefreshFloorY ()
 
float GetSurfaceY ()
 Get the position of the surface of water at the position of the character, in display units (taking into account connected hulls above the hull the character is in) More...
 
void SetPosition (Vector2 simPosition, bool lerp=false, bool ignorePlatforms=true, bool forceMainLimbToCollider=false, bool detachProjectiles=true)
 
void Hang ()
 
Limb GetLimb (LimbType limbType, bool excludeSevered=true)
 Note that if there are multiple limbs of the same type, only the first (valid) limb is returned. More...
 
Vector2? GetMouthPosition ()
 
Vector2 GetColliderBottom ()
 
Limb FindLowestLimb ()
 
void ReleaseStuckLimbs ()
 
void HideAndDisable (LimbType limbType, float duration=0, bool ignoreCollisions=true)
 
void RestoreTemporarilyDisabled ()
 
void Remove ()
 

Static Public Member Functions

static void UpdateAll (float deltaTime, Camera cam)
 
static void RemoveAll ()
 

Public Attributes

LimbJoint[] LimbJoints
 
Vector2 movement
 
Structure Stairs
 
Direction TargetDir
 
bool forceStanding
 
bool forceNotStanding
 

Static Public Attributes

const float MAX_SPEED = 20
 

Protected Member Functions

void CreateColliders ()
 
void CreateJoints ()
 
void CreateLimbs ()
 
void AddLimb (LimbParams limbParams)
 
List< LimbGetConnectedLimbs (Limb limb)
 
void LogAccessedRemovedCharacterError ()
 
void TrySetLimbPosition (Limb limb, Vector2 original, Vector2 simPosition, float rotation, bool lerp=false, bool ignorePlatforms=true)
 
void CheckDistFromCollider ()
 

Protected Attributes

Hull currentHull
 
Character character
 
float strongestImpact
 
Vector2 targetMovement
 
Vector2 overrideTargetMovement
 
float floorY
 
Fixture floorFixture
 
Vector2 floorNormal = Vector2.UnitY
 
float surfaceY
 
bool inWater
 
bool onGround
 
Direction dir
 
List< PhysicsBodycollider
 
int colliderIndex = 0
 
bool levitatingCollider = true
 

Properties

abstract RagdollParams RagdollParams [get, protected set]
 
Limb[] Limbs [get]
 
bool HasMultipleLimbsOfSameType [get]
 
bool?? Frozen [get, set]
 
Character Character [get]
 
bool OnGround [get]
 
float ColliderHeightFromFloor [get]
 In sim units. Joint scale applied. More...
 
bool IsStuck [get]
 
PhysicsBodyCollider [get]
 
int ColliderIndex [get, set]
 
float FloorY [get]
 
float Mass [get]
 
Limb?? MainLimb [get]
 
Vector2? WorldPosition [get]
 
bool? SimplePhysicsEnabled [get, set]
 
Vector2? TargetMovement [get, set]
 
abstract ? float HeadPosition [get]
 
abstract ? float HeadAngle [get]
 
abstract ? float TorsoPosition [get]
 
abstract ? float TorsoAngle [get]
 
float?? ImpactTolerance [get]
 
bool Draggable [get]
 
bool CanEnterSubmarine [get]
 
float Dir [get]
 
Direction Direction [get]
 
bool InWater [get]
 
bool HeadInWater [get]
 
HullCurrentHull [get, set]
 
bool IgnorePlatforms [get, set]
 
bool IsFlipped [get]
 
bool? BodyInRest [get, set]
 
bool Invalid [get]
 
bool IsHanging [get, protected set]
 

Detailed Description

Definition at line 18 of file Ragdoll.cs.

Constructor & Destructor Documentation

◆ Ragdoll()

Barotrauma.Ragdoll.Ragdoll ( Character  character,
string  seed,
RagdollParams  ragdollParams = null 
)

Definition at line 458 of file Ragdoll.cs.

Member Function Documentation

◆ AddJoint()

void Barotrauma.Ragdoll.AddJoint ( JointParams  jointParams)

Definition at line 574 of file Ragdoll.cs.

◆ AddLimb() [1/2]

void Barotrauma.Ragdoll.AddLimb ( Limb  limb)

Definition at line 625 of file Ragdoll.cs.

◆ AddLimb() [2/2]

void Barotrauma.Ragdoll.AddLimb ( LimbParams  limbParams)
protected

Definition at line 607 of file Ragdoll.cs.

◆ CheckDistFromCollider()

void Barotrauma.Ragdoll.CheckDistFromCollider ( )
protected

Definition at line 1965 of file Ragdoll.cs.

◆ CreateColliders()

void Barotrauma.Ragdoll.CreateColliders ( )
protected

Definition at line 465 of file Ragdoll.cs.

◆ CreateJoints()

void Barotrauma.Ragdoll.CreateJoints ( )
protected

Definition at line 488 of file Ragdoll.cs.

◆ CreateLimbs()

void Barotrauma.Ragdoll.CreateLimbs ( )
protected

Definition at line 525 of file Ragdoll.cs.

◆ FindHull()

void Barotrauma.Ragdoll.FindHull ( Vector2?  worldPosition = null,
bool  setSubmarine = true 
)

Definition at line 1036 of file Ragdoll.cs.

◆ FindLowestLimb()

Limb Barotrauma.Ragdoll.FindLowestLimb ( )

Definition at line 2108 of file Ragdoll.cs.

◆ Flip()

virtual void Barotrauma.Ragdoll.Flip ( )
virtual

Reimplemented in Barotrauma.HumanoidAnimController, and Barotrauma.FishAnimController.

Definition at line 949 of file Ragdoll.cs.

◆ ForceRefreshFloorY()

void Barotrauma.Ragdoll.ForceRefreshFloorY ( )

Definition at line 1653 of file Ragdoll.cs.

◆ GetCenterOfMass()

Vector2 Barotrauma.Ragdoll.GetCenterOfMass ( )

Definition at line 979 of file Ragdoll.cs.

◆ GetColliderBottom()

Vector2 Barotrauma.Ragdoll.GetColliderBottom ( )

Definition at line 2085 of file Ragdoll.cs.

◆ GetConnectedLimbs()

List<Limb> Barotrauma.Ragdoll.GetConnectedLimbs ( Limb  limb)
protected

Definition at line 911 of file Ragdoll.cs.

◆ GetImpactDamage()

float Barotrauma.Ragdoll.GetImpactDamage ( float  impact,
float?  impactTolerance = null 
)

Definition at line 853 of file Ragdoll.cs.

◆ GetLimb()

Limb Barotrauma.Ragdoll.GetLimb ( LimbType  limbType,
bool  excludeSevered = true 
)

Note that if there are multiple limbs of the same type, only the first (valid) limb is returned.

Definition at line 2049 of file Ragdoll.cs.

◆ GetMouthPosition()

Vector2? Barotrauma.Ragdoll.GetMouthPosition ( )

Definition at line 2074 of file Ragdoll.cs.

◆ GetSurfaceY()

float Barotrauma.Ragdoll.GetSurfaceY ( )

Get the position of the surface of water at the position of the character, in display units (taking into account connected hulls above the hull the character is in)

Definition at line 1800 of file Ragdoll.cs.

◆ Hang()

void Barotrauma.Ragdoll.Hang ( )

Definition at line 1910 of file Ragdoll.cs.

◆ HideAndDisable()

void Barotrauma.Ragdoll.HideAndDisable ( LimbType  limbType,
float  duration = 0,
bool  ignoreCollisions = true 
)

Definition at line 2133 of file Ragdoll.cs.

◆ LogAccessedRemovedCharacterError()

void Barotrauma.Ragdoll.LogAccessedRemovedCharacterError ( )
protected

Definition at line 1565 of file Ragdoll.cs.

◆ MoveLimb()

void Barotrauma.Ragdoll.MoveLimb ( Limb  limb,
Vector2  pos,
float  amount,
bool  pullFromCenter = false 
)

Parameters
pullFromCenterif false, force is applied to the position of pullJoint

Definition at line 1013 of file Ragdoll.cs.

◆ OnLimbCollision()

bool Barotrauma.Ragdoll.OnLimbCollision ( Fixture  f1,
Fixture  f2,
Contact  contact 
)

Definition at line 698 of file Ragdoll.cs.

◆ Recreate()

virtual void Barotrauma.Ragdoll.Recreate ( RagdollParams  ragdollParams = null)
virtual

Call this to create the ragdoll from the RagdollParams.

Reimplemented in Barotrauma.HumanoidAnimController, and Barotrauma.AnimController.

Definition at line 377 of file Ragdoll.cs.

◆ ReleaseStuckLimbs()

void Barotrauma.Ragdoll.ReleaseStuckLimbs ( )

Definition at line 2127 of file Ragdoll.cs.

◆ Remove()

void Barotrauma.Ragdoll.Remove ( )

Definition at line 2146 of file Ragdoll.cs.

◆ RemoveAll()

static void Barotrauma.Ragdoll.RemoveAll ( )
static

Definition at line 2182 of file Ragdoll.cs.

◆ RemoveLimb()

void Barotrauma.Ragdoll.RemoveLimb ( Limb  limb)

Definition at line 636 of file Ragdoll.cs.

◆ ResetJoints()

void Barotrauma.Ragdoll.ResetJoints ( )

Resets the current joint values to the serialized joint params.

Definition at line 560 of file Ragdoll.cs.

◆ ResetLimbs()

void Barotrauma.Ragdoll.ResetLimbs ( )

Resets the current limb values to the serialized limb params.

Definition at line 568 of file Ragdoll.cs.

◆ ResetPullJoints()

void Barotrauma.Ragdoll.ResetPullJoints ( Func< Limb, bool >  condition = null)

Definition at line 1018 of file Ragdoll.cs.

◆ ResetRagdoll()

void Barotrauma.Ragdoll.ResetRagdoll ( bool  forceReload = false)

Resets the serializable data to the currently selected ragdoll params. Force reloading always loads the xml stored on the disk.

Definition at line 550 of file Ragdoll.cs.

◆ RestoreTemporarilyDisabled()

void Barotrauma.Ragdoll.RestoreTemporarilyDisabled ( )

◆ SaveRagdoll()

void Barotrauma.Ragdoll.SaveRagdoll ( string  fileNameWithoutExtension = null)

Saves all serializable data in the currently selected ragdoll params. This method should properly handle character flipping.

Definition at line 541 of file Ragdoll.cs.

◆ SetPosition()

void Barotrauma.Ragdoll.SetPosition ( Vector2  simPosition,
bool  lerp = false,
bool  ignorePlatforms = true,
bool  forceMainLimbToCollider = false,
bool  detachProjectiles = true 
)

Definition at line 1856 of file Ragdoll.cs.

◆ SeverLimbJoint()

bool Barotrauma.Ragdoll.SeverLimbJoint ( LimbJoint  limbJoint)

Definition at line 861 of file Ragdoll.cs.

◆ SubtractMass()

void Barotrauma.Ragdoll.SubtractMass ( Limb  limb)

Definition at line 213 of file Ragdoll.cs.

◆ Teleport()

void Barotrauma.Ragdoll.Teleport ( Vector2  moveAmount,
Vector2  velocityChange,
bool  detachProjectiles = true 
)

Definition at line 1144 of file Ragdoll.cs.

◆ TryGetCollider()

bool Barotrauma.Ragdoll.TryGetCollider ( int  index,
out PhysicsBody  collider 
)

Definition at line 152 of file Ragdoll.cs.

◆ TrySetLimbPosition()

void Barotrauma.Ragdoll.TrySetLimbPosition ( Limb  limb,
Vector2  original,
Vector2  simPosition,
float  rotation,
bool  lerp = false,
bool  ignorePlatforms = true 
)
protected

Definition at line 1918 of file Ragdoll.cs.

◆ Update()

void Barotrauma.Ragdoll.Update ( float  deltaTime,
Camera  cam 
)

Definition at line 1232 of file Ragdoll.cs.

◆ UpdateAll()

static void Barotrauma.Ragdoll.UpdateAll ( float  deltaTime,
Camera  cam 
)
static

Definition at line 1028 of file Ragdoll.cs.

Member Data Documentation

◆ character

Character Barotrauma.Ragdoll.character
protected

Definition at line 95 of file Ragdoll.cs.

◆ collider

List<PhysicsBody> Barotrauma.Ragdoll.collider
protected

Definition at line 137 of file Ragdoll.cs.

◆ colliderIndex

int Barotrauma.Ragdoll.colliderIndex = 0
protected

Definition at line 138 of file Ragdoll.cs.

◆ currentHull

Hull Barotrauma.Ragdoll.currentHull
protected

Definition at line 50 of file Ragdoll.cs.

◆ dir

Direction Barotrauma.Ragdoll.dir
protected

Definition at line 133 of file Ragdoll.cs.

◆ floorFixture

Fixture Barotrauma.Ragdoll.floorFixture
protected

Definition at line 115 of file Ragdoll.cs.

◆ floorNormal

Vector2 Barotrauma.Ragdoll.floorNormal = Vector2.UnitY
protected

Definition at line 116 of file Ragdoll.cs.

◆ floorY

float Barotrauma.Ragdoll.floorY
protected

Definition at line 114 of file Ragdoll.cs.

◆ forceNotStanding

bool Barotrauma.Ragdoll.forceNotStanding

Definition at line 1230 of file Ragdoll.cs.

◆ forceStanding

bool Barotrauma.Ragdoll.forceStanding

Definition at line 1229 of file Ragdoll.cs.

◆ inWater

bool Barotrauma.Ragdoll.inWater
protected

Definition at line 119 of file Ragdoll.cs.

◆ levitatingCollider

bool Barotrauma.Ragdoll.levitatingCollider = true
protected

Definition at line 1207 of file Ragdoll.cs.

◆ LimbJoints

LimbJoint [] Barotrauma.Ragdoll.LimbJoints

Definition at line 90 of file Ragdoll.cs.

◆ MAX_SPEED

const float Barotrauma.Ragdoll.MAX_SPEED = 20
static

Definition at line 295 of file Ragdoll.cs.

◆ movement

Vector2 Barotrauma.Ragdoll.movement

Definition at line 106 of file Ragdoll.cs.

◆ onGround

bool Barotrauma.Ragdoll.onGround
protected

Definition at line 120 of file Ragdoll.cs.

◆ overrideTargetMovement

Vector2 Barotrauma.Ragdoll.overrideTargetMovement
protected

Definition at line 112 of file Ragdoll.cs.

◆ Stairs

Structure Barotrauma.Ragdoll.Stairs

Definition at line 131 of file Ragdoll.cs.

◆ strongestImpact

float Barotrauma.Ragdoll.strongestImpact
protected

Definition at line 97 of file Ragdoll.cs.

◆ surfaceY

float Barotrauma.Ragdoll.surfaceY
protected

Definition at line 117 of file Ragdoll.cs.

◆ TargetDir

Direction Barotrauma.Ragdoll.TargetDir

Definition at line 135 of file Ragdoll.cs.

◆ targetMovement

Vector2 Barotrauma.Ragdoll.targetMovement
protected

Definition at line 108 of file Ragdoll.cs.

Property Documentation

◆ BodyInRest

bool? Barotrauma.Ragdoll.BodyInRest
getset

Definition at line 1216 of file Ragdoll.cs.

◆ CanEnterSubmarine

bool Barotrauma.Ragdoll.CanEnterSubmarine
get

Definition at line 338 of file Ragdoll.cs.

◆ Character

Character Barotrauma.Ragdoll.Character
get

Definition at line 94 of file Ragdoll.cs.

◆ Collider

PhysicsBody? Barotrauma.Ragdoll.Collider
get

Definition at line 144 of file Ragdoll.cs.

◆ ColliderHeightFromFloor

float Barotrauma.Ragdoll.ColliderHeightFromFloor
get

In sim units. Joint scale applied.

Definition at line 129 of file Ragdoll.cs.

◆ ColliderIndex

int Barotrauma.Ragdoll.ColliderIndex
getset

Definition at line 166 of file Ragdoll.cs.

◆ CurrentHull

Hull? Barotrauma.Ragdoll.CurrentHull
getset

Definition at line 354 of file Ragdoll.cs.

◆ Dir

float Barotrauma.Ragdoll.Dir
get

Definition at line 340 of file Ragdoll.cs.

◆ Direction

Direction Barotrauma.Ragdoll.Direction
get

Definition at line 342 of file Ragdoll.cs.

◆ Draggable

bool Barotrauma.Ragdoll.Draggable
get

Definition at line 337 of file Ragdoll.cs.

◆ FloorY

float Barotrauma.Ragdoll.FloorY
get

Definition at line 202 of file Ragdoll.cs.

◆ Frozen

bool?? Barotrauma.Ragdoll.Frozen
getset

Definition at line 71 of file Ragdoll.cs.

◆ HasMultipleLimbsOfSameType

bool Barotrauma.Ragdoll.HasMultipleLimbsOfSameType
get

Definition at line 68 of file Ragdoll.cs.

◆ HeadAngle

abstract ? float Barotrauma.Ragdoll.HeadAngle
get

Definition at line 312 of file Ragdoll.cs.

◆ HeadInWater

bool Barotrauma.Ragdoll.HeadInWater
get

Definition at line 349 of file Ragdoll.cs.

◆ HeadPosition

abstract ? float Barotrauma.Ragdoll.HeadPosition
get

Definition at line 311 of file Ragdoll.cs.

◆ IgnorePlatforms

bool Barotrauma.Ragdoll.IgnorePlatforms
getset

Definition at line 372 of file Ragdoll.cs.

◆ ImpactTolerance

float?? Barotrauma.Ragdoll.ImpactTolerance
get

Definition at line 317 of file Ragdoll.cs.

◆ Invalid

bool Barotrauma.Ragdoll.Invalid
get

Definition at line 1459 of file Ragdoll.cs.

◆ InWater

bool Barotrauma.Ragdoll.InWater
get

Definition at line 344 of file Ragdoll.cs.

◆ IsFlipped

bool Barotrauma.Ragdoll.IsFlipped
get

Definition at line 947 of file Ragdoll.cs.

◆ IsHanging

bool Barotrauma.Ragdoll.IsHanging
getprotected set

Definition at line 1908 of file Ragdoll.cs.

◆ IsStuck

bool Barotrauma.Ragdoll.IsStuck
get

Definition at line 142 of file Ragdoll.cs.

◆ Limbs

Limb [] Barotrauma.Ragdoll.Limbs
get

Definition at line 55 of file Ragdoll.cs.

◆ MainLimb

Limb?? Barotrauma.Ragdoll.MainLimb
get

Definition at line 221 of file Ragdoll.cs.

◆ Mass

float Barotrauma.Ragdoll.Mass
get

Definition at line 207 of file Ragdoll.cs.

◆ OnGround

bool Barotrauma.Ragdoll.OnGround
get

Definition at line 121 of file Ragdoll.cs.

◆ RagdollParams

abstract RagdollParams Barotrauma.Ragdoll.RagdollParams
getprotected set

Definition at line 20 of file Ragdoll.cs.

◆ SimplePhysicsEnabled

bool? Barotrauma.Ragdoll.SimplePhysicsEnabled
getset

Definition at line 256 of file Ragdoll.cs.

◆ TargetMovement

Vector2? Barotrauma.Ragdoll.TargetMovement
getset

Definition at line 297 of file Ragdoll.cs.

◆ TorsoAngle

abstract ? float Barotrauma.Ragdoll.TorsoAngle
get

Definition at line 314 of file Ragdoll.cs.

◆ TorsoPosition

abstract ? float Barotrauma.Ragdoll.TorsoPosition
get

Definition at line 313 of file Ragdoll.cs.

◆ WorldPosition

Vector2? Barotrauma.Ragdoll.WorldPosition
get

Definition at line 246 of file Ragdoll.cs.