Skip to content

Commit dcf93fb

Browse files
committed
feat(event): add game_start event with exec cfg after loading end
gamestart.cfg and maps_gamestart/*.cfg
1 parent 992d8e4 commit dcf93fb

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/game/client/swarm/clientmode_asw.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ void ClientModeASW::Init()
434434
gameeventmanager->AddListener( this, "mission_failed", false );
435435
gameeventmanager->AddListener( this, "asw_mission_restart", false );
436436
gameeventmanager->AddListener( this, "game_newmap", false );
437+
gameeventmanager->AddListener( this, "game_start", false );
437438
HOOK_MESSAGE( ASWBlur );
438439
HOOK_MESSAGE( ASWCampaignCompleted );
439440
HOOK_MESSAGE( ASWTechFailure );
@@ -826,6 +827,11 @@ void ClientModeASW::FireGameEvent( IGameEvent *event )
826827
// BenLubar: Support configloader config files from that one HUD mod: https://steamcommunity.com/app/630/discussions/0/522728268792383118/
827828
engine->ClientCmd_Unrestricted( VarArgs( "execifexists configloader/maps/%s\n", engine->GetLevelNameShort() ) );
828829
}
830+
else if ( Q_strcmp( "game_start", eventname ) == 0 )
831+
{
832+
engine->ClientCmd("execifexists gamestart\n");
833+
engine->ClientCmd_Unrestricted( VarArgs( "execifexists maps_gamestart/%s\n", engine->GetLevelNameShort() ) );
834+
}
829835

830836
if ( !Q_strcmp( "achievement_earned", eventname ) )
831837
{

src/game/shared/swarm/asw_gamerules.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3121,6 +3121,12 @@ void CAlienSwarm::UpdateLaunching()
31213121
{
31223122
RunScriptFunctionInListenerScopes( "OnGameplayStart", NULL, 0, NULL );
31233123
}
3124+
3125+
IGameEvent *event = gameeventmanager->CreateEvent( "game_start" );
3126+
if ( event )
3127+
{
3128+
gameeventmanager->FireEvent( event );
3129+
}
31243130
}
31253131
else
31263132
{

0 commit comments

Comments
 (0)