From 6861287e01396aeaf8b51f89be60567bcd7f4c85 Mon Sep 17 00:00:00 2001 From: Gajo Petrovic Date: Sun, 9 Feb 2020 11:33:40 +0900 Subject: [PATCH 1/3] remove authorship info: it's outdated and generally bad practice to keep in files --- modinfo.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/modinfo.lua b/modinfo.lua index 0213cfcee..b02d62580 100644 --- a/modinfo.lua +++ b/modinfo.lua @@ -1,5 +1,4 @@ -- Chobby - an in-game lobby project --- Authors: gajop local modinfo = { name = "Chobby", From e01bdcad2f422562808dd66e1cc587a7b98643be Mon Sep 17 00:00:00 2001 From: Gajo Petrovic Date: Sun, 9 Feb 2020 11:58:52 +0900 Subject: [PATCH 2/3] fix travis --- LuaMenu/configs/gameConfig/zk/ModOptions.lua | 4 +--- LuaMenu/widgets/gui_campaign_handler.lua | 2 +- LuaMenu/widgets/gui_steam_coop_handler.lua | 4 ++-- .../luamenu/chili/chili/controls/font.lua | 16 ++++++++-------- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/LuaMenu/configs/gameConfig/zk/ModOptions.lua b/LuaMenu/configs/gameConfig/zk/ModOptions.lua index 3cea1d175..30ffdc9c0 100644 --- a/LuaMenu/configs/gameConfig/zk/ModOptions.lua +++ b/LuaMenu/configs/gameConfig/zk/ModOptions.lua @@ -1,4 +1,3 @@ - -- $Id: ModOptions.lua 4642 2009-05-22 05:32:36Z carrepairer $ @@ -83,7 +82,7 @@ local options = { { key='none', name = "Off", desc = 'Turns commsharing off.' }, }, }, - + { key = "noelo", name = "No Elo", @@ -539,7 +538,6 @@ local options = { -- -- } -- }, -- }, - { key = 'chicken', name = 'Chicken', diff --git a/LuaMenu/widgets/gui_campaign_handler.lua b/LuaMenu/widgets/gui_campaign_handler.lua index 747ae70c2..bddc17927 100644 --- a/LuaMenu/widgets/gui_campaign_handler.lua +++ b/LuaMenu/widgets/gui_campaign_handler.lua @@ -932,7 +932,7 @@ local function SelectPlanet(popupOverlay, planetHandler, planetID, planetData, s fluffGrid:SetVisibility(true) end planetDesc:UpdateClientArea(false) - + if planetHandler.height < 600 then subPanel._relativeBounds.right = 390 subPanel._relativeBounds.bottom = "2%" diff --git a/LuaMenu/widgets/gui_steam_coop_handler.lua b/LuaMenu/widgets/gui_steam_coop_handler.lua index 6d6936635..9aee8d812 100644 --- a/LuaMenu/widgets/gui_steam_coop_handler.lua +++ b/LuaMenu/widgets/gui_steam_coop_handler.lua @@ -200,7 +200,7 @@ local function CheckDownloads(gameName, mapName, DoneFunc, gameList) DownloadUpdateFunction = nil end DownloadUpdateFunction = Update - + local dlString = "Waiting on content: " downloading = { downloads = { @@ -208,7 +208,7 @@ local function CheckDownloads(gameName, mapName, DoneFunc, gameList) progress = { }, } - + if gameList then for i = 1, #gameList do if not WG.Package.ArchiveExists(gameList[i]) then diff --git a/libs/chiliui/luamenu/chili/chili/controls/font.lua b/libs/chiliui/luamenu/chili/chili/controls/font.lua index 1c768c83b..5164c28c4 100644 --- a/libs/chiliui/luamenu/chili/chili/controls/font.lua +++ b/libs/chiliui/luamenu/chili/chili/controls/font.lua @@ -1,4 +1,4 @@ ---// ============================================================================= +--// ============================================================================= --- Font module @@ -31,7 +31,7 @@ Font = Object:Inherit{ local this = Font local inherited = this.inherited ---// ============================================================================= +--// ============================================================================= function Font:New(obj) obj = inherited.New(self, obj) @@ -50,7 +50,7 @@ function Font:Dispose(...) inherited.Dispose(self, ...) end ---// ============================================================================= +--// ============================================================================= function Font:_LoadFont() local oldfont = self._font @@ -60,7 +60,7 @@ function Font:_LoadFont() FontHandler.UnloadFont(oldfont) end ---// ============================================================================= +--// ============================================================================= local function NotEqual(v1, v2) local t1 = type(v1) @@ -143,7 +143,7 @@ do params = nil end ---// ============================================================================= +--// ============================================================================= function Font:GetLineHeight(size) return self._font.lineheight * (size or self.size) @@ -176,7 +176,7 @@ function Font:WrapText(text, width, height, size) return (self._font):WrapText(text, width, height, size) end ---// ============================================================================= +--// ============================================================================= function Font:AdjustPosToAlignment(x, y, width, height, align, valign) local extra = '' @@ -248,7 +248,7 @@ local function _GetExtra(align, valign) return extra end ---// ============================================================================= +--// ============================================================================= function Font:_DrawText(text, x, y, extra) local font = self._font @@ -307,4 +307,4 @@ end Font.Print = Font.Draw Font.PrintInBox = Font.DrawInBox ---// ============================================================================= +--// ============================================================================= From 7e4deec814699986a7c3c42ba8780e8b31c58296 Mon Sep 17 00:00:00 2001 From: Gajo Petrovic Date: Sun, 9 Feb 2020 12:23:07 +0900 Subject: [PATCH 3/3] revert revert of battle_list_window.lua changes --- LuaMenu/configs/gameConfig/zk/mainConfig.lua | 2 + .../components/battle/battle_list_window.lua | 105 +++++++++--------- 2 files changed, 53 insertions(+), 54 deletions(-) diff --git a/LuaMenu/configs/gameConfig/zk/mainConfig.lua b/LuaMenu/configs/gameConfig/zk/mainConfig.lua index d1057ba28..f2367cfe2 100644 --- a/LuaMenu/configs/gameConfig/zk/mainConfig.lua +++ b/LuaMenu/configs/gameConfig/zk/mainConfig.lua @@ -112,6 +112,8 @@ local externalFuncAndData = { "sounds/lobbyMusic/Interstellar.ogg", "sounds/lobbyMusic/Tomorrow Landscape.ogg", }, + -- I assume ZK doesn't want to show this as it was removed + hideGameExistanceDisplay = true, } function externalFuncAndData.CheckAvailability() diff --git a/LuaMenu/widgets/chobby/components/battle/battle_list_window.lua b/LuaMenu/widgets/chobby/components/battle/battle_list_window.lua index 8d271e519..e3e448bb4 100644 --- a/LuaMenu/widgets/chobby/components/battle/battle_list_window.lua +++ b/LuaMenu/widgets/chobby/components/battle/battle_list_window.lua @@ -9,23 +9,23 @@ local IMG_UNREADY = LUA_DIRNAME .. "images/unready.png" function BattleListWindow:init(parent) self:super("init", parent, "Play or watch a game", true, nil, nil, nil, 34) -if not Configuration.gameConfig.disableBattleListHostButton then - self.btnNewBattle = Button:New { - x = 260, - y = 7, - width = 150, - height = 45, - caption = i18n("open_mp_game"), - font = Configuration:GetFont(3), - classname = "option_button", - parent = self.window, - OnClick = { - function () - self:OpenHostWindow() - end - }, - } -end + if not Configuration.gameConfig.disableBattleListHostButton then + self.btnNewBattle = Button:New { + x = 260, + y = 7, + width = 150, + height = 45, + caption = i18n("open_mp_game"), + font = Configuration:GetFont(3), + classname = "option_button", + parent = self.window, + OnClick = { + function () + self:OpenHostWindow() + end + }, + } + end local function SoftUpdate() self:UpdateFilters() @@ -511,24 +511,17 @@ function BattleListWindow:MakeJoinBattle(battleID, battle) } end - --local imHaveGame = Image:New { - -- name = "imHaveGame", - -- x = height + 50, - -- width = 15, - -- height = 15, - -- y = 20, - -- height = 15, - -- file = (VFS.HasArchive(battle.gameName) and IMG_READY or IMG_UNREADY), - -- parent = parentButton, - --} - local modeName = battle.battleMode and Configuration.battleTypeToHumanName[battle.battleMode] - if battle.isRunning then - if modeName then - modeName = modeName .. " - " - else - modeName = "" - end - modeName = modeName .. "Running for " .. Spring.Utilities.GetTimeToPast(battle.runningSince) + if not Configuration.gameConfig.hideGameExistanceDisplay then + local imHaveGame = Image:New { + name = "imHaveGame", + x = height + 50, + width = 15, + height = 15, + y = 20, + height = 15, + file = (VFS.HasArchive(battle.gameName) and IMG_READY or IMG_UNREADY), + parent = parentButton, + } end local lblGame = Label:New { @@ -538,7 +531,7 @@ function BattleListWindow:MakeJoinBattle(battleID, battle) y = 20, height = 15, valign = 'center', - caption = modeName, --battle.gameName:sub(1, 22), + caption = self:_MakeGameCaption(battle), font = Configuration:GetFont(1), parent = parentButton, } @@ -656,12 +649,14 @@ function BattleListWindow:UpdateSync(battleID) end local imHaveMap = items.battleButton:GetChildByName("imHaveMap") - --local imHaveGame = items.battleButton:GetChildByName("imHaveGame") - - if imHaveMap then - --imHaveGame.file = (VFS.HasArchive(battle.gameName) and IMG_READY or IMG_UNREADY) + if imHaveMap ~= nil then imHaveMap.file = (VFS.HasArchive(battle.mapName) and IMG_READY or IMG_UNREADY) end + + local imHaveGame = items.battleButton:GetChildByName("imHaveGame") + if imHaveGame ~= nil then + imHaveGame.file = (VFS.HasArchive(battle.gameName) and IMG_READY or IMG_UNREADY) + end end function BattleListWindow:UpdateTimers() @@ -685,6 +680,17 @@ function BattleListWindow:UpdateTimers() end end +function BattleListWindow:_MakeGameCaption(battle) + local gameCaption = battle.battleMode and Configuration.battleTypeToHumanName[battle.battleMode] + if gameCaption == nil then + gameCaption = battle.gameName -- :sub(1, 22) + end + if battle.isRunning then + gameCaption = gameCaption .. " - Running for " .. Spring.Utilities.GetTimeToPast(battle.runningSince) + end + return gameCaption +end + function BattleListWindow:JoinedBattle(battleID) local battle = lobby:GetBattle(battleID) if not (Configuration.displayBadEngines2 or Configuration:IsValidEngineVersion(battle.engineVersion)) then @@ -781,22 +787,13 @@ function BattleListWindow:OnUpdateBattleInfo(battleID) imHaveMap:Invalidate() - --local imHaveGame = items.battleButton:GetChildByName("imHaveGame") - --imHaveGame.file = (VFS.HasArchive(battle.gameName) and IMG_READY or IMG_UNREADY) - --gameCaption:SetCaption(battle.gameName:gsub("_", " ")) + local imHaveGame = items.battleButton:GetChildByName("imHaveGame") + if imHaveGame ~= nil then + imHaveGame.file = (VFS.HasArchive(battle.gameName) and IMG_READY or IMG_UNREADY) + end local gameCaption = items.battleButton:GetChildByName("gameCaption") - local modeName = battle.battleMode and Configuration.battleTypeToHumanName[battle.battleMode] - if battle.isRunning then - if modeName then - modeName = modeName .. " - " - else - modeName = "" - end - gameCaption:SetCaption(modeName .. "Running for " .. Spring.Utilities.GetTimeToPast(battle.runningSince)) - else - gameCaption:SetCaption(modeName) - end + gameCaption:SetCaption(self:_MakeGameCaption(battle)) local playersCaption = items.battleButton:GetChildByName("playersCaption") playersCaption:SetCaption(lobby:GetBattlePlayerCount(battleID) .. "/" .. battle.maxPlayers)