From 514bcedae4464e65af42ebb950f899f7b8838206 Mon Sep 17 00:00:00 2001 From: saurtron Date: Fri, 6 Dec 2024 18:55:58 +0100 Subject: [PATCH] Fix instances of 'if not x == y'. (#3980) --- luarules/gadgets/unit_target_on_the_move.lua | 2 +- luaui/Widgets/gui_info.lua | 4 ++-- luaui/Widgets/gui_unit_stats.lua | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/luarules/gadgets/unit_target_on_the_move.lua b/luarules/gadgets/unit_target_on_the_move.lua index ee9dcd43b4a..78779732770 100644 --- a/luarules/gadgets/unit_target_on_the_move.lua +++ b/luarules/gadgets/unit_target_on_the_move.lua @@ -288,7 +288,7 @@ if gadgetHandler:IsSyncedCode() then spSetUnitRulesParam(unitID, "targetCoordX", -1) spSetUnitRulesParam(unitID, "targetCoordY", -1) spSetUnitRulesParam(unitID, "targetCoordZ", -1) - if unitTargets[unitID] and not keeptrack == true then + if unitTargets[unitID] and not keeptrack then SendToUnsynced("targetList", unitID, 0) end unitTargets[unitID] = nil diff --git a/luaui/Widgets/gui_info.lua b/luaui/Widgets/gui_info.lua index f18fe2876b1..3bd236ea894 100644 --- a/luaui/Widgets/gui_info.lua +++ b/luaui/Widgets/gui_info.lua @@ -1103,7 +1103,7 @@ local function drawUnitInfo() local unitNameColor = tooltipTitleColor if SelectedUnitsCount > 0 then - if not displayMode == 'unitdef' or (WG['buildmenu'] and (activeCmdID and activeCmdID < 0 and (not WG['buildmenu'].hoverID or (-activeCmdID == WG['buildmenu'].hoverID)))) then + if displayMode ~= 'unitdef' or (WG['buildmenu'] and (activeCmdID and activeCmdID < 0 and (not WG['buildmenu'].hoverID or (-activeCmdID == WG['buildmenu'].hoverID)))) then unitNameColor = '\255\125\255\125' end end @@ -1143,7 +1143,7 @@ local function drawUnitInfo() -- custom unit info area customInfoArea = { math_floor(backgroundRect[3] - width - bgpadding), math_floor(backgroundRect[2]), math_floor(backgroundRect[3] - bgpadding), math_floor(backgroundRect[2] + height) } - if not displayMode == 'unitdef' or not showBuilderBuildlist or not unitDefInfo[displayUnitDefID].buildOptions or (not (WG['buildmenu'] and WG['buildmenu'].hoverID)) then + if displayMode ~= 'unitdef' or not showBuilderBuildlist or not unitDefInfo[displayUnitDefID].buildOptions or (not (WG['buildmenu'] and WG['buildmenu'].hoverID)) then RectRound(customInfoArea[1], customInfoArea[2], customInfoArea[3], customInfoArea[4], elementCorner*0.66, 1, 0, 0, 0, { 0.8, 0.8, 0.8, 0.08 }, { 0.8, 0.8, 0.8, 0.15 }) end diff --git a/luaui/Widgets/gui_unit_stats.lua b/luaui/Widgets/gui_unit_stats.lua index dbfac5b21ec..8cca389eb14 100644 --- a/luaui/Widgets/gui_unit_stats.lua +++ b/luaui/Widgets/gui_unit_stats.lua @@ -26,7 +26,7 @@ end if damageStats and damageStats[gameName] and damageStats[gameName].team then local rate = 0 for k, v in pairs (damageStats[gameName].team) do - if not v == damageStats[gameName].team.games and v.cost and v.killed_cost then + if k ~= "games" and v.cost and v.killed_cost then local compRate = v.killed_cost/v.cost if compRate > rate then highestUnitDef = k @@ -36,7 +36,7 @@ if damageStats and damageStats[gameName] and damageStats[gameName].team then end local scndRate = 0 for k, v in pairs (damageStats[gameName].team) do - if not v == damageStats[gameName].team.games and v.cost and v.killed_cost then + if k ~= "games" and v.cost and v.killed_cost then local compRate = v.killed_cost/v.cost if compRate > scndRate and k ~= highestUnitDef then scndhighestUnitDef = k @@ -47,7 +47,7 @@ if damageStats and damageStats[gameName] and damageStats[gameName].team then local thirdRate = 0 --local thirdhighestUnitDef for k, v in pairs (damageStats[gameName].team) do - if not v == damageStats[gameName].team.games and v.cost and v.killed_cost then + if k ~= "games" and v.cost and v.killed_cost then local compRate = v.killed_cost/v.cost if compRate > thirdRate and k ~= highestUnitDef and k ~= scndhighestUnitDef then --thirdhighestUnitDef = k