Fix masks with flash, eye, and damage protection working while being pulled down (#40331)

Fix
This commit is contained in:
Winkarst-cpu
2025-10-09 17:07:58 +03:00
committed by GitHub
parent dc127d0857
commit e89651c774
3 changed files with 19 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
using Content.Shared.Damage; using Content.Shared.Clothing.Components;
using Content.Shared.Damage;
using Content.Shared.Examine; using Content.Shared.Examine;
using Content.Shared.Inventory; using Content.Shared.Inventory;
using Content.Shared.Silicons.Borgs; using Content.Shared.Silicons.Borgs;
@@ -32,6 +33,9 @@ public abstract class SharedArmorSystem : EntitySystem
/// <param name="args">The event, contains the running count of armor percentage as a coefficient</param> /// <param name="args">The event, contains the running count of armor percentage as a coefficient</param>
private void OnCoefficientQuery(Entity<ArmorComponent> ent, ref InventoryRelayedEvent<CoefficientQueryEvent> args) private void OnCoefficientQuery(Entity<ArmorComponent> ent, ref InventoryRelayedEvent<CoefficientQueryEvent> args)
{ {
if (TryComp<MaskComponent>(ent, out var mask) && mask.IsToggled)
return;
foreach (var armorCoefficient in ent.Comp.Modifiers.Coefficients) 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; 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<DamageModifyEvent> args) private void OnDamageModify(EntityUid uid, ArmorComponent component, InventoryRelayedEvent<DamageModifyEvent> args)
{ {
if (TryComp<MaskComponent>(uid, out var mask) && mask.IsToggled)
return;
args.Args.Damage = DamageSpecifier.ApplyModifierSet(args.Args.Damage, component.Modifiers); args.Args.Damage = DamageSpecifier.ApplyModifierSet(args.Args.Damage, component.Modifiers);
} }
private void OnBorgDamageModify(EntityUid uid, ArmorComponent component, private void OnBorgDamageModify(EntityUid uid, ArmorComponent component,
ref BorgModuleRelayedEvent<DamageModifyEvent> args) ref BorgModuleRelayedEvent<DamageModifyEvent> args)
{ {
if (TryComp<MaskComponent>(uid, out var mask) && mask.IsToggled)
return;
args.Args.Damage = DamageSpecifier.ApplyModifierSet(args.Args.Damage, component.Modifiers); args.Args.Damage = DamageSpecifier.ApplyModifierSet(args.Args.Damage, component.Modifiers);
} }

View File

@@ -3,6 +3,7 @@ using Content.Shared.Inventory;
using Content.Shared.Eye.Blinding.Components; using Content.Shared.Eye.Blinding.Components;
using Content.Shared.Tools.Components; using Content.Shared.Tools.Components;
using Content.Shared.Item.ItemToggle.Components; using Content.Shared.Item.ItemToggle.Components;
using Content.Shared.Clothing.Components;
namespace Content.Shared.Eye.Blinding.Systems 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) private void OnGetProtection(EntityUid uid, EyeProtectionComponent component, GetEyeProtectionEvent args)
{ {
if (TryComp<MaskComponent>(uid, out var mask) && mask.IsToggled)
return;
args.Protection += component.ProtectionTime; args.Protection += component.ProtectionTime;
} }

View File

@@ -22,6 +22,7 @@ using Robust.Shared.Timing;
using System.Linq; using System.Linq;
using Content.Shared.Movement.Systems; using Content.Shared.Movement.Systems;
using Content.Shared.Random.Helpers; using Content.Shared.Random.Helpers;
using Content.Shared.Clothing.Components;
namespace Content.Shared.Flash; namespace Content.Shared.Flash;
@@ -258,6 +259,9 @@ public abstract class SharedFlashSystem : EntitySystem
private void OnFlashImmunityFlashAttempt(Entity<FlashImmunityComponent> ent, ref FlashAttemptEvent args) private void OnFlashImmunityFlashAttempt(Entity<FlashImmunityComponent> ent, ref FlashAttemptEvent args)
{ {
if (TryComp<MaskComponent>(ent, out var mask) && mask.IsToggled)
return;
if (ent.Comp.Enabled) if (ent.Comp.Enabled)
args.Cancelled = true; args.Cancelled = true;
} }