Skip to content

Commit 14d3ee1

Browse files
committed
Fixed the client-side VScript "player" instance not being set once more after having moved around the VM init code again
1 parent fa45fff commit 14d3ee1

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

sp/src/game/client/c_baseplayer.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,14 @@ void C_BasePlayer::PostDataUpdate( DataUpdateType_t updateType )
855855
// changed level, which would cause the snd_soundmixer to be left modified.
856856
ConVar *pVar = (ConVar *)cvar->FindVar( "snd_soundmixer" );
857857
pVar->Revert();
858+
859+
#ifdef MAPBASE_VSCRIPT
860+
// Moved here from LevelInitPostEntity, which is executed before local player is spawned.
861+
if ( g_pScriptVM )
862+
{
863+
g_pScriptVM->SetValue( "player", GetScriptInstance() );
864+
}
865+
#endif
858866
}
859867
}
860868

sp/src/game/client/vscript_client.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -576,13 +576,6 @@ bool VScriptClientInit()
576576
if( g_pScriptVM )
577577
{
578578
#ifdef MAPBASE_VSCRIPT
579-
// Moved here from LevelInitPostEntity, which is executed before local player is spawned.
580-
// This is executed after C_World::OnDataChanged, which is after C_BasePlayer::Spawn
581-
if ( C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer() )
582-
{
583-
g_pScriptVM->SetValue( "player", pPlayer->GetScriptInstance() );
584-
}
585-
586579
CGMsg( 0, CON_GROUP_VSCRIPT, "VSCRIPT CLIENT: Started VScript virtual machine using script language '%s'\n", g_pScriptVM->GetLanguageName() );
587580
#else
588581
Log( "VSCRIPT: Started VScript virtual machine using script language '%s'\n", g_pScriptVM->GetLanguageName() );

0 commit comments

Comments
 (0)