Allow IdentityBlocker partial coverage (#24741)

* Allow IdentityBlocker partial coverage

* rename to TotalCoverage
This commit is contained in:
themias
2024-01-30 22:49:19 -05:00
committed by GitHub
parent bd46d7cc8a
commit d75f6c3db4
5 changed files with 35 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
using Content.Shared.Actions; using Content.Shared.Actions;
using Content.Shared.Clothing.Components; using Content.Shared.Clothing.Components;
using Content.Shared.Inventory; using Content.Shared.Inventory;
using Content.Shared.Inventory.Events; using Content.Shared.Inventory.Events;
@@ -68,6 +68,6 @@ public sealed class MaskSystem : EntitySystem
RaiseLocalEvent(uid, ref maskEv); RaiseLocalEvent(uid, ref maskEv);
var wearerEv = new WearerMaskToggledEvent(mask.IsToggled); var wearerEv = new WearerMaskToggledEvent(mask.IsToggled);
RaiseLocalEvent(uid, ref wearerEv); RaiseLocalEvent(wearer, ref wearerEv);
} }
} }

View File

@@ -1,4 +1,4 @@
using Content.Shared.Inventory; using Content.Shared.Inventory;
using Robust.Shared.GameStates; using Robust.Shared.GameStates;
namespace Content.Shared.IdentityManagement.Components; namespace Content.Shared.IdentityManagement.Components;
@@ -7,6 +7,20 @@ namespace Content.Shared.IdentityManagement.Components;
public sealed partial class IdentityBlockerComponent : Component public sealed partial class IdentityBlockerComponent : Component
{ {
public bool Enabled = true; public bool Enabled = true;
/// <summary>
/// What part of your face does this cover? Eyes, mouth, or full?
/// </summary>
[DataField]
public IdentityBlockerCoverage Coverage = IdentityBlockerCoverage.FULL;
}
public enum IdentityBlockerCoverage
{
NONE = 0,
MOUTH = 1 << 0,
EYES = 1 << 1,
FULL = MOUTH | EYES
} }
/// <summary> /// <summary>
@@ -14,6 +28,9 @@ public sealed partial class IdentityBlockerComponent : Component
/// </summary> /// </summary>
public sealed class SeeIdentityAttemptEvent : CancellableEntityEventArgs, IInventoryRelayEvent public sealed class SeeIdentityAttemptEvent : CancellableEntityEventArgs, IInventoryRelayEvent
{ {
// i.e. masks or helmets. // i.e. masks, helmets, or glasses.
public SlotFlags TargetSlots => SlotFlags.MASK | SlotFlags.HEAD; public SlotFlags TargetSlots => SlotFlags.MASK | SlotFlags.HEAD | SlotFlags.EYES;
// cumulative coverage from each relayed slot
public IdentityBlockerCoverage TotalCoverage = IdentityBlockerCoverage.NONE;
} }

View File

@@ -23,7 +23,11 @@ public abstract class SharedIdentitySystem : EntitySystem
private void OnSeeIdentity(EntityUid uid, IdentityBlockerComponent component, SeeIdentityAttemptEvent args) private void OnSeeIdentity(EntityUid uid, IdentityBlockerComponent component, SeeIdentityAttemptEvent args)
{ {
if (component.Enabled) if (component.Enabled)
args.Cancel(); {
args.TotalCoverage |= component.Coverage;
if(args.TotalCoverage == IdentityBlockerCoverage.FULL)
args.Cancel();
}
} }
protected virtual void OnComponentInit(EntityUid uid, IdentityComponent component, ComponentInit args) protected virtual void OnComponentInit(EntityUid uid, IdentityComponent component, ComponentInit args)

View File

@@ -122,6 +122,7 @@
sprite: Clothing/Eyes/Glasses/outlawglasses.rsi sprite: Clothing/Eyes/Glasses/outlawglasses.rsi
- type: VisionCorrection - type: VisionCorrection
- type: IdentityBlocker - type: IdentityBlocker
coverage: EYES
- type: entity - type: entity
parent: ClothingEyesBase parent: ClothingEyesBase
@@ -140,6 +141,8 @@
tags: tags:
- HamsterWearable - HamsterWearable
- WhitelistChameleon - WhitelistChameleon
- type: IdentityBlocker
coverage: EYES
- type: entity - type: entity
parent: ClothingEyesBase parent: ClothingEyesBase
@@ -162,6 +165,8 @@
guides: guides:
- Security - Security
- type: ShowSecurityIcons - type: ShowSecurityIcons
- type: IdentityBlocker
coverage: EYES
- type: entity - type: entity
parent: ClothingEyesBase parent: ClothingEyesBase

View File

@@ -262,6 +262,8 @@
- type: IngestionBlocker - type: IngestionBlocker
- type: Item - type: Item
storedRotation: -90 storedRotation: -90
- type: IdentityBlocker
coverage: MOUTH
- type: entity - type: entity
parent: ClothingMaskBase parent: ClothingMaskBase
@@ -475,6 +477,7 @@
- type: Clothing - type: Clothing
sprite: Clothing/Mask/neckgaiter.rsi sprite: Clothing/Mask/neckgaiter.rsi
- type: IdentityBlocker - type: IdentityBlocker
coverage: MOUTH
- type: Tag - type: Tag
tags: tags:
- WhitelistChameleon - WhitelistChameleon