using Robust.Shared.Audio; using Robust.Shared.GameStates; namespace Content.Shared.Weapons.Reflect; /// /// Entities with this component have a chance to reflect projectiles and hitscan shots /// [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] public sealed partial class ReflectComponent : Component { /// /// Can only reflect when enabled /// [DataField("enabled"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public bool Enabled = true; /// /// What we reflect. /// [ViewVariables(VVAccess.ReadWrite), DataField("reflects")] public ReflectType Reflects = ReflectType.Energy | ReflectType.NonEnergy; [DataField("spread"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public Angle Spread = Angle.FromDegrees(45); [DataField("soundOnReflect")] public SoundSpecifier? SoundOnReflect = new SoundPathSpecifier("/Audio/Weapons/Guns/Hits/laser_sear_wall.ogg"); /// /// Is the deflection an innate power or something actively maintained? If true, this component grants a flat /// deflection chance rather than a chance that degrades when moving/weightless/stunned/etc. /// [DataField] public bool Innate = false; /// /// Maximum probability for a projectile to be reflected. /// [DataField("reflectProb"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public float ReflectProb = 0.25f; /// /// The maximum velocity a wielder can move at before losing effectiveness. /// [DataField] public float VelocityBeforeNotMaxProb = 2.5f; // Walking speed for a human. Suitable for a weightless deflector like an e-sword. /// /// The velocity a wielder has to be moving at to use the minimum effectiveness value. /// [DataField] public float VelocityBeforeMinProb = 4.5f; // Sprinting speed for a human. Suitable for a weightless deflector like an e-sword. /// /// Minimum probability for a projectile to be reflected. /// [DataField] public float MinReflectProb = 0.1f; } [Flags] public enum ReflectType : byte { None = 0, NonEnergy = 1 << 0, Energy = 1 << 1, }