diff options
Diffstat (limited to 'game/server/tf/tf_entity_spawner.h')
| -rw-r--r-- | game/server/tf/tf_entity_spawner.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/game/server/tf/tf_entity_spawner.h b/game/server/tf/tf_entity_spawner.h new file mode 100644 index 0000000..7e0b35a --- /dev/null +++ b/game/server/tf/tf_entity_spawner.h @@ -0,0 +1,69 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// TF Entity Spawner +// +//============================================================================= +#ifndef TF_ENTITY_SPAWNER_H +#define TF_ENTITY_SPAWNER_H +#ifdef _WIN32 +#pragma once +#endif + +class CEntitySpawnPoint; +class CEntitySpawnManager; + +class CEntitySpawnPoint : public CServerOnlyPointEntity, public IEntityListener +{ +public: + DECLARE_CLASS( CEntitySpawnPoint, CServerOnlyPointEntity ); + DECLARE_DATADESC(); + + CEntitySpawnPoint() {} + + virtual void Spawn( void ); + virtual void UpdateOnRemove( void ); + bool IsUsed( void ) { return (m_hMyEntity.Get() != NULL); } + void SetEntity( CBaseEntity* pEnt ) { m_hMyEntity = pEnt; } + void RespawnNotifyThink( void ); + + virtual void OnEntityDeleted( CBaseEntity* pEntity ); + +private: + string_t m_iszSpawnManagerName; + float m_flNodeFree; + + CHandle< CEntitySpawnManager > m_hSpawnManager; + CHandle< CBaseEntity > m_hMyEntity; +}; + +class CEntitySpawnManager : public CLogicalEntity +{ +public: + DECLARE_CLASS( CEntitySpawnManager, CLogicalEntity ); + DECLARE_DATADESC(); + + CEntitySpawnManager() {} + + virtual void Spawn( void ); + void RegisterSpawnPoint( CEntitySpawnPoint* pNewPoint ); + virtual void Activate( void ); + void SpawnAllEntities( void ); + bool SpawnEntity( void ); + int GetRespawnTime( void ) { return m_iRespawnTime; } + +private: + int GetRandomUnusedIndex( void ); + bool SpawnEntityAt( int iIndex ); + +private: + string_t m_iszEntityName; + int m_iEntityCount; + int m_iRespawnTime; + bool m_bDropToGround; + bool m_bRandomRotation; + + int m_iMaxSpawnedEntities; + CUtlVector< CHandle< CEntitySpawnPoint > > m_SpawnPoints; +}; + +#endif //TF_ENTITY_SPAWNER_H
\ No newline at end of file |