BodySystem stuff 2: overused boogaloo (#1174)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
@@ -58,7 +58,7 @@ namespace Content.Shared.BodySystem {
|
||||
tempConnections.Add(connection);
|
||||
}
|
||||
}
|
||||
else if (slotConnections.Contains(slotName))
|
||||
else if (slotConnections.Contains(targetSlotName))
|
||||
{
|
||||
tempConnections.Add(slotName);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
|
||||
namespace Content.Shared.BodySystem
|
||||
{
|
||||
public enum BodyPartCompatibility { Mechanical, Biological, Universal };
|
||||
/// <summary>
|
||||
/// Used to determine whether a BodyPart can connect to another BodyPart.
|
||||
/// </summary>
|
||||
public enum BodyPartCompatibility { Universal, Biological, Mechanical };
|
||||
|
||||
/// <summary>
|
||||
/// Each BodyPart has a BodyPartType used to determine a variety of things - for instance, what slots it can fit into.
|
||||
/// </summary>
|
||||
public enum BodyPartType { Other, Torso, Head, Arm, Hand, Leg, Foot };
|
||||
public enum SurgeryToolType { Incision, Retraction, Cauterization, VesselCompression, Drilling, BoneSawing, Amputation }
|
||||
|
||||
/// <summary>
|
||||
/// Defines a surgery operation that can be performed.
|
||||
/// </summary>
|
||||
public enum SurgeryType { Incision, Retraction, Cauterization, VesselCompression, Drilling, Amputation }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,24 +8,27 @@ using YamlDotNet.RepresentationModel;
|
||||
|
||||
|
||||
|
||||
namespace Content.Shared.BodySystem {
|
||||
namespace Content.Shared.BodySystem
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Prototype for the Mechanism class.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
[Prototype("mechanism")]
|
||||
[NetSerializable, Serializable]
|
||||
public class MechanismPrototype : IPrototype, IIndexedPrototype {
|
||||
public class MechanismPrototype : IPrototype, IIndexedPrototype
|
||||
{
|
||||
private string _id;
|
||||
private string _name;
|
||||
private string _description;
|
||||
private string _examineMessage;
|
||||
private string _description;
|
||||
private string _examineMessage;
|
||||
private string _spritePath;
|
||||
private string _rsiPath;
|
||||
private string _rsiState;
|
||||
private int _durability;
|
||||
private int _destroyThreshold;
|
||||
private int _resistance;
|
||||
private int _size;
|
||||
private int _destroyThreshold;
|
||||
private int _resistance;
|
||||
private int _size;
|
||||
private BodyPartCompatibility _compatibility;
|
||||
|
||||
[ViewVariables]
|
||||
@@ -34,11 +37,11 @@ namespace Content.Shared.BodySystem {
|
||||
[ViewVariables]
|
||||
public string Name => _name;
|
||||
|
||||
[ViewVariables]
|
||||
[ViewVariables]
|
||||
public string Description => _description;
|
||||
|
||||
[ViewVariables]
|
||||
public string ExamineMessage => _examineMessage;
|
||||
[ViewVariables]
|
||||
public string ExamineMessage => _examineMessage;
|
||||
|
||||
[ViewVariables]
|
||||
public string RSIPath => _rsiPath;
|
||||
@@ -47,21 +50,22 @@ namespace Content.Shared.BodySystem {
|
||||
public string RSIState => _rsiState;
|
||||
|
||||
[ViewVariables]
|
||||
public int Durability => _durability;
|
||||
public int Durability => _durability;
|
||||
|
||||
[ViewVariables]
|
||||
public int DestroyThreshold => _destroyThreshold;
|
||||
[ViewVariables]
|
||||
public int DestroyThreshold => _destroyThreshold;
|
||||
|
||||
[ViewVariables]
|
||||
public int Resistance => _resistance;
|
||||
[ViewVariables]
|
||||
public int Resistance => _resistance;
|
||||
|
||||
[ViewVariables]
|
||||
public int Size => _size;
|
||||
[ViewVariables]
|
||||
public int Size => _size;
|
||||
|
||||
[ViewVariables]
|
||||
public BodyPartCompatibility Compatibility => _compatibility;
|
||||
|
||||
public virtual void LoadFrom(YamlMappingNode mapping){
|
||||
public virtual void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
var serializer = YamlObjectSerializer.NewReader(mapping);
|
||||
|
||||
serializer.DataField(ref _id, "id", string.Empty);
|
||||
@@ -76,6 +80,6 @@ namespace Content.Shared.BodySystem {
|
||||
serializer.DataField(ref _size, "size", 2);
|
||||
serializer.DataField(ref _compatibility, "compatibility", BodyPartCompatibility.Universal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Components.UserInterface;
|
||||
using Robust.Shared.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Content.Shared.BodySystem
|
||||
{
|
||||
|
||||
[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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[NetSerializable, Serializable]
|
||||
public enum GenericSurgeryUiKey
|
||||
{
|
||||
Key,
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.Serialization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Shared.BodySystem {
|
||||
|
||||
|
||||
public class SharedSurgeryToolComponent : Component {
|
||||
|
||||
protected SurgeryToolType _surgeryToolClass;
|
||||
protected float _baseOperateTime;
|
||||
public override string Name => "SurgeryTool";
|
||||
public override uint? NetID => ContentNetIDs.SURGERY;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _surgeryToolClass, "surgeryToolClass", SurgeryToolType.Incision);
|
||||
serializer.DataField(ref _baseOperateTime, "baseOperateTime", 5);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class OpenSurgeryUIMessage : ComponentMessage
|
||||
{
|
||||
public OpenSurgeryUIMessage()
|
||||
{
|
||||
Directed = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class CloseSurgeryUIMessage : ComponentMessage
|
||||
{
|
||||
public CloseSurgeryUIMessage()
|
||||
{
|
||||
Directed = true;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class UpdateSurgeryUIMessage : ComponentMessage
|
||||
{
|
||||
public Dictionary<string, string> Targets;
|
||||
public UpdateSurgeryUIMessage(Dictionary<string, string> targets)
|
||||
{
|
||||
Targets = targets;
|
||||
Directed = true;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class SelectSurgeryUIMessage : ComponentMessage
|
||||
{
|
||||
public string TargetSlot;
|
||||
public SelectSurgeryUIMessage(string target)
|
||||
{
|
||||
TargetSlot = target;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user