using Content.Shared.Inventory;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Weapons.Reflect;
///
/// Entities with this component have a chance to reflect projectiles and hitscan shots
/// Uses ItemToggleComponent to control reflection.
///
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class ReflectComponent : Component
{
///
/// What we reflect.
///
[DataField]
public ReflectType Reflects = ReflectType.Energy | ReflectType.NonEnergy;
///
/// Select in which inventory slots it will reflect.
/// By default, it will reflect in any inventory position, except pockets.
///
[DataField]
public SlotFlags SlotFlags = SlotFlags.WITHOUT_POCKET;
///
/// Is it allowed to reflect while being in hands.
///
[DataField, AutoNetworkedField]
public bool ReflectingInHands = true;
///
/// Can only reflect when placed correctly.
///
[DataField, AutoNetworkedField]
public bool InRightPlace;
///
/// Probability for a projectile to be reflected.
///
[DataField, AutoNetworkedField]
public float ReflectProb = 0.25f;
///
/// Probability for a projectile to be reflected.
///
[DataField, AutoNetworkedField]
public Angle Spread = Angle.FromDegrees(45);
///
/// The sound to play when reflecting.
///
[DataField]
public SoundSpecifier? SoundOnReflect = new SoundPathSpecifier("/Audio/Weapons/Guns/Hits/laser_sear_wall.ogg", AudioParams.Default.WithVariation(0.05f));
}
[Flags, Serializable, NetSerializable]
public enum ReflectType : byte
{
None = 0,
NonEnergy = 1 << 0,
Energy = 1 << 1,
}