summaryrefslogtreecommitdiff
path: root/game/server/tfc/tfc_engineer.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/tfc/tfc_engineer.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/server/tfc/tfc_engineer.cpp')
-rw-r--r--game/server/tfc/tfc_engineer.cpp73
1 files changed, 73 insertions, 0 deletions
diff --git a/game/server/tfc/tfc_engineer.cpp b/game/server/tfc/tfc_engineer.cpp
new file mode 100644
index 0000000..ddbf32d
--- /dev/null
+++ b/game/server/tfc/tfc_engineer.cpp
@@ -0,0 +1,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" );
+ }
+}