dlls/baseentity.cpp
606162636465
#include "ModelSoundsCache.h"
#include "env_debughistory.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
6061626364656667
#include "ModelSoundsCache.h"
#include "env_debughistory.h"
#include "ff_luacontext.h" // FF
#include "ff_scriptman.h" // FF
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
239240241242243244
SendPropEHandle (SENDINFO(m_hEffectEntity)),
SendPropEHandle (SENDINFO_NAME(m_hMoveParent, moveparent)),
SendPropInt (SENDINFO(m_iParentAttachment), NUM_PARENTATTACHMENT_BITS, SPROP_UNSIGNED),
SendPropInt (SENDINFO_NAME( m_MoveType, movetype ), MOVETYPE_MAX_BITS, SPROP_UNSIGNED ),
SendPropInt (SENDINFO_NAME( m_MoveCollide, movecollide ), MOVECOLLIDE_MAX_BITS, SPROP_UNSIGNED ),
241242243244245246247
SendPropEHandle (SENDINFO(m_hEffectEntity)),
SendPropEHandle (SENDINFO_NAME(m_hMoveParent, moveparent)),
SendPropInt (SENDINFO(m_iParentAttachment), NUM_PARENTATTACHMENT_BITS, SPROP_UNSIGNED),
SendPropInt (SENDINFO(m_takedamage), 3, SPROP_UNSIGNED),
SendPropInt (SENDINFO_NAME( m_MoveType, movetype ), MOVETYPE_MAX_BITS, SPROP_UNSIGNED ),
SendPropInt (SENDINFO_NAME( m_MoveCollide, movecollide ), MOVECOLLIDE_MAX_BITS, SPROP_UNSIGNED ),
1202120312041205120612071208
return;
}
if( !g_pGameRules->AllowDamage(this, inputInfo) )
{
return;
}
1205120612071208120912101211
return;
}
if( g_pGameRules && !g_pGameRules->AllowDamage(this, inputInfo) )
{
return;
}
12151216121712181219122012211222122312241225122612271228
{
CTakeDamageInfo info = inputInfo;
// Scale the damage by the attacker's modifier.
if ( info.GetAttacker() )
{
info.ScaleDamage( info.GetAttacker()->GetAttackDamageScale( this ) );
}
// Scale the damage by my own modifiers
info.ScaleDamage( GetReceivedDamageScale( info.GetAttacker() ) );
//Msg("%s took %.2f Damage, at %.2f\n", GetClassname(), info.GetDamage(), gpGlobals->curtime );
1218121912201221122212231224122512261227122812291230123112321233
{
CTakeDamageInfo info = inputInfo;
// --> Mirv: No scaling
// Scale the damage by the attacker's modifier.
//if ( info.GetAttacker() )
//{
//info.ScaleDamage( info.GetAttacker()->GetAttackDamageScale( this ) );
//}
// Scale the damage by my own modifiers
//info.ScaleDamage( GetReceivedDamageScale( info.GetAttacker() ) );
// <-- Mirv: No scaling
//Msg("%s took %.2f Damage, at %.2f\n", GetClassname(), info.GetDamage(), gpGlobals->curtime );
224222432244224522462247
void CBaseEntity::PhysicsTouchTriggers( const Vector *pPrevAbsOrigin )
{
edict_t *pEdict = edict();
if ( pEdict && !IsWorld() )
{
22472248224922502251225222532254
void CBaseEntity::PhysicsTouchTriggers( const Vector *pPrevAbsOrigin )
{
CollisionProp()->SetSurroundingBoundsType(USE_OBB_COLLISION_BOUNDS); // |-- Mirv: Use correct bbox for physics
edict_t *pEdict = edict();
if ( pEdict && !IsWorld() )
{
227022712272227322742275
engine->TriggerMoved( pEdict );
}
}
}
void CBaseEntity::VPhysicsShadowCollision( int index, gamevcollisionevent_t *pEvent )
227722782279228022812282228322842285228622872288228922902291229222932294229522962297
engine->TriggerMoved( pEdict );
}
}
//Vector(-16, -16, -18 ), // m_vDuckHullMin
//Vector( 16, 16, 18 ), // m_vDuckHullMax
//Vector( 0, 0, 12 ), // m_vDuckView
// --> Mirv: Fix for player going out of bbox when crouching
// If ducked then inflate to roughly twice crouching bbox
if (GetFlags() & FL_DUCKING)
{
Vector absMin = Vector(-32, -32, -18);
Vector absMax = Vector(32, 32, 36);
CollisionProp()->SetSurroundingBoundsType(USE_SPECIFIED_BOUNDS, &absMin, &absMax);
}
// <-- Mirv
}
void CBaseEntity::VPhysicsShadowCollision( int index, gamevcollisionevent_t *pEvent )
251225132514251525162517251825192520252125222523
ConVar ai_debug_los("ai_debug_los", "0", FCVAR_CHEAT, "NPC Line-Of-Sight debug mode. If 1, solid entities that block NPC LOC will be highlighted with white bounding boxes. If 2, it'll show non-solid entities that would do it if they were solid.", CC_AI_LOS_Debug );
Class_T CBaseEntity::Classify ( void )
{
return CLASS_NONE;
}
//-----------------------------------------------------------------------------
// Changes the shadow cast distance over time
//-----------------------------------------------------------------------------
253425352536253725382539
ConVar ai_debug_los("ai_debug_los", "0", FCVAR_CHEAT, "NPC Line-Of-Sight debug mode. If 1, solid entities that block NPC LOC will be highlighted with white bounding boxes. If 2, it'll show non-solid entities that would do it if they were solid.", CC_AI_LOS_Debug );
//-----------------------------------------------------------------------------
// Changes the shadow cast distance over time
//-----------------------------------------------------------------------------
307630773078307930803081
int CBaseEntity::UpdateTransmitState()
{
// If you get this assert, you should be calling DispatchUpdateTransmitState
// instead of UpdateTransmitState.
Assert( g_nInsideDispatchUpdateTransmitState > 0 );
309230933094309530963097309830993100310131023103
int CBaseEntity::UpdateTransmitState()
{
// --> FF
// always transmit if you're an objective
if ( m_ObjectivePlayerRefs.Count() > 0 )
return SetTransmitState( FL_EDICT_ALWAYS );
// <-- FF
// If you get this assert, you should be calling DispatchUpdateTransmitState
// instead of UpdateTransmitState.
Assert( g_nInsideDispatchUpdateTransmitState > 0 );
342534263427342834293430
//-----------------------------------------------------------------------------
bool CBaseEntity::AcceptInput( const char *szInputName, CBaseEntity *pActivator, CBaseEntity *pCaller, variant_t Value, int outputID )
{
if ( ent_messages_draw.GetBool() )
{
if ( pCaller != NULL )
34473448344934503451345234533454345534563457345834593460346134623463
//-----------------------------------------------------------------------------
bool CBaseEntity::AcceptInput( const char *szInputName, CBaseEntity *pActivator, CBaseEntity *pCaller, variant_t Value, int outputID )
{
// pass the event to script
CFFLuaSC hInput;
if(pActivator) // just in case
hInput.Push(pActivator);
if(pCaller) // just in case
hInput.Push(pCaller);
char buf[ 512 ];
Q_strncpy( buf, szInputName, sizeof( buf ) );
Q_strlower( buf );
_scriptman.RunPredicates_LUA(this, &hInput, buf);
if ( ent_messages_draw.GetBool() )
{
if ( pCaller != NULL )
349734983499350035013502
data.nOutputID = outputID;
(this->*pfnInput)( data );
}
else if ( dmap->dataDesc[i].flags & FTYPEDESC_KEY )
{
353035313532353335343535353635373538353935403541
data.nOutputID = outputID;
(this->*pfnInput)( data );
//// pass the event to script
//CFFLuaSC sc;
//sc.Push(pActivator);
//sc.Push(pCaller);
//sc.CallFunction(this, szInputName);
}
else if ( dmap->dataDesc[i].flags & FTYPEDESC_KEY )
{
351635173518351935203521
return true;
}
}
}
}
35553556355735583559356035613562356335643565356635673568
return true;
}
}
else if ( dmap->dataDesc[i].flags & FTYPEDESC_OUTPUT )
{
// pass the event to script
/*CFFLuaSC sc;
sc.Push(pActivator);
sc.Push(pCaller);
sc.CallFunction(this, szInputName);*/
}
}
}
385338543855385638573858
UTIL_SetModel( this, szModelName );
}
//-----------------------------------------------------------------------------
// Purpose: Called once per frame after the server frame loop has finished and after all messages being
39003901390239033904390539063907390839093910
UTIL_SetModel( this, szModelName );
}
void CBaseEntity::SetModel( const char *szModelName, int iSkin)
{
SetModel(szModelName);
SetSkin(iSkin);
}
//-----------------------------------------------------------------------------
// Purpose: Called once per frame after the server frame loop has finished and after all messages being
617561766177617861796180
return GetLocalAngles();
}
//-----------------------------------------------------------------------------
// Purpose: For each client who appears to be a valid recipient, checks the client has disabled CC and if so, removes them from
// the recipient list.
62276228622962306231623262336234623562366237623862396240
return GetLocalAngles();
}
Vector CBaseEntity::GetAbsFacing() const
{
QAngle angles = GetAbsAngles();
Vector fwd;
AngleVectors(angles, &fwd);
return fwd;
}
//-----------------------------------------------------------------------------
// Purpose: For each client who appears to be a valid recipient, checks the client has disabled CC and if so, removes them from
// the recipient list.
628562866287628862896290
return BaseClass::KeyValue( szKeyName, szValue );
}
//-----------------------------------------------------------------------------
// Purpose: Sets the entity invisible, and makes it remove itself on the next frame
63456346634763486349635063516352635363546355
return BaseClass::KeyValue( szKeyName, szValue );
}
void CBaseEntity::PlaySound(const char *soundname)
{
CPASAttenuationFilter sndFilter(this);
EmitSound(sndFilter, entindex(), soundname);
}
//-----------------------------------------------------------------------------
// Purpose: Sets the entity invisible, and makes it remove itself on the next frame