Fix mechanism events not being called properly, add test (#2279)
* Add mechanism events when added/removed to/from body/parts * Change old usages * Add TODO * Remove BodyExtensions and IHasBody * Remove unnecessary extensions and fix wrong event call in mechanism behavior component * Complete test and fix event calls
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Body.Part;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Body.Mechanism
|
||||
{
|
||||
public interface IMechanism : IHasBody
|
||||
public interface IMechanism : IComponent
|
||||
{
|
||||
IBody? Body { get; }
|
||||
|
||||
IBodyPart? Part { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -70,6 +73,14 @@ namespace Content.Shared.GameObjects.Components.Body.Mechanism
|
||||
/// </summary>
|
||||
void AddedToPart();
|
||||
|
||||
/// <summary>
|
||||
/// Called when the parent <see cref="IMechanism"/> is added to a
|
||||
/// <see cref="IBodyPart"/> that is attached to a <see cref="IBody"/>.
|
||||
/// For instance, adding a brain to a head that is attached to a body.
|
||||
/// DO NOT CALL THIS DIRECTLY FROM OUTSIDE BODY SYSTEM CODE!
|
||||
/// </summary>
|
||||
void AddedToPartInBody();
|
||||
|
||||
/// <summary>
|
||||
/// Called when the parent <see cref="IBodyPart"/> is removed from a
|
||||
/// <see cref="IBody"/>.
|
||||
@@ -87,14 +98,6 @@ namespace Content.Shared.GameObjects.Components.Body.Mechanism
|
||||
/// </summary>
|
||||
void RemovedFromPart(IBodyPart old);
|
||||
|
||||
/// <summary>
|
||||
/// Called when the parent <see cref="IMechanism"/> is added to a
|
||||
/// <see cref="IBodyPart"/> that is attached to a <see cref="IBody"/>.
|
||||
/// For instance, adding a brain to a head that is attached to a body.
|
||||
/// DO NOT CALL THIS DIRECTLY FROM OUTSIDE BODY SYSTEM CODE!
|
||||
/// </summary>
|
||||
void AddedToPartInBody();
|
||||
|
||||
/// <summary>
|
||||
/// Called when the parent <see cref="IMechanism"/> is removed from a
|
||||
/// <see cref="IBodyPart"/> that is attached to a <see cref="IBody"/>.
|
||||
|
||||
Reference in New Issue
Block a user