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

@@ -4,7 +4,8 @@ using Robust.Shared.Utility;
namespace Content.Shared.Actions;
// TODO this should be an IncludeDataFields of each action component type, not use inheritance
// TODO ACTIONS make this a seprate component and remove the inheritance stuff.
// TODO ACTIONS convert to auto comp state?
// TODO add access attribute. Need to figure out what to do with decal & mapping actions.
// [Access(typeof(SharedActionsSystem))]
@@ -72,9 +73,9 @@ public abstract partial class BaseActionComponent : Component
[DataField("charges")] public int? Charges;
/// <summary>
/// The max charges this action has, set automatically from <see cref="Charges"/>
/// The max charges this action has. If null, this is set automatically from <see cref="Charges"/> on mapinit.
/// </summary>
public int MaxCharges;
[DataField] public int? MaxCharges;
/// <summary>
/// If enabled, charges will regenerate after a <see cref="Cooldown"/> is complete
@@ -130,7 +131,7 @@ public abstract partial class BaseActionComponent : Component
/// <summary>
/// What entity, if any, currently has this action in the actions component?
/// </summary>
[ViewVariables] public EntityUid? AttachedEntity;
[DataField] public EntityUid? AttachedEntity;
/// <summary>
/// If true, this will cause the the action event to always be raised directed at the action performer/user instead of the action's container/provider.
@@ -171,7 +172,7 @@ public abstract class BaseActionComponentState : ComponentState
public (TimeSpan Start, TimeSpan End)? Cooldown;
public TimeSpan? UseDelay;
public int? Charges;
public int MaxCharges;
public int? MaxCharges;
public bool RenewCharges;
public NetEntity? Container;
public NetEntity? EntityIcon;