diff --git a/src/game/server/baseentity.cpp b/src/game/server/baseentity.cpp index 3462fd3700a..d5824d94d00 100644 --- a/src/game/server/baseentity.cpp +++ b/src/game/server/baseentity.cpp @@ -4430,10 +4430,15 @@ bool CBaseEntity::AcceptInput( const char *szInputName, CBaseEntity *pActivator, g_pScriptVM->SetValue( "activator", ( pActivator ) ? ScriptVariant_t( pActivator->GetScriptInstance() ) : SCRIPT_VARIANT_NULL ); g_pScriptVM->SetValue( "caller", ( pCaller ) ? ScriptVariant_t( pCaller->GetScriptInstance() ) : SCRIPT_VARIANT_NULL ); + g_pScriptVM->SetValue( "input_value", Value.String() ); if( CallScriptFunction( szScriptFunctionName, &functionReturn ) ) { bCallInputFunc = functionReturn; + // Allow reassignment of activator and caller of the input + IScriptVM *pVM = g_pScriptVM; + pVM->IfHas ( m_ScriptScope, "activator", [&](HSCRIPT value) { data.pActivator = ToEnt(value); } ); + pVM->IfHas ( m_ScriptScope, "caller", [&](HSCRIPT value) { data.pCaller = ToEnt(value); } ); } } @@ -4446,6 +4451,7 @@ bool CBaseEntity::AcceptInput( const char *szInputName, CBaseEntity *pActivator, { g_pScriptVM->ClearValue( "activator" ); g_pScriptVM->ClearValue( "caller" ); + g_pScriptVM->ClearValue( "input_value" ); } } else if ( dmap->dataDesc[i].flags & FTYPEDESC_KEY )