using Content.Shared.Sound; using Content.Shared.Tools; using Robust.Shared.Containers; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; namespace Content.Server.PneumaticCannon { // TODO: ideally, this and most of the actual firing code doesn't need to exist, and guns can be flexible enough // to handle shooting things that aren't ammo (just firing any entity) [RegisterComponent, Access(typeof(PneumaticCannonSystem))] public sealed class PneumaticCannonComponent : Component { [ViewVariables] public ContainerSlot GasTankSlot = default!; [ViewVariables(VVAccess.ReadWrite)] public PneumaticCannonPower Power = PneumaticCannonPower.Low; [ViewVariables(VVAccess.ReadWrite)] public PneumaticCannonFireMode Mode = PneumaticCannonFireMode.Single; /// /// Used to fire the pneumatic cannon in intervals rather than all at the same time /// public float AccumulatedFrametime; public Queue FireQueue = new(); [DataField("fireInterval")] public float FireInterval = 0.1f; /// /// Whether the pneumatic cannon should instantly fire once, or whether it should wait for the /// fire interval initially. /// [DataField("instantFire")] public bool InstantFire = true; [DataField("toolModifyPower", customTypeSerializer:typeof(PrototypeIdSerializer))] public string ToolModifyPower = "Welding"; [DataField("toolModifyMode", customTypeSerializer:typeof(PrototypeIdSerializer))] public string ToolModifyMode = "Screwing"; /// /// If this value is too high it just straight up stops working for some reason /// [DataField("throwStrength")] [ViewVariables(VVAccess.ReadWrite)] public float ThrowStrength = 20.0f; [DataField("baseThrowRange")] [ViewVariables(VVAccess.ReadWrite)] public float BaseThrowRange = 8.0f; /// /// How long to stun for if they shoot the pneumatic cannon at high power. /// [DataField("highPowerStunTime")] [ViewVariables(VVAccess.ReadWrite)] public float HighPowerStunTime = 3.0f; [DataField("gasTankRequired")] [ViewVariables(VVAccess.ReadWrite)] public bool GasTankRequired = true; [DataField("fireSound")] [ViewVariables(VVAccess.ReadWrite)] public SoundSpecifier FireSound = new SoundPathSpecifier("/Audio/Effects/thunk.ogg"); public struct FireData { public EntityUid User; public float Strength; public Vector2 Direction; } } /// /// 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. /// public enum PneumaticCannonPower : byte { Low = 0, Medium = 1, High = 2, Len = 3 // used for length calc } /// /// Whether to shoot one random item at a time, or all items at the same time. /// public enum PneumaticCannonFireMode : byte { Single = 0, All = 1, Len = 2 // used for length calc } }