* add IsMemberOfAny to faction system
* pro
---------
Co-authored-by: deltanedas <@deltanedas:kde.org>
return ent.Comp.Factions.Contains(faction);
}
+ /// <summary>
+ /// Returns whether an entity is a member of any listed faction.
+ /// If the list is empty this returns false.
+ /// </summary>
+ public bool IsMemberOfAny(Entity<NpcFactionMemberComponent?> ent, IEnumerable<ProtoId<NpcFactionPrototype>> factions)
+ {
+ if (!Resolve(ent, ref ent.Comp, false))
+ return false;
+
+ foreach (var faction in factions)
+ {
+ if (ent.Comp.Factions.Contains(faction))
+ return true;
+ }
+
+ return false;
+ }
+
/// <summary>
/// Adds this entity to the particular faction.
/// </summary>