From 4151b31b3130b2261a774e289b4c9e4da0c27f6d Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Wed, 22 Mar 2023 15:58:23 +1100 Subject: [PATCH] Clear cached NPC factions on refresh (#14762) --- Content.Server/NPC/Systems/FactionSystem.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Content.Server/NPC/Systems/FactionSystem.cs b/Content.Server/NPC/Systems/FactionSystem.cs index 241c1c4bdb..a176ed149d 100644 --- a/Content.Server/NPC/Systems/FactionSystem.cs +++ b/Content.Server/NPC/Systems/FactionSystem.cs @@ -36,6 +36,9 @@ namespace Content.Server.NPC.Systems private void OnProtoReload(PrototypesReloadedEventArgs obj) { + if (!obj.ByType.ContainsKey(typeof(FactionPrototype))) + return; + RefreshFactions(); } @@ -49,6 +52,9 @@ namespace Content.Server.NPC.Systems /// private void RefreshFactions(FactionComponent component) { + component.FriendlyFactions.Clear(); + component.HostileFactions.Clear(); + foreach (var faction in component.Factions) { // YAML Linter already yells about this