From 2ea596f98c38b44e410f70db3e18d0416b87d1ae Mon Sep 17 00:00:00 2001 From: pheenty Date: Sun, 27 Oct 2024 19:06:34 +0700 Subject: [PATCH] clothingwhitelistfix --- .../ClothingWhitelistComponent.cs | 4 ++-- .../ClothingWhitelistSystem.cs | 5 ++--- .../Clothing/OuterClothing/hardsuits.yml | 20 ++++++++----------- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/Content.Server/Stories/ClothingWhitelist/ClothingWhitelistComponent.cs b/Content.Server/Stories/ClothingWhitelist/ClothingWhitelistComponent.cs index 29aabc6cd6..82adefc7e2 100644 --- a/Content.Server/Stories/ClothingWhitelist/ClothingWhitelistComponent.cs +++ b/Content.Server/Stories/ClothingWhitelist/ClothingWhitelistComponent.cs @@ -13,13 +13,13 @@ public sealed partial class ClothingWhitelistComponent : Component public EntityWhitelist? Whitelist; [DataField("factionsWhitelist"), ViewVariables(VVAccess.ReadWrite)] - public HashSet> FactionsWhitelist = new(); + public HashSet>? FactionsWhitelist = new(); [DataField("blacklist")] public EntityWhitelist? Blacklist; [DataField("factionsBlacklist"), ViewVariables(VVAccess.ReadWrite)] - public HashSet> FactionsBlacklist = new(); + public HashSet>? FactionsBlacklist = new(); [DataField("delay")] public float Delay = 3f; diff --git a/Content.Server/Stories/ClothingWhitelist/ClothingWhitelistSystem.cs b/Content.Server/Stories/ClothingWhitelist/ClothingWhitelistSystem.cs index 86f7a76ef1..23ed4462da 100644 --- a/Content.Server/Stories/ClothingWhitelist/ClothingWhitelistSystem.cs +++ b/Content.Server/Stories/ClothingWhitelist/ClothingWhitelistSystem.cs @@ -28,13 +28,12 @@ public override void Initialize() private void OnEquipped(EntityUid uid, ClothingWhitelistComponent comp, GotEquippedEvent args) { - if (comp.Blacklist != null && !_whitelistSystem.IsWhitelistFail(comp.Blacklist, args.Equipee) || comp.Blacklist == null) - if (comp.Whitelist != null && _whitelistSystem.IsWhitelistFail(comp.Whitelist, args.Equipee)) return; + if (_whitelistSystem.IsBlacklistFailOrNull(comp.Blacklist, args.Equipee) && _whitelistSystem.IsWhitelistPass(comp.Whitelist, args.Equipee)) return; if (TryComp(args.Equipee, out var npc)) { var fs = npc.Factions; - if (!fs.Overlaps(comp.FactionsBlacklist) && fs.Overlaps(comp.FactionsWhitelist)) return; + if ((comp.FactionsBlacklist != null && !fs.Overlaps(comp.FactionsBlacklist)) && (comp.FactionsWhitelist == null || fs.Overlaps(comp.FactionsWhitelist))) return; } _popupSystem.PopupEntity(Loc.GetString("Ошибка доступа! Активация протоколов защиты.."), args.Equipee, args.Equipee, PopupType.LargeCaution); diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml index cb489cd963..650d5d3c01 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml @@ -481,9 +481,6 @@ description: A heavily armored hardsuit designed for work in special operations. Property of Gorlex Marauders. components: - type: ClothingWhitelist # Stories-ExplodingHardsuit (doublechest) - start - whitelist: - components: - - NukeOperative factionsWhitelist: - Syndicate - type: Explosive @@ -551,9 +548,6 @@ description: An elite version of the blood-red hardsuit, with improved mobility and fireproofing. Property of Gorlex Marauders. components: - type: ClothingWhitelist # Stories-ExplodingHardsuit (doublechest) - start - whitelist: - components: - - NukeOperative factionsWhitelist: - Syndicate - type: Explosive @@ -603,9 +597,6 @@ description: A bulked up version of the blood-red hardsuit, purpose-built for the commander of a syndicate operative squad. Has significantly improved armor for those deadly front-lines firefights. components: - type: ClothingWhitelist # Stories-ExplodingHardsuit (doublechest) - start - whitelist: - components: - - NukeOperative factionsWhitelist: - Syndicate - type: Explosive @@ -648,9 +639,6 @@ description: A suit made by the cutting edge R&D department at cybersun to be hyper resilient. components: - type: ClothingWhitelist # Stories-ExplodingHardsuit (doublechest) - start - whitelist: - components: - - NukeOperative factionsWhitelist: - Syndicate - type: Explosive @@ -843,6 +831,8 @@ sprite: Clothing/OuterClothing/Hardsuits/ERTSuits/ertleader.rsi - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitERTLeader + - type: ClothingWhitelist # Stories-ExplodingHardsuit + factionsWhitelist: null #ERT Chaplain Hardsuit - type: entity @@ -857,6 +847,8 @@ sprite: Clothing/OuterClothing/Hardsuits/ERTSuits/ertchaplain.rsi - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitERTChaplain + - type: ClothingWhitelist # Stories-ExplodingHardsuit + factionsWhitelist: null #ERT Engineer Hardsuit - type: entity @@ -885,6 +877,8 @@ sprite: Clothing/OuterClothing/Hardsuits/ERTSuits/ertmedical.rsi - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitERTMedical + - type: ClothingWhitelist # Stories-ExplodingHardsuit + factionsWhitelist: null #ERT Security Hardsuit - type: entity @@ -920,6 +914,8 @@ tags: - Hardsuit - WhitelistChameleon + - type: ClothingWhitelist # Stories-ExplodingHardsuit + factionsWhitelist: null #ERT Janitor Hardsuit - type: entity