Disposable turret explodes when empty (#18175)

* turret go boom

* fix ammo

* universal function name

* Also explodes when destroyed

* comment added

* Triggerwhenemptycomponent added

* comment adjusted

* Updated uplink description

* Moved to own event file

* file namespace

* rerun tests

---------

Co-authored-by: Slava0135 <super.novalskiy_0135@inbox.ru>
This commit is contained in:
Arendian
2023-08-01 21:38:22 +02:00
committed by GitHub
parent 78c66cca75
commit 4cd70b241c
8 changed files with 47 additions and 20 deletions

View File

@@ -7,7 +7,6 @@ using Content.Shared.Damage;
using Content.Shared.Examine;
using Content.Shared.Gravity;
using Content.Shared.Hands.Components;
using Content.Shared.Interaction.Events;
using Content.Shared.Popups;
using Content.Shared.Projectiles;
using Content.Shared.Tag;
@@ -304,6 +303,10 @@ public abstract partial class SharedGunSystem : EntitySystem
if (ev.Ammo.Count <= 0)
{
// triggers effects on the gun if it's empty
var emptyGunShotEvent = new OnEmptyGunShotEvent();
RaiseLocalEvent(gunUid, ref emptyGunShotEvent);
// Play empty gun sounds if relevant
// If they're firing an existing clip then don't play anything.
if (shots > 0)