Show / Hide Table of Contents

Class SharedBodySystem

Inheritance
System.Object
SharedBodySystem
BodySystem
BodySystem
Namespace: Content.Shared.Body.Systems
Assembly: Content.Shared.dll
Syntax
public abstract class SharedBodySystem : EntitySystem

Fields

| Improve this Doc View Source

BodyRootContainerId

Container ID for the ContainerSlot on the body entity itself.

Declaration
public const string BodyRootContainerId = null
Field Value
Type Description
System.String
| Improve this Doc View Source

Containers

Declaration
protected readonly SharedContainerSystem Containers
Field Value
Type Description
Robust.Shared.Containers.SharedContainerSystem
| Improve this Doc View Source

Damageable

Declaration
protected readonly DamageableSystem Damageable
Field Value
Type Description
DamageableSystem
| Improve this Doc View Source

Movement

Declaration
protected readonly MovementSpeedModifierSystem Movement
Field Value
Type Description
MovementSpeedModifierSystem
| Improve this Doc View Source

OrganSlotContainerIdPrefix

Container ID prefix for any body organs.

Declaration
public const string OrganSlotContainerIdPrefix = null
Field Value
Type Description
System.String
| Improve this Doc View Source

PartSlotContainerIdPrefix

Container ID prefix for any body parts.

Declaration
public const string PartSlotContainerIdPrefix = null
Field Value
Type Description
System.String
| Improve this Doc View Source

Prototypes

Declaration
protected readonly IPrototypeManager Prototypes
Field Value
Type Description
Robust.Shared.Prototypes.IPrototypeManager
| Improve this Doc View Source

SharedTransform

Declaration
protected readonly SharedTransformSystem SharedTransform
Field Value
Type Description
SharedTransformSystem
| Improve this Doc View Source

Standing

Declaration
protected readonly StandingStateSystem Standing
Field Value
Type Description
StandingStateSystem

Methods

| Improve this Doc View Source

AddOrganToFirstValidSlot(EntityUid, EntityUid, BodyPartComponent, OrganComponent)

Tries to add this organ to any matching slot on this body part.

Declaration
public bool AddOrganToFirstValidSlot(EntityUid partId, EntityUid organId, BodyPartComponent part = null, OrganComponent organ = null)
Parameters
Type Name Description
EntityUid partId
EntityUid organId
BodyPartComponent part
OrganComponent organ
Returns
Type Description
System.Boolean
| Improve this Doc View Source

AddPart(EntityUid, EntityUid, String, BodyPartComponent, BodyComponent)

Declaration
protected virtual void AddPart(EntityUid bodyUid, EntityUid partUid, string slotId, BodyPartComponent component, BodyComponent bodyComp = null)
Parameters
Type Name Description
EntityUid bodyUid
EntityUid partUid
System.String slotId
BodyPartComponent component
BodyComponent bodyComp
| Improve this Doc View Source

AttachPart(EntityUid, BodyPartSlot, EntityUid, BodyPartComponent, BodyPartComponent)

Attaches a body part to the specified body part parent.

Declaration
public bool AttachPart(EntityUid parentPartId, BodyPartSlot slot, EntityUid partId, BodyPartComponent parentPart = null, BodyPartComponent part = null)
Parameters
Type Name Description
EntityUid parentPartId
BodyPartSlot slot
EntityUid partId
BodyPartComponent parentPart
BodyPartComponent part
Returns
Type Description
System.Boolean
| Improve this Doc View Source

AttachPart(EntityUid, String, EntityUid, BodyPartComponent, BodyPartComponent)

Attaches a body part to the specified body part parent.

Declaration
public bool AttachPart(EntityUid parentPartId, string slotId, EntityUid partId, BodyPartComponent parentPart = null, BodyPartComponent part = null)
Parameters
Type Name Description
EntityUid parentPartId
System.String slotId
EntityUid partId
BodyPartComponent parentPart
BodyPartComponent part
Returns
Type Description
System.Boolean
| Improve this Doc View Source

