Body code cleanup (#24946)

* Fix test

* Kill float accumulators

* Use entity proxy methods

* DataField auto name generation where possible

* Kill comp properties

* Clean up server comps

* Make events record structs

* Clean up shared body code

* Clean up server body code

* Rename organ events to be same names as in med refactor
This commit is contained in:
0x6273
2024-03-28 01:48:37 +01:00
committed by GitHub
parent 527c2c42ed
commit 37b8d78dac
32 changed files with 916 additions and 820 deletions

View File

@@ -1,61 +1,28 @@
namespace Content.Shared.Body.Events
{
// All of these events are raised on a mechanism entity when added/removed to a body in different
// ways.
namespace Content.Shared.Body.Events;
/// <summary>
/// Raised on a mechanism when it is added to a body part.
/// </summary>
public sealed class AddedToPartEvent : EntityEventArgs
{
public EntityUid Part;
// All of these events are raised on a mechanism entity when added/removed to a body in different
// ways.
public AddedToPartEvent(EntityUid part)
{
Part = part;
}
}
/// <summary>
/// Raised on a mechanism when it is added to a body part.
/// </summary>
[ByRefEvent]
public readonly record struct OrganAddedEvent(EntityUid Part);
/// <summary>
/// Raised on a mechanism when it is added to a body part within a body.
/// </summary>
public sealed class AddedToPartInBodyEvent : EntityEventArgs
{
public EntityUid Body;
public EntityUid Part;
/// <summary>
/// Raised on a mechanism when it is added to a body part within a body.
/// </summary>
[ByRefEvent]
public readonly record struct OrganAddedToBodyEvent(EntityUid Body, EntityUid Part);
public AddedToPartInBodyEvent(EntityUid body, EntityUid part)
{
Body = body;
Part = part;
}
}
/// <summary>
/// Raised on a mechanism when it is removed from a body part.
/// </summary>
[ByRefEvent]
public readonly record struct OrganRemovedEvent(EntityUid OldPart);
/// <summary>
/// Raised on a mechanism when it is removed from a body part.
/// </summary>
public sealed class RemovedFromPartEvent : EntityEventArgs
{
public EntityUid OldPart;
public RemovedFromPartEvent(EntityUid oldPart)
{
OldPart = oldPart;
}
}
/// <summary>
/// Raised on a mechanism when it is removed from a body part within a body.
/// </summary>
public sealed class RemovedFromPartInBodyEvent : EntityEventArgs
{
public EntityUid OldBody;
public EntityUid OldPart;
public RemovedFromPartInBodyEvent(EntityUid oldBody, EntityUid oldPart)
{
OldBody = oldBody;
OldPart = oldPart;
}
}
}
/// <summary>
/// Raised on a mechanism when it is removed from a body part within a body.
/// </summary>
[ByRefEvent]
public readonly record struct OrganRemovedFromBodyEvent(EntityUid OldBody, EntityUid OldPart);