1
0

BallisticAmmoProviderComponent.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using Content.Shared.Weapons.Ranged.Systems;
  2. using Content.Shared.Whitelist;
  3. using Robust.Shared.Audio;
  4. using Robust.Shared.Containers;
  5. using Robust.Shared.GameStates;
  6. using Robust.Shared.Prototypes;
  7. namespace Content.Shared.Weapons.Ranged.Components;
  8. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(fieldDeltas: true), Access(typeof(SharedGunSystem))]
  9. public sealed partial class BallisticAmmoProviderComponent : Component
  10. {
  11. [DataField]
  12. public SoundSpecifier? SoundRack = new SoundPathSpecifier("/Audio/Weapons/Guns/Cock/smg_cock.ogg");
  13. [DataField]
  14. public SoundSpecifier? SoundInsert = new SoundPathSpecifier("/Audio/Weapons/Guns/MagIn/bullet_insert.ogg");
  15. [ViewVariables(VVAccess.ReadWrite), DataField]
  16. public EntProtoId? Proto;
  17. [ViewVariables(VVAccess.ReadWrite), DataField]
  18. public int Capacity = 30;
  19. public int Count => UnspawnedCount + Container.ContainedEntities.Count;
  20. [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
  21. public int UnspawnedCount;
  22. [ViewVariables(VVAccess.ReadWrite), DataField]
  23. public EntityWhitelist? Whitelist;
  24. public Container Container = default!;
  25. // TODO: Make this use stacks when the typeserializer is done.
  26. // Realistically just point to the container.
  27. [DataField, AutoNetworkedField]
  28. public List<EntityUid> Entities = new();
  29. /// <summary>
  30. /// Is the magazine allowed to be manually cycled to eject a cartridge.
  31. /// </summary>
  32. /// <remarks>
  33. /// Set to false for entities like turrets to avoid users being able to cycle them.
  34. /// </remarks>
  35. [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
  36. public bool Cycleable = true;
  37. /// <summary>
  38. /// Is it okay for this entity to directly transfer its valid ammunition into another provider?
  39. /// </summary>
  40. [ViewVariables(VVAccess.ReadWrite), DataField]
  41. public bool MayTransfer;
  42. /// <summary>
  43. /// DoAfter delay for filling a bullet into another ballistic ammo provider.
  44. /// </summary>
  45. [DataField]
  46. public TimeSpan FillDelay = TimeSpan.FromSeconds(0.5);
  47. /// <summary>
  48. /// Goobstation - is ammo automatically ejected after each shot
  49. /// </summary>
  50. [DataField]
  51. public bool AutoCycle = true;
  52. }