AttachPartToRoot(EntityUid, EntityUid, BodyComponent, BodyPartComponent)

Declaration
public bool AttachPartToRoot(EntityUid bodyId, EntityUid partId, BodyComponent body = null, BodyPartComponent part = null)
Parameters
Type Name Description
EntityUid bodyId
EntityUid partId
BodyComponent body
BodyPartComponent part
Returns
Type Description
System.Boolean
| Improve this Doc View Source

BodyHasChild(EntityUid, EntityUid, BodyComponent, BodyPartComponent)

Returns true if the bodyId has the specified partId.

Declaration
public bool BodyHasChild(EntityUid bodyId, EntityUid partId, BodyComponent body = null, BodyPartComponent part = null)
Parameters
Type Name Description
EntityUid bodyId
EntityUid partId
BodyComponent body
BodyPartComponent part
Returns
Type Description
System.Boolean
| Improve this Doc View Source

BodyHasPartType(EntityUid, BodyPartType, BodyComponent)

Returns true if the bodyId has any parts of this type.

Declaration
public bool BodyHasPartType(EntityUid bodyId, BodyPartType type, BodyComponent body = null)
Parameters
Type Name Description
EntityUid bodyId
BodyPartType type
BodyComponent body
Returns
Type Description
System.Boolean
| Improve this Doc View Source

CanAttachPart(EntityUid, BodyPartSlot, EntityUid, BodyPartComponent, BodyPartComponent)

Returns true if the partId can be attached to the parentId in the specified slot.

Declaration
public bool CanAttachPart(EntityUid parentId, BodyPartSlot slot, EntityUid partId, BodyPartComponent parentPart = null, BodyPartComponent part = null)
Parameters
Type Name Description
EntityUid parentId
BodyPartSlot slot
EntityUid partId
BodyPartComponent parentPart
BodyPartComponent part
Returns
Type Description
System.Boolean
| Improve this Doc View Source

CanAttachPart(EntityUid, String, EntityUid, BodyPartComponent, BodyPartComponent)

Returns true if we can attach the specified partId to the parentId in the specified slot.

Declaration
public bool CanAttachPart(EntityUid parentId, string slotId, EntityUid partId, BodyPartComponent parentPart = null, BodyPartComponent part = null)
Parameters
Type Name Description
EntityUid parentId
System.String slotId
EntityUid partId
BodyPartComponent parentPart
BodyPartComponent part
Returns
Type Description
System.Boolean
| Improve this Doc View Source

CanAttachToRoot(EntityUid, EntityUid, BodyComponent, BodyPartComponent)

Returns true if we can attach the partId to the bodyId as the root entity.

Declaration
public bool CanAttachToRoot(EntityUid bodyId, EntityUid partId, BodyComponent body = null, BodyPartComponent part = null)
Parameters
Type Name Description
EntityUid bodyId
EntityUid partId
BodyComponent body
BodyPartComponent part
Returns
Type Description
System.Boolean
| Improve this Doc View Source

CanInsertOrgan(EntityUid, OrganSlot, BodyPartComponent)

Returns whether the specified organ slot exists on the partId.

Declaration
public bool CanInsertOrgan(EntityUid partId, OrganSlot slot, BodyPartComponent part = null)
Parameters
Type Name Description
EntityUid partId
OrganSlot slot
BodyPartComponent part
Returns
Type Description
System.Boolean
| Improve this Doc View Source

CanInsertOrgan(EntityUid, String, BodyPartComponent)

Returns whether the slotId exists on the partId.

Declaration
public bool CanInsertOrgan(EntityUid partId, string slotId, BodyPartComponent part = null)
Parameters
Type Name Description
EntityUid partId
System.String slotId
BodyPartComponent part
Returns
Type Description
System.Boolean
| Improve this Doc View Source

GetAllBodyPartSlots(EntityUid, BodyPartComponent)

Returns all body part slots for this entity.

