BatteryWeaponFireModesComponent.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using Content.Shared.Weapons.Ranged.Systems;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Prototypes;
  4. using Robust.Shared.Serialization;
  5. namespace Content.Shared.Weapons.Ranged.Components;
  6. /// <summary>
  7. /// Allows battery weapons to fire different types of projectiles
  8. /// </summary>
  9. [RegisterComponent, NetworkedComponent]
  10. [Access(typeof(BatteryWeaponFireModesSystem))]
  11. [AutoGenerateComponentState]
  12. public sealed partial class BatteryWeaponFireModesComponent : Component
  13. {
  14. /// <summary>
  15. /// A list of the different firing modes the weapon can switch between
  16. /// </summary>
  17. [DataField(required: true)]
  18. [AutoNetworkedField]
  19. public List<BatteryWeaponFireMode> FireModes = new();
  20. /// <summary>
  21. /// The currently selected firing mode
  22. /// </summary>
  23. [DataField]
  24. [AutoNetworkedField]
  25. public int CurrentFireMode;
  26. }
  27. [DataDefinition, Serializable, NetSerializable]
  28. public sealed partial class BatteryWeaponFireMode
  29. {
  30. /// <summary>
  31. /// The projectile prototype associated with this firing mode
  32. /// </summary>
  33. [DataField("proto", required: true)]
  34. public EntProtoId Prototype = default!;
  35. /// <summary>
  36. /// The battery cost to fire the projectile associated with this firing mode
  37. /// </summary>
  38. [DataField]
  39. public float FireCost = 100;
  40. }