blob: 4d78b274fd2ce284ead142ed857607231ef42b41 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Human's power pack
//
// $NoKeywords: $
//=============================================================================//
#ifndef TF_OBJ_POWERPACK_H
#define TF_OBJ_POWERPACK_H
#ifdef _WIN32
#pragma once
#endif
#include "tf_obj.h"
// ------------------------------------------------------------------------ //
// Pack defines
#define POWERPACK_MINS Vector(-20, -20, 0)
#define POWERPACK_MAXS Vector( 20, 20, 80)
#define POWERPACK_RANGE (600 * 600)
// ------------------------------------------------------------------------ //
// Resupply object that's built by the player
// ------------------------------------------------------------------------ //
class CObjectPowerPack : public CBaseObject
{
DECLARE_CLASS( CObjectPowerPack, CBaseObject );
public:
DECLARE_SERVERCLASS();
CObjectPowerPack();
static CObjectPowerPack *Create(const Vector &vOrigin, const QAngle &vAngles);
virtual void Spawn();
virtual void FinishedBuilding( void );
virtual void Precache();
virtual bool CanTakeEMPDamage( void ) { return true; }
virtual void DestroyObject( void );
virtual bool CalculatePlacement( CBaseTFPlayer *pPlayer );
// This is called by the base object when it's time to spawn the control panels
virtual void GetControlPanelInfo( int nPanelIndex, const char *&pPanelName );
// Find nearby objects and provide them with power
void PowerNearbyObjects( CBaseObject *pObjectToTarget = NULL, bool bPlacing = false );
void UnPowerAllObjects( void );
void UnPowerObject( CBaseObject *pObject );
void EnsureObjectPower( CBaseObject *pObject );
// Powerpack switches models after assembly
virtual void OnActivityChanged( Activity act );
private:
void PowerObject( CBaseObject *pObject, bool bPlacing = false );
bool IsWithinPowerRange( CBaseObject *pObject );
// Objects powered from this pack
typedef CHandle<CBaseObject> ObjectHandle;
CUtlVector< ObjectHandle > m_hPoweredObjects;
int m_iFreeAttachments;
CNetworkVar( int, m_iObjectsAttached );
};
#endif // TF_OBJ_POWERPACK_H
|