public sealed class PermanentBlindnessSystem : EntitySystem
{
[Dependency] private readonly INetManager _net = default!;
- [Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly BlindableSystem _blinding = default!;
/// <inheritdoc/>
private void OnShutdown(Entity<PermanentBlindnessComponent> blindness, ref ComponentShutdown args)
{
- _blinding.UpdateIsBlind(blindness.Owner);
+ if (!TryComp<BlindableComponent>(blindness.Owner, out var blindable))
+ return;
+
+ if (blindable.MinDamage != 0)
+ {
+ _blinding.SetMinDamage((blindness.Owner, blindable), 0);
+ }
}
private void OnMapInit(Entity<PermanentBlindnessComponent> blindness, ref MapInitEvent args)
{
- if (!_entityManager.TryGetComponent<BlindableComponent>(blindness, out var blindable))
+ if(!TryComp<BlindableComponent>(blindness.Owner, out var blindable))
return;
if (blindness.Comp.Blindness != 0)
- _blinding.SetMinDamage(new Entity<BlindableComponent?>(blindness.Owner, blindable), blindness.Comp.Blindness);
+ _blinding.SetMinDamage((blindness.Owner, blindable), blindness.Comp.Blindness);
else
{
var maxMagnitudeInt = (int) BlurryVisionComponent.MaxMagnitude;
- _blinding.SetMinDamage(new Entity<BlindableComponent?>(blindness.Owner, blindable), maxMagnitudeInt);
+ _blinding.SetMinDamage((blindness.Owner, blindable), maxMagnitudeInt);
}
}
}