//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: The downtrodden citizens of City 17. Timid when unarmed, they will
//			rise up against their Combine oppressors when given a weapon.
//
//=============================================================================//

#ifndef	NPC_REBELS_H
#define	NPC_REBELS_H

#include "npc_citizen17.h"
#include "hl2wars/npc/ai_behavior_placabletank.h"

#define SF_REBEL_ENGINEER ( 1 << 25 )//33554432

//-------------------------------------

class CHLW_NPC_Rebel : public CNPC_Citizen
{
	DECLARE_CLASS( CHLW_NPC_Rebel, CNPC_Citizen );
public:
	CHLW_NPC_Rebel()
	{
		m_vecTossVelocity = vec3_origin;
		m_iHead = -1;
	}

	//---------------------------------
	bool			CreateBehaviors();
	virtual void	SelectModel();
	void			Precache();
	void			Spawn();

	//---------------------------------
	// Behavior
	//---------------------------------
	virtual bool	ShouldFindCover() { return true; }
	void			PrescheduleThink( void );
	int				SelectSchedule();
	//bool			IsCrouchedActivity( Activity activity );

	void 			StartTask( const Task_t *pTask );
	void 			RunTask( const Task_t *pTask );
	
	Activity		NPC_TranslateActivity( Activity eNewActivity );
	void 			HandleAnimEvent( animevent_t *pEvent );

	int				OnTakeDamage_Alive( const CTakeDamageInfo &info );

	bool			IsEngineer() { return HasSpawnFlags(SF_REBEL_ENGINEER); }
	bool			CheckCanThrowGrenade( const Vector &vecTarget );
	bool			AbilityHeal();

	void			OnUpdateShotRegulator();
	Vector			Weapon_ShootPosition( );
	Vector			EyeOffset( Activity nActivity );
	Vector			EyePosition( void );
	virtual Vector  GetCrouchEyeOffset( void );

	// only medics regenerate health slowly
	virtual bool ShouldRegenerateHealthRTS( void ) { return IsMedic(); }

	//---------------------------------
	// Unit info
	//---------------------------------
	void			InitUnitIndex();

	//---------------------------------
	// Hints
	//---------------------------------
	bool			FValidateHintType ( CAI_Hint *pHint );


protected:
	Vector			m_vecTossVelocity;
	float			m_flNextGrenadeCheck;

	float	m_flTimeLastRegenRTS;		// Last time I regenerated a bit of health.

	// behaviors
	CAI_PlacableTankBehavior		m_PlacableTankBehavior;

	//-----------------------------------------------------
	// Conditions, Schedules, Tasks
	//-----------------------------------------------------
	enum
	{	
		SCHED_REBEL_PLACE_TURRET = BaseClass::NEXT_SCHEDULE,
		SCHED_REBEL_PLACE_MINE,
		SCHED_REBEL_PLACE_BUILDING,
		SCHED_REBEL_DROP_GRENADE,
		SCHED_REBEL_FORCED_GRENADE_THROW,
		SCHED_REBEL_MOVE_TO_FORCED_GREN_LOS,
		NEXT_SCHEDULE,
		
		TASK_REBEL_PLACE_BUILDING = BaseClass::NEXT_TASK,
		TASK_REBEL_FACE_TOSS_DIR,
		TASK_REBEL_GET_PATH_TO_FORCED_GREN_LOS,
		TASK_REBEL_THROW_GRENADE,
		NEXT_TASK,
	};

	//-----------------------------------------------------
	
	DECLARE_DATADESC();
	DEFINE_CUSTOM_AI;
};

//-----------------------------------------------------------------------------

#endif	//NPC_REBELS_H
