Remove IBody, IBodyPart, IMechanism and IMechanismBehavior (#4187)
* Remove IBody, IBodyPart, IMechanism and IMechanismBehavior interfaces * Summary cleanup
This commit is contained in:
@@ -25,7 +25,7 @@ namespace Content.Server.Body.Surgery
|
||||
{
|
||||
public override string Name => "BiologicalSurgeryData";
|
||||
|
||||
private readonly HashSet<IMechanism> _disconnectedOrgans = new();
|
||||
private readonly HashSet<SharedMechanismComponent> _disconnectedOrgans = new();
|
||||
|
||||
private bool SkinOpened { get; set; }
|
||||
|
||||
@@ -33,11 +33,11 @@ namespace Content.Server.Body.Surgery
|
||||
|
||||
private bool VesselsClamped { get; set; }
|
||||
|
||||
public IBodyPart? Parent => Owner.GetComponentOrNull<IBodyPart>();
|
||||
public SharedBodyPartComponent? Parent => Owner.GetComponentOrNull<SharedBodyPartComponent>();
|
||||
|
||||
public BodyPartType? ParentType => Parent?.PartType;
|
||||
|
||||
private void AddDisconnectedOrgan(IMechanism mechanism)
|
||||
private void AddDisconnectedOrgan(SharedMechanismComponent mechanism)
|
||||
{
|
||||
if (_disconnectedOrgans.Add(mechanism))
|
||||
{
|
||||
@@ -45,7 +45,7 @@ namespace Content.Server.Body.Surgery
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveDisconnectedOrgan(IMechanism mechanism)
|
||||
private void RemoveDisconnectedOrgan(SharedMechanismComponent mechanism)
|
||||
{
|
||||
if (_disconnectedOrgans.Remove(mechanism))
|
||||
{
|
||||
@@ -117,7 +117,7 @@ namespace Content.Server.Body.Surgery
|
||||
return toReturn.ToString();
|
||||
}
|
||||
|
||||
public bool CanAddMechanism(IMechanism mechanism)
|
||||
public bool CanAddMechanism(SharedMechanismComponent mechanism)
|
||||
{
|
||||
return Parent != null &&
|
||||
SkinOpened &&
|
||||
@@ -125,7 +125,7 @@ namespace Content.Server.Body.Surgery
|
||||
SkinRetracted;
|
||||
}
|
||||
|
||||
public bool CanAttachBodyPart(IBodyPart part)
|
||||
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.
|
||||
@@ -276,7 +276,7 @@ namespace Content.Server.Body.Surgery
|
||||
if (Parent == null) return;
|
||||
if (Parent.Mechanisms.Count <= 0) return;
|
||||
|
||||
var toSend = new List<IMechanism>();
|
||||
var toSend = new List<SharedMechanismComponent>();
|
||||
foreach (var mechanism in Parent.Mechanisms)
|
||||
{
|
||||
if (!_disconnectedOrgans.Contains(mechanism))
|
||||
@@ -291,7 +291,7 @@ namespace Content.Server.Body.Surgery
|
||||
}
|
||||
}
|
||||
|
||||
private async void LoosenOrganSurgeryCallback(IMechanism? target, IBodyPartContainer container, ISurgeon surgeon,
|
||||
private async void LoosenOrganSurgeryCallback(SharedMechanismComponent? target, IBodyPartContainer container, ISurgeon surgeon,
|
||||
IEntity performer)
|
||||
{
|
||||
if (Parent == null || target == null || !Parent.Mechanisms.Contains(target))
|
||||
@@ -332,7 +332,7 @@ namespace Content.Server.Body.Surgery
|
||||
}
|
||||
}
|
||||
|
||||
private async void RemoveOrganSurgeryCallback(IMechanism? target, IBodyPartContainer container, ISurgeon surgeon,
|
||||
private async void RemoveOrganSurgeryCallback(SharedMechanismComponent? target, IBodyPartContainer container, ISurgeon surgeon,
|
||||
IEntity performer)
|
||||
{
|
||||
if (Parent == null || target == null || !Parent.Mechanisms.Contains(target))
|
||||
@@ -359,7 +359,7 @@ namespace Content.Server.Body.Surgery
|
||||
private async void RemoveBodyPartSurgery(IBodyPartContainer container, ISurgeon surgeon, IEntity performer)
|
||||
{
|
||||
if (Parent == null) return;
|
||||
if (container is not IBody body) return;
|
||||
if (container is not SharedBodyComponent body) return;
|
||||
|
||||
performer.PopupMessage(Loc.GetString("Sawing off the limb!"));
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Content.Server.Body.Surgery.Components
|
||||
|
||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(SurgeryUIKey.Key);
|
||||
|
||||
public IBody? BodyCache { get; private set; }
|
||||
public SharedBodyComponent? BodyCache { get; private set; }
|
||||
|
||||
public IEntity? PerformerCache { get; private set; }
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Content.Server.Body.Surgery.Components
|
||||
CloseAllSurgeryUIs();
|
||||
|
||||
// Attempt surgery on a body by sending a list of operable parts for the client to choose from
|
||||
if (eventArgs.Target.TryGetComponent(out IBody? body))
|
||||
if (eventArgs.Target.TryGetComponent(out SharedBodyComponent? body))
|
||||
{
|
||||
// Create dictionary to send to client (text to be shown : data sent back if selected)
|
||||
var toSend = new Dictionary<string, int>();
|
||||
@@ -93,7 +93,7 @@ namespace Content.Server.Body.Surgery.Components
|
||||
NotUsefulPopup();
|
||||
}
|
||||
}
|
||||
else if (eventArgs.Target.TryGetComponent<IBodyPart>(out var part))
|
||||
else if (eventArgs.Target.TryGetComponent<SharedBodyPartComponent>(out var part))
|
||||
{
|
||||
// Attempt surgery on a DroppedBodyPart - there's only one possible target so no need for selection UI
|
||||
PerformerCache = eventArgs.User;
|
||||
@@ -113,7 +113,7 @@ namespace Content.Server.Body.Surgery.Components
|
||||
}
|
||||
|
||||
// Log error if the surgery fails somehow.
|
||||
Logger.Debug($"Error when trying to perform surgery on ${nameof(IBodyPart)} {eventArgs.User.Name}");
|
||||
Logger.Debug($"Error when trying to perform surgery on ${nameof(SharedBodyPartComponent)} {eventArgs.User.Name}");
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Content.Server.Body.Surgery.Components
|
||||
|
||||
public float BaseOperationTime { get => _baseOperateTime; set => _baseOperateTime = value; }
|
||||
|
||||
public void RequestMechanism(IEnumerable<IMechanism> options, ISurgeon.MechanismRequestCallback callback)
|
||||
public void RequestMechanism(IEnumerable<SharedMechanismComponent> options, ISurgeon.MechanismRequestCallback callback)
|
||||
{
|
||||
var toSend = new Dictionary<string, int>();
|
||||
foreach (var mechanism in options)
|
||||
@@ -211,7 +211,7 @@ namespace Content.Server.Body.Surgery.Components
|
||||
|
||||
/// <summary>
|
||||
/// Called after the client chooses from a list of possible
|
||||
/// <see cref="IBodyPart"/> that can be operated on.
|
||||
/// <see cref="SharedBodyPartComponent"/> that can be operated on.
|
||||
/// </summary>
|
||||
private void HandleReceiveBodyPart(int key)
|
||||
{
|
||||
@@ -230,7 +230,7 @@ namespace Content.Server.Body.Surgery.Components
|
||||
return;
|
||||
}
|
||||
|
||||
var target = (IBodyPart) targetObject!;
|
||||
var target = (SharedBodyPartComponent) targetObject!;
|
||||
|
||||
// TODO BODY Reconsider
|
||||
if (!target.AttemptSurgery(_surgeryType, BodyCache, this, PerformerCache))
|
||||
@@ -241,7 +241,7 @@ namespace Content.Server.Body.Surgery.Components
|
||||
|
||||
/// <summary>
|
||||
/// Called after the client chooses from a list of possible
|
||||
/// <see cref="IMechanism"/> to choose from.
|
||||
/// <see cref="SharedMechanismComponent"/> to choose from.
|
||||
/// </summary>
|
||||
private void HandleReceiveMechanism(int key)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user