
/* ***** BEGIN LICENSE BLOCK *****
Version: MPL 1.1/LGPL 2.1/GPL 2.0

The contents of this file are subject to the Mozilla Public License Version 
1.1 (the "License"); you may not use this file except in compliance with
...
for the specific language governing rights and limitations under the
License.

The Original Code is for Luminous Forts.

The Initial Developer of the Original Code is Hekar Khani.
Portions created by the Hekar Khani are Copyright (C) 2010
Hekar Khani. All Rights Reserved.

Contributor(s):
  Hekar Khani <hekark@gmail.com>

Alternatively, the contents of this file may be used under the terms of
either of the GNU General Public License Version 2 or later (the "GPL"),
...
the terms of any one of the MPL, the GPL or the LGPL.

***** END LICENSE BLOCK ***** */

#ifndef DOM_CAPTUREZONE_H
#define DOM_CAPTUREZONE_H

enum CaptureTimerState_t
{
	CAP_NONE = 0,
	CAP_DRAIN_RED,
	CAP_DRAIN_BLUE,
	// Currently capturing the point
	CAP_CAPTURE_RED,
	CAP_CAPTURE_BLUE,
	CAP_STALLED_RED,
	CAP_STALLED_BLUE,
	CAP_OWNED_RED,
	CAP_OWNED_BLUE
};


class CDomCaptureZone : public CBaseEntity
{
	DECLARE_CLASS( CDomCaptureZone, CBaseEntity )
	DECLARE_DATADESC()
	DECLARE_SERVERCLASS()
public:
	CDomCaptureZone();
	~CDomCaptureZone();

	virtual void Spawn();

	virtual void OnPhase( int phase );

	virtual void StartTouch( CBaseEntity *pOther );
	virtual void EndTouch( CBaseEntity *pOther );

	virtual void Think();
	virtual void CaptureThink();

protected:
	virtual void InputEnableCaptures( inputdata_t& inputdata );
	virtual void InputDisableCaptures( inputdata_t& inputdata );
	virtual void OnBuild();
	virtual void OnCombat();

private:
	int m_iSecondsToCapture;
	bool m_bDisableInBuild;
	int m_ParentZone1;
	int m_ParentZone2;
	int m_ParentZone3;
#ifndef CLIENT_DLL
	// On capture of the point
	COutputEvent m_Capture;

	// On capture of the point (Includes team)
	COutputInt m_CapturedBy;

	// On team losing the point
	COutputInt m_Lost;
#endif

	bool m_bDisabled;
	bool m_bDisableCaptures;
	CUtlVector< CBasePlayer * > *m_TouchingPlayers;
	CountdownTimer m_CaptureTimer;

	CNetworkVar( int, m_CapState );
	
	// Number of players capturing the point
	CNetworkVar( int, m_iCapturePercentage );
	CNetworkVar( int, m_iCapturingCount );
	CNetworkVar( int, m_iCapturingTeam );
};

#endif // DOM_CAPTUREZONE_H