* start work * blindness actually works now * doc * doc you too. * i desire to sneeze my lungs out * no punchie * s Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using Content.Shared.Examine;
|
|
using Content.Shared.Eye.Blinding;
|
|
using Content.Shared.IdentityManagement;
|
|
using Robust.Shared.Network;
|
|
|
|
namespace Content.Shared.Traits.Assorted;
|
|
|
|
/// <summary>
|
|
/// This handles permanent blindness, both the examine and the actual effect.
|
|
/// </summary>
|
|
public sealed class PermanentBlindnessSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly INetManager _net = default!;
|
|
[Dependency] private readonly SharedBlindingSystem _blinding = default!;
|
|
|
|
/// <inheritdoc/>
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<PermanentBlindnessComponent, ComponentStartup>(OnStartup);
|
|
SubscribeLocalEvent<PermanentBlindnessComponent, ComponentShutdown>(OnShutdown);
|
|
SubscribeLocalEvent<PermanentBlindnessComponent, ExaminedEvent>(OnExamined);
|
|
}
|
|
|
|
private void OnExamined(EntityUid uid, PermanentBlindnessComponent component, ExaminedEvent args)
|
|
{
|
|
if (args.IsInDetailsRange && !_net.IsClient)
|
|
{
|
|
args.PushMarkup(Loc.GetString("permanent-blindness-trait-examined", ("target", Identity.Entity(uid, EntityManager))));
|
|
}
|
|
}
|
|
|
|
private void OnShutdown(EntityUid uid, PermanentBlindnessComponent component, ComponentShutdown args)
|
|
{
|
|
_blinding.AdjustBlindSources(uid, false);
|
|
}
|
|
|
|
private void OnStartup(EntityUid uid, PermanentBlindnessComponent component, ComponentStartup args)
|
|
{
|
|
_blinding.AdjustBlindSources(uid, true);
|
|
}
|
|
}
|