From e89651c77481eb04b02a95e11260672062d02d12 Mon Sep 17 00:00:00 2001 From: Winkarst-cpu <74284083+Winkarst-cpu@users.noreply.github.com> Date: Thu, 9 Oct 2025 17:07:58 +0300 Subject: [PATCH] Fix masks with flash, eye, and damage protection working while being pulled down (#40331) Fix --- Content.Shared/Armor/SharedArmorSystem.cs | 12 +++++++++++- .../Eye/Blinding/Systems/EyeProtectionSystem.cs | 4 ++++ Content.Shared/Flash/SharedFlashSystem.cs | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Armor/SharedArmorSystem.cs b/Content.Shared/Armor/SharedArmorSystem.cs index 1ff1bbc073..972289460f 100644 --- a/Content.Shared/Armor/SharedArmorSystem.cs +++ b/Content.Shared/Armor/SharedArmorSystem.cs @@ -1,4 +1,5 @@ -using Content.Shared.Damage; +using Content.Shared.Clothing.Components; +using Content.Shared.Damage; using Content.Shared.Examine; using Content.Shared.Inventory; using Content.Shared.Silicons.Borgs; @@ -32,6 +33,9 @@ public abstract class SharedArmorSystem : EntitySystem /// The event, contains the running count of armor percentage as a coefficient private void OnCoefficientQuery(Entity ent, ref InventoryRelayedEvent args) { + if (TryComp(ent, out var mask) && mask.IsToggled) + return; + foreach (var armorCoefficient in ent.Comp.Modifiers.Coefficients) { args.Args.DamageModifiers.Coefficients[armorCoefficient.Key] = args.Args.DamageModifiers.Coefficients.TryGetValue(armorCoefficient.Key, out var coefficient) ? coefficient * armorCoefficient.Value : armorCoefficient.Value; @@ -40,12 +44,18 @@ public abstract class SharedArmorSystem : EntitySystem private void OnDamageModify(EntityUid uid, ArmorComponent component, InventoryRelayedEvent args) { + if (TryComp(uid, out var mask) && mask.IsToggled) + return; + args.Args.Damage = DamageSpecifier.ApplyModifierSet(args.Args.Damage, component.Modifiers); } private void OnBorgDamageModify(EntityUid uid, ArmorComponent component, ref BorgModuleRelayedEvent args) { + if (TryComp(uid, out var mask) && mask.IsToggled) + return; + args.Args.Damage = DamageSpecifier.ApplyModifierSet(args.Args.Damage, component.Modifiers); } diff --git a/Content.Shared/Eye/Blinding/Systems/EyeProtectionSystem.cs b/Content.Shared/Eye/Blinding/Systems/EyeProtectionSystem.cs index 0fc01f1b4e..0b4353eeda 100644 --- a/Content.Shared/Eye/Blinding/Systems/EyeProtectionSystem.cs +++ b/Content.Shared/Eye/Blinding/Systems/EyeProtectionSystem.cs @@ -3,6 +3,7 @@ using Content.Shared.Inventory; using Content.Shared.Eye.Blinding.Components; using Content.Shared.Tools.Components; using Content.Shared.Item.ItemToggle.Components; +using Content.Shared.Clothing.Components; namespace Content.Shared.Eye.Blinding.Systems { @@ -29,6 +30,9 @@ namespace Content.Shared.Eye.Blinding.Systems private void OnGetProtection(EntityUid uid, EyeProtectionComponent component, GetEyeProtectionEvent args) { + if (TryComp(uid, out var mask) && mask.IsToggled) + return; + args.Protection += component.ProtectionTime; } diff --git a/Content.Shared/Flash/SharedFlashSystem.cs b/Content.Shared/Flash/SharedFlashSystem.cs index 7f69e86042..02513aa91b 100644 --- a/Content.Shared/Flash/SharedFlashSystem.cs +++ b/Content.Shared/Flash/SharedFlashSystem.cs @@ -22,6 +22,7 @@ using Robust.Shared.Timing; using System.Linq; using Content.Shared.Movement.Systems; using Content.Shared.Random.Helpers; +using Content.Shared.Clothing.Components; namespace Content.Shared.Flash; @@ -258,6 +259,9 @@ public abstract class SharedFlashSystem : EntitySystem private void OnFlashImmunityFlashAttempt(Entity ent, ref FlashAttemptEvent args) { + if (TryComp(ent, out var mask) && mask.IsToggled) + return; + if (ent.Comp.Enabled) args.Cancelled = true; }