source-sdk-2013-mapbase/sp/src/game/server/point_template.h
Blixibon 418a9dcccc Mapbase v4.1
- Exposed CAmmoDef to VScript and changed ammo type functions accordingly
- Added TakeHealth and IsAlive to CBaseEntity
- Added $treeSway
- Added several inputs to control env_wind keyvalues + a new $treeSway scale keyvalue
- Added "Expanded name fixup" keyvalue to point_template which allows name fixup to fix up output parameters
- Fixed the rope on rappelling NPCs causing graphical issues
- Fixed prop_vehicle_prisoner_pod missing "EnterVehicle", "EnterVehicleImmediate", and "ExitVehicle" inputs
- Fixed hostile citizens not damaging player
- Fixed an uncommon npc_metropolice crash from when it's not in a squad
- Made SetTarget input update target handling on NPCs
- Changed ammo type functions to be more organized, added AmmoDef singleton
- Added more precache functions
- Added various misc. entity functions, like GetAllWeapons or AddOutput
- Added more utility functions
2020-06-21 15:10:56 +00:00

96 lines
2.9 KiB
C++

//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Point entity used to create templates out of other entities or groups of entities
//
//=============================================================================//
#ifndef POINT_TEMPLATE_H
#define POINT_TEMPLATE_H
#ifdef _WIN32
#pragma once
#endif
#define MAX_NUM_TEMPLATES 16
struct template_t
{
int iTemplateIndex;
VMatrix matEntityToTemplate;
DECLARE_SIMPLE_DATADESC();
};
void ScriptInstallPreSpawnHook();
bool ScriptPreInstanceSpawn( CScriptScope *pScriptScope, CBaseEntity *pChild, string_t iszKeyValueData );
void ScriptPostSpawn( CScriptScope *pScriptScope, CBaseEntity **ppEntities, int nEntities );
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CPointTemplate : public CLogicalEntity
{
DECLARE_CLASS( CPointTemplate, CLogicalEntity );
public:
DECLARE_DATADESC();
virtual void Spawn( void );
virtual void Precache();
// Template initialization
void StartBuildingTemplates( void );
void FinishBuildingTemplates( void );
// Template Entity accessors
int GetNumTemplateEntities( void );
CBaseEntity *GetTemplateEntity( int iTemplateNumber );
void AddTemplate( CBaseEntity *pEntity, const char *pszMapData, int nLen );
bool ShouldRemoveTemplateEntities( void );
bool AllowNameFixup();
#ifdef MAPBASE
bool NameFixupExpanded() { return m_bFixupExpanded; }
#endif
// Templates accessors
int GetNumTemplates( void );
int GetTemplateIndexForTemplate( int iTemplate );
// Template instancing
bool CreateInstance( const Vector &vecOrigin, const QAngle &vecAngles, CUtlVector<CBaseEntity*> *pEntities );
#ifdef MAPBASE
bool CreateSpecificInstance( int iTemplate, const Vector &vecOrigin, const QAngle &vecAngles, CBaseEntity **pOutEntity );
#endif
void CreationComplete(const CUtlVector<CBaseEntity*>& entities);
// Inputs
void InputForceSpawn( inputdata_t &inputdata );
#ifdef MAPBASE
void InputForceSpawnRandomTemplate( inputdata_t &inputdata );
#endif
virtual void PerformPrecache();
private:
string_t m_iszTemplateEntityNames[MAX_NUM_TEMPLATES];
// List of map entities this template targets. Built inside our Spawn().
// It's only valid between Spawn() & Activate(), because the map entity parsing
// code removes all the entities in it once it finishes turning them into templates.
CUtlVector< CBaseEntity * > m_hTemplateEntities;
#ifdef MAPBASE
// Allows name fixup to target all instances of a name in a keyvalue, including output parameters.
// TODO: Support for multiple fixup modes?
bool m_bFixupExpanded;
#endif
// List of templates, generated from our template entities.
CUtlVector< template_t > m_hTemplates;
COutputEvent m_pOutputOnSpawned;
#ifdef MAPBASE
COutputEHANDLE m_pOutputOutEntity;
#endif
};
#endif // POINT_TEMPLATE_H