Declaration
public IEnumerable<BodyPartSlot> GetAllBodyPartSlots(EntityUid partId, BodyPartComponent part = null)
Parameters
Type Name Description
EntityUid partId
BodyPartComponent part
Returns
Type Description
IEnumerable<BodyPartSlot>
| Improve this Doc View Source

GetBodyAllSlots(EntityUid, BodyComponent)

Returns all body part slots for this entity.

Declaration
public IEnumerable<BodyPartSlot> GetBodyAllSlots(EntityUid bodyId, BodyComponent body = null)
Parameters
Type Name Description
EntityUid bodyId
BodyComponent body
Returns
Type Description
IEnumerable<BodyPartSlot>
| Improve this Doc View Source

GetBodyChildren(Nullable<EntityUid>, BodyComponent, BodyPartComponent)

Gets all child body parts of this entity, including the root entity.

Declaration
public IEnumerable<(EntityUid Id, BodyPartComponent Component)> GetBodyChildren(EntityUid? id, BodyComponent body = null, BodyPartComponent rootPart = null)
Parameters
Type Name Description
System.Nullable<EntityUid> id
BodyComponent body
BodyPartComponent rootPart
Returns
Type Description
IEnumerable<System.ValueTuple<EntityUid, BodyPartComponent>>
| Improve this Doc View Source

GetBodyChildrenOfType(EntityUid, BodyPartType, BodyComponent)

Declaration
public IEnumerable<(EntityUid Id, BodyPartComponent Component)> GetBodyChildrenOfType(EntityUid bodyId, BodyPartType type, BodyComponent body = null)
Parameters
Type Name Description
EntityUid bodyId
BodyPartType type
BodyComponent body
Returns
Type Description
IEnumerable<System.ValueTuple<EntityUid, BodyPartComponent>>
| Improve this Doc View Source

GetBodyContainers(EntityUid, BodyComponent, BodyPartComponent)

Gets all body containers on this entity including the root one.

Declaration
public IEnumerable<BaseContainer> GetBodyContainers(EntityUid id, BodyComponent body = null, BodyPartComponent rootPart = null)
Parameters
Type Name Description
EntityUid id
BodyComponent body
BodyPartComponent rootPart
Returns
Type Description
IEnumerable<Robust.Shared.Containers.BaseContainer>
| Improve this Doc View Source

GetBodyOrganComponents<T>(EntityUid, BodyComponent)

Returns a list of ValueTuples of and OrganComponent on each organ in the given body.

Declaration
public List<(T Comp, OrganComponent Organ)> GetBodyOrganComponents<T>(EntityUid uid, BodyComponent body = null)
    where T : Component
Parameters
Type Name Description
EntityUid uid

The body entity id to check on.

BodyComponent body

The body to check for organs on.

Returns
Type Description
List<System.ValueTuple<T, OrganComponent>>
Type Parameters
Name Description
T

The component to check for.

| Improve this Doc View Source

GetBodyOrgans(Nullable<EntityUid>, BodyComponent)

Declaration
public IEnumerable<(EntityUid Id, OrganComponent Component)> GetBodyOrgans(EntityUid? bodyId, BodyComponent body = null)
Parameters
Type Name Description
System.Nullable<EntityUid> bodyId
BodyComponent body
Returns
Type Description
IEnumerable<System.ValueTuple<EntityUid, OrganComponent>>
| Improve this Doc View Source

GetBodyPartAdjacentParts(EntityUid, BodyPartComponent)

Gets the parent body part and all immediate child body parts for the partId.

Declaration
public IEnumerable<EntityUid> GetBodyPartAdjacentParts(EntityUid partId, BodyPartComponent part = null)
Parameters
Type Name Description
EntityUid partId
BodyPartComponent part
Returns
Type Description
IEnumerable<EntityUid>
| Improve this Doc View Source

GetBodyPartAdjacentPartsComponents<T>(EntityUid, BodyPartComponent)

Declaration
public IEnumerable<(EntityUid AdjacentId, T Component)> GetBodyPartAdjacentPartsComponents<T>(EntityUid partId, BodyPartComponent part = null)
    where T : Component
