class HitIsQuickhackPresentInQueuePrereqCondition extends BaseHitPrereqCondition
{
	var m_hackCategory : weak< HackCategory_Record >;
	var m_isTheNextQhInQueue : Bool;

	public override function SetData( recordID : TweakDBID )
	{
		m_hackCategory = TDB.GetHackCategoryRecord( TweakDBInterface.GetForeignKeyDefault( recordID + T".hackCategory" ) );
		m_isTheNextQhInQueue = TDB.GetBool( recordID + T".isTheNextQhInQueue" );
		super.SetData( recordID );
	}

	public override function Evaluate( hitEvent : gameHitEvent ) : Bool
	{
		var i : Int32;
		var result : Bool;
		var target : weak< ScriptedPuppet >;
		var currentlyUploadingAction : ScriptableDeviceAction;
		var objectActionRecords : array< ObjectAction_Record >;
		var objectActionRecord : ObjectAction_Record;
		target = ( ( ScriptedPuppet )( hitEvent.target ) );
		if( !( target ) )
		{
			return false;
		}
		currentlyUploadingAction = target.GetCurrentlyUploadingAction();
		if( ( currentlyUploadingAction && currentlyUploadingAction.m_deviceActionQueue ) && !( currentlyUploadingAction.m_isInactive ) )
		{
			objectActionRecords.PushBack( currentlyUploadingAction.GetObjectActionRecord() );
			currentlyUploadingAction.m_deviceActionQueue.GetAllQueuedActionObjectRecords( objectActionRecords );
			for( i = 0; i < objectActionRecords.Size(); i += 1 )
			{
				objectActionRecord = objectActionRecords[ i ];
				if( m_hackCategory.GetID() == objectActionRecord.HackCategory().GetID() )
				{
					result = true;
					break;
				}
				if( m_isTheNextQhInQueue )
				{
					break;
				}
			}
		}
		else
		{
			return false;
		}
		if( result )
		{
			result = CheckOnlyOncePerShot( hitEvent );
		}
		return ( ( m_invert ) ? ( !( result ) ) : ( result ) );
	}

}

