PneumaticCannonComponent.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using Content.Shared.Tools;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  4. namespace Content.Shared.PneumaticCannon;
  5. /// <summary>
  6. /// Handles gas powered guns--cancels shooting if no gas is available, and takes gas from the given container slot.
  7. /// </summary>
  8. [RegisterComponent, NetworkedComponent]
  9. public sealed partial class PneumaticCannonComponent : Component
  10. {
  11. public const string TankSlotId = "gas_tank";
  12. [ViewVariables(VVAccess.ReadWrite)]
  13. public PneumaticCannonPower Power = PneumaticCannonPower.Medium;
  14. [DataField("toolModifyPower", customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
  15. public string ToolModifyPower = "Anchoring";
  16. /// <summary>
  17. /// How long to stun for if they shoot the pneumatic cannon at high power.
  18. /// </summary>
  19. [DataField("highPowerStunTime")]
  20. [ViewVariables(VVAccess.ReadWrite)]
  21. public float HighPowerStunTime = 3.0f;
  22. /// <summary>
  23. /// Amount of moles to consume for each shot at any power.
  24. /// </summary>
  25. [DataField("gasUsage")]
  26. [ViewVariables(VVAccess.ReadWrite)]
  27. public float GasUsage = 0.142f;
  28. /// <summary>
  29. /// Base projectile speed at default power.
  30. /// </summary>
  31. [DataField("baseProjectileSpeed")]
  32. public float BaseProjectileSpeed = 20f;
  33. /// <summary>
  34. /// The current projectile speed setting.
  35. /// </summary>
  36. [DataField]
  37. public float? ProjectileSpeed;
  38. /// <summary>
  39. /// If true, will throw ammo rather than shoot it.
  40. /// </summary>
  41. [DataField("throwItems"), ViewVariables(VVAccess.ReadWrite)]
  42. public bool ThrowItems = true;
  43. }
  44. /// <summary>
  45. /// How strong the pneumatic cannon should be.
  46. /// Each tier throws items farther and with more speed, but has drawbacks.
  47. /// The highest power knocks the player down for a considerable amount of time.
  48. /// </summary>
  49. public enum PneumaticCannonPower : byte
  50. {
  51. Low = 0,
  52. Medium = 1,
  53. High = 2,
  54. Len = 3 // used for length calc
  55. }