From 7524fb93b68bd610df108d1f19d40730f8b3f744 Mon Sep 17 00:00:00 2001 From: DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com> Date: Sat, 11 May 2024 01:20:48 -0700 Subject: [PATCH] Fix const data field in BlindableComponent (#27919) * Fix const data field in BlindableComponent * Fix usages --- Content.Shared/Eye/Blinding/Components/BlindableComponent.cs | 2 +- Content.Shared/Eye/Blinding/Systems/BlindableSystem.cs | 4 ++-- Content.Shared/Eye/Blinding/Systems/EyeClosingSystem.cs | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Content.Shared/Eye/Blinding/Components/BlindableComponent.cs b/Content.Shared/Eye/Blinding/Components/BlindableComponent.cs index 39718bd4cf..c2e73bd6b8 100644 --- a/Content.Shared/Eye/Blinding/Components/BlindableComponent.cs +++ b/Content.Shared/Eye/Blinding/Components/BlindableComponent.cs @@ -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; diff --git a/Content.Shared/Eye/Blinding/Systems/BlindableSystem.cs b/Content.Shared/Eye/Blinding/Systems/BlindableSystem.cs index 0232bcf937..24eed3adcf 100644 --- a/Content.Shared/Eye/Blinding/Systems/BlindableSystem.cs +++ b/Content.Shared/Eye/Blinding/Systems/BlindableSystem.cs @@ -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; diff --git a/Content.Shared/Eye/Blinding/Systems/EyeClosingSystem.cs b/Content.Shared/Eye/Blinding/Systems/EyeClosingSystem.cs index 5326af9636..9a4afaec3a 100644 --- a/Content.Shared/Eye/Blinding/Systems/EyeClosingSystem.cs +++ b/Content.Shared/Eye/Blinding/Systems/EyeClosingSystem.cs @@ -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(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(blindable); return;