Skip to content

Commit

Permalink
VERSION{v0a.0.7.0}
Browse files Browse the repository at this point in the history
 * AI list window loads game AIs.
 * Battle room uses Zero-K v1.4.7.1 and downloads it upon launch (really need a game config for this).
 * Modoption listener works correctly. Still no ability to set modoptions.
  • Loading branch information
GoogleFrog committed Jul 29, 2016
1 parent 3e05ad9 commit 0e763bb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
18 changes: 11 additions & 7 deletions LuaUI/widgets/chobby/components/ai_list_window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,27 @@ function AiListWindow:init(lobby, gameName, allyTeam)
self.window:SetPos(nil, nil, 500, 700)

-- Disable game-specific AIs for now since it breaks /luaui reload
-- local ais = VFS.GetAvailableAIs(gameName)
local ais = VFS.GetAvailableAIs()
if Configuration.singleplayer_mode == 2 then
ais[#ais + 1] = ais[1]
ais[1] = {shortName = "CAI", version = 1}
end
local ais = VFS.GetAvailableAIs(gameName)
--local ais = VFS.GetAvailableAIs()
--if Configuration.singleplayer_mode == 2 then
-- ais[#ais + 1] = ais[1]
-- ais[1] = {shortName = "CAI", version = 1}
--end

local blackList = Configuration:GetGameConfig(gameName, "aiBlacklist.lua")

for i, ai in pairs(ais) do
if (not blackList) or (not blackList[ai.shortName]) then
local version = " v" .. ai.version
if version == " v<not-versioned>" then
version = ""
end
local addAIButton = Button:New {
x = 0,
y = 0,
width = "100%",
height = "100%",
caption = ai.shortName .. " v" .. ai.version,
caption = ai.shortName .. version,
font = Configuration:GetFont(3),
OnClick = {
function()
Expand Down
7 changes: 6 additions & 1 deletion LuaUI/widgets/gui_battle_room_window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,9 @@ local function SetupInfoButtonsPanel(leftInfo, rightInfo, battle, battleID, myUs
},
parent = leftInfo,
}
if modoptionsHolder.children[1].visible then
modoptionsHolder.children[1]:Hide()
end

downloader.lblDownload.OnHide = downloader.lblDownload.OnHide or {}
downloader.lblDownload.OnHide[#downloader.lblDownload.OnHide + 1] = function ()
Expand Down Expand Up @@ -1314,7 +1317,7 @@ function BattleRoomWindow.SetSingleplayerGame(ToggleShowFunc, battleroomObj, tab
if config.singleplayer_mode == 1 then
WG.Chobby.GameListWindow(SetGameFail, SetGameSucess)
elseif config.singleplayer_mode == 2 then
singleplayerGame = "Zero-K v1.4.7.0"
singleplayerGame = "Zero-K v1.4.7.1"
ToggleShowFunc(battleroomObj, tabData)
end
end
Expand Down Expand Up @@ -1348,6 +1351,8 @@ function widget:Initialize()
CHOBBY_DIR = "LuaUI/widgets/chobby/"
VFS.Include("LuaUI/widgets/chobby/headers/exports.lua", nil, VFS.RAW_FIRST)

MaybeDownloadArchive("Zero-K v1.4.7.1", "game")

WG.BattleRoomWindow = BattleRoomWindow
end

Expand Down
8 changes: 8 additions & 0 deletions LuaUI/widgets/gui_modoptions_panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ local battleLobby
local modoptionDefaults = {}
local modoptionStructure = {}

local modoptionListenerLobby

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Functions
Expand Down Expand Up @@ -185,6 +187,7 @@ local function InitializeModoptionsDisplay()
parent = mainScrollPanel,
}

modoptionListenerLobby = battleLobby
local function OnSetModOptions(listener, data)
local modoptions = battleLobby:GetMyBattleModoptions()
local text = ""
Expand All @@ -211,6 +214,11 @@ local function InitializeModoptionsDisplay()
local externalFunctions = {}

function externalFunctions.Update()
if modoptionListenerLobby then
modoptionListenerLobby:RemoveListener("OnSetModOptions", OnSetModOptions)
end
battleLobby:AddListener("OnSetModOptions", OnSetModOptions)

OnSetModOptions()
end

Expand Down
1 change: 1 addition & 0 deletions libs/liblobby/lobby/interface_skirmish.lua
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ function InterfaceSkirmish:SetBattleState(myUserName, gameName, mapName, title)
--(battleID, type, natType, founder, ip, port, maxPlayers, passworded, rank, mapHash, other, engineVersion, mapName, title, gameName, spectatorCount)
self:_OnBattleOpened(myBattleID, nil, nil, myUserName, nil, nil, nil, nil, nil, nil, nil, nil, mapName, title, gameName, nil)
self:_OnJoinedBattle(myBattleID, myUserName)
self:_OnSetModOptions({})

return self
end
Expand Down

0 comments on commit 0e763bb

Please sign in to comment.