using Content.Shared.Body.Components; using Content.Shared.Body.Systems; using Robust.Shared.Containers; using Robust.Shared.GameStates; using Robust.Shared.Serialization; namespace Content.Shared.Body.Part; [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] [Access(typeof(SharedBodySystem))] public sealed partial class BodyPartComponent : Component { // Need to set this on container changes as it may be several transform parents up the hierarchy. /// /// Parent body for this part. /// [DataField, AutoNetworkedField] public EntityUid? Body; [DataField, AutoNetworkedField] public BodyPartType PartType = BodyPartType.Other; // TODO BODY Replace with a simulation of organs /// /// Whether or not the owning will die if all /// s of this type are removed from it. /// [DataField("vital"), AutoNetworkedField] public bool IsVital; [DataField, AutoNetworkedField] public BodyPartSymmetry Symmetry = BodyPartSymmetry.None; /// /// Child body parts attached to this body part. /// [DataField, AutoNetworkedField] public Dictionary Children = new(); /// /// Organs attached to this body part. /// [DataField, AutoNetworkedField] public Dictionary Organs = new(); /// /// These are only for VV/Debug do not use these for gameplay/systems /// [ViewVariables] private List BodyPartSlotsVV { get { List temp = new(); var containerSystem = IoCManager.Resolve().System(); foreach (var slotId in Children.Keys) { temp.Add((ContainerSlot) containerSystem.GetContainer(Owner, SharedBodySystem.PartSlotContainerIdPrefix+slotId)); } return temp; } } [ViewVariables] private List OrganSlotsVV { get { List temp = new(); var containerSystem = IoCManager.Resolve().System(); foreach (var slotId in Organs.Keys) { temp.Add((ContainerSlot) containerSystem.GetContainer(Owner, SharedBodySystem.OrganSlotContainerIdPrefix+slotId)); } return temp; } } } /// /// Contains metadata about a body part in relation to its slot. /// [NetSerializable, Serializable] [DataRecord] public partial struct BodyPartSlot { public string Id; public BodyPartType Type; public BodyPartSlot(string id, BodyPartType type) { Id = id; Type = type; } }; /// /// Contains metadata about an organ part in relation to its slot. /// [NetSerializable, Serializable] [DataRecord] public partial struct OrganSlot { public string Id; public OrganSlot(string id) { Id = id; } };