//========= Copyright © 1996-2005, Sander Corporation, All rights reserved. ============//
//
// Purpose: Holder of info for an order.
//
// $NoKeywords: $
//=============================================================================//

#ifndef CRTSPOINTORDER_H
#define CRTSPOINTORDER_H
#ifdef _WIN32
#pragma once
#endif

#include "cbase.h"
#include "AI_BaseNPC.h"
#include "hl2wars/rts_parsedata.h"
#include "nav_area.h"

class CAI_Hint;
class HidingSpot;

class CRTSPointOrder : public CPointEntity
{
	DECLARE_CLASS( CRTSPointOrder, CPointEntity );
public:
	DECLARE_DATADESC();	

	CRTSPointOrder();
	~CRTSPointOrder();
	void	UpdateOnRemove();
	virtual void Spawn( void );
	void Start( void );
	
	bool ShouldRun( void ) { return m_bRun; };

	void SetOrderType( int order, bool bRun );
	void SetNPC( CAI_BaseNPC *pNPC );
	void SetAbility( int ability );
	void SetAbilityButton( int ability_button );
	void SetArrivalDirection( QAngle arrivalDirection);
	void SetMoveToGoal( bool move_to_goal );
	void SetTarget( CBaseEntity *pTarget );
	void SetAbilityRange( float min, float max );	// how close do we need to get to this point to do the ability?
	void SetAbilityModelMinMax( Vector min, Vector max );

	int GetAbility( void ) { return m_iAbility;}
	int GetAbilityButton( void ) { return m_iAbilityButton;}

	int  GetOrderType( void );
	QAngle GetArrivalDirection( void ) { return m_vArrivalDirection; }
	bool GetMoveToGoal() { return m_bMoveToGoal; }
	bool GetArrivalDirectionSetted( void ) { return m_bArrivalDirectionSetted; }
	CBaseEntity *GetTarget() { return m_hTarget.Get(); }
	float GetAbilityMinRange() { return m_fAbilityMinRange; }
	float GetAbilityMaxRange() { return m_fAbilityMaxRange; }

	bool HasModelMinMax() { return m_bModelMinMax; }
	Vector GetAbilityModelMin() { return m_vMin; }
	Vector GetAbilityModelMax() { return m_vMax; }

	bool ScheduleMoveOrder( Activity movementActivity ); 

	CAI_Hint *GetHint( void ) { return m_hHint.Get(); }
	HidingSpot *GetHidingSpot() { return m_pHidingSpot; }
	bool HasCover() { return m_hHint.Get() || m_pHidingSpot; }

private:
	void OnThink();
	void MoveOrderNormal( void );
	void OrderDefense( void );

private:
	bool m_bRun;
    int m_iOrderType;
	int m_iAbility;
	int m_iAbilityButton;
	CHandle <CAI_BaseNPC> m_hNPC;

	QAngle m_vArrivalDirection;
	bool m_bArrivalDirectionSetted;
	bool m_bMoveToGoal;
	EHANDLE m_hTarget;
	Relationship_t *m_OldRelation;

	bool  m_bModelMinMax;
	float m_fAbilityMinRange;
	float m_fAbilityMaxRange;

	// in case we have a model
	Vector m_vMin;
	Vector m_vMax;
	
	CHandle <CAI_Hint> m_hHint;
	HidingSpot *m_pHidingSpot;

public:
	CHandle<CRTSPointOrder> m_pNext;		// linked list for queueing orders
};

#endif // CRTSPOINTORDER_H

