From d46ece0bebb56a8de07b6e88e84405ce0bee2b45 Mon Sep 17 00:00:00 2001 From: vanx <61917534+Vaaankas@users.noreply.github.com> Date: Sun, 9 Mar 2025 14:58:26 +0300 Subject: [PATCH] [Fix] Torso Cavity Being Accessible (#300) rezal uristov na lokalke 10 chasov Co-authored-by: vanx --- Content.Shared/Body/Systems/SharedBodySystem.Parts.cs | 4 ++++ .../_Shitmed/Surgery/SharedSurgerySystem.Steps.cs | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs b/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs index 0610d7afe5..7e8b58751e 100644 --- a/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs +++ b/Content.Shared/Body/Systems/SharedBodySystem.Parts.cs @@ -16,6 +16,7 @@ using Robust.Shared.Utility; using Content.Shared._Shitmed.Body.Events; using Content.Shared._Shitmed.Body.Part; using Content.Shared._Shitmed.BodyEffects; +using Content.Shared.Containers.ItemSlots; using Content.Shared.Humanoid; using Content.Shared.Inventory; using Content.Shared.Random; @@ -52,6 +53,9 @@ public partial class SharedBodySystem // This seems to be an issue due to wiz-merge, on my old branch it was properly instantiating // ItemInsertionSlot's container on both ends. It does show up properly on ItemSlotsComponent though. _slots.AddItemSlot(ent, ent.Comp.ContainerName, ent.Comp.ItemInsertionSlot); + + _slots.SetLock(ent.Owner, ent.Comp.ItemInsertionSlot, true); // WWDP prevent inserting items into torsos without surgery + Dirty(ent, ent.Comp); } diff --git a/Content.Shared/_Shitmed/Surgery/SharedSurgerySystem.Steps.cs b/Content.Shared/_Shitmed/Surgery/SharedSurgerySystem.Steps.cs index e6b9814f54..6ad1a261c3 100644 --- a/Content.Shared/_Shitmed/Surgery/SharedSurgerySystem.Steps.cs +++ b/Content.Shared/_Shitmed/Surgery/SharedSurgerySystem.Steps.cs @@ -26,6 +26,8 @@ using Content.Shared.Popups; using Robust.Shared.Prototypes; using Robust.Shared.Toolshed.TypeParsers; using System.Linq; +using Content.Shared.Inventory.VirtualItem; + namespace Content.Shared._Shitmed.Medical.Surgery; @@ -396,15 +398,20 @@ public abstract partial class SharedSurgerySystem if (!TryComp(args.Part, out BodyPartComponent? partComp) || partComp.PartType != BodyPartType.Torso) return; + _itemSlotsSystem.SetLock(args.Part, partComp.ItemInsertionSlot, false); // WWDP prevent inserting items into torsos without surgery + var activeHandEntity = _hands.EnumerateHeld(args.User).FirstOrDefault(); if (activeHandEntity != default && ent.Comp.Action == "Insert" + && !HasComp(activeHandEntity) // WWDP prevent trying to insert virtual items && TryComp(activeHandEntity, out ItemComponent? itemComp) && (itemComp.Size.Id == "Tiny" || itemComp.Size.Id == "Small")) _itemSlotsSystem.TryInsert(ent, partComp.ItemInsertionSlot, activeHandEntity, args.User); else if (ent.Comp.Action == "Remove") _itemSlotsSystem.TryEjectToHands(ent, partComp.ItemInsertionSlot, args.User); + + _itemSlotsSystem.SetLock(args.Part, partComp.ItemInsertionSlot, true); // WWDP prevent inserting items into torsos without surgery } private void OnCavityCheck(Entity ent, ref SurgeryStepCompleteCheckEvent args)