Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

69 lines
1.7 KiB

//========= 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