]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix const data field in BlindableComponent (#27919)
authorDrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com>
Sat, 11 May 2024 08:20:48 +0000 (01:20 -0700)
committerGitHub <noreply@github.com>
Sat, 11 May 2024 08:20:48 +0000 (01:20 -0700)
* Fix const data field in BlindableComponent

* Fix usages

Content.Shared/Eye/Blinding/Components/BlindableComponent.cs
Content.Shared/Eye/Blinding/Systems/BlindableSystem.cs
Content.Shared/Eye/Blinding/Systems/EyeClosingSystem.cs

index 39718bd4cf5a6c8e046308deb25fcbcfa750ee4c..c2e73bd6b8934a96b5c98fa235ed2d09fdbd0e31 100644 (file)
@@ -25,7 +25,7 @@ public sealed partial class BlindableComponent : Component
     public int EyeDamage = 0;
 
     [ViewVariables(VVAccess.ReadOnly), DataField]
-    public const int MaxDamage = 9;
+    public int MaxDamage = 9;
 
     [ViewVariables(VVAccess.ReadOnly), DataField]
     public int MinDamage = 0;
index 0232bcf9376309a6e46e81d68a4776fc288ccde6..24eed3adcf5701e20b58e59df9a4ce1cceaa7295 100644 (file)
@@ -37,7 +37,7 @@ public sealed class BlindableSystem : EntitySystem
         var old = blindable.Comp.IsBlind;
 
         // Don't bother raising an event if the eye is too damaged.
-        if (blindable.Comp.EyeDamage >= BlindableComponent.MaxDamage)
+        if (blindable.Comp.EyeDamage >= blindable.Comp.MaxDamage)
         {
             blindable.Comp.IsBlind = true;
         }
@@ -70,7 +70,7 @@ public sealed class BlindableSystem : EntitySystem
             return;
 
         var previousDamage = blindable.Comp.EyeDamage;
-        blindable.Comp.EyeDamage = Math.Clamp(blindable.Comp.EyeDamage, blindable.Comp.MinDamage, BlindableComponent.MaxDamage);
+        blindable.Comp.EyeDamage = Math.Clamp(blindable.Comp.EyeDamage, blindable.Comp.MinDamage, blindable.Comp.MaxDamage);
         Dirty(blindable);
         if (!isDamageChanged && previousDamage == blindable.Comp.EyeDamage)
             return;
index 5326af9636e3a3698cb5685d27a4eca2c1e07322..9a4afaec3a9614aae81c307dd326d9dde420a8af 100644 (file)
@@ -1,4 +1,3 @@
-
 using Content.Shared.Actions;
 using Content.Shared.Eye.Blinding.Components;
 using Robust.Shared.Audio.Systems;
@@ -124,7 +123,7 @@ public sealed class EyeClosingSystem : EntitySystem
         if (_entityManager.TryGetComponent<EyeClosingComponent>(blindable, out var eyelids) && !eyelids.NaturallyCreated)
             return;
 
-        if (ev.Blur < BlurryVisionComponent.MaxMagnitude || ev.Blur >= BlindableComponent.MaxDamage)
+        if (ev.Blur < BlurryVisionComponent.MaxMagnitude || ev.Blur >= blindable.Comp.MaxDamage)
         {
             RemCompDeferred<EyeClosingComponent>(blindable);
             return;