Replace IBodyPartAdded and IBodyPartRemoved with ref events (#12572)
This commit is contained in:
7
Content.Shared/Body/Part/BodyPartEvents.cs
Normal file
7
Content.Shared/Body/Part/BodyPartEvents.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Content.Shared.Body.Part;
|
||||
|
||||
[ByRefEvent]
|
||||
public readonly record struct BodyPartAddedEvent(string Slot, BodyPartComponent Part);
|
||||
|
||||
[ByRefEvent]
|
||||
public readonly record struct BodyPartRemovedEvent(string Slot, BodyPartComponent Part);
|
||||
@@ -1,37 +0,0 @@
|
||||
using Content.Shared.Body.Components;
|
||||
|
||||
namespace Content.Shared.Body.Part
|
||||
{
|
||||
/// <summary>
|
||||
/// This interface gives components behavior when a body part
|
||||
/// is added to their owning entity.
|
||||
/// </summary>
|
||||
public interface IBodyPartAdded : IComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Called when a <see cref="BodyComponent"/> is added to the
|
||||
/// entity owning this component.
|
||||
/// </summary>
|
||||
/// <param name="args">Information about the part that was added.</param>
|
||||
void BodyPartAdded(BodyPartAddedEventArgs args);
|
||||
}
|
||||
|
||||
public sealed class BodyPartAddedEventArgs : EventArgs
|
||||
{
|
||||
public BodyPartAddedEventArgs(string slot, BodyPartComponent part)
|
||||
{
|
||||
Slot = slot;
|
||||
Part = part;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The slot that <see cref="Part"/> was added to.
|
||||
/// </summary>
|
||||
public string Slot { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The part that was added.
|
||||
/// </summary>
|
||||
public BodyPartComponent Part { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using Content.Shared.Body.Components;
|
||||
|
||||
namespace Content.Shared.Body.Part
|
||||
{
|
||||
/// <summary>
|
||||
/// This interface gives components behavior when a body part
|
||||
/// is removed from their owning entity.
|
||||
/// </summary>
|
||||
public interface IBodyPartRemoved
|
||||
{
|
||||
/// <summary>
|
||||
/// Called when a <see cref="BodyComponent"/> is removed from the
|
||||
/// entity owning this component.
|
||||
/// </summary>
|
||||
/// <param name="args">Information about the part that was removed.</param>
|
||||
void BodyPartRemoved(BodyPartRemovedEventArgs args);
|
||||
}
|
||||
|
||||
public sealed class BodyPartRemovedEventArgs : EventArgs
|
||||
{
|
||||
public BodyPartRemovedEventArgs(string slot, BodyPartComponent part)
|
||||
{
|
||||
Slot = slot;
|
||||
Part = part;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The slot that <see cref="Part"/> was removed from.
|
||||
/// </summary>
|
||||
public string Slot { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The part that was removed.
|
||||
/// </summary>
|
||||
public BodyPartComponent Part { get; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user