Fix VScript not having "self" during precache, props not using death hook, VScript proxies not cleaning up correctly

This commit is contained in:
ALLEN-PC\acj30 2025-01-05 13:04:34 -06:00 committed by Blixibon
parent 66012e7c29
commit b03ffdcac4
3 changed files with 11 additions and 0 deletions

View File

@ -272,6 +272,8 @@ void CScriptMaterialProxy::Release( void )
m_hScriptInstance = NULL; m_hScriptInstance = NULL;
} }
g_ScriptPersistableList.FindAndRemove( this );
delete this; delete this;
} }

View File

@ -1338,6 +1338,12 @@ int CBreakableProp::OnTakeDamage( const CTakeDamageInfo &inputInfo )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CBreakableProp::Event_Killed( const CTakeDamageInfo &info ) void CBreakableProp::Event_Killed( const CTakeDamageInfo &info )
{ {
#ifdef MAPBASE_VSCRIPT
// False = Cheat death
if (ScriptDeathHook( const_cast<CTakeDamageInfo *>(&info) ) == false)
return;
#endif
IPhysicsObject *pPhysics = VPhysicsGetObject(); IPhysicsObject *pPhysics = VPhysicsGetObject();
if ( pPhysics && !pPhysics->IsMoveable() ) if ( pPhysics && !pPhysics->IsMoveable() )
{ {

View File

@ -624,6 +624,9 @@ public:
if ( g_pScriptVM->GetValue( STRING(pEnt->m_iszScriptId), &variant ) && variant.m_type == FIELD_HSCRIPT ) if ( g_pScriptVM->GetValue( STRING(pEnt->m_iszScriptId), &variant ) && variant.m_type == FIELD_HSCRIPT )
{ {
pEnt->m_ScriptScope.Init( variant.m_hScript, false ); pEnt->m_ScriptScope.Init( variant.m_hScript, false );
#ifdef MAPBASE_VSCRIPT
g_pScriptVM->SetValue( pEnt->m_ScriptScope, "self", pEnt->m_hScriptInstance );
#endif
#ifndef CLIENT_DLL #ifndef CLIENT_DLL
pEnt->RunPrecacheScripts(); pEnt->RunPrecacheScripts();
#endif #endif