Skip to content

Commit 0a7aea4

Browse files
committed
Added a 'Select Mod' button to Adv Options.
1 parent d1fedf6 commit 0a7aea4

9 files changed

Lines changed: 66 additions & 6 deletions

File tree

LuaMenu/configs/gameConfig/zk/mainConfig.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ local backgroundConfig = VFS.Include(LUA_DIRNAME .. "configs/game
1313
local gameUnitInformation = VFS.Include(LUA_DIRNAME .. "configs/gameConfig/" .. shortname .. "/gameUnitInformation.lua")
1414
local badges = VFS.Include(LUA_DIRNAME .. "configs/gameConfig/" .. shortname .. "/badges.lua")
1515
local GetRankAndImage = VFS.Include(LUA_DIRNAME .. "configs/gameConfig/" .. shortname .. "/profilePage.lua")
16+
local modBlacklist = VFS.Include(LUA_DIRNAME .. "configs/gameConfig/" .. shortname .. "/modBlacklist.lua")
1617

1718
local link_reportPlayer, link_userPage, link_homePage, link_replays, link_maps, link_particularMapPage, link_matchmakerMapBans = VFS.Include(LUA_DIRNAME .. "configs/gameConfig/" .. shortname .. "/linkFunctions.lua")
1819

@@ -117,6 +118,7 @@ local externalFuncAndData = {
117118
-- I assume ZK doesn't want to show this as it was removed
118119
hideGameExistanceDisplay = true,
119120
disableColorChoosing = true,
121+
modBlacklist = modBlacklist,
120122
}
121123

122124
function externalFuncAndData.CheckAvailability()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
return {
2+
["Zero-K Benchmark v3"] = true,
3+
["Zero-K Benchmark v2"] = true,
4+
["Zero-K Benchmark v1"] = true,
5+
["Quick Rocket Tutorial"] = true,
6+
}

LuaMenu/widgets/chobby/components/game_list_window.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
GameListWindow = ListWindow:extends{}
22

3-
function GameListWindow:init(failFunction, sucessFunction)
3+
function GameListWindow:init(failFunction, sucessFunction, blacklist)
44

55
self:super('init', WG.Chobby.lobbyInterfaceHolder, "Select Game", false, "main_window", nil, {6, 7, 7, 4})
66
self.window:SetPos(nil, nil, 500, 700)
77

88
for i, archive in pairs(VFS.GetAllArchives()) do
99
local info = VFS.GetArchiveInfo(archive)
10-
if info and info.modtype == 1 then
10+
if info and info.modtype == 1 and not (blacklist and blacklist[info.name]) then
1111
local pickMapButton = Button:New {
1212
x = 0,
1313
y = 0,

LuaMenu/widgets/chobby/i18n/chililobby.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ return {
88
retry = "Retry",
99
reset = "Reset",
1010
close = "Close",
11+
select_mod = "Select Mod",
1112
continue = "Continue",
1213
yes = "Yes",
1314
no = "No",

LuaMenu/widgets/gui_modoptions_panel.lua

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,11 +380,27 @@ local function CreateModoptionWindow()
380380
modoptionsSelectionWindow:Dispose()
381381
end
382382

383-
local buttonAccept
383+
local buttonAccept, buttonMods, modSelection
384+
385+
function GetModSelection()
386+
local function SetGameFail()
387+
end
388+
389+
local function SetGameSucess(name)
390+
buttonMods.caption = name
391+
modSelection = name
392+
end
393+
394+
local Configuration = WG.Chobby.Configuration
395+
WG.Chobby.GameListWindow(SetGameFail, SetGameSucess, Configuration and Configuration.gameConfig.modBlacklist)
396+
end
384397

385398
local function AcceptFunc()
386399
screen0:FocusControl(buttonAccept) -- Defocus the text entry
387400
battleLobby:SetModOptions(localModoptions)
401+
if modSelection then
402+
battleLobby:SelectGame(modSelection)
403+
end
388404
modoptionsSelectionWindow:Dispose()
389405
end
390406

@@ -393,9 +409,28 @@ local function CreateModoptionWindow()
393409
UpdateControlValue(key, value)
394410
end
395411
localModoptions = {}
412+
413+
modSelection = false
414+
buttonMods.caption = i18n("select_mod")
396415
end
397416

398-
buttonReset = Button:New {
417+
buttonMods = Button:New {
418+
x = 10,
419+
right = 513,
420+
bottom = 1,
421+
height = 70,
422+
caption = i18n("select_mod"),
423+
font = WG.Chobby.Configuration:GetFont(3),
424+
parent = modoptionsSelectionWindow,
425+
classname = "option_button",
426+
OnClick = {
427+
function()
428+
GetModSelection()
429+
end
430+
},
431+
}
432+
433+
Button:New {
399434
right = 294,
400435
width = 135,
401436
bottom = 1,

LuaMenu/widgets/gui_settings_window.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ local function GetVoidTabControls()
10811081
valign = "top",
10821082
align = "left",
10831083
font = Configuration:GetFont(2),
1084-
caption = "Server Address",
1084+
caption = "Server Address (zero-k.info or test.zero-k.info for testing)",
10851085
}
10861086
children[#children + 1] = EditBox:New {
10871087
x = COMBO_X,
@@ -1112,7 +1112,7 @@ local function GetVoidTabControls()
11121112
valign = "top",
11131113
align = "left",
11141114
font = Configuration:GetFont(2),
1115-
caption = "Server Port",
1115+
caption = "Server Port (8200 or 8202 for testing)",
11161116
}
11171117
children[#children + 1] = EditBox:New {
11181118
x = COMBO_X,

libs/liblobby/lobby/interface_skirmish.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,13 @@ function InterfaceSkirmish:SelectMap(mapName)
373373
})
374374
end
375375

376+
function InterfaceSkirmish:SelectGame(gameName)
377+
self:_OnUpdateBattleInfo(self:GetMyBattleID(), {
378+
gameName = gameName,
379+
})
380+
return self
381+
end
382+
376383
-- Skirmish only
377384
function InterfaceSkirmish:SetBattleState(myUserName, gameName, mapName, title)
378385
local myBattleID = 1

libs/liblobby/lobby/interface_zerok.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,11 @@ function Interface:StartBattle()
404404
return self
405405
end
406406

407+
function Interface:SelectGame(gameName)
408+
self:SayBattle("!game " .. gameName)
409+
return self
410+
end
411+
407412
------------------------
408413
-- Channel & private chat commands
409414
------------------------

libs/liblobby/lobby/lobby.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ function Lobby:SelectMap(mapName)
115115
self:SayBattle("!map " .. mapName)
116116
end
117117

118+
function Lobby:SelectGame(gameName)
119+
return self
120+
end
121+
118122
function Lobby:SetBattleType(typeName)
119123
self:SayBattle("!type " .. typeName)
120124
end

0 commit comments

Comments
 (0)