2023-04-29 17:32:14 +12:00
|
|
|
using Content.Shared.Eye.Blinding.Components;
|
|
|
|
|
using Content.Shared.Inventory.Events;
|
|
|
|
|
using Content.Shared.Inventory;
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared.Eye.Blinding.Systems;
|
|
|
|
|
|
|
|
|
|
public sealed class BlindfoldSystem : EntitySystem
|
|
|
|
|
{
|
|
|
|
|
[Dependency] private readonly BlindableSystem _blindableSystem = default!;
|
|
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
|
|
|
|
SubscribeLocalEvent<BlindfoldComponent, GotEquippedEvent>(OnEquipped);
|
|
|
|
|
SubscribeLocalEvent<BlindfoldComponent, GotUnequippedEvent>(OnUnequipped);
|
|
|
|
|
SubscribeLocalEvent<BlindfoldComponent, InventoryRelayedEvent<CanSeeAttemptEvent>>(OnBlindfoldTrySee);
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-03 04:07:02 -05:00
|
|
|
private void OnBlindfoldTrySee(Entity<BlindfoldComponent> blindfold, ref InventoryRelayedEvent<CanSeeAttemptEvent> args)
|
2023-04-29 17:32:14 +12:00
|
|
|
{
|
|
|
|
|
args.Args.Cancel();
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-03 04:07:02 -05:00
|
|
|
private void OnEquipped(Entity<BlindfoldComponent> blindfold, ref GotEquippedEvent args)
|
2023-04-29 17:32:14 +12:00
|
|
|
{
|
|
|
|
|
_blindableSystem.UpdateIsBlind(args.Equipee);
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-03 04:07:02 -05:00
|
|
|
private void OnUnequipped(Entity<BlindfoldComponent> blindfold, ref GotUnequippedEvent args)
|
2023-04-29 17:32:14 +12:00
|
|
|
{
|
|
|
|
|
_blindableSystem.UpdateIsBlind(args.Equipee);
|
|
|
|
|
}
|
|
|
|
|
}
|