Fix chairs not unbuckling entities when deconstructed or destroyed (#3696)
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Buckle;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.GameObjects.Components.Strap;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||
using Content.Shared.GameObjects.Verbs;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
@@ -20,7 +21,7 @@ namespace Content.Server.GameObjects.Components.Strap
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(SharedStrapComponent))]
|
||||
public class StrapComponent : SharedStrapComponent, IInteractHand, ISerializationHooks
|
||||
public class StrapComponent : SharedStrapComponent, IInteractHand, ISerializationHooks, IDestroyAct
|
||||
{
|
||||
[ComponentDependency] public readonly SpriteComponent? SpriteComponent = null;
|
||||
|
||||
@@ -134,6 +135,16 @@ namespace Content.Server.GameObjects.Components.Strap
|
||||
{
|
||||
base.OnRemove();
|
||||
|
||||
RemoveAll();
|
||||
}
|
||||
|
||||
void IDestroyAct.OnDestroy(DestructionEventArgs eventArgs)
|
||||
{
|
||||
RemoveAll();
|
||||
}
|
||||
|
||||
private void RemoveAll()
|
||||
{
|
||||
foreach (var entity in _buckledEntities.ToArray())
|
||||
{
|
||||
if (entity.TryGetComponent<BuckleComponent>(out var buckle))
|
||||
|
||||
Reference in New Issue
Block a user