Skip to content

Commit

Permalink
clothingwhitelistfix
Browse files Browse the repository at this point in the history
  • Loading branch information
pheenty committed Oct 27, 2024
1 parent 31dfe87 commit 2ea596f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ public sealed partial class ClothingWhitelistComponent : Component
public EntityWhitelist? Whitelist;

[DataField("factionsWhitelist"), ViewVariables(VVAccess.ReadWrite)]
public HashSet<ProtoId<NpcFactionPrototype>> FactionsWhitelist = new();
public HashSet<ProtoId<NpcFactionPrototype>>? FactionsWhitelist = new();

[DataField("blacklist")]
public EntityWhitelist? Blacklist;

[DataField("factionsBlacklist"), ViewVariables(VVAccess.ReadWrite)]
public HashSet<ProtoId<NpcFactionPrototype>> FactionsBlacklist = new();
public HashSet<ProtoId<NpcFactionPrototype>>? FactionsBlacklist = new();

[DataField("delay")]
public float Delay = 3f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<NpcFactionMemberComponent>(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);
Expand Down
20 changes: 8 additions & 12 deletions Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -920,6 +914,8 @@
tags:
- Hardsuit
- WhitelistChameleon
- type: ClothingWhitelist # Stories-ExplodingHardsuit
factionsWhitelist: null

#ERT Janitor Hardsuit
- type: entity
Expand Down

0 comments on commit 2ea596f

Please sign in to comment.