mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-22 16:17:00 +03:00
# Description
Another request by Aisha for Hullrot. This adds the necessary code for
supporting completely yml serialized cybernetics, via use of the all
powerful TraitFunctions library. A new TraitFunction exists for removing
actions from an entity, and in order to make it less terrible to use, I
added a new public function to the SharedActionsSystem to allow removing
an Action from an entity via Action Prototype rather than EntityUid.
# Changelog
🆑
- add: Added support for Organs(such as Cybernetics) to utilize the same
massive library of functions used by Traits.
86 lines
2.8 KiB
C#
86 lines
2.8 KiB
C#
using Content.Shared.Body.Systems;
|
|
using Content.Shared.Traits;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Prototypes; // Shitmed Change
|
|
using Content.Shared._Shitmed.Medical.Surgery; // Shitmed Change
|
|
using Content.Shared._Shitmed.Medical.Surgery.Tools; // Shitmed Change
|
|
|
|
namespace Content.Shared.Body.Organ;
|
|
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
|
[Access(typeof(SharedBodySystem), typeof(SharedSurgerySystem))] // Shitmed Change
|
|
public sealed partial class OrganComponent : Component, ISurgeryToolComponent // Shitmed Change
|
|
{
|
|
/// <summary>
|
|
/// Relevant body this organ is attached to.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField]
|
|
public EntityUid? Body;
|
|
|
|
/// <summary>
|
|
/// Shitmed Change:Relevant body this organ originally belonged to.
|
|
/// FOR WHATEVER FUCKING REASON AUTONETWORKING THIS CRASHES GIBTEST AAAAAAAAAAAAAAA
|
|
/// </summary>
|
|
[DataField]
|
|
public EntityUid? OriginalBody;
|
|
|
|
// Shitmed Change Start
|
|
/// <summary>
|
|
/// Shitmed Change: Shitcodey solution to not being able to know what name corresponds to each organ's slot ID
|
|
/// without referencing the prototype or hardcoding.
|
|
/// </summary>
|
|
|
|
[DataField]
|
|
public string SlotId = string.Empty;
|
|
|
|
[DataField]
|
|
public string ToolName { get; set; } = "An organ";
|
|
|
|
[DataField]
|
|
public float Speed { get; set; } = 1f;
|
|
|
|
/// <summary>
|
|
/// Shitmed Change: If true, the organ will not heal an entity when transplanted into them.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField]
|
|
public bool? Used { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// When attached, the organ will ensure these components on the entity, and delete them on removal.
|
|
/// </summary>
|
|
[DataField]
|
|
public ComponentRegistry? OnAdd;
|
|
|
|
/// <summary>
|
|
/// When removed, the organ will ensure these components on the entity, and delete them on insertion.
|
|
/// </summary>
|
|
[DataField]
|
|
public ComponentRegistry? OnRemove;
|
|
|
|
/// <summary>
|
|
/// Is this organ working or not?
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField]
|
|
public bool Enabled = true;
|
|
|
|
/// <summary>
|
|
/// Can this organ be enabled or disabled? Used mostly for prop, damaged or useless organs.
|
|
/// </summary>
|
|
[DataField]
|
|
public bool CanEnable = true;
|
|
// Shitmed Change End
|
|
|
|
/// <summary>
|
|
/// These functions are called when this organ is added/implanted to an entity.
|
|
/// </summary>
|
|
[DataField(serverOnly: true)]
|
|
public TraitFunction[] OnImplantFunctions { get; private set; } = Array.Empty<TraitFunction>();
|
|
|
|
/// <summary>
|
|
/// These functions are called when this organ is removed from an entity.
|
|
/// </summary>
|
|
[DataField(serverOnly: true)]
|
|
public TraitFunction[] OnRemoveFunctions { get; private set; } = Array.Empty<TraitFunction>();
|
|
}
|