diff --git a/Content.Shared/Weapons/Ranged/Components/AmmoComponent.cs b/Content.Shared/Weapons/Ranged/Components/AmmoComponent.cs index 0ba8a5faee..0fedf95146 100644 --- a/Content.Shared/Weapons/Ranged/Components/AmmoComponent.cs +++ b/Content.Shared/Weapons/Ranged/Components/AmmoComponent.cs @@ -34,6 +34,12 @@ public sealed partial class CartridgeAmmoComponent : AmmoComponent [DataField, AutoNetworkedField] public bool Spent; + /// + /// Is this cartridge automatically marked as trash once spent? + /// + [DataField, AutoNetworkedField] + public bool MarkSpentAsTrash = true; + /// /// Caseless ammunition. /// diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index e3fbec0d5d..952b53acf2 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -65,6 +65,8 @@ public abstract partial class SharedGunSystem : EntitySystem [Dependency] private readonly UseDelaySystem _useDelay = default!; [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!; + private static readonly ProtoId TrashTag = "Trash"; + private const float InteractNextFire = 0.3f; private const double SafetyNextFire = 0.5; private const float EjectOffset = 0.4f; @@ -452,6 +454,14 @@ public abstract partial class SharedGunSystem : EntitySystem cartridge.Spent = spent; Appearance.SetData(uid, AmmoVisuals.Spent, spent); + + if (!cartridge.MarkSpentAsTrash) + return; + + if (spent) + TagSystem.AddTag(uid, TrashTag); + else + TagSystem.RemoveTag(uid, TrashTag); } /// diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/pistol.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/pistol.yml index ba2b856778..3862918e38 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/pistol.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/pistol.yml @@ -89,3 +89,7 @@ - type: CartridgeAmmo proto: BulletPistol spent: true + - type: Tag + tags: + - CartridgePistol + - Trash # surely theres a way to automatically add this...