Fixed activator, caller, etc. values not working within RunScriptCode and related inputs

This commit is contained in:
Blixibon 2022-03-09 14:14:12 -06:00
parent bb2478f342
commit e4d5d946d2
2 changed files with 16 additions and 2 deletions

View File

@ -4674,6 +4674,11 @@ bool CBaseEntity::AcceptInput( const char *szInputName, CBaseEntity *pActivator,
{
(this->*pfnInput)( data );
}
if ( m_ScriptScope.IsInitialized() )
{
ScriptInputHookClearParams();
}
}
else if ( dmap->dataDesc[i].flags & FTYPEDESC_KEY )
{
@ -4707,6 +4712,8 @@ bool CBaseEntity::AcceptInput( const char *szInputName, CBaseEntity *pActivator,
if (functionReturn.m_bool)
return true;
}
ScriptInputHookClearParams();
}
#endif
@ -4750,13 +4757,19 @@ bool CBaseEntity::ScriptInputHook( const char *szInputName, CBaseEntity *pActiva
bHandled = true;
}
return bHandled;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseEntity::ScriptInputHookClearParams()
{
g_pScriptVM->ClearValue( "activator" );
g_pScriptVM->ClearValue( "caller" );
#ifdef MAPBASE_VSCRIPT
g_pScriptVM->ClearValue( "parameter" );
#endif
return bHandled;
}
#ifdef MAPBASE_VSCRIPT

View File

@ -693,6 +693,7 @@ public:
#endif
bool ScriptInputHook( const char *szInputName, CBaseEntity *pActivator, CBaseEntity *pCaller, variant_t Value, ScriptVariant_t &functionReturn );
void ScriptInputHookClearParams();
#ifdef MAPBASE_VSCRIPT
bool ScriptDeathHook( CTakeDamageInfo *info );
#endif