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

@@ -78,10 +78,12 @@ namespace Content.Client.Actions
private void BaseHandleState<T>(EntityUid uid, BaseActionComponent component, BaseActionComponentState state) where T : BaseActionComponent
{
// TODO ACTIONS use auto comp states
component.Icon = state.Icon;
component.IconOn = state.IconOn;
component.IconColor = state.IconColor;
component.Keywords = new HashSet<string>(state.Keywords);
component.Keywords.Clear();
component.Keywords.UnionWith(state.Keywords);
component.Enabled = state.Enabled;
component.Toggled = state.Toggled;
component.Cooldown = state.Cooldown;
@@ -101,8 +103,7 @@ namespace Content.Client.Actions
component.ItemIconStyle = state.ItemIconStyle;
component.Sound = state.Sound;
if (_playerManager.LocalEntity == component.AttachedEntity)
ActionsUpdated?.Invoke();
UpdateAction(uid, component);
}
protected override void UpdateAction(EntityUid? actionId, BaseActionComponent? action = null)