Remove file delay system.

It didn't work and was replaced by just spamming mouse updates.

It caused guns to fire twice on accident.
This commit is contained in:
Pieter-Jan Briers
2020-05-28 14:32:10 +02:00
parent 1fc20a4e14
commit 785ecacb32

View File

@@ -2,7 +2,6 @@
using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.EntitySystems; using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Weapons.Ranged; using Content.Shared.GameObjects.Components.Weapons.Ranged;
using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network; using Robust.Shared.Interfaces.Network;
@@ -10,7 +9,6 @@ using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Players; using Robust.Shared.Players;
using Robust.Shared.Timers;
namespace Content.Server.GameObjects.Components.Weapon.Ranged namespace Content.Server.GameObjects.Components.Weapon.Ranged
{ {
@@ -23,8 +21,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged
public Func<IEntity, bool> UserCanFireHandler; public Func<IEntity, bool> UserCanFireHandler;
public Action<IEntity, GridCoordinates> FireHandler; public Action<IEntity, GridCoordinates> FireHandler;
private const int MaxFireDelayAttempts = 2;
private bool WeaponCanFire() private bool WeaponCanFire()
{ {
return WeaponCanFireHandler == null || WeaponCanFireHandler(); return WeaponCanFireHandler == null || WeaponCanFireHandler();
@@ -59,12 +55,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged
return; return;
} }
_tryFire(user, msg.Target, 0); _tryFire(user, msg.Target);
break; 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) 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; var span = curTime - _lastFireTime;
if (span.TotalSeconds < 1 / FireRate) if (span.TotalSeconds < 1 / FireRate)
{ {
if (attemptCount >= MaxFireDelayAttempts)
{
return;
}
Timer.Spawn(TimeSpan.FromSeconds(1 / FireRate) - span,
() => _tryFire(user, coordinates, attemptCount + 1));
return; return;
} }