Blindness, Narcolepsy, Pacifism, and uncontrollable sneezing (#11489)
* 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>
This commit is contained in:
41
Content.Shared/Traits/Assorted/PermanentBlindnessSystem.cs
Normal file
41
Content.Shared/Traits/Assorted/PermanentBlindnessSystem.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user