add IsMemberOfAny to faction system (#32975)
* add IsMemberOfAny to faction system * pro --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -81,6 +81,24 @@ public sealed partial class NpcFactionSystem : EntitySystem
|
|||||||
return ent.Comp.Factions.Contains(faction);
|
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>
|
/// <summary>
|
||||||
/// Adds this entity to the particular faction.
|
/// Adds this entity to the particular faction.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user