diff --git a/Content.Client/Body/Components/BodyPartComponent.cs b/Content.Client/Body/Components/BodyPartComponent.cs
index b2927372de..127990ee93 100644
--- a/Content.Client/Body/Components/BodyPartComponent.cs
+++ b/Content.Client/Body/Components/BodyPartComponent.cs
@@ -1,5 +1,4 @@
using Content.Shared.Body.Components;
-using Content.Shared.Body.Part;
using Robust.Shared.GameObjects;
namespace Content.Client.Body.Components
diff --git a/Content.Client/Body/Components/MechanismComponent.cs b/Content.Client/Body/Components/MechanismComponent.cs
deleted file mode 100644
index 2ff51766be..0000000000
--- a/Content.Client/Body/Components/MechanismComponent.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Content.Shared.Body.Components;
-using Robust.Shared.GameObjects;
-
-namespace Content.Client.Body.Components
-{
- [RegisterComponent]
- [ComponentReference(typeof(SharedMechanismComponent))]
- public class MechanismComponent : SharedMechanismComponent
- {
- }
-}
diff --git a/Content.Client/Body/UI/BodyScannerDisplay.cs b/Content.Client/Body/UI/BodyScannerDisplay.cs
index 921419d5f8..c1bf89a198 100644
--- a/Content.Client/Body/UI/BodyScannerDisplay.cs
+++ b/Content.Client/Body/UI/BodyScannerDisplay.cs
@@ -161,7 +161,7 @@ namespace Content.Client.Body.UI
UpdateMechanismBox(_currentBodyPart?.Mechanisms.ElementAt(args.ItemIndex));
}
- private void UpdateMechanismBox(SharedMechanismComponent? mechanism)
+ private void UpdateMechanismBox(MechanismComponent? mechanism)
{
// TODO BODY Improve UI
if (mechanism == null)
diff --git a/Content.Client/Body/UI/SurgeryBoundUserInterface.cs b/Content.Client/Body/UI/SurgeryBoundUserInterface.cs
deleted file mode 100644
index 7f5a004b9b..0000000000
--- a/Content.Client/Body/UI/SurgeryBoundUserInterface.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using Content.Shared.Body.Surgery;
-using JetBrains.Annotations;
-using Robust.Client.GameObjects;
-using Robust.Shared.GameObjects;
-
-namespace Content.Client.Body.UI
-{
- // TODO BODY Make window close if target or surgery tool gets too far away from user.
-
- ///
- /// Generic client-side UI list popup that allows users to choose from an option
- /// of limbs or organs to operate on.
- ///
- [UsedImplicitly]
- public class SurgeryBoundUserInterface : BoundUserInterface
- {
- private SurgeryWindow? _window;
-
- public SurgeryBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) { }
-
- protected override void Open()
- {
- _window = new SurgeryWindow();
-
- _window.OpenCentered();
- _window.OnClose += Close;
- }
-
- protected override void ReceiveMessage(BoundUserInterfaceMessage message)
- {
- switch (message)
- {
- case RequestBodyPartSurgeryUIMessage msg:
- HandleBodyPartRequest(msg);
- break;
- case RequestMechanismSurgeryUIMessage msg:
- HandleMechanismRequest(msg);
- break;
- case RequestBodyPartSlotSurgeryUIMessage msg:
- HandleBodyPartSlotRequest(msg);
- break;
- }
- }
-
- private void HandleBodyPartRequest(RequestBodyPartSurgeryUIMessage msg)
- {
- _window?.BuildDisplay(msg.Targets, BodyPartSelectedCallback);
- }
-
- private void HandleMechanismRequest(RequestMechanismSurgeryUIMessage msg)
- {
- _window?.BuildDisplay(msg.Targets, MechanismSelectedCallback);
- }
-
- private void HandleBodyPartSlotRequest(RequestBodyPartSlotSurgeryUIMessage msg)
- {
- _window?.BuildDisplay(msg.Targets, BodyPartSlotSelectedCallback);
- }
-
- private void BodyPartSelectedCallback(int selectedOptionData)
- {
- SendMessage(new ReceiveBodyPartSurgeryUIMessage(selectedOptionData));
- }
-
- private void MechanismSelectedCallback(int selectedOptionData)
- {
- SendMessage(new ReceiveMechanismSurgeryUIMessage(selectedOptionData));
- }
-
- private void BodyPartSlotSelectedCallback(int selectedOptionData)
- {
- SendMessage(new ReceiveBodyPartSlotSurgeryUIMessage(selectedOptionData));
- }
-
- protected override void Dispose(bool disposing)
- {
- base.Dispose(disposing);
-
- if (disposing)
- {
- _window?.Dispose();
- }
- }
- }
-}
diff --git a/Content.Client/Body/UI/SurgeryWindow.cs b/Content.Client/Body/UI/SurgeryWindow.cs
deleted file mode 100644
index 9f8b18c5e0..0000000000
--- a/Content.Client/Body/UI/SurgeryWindow.cs
+++ /dev/null
@@ -1,137 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Robust.Client.UserInterface;
-using Robust.Client.UserInterface.Controls;
-using Robust.Client.UserInterface.CustomControls;
-using Robust.Shared.Localization;
-using Robust.Shared.Maths;
-using static Robust.Client.UserInterface.Controls.BoxContainer;
-
-namespace Content.Client.Body.UI
-{
- public class SurgeryWindow : SS14Window
- {
- public delegate void OptionSelectedCallback(int selectedOptionData);
-
- private readonly BoxContainer _optionsBox;
- private OptionSelectedCallback? _optionSelectedCallback;
-
- public SurgeryWindow()
- {
- MinSize = SetSize = (300, 400);
- Title = Loc.GetString("surgery-window-title");
- RectClipContent = true;
-
- var vSplitContainer = new BoxContainer
- {
- Orientation = LayoutOrientation.Vertical,
- Children =
- {
- new ScrollContainer
- {
- VerticalExpand = true,
- HorizontalExpand = true,
- HScrollEnabled = true,
- VScrollEnabled = true,
- Children =
- {
- (_optionsBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Vertical,
- HorizontalExpand = true
- })
- }
- }
- }
- };
-
- Contents.AddChild(vSplitContainer);
- }
-
- public void BuildDisplay(Dictionary data, OptionSelectedCallback callback)
- {
- _optionsBox.DisposeAllChildren();
- _optionSelectedCallback = callback;
-
- foreach (var (displayText, callbackData) in data)
- {
- var button = new SurgeryButton(callbackData);
-
- button.SetOnToggleBehavior(OnButtonPressed);
- button.SetDisplayText(Loc.GetString(displayText));
-
- _optionsBox.AddChild(button);
- }
- }
-
- private void OnButtonPressed(BaseButton.ButtonEventArgs args)
- {
- if (args.Button.Parent is SurgeryButton surgery)
- {
- _optionSelectedCallback?.Invoke(surgery.CallbackData);
- }
- }
- }
-
- class SurgeryButton : PanelContainer
- {
- public Button Button { get; }
-
- private SpriteView SpriteView { get; }
-
- private Label DisplayText { get; }
-
- public int CallbackData { get; }
-
- public SurgeryButton(int callbackData)
- {
- CallbackData = callbackData;
-
- Button = new Button
- {
- HorizontalExpand = true,
- VerticalExpand = true,
- ToggleMode = true,
- MouseFilter = MouseFilterMode.Stop
- };
-
- AddChild(Button);
-
- AddChild(new BoxContainer
- {
- Orientation = LayoutOrientation.Horizontal,
- Children =
- {
- (SpriteView = new SpriteView
- {
- MinSize = new Vector2(32.0f, 32.0f)
- }),
- (DisplayText = new Label
- {
- VerticalAlignment = VAlignment.Center,
- Text = Loc.GetString("surgery-window-not-available-button-text"),
- }),
- (new Control
- {
- HorizontalExpand = true
- })
- }
- });
- }
-
- public void SetDisplayText(string text)
- {
- DisplayText.Text = text;
- }
-
- public void SetOnToggleBehavior(Action behavior)
- {
- Button.OnToggled += behavior;
- }
-
- public void SetSprite()
- {
- //button.SpriteView.Sprite = sprite;
- }
- }
-}
diff --git a/Content.Client/Commands/HideMechanismsCommand.cs b/Content.Client/Commands/HideMechanismsCommand.cs
index 31236b0fbc..910db5b887 100644
--- a/Content.Client/Commands/HideMechanismsCommand.cs
+++ b/Content.Client/Commands/HideMechanismsCommand.cs
@@ -17,7 +17,7 @@ namespace Content.Client.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var entityManager = IoCManager.Resolve();
- var mechanisms = entityManager.EntityQuery(true);
+ var mechanisms = entityManager.EntityQuery(true);
foreach (var mechanism in mechanisms)
{
diff --git a/Content.Client/Commands/ShowMechanismsCommand.cs b/Content.Client/Commands/ShowMechanismsCommand.cs
index 168bd61c6c..433ee6b13c 100644
--- a/Content.Client/Commands/ShowMechanismsCommand.cs
+++ b/Content.Client/Commands/ShowMechanismsCommand.cs
@@ -19,7 +19,7 @@ namespace Content.Client.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var entityManager = IoCManager.Resolve();
- var mechanisms = entityManager.EntityQuery(true);
+ var mechanisms = entityManager.EntityQuery(true);
foreach (var mechanism in mechanisms)
{
diff --git a/Content.Client/Entry/IgnoredComponents.cs b/Content.Client/Entry/IgnoredComponents.cs
index df3027fd7d..cc85722423 100644
--- a/Content.Client/Entry/IgnoredComponents.cs
+++ b/Content.Client/Entry/IgnoredComponents.cs
@@ -121,7 +121,6 @@ namespace Content.Client.Entry
"Cable",
"StressTestMovement",
"Toys",
- "SurgeryTool",
"EmitSoundOnThrow",
"Salvage",
"SalvageMagnet",
@@ -251,7 +250,6 @@ namespace Content.Client.Entry
"MachineFrame",
"MachineBoard",
"ChemicalAmmo",
- "BiologicalSurgeryData",
"CargoTelepad",
"TraitorDeathMatchRedemption",
"GlassBeaker",
diff --git a/Content.Server/Administration/Commands/AddMechanismCommand.cs b/Content.Server/Administration/Commands/AddMechanismCommand.cs
index b71d0f384c..71a9459348 100644
--- a/Content.Server/Administration/Commands/AddMechanismCommand.cs
+++ b/Content.Server/Administration/Commands/AddMechanismCommand.cs
@@ -1,5 +1,6 @@
using Content.Server.Body.Components;
using Content.Shared.Administration;
+using Content.Shared.Body.Components;
using Robust.Shared.Console;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
diff --git a/Content.Server/Administration/Commands/RemoveMechanismCommand.cs b/Content.Server/Administration/Commands/RemoveMechanismCommand.cs
index 1794580866..6a8d35a249 100644
--- a/Content.Server/Administration/Commands/RemoveMechanismCommand.cs
+++ b/Content.Server/Administration/Commands/RemoveMechanismCommand.cs
@@ -1,5 +1,6 @@
using Content.Server.Body.Components;
using Content.Shared.Administration;
+using Content.Shared.Body.Components;
using Robust.Shared.Console;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
diff --git a/Content.Server/Body/Components/BodyComponent.cs b/Content.Server/Body/Components/BodyComponent.cs
index 9fe11422a0..307f74c562 100644
--- a/Content.Server/Body/Components/BodyComponent.cs
+++ b/Content.Server/Body/Components/BodyComponent.cs
@@ -1,4 +1,3 @@
-using Content.Server.Ghost;
using Content.Shared.Audio;
using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
@@ -16,8 +15,7 @@ namespace Content.Server.Body.Components
{
[RegisterComponent]
[ComponentReference(typeof(SharedBodyComponent))]
- [ComponentReference(typeof(IGhostOnMove))]
- public class BodyComponent : SharedBodyComponent, IGhostOnMove
+ public class BodyComponent : SharedBodyComponent
{
[Dependency] private readonly IEntityManager _entMan = default!;
diff --git a/Content.Server/Body/Components/BodyPartComponent.cs b/Content.Server/Body/Components/BodyPartComponent.cs
index 6cb19ec14f..87a169171e 100644
--- a/Content.Server/Body/Components/BodyPartComponent.cs
+++ b/Content.Server/Body/Components/BodyPartComponent.cs
@@ -1,50 +1,34 @@
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Content.Server.UserInterface;
using Content.Shared.Body.Components;
-using Content.Shared.Body.Surgery;
-using Content.Shared.Interaction;
-using Content.Shared.Popups;
using Content.Shared.Random.Helpers;
-using Robust.Server.GameObjects;
-using Robust.Server.Player;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
-using Robust.Shared.Localization;
using Robust.Shared.Log;
-using Robust.Shared.ViewVariables;
namespace Content.Server.Body.Components
{
[RegisterComponent]
[ComponentReference(typeof(SharedBodyPartComponent))]
- public class BodyPartComponent : SharedBodyPartComponent, IAfterInteract
+ public class BodyPartComponent : SharedBodyPartComponent
{
[Dependency] private readonly IEntityManager _entMan = default!;
- private readonly Dictionary _optionsCache = new();
- private SharedBodyComponent? _owningBodyCache;
- private int _idHash;
- private EntityUid? _surgeonCache;
private Container _mechanismContainer = default!;
- [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(SurgeryUIKey.Key);
-
- public override bool CanAddMechanism(SharedMechanismComponent mechanism)
+ public override bool CanAddMechanism(MechanismComponent mechanism)
{
return base.CanAddMechanism(mechanism) &&
_mechanismContainer.CanInsert(mechanism.Owner);
}
- protected override void OnAddMechanism(SharedMechanismComponent mechanism)
+ protected override void OnAddMechanism(MechanismComponent mechanism)
{
base.OnAddMechanism(mechanism);
_mechanismContainer.Insert(mechanism.Owner);
}
- protected override void OnRemoveMechanism(SharedMechanismComponent mechanism)
+ protected override void OnRemoveMechanism(MechanismComponent mechanism)
{
base.OnRemoveMechanism(mechanism);
@@ -65,156 +49,14 @@ namespace Content.Server.Body.Components
{
var entity = _entMan.SpawnEntity(mechanismId, _entMan.GetComponent(Owner).MapPosition);
- if (!_entMan.TryGetComponent(entity, out SharedMechanismComponent? mechanism))
+ if (!_entMan.TryGetComponent(entity, out MechanismComponent? mechanism))
{
- Logger.Error($"Entity {mechanismId} does not have a {nameof(SharedMechanismComponent)} component.");
+ Logger.Error($"Entity {mechanismId} does not have a {nameof(MechanismComponent)} component.");
continue;
}
TryAddMechanism(mechanism, true);
}
}
-
- protected override void Startup()
- {
- base.Startup();
-
- if (UserInterface != null)
- {
- UserInterface.OnReceiveMessage += OnUIMessage;
- }
-
- foreach (var mechanism in Mechanisms)
- {
- mechanism.Dirty();
- }
- }
-
- async Task IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
- {
- // TODO BODY
- if (eventArgs.Target == null)
- {
- return false;
- }
-
- CloseAllSurgeryUIs();
- _optionsCache.Clear();
- _surgeonCache = null;
- _owningBodyCache = null;
-
- if (_entMan.TryGetComponent(eventArgs.Target.Value, out SharedBodyComponent? body))
- {
- SendSlots(eventArgs, body);
- }
-
- return true;
- }
-
- private void SendSlots(AfterInteractEventArgs eventArgs, SharedBodyComponent body)
- {
- // Create dictionary to send to client (text to be shown : data sent back if selected)
- var toSend = new Dictionary();
-
- // Here we are trying to grab a list of all empty BodySlots adjacent to an existing BodyPart that can be
- // attached to. i.e. an empty left hand slot, connected to an occupied left arm slot would be valid.
- foreach (var slot in body.EmptySlots)
- {
- if (slot.PartType != PartType)
- {
- continue;
- }
-
- foreach (var connection in slot.Connections)
- {
- if (connection.Part == null ||
- !connection.Part.CanAttachPart(this))
- {
- continue;
- }
-
- _optionsCache.Add(_idHash, slot);
- toSend.Add(slot.Id, _idHash++);
- }
- }
-
- if (_optionsCache.Count > 0)
- {
- OpenSurgeryUI(_entMan.GetComponent(eventArgs.User).PlayerSession);
- BodyPartSlotRequest(_entMan.GetComponent(eventArgs.User).PlayerSession,
- toSend);
- _surgeonCache = eventArgs.User;
- _owningBodyCache = body;
- }
- else // If surgery cannot be performed, show message saying so.
- {
- eventArgs.Target?.PopupMessage(eventArgs.User,
- Loc.GetString("bodypart-component-no-way-to-install-message", ("partName", Owner)));
- }
- }
-
- ///
- /// Called after the client chooses from a list of possible
- /// BodyPartSlots to install the limb on.
- ///
- private void ReceiveBodyPartSlot(int key)
- {
- if (_surgeonCache == null ||
- !_entMan.TryGetComponent(_surgeonCache.Value, out ActorComponent? actor))
- {
- return;
- }
-
- CloseSurgeryUI(actor.PlayerSession);
-
- if (_owningBodyCache == null)
- {
- return;
- }
-
- // TODO: sanity checks to see whether user is in range, user is still able-bodied, target is still the same, etc etc
- if (!_optionsCache.TryGetValue(key, out var targetObject))
- {
- _owningBodyCache.Owner.PopupMessage(_surgeonCache.Value,
- Loc.GetString("bodypart-component-no-way-to-attach-message", ("partName", Owner)));
- }
-
- var target = (string) targetObject!;
- var message = _owningBodyCache.TryAddPart(target, this)
- ? Loc.GetString("bodypart-component-attach-success-message",("partName", Owner))
- : Loc.GetString("bodypart-component-attach-fail-message",("partName", Owner));
-
- _owningBodyCache.Owner.PopupMessage(_surgeonCache.Value, message);
- }
-
- private void OpenSurgeryUI(IPlayerSession session)
- {
- UserInterface?.Open(session);
- }
-
- private void BodyPartSlotRequest(IPlayerSession session, Dictionary options)
- {
- UserInterface?.SendMessage(new RequestBodyPartSlotSurgeryUIMessage(options), session);
- }
-
- private void CloseSurgeryUI(IPlayerSession session)
- {
- UserInterface?.Close(session);
- }
-
- private void CloseAllSurgeryUIs()
- {
- UserInterface?.CloseAll();
- }
-
- private void OnUIMessage(ServerBoundUserInterfaceMessage message)
- {
- switch (message.Message)
- {
- case ReceiveBodyPartSlotSurgeryUIMessage msg:
- ReceiveBodyPartSlot(msg.SelectedOptionId);
- break;
- }
- }
}
}
diff --git a/Content.Server/Body/Components/MechanismComponent.cs b/Content.Server/Body/Components/MechanismComponent.cs
deleted file mode 100644
index ec5f538c4c..0000000000
--- a/Content.Server/Body/Components/MechanismComponent.cs
+++ /dev/null
@@ -1,161 +0,0 @@
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Content.Server.UserInterface;
-using Content.Shared.Body.Components;
-using Content.Shared.Body.Surgery;
-using Content.Shared.Interaction;
-using Content.Shared.Popups;
-using Robust.Server.GameObjects;
-using Robust.Server.Player;
-using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
-using Robust.Shared.Localization;
-using Robust.Shared.Utility;
-using Robust.Shared.ViewVariables;
-
-namespace Content.Server.Body.Components
-{
- [RegisterComponent]
- [ComponentReference(typeof(SharedMechanismComponent))]
- public class MechanismComponent : SharedMechanismComponent, IAfterInteract
- {
- [Dependency] private readonly IEntityManager _entities = default!;
-
- [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(SurgeryUIKey.Key);
-
- protected override void Initialize()
- {
- base.Initialize();
-
- if (UserInterface != null)
- {
- UserInterface.OnReceiveMessage += OnUIMessage;
- }
- }
-
- async Task IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
- {
- if (eventArgs.Target == null)
- {
- return false;
- }
-
- CloseAllSurgeryUIs();
- OptionsCache.Clear();
- PerformerCache = null;
- BodyCache = null;
-
- if (_entities.TryGetComponent(eventArgs.Target.Value, out SharedBodyComponent? body))
- {
- SendBodyPartListToUser(eventArgs, body);
- }
- else if (_entities.TryGetComponent(eventArgs.Target.Value, out var part))
- {
- DebugTools.AssertNotNull(part);
-
- if (!part.TryAddMechanism(this))
- {
- eventArgs.Target.Value.PopupMessage(eventArgs.User, Loc.GetString("mechanism-component-cannot-fit-message"));
- }
- }
-
- return true;
- }
-
- private void SendBodyPartListToUser(AfterInteractEventArgs eventArgs, SharedBodyComponent body)
- {
- // Create dictionary to send to client (text to be shown : data sent back if selected)
- var toSend = new Dictionary();
-
- foreach (var (part, slot) in body.Parts)
- {
- // For each limb in the target, add it to our cache if it is a valid option.
- if (part.CanAddMechanism(this))
- {
- OptionsCache.Add(IdHash, slot);
- toSend.Add(part + ": " + part.Name, IdHash++);
- }
- }
-
- if (OptionsCache.Count > 0 &&
- _entities.TryGetComponent(eventArgs.User, out ActorComponent? actor))
- {
- OpenSurgeryUI(actor.PlayerSession);
- UpdateSurgeryUIBodyPartRequest(actor.PlayerSession, toSend);
- PerformerCache = eventArgs.User;
- BodyCache = body;
- }
- else // If surgery cannot be performed, show message saying so.
- {
- eventArgs.Target?.PopupMessage(eventArgs.User,
- Loc.GetString("mechanism-component-no-way-to-install-message", ("partName", Name: _entities.GetComponent(Owner).EntityName)));
- }
- }
-
- ///
- /// Called after the client chooses from a list of possible BodyParts that can be operated on.
- ///
- private void HandleReceiveBodyPart(int key)
- {
- if (PerformerCache == null ||
- !_entities.TryGetComponent(PerformerCache.Value, out ActorComponent? actor))
- {
- return;
- }
-
- CloseSurgeryUI(actor.PlayerSession);
-
- if (BodyCache == null)
- {
- return;
- }
-
- // TODO: sanity checks to see whether user is in range, user is still able-bodied, target is still the same, etc etc
- if (!OptionsCache.TryGetValue(key, out var targetObject))
- {
- BodyCache.Owner.PopupMessage(PerformerCache.Value,
- Loc.GetString("mechanism-component-no-useful-way-to-use-message",("partName", Name: _entities.GetComponent(Owner).EntityName)));
- return;
- }
-
- var target = (SharedBodyPartComponent) targetObject;
- var message = target.TryAddMechanism(this)
- ? Loc.GetString("mechanism-component-jam-inside-message",("ownerName", Owner),("them", PerformerCache))
- : Loc.GetString("mechanism-component-cannot-fit-message");
-
- BodyCache.Owner.PopupMessage(PerformerCache.Value, message);
-
- // TODO: {1:theName}
- }
-
- private void OpenSurgeryUI(IPlayerSession session)
- {
- UserInterface?.Open(session);
- }
-
- private void UpdateSurgeryUIBodyPartRequest(IPlayerSession session, Dictionary options)
- {
- UserInterface?.SendMessage(new RequestBodyPartSurgeryUIMessage(options), session);
- }
-
- private void CloseSurgeryUI(IPlayerSession session)
- {
- UserInterface?.Close(session);
- }
-
- private void CloseAllSurgeryUIs()
- {
- UserInterface?.CloseAll();
- }
-
- private void OnUIMessage(ServerBoundUserInterfaceMessage message)
- {
- switch (message.Message)
- {
- case ReceiveBodyPartSurgeryUIMessage msg:
- HandleReceiveBodyPart(msg.SelectedOptionId);
- break;
- }
- }
- }
-}
diff --git a/Content.Server/Body/Surgery/BiologicalSurgeryDataComponent.cs b/Content.Server/Body/Surgery/BiologicalSurgeryDataComponent.cs
deleted file mode 100644
index 1feb8d04be..0000000000
--- a/Content.Server/Body/Surgery/BiologicalSurgeryDataComponent.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Content.Server.DoAfter;
-using Content.Shared.Body.Components;
-using Content.Shared.Body.Part;
-using Content.Shared.Body.Surgery;
-using Content.Shared.Popups;
-using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
-using Robust.Shared.Localization;
-using static Content.Shared.Body.Surgery.ISurgeryData;
-
-namespace Content.Server.Body.Surgery
-{
- ///
- /// Data class representing the surgery state of a biological entity.
- ///
- [RegisterComponent]
- [ComponentReference(typeof(ISurgeryData))]
- public class BiologicalSurgeryDataComponent : Component, ISurgeryData
- {
- [Dependency] private readonly IEntityManager _entMan = default!;
-
- public override string Name => "BiologicalSurgeryData";
-
- private readonly HashSet _disconnectedOrgans = new();
-
- private bool SkinOpened { get; set; }
-
- private bool SkinRetracted { get; set; }
-
- private bool VesselsClamped { get; set; }
-
- public SharedBodyPartComponent? Parent => _entMan.GetComponentOrNull(Owner);
-
- public BodyPartType? ParentType => Parent?.PartType;
-
- private void AddDisconnectedOrgan(SharedMechanismComponent mechanism)
- {
- if (_disconnectedOrgans.Add(mechanism))
- {
- Dirty();
- }
- }
-
- private void RemoveDisconnectedOrgan(SharedMechanismComponent mechanism)
- {
- if (_disconnectedOrgans.Remove(mechanism))
- {
- Dirty();
- }
- }
-
- private async Task SurgeryDoAfter(EntityUid performer)
- {
- if (!_entMan.HasComponent(performer))
- {
- return true;
- }
-
- var doAfterSystem = EntitySystem.Get();
- var target = Parent?.Body?.Owner ?? Owner;
- var args = new DoAfterEventArgs(performer, 3, target: target)
- {
- BreakOnUserMove = true,
- BreakOnTargetMove = true
- };
-
- return await doAfterSystem.WaitDoAfter(args) == DoAfterStatus.Finished;
- }
-
- private bool HasIncisionNotClamped()
- {
- return SkinOpened && !VesselsClamped;
- }
-
- private bool HasClampedIncisionNotRetracted()
- {
- return SkinOpened && VesselsClamped && !SkinRetracted;
- }
-
- private bool HasFullyOpenIncision()
- {
- return SkinOpened && VesselsClamped && SkinRetracted;
- }
-
- public string GetDescription()
- {
- if (Parent == null)
- {
- return string.Empty;
- }
-
- var toReturn = new StringBuilder();
-
- if (HasIncisionNotClamped())
- {
- toReturn.Append(Loc.GetString("biological-surgery-data-component-has-incision-not-clamped-message",
- ("owner", Owner),("bodyPart", Parent.Name)));
- }
- else if (HasClampedIncisionNotRetracted())
- {
- toReturn.AppendLine(Loc.GetString("biological-surgery-data-component-has-clamped-incision-not-retracted-message",
- ("owner", Owner),("bodyPary", Parent.Name)));
- }
- else if (HasFullyOpenIncision())
- {
- toReturn.AppendLine(Loc.GetString("biological-surgery-data-component-has-fully-open-incision-message", ("owner", Owner), ("bodyPart", Parent.Name)) + "\n");
- foreach (var mechanism in _disconnectedOrgans)
- {
- toReturn.AppendLine(Loc.GetString("biological-surgery-data-component-part-is-loose-message",("owner", Owner), ("bodyPart", mechanism.Name)));
- }
- }
-
- return toReturn.ToString();
- }
-
- public bool CanAddMechanism(SharedMechanismComponent mechanism)
- {
- return Parent != null &&
- SkinOpened &&
- VesselsClamped &&
- SkinRetracted;
- }
-
- public bool CanAttachBodyPart(SharedBodyPartComponent part)
- {
- return Parent != null;
- // TODO BODY if a part is disconnected, you should have to do some surgery to allow another body part to be attached.
- }
-
- public SurgeryAction? GetSurgeryStep(SurgeryType toolType)
- {
- if (Parent == null)
- {
- return null;
- }
-
- if (toolType == SurgeryType.Amputation)
- {
- return RemoveBodyPartSurgery;
- }
-
- if (!SkinOpened)
- {
- // Case: skin is normal.
- if (toolType == SurgeryType.Incision)
- {
- return OpenSkinSurgery;
- }
- }
- else if (!VesselsClamped)
- {
- // Case: skin is opened, but not clamped.
- switch (toolType)
- {
- case SurgeryType.VesselCompression:
- return ClampVesselsSurgery;
- case SurgeryType.Cauterization:
- return CauterizeIncisionSurgery;
- }
- }
- else if (!SkinRetracted)
- {
- // Case: skin is opened and clamped, but not retracted.
- switch (toolType)
- {
- case SurgeryType.Retraction:
- return RetractSkinSurgery;
- case SurgeryType.Cauterization:
- return CauterizeIncisionSurgery;
- }
- }
- else
- {
- // Case: skin is fully open.
- if (Parent.Mechanisms.Count > 0 &&
- toolType == SurgeryType.VesselCompression)
- {
- if (_disconnectedOrgans.Except(Parent.Mechanisms).Count() != 0 ||
- Parent.Mechanisms.Except(_disconnectedOrgans).Count() != 0)
- {
- return LoosenOrganSurgery;
- }
- }
-
- if (_disconnectedOrgans.Count > 0 && toolType == SurgeryType.Incision)
- {
- return RemoveOrganSurgery;
- }
-
- if (toolType == SurgeryType.Cauterization)
- {
- return CauterizeIncisionSurgery;
- }
- }
-
- return null;
- }
-
- public bool CheckSurgery(SurgeryType toolType)
- {
- return GetSurgeryStep(toolType) != null;
- }
-
- public bool PerformSurgery(SurgeryType surgeryType, IBodyPartContainer container, ISurgeon surgeon, EntityUid performer)
- {
- var step = GetSurgeryStep(surgeryType);
-
- if (step == null)
- {
- return false;
- }
-
- step(container, surgeon, performer);
- return true;
- }
-
- private async void OpenSkinSurgery(IBodyPartContainer container, ISurgeon surgeon, EntityUid performer)
- {
- if (Parent == null)
- {
- return;
- }
-
- performer.PopupMessage(Loc.GetString("biological-surgery-data-component-open-skin-message"));
-
- if (await SurgeryDoAfter(performer))
- {
- SkinOpened = true;
- }
- }
-
- private async void ClampVesselsSurgery(IBodyPartContainer container, ISurgeon surgeon, EntityUid performer)
- {
- if (Parent == null) return;
-
- performer.PopupMessage(Loc.GetString("biological-surgery-data-component-clamp-vessels-message"));
-
- if (await SurgeryDoAfter(performer))
- {
- VesselsClamped = true;
- }
- }
-
- private async void RetractSkinSurgery(IBodyPartContainer container, ISurgeon surgeon, EntityUid performer)
- {
- if (Parent == null) return;
-
- performer.PopupMessage(Loc.GetString("biological-surgery-data-component-retract-skin-message"));
-
- if (await SurgeryDoAfter(performer))
- {
- SkinRetracted = true;
- }
- }
-
- private async void CauterizeIncisionSurgery(IBodyPartContainer container, ISurgeon surgeon, EntityUid performer)
- {
- if (Parent == null) return;
-
- performer.PopupMessage(Loc.GetString("biological-surgery-data-component-cauterize-incision-message"));
-
- if (await SurgeryDoAfter(performer))
- {
- SkinOpened = false;
- VesselsClamped = false;
- SkinRetracted = false;
- }
- }
-
- private void LoosenOrganSurgery(IBodyPartContainer container, ISurgeon surgeon, EntityUid performer)
- {
- if (Parent == null) return;
- if (Parent.Mechanisms.Count <= 0) return;
-
- var toSend = new List();
- foreach (var mechanism in Parent.Mechanisms)
- {
- if (!_disconnectedOrgans.Contains(mechanism))
- {
- toSend.Add(mechanism);
- }
- }
-
- if (toSend.Count > 0)
- {
- surgeon.RequestMechanism(toSend, LoosenOrganSurgeryCallback);
- }
- }
-
- private async void LoosenOrganSurgeryCallback(SharedMechanismComponent? target, IBodyPartContainer container, ISurgeon surgeon,
- EntityUid performer)
- {
- if (Parent == null || target == null || !Parent.Mechanisms.Contains(target))
- {
- return;
- }
-
- performer.PopupMessage(Loc.GetString("biological-surgery-data-component-loosen-organ-message"));
-
- if (!_entMan.HasComponent(performer))
- {
- AddDisconnectedOrgan(target);
- return;
- }
-
- if (await SurgeryDoAfter(performer))
- {
- AddDisconnectedOrgan(target);
- }
- }
-
- private void RemoveOrganSurgery(IBodyPartContainer container, ISurgeon surgeon, EntityUid performer)
- {
- if (Parent == null) return;
-
- if (_disconnectedOrgans.Count <= 0)
- {
- return;
- }
-
- if (_disconnectedOrgans.Count == 1)
- {
- RemoveOrganSurgeryCallback(_disconnectedOrgans.First(), container, surgeon, performer);
- }
- else
- {
- surgeon.RequestMechanism(_disconnectedOrgans, RemoveOrganSurgeryCallback);
- }
- }
-
- private async void RemoveOrganSurgeryCallback(SharedMechanismComponent? target, IBodyPartContainer container, ISurgeon surgeon,
- EntityUid performer)
- {
- if (Parent == null || target == null || !Parent.Mechanisms.Contains(target))
- {
- return;
- }
-
- performer.PopupMessage(Loc.GetString("biological-surgery-data-component-remove-organ-message"));
-
- if (!_entMan.HasComponent(performer))
- {
- Parent.RemoveMechanism(target, _entMan.GetComponent(performer).Coordinates);
- RemoveDisconnectedOrgan(target);
- return;
- }
-
- if (await SurgeryDoAfter(performer))
- {
- Parent.RemoveMechanism(target, _entMan.GetComponent(performer).Coordinates);
- RemoveDisconnectedOrgan(target);
- }
- }
-
- private async void RemoveBodyPartSurgery(IBodyPartContainer container, ISurgeon surgeon, EntityUid performer)
- {
- if (Parent == null) return;
- if (container is not SharedBodyComponent body) return;
-
- performer.PopupMessage(Loc.GetString("biological-surgery-data-component-remove-bodypart-message"));
-
- if (await SurgeryDoAfter(performer))
- {
- body.RemovePart(Parent);
- }
- }
- }
-}
diff --git a/Content.Server/Body/Surgery/Components/SurgeryToolComponent.cs b/Content.Server/Body/Surgery/Components/SurgeryToolComponent.cs
deleted file mode 100644
index 70ccfd94d5..0000000000
--- a/Content.Server/Body/Surgery/Components/SurgeryToolComponent.cs
+++ /dev/null
@@ -1,278 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Content.Server.Body.Components;
-using Content.Server.Body.Surgery.Messages;
-using Content.Server.UserInterface;
-using Content.Shared.Body.Components;
-using Content.Shared.Body.Surgery;
-using Content.Shared.Interaction;
-using Content.Shared.Popups;
-using Robust.Server.GameObjects;
-using Robust.Server.Player;
-using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
-using Robust.Shared.Localization;
-using Robust.Shared.Log;
-using Robust.Shared.Serialization.Manager.Attributes;
-using Robust.Shared.ViewVariables;
-
-namespace Content.Server.Body.Surgery.Components
-{
- ///
- /// Server-side component representing a generic tool capable of performing surgery.
- /// For instance, the scalpel.
- ///
- [RegisterComponent]
- public class SurgeryToolComponent : Component, ISurgeon, IAfterInteract
- {
- [Dependency] private readonly IEntityManager _entities = default!;
-
- public override string Name => "SurgeryTool";
-
- private readonly Dictionary _optionsCache = new();
-
- [DataField("baseOperateTime")]
- private float _baseOperateTime = 5;
-
- private ISurgeon.MechanismRequestCallback? _callbackCache;
-
- private int _idHash;
-
- [DataField("surgeryType")]
- private SurgeryType _surgeryType = SurgeryType.Incision;
-
- [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(SurgeryUIKey.Key);
-
- public SharedBodyComponent? BodyCache { get; private set; }
-
- public EntityUid? PerformerCache { get; private set; }
-
- async Task IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
- {
- if (eventArgs.Target == null)
- {
- return false;
- }
-
- if (!_entities.TryGetComponent(eventArgs.User, out ActorComponent? actor))
- {
- return false;
- }
-
- CloseAllSurgeryUIs();
-
- // Attempt surgery on a body by sending a list of operable parts for the client to choose from
- if (_entities.TryGetComponent(eventArgs.Target.Value, out SharedBodyComponent? body))
- {
- // Create dictionary to send to client (text to be shown : data sent back if selected)
- var toSend = new Dictionary();
-
- foreach (var (part, slot) in body.Parts)
- {
- // For each limb in the target, add it to our cache if it is a valid option.
- if (part.SurgeryCheck(_surgeryType))
- {
- _optionsCache.Add(_idHash, part);
- toSend.Add(slot.Id + ": " + part.Name, _idHash++);
- }
- }
-
- if (_optionsCache.Count > 0)
- {
- OpenSurgeryUI(actor.PlayerSession);
- UpdateSurgeryUIBodyPartRequest(actor.PlayerSession, toSend);
- PerformerCache = eventArgs.User; // Also, cache the data.
- BodyCache = body;
- }
- else // If surgery cannot be performed, show message saying so.
- {
- NotUsefulPopup();
- }
- }
- else if (_entities.TryGetComponent(eventArgs.Target.Value, out var part))
- {
- // Attempt surgery on a DroppedBodyPart - there's only one possible target so no need for selection UI
- PerformerCache = eventArgs.User;
-
- // If surgery can be performed...
- if (!part.SurgeryCheck(_surgeryType))
- {
- NotUsefulPopup();
- return true;
- }
-
- // ...do the surgery.
- if (part.AttemptSurgery(_surgeryType, part, this,
- eventArgs.User))
- {
- return true;
- }
-
- // Log error if the surgery fails somehow.
- Logger.Debug($"Error when trying to perform surgery on ${nameof(SharedBodyPartComponent)} {_entities.GetComponent(eventArgs.User).EntityName}");
- throw new InvalidOperationException();
- }
-
- return true;
- }
-
- public float BaseOperationTime { get => _baseOperateTime; set => _baseOperateTime = value; }
-
- public void RequestMechanism(IEnumerable options, ISurgeon.MechanismRequestCallback callback)
- {
- var toSend = new Dictionary();
- foreach (var mechanism in options)
- {
- _optionsCache.Add(_idHash, mechanism);
- toSend.Add(mechanism.Name, _idHash++);
- }
-
- if (_optionsCache.Count > 0 && PerformerCache != null)
- {
- OpenSurgeryUI(_entities.GetComponent(PerformerCache.Value).PlayerSession);
- UpdateSurgeryUIMechanismRequest(_entities.GetComponent(PerformerCache.Value).PlayerSession,
- toSend);
- _callbackCache = callback;
- }
- else
- {
- Logger.Debug("Error on callback from mechanisms: there were no viable options to choose from!");
- throw new InvalidOperationException();
- }
- }
-
- protected override void Initialize()
- {
- base.Initialize();
-
- if (UserInterface != null)
- {
- UserInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
- }
- }
-
- private void OpenSurgeryUI(IPlayerSession session)
- {
- UserInterface?.Open(session);
-
- var message = new SurgeryWindowOpenMessage(this);
-
-#pragma warning disable 618
- SendMessage(message);
-#pragma warning restore 618
- _entities.EventBus.RaiseEvent(EventSource.Local, message);
- }
-
- private void UpdateSurgeryUIBodyPartRequest(IPlayerSession session, Dictionary options)
- {
- UserInterface?.SendMessage(new RequestBodyPartSurgeryUIMessage(options), session);
- }
-
- private void UpdateSurgeryUIMechanismRequest(IPlayerSession session, Dictionary options)
- {
- UserInterface?.SendMessage(new RequestMechanismSurgeryUIMessage(options), session);
- }
-
- private void ClearUIData()
- {
- _optionsCache.Clear();
-
- PerformerCache = null;
- BodyCache = null;
- _callbackCache = null;
- }
-
- private void CloseSurgeryUI(IPlayerSession session)
- {
- UserInterface?.Close(session);
- ClearUIData();
- }
-
- public void CloseAllSurgeryUIs()
- {
- UserInterface?.CloseAll();
- ClearUIData();
- }
-
- private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage message)
- {
- switch (message.Message)
- {
- case ReceiveBodyPartSurgeryUIMessage msg:
- HandleReceiveBodyPart(msg.SelectedOptionId);
- break;
- case ReceiveMechanismSurgeryUIMessage msg:
- HandleReceiveMechanism(msg.SelectedOptionId);
- break;
- }
- }
-
- ///
- /// Called after the client chooses from a list of possible
- /// that can be operated on.
- ///
- private void HandleReceiveBodyPart(int key)
- {
- if (PerformerCache == null ||
- !_entities.TryGetComponent(PerformerCache.Value, out ActorComponent? actor))
- {
- return;
- }
-
- CloseSurgeryUI(actor.PlayerSession);
- // TODO: sanity checks to see whether user is in range, user is still able-bodied, target is still the same, etc etc
- if (!_optionsCache.TryGetValue(key, out var targetObject) ||
- BodyCache == null)
- {
- NotUsefulAnymorePopup();
- return;
- }
-
- var target = (SharedBodyPartComponent) targetObject;
-
- // TODO BODY Reconsider
- if (!target.AttemptSurgery(_surgeryType, BodyCache, this, PerformerCache.Value))
- {
- NotUsefulAnymorePopup();
- }
- }
-
- ///
- /// Called after the client chooses from a list of possible
- /// to choose from.
- ///
- private void HandleReceiveMechanism(int key)
- {
- // TODO: sanity checks to see whether user is in range, user is still able-bodied, target is still the same, etc etc
- if (BodyCache == null ||
- !_optionsCache.TryGetValue(key, out var targetObject) ||
- targetObject is not MechanismComponent target ||
- PerformerCache == null ||
- !_entities.TryGetComponent(PerformerCache.Value, out ActorComponent? actor))
- {
- NotUsefulAnymorePopup();
- return;
- }
-
- CloseSurgeryUI(actor.PlayerSession);
- _callbackCache?.Invoke(target, BodyCache, this, PerformerCache.Value);
- }
-
- private void NotUsefulPopup()
- {
- if (PerformerCache == null) return;
-
- BodyCache?.Owner.PopupMessage(PerformerCache.Value,
- Loc.GetString("surgery-tool-component-not-useful-message", ("bodyPart", Owner)));
- }
-
- private void NotUsefulAnymorePopup()
- {
- if (PerformerCache == null) return;
-
- BodyCache?.Owner.PopupMessage(PerformerCache.Value,
- Loc.GetString("surgery-tool-component-not-useful-anymore-message", ("bodyPart", Owner)));
- }
- }
-}
diff --git a/Content.Server/Body/Surgery/Components/SurgeryToolSystem.cs b/Content.Server/Body/Surgery/Components/SurgeryToolSystem.cs
deleted file mode 100644
index 279e71b7e7..0000000000
--- a/Content.Server/Body/Surgery/Components/SurgeryToolSystem.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using System.Collections.Generic;
-using Content.Server.Body.Surgery.Messages;
-using Content.Shared.ActionBlocker;
-using Content.Shared.GameTicking;
-using Content.Shared.Interaction.Helpers;
-using JetBrains.Annotations;
-using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
-
-namespace Content.Server.Body.Surgery.Components
-{
- [UsedImplicitly]
- public class SurgeryToolSystem : EntitySystem
- {
- [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
-
- private readonly HashSet _openSurgeryUIs = new();
-
- public override void Initialize()
- {
- base.Initialize();
-
- SubscribeLocalEvent(Reset);
- SubscribeLocalEvent(OnSurgeryWindowOpen);
- SubscribeLocalEvent(OnSurgeryWindowClose);
- }
-
- public void Reset(RoundRestartCleanupEvent ev)
- {
- _openSurgeryUIs.Clear();
- }
-
- private void OnSurgeryWindowOpen(SurgeryWindowOpenMessage ev)
- {
- _openSurgeryUIs.Add(ev.Tool);
- }
-
- private void OnSurgeryWindowClose(SurgeryWindowCloseMessage ev)
- {
- _openSurgeryUIs.Remove(ev.Tool);
- }
-
- public override void Update(float frameTime)
- {
- base.Update(frameTime);
-
- foreach (var tool in _openSurgeryUIs)
- {
- if (tool.PerformerCache == null)
- {
- continue;
- }
-
- if (tool.BodyCache == null)
- {
- continue;
- }
-
- if (!_actionBlockerSystem.CanInteract(tool.PerformerCache.Value) ||
- !tool.PerformerCache.Value.InRangeUnobstructed(tool.BodyCache))
- {
- tool.CloseAllSurgeryUIs();
- }
- }
- }
- }
-}
diff --git a/Content.Server/Body/Surgery/Messages/SurgeryWindowCloseMessage.cs b/Content.Server/Body/Surgery/Messages/SurgeryWindowCloseMessage.cs
deleted file mode 100644
index 85ce551bea..0000000000
--- a/Content.Server/Body/Surgery/Messages/SurgeryWindowCloseMessage.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using Content.Server.Body.Surgery.Components;
-
-namespace Content.Server.Body.Surgery.Messages
-{
- public class SurgeryWindowCloseMessage
- {
- public SurgeryWindowCloseMessage(SurgeryToolComponent tool)
- {
- Tool = tool;
- }
-
- public SurgeryToolComponent Tool { get; }
- }
-}
diff --git a/Content.Server/Body/Surgery/Messages/SurgeryWindowOpenMessage.cs b/Content.Server/Body/Surgery/Messages/SurgeryWindowOpenMessage.cs
deleted file mode 100644
index 1c305079d6..0000000000
--- a/Content.Server/Body/Surgery/Messages/SurgeryWindowOpenMessage.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using Content.Server.Body.Surgery.Components;
-using Robust.Shared.GameObjects;
-
-namespace Content.Server.Body.Surgery.Messages
-{
-#pragma warning disable 618
- public class SurgeryWindowOpenMessage : ComponentMessage
-#pragma warning restore 618
- {
- public SurgeryWindowOpenMessage(SurgeryToolComponent tool)
- {
- Tool = tool;
- }
-
- public SurgeryToolComponent Tool { get; }
- }
-}
diff --git a/Content.Server/Body/Systems/BodySystem.cs b/Content.Server/Body/Systems/BodySystem.cs
index b776965d24..a9d0e0be50 100644
--- a/Content.Server/Body/Systems/BodySystem.cs
+++ b/Content.Server/Body/Systems/BodySystem.cs
@@ -41,13 +41,13 @@ namespace Content.Server.Body.Systems
}
///
- /// Returns a list of ValueTuples of and SharedMechanismComponent on each mechanism
+ /// Returns a list of ValueTuples of and MechanismComponent on each mechanism
/// in the given body.
///
/// The entity to check for the component on.
/// The body to check for mechanisms on.
/// The component to check for.
- public IEnumerable<(T Comp, SharedMechanismComponent Mech)> GetComponentsOnMechanisms(EntityUid uid,
+ public IEnumerable<(T Comp, MechanismComponent Mech)> GetComponentsOnMechanisms(EntityUid uid,
SharedBodyComponent? body=null) where T : Component
{
if (!Resolve(uid, ref body))
@@ -62,7 +62,7 @@ namespace Content.Server.Body.Systems
}
///
- /// Tries to get a list of ValueTuples of and SharedMechanismComponent on each mechanism
+ /// Tries to get a list of ValueTuples of and MechanismComponent on each mechanism
/// in the given body.
///
/// The entity to check for the component on.
@@ -71,7 +71,7 @@ namespace Content.Server.Body.Systems
/// The component to check for.
/// Whether any were found.
public bool TryGetComponentsOnMechanisms(EntityUid uid,
- [NotNullWhen(true)] out IEnumerable<(T Comp, SharedMechanismComponent Mech)>? comps,
+ [NotNullWhen(true)] out IEnumerable<(T Comp, MechanismComponent Mech)>? comps,
SharedBodyComponent? body=null) where T: Component
{
if (!Resolve(uid, ref body))
diff --git a/Content.Server/Body/Systems/BrainSystem.cs b/Content.Server/Body/Systems/BrainSystem.cs
index 0cb64b4756..e7a84a6fba 100644
--- a/Content.Server/Body/Systems/BrainSystem.cs
+++ b/Content.Server/Body/Systems/BrainSystem.cs
@@ -1,8 +1,9 @@
using Content.Server.Body.Components;
-using Content.Server.Ghost;
using Content.Server.Ghost.Components;
using Content.Server.Mind.Components;
+using Content.Shared.Body.Components;
using Content.Shared.Body.Events;
+using Content.Shared.MobState.Components;
using Content.Shared.Movement.Components;
using Robust.Shared.GameObjects;
@@ -14,12 +15,12 @@ namespace Content.Server.Body.Systems
{
base.Initialize();
- SubscribeLocalEvent((uid, component, args) => HandleMind((args.Body).Owner, uid));
- SubscribeLocalEvent((uid, component, args) => HandleMind((args.Part).Owner, uid));
- SubscribeLocalEvent((uid, component, args) => HandleMind((args.Body).Owner, uid));
+ SubscribeLocalEvent((uid, _, args) => HandleMind((args.Body).Owner, uid));
+ SubscribeLocalEvent((uid, _, args) => HandleMind((args.Part).Owner, uid));
+ SubscribeLocalEvent((uid, _, args) => HandleMind((args.Body).Owner, uid));
SubscribeLocalEvent(OnRemovedFromBody);
- SubscribeLocalEvent((uid, component, args) => HandleMind(uid, (args.Old).Owner));
- SubscribeLocalEvent((uid, component, args) => HandleMind((args.OldBody).Owner, uid));
+ SubscribeLocalEvent((uid, _, args) => HandleMind(uid, (args.Old).Owner));
+ SubscribeLocalEvent((uid, _, args) => HandleMind((args.OldBody).Owner, uid));
}
private void OnRemovedFromBody(EntityUid uid, BrainComponent component, RemovedFromBodyEvent args)
@@ -36,8 +37,9 @@ namespace Content.Server.Body.Systems
EntityManager.EnsureComponent(newEntity);
var oldMind = EntityManager.EnsureComponent(oldEntity);
- if (!EntityManager.HasComponent(newEntity))
- EntityManager.AddComponent(newEntity);
+ EnsureComp(newEntity);
+ if (HasComp(newEntity))
+ Comp(newEntity).MustBeDead = true;
// TODO: This is an awful solution.
if (!EntityManager.HasComponent(newEntity))
diff --git a/Content.Server/Body/Systems/LungSystem.cs b/Content.Server/Body/Systems/LungSystem.cs
index 9714875512..3d0f5dd0d4 100644
--- a/Content.Server/Body/Systems/LungSystem.cs
+++ b/Content.Server/Body/Systems/LungSystem.cs
@@ -57,7 +57,7 @@ public class LungSystem : EntitySystem
public void Gasp(EntityUid uid,
LungComponent? lung=null,
- SharedMechanismComponent? mech=null)
+ MechanismComponent? mech=null)
{
if (!Resolve(uid, ref lung, ref mech))
return;
@@ -76,7 +76,7 @@ public class LungSystem : EntitySystem
public void UpdateLung(EntityUid uid,
LungComponent? lung=null,
- SharedMechanismComponent? mech=null)
+ MechanismComponent? mech=null)
{
if (!Resolve(uid, ref lung, ref mech))
return;
@@ -128,7 +128,7 @@ public class LungSystem : EntitySystem
///
public void Inhale(EntityUid uid, float frameTime,
LungComponent? lung=null,
- SharedMechanismComponent? mech=null)
+ MechanismComponent? mech=null)
{
if (!Resolve(uid, ref lung, ref mech))
return;
@@ -159,7 +159,7 @@ public class LungSystem : EntitySystem
///
public void TakeGasFrom(EntityUid uid, float frameTime, GasMixture from,
LungComponent? lung=null,
- SharedMechanismComponent? mech=null)
+ MechanismComponent? mech=null)
{
if (!Resolve(uid, ref lung, ref mech))
return;
@@ -186,7 +186,7 @@ public class LungSystem : EntitySystem
///
public void Exhale(EntityUid uid, float frameTime,
LungComponent? lung=null,
- SharedMechanismComponent? mech=null)
+ MechanismComponent? mech=null)
{
if (!Resolve(uid, ref lung, ref mech))
return;
@@ -204,7 +204,7 @@ public class LungSystem : EntitySystem
///
public void PushGasTo(EntityUid uid, GasMixture to,
LungComponent? lung=null,
- SharedMechanismComponent? mech=null)
+ MechanismComponent? mech=null)
{
if (!Resolve(uid, ref lung, ref mech))
return;
diff --git a/Content.Server/Body/Systems/MetabolizerSystem.cs b/Content.Server/Body/Systems/MetabolizerSystem.cs
index c4d517389b..477a4782b0 100644
--- a/Content.Server/Body/Systems/MetabolizerSystem.cs
+++ b/Content.Server/Body/Systems/MetabolizerSystem.cs
@@ -3,6 +3,7 @@ using Content.Server.Body.Components;
using Content.Server.Chemistry.Components.SolutionManager;
using Content.Server.Chemistry.EntitySystems;
using Content.Shared.Administration.Logs;
+using Content.Shared.Body.Components;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Database;
diff --git a/Content.Server/Body/Systems/StomachSystem.cs b/Content.Server/Body/Systems/StomachSystem.cs
index 9f626f718f..c264870469 100644
--- a/Content.Server/Body/Systems/StomachSystem.cs
+++ b/Content.Server/Body/Systems/StomachSystem.cs
@@ -1,6 +1,7 @@
using Content.Server.Body.Components;
using Content.Server.Chemistry.Components.SolutionManager;
using Content.Server.Chemistry.EntitySystems;
+using Content.Shared.Body.Components;
using Content.Shared.Chemistry.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
diff --git a/Content.Server/Explosion/Components/ExplosiveComponent.cs b/Content.Server/Explosion/Components/ExplosiveComponent.cs
index 839426249b..c4aba1f3a9 100644
--- a/Content.Server/Explosion/Components/ExplosiveComponent.cs
+++ b/Content.Server/Explosion/Components/ExplosiveComponent.cs
@@ -1,3 +1,4 @@
+using Content.Server.Chemistry.ReactionEffects;
using Content.Server.Destructible.Thresholds.Behaviors;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
diff --git a/Content.Server/Ghost/Components/GhostOnMoveComponent.cs b/Content.Server/Ghost/Components/GhostOnMoveComponent.cs
index 04c3a3384a..c68ed195e4 100644
--- a/Content.Server/Ghost/Components/GhostOnMoveComponent.cs
+++ b/Content.Server/Ghost/Components/GhostOnMoveComponent.cs
@@ -9,11 +9,13 @@ using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Ghost.Components
{
[RegisterComponent]
- [ComponentReference(typeof(IGhostOnMove))]
- public class GhostOnMoveComponent : Component,IGhostOnMove
+ public class GhostOnMoveComponent : Component
{
public override string Name => "GhostOnMove";
[DataField("canReturn")] public bool CanReturn { get; set; } = true;
+
+ [DataField("mustBeDead")]
+ public bool MustBeDead = false;
}
}
diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs
index bf6386f1d9..2073fe3c49 100644
--- a/Content.Server/Ghost/GhostSystem.cs
+++ b/Content.Server/Ghost/GhostSystem.cs
@@ -8,6 +8,7 @@ using Content.Server.Visible;
using Content.Server.Warps;
using Content.Shared.Examine;
using Content.Shared.Ghost;
+using Content.Shared.MobState.Components;
using Content.Shared.Movement.EntitySystems;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
@@ -53,6 +54,7 @@ namespace Content.Server.Ghost
// Let's not ghost if our mind is visiting...
if (EntityManager.HasComponent(uid)) return;
if (!EntityManager.TryGetComponent(uid, out var mind) || !mind.HasMind || mind.Mind!.IsVisitingEntity) return;
+ if (component.MustBeDead && TryComp(uid, out var state) && !state.IsDead()) return;
_ticker.OnGhostAttempt(mind.Mind!, component.CanReturn);
}
diff --git a/Content.Server/Ghost/IGhostOnMove.cs b/Content.Server/Ghost/IGhostOnMove.cs
deleted file mode 100644
index d6b7a59b57..0000000000
--- a/Content.Server/Ghost/IGhostOnMove.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Content.Server.Ghost
-{
- public interface IGhostOnMove
- {
- }
-}
diff --git a/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs b/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs
index 0cb4a2fafe..ef5b4e7436 100644
--- a/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs
+++ b/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs
@@ -1,4 +1,5 @@
-using Robust.Server.Player;
+using Content.Server.Mind.Commands;
+using Robust.Server.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
diff --git a/Content.Shared/Body/Components/SharedMechanismComponent.cs b/Content.Shared/Body/Components/MechanismComponent.cs
similarity index 82%
rename from Content.Shared/Body/Components/SharedMechanismComponent.cs
rename to Content.Shared/Body/Components/MechanismComponent.cs
index 811521887b..4930b238ee 100644
--- a/Content.Shared/Body/Components/SharedMechanismComponent.cs
+++ b/Content.Shared/Body/Components/MechanismComponent.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using Content.Shared.Body.Events;
+using Content.Shared.Body.Events;
using Content.Shared.Body.Part;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
@@ -8,16 +7,13 @@ using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Shared.Body.Components
{
- public abstract class SharedMechanismComponent : Component, ISerializationHooks
+ [RegisterComponent]
+ public class MechanismComponent : Component, ISerializationHooks
{
[Dependency] private readonly IEntityManager _entMan = default!;
public override string Name => "Mechanism";
- protected readonly Dictionary OptionsCache = new();
- protected SharedBodyComponent? BodyCache;
- protected int IdHash;
- protected EntityUid? PerformerCache;
private SharedBodyPartComponent? _part;
public SharedBodyComponent? Body => Part?.Body;
@@ -74,13 +70,13 @@ namespace Content.Shared.Body.Components
// TODO BODY OnSizeChanged
///
/// Determines whether this
- /// can fit into a .
+ /// can fit into a .
///
[DataField("size")] public int Size { get; set; } = 1;
///
/// What kind of this
- /// can be easily installed into.
+ /// can be easily installed into.
///
[DataField("compatibility")]
public BodyPartCompatibility Compatibility { get; set; } = BodyPartCompatibility.Universal;
diff --git a/Content.Shared/Body/Components/SharedBodyComponent.cs b/Content.Shared/Body/Components/SharedBodyComponent.cs
index 1cac1d8605..812ad34a14 100644
--- a/Content.Shared/Body/Components/SharedBodyComponent.cs
+++ b/Content.Shared/Body/Components/SharedBodyComponent.cs
@@ -22,7 +22,7 @@ namespace Content.Shared.Body.Components
// TODO BODY Damage methods for collections of IDamageableComponents
[NetworkedComponent()]
- public abstract class SharedBodyComponent : Component, IBodyPartContainer, ISerializationHooks
+ public abstract class SharedBodyComponent : Component, ISerializationHooks
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
@@ -58,9 +58,6 @@ namespace Content.Shared.Body.Components
[ViewVariables]
public IEnumerable> Parts => SlotParts;
- [ViewVariables]
- public IEnumerable EmptySlots => Slots.Where(slot => slot.Part == null);
-
public BodyPartSlot? CenterSlot =>
Template?.CenterSlot is { } centerSlot
? SlotIds.GetValueOrDefault(centerSlot)
@@ -223,14 +220,6 @@ namespace Content.Shared.Body.Components
slot.SetPart(part);
}
- public bool HasPart(string slotId)
- {
- DebugTools.AssertNotNull(slotId);
-
- return SlotIds.TryGetValue(slotId, out var slot) &&
- slot.Part != null;
- }
-
public bool HasPart(SharedBodyPartComponent part)
{
DebugTools.AssertNotNull(part);
@@ -246,34 +235,6 @@ namespace Content.Shared.Body.Components
slot.RemovePart();
}
- public bool RemovePart(string slotId)
- {
- DebugTools.AssertNotNull(slotId);
-
- return SlotIds.TryGetValue(slotId, out var slot) &&
- slot.RemovePart();
- }
-
- public bool RemovePart(SharedBodyPartComponent part, [NotNullWhen(true)] out BodyPartSlot? slotId)
- {
- DebugTools.AssertNotNull(part);
-
- if (!SlotParts.TryGetValue(part, out var slot))
- {
- slotId = null;
- return false;
- }
-
- if (!slot.RemovePart())
- {
- slotId = null;
- return false;
- }
-
- slotId = slot;
- return true;
- }
-
public bool TryDropPart(BodyPartSlot slot, [NotNullWhen(true)] out Dictionary? dropped)
{
DebugTools.AssertNotNull(slot);
@@ -333,86 +294,16 @@ namespace Content.Shared.Body.Components
return false;
}
- public bool HasSlot(string slot)
- {
- return SlotIds.ContainsKey(slot);
- }
-
- public IEnumerable GetParts()
- {
- foreach (var slot in SlotIds.Values)
- {
- if (slot.Part != null)
- {
- yield return slot.Part;
- }
- }
- }
-
- public bool TryGetPart(string slotId, [NotNullWhen(true)] out SharedBodyPartComponent? result)
- {
- result = null;
-
- return SlotIds.TryGetValue(slotId, out var slot) &&
- (result = slot.Part) != null;
- }
-
- public BodyPartSlot? GetSlot(string id)
- {
- return SlotIds.GetValueOrDefault(id);
- }
-
public BodyPartSlot? GetSlot(SharedBodyPartComponent part)
{
return SlotParts.GetValueOrDefault(part);
}
- public bool TryGetSlot(string slotId, [NotNullWhen(true)] out BodyPartSlot? slot)
- {
- return (slot = GetSlot(slotId)) != null;
- }
-
public bool TryGetSlot(SharedBodyPartComponent part, [NotNullWhen(true)] out BodyPartSlot? slot)
{
return (slot = GetSlot(part)) != null;
}
- public bool TryGetPartConnections(string slotId, [NotNullWhen(true)] out List? connections)
- {
- if (!SlotIds.TryGetValue(slotId, out var slot))
- {
- connections = null;
- return false;
- }
-
- connections = new List();
- foreach (var connection in slot.Connections)
- {
- if (connection.Part != null)
- {
- connections.Add(connection.Part);
- }
- }
-
- if (connections.Count <= 0)
- {
- connections = null;
- return false;
- }
-
- return true;
- }
-
- public bool HasSlotOfType(BodyPartType type)
- {
- foreach (var _ in GetSlotsOfType(type))
- {
- return true;
- }
-
- return false;
- }
-
public IEnumerable GetSlotsOfType(BodyPartType type)
{
foreach (var slot in SlotIds.Values)
diff --git a/Content.Shared/Body/Components/SharedBodyPartComponent.cs b/Content.Shared/Body/Components/SharedBodyPartComponent.cs
index 076001d7f3..c00a50a970 100644
--- a/Content.Shared/Body/Components/SharedBodyPartComponent.cs
+++ b/Content.Shared/Body/Components/SharedBodyPartComponent.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using Content.Shared.Body.Events;
using Content.Shared.Body.Part;
-using Content.Shared.Body.Surgery;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.IoC;
@@ -16,7 +15,7 @@ using Robust.Shared.ViewVariables;
namespace Content.Shared.Body.Components
{
[NetworkedComponent()]
- public abstract class SharedBodyPartComponent : Component, IBodyPartContainer
+ public abstract class SharedBodyPartComponent : Component
{
[Dependency] private readonly IEntityManager _entMan = default!;
@@ -30,7 +29,7 @@ namespace Content.Shared.Body.Components
public IReadOnlyList MechanismIds => _mechanismIds;
[ViewVariables]
- private readonly HashSet _mechanisms = new();
+ private readonly HashSet _mechanisms = new();
[ViewVariables]
public SharedBodyComponent? Body
@@ -58,12 +57,6 @@ namespace Content.Shared.Body.Components
}
}
- ///
- /// The string to show when displaying this part's name to players.
- ///
- [ViewVariables]
- public string DisplayName => Name;
-
///
/// that this is considered
/// to be.
@@ -91,11 +84,11 @@ namespace Content.Shared.Body.Components
///
[ViewVariables]
[DataField("compatibility")]
- public BodyPartCompatibility Compatibility { get; private set; } = BodyPartCompatibility.Universal;
+ public BodyPartCompatibility Compatibility = BodyPartCompatibility.Universal;
// TODO BODY Mechanisms occupying different parts at the body level
[ViewVariables]
- public IReadOnlyCollection Mechanisms => _mechanisms;
+ public IReadOnlyCollection Mechanisms => _mechanisms;
// TODO BODY Replace with a simulation of organs
///
@@ -104,16 +97,13 @@ namespace Content.Shared.Body.Components
///
[ViewVariables]
[DataField("vital")]
- public bool IsVital { get; private set; } = false;
+ public bool IsVital = false;
[ViewVariables]
[DataField("symmetry")]
- public BodyPartSymmetry Symmetry { get; private set; } = BodyPartSymmetry.None;
+ public BodyPartSymmetry Symmetry = BodyPartSymmetry.None;
- [ViewVariables]
- public ISurgeryData? SurgeryDataComponent => _entMan.GetComponentOrNull(Owner);
-
- protected virtual void OnAddMechanism(SharedMechanismComponent mechanism)
+ protected virtual void OnAddMechanism(MechanismComponent mechanism)
{
var prototypeId = _entMan.GetComponent(mechanism.Owner).EntityPrototype!.ID;
@@ -128,7 +118,7 @@ namespace Content.Shared.Body.Components
Dirty();
}
- protected virtual void OnRemoveMechanism(SharedMechanismComponent mechanism)
+ protected virtual void OnRemoveMechanism(MechanismComponent mechanism)
{
_mechanismIds.Remove(_entMan.GetComponent(mechanism.Owner).EntityPrototype!.ID);
mechanism.Part = null;
@@ -179,39 +169,13 @@ namespace Content.Shared.Body.Components
}
}
- public bool SurgeryCheck(SurgeryType surgery)
+ public virtual bool CanAddMechanism(MechanismComponent mechanism)
{
- return SurgeryDataComponent?.CheckSurgery(surgery) ?? false;
- }
-
- public bool AttemptSurgery(SurgeryType toolType, IBodyPartContainer target, ISurgeon surgeon, EntityUid performer)
- {
- DebugTools.AssertNotNull(toolType);
- DebugTools.AssertNotNull(target);
- DebugTools.AssertNotNull(surgeon);
- DebugTools.AssertNotNull(performer);
-
- return SurgeryDataComponent?.PerformSurgery(toolType, target, surgeon, performer) ?? false;
- }
-
- public bool CanAttachPart(SharedBodyPartComponent part)
- {
- DebugTools.AssertNotNull(part);
-
- return SurgeryDataComponent?.CanAttachBodyPart(part) ?? false;
- }
-
- public virtual bool CanAddMechanism(SharedMechanismComponent mechanism)
- {
- DebugTools.AssertNotNull(mechanism);
-
- return SurgeryDataComponent != null &&
- SizeUsed + mechanism.Size <= Size &&
- SurgeryDataComponent.CanAddMechanism(mechanism);
+ return SizeUsed + mechanism.Size <= Size;
}
///
- /// Tries to add a to this part.
+ /// Tries to add a to this part.
///
/// The mechanism to add.
///
@@ -220,7 +184,7 @@ namespace Content.Shared.Body.Components
/// it was already added before.
///
/// true if added, false otherwise even if it was already added.
- public bool TryAddMechanism(SharedMechanismComponent mechanism, bool force = false)
+ public bool TryAddMechanism(MechanismComponent mechanism, bool force = false)
{
DebugTools.AssertNotNull(mechanism);
@@ -244,7 +208,7 @@ namespace Content.Shared.Body.Components
///
/// The mechanism to remove.
/// True if it was removed, false otherwise.
- public bool RemoveMechanism(SharedMechanismComponent mechanism)
+ public bool RemoveMechanism(MechanismComponent mechanism)
{
DebugTools.AssertNotNull(mechanism);
@@ -265,7 +229,7 @@ namespace Content.Shared.Body.Components
/// The mechanism to remove.
/// The coordinates to drop it at.
/// True if it was removed, false otherwise.
- public bool RemoveMechanism(SharedMechanismComponent mechanism, EntityCoordinates coordinates)
+ public bool RemoveMechanism(MechanismComponent mechanism, EntityCoordinates coordinates)
{
if (RemoveMechanism(mechanism))
{
@@ -277,7 +241,7 @@ namespace Content.Shared.Body.Components
}
///
- /// Tries to destroy the given from
+ /// Tries to destroy the given from
/// this part.
/// The mechanism won't be deleted if it is not in this body part.
///
@@ -285,7 +249,7 @@ namespace Content.Shared.Body.Components
/// True if the mechanism was in this body part and destroyed,
/// false otherwise.
///
- public bool DeleteMechanism(SharedMechanismComponent mechanism)
+ public bool DeleteMechanism(MechanismComponent mechanism)
{
DebugTools.AssertNotNull(mechanism);
@@ -344,7 +308,7 @@ namespace Content.Shared.Body.Components
[Serializable, NetSerializable]
public class BodyPartComponentState : ComponentState
{
- [NonSerialized] private List? _mechanisms;
+ [NonSerialized] private List? _mechanisms;
public readonly EntityUid[] MechanismIds;
@@ -353,7 +317,7 @@ namespace Content.Shared.Body.Components
MechanismIds = mechanismIds;
}
- public List Mechanisms(IEntityManager? entityManager = null)
+ public List Mechanisms(IEntityManager? entityManager = null)
{
if (_mechanisms != null)
{
@@ -362,7 +326,7 @@ namespace Content.Shared.Body.Components
IoCManager.Resolve(ref entityManager);
- var mechanisms = new List(MechanismIds.Length);
+ var mechanisms = new List(MechanismIds.Length);
foreach (var id in MechanismIds)
{
@@ -371,7 +335,7 @@ namespace Content.Shared.Body.Components
continue;
}
- if (!entityManager.TryGetComponent(id, out SharedMechanismComponent? mechanism))
+ if (!entityManager.TryGetComponent(id, out MechanismComponent? mechanism))
{
continue;
}
diff --git a/Content.Shared/Body/Part/BodyPartSlot.cs b/Content.Shared/Body/Part/BodyPartSlot.cs
index cc18bd0dc8..f36f039fcc 100644
--- a/Content.Shared/Body/Part/BodyPartSlot.cs
+++ b/Content.Shared/Body/Part/BodyPartSlot.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using Content.Shared.Body.Components;
-using Content.Shared.Body.Part;
using Robust.Shared.ViewVariables;
namespace Content.Shared.Body.Part
diff --git a/Content.Shared/Body/Part/IBodyPartContainer.cs b/Content.Shared/Body/Part/IBodyPartContainer.cs
deleted file mode 100644
index bad145939e..0000000000
--- a/Content.Shared/Body/Part/IBodyPartContainer.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-
-namespace Content.Shared.Body.Part
-{
- ///
- /// Defines a component as being capable of containing parts.
- /// Used during surgery.
- ///
- // TODO BODY Remove
- public interface IBodyPartContainer
- {
- }
-}
diff --git a/Content.Shared/Body/Surgery/ISurgeon.cs b/Content.Shared/Body/Surgery/ISurgeon.cs
deleted file mode 100644
index a322e779cd..0000000000
--- a/Content.Shared/Body/Surgery/ISurgeon.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System.Collections.Generic;
-using Content.Shared.Body.Components;
-using Content.Shared.Body.Part;
-using Robust.Shared.GameObjects;
-
-namespace Content.Shared.Body.Surgery
-{
- ///
- /// Interface representing an entity capable of performing surgery,
- /// such as a circular saw.
- ///
- public interface ISurgeon
- {
- public delegate void MechanismRequestCallback(
- SharedMechanismComponent target,
- IBodyPartContainer container,
- ISurgeon surgeon,
- EntityUid performer);
-
- ///
- /// How long it takes to perform a single surgery step in seconds.
- ///
- public float BaseOperationTime { get; set; }
-
- ///
- /// When performing a surgery, the
- /// may sometimes require selecting from a set of
- /// s to operate on.
- /// This function is called in that scenario, and it is expected that you call
- /// the callback with one from the provided list.
- ///
- public void RequestMechanism(IEnumerable options, MechanismRequestCallback callback);
- }
-}
diff --git a/Content.Shared/Body/Surgery/SurgeryDataComponent.cs b/Content.Shared/Body/Surgery/SurgeryDataComponent.cs
deleted file mode 100644
index d7ad938d3f..0000000000
--- a/Content.Shared/Body/Surgery/SurgeryDataComponent.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-using Content.Shared.Body.Components;
-using Content.Shared.Body.Part;
-using Robust.Shared.GameObjects;
-
-namespace Content.Shared.Body.Surgery
-{
- ///
- /// Represents the current surgery state of a .
- ///
- public interface ISurgeryData : IComponent
- {
- public delegate void SurgeryAction(IBodyPartContainer container, ISurgeon surgeon, EntityUid performer);
-
- ///
- /// The this
- /// is attached to.
- ///
- public SharedBodyPartComponent? Parent { get; }
-
- ///
- /// The of the parent
- /// .
- ///
- public BodyPartType? ParentType { get; }
-
- ///
- /// Returns a description of this entity.
- ///
- /// The description shown upon observing this entity.
- public string GetDescription();
-
- ///
- /// Returns whether a can be added into the
- /// this
- /// represents.
- ///
- public bool CanAddMechanism(SharedMechanismComponent mechanism);
-
- ///
- /// Returns whether the given can be connected
- /// to the this
- /// represents.
- ///
- public bool CanAttachBodyPart(SharedBodyPartComponent part);
-
- ///
- /// Gets the delegate corresponding to the surgery step using the given
- /// .
- ///
- ///
- /// The corresponding surgery action or null if no step can be
- /// performed.
- ///
- public SurgeryAction? GetSurgeryStep(SurgeryType toolType);
-
- ///
- /// Returns whether the given can be used to
- /// perform a surgery on the this
- /// represents.
- ///
- public bool CheckSurgery(SurgeryType toolType)
- {
- return GetSurgeryStep(toolType) != null;
- }
-
- ///
- /// Attempts to perform surgery of the given .
- ///
- ///
- /// The used for this surgery.
- ///
- ///
- /// The container where the surgery is being done.
- ///
- ///
- /// The entity being used to perform the surgery.
- ///
- /// The entity performing the surgery.
- /// True if successful, false otherwise.
- public bool PerformSurgery(SurgeryType surgeryType, IBodyPartContainer container, ISurgeon surgeon,
- EntityUid performer);
- }
-}
diff --git a/Content.Shared/Body/Surgery/SurgeryType.cs b/Content.Shared/Body/Surgery/SurgeryType.cs
deleted file mode 100644
index 2879399834..0000000000
--- a/Content.Shared/Body/Surgery/SurgeryType.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using Robust.Shared.Serialization;
-
-namespace Content.Shared.Body.Surgery
-{
- ///
- /// Types of surgery operations that can be performed.
- ///
- // TODO BODY Move this to YAML?
- [Serializable, NetSerializable]
- public enum SurgeryType
- {
- None = 0,
- Incision,
- Retraction,
- Cauterization,
- VesselCompression,
- Drilling,
- Amputation
- }
-}
diff --git a/Content.Shared/Body/Surgery/SurgeryUIKey.cs b/Content.Shared/Body/Surgery/SurgeryUIKey.cs
deleted file mode 100644
index e27bd910a1..0000000000
--- a/Content.Shared/Body/Surgery/SurgeryUIKey.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System;
-using Robust.Shared.Serialization;
-
-namespace Content.Shared.Body.Surgery
-{
- [Serializable, NetSerializable]
- public enum SurgeryUIKey
- {
- Key
- }
-}
diff --git a/Content.Shared/Body/Surgery/SurgeryUIMessages.cs b/Content.Shared/Body/Surgery/SurgeryUIMessages.cs
deleted file mode 100644
index 72817f8581..0000000000
--- a/Content.Shared/Body/Surgery/SurgeryUIMessages.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Robust.Shared.GameObjects;
-using Robust.Shared.Serialization;
-
-namespace Content.Shared.Body.Surgery
-{
- [Serializable, NetSerializable]
- public class RequestBodyPartSurgeryUIMessage : BoundUserInterfaceMessage
- {
- public Dictionary Targets;
-
- public RequestBodyPartSurgeryUIMessage(Dictionary targets)
- {
- Targets = targets;
- }
- }
-
- [Serializable, NetSerializable]
- public class RequestMechanismSurgeryUIMessage : BoundUserInterfaceMessage
- {
- public Dictionary Targets;
-
- public RequestMechanismSurgeryUIMessage(Dictionary targets)
- {
- Targets = targets;
- }
- }
-
- [Serializable, NetSerializable]
- public class RequestBodyPartSlotSurgeryUIMessage : BoundUserInterfaceMessage
- {
- public Dictionary Targets;
-
- public RequestBodyPartSlotSurgeryUIMessage(Dictionary targets)
- {
- Targets = targets;
- }
- }
-
- [Serializable, NetSerializable]
- public class ReceiveBodyPartSurgeryUIMessage : BoundUserInterfaceMessage
- {
- public int SelectedOptionId;
-
- public ReceiveBodyPartSurgeryUIMessage(int selectedOptionId)
- {
- SelectedOptionId = selectedOptionId;
- }
- }
-
- [Serializable, NetSerializable]
- public class ReceiveMechanismSurgeryUIMessage : BoundUserInterfaceMessage
- {
- public int SelectedOptionId;
-
- public ReceiveMechanismSurgeryUIMessage(int selectedOptionId)
- {
- SelectedOptionId = selectedOptionId;
- }
- }
-
- [Serializable, NetSerializable]
- public class ReceiveBodyPartSlotSurgeryUIMessage : BoundUserInterfaceMessage
- {
- public int SelectedOptionId;
-
- public ReceiveBodyPartSlotSurgeryUIMessage(int selectedOptionId)
- {
- SelectedOptionId = selectedOptionId;
- }
- }
-}
diff --git a/Resources/Prototypes/Body/Parts/animal.yml b/Resources/Prototypes/Body/Parts/animal.yml
index 3071aba32c..9fdf956298 100644
--- a/Resources/Prototypes/Body/Parts/animal.yml
+++ b/Resources/Prototypes/Body/Parts/animal.yml
@@ -10,7 +10,6 @@
components:
- type: Damageable
damageContainer: Biological
- - type: BiologicalSurgeryData
# For primates mainly
- type: entity
diff --git a/Resources/Prototypes/Body/Parts/human.yml b/Resources/Prototypes/Body/Parts/human.yml
index 5d65b479bc..30f1cd422b 100644
--- a/Resources/Prototypes/Body/Parts/human.yml
+++ b/Resources/Prototypes/Body/Parts/human.yml
@@ -31,7 +31,6 @@
- OrganHumanStomach
- OrganHumanLiver
- OrganHumanKidneys
- - type: BiologicalSurgeryData
# criticalThreshold: 100
# deadThreshold: 150
@@ -55,7 +54,6 @@
mechanisms:
- OrganHumanBrain
- OrganHumanEyes
- - type: BiologicalSurgeryData
# criticalThreshold: 50
# deadThreshold: 120
- type: Input
@@ -80,7 +78,6 @@
size: 5
compatibility: Biological
symmetry: Left
- - type: BiologicalSurgeryData
# criticalThreshold: 40
# deadThreshold: 80
@@ -101,7 +98,6 @@
size: 5
compatibility: Biological
symmetry: Right
- - type: BiologicalSurgeryData
# criticalThreshold: 40
# deadThreshold: 80
@@ -122,7 +118,6 @@
size: 3
compatibility: Biological
symmetry: Left
- - type: BiologicalSurgeryData
# criticalThreshold: 30
# deadThreshold: 60
@@ -143,7 +138,6 @@
size: 3
compatibility: Biological
symmetry: Right
- - type: BiologicalSurgeryData
# criticalThreshold: 30
# deadThreshold: 60
@@ -164,7 +158,6 @@
size: 6
compatibility: Biological
symmetry: Left
- - type: BiologicalSurgeryData
# criticalThreshold: 45
# deadThreshold: 90
@@ -185,7 +178,6 @@
size: 6
compatibility: Biological
symmetry: Right
- - type: BiologicalSurgeryData
# criticalThreshold: 45
# deadThreshold: 90
@@ -206,7 +198,6 @@
size: 2
compatibility: Biological
symmetry: Left
- - type: BiologicalSurgeryData
# criticalThreshold: 30
# deadThreshold: 60
@@ -227,6 +218,5 @@
size: 2
compatibility: Biological
symmetry: Right
- - type: BiologicalSurgeryData
# criticalThreshold: 30
# deadThreshold: 60
diff --git a/Resources/Prototypes/Body/Parts/slime.yml b/Resources/Prototypes/Body/Parts/slime.yml
index 40e82f2a6e..31b2fcc493 100644
--- a/Resources/Prototypes/Body/Parts/slime.yml
+++ b/Resources/Prototypes/Body/Parts/slime.yml
@@ -30,7 +30,6 @@
- OrganHumanStomach
- OrganHumanLiver
- OrganHumanKidneys
- - type: BiologicalSurgeryData
# criticalThreshold: 100
# deadThreshold: 150
@@ -54,7 +53,6 @@
mechanisms:
- OrganHumanBrain
- OrganHumanEyes
- - type: BiologicalSurgeryData
# criticalThreshold: 50
# deadThreshold: 120
- type: Input
@@ -79,7 +77,6 @@
size: 5
compatibility: Biological
symmetry: Left
- - type: BiologicalSurgeryData
# criticalThreshold: 40
# deadThreshold: 80
@@ -100,7 +97,6 @@
size: 5
compatibility: Biological
symmetry: Right
- - type: BiologicalSurgeryData
# criticalThreshold: 40
# deadThreshold: 80
@@ -121,7 +117,6 @@
size: 3
compatibility: Biological
symmetry: Left
- - type: BiologicalSurgeryData
# criticalThreshold: 30
# deadThreshold: 60
@@ -142,7 +137,6 @@
size: 3
compatibility: Biological
symmetry: Right
- - type: BiologicalSurgeryData
# criticalThreshold: 30
# deadThreshold: 60
@@ -163,7 +157,6 @@
size: 6
compatibility: Biological
symmetry: Left
- - type: BiologicalSurgeryData
- type: entity
id: RightLegSlime
@@ -182,7 +175,6 @@
size: 6
compatibility: Biological
symmetry: Right
- - type: BiologicalSurgeryData
# criticalThreshold: 45
# deadThreshold: 90
@@ -203,7 +195,6 @@
size: 2
compatibility: Biological
symmetry: Left
- - type: BiologicalSurgeryData
# criticalThreshold: 30
# deadThreshold: 60
@@ -224,6 +215,5 @@
size: 2
compatibility: Biological
symmetry: Right
- - type: BiologicalSurgeryData
# criticalThreshold: 30
# deadThreshold: 60
diff --git a/Resources/Prototypes/Body/Parts/vox.yml b/Resources/Prototypes/Body/Parts/vox.yml
index 502e7dc5b6..923c26457b 100644
--- a/Resources/Prototypes/Body/Parts/vox.yml
+++ b/Resources/Prototypes/Body/Parts/vox.yml
@@ -31,7 +31,6 @@
- OrganHumanStomach
- OrganHumanLiver
- OrganHumanKidneys
- - type: BiologicalSurgeryData
# TODO BODY DettachableDamageableComponent?
# criticalThreshold: 100
# deadThreshold: 150
@@ -56,7 +55,6 @@
mechanisms:
- OrganHumanBrain
- OrganHumanEyes
- - type: BiologicalSurgeryData
# criticalThreshold: 50
# deadThreshold: 120
- type: Input
@@ -81,7 +79,6 @@
size: 5
compatibility: Biological
symmetry: Left
- - type: BiologicalSurgeryData
# criticalThreshold: 40
# deadThreshold: 80
@@ -102,7 +99,6 @@
size: 5
compatibility: Biological
symmetry: Right
- - type: BiologicalSurgeryData
# criticalThreshold: 40
# deadThreshold: 80
@@ -123,7 +119,6 @@
size: 3
compatibility: Biological
symmetry: Left
- - type: BiologicalSurgeryData
# criticalThreshold: 30
# deadThreshold: 60
@@ -144,7 +139,6 @@
size: 3
compatibility: Biological
symmetry: Right
- - type: BiologicalSurgeryData
# criticalThreshold: 30
# deadThreshold: 60
@@ -165,7 +159,6 @@
size: 6
compatibility: Biological
symmetry: Left
- - type: BiologicalSurgeryData
# criticalThreshold: 45
# deadThreshold: 90
@@ -186,7 +179,6 @@
size: 6
compatibility: Biological
symmetry: Right
- - type: BiologicalSurgeryData
# criticalThreshold: 45
# deadThreshold: 90
@@ -207,7 +199,6 @@
size: 2
compatibility: Biological
symmetry: Left
- - type: BiologicalSurgeryData
# criticalThreshold: 30
# deadThreshold: 60
@@ -228,6 +219,5 @@
size: 2
compatibility: Biological
symmetry: Right
- - type: BiologicalSurgeryData
# criticalThreshold: 30
# deadThreshold: 60
diff --git a/Resources/Prototypes/Entities/Clothing/Belt/belts.yml b/Resources/Prototypes/Entities/Clothing/Belt/belts.yml
index c8ac59b0a6..6da8411f77 100644
--- a/Resources/Prototypes/Entities/Clothing/Belt/belts.yml
+++ b/Resources/Prototypes/Entities/Clothing/Belt/belts.yml
@@ -240,7 +240,6 @@
- PillCanister
components:
- Hypospray
- - SurgeryTool
- Radio
- type: ItemMapper
mapLayers:
diff --git a/Resources/Prototypes/Entities/Objects/Specific/Medical/surgery.yml b/Resources/Prototypes/Entities/Objects/Specific/Medical/surgery.yml
index e5b6c49ce4..e7344c2632 100644
--- a/Resources/Prototypes/Entities/Objects/Specific/Medical/surgery.yml
+++ b/Resources/Prototypes/Entities/Objects/Specific/Medical/surgery.yml
@@ -7,10 +7,6 @@
components:
- type: Sprite
netsync: false
- - type: UserInterface
- interfaces:
- - key: enum.SurgeryUIKey.Key
- type: SurgeryBoundUserInterface
# Cautery
@@ -20,9 +16,6 @@
parent: BaseToolSurgery
description: A surgical tool used to cauterize open wounds.
components:
- - type: SurgeryTool
- surgeryType: Cauterization
- baseOperateTime: 3
- type: Sprite
sprite: Objects/Specific/Medical/Surgery/cautery.rsi
state: cautery
@@ -38,10 +31,6 @@
parent: BaseToolSurgery
description: A surgical drill for making holes into hard material.
components:
-# - type: PowerCellSlot
- - type: SurgeryTool
- surgeryType: Drilling
- baseOperateTime: 3
- type: Sprite
sprite: Objects/Specific/Medical/Surgery/drill.rsi
state: drill
@@ -66,9 +55,6 @@
- type: Utensil
types:
- Knife
- - type: SurgeryTool
- surgeryType: Incision
- baseOperateTime: 5
- type: Sprite
sprite: Objects/Specific/Medical/Surgery/scalpel.rsi
state: scalpel
@@ -88,9 +74,6 @@
parent: Scalpel
description: A pointy piece of glass, abraded to an edge and wrapped in tape for a handle. # Could become a decent tool or weapon with right tool mods.
components:
- - type: SurgeryTool
- surgeryType: Incision
- baseOperateTime: 8
- type: Sprite
state: shiv
- type: Item
@@ -102,9 +85,6 @@
parent: Scalpel
description: Made of more expensive materials, sharper and generally more reliable.
components:
- - type: SurgeryTool
- surgeryType: Incision
- baseOperateTime: 4
- type: Sprite
state: advanced
- type: Item
@@ -116,10 +96,6 @@
parent: Scalpel
description: A scalpel which uses a directed laser to slice instead of a blade, for more precise surgery while also cauterizing as it cuts.
components:
-# - type: PowerCellSlot
- - type: SurgeryTool
- surgeryType: Incision
- baseOperateTime: 2
- type: Sprite
state: laser
- type: Item
@@ -133,29 +109,12 @@
parent: BaseToolSurgery
description: A surgical tool used to hold open incisions.
components:
- - type: SurgeryTool
- surgeryType: Retraction
- baseOperateTime: 3
- type: Sprite
sprite: Objects/Specific/Medical/Surgery/scissors.rsi
state: retractor
- type: Item
sprite: Objects/Specific/Medical/Surgery/scissors.rsi
- type: ItemCooldown
-# Would do this, but inhands don't change. Also doesn't work for SurgeryTool yet.
-# - type: MultiTool
-# tools:
-# - behavior: VesselCompression
-# state: hemostat
-# useSound:
-# path: /Audio/Items/jaws_pry.ogg
-# changeSound:
-# path: /Audio/Items/change_jaws.ogg
-# - behavior: Setting
-# state: setter
-# useSound:
-# changeSound:
-# path: /Audio/Items/change_jaws.ogg
- type: entity
name: hemostat
@@ -163,8 +122,6 @@
parent: Retractor
description: A surgical tool used to compress blood vessels to prevent bleeding.
components:
- - type: SurgeryTool
- surgeryType: VesselCompression
- type: Sprite
state: hemostat
- type: Item
@@ -176,13 +133,6 @@
# parent: Retractor
# description: A surgical tool used for setting bones.
# components:
- # - type: SurgeryTool
- # surgeryType: Setting
- # - type: Sprite
- # state: setter
- # - type: Item
- # HeldPrefix: setter
-
# Saws
- type: entity
@@ -194,9 +144,6 @@
- type: Utensil
types:
- Knife
- - type: SurgeryTool
- surgeryType: Amputation
- baseOperateTime: 6
- type: Sprite
sprite: Objects/Specific/Medical/Surgery/saw.rsi
state: saw
@@ -211,9 +158,6 @@
parent: Saw
description: A wicked serrated blade made of whatever nasty sharp things you could find. # It would make a pretty decent weapon, given there are more space for some tool mods too.
components:
- - type: SurgeryTool
- surgeryType: Amputation
- baseOperateTime: 8
- type: Sprite
state: improv
- type: Item
@@ -231,10 +175,6 @@
parent: Saw
description: For heavy duty cutting.
components:
-# - type: PowerCellSlot
- - type: SurgeryTool
- surgeryType: Amputation
- baseOperateTime: 4
- type: Sprite
state: electric
- type: Item
@@ -252,10 +192,6 @@
parent: Saw
description: You think you can cut anything with it.
components:
-# - type: PowerCellSlot
- - type: SurgeryTool
- surgeryType: Amputation
- baseOperateTime: 2
- type: Sprite
state: advanced
- type: Item