Blindness refactor (#15705)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
41
Content.Shared/Eye/Blinding/Components/BlindableComponent.cs
Normal file
41
Content.Shared/Eye/Blinding/Components/BlindableComponent.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using Content.Shared.Eye.Blinding.Systems;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Eye.Blinding.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent, AutoGenerateComponentState]
|
||||
[Access(typeof(BlindableSystem))]
|
||||
public sealed partial class BlindableComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// How many seconds will be subtracted from each attempt to add blindness to us?
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("isBlind"), AutoNetworkedField]
|
||||
public bool IsBlind;
|
||||
|
||||
/// <summary>
|
||||
/// Eye damage due to things like staring directly at welders. Causes blurry vision or outright
|
||||
/// blindness if greater than or equal to <see cref="MaxDamage"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Should eventually be replaced with a proper eye health system when we have bobby.
|
||||
/// </remarks>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("EyeDamage"), AutoNetworkedField]
|
||||
public int EyeDamage = 0;
|
||||
|
||||
public const int MaxDamage = 8;
|
||||
|
||||
/// <description>
|
||||
/// Used to ensure that this doesn't break with sandbox or admin tools.
|
||||
/// This is not "enabled/disabled".
|
||||
/// </description>
|
||||
[Access(Other = AccessPermissions.ReadWriteExecute)]
|
||||
public bool LightSetup = false;
|
||||
|
||||
/// <description>
|
||||
/// Gives an extra frame of blindness to reenable light manager during
|
||||
/// </description>
|
||||
[Access(Other = AccessPermissions.ReadWriteExecute)]
|
||||
public bool GraceFrame = false;
|
||||
}
|
||||
12
Content.Shared/Eye/Blinding/Components/BlindfoldComponent.cs
Normal file
12
Content.Shared/Eye/Blinding/Components/BlindfoldComponent.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Eye.Blinding.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Blinds a person when an item with this component is equipped to the eye, head, or mask slot.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent]
|
||||
public sealed class BlindfoldComponent : Component
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Content.Shared.Eye.Blinding.Systems;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Eye.Blinding.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This component adds a white overlay to the viewport. It does not actually cause blurring.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent, AutoGenerateComponentState]
|
||||
[Access(typeof(BlurryVisionSystem))]
|
||||
public sealed partial class BlurryVisionComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Amount of "blurring". Also modifies examine ranges.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("magnitude"), AutoNetworkedField]
|
||||
public float Magnitude;
|
||||
|
||||
public const float MaxMagnitude = 10;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Content.Shared.Eye.Blinding.Components;
|
||||
|
||||
/// <summary>
|
||||
/// For welding masks, sunglasses, etc.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class EyeProtectionComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// How many seconds to subtract from the status effect. If it's greater than the source
|
||||
/// of blindness, do not blind.
|
||||
/// </summary>
|
||||
[DataField("protectionTime")]
|
||||
public readonly TimeSpan ProtectionTime = TimeSpan.FromSeconds(10);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Eye.Blinding.Components;
|
||||
|
||||
/// <summary>
|
||||
/// For tools like welders that will damage your eyes when you use them.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class RequiresEyeProtectionComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// How long to apply temporary blindness to the user.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("statusEffectTime"), AutoNetworkedField]
|
||||
public TimeSpan StatusEffectTime = TimeSpan.FromSeconds(10);
|
||||
|
||||
/// <summary>
|
||||
/// You probably want to turn this on in yaml if it's something always on and not a welder.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("toggled"), AutoNetworkedField]
|
||||
public bool Toggled;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Eye.Blinding.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Component used for the blind status effect.
|
||||
/// </summary>
|
||||
[NetworkedComponent, RegisterComponent]
|
||||
public sealed class TemporaryBlindnessComponent : Component
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Eye.Blinding.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This component allows equipment to offset blurry vision.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class VisionCorrectionComponent : Component
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("visionBonus"), AutoNetworkedField]
|
||||
public float VisionBonus = 3f;
|
||||
}
|
||||
Reference in New Issue
Block a user