Files
tbd-station-14/Content.Shared/Weapons/Ranged/Components/AmmoComponent.cs
Callmore 2696fd7cd5 Automatically add trash tag to spent bullet casings (#40829)
* Automatically add trash tag to spent bullet casings

* Resolving comments

* 2

* Update Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/pistol.yml

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2025-10-12 18:34:20 +00:00

55 lines
1.5 KiB
C#

using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.Weapons.Ranged.Components;
/// <summary>
/// Allows the entity to be fired from a gun.
/// </summary>
[RegisterComponent, Virtual]
public partial class AmmoComponent : Component, IShootable
{
// Muzzle flash stored on ammo because if we swap a gun to whatever we may want to override it.
[DataField]
public EntProtoId? MuzzleFlash = "MuzzleFlashEffect";
}
/// <summary>
/// Spawns another prototype to be shot instead of itself.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(fieldDeltas: true)]
public sealed partial class CartridgeAmmoComponent : AmmoComponent
{
/// <summary>
/// Prototype of the ammo to be shot.
/// </summary>
[DataField("proto", required: true)]
public EntProtoId Prototype;
/// <summary>
/// Is this cartridge spent?
/// </summary>
[DataField, AutoNetworkedField]
public bool Spent;
/// <summary>
/// Is this cartridge automatically marked as trash once spent?
/// </summary>
[DataField, AutoNetworkedField]
public bool MarkSpentAsTrash = true;
/// <summary>
/// Caseless ammunition.
/// </summary>
[DataField]
public bool DeleteOnSpawn;
/// <summary>
/// Sound the case makes when it leaves the weapon.
/// </summary>
[DataField("soundEject")]
public SoundSpecifier? EjectSound = new SoundCollectionSpecifier("CasingEject");
}