diff --git a/Content.Server/Abilities/Mime/MimePowersComponent.cs b/Content.Server/Abilities/Mime/MimePowersComponent.cs index 6e547d306e..e38935742b 100644 --- a/Content.Server/Abilities/Mime/MimePowersComponent.cs +++ b/Content.Server/Abilities/Mime/MimePowersComponent.cs @@ -53,7 +53,7 @@ namespace Content.Server.Abilities.Mime /// /// How long it takes the mime to get their powers back /// - [DataField("vowCooldown", customTypeSerializer: typeof(TimeOffsetSerializer))] + [DataField("vowCooldown")] public TimeSpan VowCooldown = TimeSpan.FromMinutes(5); } } diff --git a/Content.Shared/Materials/MaterialStorageComponent.cs b/Content.Shared/Materials/MaterialStorageComponent.cs index 0bc0c280c2..491c4d3cb7 100644 --- a/Content.Shared/Materials/MaterialStorageComponent.cs +++ b/Content.Shared/Materials/MaterialStorageComponent.cs @@ -55,7 +55,7 @@ public sealed class MaterialStorageComponent : Component /// /// How long the inserting animation will play /// - [DataField("insertionTime", customTypeSerializer: typeof(TimeOffsetSerializer))] + [DataField("insertionTime")] public TimeSpan InsertionTime = TimeSpan.FromSeconds(0.79f); // 0.01 off for animation timing } diff --git a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs index 2f9113cc50..39721a6c3e 100644 --- a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs +++ b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs @@ -70,6 +70,16 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem SubscribeAllEvent(OnHeavyAttack); SubscribeAllEvent(OnDisarmAttack); SubscribeAllEvent(OnStopAttack); + +#if DEBUG + SubscribeLocalEvent(OnMapInit); + } + + private void OnMapInit(EntityUid uid, MeleeWeaponComponent component, MapInitEvent args) + { + if (component.NextAttack > TimeSpan.Zero) + Logger.Warning($"Initializing a map that contains an entity that is on cooldown. Entity: {ToPrettyString(uid)}"); +#endif } private void OnMeleeSelected(EntityUid uid, MeleeWeaponComponent component, HandSelectedEvent args) @@ -80,6 +90,9 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem if (!component.ResetOnHandSelected) return; + if (Paused(uid)) + return; + // If someone swaps to this weapon then reset its cd. var curTime = Timing.CurTime; var minimum = curTime + TimeSpan.FromSeconds(1 / component.AttackRate); diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs index 3bd3e9d789..2b5b330fb5 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs @@ -152,7 +152,8 @@ public abstract partial class SharedGunSystem { // Reset shotting for cycling if (Resolve(uid, ref gunComp, false) && - gunComp is { FireRate: > 0f }) + gunComp is { FireRate: > 0f } && + !Paused(uid)) { gunComp.NextFire = Timing.CurTime + TimeSpan.FromSeconds(1 / gunComp.FireRate); } diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Interactions.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Interactions.cs index 953881d7d6..ae873f6f60 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Interactions.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Interactions.cs @@ -64,13 +64,17 @@ public abstract partial class SharedGunSystem DebugTools.Assert((component.AvailableModes & fire) != 0x0); component.SelectedMode = fire; - var curTime = Timing.CurTime; - var cooldown = TimeSpan.FromSeconds(InteractNextFire); - if (component.NextFire < curTime) - component.NextFire = curTime + cooldown; - else - component.NextFire += cooldown; + if (!Paused(uid)) + { + var curTime = Timing.CurTime; + var cooldown = TimeSpan.FromSeconds(InteractNextFire); + + if (component.NextFire < curTime) + component.NextFire = curTime + cooldown; + else + component.NextFire += cooldown; + } Audio.PlayPredicted(component.SoundModeToggle, uid, user); Popup(Loc.GetString("gun-selected-mode", ("mode", GetLocSelector(fire))), uid, user); diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index 1b0a1221ee..34ba12c7cd 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -88,6 +88,16 @@ public abstract partial class SharedGunSystem : EntitySystem SubscribeLocalEvent(OnExamine); SubscribeLocalEvent(OnCycleMode); SubscribeLocalEvent(OnGunInit); + +#if DEBUG + SubscribeLocalEvent(OnMapInit); + } + + private void OnMapInit(EntityUid uid, GunComponent component, MapInitEvent args) + { + if (component.NextFire > TimeSpan.Zero) + Logger.Warning($"Initializing a map that contains an entity that is on cooldown. Entity: {ToPrettyString(uid)}"); +#endif } private void OnGunInit(EntityUid uid, GunComponent component, ComponentInit args) diff --git a/Resources/Maps/Test/dev_map.yml b/Resources/Maps/Test/dev_map.yml index a9549ba17b..d7060e0f86 100644 --- a/Resources/Maps/Test/dev_map.yml +++ b/Resources/Maps/Test/dev_map.yml @@ -1055,8 +1055,6 @@ entities: - pos: -2.172831,4.5306726 parent: 179 type: Transform - - nextAttack: 384.7724706 - type: MeleeWeapon - uid: 148 type: Ointment components: @@ -1687,8 +1685,6 @@ entities: - pos: -3.4579864,-1.9811735 parent: 179 type: Transform - - nextAttack: 582.1216812 - type: MeleeWeapon - uid: 186 type: PowerCellMedium components: @@ -2617,16 +2613,12 @@ entities: - pos: -0.11783123,4.753312 parent: 179 type: Transform - - nextAttack: 244.2972008 - type: MeleeWeapon - uid: 328 type: MopItem components: - pos: 7.6382103,16.08618 parent: 179 type: Transform - - nextAttack: 3088.5283222 - type: MeleeWeapon - solutions: absorbed: temperature: 293.15 @@ -2728,8 +2720,6 @@ entities: - pos: 0.6895334,4.7183027 parent: 179 type: Transform - - nextAttack: 247.8805212 - type: MeleeWeapon - uid: 344 type: ClothingHeadHatWelding components: @@ -2838,8 +2828,6 @@ entities: - pos: -1.6207478,4.3951616 parent: 179 type: Transform - - nextAttack: 232.4472496 - type: MeleeWeapon - uid: 360 type: PowerCellMedium components: @@ -2973,8 +2961,6 @@ entities: - pos: -3.277628,-2.15838 parent: 179 type: Transform - - nextAttack: 578.7883598 - type: MeleeWeapon - uid: 382 type: SheetSteel components: @@ -3357,8 +3343,6 @@ entities: - pos: -1.235331,4.739151 parent: 179 type: Transform - - nextAttack: 385.5557994 - type: MeleeWeapon - uid: 432 type: ChemicalPayload components: @@ -3377,8 +3361,6 @@ entities: - pos: -3.1734612,-2.6066077 parent: 179 type: Transform - - nextAttack: 577.9550312 - type: MeleeWeapon - uid: 435 type: ModularGrenade components: @@ -5099,8 +5081,6 @@ entities: - pos: 1.1246341,7.500063 parent: 179 type: Transform - - nextAttack: 669.0197422 - type: MeleeWeapon - uid: 673 type: Poweredlight components: @@ -7191,13 +7171,11 @@ entities: parent: 179 type: Transform - uid: 956 - type: EmergencyOxygenTank + type: EmergencyOxygenTankFilled components: - pos: -10.505015,6.711994 parent: 179 type: Transform - - nextAttack: 396.1132382 - type: MeleeWeapon - uid: 957 type: AlwaysPoweredLightLED components: