class NPCRecordHasVisualTagState extends PrereqState
{
}

class NPCRecordHasVisualTag extends IScriptablePrereq
{
	var m_visualTag : CName;
	var m_hasTag : Bool;

	protected export override function Initialize( recordID : TweakDBID )
	{
		var str : String;
		str = TweakDBInterface.GetString( recordID + T".visualTag", "" );
		m_visualTag = StringToName( str );
		m_hasTag = TweakDBInterface.GetBool( recordID + T".hasTag", false );
	}

	protected export const override function IsOnRegisterSupported() : Bool
	{
		return false;
	}

	public export const override function IsFulfilled( game : GameInstance, context : IScriptable ) : Bool
	{
		var owner : GameObject;
		var targetPuppet : ScriptedPuppet;
		owner = ( ( GameObject )( context ) );
		targetPuppet = ( ( ScriptedPuppet )( owner ) );
		if( m_hasTag )
		{
			if( NPCManager.HasVisualTag( targetPuppet, m_visualTag ) )
			{
				return true;
			}
		}
		else
		{
			if( !( NPCManager.HasVisualTag( targetPuppet, m_visualTag ) ) )
			{
				return true;
			}
		}
		return false;
	}

}

class EntityHasVisualTagPrereqState extends PrereqState
{
}

class EntityHasVisualTag extends IScriptablePrereq
{
	private var m_visualTag : CName;
	private var m_hasTag : Bool;

	protected override function Initialize( recordID : TweakDBID )
	{
		m_visualTag = StringToName( TweakDBInterface.GetString( recordID + T".visualTag", "" ) );
		m_hasTag = TweakDBInterface.GetBool( recordID + T".hasTag", false );
	}

	public const override function IsFulfilled( game : GameInstance, context : IScriptable ) : Bool
	{
		var owner : Entity;
		owner = ( ( Entity )( context ) );
		if( !( owner ) )
		{
			return false;
		}
		if( m_hasTag )
		{
			if( owner.MatchVisualTag( m_visualTag ) )
			{
				return true;
			}
		}
		else
		{
			if( !( owner.MatchVisualTag( m_visualTag ) ) )
			{
				return true;
			}
		}
		return false;
	}

}

