mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-30 22:19:19 +00:00
upload "kind" alien swarm
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Teleports a named entity to a given position and restores
|
||||
// it's physics state
|
||||
@@ -24,9 +24,17 @@ public:
|
||||
void Activate( void );
|
||||
|
||||
void InputTeleport( inputdata_t &inputdata );
|
||||
void InputTeleportEntity( inputdata_t &inputdata );
|
||||
void InputTeleportToCurrentPos( inputdata_t &inputdata );
|
||||
|
||||
int ObjectCaps( void )
|
||||
{
|
||||
return (BaseClass::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void DoTeleport( inputdata_t &inputdata, const Vector &vecOrigin, const QAngle &angRotation, bool bOverrideTarget = false );
|
||||
bool EntityMayTeleport( CBaseEntity *pTarget );
|
||||
|
||||
Vector m_vSaveOrigin;
|
||||
@@ -45,14 +53,14 @@ BEGIN_DATADESC( CPointTeleport )
|
||||
DEFINE_FIELD( m_vSaveAngles, FIELD_VECTOR ),
|
||||
|
||||
DEFINE_INPUTFUNC( FIELD_VOID, "Teleport", InputTeleport ),
|
||||
DEFINE_INPUTFUNC( FIELD_STRING, "TeleportEntity", InputTeleportEntity ),
|
||||
DEFINE_INPUTFUNC( FIELD_VOID, "TeleportToCurrentPos", InputTeleportToCurrentPos ),
|
||||
|
||||
END_DATADESC()
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : *pTarget -
|
||||
// Output : Returns true if the entity may be teleported
|
||||
// Returns true if the entity may be teleported
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CPointTeleport::EntityMayTeleport( CBaseEntity *pTarget )
|
||||
{
|
||||
@@ -67,8 +75,8 @@ bool CPointTeleport::EntityMayTeleport( CBaseEntity *pTarget )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//------------------------------------------------------------------------------
|
||||
void CPointTeleport::Activate( void )
|
||||
{
|
||||
@@ -107,13 +115,57 @@ void CPointTeleport::Activate( void )
|
||||
BaseClass::Activate();
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//------------------------------------------------------------------------------
|
||||
void CPointTeleport::InputTeleport( inputdata_t &inputdata )
|
||||
{
|
||||
DoTeleport( inputdata, m_vSaveOrigin, m_vSaveAngles );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Purpose: Teleport the specified entity instead of the Teleporter's pre
|
||||
// determined entity.
|
||||
//------------------------------------------------------------------------------
|
||||
void CPointTeleport::InputTeleportEntity( inputdata_t &inputdata )
|
||||
{
|
||||
DoTeleport( inputdata, m_vSaveOrigin, m_vSaveAngles, true );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Teleport the target to wherever the point_teleport entity is currently. The Teleport
|
||||
// input teleports to the initial position of the point_teleport, so this input
|
||||
// was added to avoid breaking old content.
|
||||
//------------------------------------------------------------------------------
|
||||
void CPointTeleport::InputTeleportToCurrentPos( inputdata_t &inputdata )
|
||||
{
|
||||
if ( m_spawnflags & SF_TELEPORT_TO_SPAWN_POS )
|
||||
{
|
||||
// This is a nonsensical spawnflag in combination with this input.
|
||||
Warning( "%s: TeleportToCurrentPos input received; ignoring 'Teleport Home' spawnflag.\n", GetDebugName() );
|
||||
}
|
||||
|
||||
DoTeleport( inputdata, GetAbsOrigin(), GetAbsAngles() );
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
void CPointTeleport::DoTeleport( inputdata_t &inputdata, const Vector &vecOrigin, const QAngle &angRotation, bool bOverrideTarget )
|
||||
{
|
||||
// Attempt to find the entity in question
|
||||
CBaseEntity *pTarget = gEntList.FindEntityByName( NULL, m_target, this, inputdata.pActivator, inputdata.pCaller );
|
||||
CBaseEntity *pTarget;
|
||||
if( bOverrideTarget )
|
||||
{
|
||||
// Use the inputdata to find the entity that the designer supplied in the parameter override
|
||||
pTarget = gEntList.FindEntityByName( NULL, inputdata.value.String(), this, inputdata.pActivator, inputdata.pCaller );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Default behavior: Just find the entity that I am hardwired in Hammer to teleport.
|
||||
pTarget = gEntList.FindEntityByName( NULL, m_target, this, inputdata.pActivator, inputdata.pCaller );
|
||||
}
|
||||
|
||||
if ( pTarget == NULL )
|
||||
return;
|
||||
|
||||
@@ -135,13 +187,13 @@ void CPointTeleport::InputTeleport( inputdata_t &inputdata )
|
||||
pPlayer->AddFlag( FL_DUCKING );
|
||||
pPlayer->m_Local.m_bDucked = true;
|
||||
pPlayer->m_Local.m_bDucking = true;
|
||||
pPlayer->m_Local.m_flDucktime = 0.0f;
|
||||
pPlayer->SetViewOffset( VEC_DUCK_VIEW_SCALED( pPlayer ) );
|
||||
pPlayer->m_Local.m_nDuckTimeMsecs = 0;
|
||||
pPlayer->SetViewOffset( VEC_DUCK_VIEW );
|
||||
pPlayer->SetCollisionBounds( VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
pTarget->Teleport( &m_vSaveOrigin, &m_vSaveAngles, NULL );
|
||||
pTarget->Teleport( &vecOrigin, &angRotation, NULL );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user