2023-01-16 10:56:09 -06:00
|
|
|
|
using Content.Shared.Tools;
|
|
|
|
|
|
using Robust.Shared.GameStates;
|
|
|
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared.PneumaticCannon;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Handles gas powered guns--cancels shooting if no gas is available, and takes gas from the given container slot.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[RegisterComponent, NetworkedComponent]
|
2023-08-22 18:14:33 -07:00
|
|
|
|
public sealed partial class PneumaticCannonComponent : Component
|
2023-01-16 10:56:09 -06:00
|
|
|
|
{
|
|
|
|
|
|
public const string TankSlotId = "gas_tank";
|
|
|
|
|
|
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
|
public PneumaticCannonPower Power = PneumaticCannonPower.Medium;
|
|
|
|
|
|
|
|
|
|
|
|
[DataField("toolModifyPower", customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
|
|
|
|
|
|
public string ToolModifyPower = "Anchoring";
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// How long to stun for if they shoot the pneumatic cannon at high power.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[DataField("highPowerStunTime")]
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
|
public float HighPowerStunTime = 3.0f;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Amount of moles to consume for each shot at any power.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[DataField("gasUsage")]
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2024-01-27 14:36:11 +03:00
|
|
|
|
public float GasUsage = 2f;
|
2023-01-16 10:56:09 -06:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Base projectile speed at default power.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[DataField("baseProjectileSpeed")]
|
|
|
|
|
|
public float BaseProjectileSpeed = 20f;
|
2023-03-25 23:15:46 +00:00
|
|
|
|
|
2024-01-28 15:32:42 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The current projectile speed setting.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[DataField]
|
|
|
|
|
|
public float? ProjectileSpeed;
|
|
|
|
|
|
|
2023-03-25 23:15:46 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// If true, will throw ammo rather than shoot it.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[DataField("throwItems"), ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
|
public bool ThrowItems = true;
|
2023-01-16 10:56:09 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// How strong the pneumatic cannon should be.
|
|
|
|
|
|
/// Each tier throws items farther and with more speed, but has drawbacks.
|
|
|
|
|
|
/// The highest power knocks the player down for a considerable amount of time.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public enum PneumaticCannonPower : byte
|
|
|
|
|
|
{
|
|
|
|
|
|
Low = 0,
|
|
|
|
|
|
Medium = 1,
|
|
|
|
|
|
High = 2,
|
|
|
|
|
|
Len = 3 // used for length calc
|
|
|
|
|
|
}
|