add an event to prevent gun shooting (#17104)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -221,8 +221,13 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
|
||||
var curTime = Timing.CurTime;
|
||||
|
||||
// Maybe Raise an event for this? CanAttack doesn't seem appropriate.
|
||||
if (TryComp<MeleeWeaponComponent>(gunUid, out var melee) && melee.NextAttack > curTime)
|
||||
// check if anything wants to prevent shooting
|
||||
var prevention = new ShotAttemptedEvent
|
||||
{
|
||||
User = user
|
||||
};
|
||||
RaiseLocalEvent(gunUid, ref prevention);
|
||||
if (prevention.Cancelled)
|
||||
return;
|
||||
|
||||
// Need to do this to play the clicking sound for empty automatic weapons
|
||||
|
||||
Reference in New Issue
Block a user