2022-07-29 14:13:12 +12:00
|
|
|
using Robust.Shared.Audio;
|
2024-02-01 07:29:01 -06:00
|
|
|
using Robust.Shared.GameStates;
|
2020-07-06 16:37:39 -05:00
|
|
|
|
2025-06-23 13:32:56 +02:00
|
|
|
namespace Content.Shared.Flash.Components;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Allows this entity to flash someone by using it or melee attacking with it.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
|
|
|
|
[Access(typeof(SharedFlashSystem))]
|
|
|
|
|
public sealed partial class FlashComponent : Component
|
2020-07-06 16:37:39 -05:00
|
|
|
{
|
2025-06-23 13:32:56 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Flash the area around the entity when used in hand?
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public bool FlashOnUse = true;
|
2024-01-04 05:27:32 -07:00
|
|
|
|
2025-06-23 13:32:56 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Flash the target when melee attacking them?
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public bool FlashOnMelee = true;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
2025-06-23 13:32:56 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Time the Flash will be visually flashing after use.
|
|
|
|
|
/// For the actual interaction delay use UseDelayComponent.
|
|
|
|
|
/// These two times should be the same.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public TimeSpan FlashingTime = TimeSpan.FromSeconds(4);
|
2024-04-18 02:30:01 -04:00
|
|
|
|
2025-06-23 13:32:56 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// For how long the target will lose vision when melee attacked with the flash.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public TimeSpan MeleeDuration = TimeSpan.FromSeconds(5);
|
2020-07-06 16:37:39 -05:00
|
|
|
|
2025-06-23 13:32:56 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// For how long the target will lose vision when used in hand.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public TimeSpan AoeFlashDuration = TimeSpan.FromSeconds(2);
|
2020-07-06 16:37:39 -05:00
|
|
|
|
2025-06-23 13:32:56 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// How long a target is stunned when a melee flash is used.
|
|
|
|
|
/// If null, melee flashes will not stun at all.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public TimeSpan? MeleeStunDuration = TimeSpan.FromSeconds(1.5);
|
2020-07-06 16:37:39 -05:00
|
|
|
|
2025-06-23 13:32:56 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Range of the flash when using it.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public float Range = 7f;
|
2021-07-10 17:35:33 +02:00
|
|
|
|
2025-06-23 13:32:56 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Movement speed multiplier for slowing down the target while they are flashed.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public float SlowTo = 0.5f;
|
2024-04-18 03:08:42 +03:00
|
|
|
|
2025-06-23 13:32:56 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// The sound to play when flashing.
|
|
|
|
|
/// </summary>
|
2024-06-02 06:17:53 +02:00
|
|
|
|
2025-06-23 13:32:56 +02:00
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Weapons/flash.ogg")
|
2024-06-02 06:17:53 +02:00
|
|
|
{
|
2025-06-23 13:32:56 +02:00
|
|
|
Params = AudioParams.Default.WithVolume(1f).WithMaxDistance(3f)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The probability of sucessfully flashing someone.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public float Probability = 1f;
|
2020-07-06 16:37:39 -05:00
|
|
|
}
|