]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Allow IdentityBlocker partial coverage (#24741)
authorthemias <89101928+themias@users.noreply.github.com>
Wed, 31 Jan 2024 03:49:19 +0000 (22:49 -0500)
committerGitHub <noreply@github.com>
Wed, 31 Jan 2024 03:49:19 +0000 (19:49 -0800)
* Allow IdentityBlocker partial coverage

* rename to TotalCoverage

Content.Shared/Clothing/EntitySystems/MaskSystem.cs
Content.Shared/IdentityManagement/Components/IdentityBlockerComponent.cs
Content.Shared/IdentityManagement/SharedIdentitySystem.cs
Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml
Resources/Prototypes/Entities/Clothing/Masks/masks.yml

index 6c135e1a07a95bc47f668c6eb458e44f5aaf0e27..2bbcad4bc4de0b1c0ffa5dc3ab4f82a98c56e006 100644 (file)
@@ -1,4 +1,4 @@
-using Content.Shared.Actions;
+using Content.Shared.Actions;
 using Content.Shared.Clothing.Components;
 using Content.Shared.Inventory;
 using Content.Shared.Inventory.Events;
@@ -68,6 +68,6 @@ public sealed class MaskSystem : EntitySystem
         RaiseLocalEvent(uid, ref maskEv);
 
         var wearerEv = new WearerMaskToggledEvent(mask.IsToggled);
-        RaiseLocalEvent(uid, ref wearerEv);
+        RaiseLocalEvent(wearer, ref wearerEv);
     }
 }
index 4dc9e97b016c4fe2b8ac91cc5fe0ae601ddaa14e..3857063783dd341ed96238491112d8b325352837 100644 (file)
@@ -1,4 +1,4 @@
-using Content.Shared.Inventory;
+using Content.Shared.Inventory;
 using Robust.Shared.GameStates;
 
 namespace Content.Shared.IdentityManagement.Components;
@@ -7,6 +7,20 @@ namespace Content.Shared.IdentityManagement.Components;
 public sealed partial class IdentityBlockerComponent : Component
 {
     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>
@@ -14,6 +28,9 @@ public sealed partial class IdentityBlockerComponent : Component
 /// </summary>
 public sealed class SeeIdentityAttemptEvent : CancellableEntityEventArgs, IInventoryRelayEvent
 {
-    // i.e. masks or helmets.
-    public SlotFlags TargetSlots => SlotFlags.MASK | SlotFlags.HEAD;
+    // i.e. masks, helmets, or glasses.
+    public SlotFlags TargetSlots => SlotFlags.MASK | SlotFlags.HEAD | SlotFlags.EYES;
+
+    // cumulative coverage from each relayed slot
+    public IdentityBlockerCoverage TotalCoverage = IdentityBlockerCoverage.NONE;
 }
index 7cb5f41b8a10c51e942d06783755209230db8ca4..a02e00f0b196cab7a2dc96e93677c65650d7fbe7 100644 (file)
@@ -23,7 +23,11 @@ public abstract class SharedIdentitySystem : EntitySystem
     private void OnSeeIdentity(EntityUid uid, IdentityBlockerComponent component, SeeIdentityAttemptEvent args)
     {
         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)
index cda7bc2f55084ecb27d89e88518c56890ae74beb..e969118bbee1e8ff89d515bc99a29777f1b0cf71 100644 (file)
     sprite: Clothing/Eyes/Glasses/outlawglasses.rsi
   - type: VisionCorrection
   - type: IdentityBlocker
+    coverage: EYES
 
 - type: entity
   parent: ClothingEyesBase
     tags:
     - HamsterWearable
     - WhitelistChameleon
+  - type: IdentityBlocker
+    coverage: EYES
 
 - type: entity
   parent: ClothingEyesBase
     guides:
     - Security
   - type: ShowSecurityIcons
+  - type: IdentityBlocker
+    coverage: EYES
 
 - type: entity
   parent: ClothingEyesBase
index e71c615c135f9529a485bb41a124d7d1c163a9a2..77655e7cdb18ce5a5f5c65e90db4e562b2156168 100644 (file)
   - type: IngestionBlocker
   - type: Item
     storedRotation: -90
+  - type: IdentityBlocker
+    coverage: MOUTH
 
 - type: entity
   parent: ClothingMaskBase
   - type: Clothing
     sprite: Clothing/Mask/neckgaiter.rsi
   - type: IdentityBlocker
+    coverage: MOUTH
   - type: Tag
     tags:
     - WhitelistChameleon