From 298623df4a79296a42b259646caf79dab0b35b96 Mon Sep 17 00:00:00 2001 From: Vordenburg <114301317+Vordenburg@users.noreply.github.com> Date: Sat, 5 Aug 2023 16:54:43 -0400 Subject: [PATCH] Add ClearFactions API (#18719) --- Content.Server/NPC/Systems/NpcFactionSystem.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Content.Server/NPC/Systems/NpcFactionSystem.cs b/Content.Server/NPC/Systems/NpcFactionSystem.cs index bfc4add577..79c4bbc7af 100644 --- a/Content.Server/NPC/Systems/NpcFactionSystem.cs +++ b/Content.Server/NPC/Systems/NpcFactionSystem.cs @@ -111,6 +111,20 @@ public sealed class NpcFactionSystem : EntitySystem } } + /// + /// Remove this entity from all factions. + /// + public void ClearFactions(EntityUid uid, bool dirty = true) + { + if (!TryComp(uid, out var component)) + return; + + component.Factions.Clear(); + + if (dirty) + RefreshFactions(component); + } + public IEnumerable GetNearbyHostiles(EntityUid entity, float range, NpcFactionMemberComponent? component = null) { if (!Resolve(entity, ref component, false))