From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Wed, 22 Mar 2023 04:58:23 +0000 (+1100) Subject: Clear cached NPC factions on refresh (#14762) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=4151b31b3130b2261a774e289b4c9e4da0c27f6d;p=space-station-14.git Clear cached NPC factions on refresh (#14762) --- 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