From 785ecacb325559b91758d253ddbc73eb52a951a9 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Thu, 28 May 2020 14:32:10 +0200 Subject: [PATCH] Remove file delay system. It didn't work and was replaced by just spamming mouse updates. It caused guns to fire twice on accident. --- .../Components/Weapon/Ranged/RangedWeapon.cs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/RangedWeapon.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/RangedWeapon.cs index 27eebae68e..44207ba68c 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/RangedWeapon.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/RangedWeapon.cs @@ -2,7 +2,6 @@ using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.EntitySystems; using Content.Shared.GameObjects.Components.Weapons.Ranged; -using Robust.Server.Interfaces.Player; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Network; @@ -10,7 +9,6 @@ using Robust.Shared.Interfaces.Timing; using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Players; -using Robust.Shared.Timers; namespace Content.Server.GameObjects.Components.Weapon.Ranged { @@ -23,8 +21,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged public Func UserCanFireHandler; public Action FireHandler; - private const int MaxFireDelayAttempts = 2; - private bool WeaponCanFire() { return WeaponCanFireHandler == null || WeaponCanFireHandler(); @@ -59,12 +55,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged return; } - _tryFire(user, msg.Target, 0); + _tryFire(user, msg.Target); break; } } - private void _tryFire(IEntity user, GridCoordinates coordinates, int attemptCount) + private void _tryFire(IEntity user, GridCoordinates coordinates) { if (!user.TryGetComponent(out HandsComponent hands) || hands.GetActiveHand?.Owner != Owner) { @@ -88,13 +84,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged var span = curTime - _lastFireTime; if (span.TotalSeconds < 1 / FireRate) { - if (attemptCount >= MaxFireDelayAttempts) - { - return; - } - - Timer.Spawn(TimeSpan.FromSeconds(1 / FireRate) - span, - () => _tryFire(user, coordinates, attemptCount + 1)); return; }