Re-organize all projects (#4166)

This commit is contained in:
DrSmugleaf
2021-06-09 22:19:39 +02:00
committed by GitHub
parent 9f50e4061b
commit ff1a2d97ea
1773 changed files with 5258 additions and 5508 deletions

View File

@@ -0,0 +1,34 @@
using System.Collections.Generic;
using Content.Shared.Body.Mechanism;
using Content.Shared.Body.Part;
using Robust.Shared.GameObjects;
namespace Content.Shared.Body.Surgery
{
/// <summary>
/// Interface representing an entity capable of performing surgery,
/// such as a circular saw.
/// </summary>
public interface ISurgeon
{
public delegate void MechanismRequestCallback(
IMechanism target,
IBodyPartContainer container,
ISurgeon surgeon,
IEntity performer);
/// <summary>
/// How long it takes to perform a single surgery step in seconds.
/// </summary>
public float BaseOperationTime { get; set; }
/// <summary>
/// When performing a surgery, the <see cref="SurgeryDataComponent"/>
/// may sometimes require selecting from a set of
/// <see cref="IMechanism"/>s to operate on.
/// This function is called in that scenario, and it is expected that you call
/// the callback with one <see cref="IMechanism"/> from the provided list.
/// </summary>
public void RequestMechanism(IEnumerable<IMechanism> options, MechanismRequestCallback callback);
}
}

View File

@@ -0,0 +1,84 @@
#nullable enable
using Content.Shared.Body.Mechanism;
using Content.Shared.Body.Part;
using Robust.Shared.GameObjects;
namespace Content.Shared.Body.Surgery
{
/// <summary>
/// Represents the current surgery state of a <see cref="IBodyPart"/>.
/// </summary>
public interface ISurgeryData : IComponent
{
public delegate void SurgeryAction(IBodyPartContainer container, ISurgeon surgeon, IEntity performer);
/// <summary>
/// The <see cref="IBodyPart"/> this
/// <see cref="ISurgeryData"/> is attached to.
/// </summary>
public IBodyPart? Parent { get; }
/// <summary>
/// The <see cref="BodyPartType"/> of the parent
/// <see cref="IBodyPart"/>.
/// </summary>
public BodyPartType? ParentType { get; }
/// <summary>
/// Returns a description of this entity.
/// </summary>
/// <returns>The description shown upon observing this entity.</returns>
public string GetDescription();
/// <summary>
/// Returns whether a <see cref="IMechanism"/> can be added into the
/// <see cref="IBodyPart"/> this <see cref="ISurgeryData"/>
/// represents.
/// </summary>
public bool CanAddMechanism(IMechanism mechanism);
/// <summary>
/// Returns whether the given <see cref="IBodyPart"/> can be connected
/// to the <see cref="IBodyPart"/> this <see cref="ISurgeryData"/>
/// represents.
/// </summary>
public bool CanAttachBodyPart(IBodyPart part);
/// <summary>
/// Gets the delegate corresponding to the surgery step using the given
/// <see cref="SurgeryType"/>.
/// </summary>
/// <returns>
/// The corresponding surgery action or null if no step can be
/// performed.
/// </returns>
public SurgeryAction? GetSurgeryStep(SurgeryType toolType);
/// <summary>
/// Returns whether the given <see cref="SurgeryType"/> can be used to
/// perform a surgery on the <see cref="IBodyPart"/> this
/// <see cref="ISurgeryData"/> represents.
/// </summary>
public bool CheckSurgery(SurgeryType toolType)
{
return GetSurgeryStep(toolType) != null;
}
/// <summary>
/// Attempts to perform surgery of the given <see cref="SurgeryType"/>.
/// </summary>
/// <param name="surgeryType">
/// The <see cref="SurgeryType"/> used for this surgery.
/// </param>
/// <param name="container">
/// The container where the surgery is being done.
/// </param>
/// <param name="surgeon">
/// The entity being used to perform the surgery.
/// </param>
/// <param name="performer">The entity performing the surgery.</param>
/// <returns>True if successful, false otherwise.</returns>
public bool PerformSurgery(SurgeryType surgeryType, IBodyPartContainer container, ISurgeon surgeon,
IEntity performer);
}
}

View File

@@ -0,0 +1,22 @@
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.Body.Surgery
{
/// <summary>
/// Types of surgery operations that can be performed.
/// </summary>
// TODO BODY Move this to YAML?
[Serializable, NetSerializable]
public enum SurgeryType
{
None = 0,
Incision,
Retraction,
Cauterization,
VesselCompression,
Drilling,
Amputation
}
}

View File

@@ -0,0 +1,12 @@
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.Body.Surgery
{
[Serializable, NetSerializable]
public enum SurgeryUIKey
{
Key
}
}

View File

@@ -0,0 +1,74 @@
#nullable enable
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<string, int> Targets;
public RequestBodyPartSurgeryUIMessage(Dictionary<string, int> targets)
{
Targets = targets;
}
}
[Serializable, NetSerializable]
public class RequestMechanismSurgeryUIMessage : BoundUserInterfaceMessage
{
public Dictionary<string, int> Targets;
public RequestMechanismSurgeryUIMessage(Dictionary<string, int> targets)
{
Targets = targets;
}
}
[Serializable, NetSerializable]
public class RequestBodyPartSlotSurgeryUIMessage : BoundUserInterfaceMessage
{
public Dictionary<string, int> Targets;
public RequestBodyPartSlotSurgeryUIMessage(Dictionary<string, int> 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;
}
}
}