aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/lobby/_lobby.gnut
blob: ae933b7139647d1712dab4b0e05350ba68c466bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
untyped
global function Lobby_Init
global function Lobby_OnClientConnectionStarted
global function Lobby_OnClientConnectionCompleted

void function Lobby_Init()
{
	// need to prevent a crash
	Music_Init()
	
	if ( IsPrivateMatch() || GetCurrentPlaylistName() == "private_match" ) // IsPrivateMatch() doesn't seem to be reliable on local server start
		PrivateLobby_Init()
	else
	{
		// non-private lobby clientcommands
		AddClientCommandCallback( "StartPrivateMatchSearch", ClientCommandCallback_StartPrivateMatchSearch )
	}
}

void function Lobby_OnClientConnectionStarted( entity player )
{
	if ( !( IsPrivateMatch() || GetCurrentPlaylistName() == "private_match" ) || !GetConVarBool( "ns_allow_spectators" ) )
		player.SetPersistentVar( "privateMatchState", 0 ) // disable spectator
}

void function Lobby_OnClientConnectionCompleted( entity player )
{
	player.hasConnected = true
	FinishClientScriptInitialization( player )
}

bool function ClientCommandCallback_StartPrivateMatchSearch( entity player, array<string> args )
{
	// open lobby in private match mode
	SetCurrentPlaylist( "private_match" ) // required for private match lobby to start properly
	GameRules_ChangeMap( "mp_lobby", GAMETYPE )
	
	return true
}