From 6908f27cd1450f8b57aa075f8da347c2e38db60e Mon Sep 17 00:00:00 2001
From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Date: Fri, 16 Dec 2022 08:35:08 +1100
Subject: [PATCH] Use time offsets for gun and melee (#13041)
Doesn't stop the pickup serialization.
---
Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs | 3 ++-
Content.Shared/Weapons/Ranged/Components/GunComponent.cs | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs b/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs
index ffaa3246f3..c3e17130b3 100644
--- a/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs
+++ b/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs
@@ -5,6 +5,7 @@ using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
+using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Weapons.Melee;
@@ -25,7 +26,7 @@ public sealed class MeleeWeaponComponent : Component
///
/// Next time this component is allowed to light attack. Heavy attacks are wound up and never have a cooldown.
///
- [ViewVariables(VVAccess.ReadWrite), DataField("nextAttack")]
+ [ViewVariables(VVAccess.ReadWrite), DataField("nextAttack", customTypeSerializer:typeof(TimeOffsetSerializer))]
public TimeSpan NextAttack;
/*
diff --git a/Content.Shared/Weapons/Ranged/Components/GunComponent.cs b/Content.Shared/Weapons/Ranged/Components/GunComponent.cs
index 0176667d61..229b43ac84 100644
--- a/Content.Shared/Weapons/Ranged/Components/GunComponent.cs
+++ b/Content.Shared/Weapons/Ranged/Components/GunComponent.cs
@@ -2,6 +2,7 @@ using Content.Shared.Actions.ActionTypes;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
+using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Weapons.Ranged.Components;
@@ -95,7 +96,7 @@ public class GunComponent : Component
/// When the gun is next available to be shot.
/// Can be set multiple times in a single tick due to guns firing faster than a single tick time.
///
- [DataField("nextFire")]
+ [DataField("nextFire", customTypeSerializer:typeof(TimeOffsetSerializer))]
public TimeSpan NextFire = TimeSpan.Zero;
///