AmmoComponent.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using Robust.Shared.Audio;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Prototypes;
  4. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  5. namespace Content.Shared.Weapons.Ranged.Components;
  6. /// <summary>
  7. /// Allows the entity to be fired from a gun.
  8. /// </summary>
  9. [RegisterComponent, Virtual]
  10. public partial class AmmoComponent : Component, IShootable
  11. {
  12. // Muzzle flash stored on ammo because if we swap a gun to whatever we may want to override it.
  13. [DataField]
  14. public EntProtoId? MuzzleFlash = "MuzzleFlashEffect";
  15. }
  16. /// <summary>
  17. /// Spawns another prototype to be shot instead of itself.
  18. /// </summary>
  19. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(fieldDeltas: true)]
  20. public sealed partial class CartridgeAmmoComponent : AmmoComponent
  21. {
  22. [ViewVariables(VVAccess.ReadWrite), DataField("proto", required: true)]
  23. public EntProtoId Prototype;
  24. [ViewVariables(VVAccess.ReadWrite), DataField]
  25. [AutoNetworkedField]
  26. public bool Spent;
  27. /// <summary>
  28. /// Caseless ammunition.
  29. /// </summary>
  30. [DataField]
  31. public bool DeleteOnSpawn;
  32. [DataField("soundEject")]
  33. public SoundSpecifier? EjectSound = new SoundCollectionSpecifier("CasingEject");
  34. }