]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Clear cached NPC factions on refresh (#14762)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Wed, 22 Mar 2023 04:58:23 +0000 (15:58 +1100)
committerGitHub <noreply@github.com>
Wed, 22 Mar 2023 04:58:23 +0000 (15:58 +1100)
Content.Server/NPC/Systems/FactionSystem.cs

index 241c1c4bdbc585606c61dbe9a11ff4d25b6e1d9f..a176ed149da4dc11af025a43c7ad38c5784a13a2 100644 (file)
@@ -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
         /// </summary>
         private void RefreshFactions(FactionComponent component)
         {
+            component.FriendlyFactions.Clear();
+            component.HostileFactions.Clear();
+
             foreach (var faction in component.Factions)
             {
                 // YAML Linter already yells about this