NPCs/Relationship.cs
namespace Opium;

/// <summary>
/// Placed on a GameObject that has an <see cref="Actor"/> component, this component tells AI systems about the relationship between two actors.
/// </summary>
public partial class Relationship : Component
{
	public enum FriendState
	{
		Friend,
		Enemy,
		Neutral
	}

	/// <summary>
	/// Which tags will identify this actor as friends with other actors?
	/// </summary>
	[Property] public TagSet FriendTags { get; set; } = new TagSet();

	/// <summary>
	/// Which tags will identify this actor as the enemy of other actors?
	/// </summary>
	[Property] public TagSet EnemyTags { get; set; } = new TagSet();

	/// <summary>
	/// Gets the friend status of two actors.
	/// </summary>
	/// <param name="thisActor"></param>
	/// <param name="otherActor"></param>
	/// <returns></returns>
	public FriendState GetFriendState( Actor thisActor, Actor otherActor )
	{
		if ( thisActor.Relationship.FriendTags.HasAny( otherActor.Relationship.FriendTags ) )
		{
			return FriendState.Friend;
		}
	
		// Check this actors enemy tags - if the OTHER actor has friend tags of those tags, we're not mates anymore.
		if ( thisActor.Relationship.EnemyTags.HasAny( otherActor.Relationship.FriendTags ) )
		{
			return FriendState.Enemy;
		}

		return FriendState.Neutral;
	}
}