Fix action state handling bug (#25395)

* Rejig action state handling

* Fix entity arg

* Fix deserialization
This commit is contained in:
Leon Friedrich
2024-02-19 21:08:41 -05:00
committed by GitHub
parent 2548b13abf
commit bd4597c5ca
7 changed files with 103 additions and 52 deletions

View File

@@ -170,12 +170,7 @@ public sealed class ToggleableClothingSystem : EntitySystem
// "outside" of the container or not. This means that if a hardsuit takes too much damage, the helmet will also
// automatically be deleted.
// remove action.
if (_actionsSystem.TryGetActionData(component.ActionEntity, out var action) &&
action.AttachedEntity != null)
{
_actionsSystem.RemoveAction(action.AttachedEntity.Value, component.ActionEntity);
}
_actionsSystem.RemoveAction(component.ActionEntity);
if (component.ClothingUid != null && !_netMan.IsClient)
QueueDel(component.ClothingUid.Value);
@@ -199,13 +194,7 @@ public sealed class ToggleableClothingSystem : EntitySystem
if (toggleComp.LifeStage > ComponentLifeStage.Running)
return;
// remove action.
if (_actionsSystem.TryGetActionData(toggleComp.ActionEntity, out var action) &&
action.AttachedEntity != null)
{
_actionsSystem.RemoveAction(action.AttachedEntity.Value, toggleComp.ActionEntity);
}
_actionsSystem.RemoveAction(toggleComp.ActionEntity);
RemComp(component.AttachedUid, toggleComp);
}