Fix const data field in BlindableComponent (#27919)
* Fix const data field in BlindableComponent * Fix usages
This commit is contained in:
@@ -25,7 +25,7 @@ public sealed partial class BlindableComponent : Component
|
|||||||
public int EyeDamage = 0;
|
public int EyeDamage = 0;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadOnly), DataField]
|
[ViewVariables(VVAccess.ReadOnly), DataField]
|
||||||
public const int MaxDamage = 9;
|
public int MaxDamage = 9;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadOnly), DataField]
|
[ViewVariables(VVAccess.ReadOnly), DataField]
|
||||||
public int MinDamage = 0;
|
public int MinDamage = 0;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public sealed class BlindableSystem : EntitySystem
|
|||||||
var old = blindable.Comp.IsBlind;
|
var old = blindable.Comp.IsBlind;
|
||||||
|
|
||||||
// Don't bother raising an event if the eye is too damaged.
|
// 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;
|
blindable.Comp.IsBlind = true;
|
||||||
}
|
}
|
||||||
@@ -70,7 +70,7 @@ public sealed class BlindableSystem : EntitySystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var previousDamage = blindable.Comp.EyeDamage;
|
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);
|
Dirty(blindable);
|
||||||
if (!isDamageChanged && previousDamage == blindable.Comp.EyeDamage)
|
if (!isDamageChanged && previousDamage == blindable.Comp.EyeDamage)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
using Content.Shared.Eye.Blinding.Components;
|
using Content.Shared.Eye.Blinding.Components;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
@@ -124,7 +123,7 @@ public sealed class EyeClosingSystem : EntitySystem
|
|||||||
if (_entityManager.TryGetComponent<EyeClosingComponent>(blindable, out var eyelids) && !eyelids.NaturallyCreated)
|
if (_entityManager.TryGetComponent<EyeClosingComponent>(blindable, out var eyelids) && !eyelids.NaturallyCreated)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ev.Blur < BlurryVisionComponent.MaxMagnitude || ev.Blur >= BlindableComponent.MaxDamage)
|
if (ev.Blur < BlurryVisionComponent.MaxMagnitude || ev.Blur >= blindable.Comp.MaxDamage)
|
||||||
{
|
{
|
||||||
RemCompDeferred<EyeClosingComponent>(blindable);
|
RemCompDeferred<EyeClosingComponent>(blindable);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user