Syndicate gas mask flash protection (#8818)

* Syndicate gas masks protect from flashbangs

* fix var name

* update to loop through all slots

* update based on review comments
This commit is contained in:
themias
2022-06-15 03:04:52 -04:00
committed by GitHub
parent c243edbf33
commit b4ecf8a7ec
2 changed files with 8 additions and 6 deletions

View File

@@ -195,12 +195,13 @@ namespace Content.Server.Flash
private void OnInventoryFlashAttempt(EntityUid uid, InventoryComponent component, FlashAttemptEvent args) private void OnInventoryFlashAttempt(EntityUid uid, InventoryComponent component, FlashAttemptEvent args)
{ {
// Forward the event to a worn helmet, if one is equipped. foreach (var slot in new string[]{"head", "eyes", "mask"})
if (_inventorySystem.TryGetSlotEntity(uid, "head", out var maskSlotEntity, component)) {
RaiseLocalEvent(maskSlotEntity.Value, args); if (args.Cancelled)
// Forward the event to the glasses, if any. break;
if(!args.Cancelled && _inventorySystem.TryGetSlotEntity(uid, "eyes", out var eyeSlotEntity, component)) if (_inventorySystem.TryGetSlotEntity(uid, slot, out var item, component))
RaiseLocalEvent(eyeSlotEntity.Value, args); RaiseLocalEvent(item.Value, args);
}
} }
private void OnFlashImmunityFlashAttempt(EntityUid uid, FlashImmunityComponent component, FlashAttemptEvent args) private void OnFlashImmunityFlashAttempt(EntityUid uid, FlashImmunityComponent component, FlashAttemptEvent args)

View File

@@ -42,6 +42,7 @@
- type: IngestionBlocker - type: IngestionBlocker
- type: DiseaseProtection - type: DiseaseProtection
protection: 0.05 protection: 0.05
- type: FlashImmunity
- type: entity - type: entity
parent: ClothingMaskBase parent: ClothingMaskBase