Action charges refactor (#33993)
* Action charges refactor - Fixes the slight godmoding of baseactioncomponent. - Gets back 1ms of server time. * chorg * Remove FrameUpdate * Fixes * More fixes * Combine * Fixes * Updates * weh * Last fixes * weh * Fix naughty * YAML fixes * This one too * Merge conflicts * This thing * Review * Fix this as well * Icon fix * weh * Review * Review * seamless * Review
This commit is contained in:
@@ -1,24 +1,27 @@
|
||||
using Content.Shared.Charges.Systems;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
|
||||
namespace Content.Shared.Charges.Components;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[Access(typeof(SharedChargesSystem))]
|
||||
[AutoGenerateComponentState]
|
||||
/// <summary>
|
||||
/// Specifies the attached action has discrete charges, separate to a cooldown.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedChargesSystem))]
|
||||
public sealed partial class LimitedChargesComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The maximum number of charges
|
||||
/// </summary>
|
||||
[DataField("maxCharges"), ViewVariables(VVAccess.ReadWrite)]
|
||||
[AutoNetworkedField]
|
||||
public int MaxCharges = 3;
|
||||
[DataField, AutoNetworkedField]
|
||||
public int LastCharges;
|
||||
|
||||
/// <summary>
|
||||
/// The current number of charges
|
||||
/// The max charges this action has.
|
||||
/// </summary>
|
||||
[DataField("charges"), ViewVariables(VVAccess.ReadWrite)]
|
||||
[AutoNetworkedField]
|
||||
public int Charges = 3;
|
||||
[DataField, AutoNetworkedField, Access(Other = AccessPermissions.Read)]
|
||||
public int MaxCharges = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Last time charges was changed. Used to derive current charges.
|
||||
/// </summary>
|
||||
[DataField(customTypeSerializer:typeof(TimeOffsetSerializer)), AutoNetworkedField]
|
||||
public TimeSpan LastUpdate;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user