Parameters
Type Name Description
EntityUid partId
BodyPartComponent part
Returns
Type Description
IEnumerable<System.ValueTuple<EntityUid, T>>
Type Parameters
Name Description
T
| Improve this Doc View Source

GetBodyPartChildren(EntityUid, BodyPartComponent)

Returns all body part components for this entity including itself.

Declaration
public IEnumerable<(EntityUid Id, BodyPartComponent Component)> GetBodyPartChildren(EntityUid partId, BodyPartComponent part = null)
Parameters
Type Name Description
EntityUid partId
BodyPartComponent part
Returns
Type Description
IEnumerable<System.ValueTuple<EntityUid, BodyPartComponent>>
| Improve this Doc View Source

GetBodyPartOrganComponents<T>(EntityUid, BodyPartComponent)

Returns a list of ValueTuples of and OrganComponent on each organ in the given part.

Declaration
public List<(T Comp, OrganComponent Organ)> GetBodyPartOrganComponents<T>(EntityUid uid, BodyPartComponent part = null)
    where T : Component
Parameters
Type Name Description
EntityUid uid

The part entity id to check on.

BodyPartComponent part

The part to check for organs on.

Returns
Type Description
List<System.ValueTuple<T, OrganComponent>>
Type Parameters
Name Description
T

The component to check for.

| Improve this Doc View Source

GetOrganContainerId(String)

Gets the container Id for the specified slotId.

Declaration
public static string GetOrganContainerId(string slotId)
Parameters
Type Name Description
System.String slotId
Returns
Type Description
System.String
| Improve this Doc View Source

GetParentPartAndSlotOrNull(EntityUid)

Tries to get the parent body part and slot to this if applicable.

Declaration
public (EntityUid Parent, string Slot)? GetParentPartAndSlotOrNull(EntityUid uid)
Parameters
Type Name Description
EntityUid uid
Returns
Type Description
System.Nullable<System.ValueTuple<EntityUid, System.String>>
| Improve this Doc View Source

GetParentPartOrNull(EntityUid)

Tries to get the parent body part to this if applicable. Doesn't validate if it's a part of body system.

Declaration
public EntityUid? GetParentPartOrNull(EntityUid uid)
Parameters
Type Name Description
EntityUid uid
Returns
Type Description
System.Nullable<EntityUid>
| Improve this Doc View Source

GetPartContainers(EntityUid, BodyPartComponent)

Gets all BaseContainers for body parts on this entity and its child entities.

Declaration
public IEnumerable<BaseContainer> GetPartContainers(EntityUid id, BodyPartComponent part = null)
Parameters
Type Name Description
EntityUid id
BodyPartComponent part
Returns
Type Description
IEnumerable<Robust.Shared.Containers.BaseContainer>
| Improve this Doc View Source

GetPartOrgans(EntityUid, BodyPartComponent)

Get all organs for the specified body part.

Declaration
public IEnumerable<(EntityUid Id, OrganComponent Component)> GetPartOrgans(EntityUid partId, BodyPartComponent part = null)
Parameters
Type Name Description
EntityUid partId
BodyPartComponent part
Returns
Type Description
IEnumerable<System.ValueTuple<EntityUid, OrganComponent>>
| Improve this Doc View Source

GetPartSlotContainerId(String)

Gets the container Id for the specified slotId.

Declaration
public static string GetPartSlotContainerId(string slotId)
Parameters
Type Name Description
System.String slotId
Returns
Type Description
System.String
| Improve this Doc View Source

GetPartSlotContainerIdFromContainer(String)

Inverse of GetPartSlotContainerId(String)

Declaration
protected static string? GetPartSlotContainerIdFromContainer(string containerSlotId)
Parameters
Type Name Description
System.String containerSlotId
Returns
Type Description
System.Nullable<System.String>
| Improve this Doc View Source

GetRootPartOrNull(EntityUid, BodyComponent)

Returns the root part of this body if it exists.

