//////////////////////////////////////////////////////////////////////////////
//
// AVP_ServerNode_GS2Node.h
//
// Copyright (C) 2008 Rebellion. All Rights Reserved.
//
//////////////////////////////////////////////////////////////////////////////

// B E G I N   F I L E   W R A P P E R ///////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif

#ifndef __AVP_SERVERNODE_GS2NODE_H__
#define __AVP_SERVERNODE_GS2NODE_H__ 1

// E N D   F I L E   W R A P P E R ///////////////////////////////////////////

// I N C L U D E S ///////////////////////////////////////////////////////////

// asura
#include "Entity/Locations/OrientedNode/GamesceneNode/Asura_ServerNode_GS2Node.h"

// F O R W A R D   D E C L A R A T I O N S ///////////////////////////////////

class Asura_Chunk_Stream;
template< typename T > class Asura_Hashed_List;

//////////////////////////////////////////////////////////////////////////////
//
// 
//
//////////////////////////////////////////////////////////////////////////////

enum AxonAVP_GS2_StructureType
{
	AVP_GS_ST_ALIEN_VENT = AXON_GS_ST_FIRST_PROJECT_SPECIFIC,
	AVP_GS_ST_PREDATOR_JUMP,
	AVP_GS_ST_REQUIRED_MARINE_ACTION,
	AVP_GS_ST_OPTIONAL_MARINE_ACTION,
	AVP_GS_ST_CIVILIAN_ACTION,
	AVP_GS_ST_HUMANOID_FLEE_ACTION,
	AVP_GS_ST_MOTION_TRACKER_BLIP,
};

//////////////////////////////////////////////////////////////////////////////
//
// AVP_ServerNode_GS2Node
//
//////////////////////////////////////////////////////////////////////////////

class AVP_ServerNode_GS2Node : public virtual Asura_ServerNode_GS2Node
{
	typedef Asura_ServerNode_GS2Node PARENT_ASURA;

	friend class ToolsAVP_Mode_Waypointing;
	friend class ToolsAVP_Node_GS2Node;
	friend class ToolsAVP_Node_GS2Attractor;

public:
	AVP_ServerNode_GS2Node( Asura_Guid uGuid );
	virtual ~AVP_ServerNode_GS2Node();

	virtual void ReadFromChunkStream( Asura_Chunk_Stream& xStream );
	virtual void WriteToChunkStream( Asura_Chunk_Stream& xStream ) const;
	virtual bool IsBaseOrDerivativeOf( u_short usClassification ) const;
	virtual bool HandleMessage( const Asura_Message* pxMessage );

	u_short GetWaypointID() const { return m_usWaypointID; }

#ifdef ASURA_TOOLS
	virtual bool CanBeIncludedInTemplate() const;

	void SetWaypointID( const u_short usWPID ) { m_usWaypointID = usWPID; }
	bool ShouldIntegrateWithNavData() const { return m_bIntegrateWithNavData; }
#endif

	bool ShouldExitGamesceneOnKnowledge() const { return m_bLeaveGamesceneOnKnowledge;}

	static void Create( const Asura_Guid uGuid, Asura_Chunk_Stream& xStream );

	static AVP_ServerNode_GS2Node* FindEntity( const Asura_Guid uGuid ) { return s_xList.FindEntity( uGuid ); }
	static Asura_Hashed_List< AVP_ServerNode_GS2Node >* GetList() { return &s_xList; }

private:
	// The waypoint ID corresponding to this node, if it is set to integrate with the nav data.
	u_short m_usWaypointID;

#ifdef ASURA_TOOLS
	bool m_bIntegrateWithNavData;

	// This is not saved out or loaded in but exists to help the tools to move over the gamescene structures and add them
	// to the nav data, if necessary.
	u_int m_uTraverseHelper;
#endif

	bool m_bLeaveGamesceneOnKnowledge;

	static const u_int uCURRENT_CHUNK_VERSION = 3;
	static Asura_Hashed_List< AVP_ServerNode_GS2Node > s_xList;
};

//////////////////////////////////////////////////////////////////////////////
//
// 
//
//////////////////////////////////////////////////////////////////////////////

#endif //__AVP_SERVERNODE_GS2NODE_H__
