Refactor actions to be entities with components (#19900)

This commit is contained in:
DrSmugleaf
2023-09-08 18:16:05 -07:00
committed by GitHub
parent e18f731b91
commit c71f97e3a2
210 changed files with 10693 additions and 11714 deletions

View File

@@ -1,4 +1,3 @@
using Content.Shared.Actions.ActionTypes;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
@@ -9,10 +8,10 @@ namespace Content.Shared.Actions;
[Access(typeof(SharedActionsSystem))]
public sealed partial class ActionsComponent : Component
{
[ViewVariables]
[Access(typeof(SharedActionsSystem), Other = AccessPermissions.ReadExecute)]
// FIXME Friends
public SortedSet<ActionType> Actions = new();
/// <summary>
/// Handled on the client to track added and removed actions.
/// </summary>
[ViewVariables] public readonly Dictionary<EntityUid, ActionMetaData> OldClientActions = new();
public override bool SendOnlyToOwner => true;
}
@@ -20,17 +19,16 @@ public sealed partial class ActionsComponent : Component
[Serializable, NetSerializable]
public sealed class ActionsComponentState : ComponentState
{
public readonly List<ActionType> Actions;
public readonly List<EntityUid> Actions;
[NonSerialized]
public SortedSet<ActionType>? SortedActions;
public ActionsComponentState(List<ActionType> actions)
public ActionsComponentState(List<EntityUid> actions)
{
Actions = actions;
}
}
public readonly record struct ActionMetaData(bool ClientExclusive, bool AutoRemove);
/// <summary>
/// Determines how the action icon appears in the hotbar for item actions.
/// </summary>