| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- // SPDX-FileCopyrightText: 2022 Jezithyr <Jezithyr@gmail.com>
- // SPDX-FileCopyrightText: 2023 DrSmugleaf <DrSmugleaf@users.noreply.github.com>
- // SPDX-FileCopyrightText: 2023 Jezithyr <jezithyr@gmail.com>
- // SPDX-FileCopyrightText: 2023 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
- // SPDX-FileCopyrightText: 2023 metalgearsloth <comedian_vs_clown@hotmail.com>
- // SPDX-FileCopyrightText: 2024 Aviu00 <93730715+Aviu00@users.noreply.github.com>
- // SPDX-FileCopyrightText: 2024 Piras314 <p1r4s@proton.me>
- // SPDX-FileCopyrightText: 2024 username <113782077+whateverusername0@users.noreply.github.com>
- // SPDX-FileCopyrightText: 2024 whateverusername0 <whateveremail>
- // SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
- // SPDX-FileCopyrightText: 2025 deltanedas <39013340+deltanedas@users.noreply.github.com>
- // SPDX-FileCopyrightText: 2025 deltanedas <@deltanedas:kde.org>
- // SPDX-FileCopyrightText: 2025 gluesniffler <159397573+gluesniffler@users.noreply.github.com>
- //
- // SPDX-License-Identifier: AGPL-3.0-or-later
- using Content.Shared.Body.Components;
- using Content.Shared.Body.Systems;
- using Robust.Shared.Containers;
- using Robust.Shared.GameStates;
- using Robust.Shared.Serialization;
- // Shitmed Change
- using Content.Shared.Containers.ItemSlots;
- using Content.Shared.FixedPoint;
- using Content.Shared._Shitmed.Medical.Surgery.Tools;
- using Content.Shared._Shitmed.Targeting;
- using Robust.Shared.Prototypes;
- namespace Content.Shared.Body.Part;
- [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
- //[Access(typeof(SharedBodySystem))] // goob edit - all access :godo:
- public sealed partial class BodyPartComponent : Component, ISurgeryToolComponent // Shitmed Change
- {
- // Need to set this on container changes as it may be several transform parents up the hierarchy.
- /// <summary>
- /// Parent body for this part.
- /// </summary>
- [DataField, AutoNetworkedField]
- public EntityUid? Body;
- // Shitmed Change Start
- [DataField, AutoNetworkedField]
- public BodyPartSlot? ParentSlot;
- /// <summary>
- /// Shitmed Change: Bleeding stacks to give when this body part is severed.
- /// Doubled for <see cref="IsVital"/>. parts.
- /// </summary>
- [DataField]
- public float SeverBleeding = 4f;
- [DataField]
- public string ToolName { get; set; } = "A body part";
- [DataField]
- public string SlotId = string.Empty;
- [DataField, AutoNetworkedField]
- public bool? Used { get; set; } = null;
- [DataField]
- public float Speed { get; set; } = 1f;
- /// <summary>
- /// Shitmed Change: What's the max health this body part can have?
- /// </summary>
- [DataField]
- public float MinIntegrity;
- /// <summary>
- /// Whether this body part can be severed or not
- /// </summary>
- [DataField, AutoNetworkedField]
- public bool CanSever = true;
- /// <summary>
- /// Shitmed Change: Whether this body part is enabled or not.
- /// </summary>
- [DataField, AutoNetworkedField]
- public bool Enabled = true;
- /// <summary>
- /// Shitmed Change: Whether this body part can be enabled or not. Used for non-functional prosthetics.
- /// </summary>
- [DataField, AutoNetworkedField]
- public bool CanEnable = true;
- /// <summary>
- /// Whether this body part can attach children or not.
- /// </summary>
- [DataField]
- public bool CanAttachChildren = true;
- /// <summary>
- /// Shitmed Change: How long it takes to run another self heal tick on the body part.
- /// </summary>
- [DataField]
- public float HealingTime = 30;
- /// <summary>
- /// Shitmed Change: How long it has been since the last self heal tick on the body part.
- /// </summary>
- public float HealingTimer;
- /// <summary>
- /// Shitmed Change: How much health to heal on the body part per tick.
- /// </summary>
- [DataField]
- public float SelfHealingAmount = 5;
- /// <summary>
- /// Shitmed Change: The name of the container for this body part. Used in insertion surgeries.
- /// </summary>
- [DataField]
- public string ContainerName { get; set; } = "part_slot";
- /// <summary>
- /// Shitmed Change: The slot for item insertion.
- /// </summary>
- [DataField, AutoNetworkedField]
- public ItemSlot ItemInsertionSlot = new();
- /// <summary>
- /// Shitmed Change: Current species. Dictates things like body part sprites.
- /// </summary>
- [DataField, AutoNetworkedField]
- public string Species { get; set; } = "";
- /// <summary>
- /// Shitmed Change: The total damage that has to be dealt to a body part
- /// to make possible severing it.
- /// </summary>
- [DataField, AutoNetworkedField]
- public float SeverIntegrity = 90;
- /// <summary>
- /// Shitmed Change: The ID of the base layer for this body part.
- /// </summary>
- [DataField, AutoNetworkedField]
- public string? BaseLayerId;
- /// <summary>
- /// Shitmed Change: On what TargetIntegrity we should re-enable the part.
- /// </summary>
- [DataField, AutoNetworkedField]
- public TargetIntegrity EnableIntegrity = TargetIntegrity.ModeratelyWounded;
- [DataField, AutoNetworkedField]
- public Dictionary<TargetIntegrity, float> IntegrityThresholds = new()
- {
- { TargetIntegrity.CriticallyWounded, 90 },
- { TargetIntegrity.HeavilyWounded, 75 },
- { TargetIntegrity.ModeratelyWounded, 60 },
- { TargetIntegrity.SomewhatWounded, 40},
- { TargetIntegrity.LightlyWounded, 20 },
- { TargetIntegrity.Healthy, 10 },
- };
- [DataField, AutoNetworkedField]
- public BodyPartType PartType = BodyPartType.Other;
- // TODO BODY Replace with a simulation of organs
- /// <summary>
- /// Whether or not the owning <see cref="Body"/> will die if all
- /// <see cref="BodyComponent"/>s of this type are removed from it.
- /// </summary>
- [DataField("vital"), AutoNetworkedField]
- public bool IsVital;
- [DataField, AutoNetworkedField]
- public BodyPartSymmetry Symmetry = BodyPartSymmetry.None;
- /// <summary>
- /// When attached, the part will ensure these components on the entity, and delete them on removal.
- /// </summary>
- [DataField, AlwaysPushInheritance]
- public ComponentRegistry? OnAdd;
- /// <summary>
- /// When removed, the part will ensure these components on the entity, and add them on removal.
- /// </summary>
- [DataField, AlwaysPushInheritance]
- public ComponentRegistry? OnRemove;
- // Shitmed Change End
- /// <summary>
- /// Child body parts attached to this body part.
- /// </summary>
- [DataField, AutoNetworkedField]
- public Dictionary<string, BodyPartSlot> Children = new();
- /// <summary>
- /// Organs attached to this body part.
- /// </summary>
- [DataField, AutoNetworkedField]
- public Dictionary<string, OrganSlot> Organs = new();
- /// <summary>
- /// These are only for VV/Debug do not use these for gameplay/systems
- /// </summary>
- [ViewVariables]
- private List<ContainerSlot> BodyPartSlotsVV
- {
- get
- {
- List<ContainerSlot> temp = new();
- var containerSystem = IoCManager.Resolve<IEntityManager>().System<SharedContainerSystem>();
- foreach (var slotId in Children.Keys)
- {
- temp.Add((ContainerSlot)containerSystem.GetContainer(Owner, SharedBodySystem.PartSlotContainerIdPrefix + slotId));
- }
- return temp;
- }
- }
- [ViewVariables]
- private List<ContainerSlot> OrganSlotsVV
- {
- get
- {
- List<ContainerSlot> temp = new();
- var containerSystem = IoCManager.Resolve<IEntityManager>().System<SharedContainerSystem>();
- foreach (var slotId in Organs.Keys)
- {
- temp.Add((ContainerSlot)containerSystem.GetContainer(Owner, SharedBodySystem.OrganSlotContainerIdPrefix + slotId));
- }
- return temp;
- }
- }
- }
- /// <summary>
- /// Contains metadata about a body part in relation to its slot.
- /// </summary>
- [NetSerializable, Serializable]
- [DataRecord]
- public partial struct BodyPartSlot
- {
- public string Id;
- public BodyPartType Type;
- public BodyPartSlot(string id, BodyPartType type)
- {
- Id = id;
- Type = type;
- }
- };
- /// <summary>
- /// Contains metadata about an organ part in relation to its slot.
- /// </summary>
- [NetSerializable, Serializable]
- [DataRecord]
- public partial struct OrganSlot
- {
- public string Id;
- public OrganSlot(string id)
- {
- Id = id;
- }
- };
|