Fix const data field in BlindableComponent (#27919)
* Fix const data field in BlindableComponent * Fix usages
This commit is contained in:
parent
eed560bf3e
commit
7524fb93b6
3 changed files with 4 additions and 5 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue