Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix PermanentBlindnessComponent to be not so permanent #33292

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Content.Shared/Traits/Assorted/PermanentBlindnessSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public override void Initialize()
{
SubscribeLocalEvent<PermanentBlindnessComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<PermanentBlindnessComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<PermanentBlindnessComponent, ComponentRemove>(OnRemove);
SubscribeLocalEvent<PermanentBlindnessComponent, ExaminedEvent>(OnExamined);
}

Expand All @@ -36,6 +37,17 @@ private void OnShutdown(Entity<PermanentBlindnessComponent> blindness, ref Compo
_blinding.UpdateIsBlind(blindness.Owner);
}

private void OnRemove(Entity<PermanentBlindnessComponent> blindness, ref ComponentRemove args)
{
if (!_entityManager.TryGetComponent<BlindableComponent>(blindness, out var blindable))
return;

if (blindable.MinDamage != 0)
{
_blinding.SetMinDamage(new Entity<BlindableComponent?>(blindness.Owner, blindable), 0);
}
}

private void OnMapInit(Entity<PermanentBlindnessComponent> blindness, ref MapInitEvent args)
{
if (!_entityManager.TryGetComponent<BlindableComponent>(blindness, out var blindable))
Expand Down
Loading