From 3f90fc78d3ff72af406f3b44bd9dc1a749ce4110 Mon Sep 17 00:00:00 2001 From: Adrian16199 Date: Sat, 9 Sep 2023 20:38:11 +0200 Subject: [PATCH 01/11] Adds NearSighted trait from Parkstation. Code made by DEATHB4DEFEAT. --- .../Overlays/Shaders/NearsightedOverlays.cs | 101 ++++++++++++++++++ .../Overlays/Systems/NearsightedSystem.cs | 44 ++++++++ .../Traits/Components/NearsightedComponent.cs | 26 +++++ .../accessories/new_hair.ftl | 0 .../en-US/delta-v/traits/new_traits.ftl | 4 + .../Clothing/Eyes/prescription_glasses.yml | 2 + .../Prototypes/DeltaV/Traits/New_traits.yml | 7 ++ .../Entities/Clothing/Eyes/glasses.yml | 2 + 8 files changed, 186 insertions(+) create mode 100644 Content.Client/Delta-V/Overlays/Shaders/NearsightedOverlays.cs create mode 100644 Content.Client/Delta-V/Overlays/Systems/NearsightedSystem.cs create mode 100644 Content.Shared/Delta-V/Traits/Components/NearsightedComponent.cs rename Resources/Locale/en-US/{deltav => delta-v}/accessories/new_hair.ftl (100%) create mode 100644 Resources/Locale/en-US/delta-v/traits/new_traits.ftl create mode 100644 Resources/Prototypes/DeltaV/Entities/Clothing/Eyes/prescription_glasses.yml create mode 100644 Resources/Prototypes/DeltaV/Traits/New_traits.yml diff --git a/Content.Client/Delta-V/Overlays/Shaders/NearsightedOverlays.cs b/Content.Client/Delta-V/Overlays/Shaders/NearsightedOverlays.cs new file mode 100644 index 0000000000..551aaa6794 --- /dev/null +++ b/Content.Client/Delta-V/Overlays/Shaders/NearsightedOverlays.cs @@ -0,0 +1,101 @@ +using Robust.Client.GameObjects; +using Robust.Client.Graphics; +using Robust.Client.Player; +using Robust.Shared.Enums; +using Robust.Shared.Prototypes; +using Robust.Shared.Timing; +using Content.Shared.DeltaV.Traits; + + +namespace Content.Client.DeltaV.Overlays; + +public sealed class NearsightedOverlay : Overlay +{ + [Dependency] private readonly IGameTiming _timing = default!; + [Dependency] private readonly IPrototypeManager _prototypeManager = default!; + [Dependency] private readonly IEntityManager _entityManager = default!; + [Dependency] private readonly IPlayerManager _playerManager = default!; + + public override OverlaySpace Space => OverlaySpace.WorldSpace; + + private readonly ShaderInstance _nearsightShader; + + public float OxygenLevel = 0f; + private float _oldOxygenLevel = 0f; + public float outerDarkness = 1f; + + public NearsightedOverlay() + { + IoCManager.InjectDependencies(this); + _nearsightShader = _prototypeManager.Index("GradientCircleMask").InstanceUnique(); + } + + protected override void Draw(in OverlayDrawArgs args) + { + if (!_entityManager.TryGetComponent(_playerManager.LocalPlayer?.ControlledEntity, out NearsightedComponent? nearComp)) return; + if (_playerManager.LocalPlayer?.ControlledEntity != nearComp.Owner) return; + + if (nearComp.Glasses == true) + { + OxygenLevel = nearComp.gRadius; + outerDarkness = nearComp.gAlpha; + } + else + { + OxygenLevel = nearComp.Radius; + outerDarkness = nearComp.Alpha; + } + + if (!_entityManager.TryGetComponent(_playerManager.LocalPlayer?.ControlledEntity, out EyeComponent? eyeComp)) return; + if (args.Viewport.Eye != eyeComp.Eye) return; + + var viewport = args.WorldAABB; + var handle = args.WorldHandle; + var distance = args.ViewportBounds.Width; + + var time = (float) _timing.RealTime.TotalSeconds; + var lastFrameTime = (float) _timing.FrameTime.TotalSeconds; + + if (!MathHelper.CloseTo(_oldOxygenLevel, OxygenLevel, 0.001f)) + { + var diff = OxygenLevel - _oldOxygenLevel; + _oldOxygenLevel += GetDiff(diff, lastFrameTime); + } + else + { + _oldOxygenLevel = OxygenLevel; + } + + float outerMaxLevel = 0.6f * distance; + float outerMinLevel = 0.06f * distance; + float innerMaxLevel = 0.02f * distance; + float innerMinLevel = 0.02f * distance; + + var outerRadius = outerMaxLevel - OxygenLevel * (outerMaxLevel - outerMinLevel); + var innerRadius = innerMaxLevel - OxygenLevel * (innerMaxLevel - innerMinLevel); + + _nearsightShader.SetParameter("time", 0.0f); + _nearsightShader.SetParameter("color", new Vector3(1f, 1f, 1f)); + _nearsightShader.SetParameter("darknessAlphaOuter", outerDarkness); + _nearsightShader.SetParameter("innerCircleRadius", innerRadius); + _nearsightShader.SetParameter("innerCircleMaxRadius", innerRadius); + _nearsightShader.SetParameter("outerCircleRadius", outerRadius); + _nearsightShader.SetParameter("outerCircleMaxRadius", outerRadius + 0.2f * distance); + handle.UseShader(_nearsightShader); + handle.DrawRect(viewport, Color.Black); + + handle.UseShader(null); + } + + private float GetDiff(float value, float lastFrameTime) + { + var adjustment = value * 5f * lastFrameTime; + + if (value < 0f) + adjustment = Math.Clamp(adjustment, value, -value); + else + adjustment = Math.Clamp(adjustment, -value, value); + + return adjustment; + } +} diff --git a/Content.Client/Delta-V/Overlays/Systems/NearsightedSystem.cs b/Content.Client/Delta-V/Overlays/Systems/NearsightedSystem.cs new file mode 100644 index 0000000000..e4966299ad --- /dev/null +++ b/Content.Client/Delta-V/Overlays/Systems/NearsightedSystem.cs @@ -0,0 +1,44 @@ +using Robust.Client.Graphics; +using Robust.Client.Player; +using Robust.Shared.Network; +using Content.Shared.Tag; +using Content.Shared.DeltaV.Traits; + +namespace Content.Client.DeltaV.Overlays; +public sealed class NearsightedSystem : EntitySystem +{ + [Dependency] private readonly IPlayerManager _player = default!; + [Dependency] private readonly IOverlayManager _overlayMan = default!; + [Dependency] private readonly INetManager _net = default!; + [Dependency] private readonly IEntityManager _entityManager = default!; + + private NearsightedOverlay _overlay = default!; + private NearsightedComponent nearsight = new(); + + public override void Initialize() + { + base.Initialize(); + + _overlay = new Overlays.NearsightedOverlay(); + } + + public override void Update(float frameTime) + { + base.Update(frameTime); + + foreach (var nearsight in EntityQuery()) + { + var Tags = EnsureComp(nearsight.Owner); + if (Tags.Tags.Contains("GlassesNearsight")) UpdateShader(nearsight, true); + else UpdateShader(nearsight, false); + } + } + + + private void UpdateShader(NearsightedComponent component, bool booLean) + { + while (_overlayMan.HasOverlay()) _overlayMan.RemoveOverlay(_overlay); + component.Glasses = booLean; + _overlayMan.AddOverlay(_overlay); + } +} diff --git a/Content.Shared/Delta-V/Traits/Components/NearsightedComponent.cs b/Content.Shared/Delta-V/Traits/Components/NearsightedComponent.cs new file mode 100644 index 0000000000..edea22e94d --- /dev/null +++ b/Content.Shared/Delta-V/Traits/Components/NearsightedComponent.cs @@ -0,0 +1,26 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.DeltaV.Traits +{ + /// + /// Owner entity cannot see well, without prescription glasses. + /// + [RegisterComponent, NetworkedComponent] + public sealed class NearsightedComponent : Component + { + [DataField("radius"), ViewVariables(VVAccess.ReadWrite)] + public float Radius = 0.8f; + + [DataField("alpha"), ViewVariables(VVAccess.ReadWrite)] + public float Alpha = 0.995f; + + [DataField("gradius"), ViewVariables(VVAccess.ReadWrite)] + public float gRadius = 0.45f; + + [DataField("galpha"), ViewVariables(VVAccess.ReadWrite)] + public float gAlpha = 0.93f; + + [DataField("glasses"), ViewVariables(VVAccess.ReadWrite)] + public bool Glasses = false; + } +} diff --git a/Resources/Locale/en-US/deltav/accessories/new_hair.ftl b/Resources/Locale/en-US/delta-v/accessories/new_hair.ftl similarity index 100% rename from Resources/Locale/en-US/deltav/accessories/new_hair.ftl rename to Resources/Locale/en-US/delta-v/accessories/new_hair.ftl diff --git a/Resources/Locale/en-US/delta-v/traits/new_traits.ftl b/Resources/Locale/en-US/delta-v/traits/new_traits.ftl new file mode 100644 index 0000000000..b8daf38014 --- /dev/null +++ b/Resources/Locale/en-US/delta-v/traits/new_traits.ftl @@ -0,0 +1,4 @@ +trait-nearsighted-name = Nearsighted +trait-nearsighted-desc = You require glasses to see properly. + +permanent-nearsighted-trait-examined = [color=lightblue]{CAPITALIZE(POSS-ADJ($target))} eyes are pretty unfocused. It doesn't seem like {SUBJECT($target)} can see things that well.[/color] diff --git a/Resources/Prototypes/DeltaV/Entities/Clothing/Eyes/prescription_glasses.yml b/Resources/Prototypes/DeltaV/Entities/Clothing/Eyes/prescription_glasses.yml new file mode 100644 index 0000000000..c553bcdc1a --- /dev/null +++ b/Resources/Prototypes/DeltaV/Entities/Clothing/Eyes/prescription_glasses.yml @@ -0,0 +1,2 @@ + + diff --git a/Resources/Prototypes/DeltaV/Traits/New_traits.yml b/Resources/Prototypes/DeltaV/Traits/New_traits.yml new file mode 100644 index 0000000000..fa49747729 --- /dev/null +++ b/Resources/Prototypes/DeltaV/Traits/New_traits.yml @@ -0,0 +1,7 @@ +- type: trait + id: Nearsighted + name: trait-nearsighted-name + description: You require glasses to see properly. + traitGear: ClothingEyesGlasses + components: + - type: Nearsighted diff --git a/Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml b/Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml index ce1bf45973..36e2a2f0d4 100644 --- a/Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml +++ b/Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml @@ -76,6 +76,8 @@ - type: Clothing sprite: Clothing/Eyes/Glasses/glasses.rsi - type: VisionCorrection + - type: ClothingGrantTag + tag: GlassesNearsight - type: entity parent: ClothingEyesBase From 87467cf190a980c0e41986fe9b18fde2c572c16c Mon Sep 17 00:00:00 2001 From: Adrian16199 Date: Sat, 9 Sep 2023 22:28:17 +0200 Subject: [PATCH 02/11] Changed the localization of some files to be properly done due to it bein a PR from diferent station. --- .../Overlays/Shaders/NearsightedOverlays.cs | 4 ++-- .../Overlays/Systems/NearsightedSystem.cs | 4 ++-- .../Traits/Components/NearsightedComponent.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename Content.Client/{Delta-V => SimpleStation14}/Overlays/Shaders/NearsightedOverlays.cs (97%) rename Content.Client/{Delta-V => SimpleStation14}/Overlays/Systems/NearsightedSystem.cs (93%) rename Content.Shared/{Delta-V => SimpleStation14}/Traits/Components/NearsightedComponent.cs (94%) diff --git a/Content.Client/Delta-V/Overlays/Shaders/NearsightedOverlays.cs b/Content.Client/SimpleStation14/Overlays/Shaders/NearsightedOverlays.cs similarity index 97% rename from Content.Client/Delta-V/Overlays/Shaders/NearsightedOverlays.cs rename to Content.Client/SimpleStation14/Overlays/Shaders/NearsightedOverlays.cs index 551aaa6794..5a37622f29 100644 --- a/Content.Client/Delta-V/Overlays/Shaders/NearsightedOverlays.cs +++ b/Content.Client/SimpleStation14/Overlays/Shaders/NearsightedOverlays.cs @@ -4,10 +4,10 @@ using Robust.Shared.Enums; using Robust.Shared.Prototypes; using Robust.Shared.Timing; -using Content.Shared.DeltaV.Traits; +using Content.Shared.SimpleStation14.Traits; -namespace Content.Client.DeltaV.Overlays; +namespace Content.Client.SimpleStation14.Overlays; public sealed class NearsightedOverlay : Overlay { diff --git a/Content.Client/Delta-V/Overlays/Systems/NearsightedSystem.cs b/Content.Client/SimpleStation14/Overlays/Systems/NearsightedSystem.cs similarity index 93% rename from Content.Client/Delta-V/Overlays/Systems/NearsightedSystem.cs rename to Content.Client/SimpleStation14/Overlays/Systems/NearsightedSystem.cs index e4966299ad..399cf8adf2 100644 --- a/Content.Client/Delta-V/Overlays/Systems/NearsightedSystem.cs +++ b/Content.Client/SimpleStation14/Overlays/Systems/NearsightedSystem.cs @@ -2,9 +2,9 @@ using Robust.Client.Player; using Robust.Shared.Network; using Content.Shared.Tag; -using Content.Shared.DeltaV.Traits; +using Content.Shared.SimpleStation14.Traits; -namespace Content.Client.DeltaV.Overlays; +namespace Content.Client.SimpleStation14.Overlays; public sealed class NearsightedSystem : EntitySystem { [Dependency] private readonly IPlayerManager _player = default!; diff --git a/Content.Shared/Delta-V/Traits/Components/NearsightedComponent.cs b/Content.Shared/SimpleStation14/Traits/Components/NearsightedComponent.cs similarity index 94% rename from Content.Shared/Delta-V/Traits/Components/NearsightedComponent.cs rename to Content.Shared/SimpleStation14/Traits/Components/NearsightedComponent.cs index edea22e94d..0a061a18f9 100644 --- a/Content.Shared/Delta-V/Traits/Components/NearsightedComponent.cs +++ b/Content.Shared/SimpleStation14/Traits/Components/NearsightedComponent.cs @@ -1,6 +1,6 @@ using Robust.Shared.GameStates; -namespace Content.Shared.DeltaV.Traits +namespace Content.Shared.SimpleStation14.Traits { /// /// Owner entity cannot see well, without prescription glasses. From 73a98046da43e780908a26cc3eb2349af655a62e Mon Sep 17 00:00:00 2001 From: Adrian16199 Date: Sat, 9 Sep 2023 22:37:56 +0200 Subject: [PATCH 03/11] Forgot the second half. I think every file should be there where they should be. Or i hope so. --- .../{delta-v/traits => simplestation14/Traits}/new_traits.ftl | 0 .../DeltaV/Entities/Clothing/Eyes/prescription_glasses.yml | 2 -- .../{DeltaV => SimpleStation14}/Traits/New_traits.yml | 0 3 files changed, 2 deletions(-) rename Resources/Locale/en-US/{delta-v/traits => simplestation14/Traits}/new_traits.ftl (100%) delete mode 100644 Resources/Prototypes/DeltaV/Entities/Clothing/Eyes/prescription_glasses.yml rename Resources/Prototypes/{DeltaV => SimpleStation14}/Traits/New_traits.yml (100%) diff --git a/Resources/Locale/en-US/delta-v/traits/new_traits.ftl b/Resources/Locale/en-US/simplestation14/Traits/new_traits.ftl similarity index 100% rename from Resources/Locale/en-US/delta-v/traits/new_traits.ftl rename to Resources/Locale/en-US/simplestation14/Traits/new_traits.ftl diff --git a/Resources/Prototypes/DeltaV/Entities/Clothing/Eyes/prescription_glasses.yml b/Resources/Prototypes/DeltaV/Entities/Clothing/Eyes/prescription_glasses.yml deleted file mode 100644 index c553bcdc1a..0000000000 --- a/Resources/Prototypes/DeltaV/Entities/Clothing/Eyes/prescription_glasses.yml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/Resources/Prototypes/DeltaV/Traits/New_traits.yml b/Resources/Prototypes/SimpleStation14/Traits/New_traits.yml similarity index 100% rename from Resources/Prototypes/DeltaV/Traits/New_traits.yml rename to Resources/Prototypes/SimpleStation14/Traits/New_traits.yml From fcaabce20e69d5cc2b4176cfcee90d00af88a4ad Mon Sep 17 00:00:00 2001 From: Adrian16199 Date: Sat, 9 Sep 2023 22:58:30 +0200 Subject: [PATCH 04/11] God bless death(the coder, not literal death) Added Tag Component. --- .../Components/ClothingGrantTagComponent.cs | 12 ++++++++++ .../Systems/ClothingGrantingSystem.cs | 22 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 Content.Shared/SimpleStation14/Clothing/Components/ClothingGrantTagComponent.cs diff --git a/Content.Shared/SimpleStation14/Clothing/Components/ClothingGrantTagComponent.cs b/Content.Shared/SimpleStation14/Clothing/Components/ClothingGrantTagComponent.cs new file mode 100644 index 0000000000..bafa228e37 --- /dev/null +++ b/Content.Shared/SimpleStation14/Clothing/Components/ClothingGrantTagComponent.cs @@ -0,0 +1,12 @@ +namespace Content.Shared.SimpleStation14.Clothing +{ + [RegisterComponent] + public sealed class ClothingGrantTagComponent : Component + { + [DataField("tag", required: true), ViewVariables(VVAccess.ReadWrite)] + public string Tag = ""; + + [ViewVariables(VVAccess.ReadWrite)] + public bool IsActive = false; + } +} \ No newline at end of file diff --git a/Content.Shared/SimpleStation14/Clothing/Systems/ClothingGrantingSystem.cs b/Content.Shared/SimpleStation14/Clothing/Systems/ClothingGrantingSystem.cs index b65f11c6bc..0f58bf6a5a 100644 --- a/Content.Shared/SimpleStation14/Clothing/Systems/ClothingGrantingSystem.cs +++ b/Content.Shared/SimpleStation14/Clothing/Systems/ClothingGrantingSystem.cs @@ -16,6 +16,8 @@ public override void Initialize() base.Initialize(); SubscribeLocalEvent(OnCompEquip); SubscribeLocalEvent(OnCompUnequip); + SubscribeLocalEvent(OnTagEquip); + SubscribeLocalEvent(OnTagUnequip); } private void OnCompEquip(EntityUid uid, ClothingGrantComponentComponent component, GotEquippedEvent args) @@ -58,6 +60,26 @@ private void OnCompUnequip(EntityUid uid, ClothingGrantComponentComponent compon RemComp(args.Equipee, newComp.GetType()); } + component.IsActive = false; + } + private void OnTagEquip(EntityUid uid, ClothingGrantTagComponent component, GotEquippedEvent args) + { + if (!TryComp(uid, out var clothing)) return; + + if (!clothing.Slots.HasFlag(args.SlotFlags)) return; + + EnsureComp(args.Equipee); + _tagSystem.AddTag(args.Equipee, component.Tag); + + component.IsActive = true; + } + + private void OnTagUnequip(EntityUid uid, ClothingGrantTagComponent component, GotUnequippedEvent args) + { + if (!component.IsActive) return; + + _tagSystem.RemoveTag(args.Equipee, component.Tag); + component.IsActive = false; } } From 3da4f90cda423cad5c0a534f2a4cc5f5c563b5bc Mon Sep 17 00:00:00 2001 From: Adrian16199 Date: Sun, 10 Sep 2023 18:47:42 +0200 Subject: [PATCH 05/11] Adds glasses to NanoMed plus and ClothesMate. --- .../Catalog/VendingMachines/Inventories/clothesmate.yml | 1 + .../Prototypes/Catalog/VendingMachines/Inventories/medical.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/Resources/Prototypes/Catalog/VendingMachines/Inventories/clothesmate.yml b/Resources/Prototypes/Catalog/VendingMachines/Inventories/clothesmate.yml index 8887ab5b97..f677985db7 100644 --- a/Resources/Prototypes/Catalog/VendingMachines/Inventories/clothesmate.yml +++ b/Resources/Prototypes/Catalog/VendingMachines/Inventories/clothesmate.yml @@ -71,3 +71,4 @@ ClothingHeadTinfoil: 2 ClothingHeadRastaHat: 2 ClothingBeltStorageWaistbag: 3 + ClothingEyesGlasses: 5 diff --git a/Resources/Prototypes/Catalog/VendingMachines/Inventories/medical.yml b/Resources/Prototypes/Catalog/VendingMachines/Inventories/medical.yml index 43e7cf7c94..75b0d5803d 100644 --- a/Resources/Prototypes/Catalog/VendingMachines/Inventories/medical.yml +++ b/Resources/Prototypes/Catalog/VendingMachines/Inventories/medical.yml @@ -7,3 +7,4 @@ Bloodpack: 5 EpinephrineChemistryBottle: 3 Syringe: 5 + ClothingEyesGlasses: 5 From e9cbc4c3513bb0c1cd1e585e9e621a4791a40a0e Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Fri, 29 Sep 2023 22:09:12 -0700 Subject: [PATCH 06/11] fix naming --- .../Locale/en-US/simplestation14/Traits/disabilities.ftl | 3 +++ Resources/Locale/en-US/simplestation14/Traits/new_traits.ftl | 4 ---- Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml | 5 +++-- .../Traits/{New_traits.yml => disabilities.yml} | 0 Resources/Prototypes/SimpleStation14/tags.yml | 2 ++ 5 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 Resources/Locale/en-US/simplestation14/Traits/disabilities.ftl delete mode 100644 Resources/Locale/en-US/simplestation14/Traits/new_traits.ftl rename Resources/Prototypes/SimpleStation14/Traits/{New_traits.yml => disabilities.yml} (100%) create mode 100644 Resources/Prototypes/SimpleStation14/tags.yml diff --git a/Resources/Locale/en-US/simplestation14/Traits/disabilities.ftl b/Resources/Locale/en-US/simplestation14/Traits/disabilities.ftl new file mode 100644 index 0000000000..3d8af06139 --- /dev/null +++ b/Resources/Locale/en-US/simplestation14/Traits/disabilities.ftl @@ -0,0 +1,3 @@ +trait-nearsighted-name = Nearsighted +trait-nearsighted-desc = You require glasses to see properly. +trait-nearsighted-examined = [color=lightblue]{CAPITALIZE(POSS-ADJ($target))} eyes are pretty unfocused. It doesn't seem like {SUBJECT($target)} can see things that well.[/color] diff --git a/Resources/Locale/en-US/simplestation14/Traits/new_traits.ftl b/Resources/Locale/en-US/simplestation14/Traits/new_traits.ftl deleted file mode 100644 index b8daf38014..0000000000 --- a/Resources/Locale/en-US/simplestation14/Traits/new_traits.ftl +++ /dev/null @@ -1,4 +0,0 @@ -trait-nearsighted-name = Nearsighted -trait-nearsighted-desc = You require glasses to see properly. - -permanent-nearsighted-trait-examined = [color=lightblue]{CAPITALIZE(POSS-ADJ($target))} eyes are pretty unfocused. It doesn't seem like {SUBJECT($target)} can see things that well.[/color] diff --git a/Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml b/Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml index 36e2a2f0d4..c3870188b8 100644 --- a/Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml +++ b/Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml @@ -76,8 +76,9 @@ - type: Clothing sprite: Clothing/Eyes/Glasses/glasses.rsi - type: VisionCorrection - - type: ClothingGrantTag - tag: GlassesNearsight + - type: Tag + tags: + - GlassesNearsight - type: entity parent: ClothingEyesBase diff --git a/Resources/Prototypes/SimpleStation14/Traits/New_traits.yml b/Resources/Prototypes/SimpleStation14/Traits/disabilities.yml similarity index 100% rename from Resources/Prototypes/SimpleStation14/Traits/New_traits.yml rename to Resources/Prototypes/SimpleStation14/Traits/disabilities.yml diff --git a/Resources/Prototypes/SimpleStation14/tags.yml b/Resources/Prototypes/SimpleStation14/tags.yml new file mode 100644 index 0000000000..3b885a5801 --- /dev/null +++ b/Resources/Prototypes/SimpleStation14/tags.yml @@ -0,0 +1,2 @@ +- type: Tag + id: GlassesNearsight From 29bf0191e92881b30465ea3717bfdee574889a87 Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Fri, 29 Sep 2023 22:15:41 -0700 Subject: [PATCH 07/11] reformatting --- .../Components/ClothingGrantTagComponent.cs | 19 +++++----- .../Systems/ClothingGrantingSystem.cs | 17 ++++++--- .../Traits/Components/NearsightedComponent.cs | 35 +++++++++---------- 3 files changed, 38 insertions(+), 33 deletions(-) diff --git a/Content.Shared/SimpleStation14/Clothing/Components/ClothingGrantTagComponent.cs b/Content.Shared/SimpleStation14/Clothing/Components/ClothingGrantTagComponent.cs index bafa228e37..01b70f90f4 100644 --- a/Content.Shared/SimpleStation14/Clothing/Components/ClothingGrantTagComponent.cs +++ b/Content.Shared/SimpleStation14/Clothing/Components/ClothingGrantTagComponent.cs @@ -1,12 +1,11 @@ -namespace Content.Shared.SimpleStation14.Clothing +namespace Content.Shared.SimpleStation14.Clothing; + +[RegisterComponent] +public sealed class ClothingGrantTagComponent : Component { - [RegisterComponent] - public sealed class ClothingGrantTagComponent : Component - { - [DataField("tag", required: true), ViewVariables(VVAccess.ReadWrite)] - public string Tag = ""; + [DataField("tag", required: true), ViewVariables(VVAccess.ReadWrite)] + public string Tag = ""; - [ViewVariables(VVAccess.ReadWrite)] - public bool IsActive = false; - } -} \ No newline at end of file + [ViewVariables(VVAccess.ReadWrite)] + public bool IsActive = false; +} diff --git a/Content.Shared/SimpleStation14/Clothing/Systems/ClothingGrantingSystem.cs b/Content.Shared/SimpleStation14/Clothing/Systems/ClothingGrantingSystem.cs index 0f58bf6a5a..5fbc83a4b0 100644 --- a/Content.Shared/SimpleStation14/Clothing/Systems/ClothingGrantingSystem.cs +++ b/Content.Shared/SimpleStation14/Clothing/Systems/ClothingGrantingSystem.cs @@ -14,8 +14,10 @@ public sealed class ClothingGrantingSystem : EntitySystem public override void Initialize() { base.Initialize(); + SubscribeLocalEvent(OnCompEquip); SubscribeLocalEvent(OnCompUnequip); + SubscribeLocalEvent(OnTagEquip); SubscribeLocalEvent(OnTagUnequip); } @@ -62,21 +64,26 @@ private void OnCompUnequip(EntityUid uid, ClothingGrantComponentComponent compon component.IsActive = false; } - private void OnTagEquip(EntityUid uid, ClothingGrantTagComponent component, GotEquippedEvent args) + + + private void OnTagEquip(EntityUid uid, ClothingGrantTagComponent component, GotEquippedEvent args) { - if (!TryComp(uid, out var clothing)) return; + if (!TryComp(uid, out var clothing)) + return; - if (!clothing.Slots.HasFlag(args.SlotFlags)) return; + if (!clothing.Slots.HasFlag(args.SlotFlags)) + return; EnsureComp(args.Equipee); _tagSystem.AddTag(args.Equipee, component.Tag); component.IsActive = true; } - + private void OnTagUnequip(EntityUid uid, ClothingGrantTagComponent component, GotUnequippedEvent args) { - if (!component.IsActive) return; + if (!component.IsActive) + return; _tagSystem.RemoveTag(args.Equipee, component.Tag); diff --git a/Content.Shared/SimpleStation14/Traits/Components/NearsightedComponent.cs b/Content.Shared/SimpleStation14/Traits/Components/NearsightedComponent.cs index 0a061a18f9..9c99b75e01 100644 --- a/Content.Shared/SimpleStation14/Traits/Components/NearsightedComponent.cs +++ b/Content.Shared/SimpleStation14/Traits/Components/NearsightedComponent.cs @@ -1,26 +1,25 @@ using Robust.Shared.GameStates; -namespace Content.Shared.SimpleStation14.Traits +namespace Content.Shared.SimpleStation14.Traits.Components; + +/// +/// Owner entity cannot see well, without prescription glasses. +/// +[RegisterComponent, NetworkedComponent] +public sealed class NearsightedComponent : Component { - /// - /// Owner entity cannot see well, without prescription glasses. - /// - [RegisterComponent, NetworkedComponent] - public sealed class NearsightedComponent : Component - { - [DataField("radius"), ViewVariables(VVAccess.ReadWrite)] - public float Radius = 0.8f; + [DataField("radius"), ViewVariables(VVAccess.ReadWrite)] + public float Radius = 0.8f; - [DataField("alpha"), ViewVariables(VVAccess.ReadWrite)] - public float Alpha = 0.995f; + [DataField("alpha"), ViewVariables(VVAccess.ReadWrite)] + public float Alpha = 0.995f; - [DataField("gradius"), ViewVariables(VVAccess.ReadWrite)] - public float gRadius = 0.45f; + [DataField("gradius"), ViewVariables(VVAccess.ReadWrite)] + public float gRadius = 0.45f; - [DataField("galpha"), ViewVariables(VVAccess.ReadWrite)] - public float gAlpha = 0.93f; + [DataField("galpha"), ViewVariables(VVAccess.ReadWrite)] + public float gAlpha = 0.93f; - [DataField("glasses"), ViewVariables(VVAccess.ReadWrite)] - public bool Glasses = false; - } + [DataField("glasses"), ViewVariables(VVAccess.ReadWrite)] + public bool Glasses = false; } From 4d2c280c1cdbd6387b669d4809d23dfa375f539c Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Fri, 29 Sep 2023 22:16:10 -0700 Subject: [PATCH 08/11] use events instead of an update loop --- .../Overlays/Systems/NearsightedSystem.cs | 52 ++++++++++++------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/Content.Client/SimpleStation14/Overlays/Systems/NearsightedSystem.cs b/Content.Client/SimpleStation14/Overlays/Systems/NearsightedSystem.cs index 399cf8adf2..90f5803168 100644 --- a/Content.Client/SimpleStation14/Overlays/Systems/NearsightedSystem.cs +++ b/Content.Client/SimpleStation14/Overlays/Systems/NearsightedSystem.cs @@ -1,43 +1,57 @@ -using Robust.Client.Graphics; -using Robust.Client.Player; -using Robust.Shared.Network; -using Content.Shared.Tag; +using Content.Client.SimpleStation14.Overlays.Shaders; +using Content.Shared.Inventory.Events; using Content.Shared.SimpleStation14.Traits; +using Content.Shared.SimpleStation14.Traits.Components; +using Content.Shared.Tag; +using Robust.Client.Graphics; + +namespace Content.Client.SimpleStation14.Overlays.Systems; -namespace Content.Client.SimpleStation14.Overlays; public sealed class NearsightedSystem : EntitySystem { - [Dependency] private readonly IPlayerManager _player = default!; [Dependency] private readonly IOverlayManager _overlayMan = default!; - [Dependency] private readonly INetManager _net = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; private NearsightedOverlay _overlay = default!; - private NearsightedComponent nearsight = new(); public override void Initialize() { base.Initialize(); - _overlay = new Overlays.NearsightedOverlay(); + _overlay = new NearsightedOverlay(); + + SubscribeLocalEvent(OnStartup); + SubscribeLocalEvent(OnEquip); + SubscribeLocalEvent(OnUnEquip); } - public override void Update(float frameTime) + + private void OnStartup(EntityUid uid, NearsightedComponent component, ComponentStartup args) { - base.Update(frameTime); + UpdateShader(component, false); + } - foreach (var nearsight in EntityQuery()) - { - var Tags = EnsureComp(nearsight.Owner); - if (Tags.Tags.Contains("GlassesNearsight")) UpdateShader(nearsight, true); - else UpdateShader(nearsight, false); - } + private void OnEquip(GotEquippedEvent args) + { + if (TryComp(args.Equipee, out var nearsighted) && + EnsureComp(args.Equipment).Tags.Contains("GlassesNearsight")) + UpdateShader(nearsighted, true); + } + + private void OnUnEquip(GotUnequippedEvent args) + { + if (TryComp(args.Equipee, out var nearsighted) && + EnsureComp(args.Equipment).Tags.Contains("GlassesNearsight")) + UpdateShader(nearsighted, false); } private void UpdateShader(NearsightedComponent component, bool booLean) { - while (_overlayMan.HasOverlay()) _overlayMan.RemoveOverlay(_overlay); + while (_overlayMan.HasOverlay()) + { + _overlayMan.RemoveOverlay(_overlay); + } + component.Glasses = booLean; _overlayMan.AddOverlay(_overlay); } From 96dadb0e151d7b3f0609d5aa26e74e44d0027d3b Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Fri, 29 Sep 2023 22:16:49 -0700 Subject: [PATCH 09/11] lerping and comments for the overlay --- .../Overlays/Shaders/NearsightedOverlays.cs | 82 ++++++++++--------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/Content.Client/SimpleStation14/Overlays/Shaders/NearsightedOverlays.cs b/Content.Client/SimpleStation14/Overlays/Shaders/NearsightedOverlays.cs index 5a37622f29..dce6709fa5 100644 --- a/Content.Client/SimpleStation14/Overlays/Shaders/NearsightedOverlays.cs +++ b/Content.Client/SimpleStation14/Overlays/Shaders/NearsightedOverlays.cs @@ -1,13 +1,12 @@ +using Content.Shared.SimpleStation14.Traits.Components; using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Client.Player; using Robust.Shared.Enums; using Robust.Shared.Prototypes; using Robust.Shared.Timing; -using Content.Shared.SimpleStation14.Traits; - -namespace Content.Client.SimpleStation14.Overlays; +namespace Content.Client.SimpleStation14.Overlays.Shaders; public sealed class NearsightedOverlay : Overlay { @@ -17,12 +16,15 @@ public sealed class NearsightedOverlay : Overlay [Dependency] private readonly IPlayerManager _playerManager = default!; public override OverlaySpace Space => OverlaySpace.WorldSpace; - private readonly ShaderInstance _nearsightShader; - public float OxygenLevel = 0f; - private float _oldOxygenLevel = 0f; - public float outerDarkness = 1f; + public float Radius = 0f; + private float _oldRadius = 0f; + public float Darkness = 1f; + + private float _lerpTime = 0f; + private float _lerpDuration = 0.25f; + public NearsightedOverlay() { @@ -30,53 +32,65 @@ public NearsightedOverlay() _nearsightShader = _prototypeManager.Index("GradientCircleMask").InstanceUnique(); } + protected override void Draw(in OverlayDrawArgs args) { - if (!_entityManager.TryGetComponent(_playerManager.LocalPlayer?.ControlledEntity, out NearsightedComponent? nearComp)) return; - if (_playerManager.LocalPlayer?.ControlledEntity != nearComp.Owner) return; + // Check if the player has a NearsightedComponent and is controlling it + if (!_entityManager.TryGetComponent(_playerManager.LocalPlayer?.ControlledEntity, out NearsightedComponent? nearComp) || + _playerManager.LocalPlayer?.ControlledEntity != nearComp.Owner) + return; - if (nearComp.Glasses == true) + // Set the radius and darkness values based on whether the player is wearing glasses or not + if (nearComp.Glasses) { - OxygenLevel = nearComp.gRadius; - outerDarkness = nearComp.gAlpha; + Radius = nearComp.gRadius; + Darkness = nearComp.gAlpha; } else { - OxygenLevel = nearComp.Radius; - outerDarkness = nearComp.Alpha; + Radius = nearComp.Radius; + Darkness = nearComp.Alpha; } - if (!_entityManager.TryGetComponent(_playerManager.LocalPlayer?.ControlledEntity, out EyeComponent? eyeComp)) return; - if (args.Viewport.Eye != eyeComp.Eye) return; + // Check if the player has an EyeComponent and if the overlay should be drawn for this eye + if (!_entityManager.TryGetComponent(_playerManager.LocalPlayer?.ControlledEntity, out EyeComponent? eyeComp) || + args.Viewport.Eye != eyeComp.Eye) + return; + var viewport = args.WorldAABB; var handle = args.WorldHandle; var distance = args.ViewportBounds.Width; - var time = (float) _timing.RealTime.TotalSeconds; var lastFrameTime = (float) _timing.FrameTime.TotalSeconds; - if (!MathHelper.CloseTo(_oldOxygenLevel, OxygenLevel, 0.001f)) + // If the current radius value is different from the previous one, lerp between them + if (!MathHelper.CloseTo(_oldRadius, Radius, 0.001f)) { - var diff = OxygenLevel - _oldOxygenLevel; - _oldOxygenLevel += GetDiff(diff, lastFrameTime); + _lerpTime += lastFrameTime; + var t = MathHelper.Clamp(_lerpTime / _lerpDuration, 0f, 1f); // Calculate lerp time + _oldRadius = MathHelper.Lerp(_oldRadius, Radius, t); // Lerp between old and new radius values } + // If the current radius value is the same as the previous one, reset the lerp time and old radius value else { - _oldOxygenLevel = OxygenLevel; + _lerpTime = 0f; + _oldRadius = Radius; } - float outerMaxLevel = 0.6f * distance; - float outerMinLevel = 0.06f * distance; - float innerMaxLevel = 0.02f * distance; - float innerMinLevel = 0.02f * distance; + // Calculate the outer and inner radii based on the current radius value + var outerMaxLevel = 0.6f * distance; + var outerMinLevel = 0.06f * distance; + var innerMaxLevel = 0.02f * distance; + var innerMinLevel = 0.02f * distance; - var outerRadius = outerMaxLevel - OxygenLevel * (outerMaxLevel - outerMinLevel); - var innerRadius = innerMaxLevel - OxygenLevel * (innerMaxLevel - innerMinLevel); + var outerRadius = outerMaxLevel - _oldRadius * (outerMaxLevel - outerMinLevel); + var innerRadius = innerMaxLevel - _oldRadius * (innerMaxLevel - innerMinLevel); + // Set the shader parameters and draw the overlay _nearsightShader.SetParameter("time", 0.0f); _nearsightShader.SetParameter("color", new Vector3(1f, 1f, 1f)); - _nearsightShader.SetParameter("darknessAlphaOuter", outerDarkness); + _nearsightShader.SetParameter("darknessAlphaOuter", Darkness); _nearsightShader.SetParameter("innerCircleRadius", innerRadius); _nearsightShader.SetParameter("innerCircleMaxRadius", innerRadius); _nearsightShader.SetParameter("outerCircleRadius", outerRadius); @@ -86,16 +100,4 @@ protected override void Draw(in OverlayDrawArgs args) handle.UseShader(null); } - - private float GetDiff(float value, float lastFrameTime) - { - var adjustment = value * 5f * lastFrameTime; - - if (value < 0f) - adjustment = Math.Clamp(adjustment, value, -value); - else - adjustment = Math.Clamp(adjustment, -value, value); - - return adjustment; - } } From 2099e47bd066d858fee5909b92aba0a74f4789c8 Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Fri, 29 Sep 2023 23:12:06 -0700 Subject: [PATCH 10/11] component comments and networking --- .../Traits/Components/NearsightedComponent.cs | 44 ++++++++++++++----- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/Content.Shared/SimpleStation14/Traits/Components/NearsightedComponent.cs b/Content.Shared/SimpleStation14/Traits/Components/NearsightedComponent.cs index 9c99b75e01..fafd8f8710 100644 --- a/Content.Shared/SimpleStation14/Traits/Components/NearsightedComponent.cs +++ b/Content.Shared/SimpleStation14/Traits/Components/NearsightedComponent.cs @@ -5,21 +5,45 @@ namespace Content.Shared.SimpleStation14.Traits.Components; /// /// Owner entity cannot see well, without prescription glasses. /// -[RegisterComponent, NetworkedComponent] -public sealed class NearsightedComponent : Component +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +public sealed partial class NearsightedComponent : Component { - [DataField("radius"), ViewVariables(VVAccess.ReadWrite)] + /// + /// Distance from the edge of the screen to the center + /// + /// + /// I don't know how the distance is measured, 1 is very close to the center, 0 is maybe visible around the edge + /// + [DataField("radius"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public float Radius = 0.8f; - [DataField("alpha"), ViewVariables(VVAccess.ReadWrite)] + /// + /// How dark the circle mask is from + /// + /// + /// I also don't know how this works, it only starts getting noticeably dark at 0.7, and is definitely noticeable at 0.9, 1 is black + /// + [DataField("alpha"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public float Alpha = 0.995f; - [DataField("gradius"), ViewVariables(VVAccess.ReadWrite)] - public float gRadius = 0.45f; + /// + [DataField("equippedRadius"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] + public float EquippedRadius = 0.45f; - [DataField("galpha"), ViewVariables(VVAccess.ReadWrite)] - public float gAlpha = 0.93f; + /// + [DataField("equippedAlpha"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] + public float EquippedAlpha = 0.93f; - [DataField("glasses"), ViewVariables(VVAccess.ReadWrite)] - public bool Glasses = false; + /// + /// How long the lerp animation should go on for in seconds. + /// + [DataField("lerpDuration"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] + public float LerpDuration = 0.25f; + + /// + /// If true, uses the variables prefixed "Equipped" + /// If false, uses the variables without a prefix + /// + [ViewVariables(VVAccess.ReadWrite)] // Make the system shared if you want this networked, I don't wanna do that + public bool Active = false; } From a876f10835fcefe369d5af3c6b8907bd7e8beed0 Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Fri, 29 Sep 2023 23:12:31 -0700 Subject: [PATCH 11/11] darkness lerping for the overlay --- .../Overlays/Shaders/NearsightedOverlays.cs | 63 +++++++++++++------ .../Overlays/Systems/NearsightedSystem.cs | 2 +- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/Content.Client/SimpleStation14/Overlays/Shaders/NearsightedOverlays.cs b/Content.Client/SimpleStation14/Overlays/Shaders/NearsightedOverlays.cs index dce6709fa5..2597975bd4 100644 --- a/Content.Client/SimpleStation14/Overlays/Shaders/NearsightedOverlays.cs +++ b/Content.Client/SimpleStation14/Overlays/Shaders/NearsightedOverlays.cs @@ -18,12 +18,13 @@ public sealed class NearsightedOverlay : Overlay public override OverlaySpace Space => OverlaySpace.WorldSpace; private readonly ShaderInstance _nearsightShader; - public float Radius = 0f; - private float _oldRadius = 0f; - public float Darkness = 1f; + public float Radius; + private float _oldRadius; + public float Darkness; + private float _oldDarkness; - private float _lerpTime = 0f; - private float _lerpDuration = 0.25f; + private float _lerpTime; + public float LerpDuration; public NearsightedOverlay() @@ -32,19 +33,34 @@ public NearsightedOverlay() _nearsightShader = _prototypeManager.Index("GradientCircleMask").InstanceUnique(); } - - protected override void Draw(in OverlayDrawArgs args) + protected override bool BeforeDraw(in OverlayDrawArgs args) { // Check if the player has a NearsightedComponent and is controlling it if (!_entityManager.TryGetComponent(_playerManager.LocalPlayer?.ControlledEntity, out NearsightedComponent? nearComp) || _playerManager.LocalPlayer?.ControlledEntity != nearComp.Owner) - return; + return false; + + // Check if the player has an EyeComponent and if the overlay should be drawn for this eye + if (!_entityManager.TryGetComponent(_playerManager.LocalPlayer?.ControlledEntity, out EyeComponent? eyeComp) || + args.Viewport.Eye != eyeComp.Eye) + return false; + + return true; + } + + protected override void Draw(in OverlayDrawArgs args) + { + // We already checked if they have a NearsightedComponent and are controlling it in BeforeDraw, so we assume this hasn't changed + var nearComp = _entityManager.GetComponent(_playerManager.LocalPlayer!.ControlledEntity!.Value); + + // Set LerpDuration based on nearComp.LerpDuration + LerpDuration = nearComp.LerpDuration; // Set the radius and darkness values based on whether the player is wearing glasses or not - if (nearComp.Glasses) + if (nearComp.Active) { - Radius = nearComp.gRadius; - Darkness = nearComp.gAlpha; + Radius = nearComp.EquippedRadius; + Darkness = nearComp.EquippedAlpha; } else { @@ -52,11 +68,6 @@ protected override void Draw(in OverlayDrawArgs args) Darkness = nearComp.Alpha; } - // Check if the player has an EyeComponent and if the overlay should be drawn for this eye - if (!_entityManager.TryGetComponent(_playerManager.LocalPlayer?.ControlledEntity, out EyeComponent? eyeComp) || - args.Viewport.Eye != eyeComp.Eye) - return; - var viewport = args.WorldAABB; var handle = args.WorldHandle; @@ -64,11 +75,12 @@ protected override void Draw(in OverlayDrawArgs args) var lastFrameTime = (float) _timing.FrameTime.TotalSeconds; + // If the current radius value is different from the previous one, lerp between them if (!MathHelper.CloseTo(_oldRadius, Radius, 0.001f)) { _lerpTime += lastFrameTime; - var t = MathHelper.Clamp(_lerpTime / _lerpDuration, 0f, 1f); // Calculate lerp time + var t = MathHelper.Clamp(_lerpTime / LerpDuration, 0f, 1f); // Calculate lerp time _oldRadius = MathHelper.Lerp(_oldRadius, Radius, t); // Lerp between old and new radius values } // If the current radius value is the same as the previous one, reset the lerp time and old radius value @@ -78,6 +90,21 @@ protected override void Draw(in OverlayDrawArgs args) _oldRadius = Radius; } + // If the current darkness value is different from the previous one, lerp between them + if (!MathHelper.CloseTo(_oldDarkness, Darkness, 0.001f)) + { + _lerpTime += lastFrameTime; + var t = MathHelper.Clamp(_lerpTime / LerpDuration, 0f, 1f); // Calculate lerp time + _oldDarkness = MathHelper.Lerp(_oldDarkness, Darkness, t); // Lerp between old and new darkness values + } + // If the current darkness value is the same as the previous one, reset the lerp time and old darkness value + else + { + _lerpTime = 0f; + _oldDarkness = Darkness; + } + + // Calculate the outer and inner radii based on the current radius value var outerMaxLevel = 0.6f * distance; var outerMinLevel = 0.06f * distance; @@ -90,7 +117,7 @@ protected override void Draw(in OverlayDrawArgs args) // Set the shader parameters and draw the overlay _nearsightShader.SetParameter("time", 0.0f); _nearsightShader.SetParameter("color", new Vector3(1f, 1f, 1f)); - _nearsightShader.SetParameter("darknessAlphaOuter", Darkness); + _nearsightShader.SetParameter("darknessAlphaOuter", _oldDarkness); _nearsightShader.SetParameter("innerCircleRadius", innerRadius); _nearsightShader.SetParameter("innerCircleMaxRadius", innerRadius); _nearsightShader.SetParameter("outerCircleRadius", outerRadius); diff --git a/Content.Client/SimpleStation14/Overlays/Systems/NearsightedSystem.cs b/Content.Client/SimpleStation14/Overlays/Systems/NearsightedSystem.cs index 90f5803168..ef413ec65d 100644 --- a/Content.Client/SimpleStation14/Overlays/Systems/NearsightedSystem.cs +++ b/Content.Client/SimpleStation14/Overlays/Systems/NearsightedSystem.cs @@ -52,7 +52,7 @@ private void UpdateShader(NearsightedComponent component, bool booLean) _overlayMan.RemoveOverlay(_overlay); } - component.Glasses = booLean; + component.Active = booLean; _overlayMan.AddOverlay(_overlay); } }