using Content.Shared.Damage; using Content.Shared.Movement.Systems; using Content.Shared.Standing; using Robust.Shared.Containers; using Robust.Shared.Prototypes; namespace Content.Shared.Body.Systems; public abstract partial class SharedBodySystem : EntitySystem { /* * See the body partial for how this works. */ /// /// Container ID prefix for any body parts. /// protected const string PartSlotContainerIdPrefix = "body_part_slot_"; /// /// Container ID for the ContainerSlot on the body entity itself. /// protected const string BodyRootContainerId = "body_root_part"; /// /// Container ID prefix for any body organs. /// protected const string OrganSlotContainerIdPrefix = "body_organ_slot_"; [Dependency] protected readonly IPrototypeManager Prototypes = default!; [Dependency] protected readonly DamageableSystem Damageable = default!; [Dependency] protected readonly MovementSpeedModifierSystem Movement = default!; [Dependency] protected readonly SharedContainerSystem Containers = default!; [Dependency] protected readonly SharedTransformSystem SharedTransform = default!; [Dependency] protected readonly StandingStateSystem Standing = default!; public override void Initialize() { base.Initialize(); InitializeBody(); InitializeParts(); } /// /// Inverse of /// protected static string? GetPartSlotContainerIdFromContainer(string containerSlotId) { // This is blursed var slotIndex = containerSlotId.IndexOf(PartSlotContainerIdPrefix, StringComparison.Ordinal); if (slotIndex < -1) return null; var slotId = containerSlotId.Remove(slotIndex, PartSlotContainerIdPrefix.Length); return slotId; } /// /// Gets the container Id for the specified slotId. /// public static string GetPartSlotContainerId(string slotId) { return PartSlotContainerIdPrefix + slotId; } /// /// Gets the container Id for the specified slotId. /// public static string GetOrganContainerId(string slotId) { return OrganSlotContainerIdPrefix + slotId; } }