mirror of
https://github.com/Dss0/t7-server-config.git
synced 2025-07-01 16:51:49 +00:00
Allow ignoring playlists for the first map.
If sv_skip_lobby dvar is 1 set the lobby map and gametype to what the first gametype and map in the sv_maprotation dvar is set to, and then launch the game. sv_skip_lobby is enabled by default but setting it to 0 enables default behavior.
This commit is contained in:
@ -34,7 +34,20 @@ Lobby.Process.CreateDedicatedModsLobby = function (f8_arg0, f8_arg1)
|
||||
Engine.RunPlaylistRules(f8_arg0)
|
||||
Engine.RunPlaylistSettings(f8_arg0)
|
||||
Lobby.Timer.HostingLobby({controller = f8_arg0, lobbyType = f8_arg1.lobbyType, mainMode = f8_arg1.mainMode, lobbyTimerType = f8_arg1.lobbyTimerType})
|
||||
if Engine.DvarInt( nil, "sv_skip_lobby" ) == 1 then
|
||||
if Engine.DvarInt( nil, "sv_skip_lobby" ) == 1 then
|
||||
-- Engine.ComError( Enum.errorCode.ERROR_SCRIPT, "Using sv_skip_lobby" )
|
||||
local map_rotation_string = Engine.DvarString( nil, "sv_maprotation" )
|
||||
if map_rotation_string ~= "" then
|
||||
local map_rotation_tokens = split_string( map_rotation_string, " " )
|
||||
if map_rotation_tokens[ 1 ] == "gametype" then
|
||||
Engine.Exec(0, "lobby_setgametype " .. map_rotation_tokens[ 2 ] )
|
||||
-- Engine.ComError( Enum.errorCode.ERROR_SCRIPT, "Set gametype to " .. map_rotation_tokens[ 2 ] .. " based on map rotation" )
|
||||
if map_rotation_tokens[ 3 ] == "map" then
|
||||
Engine.Exec(0, "lobby_setmap " .. map_rotation_tokens[ 4 ] )
|
||||
-- Engine.ComError( Enum.errorCode.ERROR_SCRIPT, "Set map to " .. map_rotation_tokens[ 4 ] .. " based on map rotation" )
|
||||
end
|
||||
end
|
||||
end
|
||||
Engine.Exec(0, "launchgame")
|
||||
end
|
||||
end)
|
||||
@ -46,4 +59,13 @@ Lobby.Process.CreateDedicatedModsLobby = function (f8_arg0, f8_arg1)
|
||||
Lobby.Process.AddActions(f8_local6, f8_local7)
|
||||
Lobby.Process.AddActions(f8_local7, nil)
|
||||
return {head = f8_local2, interrupt = Lobby.Interrupt.NONE, force = true, cancellable = true}
|
||||
end
|
||||
end
|
||||
|
||||
function split_string(str, delimiter)
|
||||
local tokens = {}
|
||||
local pattern = string.format("([^%s]+)", delimiter)
|
||||
for token in string.gmatch(str, pattern) do
|
||||
table.insert(tokens, token)
|
||||
end
|
||||
return tokens
|
||||
end
|
Reference in New Issue
Block a user