summaryrefslogtreecommitdiff
path: root/game/server/func_ladder_endpoint.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/func_ladder_endpoint.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/server/func_ladder_endpoint.cpp')
-rw-r--r--game/server/func_ladder_endpoint.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/game/server/func_ladder_endpoint.cpp b/game/server/func_ladder_endpoint.cpp
new file mode 100644
index 0000000..73d29c5
--- /dev/null
+++ b/game/server/func_ladder_endpoint.cpp
@@ -0,0 +1,68 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================//
+#include "cbase.h"
+#include "func_ladder.h"
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"
+
+//-----------------------------------------------------------------------------
+// Purpose: A transient entity used to construct a true CFuncLadder
+// FIXME: THIS ENTITY IS OBSOLETE NOW, SHOULD BE REMOVED FROM HERE AND .FGD AT SOME POINT!!!
+//-----------------------------------------------------------------------------
+class CFuncLadderEndPoint : public CBaseEntity
+{
+public:
+ DECLARE_CLASS( CFuncLadderEndPoint, CBaseEntity );
+
+ virtual void Activate();
+
+private:
+ bool Validate();
+};
+
+LINK_ENTITY_TO_CLASS( func_ladderendpoint, CFuncLadderEndPoint );
+
+void CFuncLadderEndPoint::Activate()
+{
+ BaseClass::Activate();
+
+ if ( IsMarkedForDeletion() )
+ return;
+
+ Validate();
+}
+
+bool CFuncLadderEndPoint::Validate()
+{
+ // Find the the other end
+ Vector startPos = GetAbsOrigin();
+
+ CFuncLadderEndPoint *other = dynamic_cast< CFuncLadderEndPoint * >( GetNextTarget() );
+ if ( !other )
+ {
+ DevMsg( 1, "func_ladderendpoint(%s) without matching target\n", GetEntityName().ToCStr() );
+ return false;
+ }
+
+ Vector endPos = other->GetAbsOrigin();
+
+ CFuncLadder *ladder = ( CFuncLadder * )CreateEntityByName( "func_useableladder" );
+ if ( ladder )
+ {
+ ladder->SetEndPoints( startPos, endPos );
+ ladder->SetAbsOrigin( GetAbsOrigin() );
+ ladder->SetParent( GetParent() );
+ ladder->SetName( GetEntityName() );
+ ladder->Spawn();
+ }
+
+ // Delete both endpoints
+ UTIL_Remove( other );
+ UTIL_Remove( this );
+
+ return true;
+}