Move MaskComponent to shared and add toggle events (#22395)

* Move MaskComponent to shared and add toggle events

* Datafield and network IsToggled

* Add missing dirty
This commit is contained in:
DrSmugleaf
2023-12-12 19:02:35 -07:00
committed by GitHub
parent 16bd6802df
commit ad6dc94c60
12 changed files with 174 additions and 148 deletions

View File

@@ -1,3 +1,4 @@
using Content.Shared.Clothing;
using Content.Shared.IdentityManagement.Components;
using Content.Shared.Inventory;
using Robust.Shared.Containers;
@@ -16,6 +17,7 @@ public abstract class SharedIdentitySystem : EntitySystem
SubscribeLocalEvent<IdentityComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<IdentityBlockerComponent, SeeIdentityAttemptEvent>(OnSeeIdentity);
SubscribeLocalEvent<IdentityBlockerComponent, InventoryRelayedEvent<SeeIdentityAttemptEvent>>((e, c, ev) => OnSeeIdentity(e, c, ev.Args));
SubscribeLocalEvent<IdentityBlockerComponent, ItemMaskToggledEvent>(OnMaskToggled);
}
private void OnSeeIdentity(EntityUid uid, IdentityBlockerComponent component, SeeIdentityAttemptEvent args)
@@ -28,4 +30,9 @@ public abstract class SharedIdentitySystem : EntitySystem
{
component.IdentityEntitySlot = _container.EnsureContainer<ContainerSlot>(uid, SlotName);
}
private void OnMaskToggled(Entity<IdentityBlockerComponent> ent, ref ItemMaskToggledEvent args)
{
ent.Comp.Enabled = !args.IsToggled;
}
}