Declaration
public (EntityUid Entity, BodyPartComponent BodyPart)? GetRootPartOrNull(EntityUid bodyId, BodyComponent body = null)
Parameters
Type Name Description
EntityUid bodyId
BodyComponent body
Returns
Type Description
System.Nullable<System.ValueTuple<EntityUid, BodyPartComponent>>
| Improve this Doc View Source

GibBody(EntityUid, Boolean, BodyComponent, Boolean)

Declaration
public virtual HashSet<EntityUid> GibBody(EntityUid bodyId, bool gibOrgans = false, BodyComponent body = null, bool deleteItems = false)
Parameters
Type Name Description
EntityUid bodyId
System.Boolean gibOrgans
BodyComponent body
System.Boolean deleteItems
Returns
Type Description
HashSet<EntityUid>
| Improve this Doc View Source

Initialize()

Declaration
public override void Initialize()
| Improve this Doc View Source

InsertOrgan(EntityUid, EntityUid, String, BodyPartComponent, OrganComponent)

Declaration
public bool InsertOrgan(EntityUid partId, EntityUid organId, string slotId, BodyPartComponent part = null, OrganComponent organ = null)
Parameters
Type Name Description
EntityUid partId
EntityUid organId
System.String slotId
BodyPartComponent part
OrganComponent organ
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsPartRoot(EntityUid, EntityUid, BodyComponent, BodyPartComponent)

Returns true if the partId is the root body container for the specified bodyId.

Declaration
public bool IsPartRoot(EntityUid bodyId, EntityUid partId, BodyComponent body = null, BodyPartComponent part = null)
Parameters
Type Name Description
EntityUid bodyId
EntityUid partId
BodyComponent body
BodyPartComponent part
Returns
Type Description
System.Boolean
| Improve this Doc View Source

PartHasChild(EntityUid, EntityUid, BodyPartComponent, BodyPartComponent)

Returns true if the parentId has the specified childId.

Declaration
public bool PartHasChild(EntityUid parentId, EntityUid childId, BodyPartComponent parent, BodyPartComponent child)
Parameters
Type Name Description
EntityUid parentId
EntityUid childId
BodyPartComponent parent
BodyPartComponent child
Returns
Type Description
System.Boolean
| Improve this Doc View Source

RemoveOrgan(EntityUid, OrganComponent)

Removes the organ if it is inside of a body part.

Declaration
public bool RemoveOrgan(EntityUid organId, OrganComponent organ = null)
Parameters
Type Name Description
EntityUid organId
OrganComponent organ
Returns
Type Description
System.Boolean
| Improve this Doc View Source

RemovePart(EntityUid, EntityUid, String, BodyPartComponent, BodyComponent)

Declaration
protected virtual void RemovePart(EntityUid bodyUid, EntityUid partUid, string slotId, BodyPartComponent component, BodyComponent bodyComp = null)
Parameters
Type Name Description
EntityUid bodyUid
EntityUid partUid
System.String slotId
BodyPartComponent component
BodyComponent bodyComp
| Improve this Doc View Source

TryCreateOrganSlot(Nullable<EntityUid>, String, out Nullable<OrganSlot>, BodyPartComponent)

Attempts to create the specified organ slot on the specified parent if it exists.

Declaration
public bool TryCreateOrganSlot(EntityUid? parent, string slotId, out OrganSlot? slot, BodyPartComponent part = null)
Parameters
Type Name Description
System.Nullable<EntityUid> parent
System.String slotId
System.Nullable<OrganSlot> slot
BodyPartComponent part
Returns
Type Description
System.Boolean
| Improve this Doc View Source

TryCreatePartSlot(Nullable<EntityUid>, String, BodyPartType, out Nullable<BodyPartSlot>, BodyPartComponent)

Tries to create a BodyPartSlot on the specified partUid.

Declaration
public bool TryCreatePartSlot(EntityUid? partId, string slotId, BodyPartType partType, out BodyPartSlot? slot, BodyPartComponent part = null)
Parameters
Type Name Description
System.Nullable<EntityUid> partId
System.String slotId
BodyPartType partType
System.Nullable<BodyPartSlot> slot
BodyPartComponent part
Returns
Type Description
System.Boolean

