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
65
66
67
68
69
70
71
72
73
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "tfc_player.h"
#include "tfc_building.h"
//=========================================================================
// Destroys a single Engineer building
void DestroyBuilding(CTFCPlayer *eng, char *bld)
{
CBaseEntity *pEnt = gEntList.FindEntityByClassname( NULL, bld );
while ( pEnt )
{
CTFBaseBuilding *pBuilding = dynamic_cast<CTFBaseBuilding*>( pEnt );
if (pBuilding && pBuilding->real_owner == eng)
{
// If it's fallen out of the world, give the engineer
// some metal back
int pos = UTIL_PointContents(pEnt->GetAbsOrigin());
#ifdef TFCTODO // CONTENTS_SKY doesn't exist in the new engine
if (pos == CONTENT_SOLID || pos == CONTENT_SKY)
#else
if (pos == CONTENTS_SOLID)
#endif
{
eng->GiveAmmo( 100, TFC_AMMO_CELLS );
eng->TeamFortress_CheckClassStats();
}
pEnt->TakeDamage( CTakeDamageInfo( pEnt, pEnt, 500, 0 ) );
}
pEnt = gEntList.FindEntityByClassname( pEnt, bld );
}
}
//=========================================================================
// Destroys a teleporter (determined by type)
void DestroyTeleporter(CTFCPlayer *eng, int type)
{
CBaseEntity *pEnt = gEntList.FindEntityByClassname( NULL, "building_teleporter" );
while ( pEnt )
{
CTFTeleporter *pTeleporter = dynamic_cast<CTFTeleporter*>( pEnt );
if (pTeleporter && pTeleporter->real_owner == eng && pTeleporter->m_iType == type )
{
// If it's fallen out of the world, give the engineer
// some metal back
int pos = UTIL_PointContents(pEnt->GetAbsOrigin());
#ifdef TFCTODO // CONTENTS_SKY doesn't exist in the new engine
if (pos == CONTENT_SOLID || pos == CONTENT_SKY)
#else
if (pos == CONTENTS_SOLID)
#endif
{
eng->GiveAmmo( 100, TFC_AMMO_CELLS );
eng->TeamFortress_CheckClassStats();
}
pEnt->TakeDamage( CTakeDamageInfo( pEnt, pEnt, 500, 0 ) );
}
pEnt = gEntList.FindEntityByClassname( pEnt, "building_teleporter" );
}
}
|