Action bugfixes (#21321)
This commit is contained in:
@@ -213,6 +213,9 @@ public sealed class ActionContainerSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnShutdown(EntityUid uid, ActionsContainerComponent component, ComponentShutdown args)
|
private void OnShutdown(EntityUid uid, ActionsContainerComponent component, ComponentShutdown args)
|
||||||
{
|
{
|
||||||
|
if (_timing.ApplyingState && component.NetSyncEnabled)
|
||||||
|
return; // The game state should handle the container removal & action deletion.
|
||||||
|
|
||||||
component.Container.Shutdown();
|
component.Container.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ public abstract class SharedActionsSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<ActionsComponent, DidUnequipEvent>(OnDidUnequip);
|
SubscribeLocalEvent<ActionsComponent, DidUnequipEvent>(OnDidUnequip);
|
||||||
SubscribeLocalEvent<ActionsComponent, DidUnequipHandEvent>(OnHandUnequipped);
|
SubscribeLocalEvent<ActionsComponent, DidUnequipHandEvent>(OnHandUnequipped);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<ActionsComponent, ComponentShutdown>(OnShutdown);
|
||||||
|
|
||||||
SubscribeLocalEvent<ActionsComponent, ComponentGetState>(OnActionsGetState);
|
SubscribeLocalEvent<ActionsComponent, ComponentGetState>(OnActionsGetState);
|
||||||
|
|
||||||
SubscribeLocalEvent<InstantActionComponent, ComponentGetState>(OnInstantGetState);
|
SubscribeLocalEvent<InstantActionComponent, ComponentGetState>(OnInstantGetState);
|
||||||
@@ -49,6 +51,14 @@ public abstract class SharedActionsSystem : EntitySystem
|
|||||||
SubscribeAllEvent<RequestPerformActionEvent>(OnActionRequest);
|
SubscribeAllEvent<RequestPerformActionEvent>(OnActionRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnShutdown(EntityUid uid, ActionsComponent component, ComponentShutdown args)
|
||||||
|
{
|
||||||
|
foreach (var act in component.Actions)
|
||||||
|
{
|
||||||
|
RemoveAction(uid, act, component);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnInstantGetState(EntityUid uid, InstantActionComponent component, ref ComponentGetState args)
|
private void OnInstantGetState(EntityUid uid, InstantActionComponent component, ref ComponentGetState args)
|
||||||
{
|
{
|
||||||
args.State = new InstantActionComponentState(component, EntityManager);
|
args.State = new InstantActionComponentState(component, EntityManager);
|
||||||
@@ -611,6 +621,9 @@ public abstract class SharedActionsSystem : EntitySystem
|
|||||||
|
|
||||||
if (action.AttachedEntity != performer)
|
if (action.AttachedEntity != performer)
|
||||||
{
|
{
|
||||||
|
DebugTools.Assert(!Resolve(performer, ref comp, false) || !comp.Actions.Contains(actionId.Value));
|
||||||
|
|
||||||
|
if (!GameTiming.ApplyingState)
|
||||||
Log.Error($"Attempted to remove an action {ToPrettyString(actionId)} from an entity that it was never attached to: {ToPrettyString(performer)}");
|
Log.Error($"Attempted to remove an action {ToPrettyString(actionId)} from an entity that it was never attached to: {ToPrettyString(performer)}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user