Files
wwdpublic/Content.Shared/_Goobstation/Weapons/Wielding/UnwieldOnShootSystem.cs
Aviu00 1a6270309a Yuh
(cherry picked from commit dc051987ca50fc97848285b66eca9694e31f7941)
2025-03-21 17:37:58 +03:00

24 lines
701 B
C#

using Content.Shared.Weapons.Ranged.Systems;
using Content.Shared.Wieldable;
using Content.Shared.Wieldable.Components;
namespace Content.Shared._Goobstation.Weapons.Wielding;
public sealed class UnwieldOnShootSystem : EntitySystem
{
[Dependency] private readonly WieldableSystem _wieldable = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<UnwieldOnShootComponent, GunShotEvent>(OnShoot);
}
private void OnShoot(EntityUid uid, UnwieldOnShootComponent component, ref GunShotEvent args)
{
if (TryComp(uid, out WieldableComponent? wieldable))
_wieldable.TryUnwield(uid, wieldable, args.User);
}
}