Add IMechanism interface to body system (#1997)

This commit is contained in:
DrSmugleaf
2020-09-02 01:16:13 +02:00
committed by GitHub
parent 072f374bcc
commit 682b6b9568
9 changed files with 162 additions and 117 deletions

View File

@@ -17,7 +17,7 @@ namespace Content.Server.Body.Surgery
[UsedImplicitly]
public class BiologicalSurgeryData : SurgeryData
{
private readonly List<Mechanism> _disconnectedOrgans = new List<Mechanism>();
private readonly List<IMechanism> _disconnectedOrgans = new List<IMechanism>();
private bool _skinOpened;
private bool _skinRetracted;
@@ -118,7 +118,7 @@ namespace Content.Server.Body.Surgery
return toReturn;
}
public override bool CanInstallMechanism(Mechanism mechanism)
public override bool CanInstallMechanism(IMechanism mechanism)
{
return _skinOpened && _vesselsClamped && _skinRetracted;
}
@@ -170,7 +170,7 @@ namespace Content.Server.Body.Surgery
return;
}
var toSend = new List<Mechanism>();
var toSend = new List<IMechanism>();
foreach (var mechanism in Parent.Mechanisms)
{
if (!_disconnectedOrgans.Contains(mechanism))
@@ -185,7 +185,7 @@ namespace Content.Server.Body.Surgery
}
}
private void LoosenOrganSurgeryCallback(Mechanism target, IBodyPartContainer container, ISurgeon surgeon,
private void LoosenOrganSurgeryCallback(IMechanism target, IBodyPartContainer container, ISurgeon surgeon,
IEntity performer)
{
if (target == null || !Parent.Mechanisms.Contains(target))
@@ -216,7 +216,7 @@ namespace Content.Server.Body.Surgery
}
}
private void RemoveOrganSurgeryCallback(Mechanism target, IBodyPartContainer container, ISurgeon surgeon,
private void RemoveOrganSurgeryCallback(IMechanism target, IBodyPartContainer container, ISurgeon surgeon,
IEntity performer)
{
if (target == null || !Parent.Mechanisms.Contains(target))

View File

@@ -13,7 +13,7 @@ namespace Content.Server.Body.Surgery
public interface ISurgeon
{
public delegate void MechanismRequestCallback(
Mechanism target,
IMechanism target,
IBodyPartContainer container,
ISurgeon surgeon,
IEntity performer);
@@ -29,6 +29,6 @@ namespace Content.Server.Body.Surgery
/// This function is called in that scenario, and it is expected that you call the callback with one mechanism from the
/// provided list.
/// </summary>
public void RequestMechanism(IEnumerable<Mechanism> options, MechanismRequestCallback callback);
public void RequestMechanism(IEnumerable<IMechanism> options, MechanismRequestCallback callback);
}
}

View File

@@ -38,10 +38,10 @@ namespace Content.Server.Body.Surgery
public abstract string GetDescription(IEntity target);
/// <summary>
/// Returns whether a <see cref="Mechanism"/> can be installed into the
/// Returns whether a <see cref="IMechanism"/> can be installed into the
/// <see cref="IBodyPart"/> this <see cref="SurgeryData"/> represents.
/// </summary>
public abstract bool CanInstallMechanism(Mechanism mechanism);
public abstract bool CanInstallMechanism(IMechanism mechanism);
/// <summary>
/// Returns whether the given <see cref="IBodyPart"/> can be connected to the