emag refactor (#15181)
* limitedcharges stuff from emag * changes except broken * fix * the * move recharging to server, emag namespace -> charges * the * use resolve * pro webedit gaming * the * the --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Content.Shared.Emag.Systems;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -9,62 +8,13 @@ namespace Content.Shared.Emag.Components;
|
||||
|
||||
[Access(typeof(EmagSystem))]
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class EmagComponent : Component
|
||||
[AutoGenerateComponentState]
|
||||
public sealed partial class EmagComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The maximum number of charges the emag can have
|
||||
/// </summary>
|
||||
[DataField("maxCharges"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public int MaxCharges = 3;
|
||||
|
||||
/// <summary>
|
||||
/// The current number of charges on the emag
|
||||
/// </summary>
|
||||
[DataField("charges"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public int Charges = 3;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the emag automatically recharges over time.
|
||||
/// </summary>
|
||||
[DataField("autoRecharge"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool AutoRecharge = true;
|
||||
|
||||
/// <summary>
|
||||
/// The time it takes to regain a single charge
|
||||
/// </summary>
|
||||
[DataField("rechargeDuration"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public TimeSpan RechargeDuration = TimeSpan.FromSeconds(90);
|
||||
|
||||
/// <summary>
|
||||
/// The time when the next charge will be added
|
||||
/// </summary>
|
||||
[DataField("nextChargeTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
|
||||
public TimeSpan NextChargeTime = TimeSpan.MaxValue;
|
||||
|
||||
/// <summary>
|
||||
/// The tag that marks an entity as immune to emags
|
||||
/// </summary>
|
||||
[DataField("emagImmuneTag", customTypeSerializer: typeof(PrototypeIdSerializer<TagPrototype>)), ViewVariables(VVAccess.ReadWrite)]
|
||||
[AutoNetworkedField]
|
||||
public string EmagImmuneTag = "EmagImmune";
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class EmagComponentState : ComponentState
|
||||
{
|
||||
public int MaxCharges;
|
||||
public int Charges;
|
||||
public bool AutoRecharge;
|
||||
public TimeSpan RechargeTime;
|
||||
public TimeSpan NextChargeTime;
|
||||
public string EmagImmuneTag;
|
||||
|
||||
public EmagComponentState(int maxCharges, int charges, TimeSpan rechargeTime, TimeSpan nextChargeTime, string emagImmuneTag, bool autoRecharge)
|
||||
{
|
||||
MaxCharges = maxCharges;
|
||||
Charges = charges;
|
||||
RechargeTime = rechargeTime;
|
||||
NextChargeTime = nextChargeTime;
|
||||
EmagImmuneTag = emagImmuneTag;
|
||||
AutoRecharge = autoRecharge;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user