multi-gun nerf (#20194)

This commit is contained in:
Nemanja
2023-09-15 00:15:42 -04:00
committed by GitHub
parent 49581e1ec0
commit 170e559417
3 changed files with 32 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
using Content.Shared.Actions;
using Content.Shared.Examine;
using Content.Shared.Hands;
using Content.Shared.Verbs;
using Content.Shared.Weapons.Ranged.Components;
using Robust.Shared.Utility;
@@ -103,4 +104,27 @@ public abstract partial class SharedGunSystem
{
SelectFire(uid, component, args.Mode, args.Performer);
}
private void OnGunSelected(EntityUid uid, GunComponent component, HandSelectedEvent args)
{
var fireDelay = 1f / component.FireRate;
if (fireDelay.Equals(0f))
return;
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(fireDelay);
if (minimum < component.NextFire)
return;
component.NextFire = minimum;
Dirty(uid, component);
}
}