using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Weapons.Ranged.Components;
///
/// Allows the entity to be fired from a gun.
///
[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.
[ViewVariables(VVAccess.ReadWrite), DataField("muzzleFlash", customTypeSerializer:typeof(PrototypeIdSerializer))]
public string? MuzzleFlash = "MuzzleFlashEffect";
}
///
/// Spawns another prototype to be shot instead of itself.
///
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class CartridgeAmmoComponent : AmmoComponent
{
[ViewVariables(VVAccess.ReadWrite), DataField("proto", required: true, customTypeSerializer: typeof(PrototypeIdSerializer))]
public string Prototype = default!;
[ViewVariables(VVAccess.ReadWrite), DataField("spent")]
[AutoNetworkedField]
public bool Spent = false;
///
/// Caseless ammunition.
///
[DataField("deleteOnSpawn")]
public bool DeleteOnSpawn;
[DataField("soundEject")]
public SoundSpecifier? EjectSound = new SoundCollectionSpecifier("CasingEject");
}