Fix stun batons using excess charges when thrown (#30136)

Fix stun batons

Co-authored-by: plykiya <plykiya@protonmail.com>
This commit is contained in:
Plykiya 2024-07-17 17:48:08 -07:00 committed by GitHub
parent d7b2e72882
commit 961a553fa2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -192,6 +192,11 @@ public sealed partial class StaminaSystem : EntitySystem
private void OnCollide(EntityUid uid, StaminaDamageOnCollideComponent component, EntityUid target)
{
// you can't inflict stamina damage on things with no stamina component
// this prevents stun batons from using up charges when throwing it at lockers or lights
if (!HasComp<StaminaComponent>(target))
return;
var ev = new StaminaDamageOnHitAttemptEvent();
RaiseLocalEvent(uid, ref ev);
if (ev.Cancelled)