From b9864459a7c581b5a2d6990d120a47faaaca7b76 Mon Sep 17 00:00:00 2001 From: Spatison <137375981+Spatison@users.noreply.github.com> Date: Fri, 10 Jan 2025 00:12:47 +1000 Subject: [PATCH 1/2] fixs some bugs --- .../Body/Systems/SharedBodySystem.cs | 2 +- .../SurgeryOrganConditionComponent.cs | 5 ++- .../_Shitmed/Surgery/SharedSurgerySystem.cs | 4 ++- Resources/Prototypes/Body/Organs/diona.yml | 15 +++++++++ .../Entities/Mobs/Species/skeleton.yml | 1 + .../_Shitmed/Entities/Surgery/surgeries.yml | 32 +++++++++++++++++++ 6 files changed, 56 insertions(+), 3 deletions(-) diff --git a/Content.Shared/Body/Systems/SharedBodySystem.cs b/Content.Shared/Body/Systems/SharedBodySystem.cs index dddb6398005..5f3965dde5c 100644 --- a/Content.Shared/Body/Systems/SharedBodySystem.cs +++ b/Content.Shared/Body/Systems/SharedBodySystem.cs @@ -76,7 +76,7 @@ public static string GetPartSlotContainerId(string slotId) /// /// Gets the container Id for the specified slotId. /// - public static string GetOrganContainerId(string slotId) + public string GetOrganContainerId(string slotId) { return OrganSlotContainerIdPrefix + slotId; } diff --git a/Content.Shared/_Shitmed/Surgery/Conditions/SurgeryOrganConditionComponent.cs b/Content.Shared/_Shitmed/Surgery/Conditions/SurgeryOrganConditionComponent.cs index 53db0430e53..7ddd99f9af8 100644 --- a/Content.Shared/_Shitmed/Surgery/Conditions/SurgeryOrganConditionComponent.cs +++ b/Content.Shared/_Shitmed/Surgery/Conditions/SurgeryOrganConditionComponent.cs @@ -15,4 +15,7 @@ public sealed partial class SurgeryOrganConditionComponent : Component [DataField] public bool Reattaching; -} \ No newline at end of file + + [DataField(required: true)] + public string SlotId = string.Empty; +} diff --git a/Content.Shared/_Shitmed/Surgery/SharedSurgerySystem.cs b/Content.Shared/_Shitmed/Surgery/SharedSurgerySystem.cs index fe12eed8fe7..43917020d1d 100644 --- a/Content.Shared/_Shitmed/Surgery/SharedSurgerySystem.cs +++ b/Content.Shared/_Shitmed/Surgery/SharedSurgerySystem.cs @@ -22,6 +22,7 @@ using Content.Shared.Prototypes; using Content.Shared.Standing; using Robust.Shared.Audio.Systems; +using Robust.Shared.Containers; using Robust.Shared.Map; using Robust.Shared.Network; using Robust.Shared.Prototypes; @@ -47,6 +48,7 @@ public abstract partial class SharedSurgerySystem : EntitySystem [Dependency] private readonly RotateToFaceSystem _rotateToFace = default!; [Dependency] private readonly StandingStateSystem _standing = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; + [Dependency] private readonly SharedContainerSystem _container = default!; /// /// Cache of all surgery prototypes' singleton entities. @@ -265,7 +267,7 @@ private void OnOrganConditionValid(Entity ent, r && !organs.Any(organ => HasComp(organ.Id)))) args.Cancelled = true; } - else if (!ent.Comp.Inverse) + else if (!ent.Comp.Inverse || !_container.TryGetContainer(args.Part, _body.GetOrganContainerId(ent.Comp.SlotId), out _)) args.Cancelled = true; } } diff --git a/Resources/Prototypes/Body/Organs/diona.yml b/Resources/Prototypes/Body/Organs/diona.yml index 72564b1abb7..fb6c819493b 100644 --- a/Resources/Prototypes/Body/Organs/diona.yml +++ b/Resources/Prototypes/Body/Organs/diona.yml @@ -184,6 +184,11 @@ - type: IsDeadIC - type: Body prototype: AnimalNymphBrain + - type: SurgeryTarget + - type: UserInterface + interfaces: + enum.SurgeryUIKey.Key: + type: SurgeryBui - type: entity id: OrganDionaNymphStomach @@ -196,6 +201,11 @@ - type: IsDeadIC - type: Body prototype: AnimalNymphStomach + - type: SurgeryTarget + - type: UserInterface + interfaces: + enum.SurgeryUIKey.Key: + type: SurgeryBui - type: entity id: OrganDionaNymphLungs @@ -208,3 +218,8 @@ - type: IsDeadIC - type: Body prototype: AnimalNymphLungs + - type: SurgeryTarget + - type: UserInterface + interfaces: + enum.SurgeryUIKey.Key: + type: SurgeryBui diff --git a/Resources/Prototypes/Entities/Mobs/Species/skeleton.yml b/Resources/Prototypes/Entities/Mobs/Species/skeleton.yml index 96c61856936..5f9812f4909 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/skeleton.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/skeleton.yml @@ -104,6 +104,7 @@ - type: FireVisuals alternateState: Standing - type: FootPrints + - type: LayingDown - type: entity parent: BaseSpeciesDummy diff --git a/Resources/Prototypes/_Shitmed/Entities/Surgery/surgeries.yml b/Resources/Prototypes/_Shitmed/Entities/Surgery/surgeries.yml index 775716ecff4..44d1f3c1c87 100644 --- a/Resources/Prototypes/_Shitmed/Entities/Surgery/surgeries.yml +++ b/Resources/Prototypes/_Shitmed/Entities/Surgery/surgeries.yml @@ -377,6 +377,16 @@ - type: SurgeryOrganCondition organ: - type: Brain + slotId: brain + +- type: entity + parent: SurgeryRemoveBrain + id: SurgeryRemoveBrainTorso + name: Remove Brain + categories: [ HideSpawnMenu ] + components: + - type: SurgeryPartCondition + part: Torso - type: entity parent: SurgeryBase @@ -397,6 +407,16 @@ - type: Brain inverse: true reattaching: true + slotId: brain + +- type: entity + parent: SurgeryInsertBrain + id: SurgeryInsertBrainTorso + name: Insert Brain + categories: [ HideSpawnMenu ] + components: + - type: SurgeryPartCondition + part: Torso - type: entity parent: SurgeryBase @@ -415,6 +435,7 @@ - type: SurgeryOrganCondition organ: - type: Heart + slotId: heart - type: entity parent: SurgeryBase @@ -435,6 +456,7 @@ - type: Heart inverse: true reattaching: true + slotId: heart - type: entity parent: SurgeryBase @@ -453,6 +475,7 @@ - type: SurgeryOrganCondition organ: - type: Liver + slotId: liver - type: entity parent: SurgeryBase @@ -473,6 +496,7 @@ - type: Liver inverse: true reattaching: true + slotId: liver - type: entity parent: SurgeryBase @@ -491,6 +515,7 @@ - type: SurgeryOrganCondition organ: - type: Lung + slotId: lungs - type: entity parent: SurgeryBase @@ -511,6 +536,7 @@ - type: Lung inverse: true reattaching: true + slotId: lungs - type: entity parent: SurgeryBase @@ -529,6 +555,7 @@ - type: SurgeryOrganCondition organ: - type: Stomach + slotId: stomach - type: entity parent: SurgeryBase @@ -549,6 +576,7 @@ - type: Stomach inverse: true reattaching: true + slotId: stomach - type: entity parent: SurgeryBase @@ -567,6 +595,7 @@ - type: SurgeryOrganCondition organ: - type: Eyes + slotId: eyes - type: entity parent: SurgeryBase @@ -587,6 +616,7 @@ - type: Eyes inverse: true reattaching: true + slotId: eyes - type: entity parent: SurgeryBase @@ -602,6 +632,7 @@ - type: SurgeryOrganCondition organ: - type: Brain + slotId: brain - type: SurgeryOrganOnAddCondition components: brain: @@ -629,6 +660,7 @@ - type: SurgeryOrganCondition organ: - type: Brain + slotId: brain - type: SurgeryOrganOnAddCondition components: brain: From 11aefa955e800332a2ce20d5c33b4878169c60d2 Mon Sep 17 00:00:00 2001 From: Spatison <137375981+Spatison@users.noreply.github.com> Date: Fri, 10 Jan 2025 02:30:42 +1000 Subject: [PATCH 2/2] static --- Content.Shared/Body/Systems/SharedBodySystem.cs | 2 +- Content.Shared/_Shitmed/Surgery/SharedSurgerySystem.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Shared/Body/Systems/SharedBodySystem.cs b/Content.Shared/Body/Systems/SharedBodySystem.cs index 5f3965dde5c..dddb6398005 100644 --- a/Content.Shared/Body/Systems/SharedBodySystem.cs +++ b/Content.Shared/Body/Systems/SharedBodySystem.cs @@ -76,7 +76,7 @@ public static string GetPartSlotContainerId(string slotId) /// /// Gets the container Id for the specified slotId. /// - public string GetOrganContainerId(string slotId) + public static string GetOrganContainerId(string slotId) { return OrganSlotContainerIdPrefix + slotId; } diff --git a/Content.Shared/_Shitmed/Surgery/SharedSurgerySystem.cs b/Content.Shared/_Shitmed/Surgery/SharedSurgerySystem.cs index 43917020d1d..aa47087532b 100644 --- a/Content.Shared/_Shitmed/Surgery/SharedSurgerySystem.cs +++ b/Content.Shared/_Shitmed/Surgery/SharedSurgerySystem.cs @@ -267,7 +267,7 @@ private void OnOrganConditionValid(Entity ent, r && !organs.Any(organ => HasComp(organ.Id)))) args.Cancelled = true; } - else if (!ent.Comp.Inverse || !_container.TryGetContainer(args.Part, _body.GetOrganContainerId(ent.Comp.SlotId), out _)) + else if (!ent.Comp.Inverse || !_container.TryGetContainer(args.Part, SharedBodySystem.GetOrganContainerId(ent.Comp.SlotId), out _)) args.Cancelled = true; } }