false if not relevant or can't add it.

| Improve this Doc View Source

TryCreatePartSlotAndAttach(EntityUid, String, EntityUid, BodyPartType, BodyPartComponent, BodyPartComponent)

Declaration
public bool TryCreatePartSlotAndAttach(EntityUid parentId, string slotId, EntityUid childId, BodyPartType partType, BodyPartComponent parent = null, BodyPartComponent child = null)
Parameters
Type Name Description
EntityUid parentId
System.String slotId
EntityUid childId
BodyPartType partType
BodyPartComponent parent
BodyPartComponent child
Returns
Type Description
System.Boolean
| Improve this Doc View Source

TryGetBodyOrganComponents<T>(EntityUid, out Nullable<List<(T Comp, OrganComponent Organ)>>, BodyComponent)

Tries to get a list of ValueTuples of and OrganComponent on each organs in the given body.

Declaration
public bool TryGetBodyOrganComponents<T>(EntityUid uid, out List<(T Comp, OrganComponent Organ)>? comps, BodyComponent body = null)
    where T : Component
Parameters
Type Name Description
EntityUid uid

The body entity id to check on.

System.Nullable<List<System.ValueTuple<T, OrganComponent>>> comps

The list of components.

BodyComponent body

The body to check for organs on.

Returns
Type Description
System.Boolean

Whether any were found.

Type Parameters
Name Description
T

The component to check for.

| Improve this Doc View Source

TryGetBodyPartAdjacentPartsComponents<T>(EntityUid, out Nullable<List<(EntityUid AdjacentId, T Component)>>, BodyPartComponent)

Declaration
public bool TryGetBodyPartAdjacentPartsComponents<T>(EntityUid partId, out List<(EntityUid AdjacentId, T Component)>? comps, BodyPartComponent part = null)
    where T : Component
Parameters
Type Name Description
EntityUid partId
System.Nullable<List<System.ValueTuple<EntityUid, T>>> comps
BodyPartComponent part
Returns
Type Description
System.Boolean
Type Parameters
Name Description
T
| Improve this Doc View Source

TryGetBodyPartOrganComponents<T>(EntityUid, out Nullable<List<(T Comp, OrganComponent Organ)>>, BodyPartComponent)

Tries to get a list of ValueTuples of and OrganComponent on each organs in the given part.

Declaration
public bool TryGetBodyPartOrganComponents<T>(EntityUid uid, out List<(T Comp, OrganComponent Organ)>? comps, BodyPartComponent part = null)
    where T : Component
Parameters
Type Name Description
EntityUid uid

The part entity id to check on.

System.Nullable<List<System.ValueTuple<T, OrganComponent>>> comps

The list of components.

BodyPartComponent part

The part to check for organs on.

Returns
Type Description
System.Boolean

Whether any were found.

Type Parameters
Name Description
T

The component to check for.

| Improve this Doc View Source

TryGetParentBodyPart(EntityUid, out Nullable<EntityUid>, out BodyPartComponent)

Tries to get the relevant parent body part to this if it exists. It won't exist if this is the root body part or if it's not in a body.

Declaration
public bool TryGetParentBodyPart(EntityUid partUid, out EntityUid? parentUid, out BodyPartComponent parentComponent)
Parameters
Type Name Description
EntityUid partUid
System.Nullable<EntityUid> parentUid
BodyPartComponent parentComponent
Returns
Type Description
System.Boolean
| Improve this Doc View Source

UpdateMovementSpeed(EntityUid, BodyComponent, MovementSpeedModifierComponent)

Declaration
public void UpdateMovementSpeed(EntityUid bodyId, BodyComponent body = null, MovementSpeedModifierComponent movement = null)
Parameters
Type Name Description
EntityUid bodyId
BodyComponent body
MovementSpeedModifierComponent movement
  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