summaryrefslogtreecommitdiff
path: root/game/server/cstrike/func_buy_zone.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/cstrike/func_buy_zone.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/server/cstrike/func_buy_zone.cpp')
-rw-r--r--game/server/cstrike/func_buy_zone.cpp77
1 files changed, 77 insertions, 0 deletions
diff --git a/game/server/cstrike/func_buy_zone.cpp b/game/server/cstrike/func_buy_zone.cpp
new file mode 100644
index 0000000..a982fe4
--- /dev/null
+++ b/game/server/cstrike/func_buy_zone.cpp
@@ -0,0 +1,77 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================//
+
+#include "cbase.h"
+#include "triggers.h"
+#include "cs_player.h"
+
+
+//======================================
+// Bomb target area
+//
+//
+
+class CBuyZone : public CBaseTrigger
+{
+public:
+ DECLARE_CLASS( CBuyZone, CBaseTrigger );
+ DECLARE_DATADESC();
+
+ CBuyZone();
+ void Spawn();
+ void EXPORT BuyZoneTouch( CBaseEntity* pOther );
+
+public:
+ int m_LegacyTeamNum;
+};
+
+
+LINK_ENTITY_TO_CLASS( func_buyzone, CBuyZone );
+
+BEGIN_DATADESC( CBuyZone )
+ DEFINE_FUNCTION( BuyZoneTouch ),
+
+ // This is here to support maps that haven't updated to using "teamnum" yet.
+ DEFINE_INPUT( m_LegacyTeamNum, FIELD_INTEGER, "team" )
+END_DATADESC()
+
+
+CBuyZone::CBuyZone()
+{
+ m_LegacyTeamNum = -1;
+}
+
+
+void CBuyZone::Spawn()
+{
+ InitTrigger();
+ SetTouch( &CBuyZone::BuyZoneTouch );
+
+ // Support for legacy-style teamnums.
+ if ( m_LegacyTeamNum == 1 )
+ {
+ ChangeTeam( TEAM_TERRORIST );
+ }
+ else if ( m_LegacyTeamNum == 2 )
+ {
+ ChangeTeam( TEAM_CT );
+ }
+}
+
+
+void CBuyZone::BuyZoneTouch( CBaseEntity* pOther )
+{
+ CCSPlayer *p = dynamic_cast< CCSPlayer* >( pOther );
+ if ( p )
+ {
+ // compare player team with buy zone team number
+ if ( p->GetTeamNumber() == GetTeamNumber() )
+ {
+ p->m_bInBuyZone = true;
+ }
+ }
+}
+