diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000000..b8167f99608 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,18 @@ +# gen(stylua): initial formatting of entire codebase +0893975d66c3a6b44248054b49d468f0e51ff0b6 + +# gen(bar_codemod): bracket-to-dot +2e67e27c76995c5bff47505214de9ad14f9cb922 + +# gen(bar_codemod): rename-aliases +3a5746e07d7390aa3fd740e217adebd8c8bbdd32 + +# gen(bar_codemod): detach-bar-modules +1fcca8773dbaa2d2b4cc8fc57b4036ce887905fd + +# gen(hand): integration tests return-table shape +1fcca8773dbaa2d2b4cc8fc57b4036ce887905fd + +# gen(hand): inline luassert and busted LuaCATS types +1fcca8773dbaa2d2b4cc8fc57b4036ce887905fd + diff --git a/luarules/gadgets/api_enemyunitdestroyed.lua b/luarules/gadgets/api_enemyunitdestroyed.lua index 709438718a4..af0f5ecf9a3 100644 --- a/luarules/gadgets/api_enemyunitdestroyed.lua +++ b/luarules/gadgets/api_enemyunitdestroyed.lua @@ -28,7 +28,7 @@ if not gadgetHandler:IsSyncedCode() then function gadget:UnitDestroyed(unitID, unitDefID, teamID, attackerID, attackerDefID, attackerTeamID, weaponDefID) local allyTeam = spGetUnitAllyTeam(unitID) - if (spec and fullview) or (allyTeam and allyTeam ~= myAllyTeamID) then + if (spec and fullView) or (allyTeam and allyTeam ~= myAllyTeamID) then local losstate = Spring.GetUnitLosState(unitID, myAllyTeamID) if losstate and losstate.los and Script.LuaUI("EnemyUnitDestroyed") then Script.LuaUI.EnemyUnitDestroyed(unitID, unitDefID, teamID, attackerID, attackerDefID, attackerTeamID, weaponDefID) diff --git a/luarules/gadgets/raptor_spawner_defense.lua b/luarules/gadgets/raptor_spawner_defense.lua index 33bf9013c0f..d7489e65720 100644 --- a/luarules/gadgets/raptor_spawner_defense.lua +++ b/luarules/gadgets/raptor_spawner_defense.lua @@ -1048,7 +1048,7 @@ if gadgetHandler:IsSyncedCode() then --if bestBurrowID then -- DestroyUnit(bestBurrowID, true, false) --end - return CreateUnit(config.queenName, sx, sy, sz, mRandom(0, 3), raptorTeamID), burrowID + return CreateUnit(config.queenName, sx, sy, sz, mRandom(0, 3), raptorTeamID), bestBurrowID end local x, z, y diff --git a/luarules/gadgets/scav_spawner_defense.lua b/luarules/gadgets/scav_spawner_defense.lua index a940e45374c..2e0ad583ab2 100644 --- a/luarules/gadgets/scav_spawner_defense.lua +++ b/luarules/gadgets/scav_spawner_defense.lua @@ -1181,7 +1181,7 @@ if gadgetHandler:IsSyncedCode() then --if bestBurrowID then -- Spring.DestroyUnit(bestBurrowID, true, false) --end - return CreateUnit(config.bossName, sx, sy, sz, mRandom(0, 3), scavTeamID), burrowID + return CreateUnit(config.bossName, sx, sy, sz, mRandom(0, 3), scavTeamID), bestBurrowID end local x, z, y diff --git a/luarules/gadgets/unit_area_timed_damage.lua b/luarules/gadgets/unit_area_timed_damage.lua index 38785049088..908c571f4d6 100644 --- a/luarules/gadgets/unit_area_timed_damage.lua +++ b/luarules/gadgets/unit_area_timed_damage.lua @@ -20,12 +20,12 @@ end -------------------------------------------------------------------------------- -- Configuration --------------------------------------------------------------- -local damageInterval = 0.7333 ---@type number in seconds, time between procs -local damageLimit = 120 ---@type number in damage per second, soft-cap across multiple areas -local damageExcessRate = 0.2 ---@type number %damage dealt above limit [0, 1) -local damageCegMinScalar = 30 ---@type number in damage, minimum to show hit CEG -local damageCegMinMultiple = 1 / 3 ---@type number in %damage, minimum to show hit CEG -local factoryWaitTime = damageInterval ---@type number in seconds, immunity period for factory-built units +local damageInterval = 0.7333 ---@type number # in seconds, time between procs +local damageLimit = 120 ---@type number # in damage per second, soft-cap across multiple areas +local damageExcessRate = 0.2 ---@type number # %damage dealt above limit [0, 1) +local damageCegMinScalar = 30 ---@type number # in damage, minimum to show hit CEG +local damageCegMinMultiple = 1 / 3 ---@type number # in %damage, minimum to show hit CEG +local factoryWaitTime = damageInterval ---@type number # in seconds, immunity period for factory-built units -- Since I couldn't figure out totally arbitrary-radius variable CEGs for fire, -- we're left with this static list, which is repeated in the expgen def files: diff --git a/luarules/gadgets/unit_carrier_spawner.lua b/luarules/gadgets/unit_carrier_spawner.lua index 18e61a748c8..98d46184219 100644 --- a/luarules/gadgets/unit_carrier_spawner.lua +++ b/luarules/gadgets/unit_carrier_spawner.lua @@ -421,7 +421,7 @@ local function CobDroneSpawnSequenceFinished(unitID, unitDefID, team, subUnitID) return else local dockingPiece = carrierMetaList[unitID].subUnitsList[subUnitID].dockingPiece - local _, pieceAngle = spCallCOBScript(unitID, "DroneDocked", 5, pieceAngle, dockingPiece) + local _, pieceAngle = spCallCOBScript(unitID, "DroneDocked", 5, nil, dockingPiece) spCallCOBScript(subUnitID, "Docked", 0, carrierMetaList[unitID].cobdockparam, dockingPiece, pieceAngle) return end @@ -475,7 +475,7 @@ local function spawnUnit(spawnData) energyCost = carrierData.energyCost[dronetypeIndex] else local subUnitDef = UnitDefNames[dronename] - if subunitDef then + if subUnitDef then metalCost = subUnitDef.metalCost energyCost = subUnitDef.energyCost else @@ -617,7 +617,7 @@ local function spawnUnit(spawnData) droneSpawnSequence(ownerID, subUnitID) droneMetaData.activeSpawnSequence = true else - local _, pieceAngle = spCallCOBScript(ownerID, "DroneDocked", 5, pieceAngle, droneMetaData.dockingPiece) + local _, pieceAngle = spCallCOBScript(ownerID, "DroneDocked", 5, nil, droneMetaData.dockingPiece) spCallCOBScript(subUnitID, "Docked", 0, carrierData.cobdockparam, droneMetaData.dockingPiece, pieceAngle) end else @@ -1578,7 +1578,7 @@ local function dockUnits(dockingqueue, queuestart, queueend) if carrierMetaList[unitID].dockArmor then spSetUnitArmored(subUnitID, true, carrierMetaList[unitID].dockArmor) end - local _, pieceAngle = spCallCOBScript(unitID, "DroneDocked", 5, pieceAngle, pieceNumber) + local _, pieceAngle = spCallCOBScript(unitID, "DroneDocked", 5, nil, pieceNumber) spCallCOBScript(subUnitID, "Docked", 0, carrierMetaList[unitID].cobdockparam, pieceNumber, pieceAngle) if dronetype == "abductor" then diff --git a/luarules/gadgets/unit_stomp.lua b/luarules/gadgets/unit_stomp.lua index 2e42a779f22..afeb614cfe0 100644 --- a/luarules/gadgets/unit_stomp.lua +++ b/luarules/gadgets/unit_stomp.lua @@ -31,7 +31,7 @@ end local stompableDefs = {} for udid, ud in pairs(UnitDefs) do if stompable[ud.name] then - stompableDefs[udid] = v + stompableDefs[udid] = true end end diff --git a/luaui/Include/AtlasOnDemand.lua b/luaui/Include/AtlasOnDemand.lua index 2802e5b6ab5..15f2d99a563 100644 --- a/luaui/Include/AtlasOnDemand.lua +++ b/luaui/Include/AtlasOnDemand.lua @@ -529,7 +529,7 @@ local function MakeAtlasOnDemand(config) if id then self.uvcoords[id] = nil end - local drawblanktask = { id = self.blankimg, w = xmax - xmin * self.xresolution, h = ymax - ymin * yresolution, x = xmin * self.xresolution, y = ymin * self.yresolution } + local drawblanktask = { id = self.blankimg, w = xmax - xmin * self.xresolution, h = ymax - ymin * self.yresolution, x = xmin * self.xresolution, y = ymin * self.yresolution } self.renderImageTaskList[#self.renderImageTaskList + 1] = drawblanktask self.hastasks = true end diff --git a/luaui/Scenarios/stresstest/multi_attack.lua b/luaui/Scenarios/stresstest/multi_attack.lua index 29b2e62ebb8..6facb40f8a5 100644 --- a/luaui/Scenarios/stresstest/multi_attack.lua +++ b/luaui/Scenarios/stresstest/multi_attack.lua @@ -106,7 +106,7 @@ function run_commands(nattackers, ntargets, attackerDef, targetDef) local arr = {} for _, unitID in pairs(attackers) do for idx, targetID in pairs(targets) do - currOpt = (idx == 1) and opts or shiftOpts + local currOpt = (idx == 1) and {} or shiftOpts arr[1] = targetID spGiveOrderToUnit(unitID, CMD_ATTACK, arr, currOpt) end diff --git a/luaui/Widgets/api_unit_tracker_gl4.lua b/luaui/Widgets/api_unit_tracker_gl4.lua index b479b936265..84f0a56cacd 100644 --- a/luaui/Widgets/api_unit_tracker_gl4.lua +++ b/luaui/Widgets/api_unit_tracker_gl4.lua @@ -135,7 +135,7 @@ local function Scream(reason, unitID) -- This will pause the game and play some -- gather as much info as possible about this unitID local unitDefID = spGetUnitDefID(unitID) local unitTeam = spGetUnitTeam(unitID) - local ux, uy, uz = spGetUnitPosition(unitID) + local px, py, pz = spGetUnitPosition(unitID) spEcho("API Unit Tracker error unitID", unitID, unitDefID and UnitDefs[unitDefID].name or "nil", unitTeam, px, pz) end if lastknownunitpos[unitID] then diff --git a/luaui/Widgets/cmd_area_commands_filter.lua b/luaui/Widgets/cmd_area_commands_filter.lua index 817c3e86ae1..916e1e26745 100644 --- a/luaui/Widgets/cmd_area_commands_filter.lua +++ b/luaui/Widgets/cmd_area_commands_filter.lua @@ -56,8 +56,8 @@ local myAllyTeamID --- Target sorting logic (pick the closest first) --------------------------------------------------------------------------------------- ----@field position1 table {x, y, z} ----@field position2 table {x, y, z} +---@param position1 table {x, y, z} +---@param position2 table {x, y, z} local function distanceSq(position1, position2) local dx = position1.x - position2.x local dz = position1.z - position2.z diff --git a/luaui/Widgets/cmd_context_build.lua b/luaui/Widgets/cmd_context_build.lua index 66bf3477ddb..13bbf9089c9 100644 --- a/luaui/Widgets/cmd_context_build.lua +++ b/luaui/Widgets/cmd_context_build.lua @@ -26,6 +26,7 @@ local tableInsert = table.insert -- Localized Spring API for performance local spGetGameFrame = Spring.GetGameFrame +local _, isSpec = Spring.GetSpectatingState() local isPregame = spGetGameFrame() == 0 and not isSpec diff --git a/luaui/Widgets/dbg_frame_grapher.lua b/luaui/Widgets/dbg_frame_grapher.lua index 17ff19c64d1..814f75e5764 100644 --- a/luaui/Widgets/dbg_frame_grapher.lua +++ b/luaui/Widgets/dbg_frame_grapher.lua @@ -5,6 +5,7 @@ local widget = widget ---@type Widget +local lastframeduration = 0 -- forward-decl: read into prevframems local lastframems -- forward-decl: read into prevframems local alpha = 0 -- forward-decl: read at file scope in a shader-params table diff --git a/luaui/Widgets/gfx_deferred_rendering_GL4.lua b/luaui/Widgets/gfx_deferred_rendering_GL4.lua index 071f2fcd730..d57fa0e314f 100644 --- a/luaui/Widgets/gfx_deferred_rendering_GL4.lua +++ b/luaui/Widgets/gfx_deferred_rendering_GL4.lua @@ -1416,8 +1416,8 @@ function widget:UnitCreated(unitID, unitDefID, teamID) eventLightSpawner("UnitCreated", unitID, unitDefID, teamID) end function widget:UnitFromFactory(unitID, unitDefID, unitTeam, factID, factDefID, userOrders) - eventLightSpawner("UnitFromFactory", unitID, unitDefID, teamID) -- i have no idea of the differences here - eventLightSpawner("UnitFromFactoryBuilder", factID, factDefID, teamID) + eventLightSpawner("UnitFromFactory", unitID, unitDefID, unitTeam) -- i have no idea of the differences here + eventLightSpawner("UnitFromFactoryBuilder", factID, factDefID, unitTeam) end function widget:UnitDestroyed(unitID, unitDefID, teamID) -- dont do piece-attached lights here! eventLightSpawner("UnitDestroyed", unitID, unitDefID, teamID) diff --git a/luaui/Widgets/gfx_distortion_gl4.lua b/luaui/Widgets/gfx_distortion_gl4.lua index c93f749396f..03ee886b9f2 100644 --- a/luaui/Widgets/gfx_distortion_gl4.lua +++ b/luaui/Widgets/gfx_distortion_gl4.lua @@ -999,8 +999,8 @@ function widget:UnitCreated(unitID, unitDefID, teamID) eventDistortionSpawner("UnitCreated", unitID, unitDefID, teamID) end function widget:UnitFromFactory(unitID, unitDefID, unitTeam, factID, factDefID, userOrders) - eventDistortionSpawner("UnitFromFactory", unitID, unitDefID, teamID) -- i have no idea of the differences here - eventDistortionSpawner("UnitFromFactoryBuilder", factID, factDefID, teamID) + eventDistortionSpawner("UnitFromFactory", unitID, unitDefID, unitTeam) -- i have no idea of the differences here + eventDistortionSpawner("UnitFromFactoryBuilder", factID, factDefID, unitTeam) end function widget:UnitDestroyed(unitID, unitDefID, teamID) -- dont do piece-attached distortions here! eventDistortionSpawner("UnitDestroyed", unitID, unitDefID, teamID) diff --git a/luaui/Widgets/gfx_norush_timer_gl4.lua b/luaui/Widgets/gfx_norush_timer_gl4.lua index ad5e32294c3..63ec4b7fc55 100644 --- a/luaui/Widgets/gfx_norush_timer_gl4.lua +++ b/luaui/Widgets/gfx_norush_timer_gl4.lua @@ -32,6 +32,7 @@ local LuaShader = gl.LuaShader local InstanceVBOTable = gl.InstanceVBOTable local minY, maxY = Spring.GetGroundExtremes() +local NUM_BOXES = 0 local shaderSourceCache = { vssrcpath = "LuaUI/Shaders/norush_timer.vert.glsl", diff --git a/luaui/Widgets/gui_advplayerslist.lua b/luaui/Widgets/gui_advplayerslist.lua index c7ffafb8c55..3ca7c465ab9 100644 --- a/luaui/Widgets/gui_advplayerslist.lua +++ b/luaui/Widgets/gui_advplayerslist.lua @@ -2026,7 +2026,7 @@ function CreateBackground() if absRight > vsx + margin then -- lazy bugfix needed when playerScale < 1 is in effect absRight = vsx + margin end - apiAbsPosition = { absTop, absLeft, absBottom, absRight, widgetScale, right, false } + apiAbsPosition = { absTop, absLeft, absBottom, absRight, widgetScale, absRight, false } local paddingBottom = bgpadding local paddingRight = bgpadding @@ -2844,6 +2844,7 @@ function DrawState(playerID, posX, posY) -- note that adv pl list uses a phantom pID for absent players, so this will always show unready for players not ingame local ready = (playerReadyState[playerID] == 1) or (playerReadyState[playerID] == 2) or (playerReadyState[playerID] == -1) local hasStartPoint = (playerReadyState[playerID] == 4) + local ai = player[playerID] and player[playerID].ai if ai then gl_Color(0.1, 0.1, 0.97, 1) else diff --git a/luaui/Widgets/gui_building_grid_gl4.lua b/luaui/Widgets/gui_building_grid_gl4.lua index 27d103009a1..78ad69c86bd 100644 --- a/luaui/Widgets/gui_building_grid_gl4.lua +++ b/luaui/Widgets/gui_building_grid_gl4.lua @@ -30,6 +30,7 @@ local config = { local waterLevel = Spring.GetWaterPlaneLevel and Spring.GetWaterPlaneLevel() or 0 local cmdShowForUnitDefID +local _, _, isSpec = Spring.GetPlayerInfo(Spring.GetMyPlayerID()) local isPregame = Spring.GetGameFrame() == 0 and not isSpec local gridVBO = nil -- the vertex buffer object, an array of vec2 coords diff --git a/luaui/Widgets/gui_flowui.lua b/luaui/Widgets/gui_flowui.lua index 1baea1438c9..4c2ebcb59cb 100644 --- a/luaui/Widgets/gui_flowui.lua +++ b/luaui/Widgets/gui_flowui.lua @@ -1120,7 +1120,7 @@ WG.FlowUI.Draw.Button = function(px, py, sx, sy, tl, tr, br, bl, ptl, ptr, pbr, -- Layer 6: White feathered inner outline glow local outlineWidth = 7 - local outlineAlpha = opaque and 0.12 or 0.06 + local outlineAlpha = opacity >= 1 and 0.12 or 0.06 WG.FlowUI.Draw.RectRoundOutline(px + pxPad, py + pyPad, sx - sxPad, sy - syPad, cs, outlineWidth, tl, tr, br, bl, { 1, 1, 1, outlineAlpha }, { 1, 1, 1, 0 }) end diff --git a/luaui/Widgets/gui_ground_ao_plates_gl4.lua b/luaui/Widgets/gui_ground_ao_plates_gl4.lua index 97ef93d6248..eb8183aaf74 100644 --- a/luaui/Widgets/gui_ground_ao_plates_gl4.lua +++ b/luaui/Widgets/gui_ground_ao_plates_gl4.lua @@ -180,7 +180,7 @@ end function widget:VisibleUnitRemoved(unitID) -- remove the corresponding ground plate if it exists if debugmode then - BAR.Debug.TraceEcho("remove", unitID, reason) + BAR.Debug.TraceEcho("remove", unitID, "VisibleUnitRemoved") end if groundPlateVBO.instanceIDtoIndex[unitID] then popElementInstance(groundPlateVBO, unitID) diff --git a/luaui/Widgets/gui_healthbars_gl4.lua b/luaui/Widgets/gui_healthbars_gl4.lua index ad3475adeb2..11fa3a87f0d 100644 --- a/luaui/Widgets/gui_healthbars_gl4.lua +++ b/luaui/Widgets/gui_healthbars_gl4.lua @@ -671,7 +671,7 @@ local function addBarForUnit(unitID, unitDefID, barname, reason) if unitDefID == nil or Spring.ValidUnitID(unitID) == false or Spring.GetUnitIsDead(unitID) == true then -- dead or invalid if debugmode then - BAR.Debug.TraceEcho("Tried to add a bar to dead/invalid/nounitdef unit", unitID, unitdefID, barname) + BAR.Debug.TraceEcho("Tried to add a bar to dead/invalid/nounitdef unit", unitID, unitDefID, barname) end return nil end diff --git a/luaui/Widgets/gui_idle_builders.lua b/luaui/Widgets/gui_idle_builders.lua index a2dac398772..6daf64b695e 100644 --- a/luaui/Widgets/gui_idle_builders.lua +++ b/luaui/Widgets/gui_idle_builders.lua @@ -229,7 +229,7 @@ local function drawContent() end local texSize = floor(iconSize * 1.33) - local zoom = i == hoveredIcon and (b and 0.15 or 0.105) or 0.05 + local zoom = i == hoveredIcon and (showStack and 0.15 or 0.105) or 0.05 local highlightOpacity = 0 if i == hoveredIcon then highlightOpacity = 0.22 diff --git a/luaui/Widgets/gui_options.lua b/luaui/Widgets/gui_options.lua index 571ec4e1b7f..8d2d6baf647 100644 --- a/luaui/Widgets/gui_options.lua +++ b/luaui/Widgets/gui_options.lua @@ -1234,9 +1234,11 @@ function widget:RecvLuaMsg(msg, playerID) end local showToggledOff = false +local isClientPaused = false local function checkPause() -- pause/unpause when the options/quitscreen interface shows - local _, _, isClientPaused, _ = Spring.GetGameState() + local _, _, currentIsClientPaused, _ = Spring.GetGameState() + isClientPaused = currentIsClientPaused if not isClientPaused then skipUnpauseOnHide = false skipUnpauseOnLobbyHide = false @@ -10652,7 +10654,7 @@ function widget:GetConfigData() currentGroupTab = currentGroupTab, show = show, waterDetected = waterDetected, - customPresets = customPresets, + customPresets = customPresetOptions, changesRequireRestart = changesRequireRestart, requireRestartDefaults = requireRestartDefaults, diff --git a/luaui/Widgets/gui_pip.lua b/luaui/Widgets/gui_pip.lua index 2689635c327..d7b0d3b4795 100644 --- a/luaui/Widgets/gui_pip.lua +++ b/luaui/Widgets/gui_pip.lua @@ -987,6 +987,7 @@ function pipTV.DirectorTick(dt) -- Before game start, stay on overview — pre-game map markers shouldn't move the camera -- Note: can't use gameHasStarted (declared later in file), so check gameFrame directly + local gameFrame = Spring.GetGameFrame() if gameFrame == 0 then local offsetX = (pipNumber or 0) * Game.mapSizeX * 0.15 local overviewX = math.min(Game.mapSizeX * 0.85, Game.mapSizeX / 2 + offsetX) @@ -997,7 +998,6 @@ function pipTV.DirectorTick(dt) -- Time factor: 0→1 over first 2 minutes (baseline) -- Activity factor: 0→1 as peak hotspot weight reaches combat levels (~10+) -- Use whichever is higher — so early fights on small maps instantly ramp up - local gameFrame = Spring.GetGameFrame() local timeFactor = math.min(1, gameFrame / (30 * 60 * 2)) -- 0→1 over 2 minutes -- Track peak activity across all current hotspots diff --git a/luaui/Widgets/gui_pregameui_draft.lua b/luaui/Widgets/gui_pregameui_draft.lua index a80713a0700..e4feda8c2d8 100644 --- a/luaui/Widgets/gui_pregameui_draft.lua +++ b/luaui/Widgets/gui_pregameui_draft.lua @@ -1,6 +1,7 @@ local widget = widget ---@type Widget local isAI = false -- forward-decl: read in DrawState +local msx, msz = Game.mapSizeX, Game.mapSizeZ -- forward-decl: read in Initialize startbox check function widget:GetInfo() return { @@ -213,7 +214,7 @@ local function DrawState(playerID, posX, posY) -- note that adv pl list uses a phantom pID for absent players, so this will always show unready for players not ingame local ready = (playerReadyState[playerID] == 1) or (playerReadyState[playerID] == 2) or (playerReadyState[playerID] == -1) local hasStartPoint = (playerReadyState[playerID] == 4) - if ai then + if isAI then gl_Color(0.1, 0.1, 0.97, 1) else if ready then diff --git a/luaui/Widgets/gui_spectator_hud.lua b/luaui/Widgets/gui_spectator_hud.lua index dc645279268..6e1c8b6fafb 100644 --- a/luaui/Widgets/gui_spectator_hud.lua +++ b/luaui/Widgets/gui_spectator_hud.lua @@ -295,7 +295,7 @@ local function buildUnitDefs() local function isArmyUnit(unitDefID, unitDef) local isArmyUnit = #unitDef.weapons > 0 and unitDef.speed > 0 - return isArmyUnit and not isCommander(unitDefId, unitDef) + return isArmyUnit and not isCommander(unitDefID, unitDef) end local function isDefenseUnit(unitDefID, unitDef) diff --git a/luaui/Widgets/map_startbox.lua b/luaui/Widgets/map_startbox.lua index 2afad084991..9f7aa46c657 100644 --- a/luaui/Widgets/map_startbox.lua +++ b/luaui/Widgets/map_startbox.lua @@ -31,6 +31,7 @@ local spGetTeamStartPosition = Spring.GetTeamStartPosition local spGetTeamRulesParam = Spring.GetTeamRulesParam local spGetGroundHeight = Spring.GetGroundHeight local glDrawGroundCircle = gl.DrawGroundCircle +local goodbye = spEcho local GL_SRC_ALPHA = GL.SRC_ALPHA local GL_ONE_MINUS_SRC_ALPHA = GL.ONE_MINUS_SRC_ALPHA diff --git a/luaui/Widgets/snd_notifications.lua b/luaui/Widgets/snd_notifications.lua index c59889d67c1..9b0d42e9f1e 100644 --- a/luaui/Widgets/snd_notifications.lua +++ b/luaui/Widgets/snd_notifications.lua @@ -1,5 +1,6 @@ local widget = widget ---@type Widget +local customNotifications -- forward-decl: read in GetConfigData export local customNotificationTimers -- forward-decl: read in GetConfigData export function widget:GetInfo() diff --git a/luaui/barwidgets.lua b/luaui/barwidgets.lua index 964a3a73d84..2f819884945 100644 --- a/luaui/barwidgets.lua +++ b/luaui/barwidgets.lua @@ -1068,7 +1068,7 @@ function widgetHandler:UpdateCallIn(name) if name == "Update" or name == "DrawScreen" then return end - if #self[listName] > 0 or not flexCallInMap[name] or (name == "GotChatMsg" and actionHandler.HaveChatAction()) or (name == "RecvFromSynced" and actionHandler.HaveSyncAction()) then + if #self[listName] > 0 or not flexCallInMap[name] or (name == "GotChatMsg" and self.actionHandler.HaveChatAction()) or (name == "RecvFromSynced" and self.actionHandler.HaveSyncAction()) then -- always assign these call-ins local selffunc = self[name] @@ -1808,7 +1808,8 @@ function widgetHandler:DrawInMiniMap(xSize, ySize) end function widgetHandler:DrawBuildSquare(unitDefID, x, z, facing, statuses) - for _, w in ripairs(self.DrawBuildSquareList) do + for i = #self.DrawBuildSquareList, 1, -1 do + local w = self.DrawBuildSquareList[i] w:DrawBuildSquare(unitDefID, x, z, facing, statuses) end return diff --git a/modules/graphics/LuaShader.lua b/modules/graphics/LuaShader.lua index 9a833dfc1e2..92aacd32b5f 100644 --- a/modules/graphics/LuaShader.lua +++ b/modules/graphics/LuaShader.lua @@ -1116,7 +1116,7 @@ local function isUpdateRequiredNoTable(uniform, u1, u2, u3, u4) if u1 and cachedValues[1] ~= u1 then update = true - cachedValues[1] = val + cachedValues[1] = u1 end if u2 and cachedValues[2] ~= u2 then update = true diff --git a/modules/graphics/instancevboidtable.lua b/modules/graphics/instancevboidtable.lua index dff12605845..38faa8527c0 100644 --- a/modules/graphics/instancevboidtable.lua +++ b/modules/graphics/instancevboidtable.lua @@ -92,7 +92,7 @@ local function makeVAOandAttach(vertexVBO, instanceVBO, indexVBO) -- Attach a ve local newVAO = nil newVAO = gl.GetVAO() if newVAO == nil then - goodbye("Failed to create newVAO") + Spring.Echo("Failed to create newVAO") end if vertexVBO == nil then -- the special case where are using 'vertices' as 'instances' newVAO:AttachVertexBuffer(instanceVBO) @@ -639,5 +639,6 @@ return { dumpAndCompareInstanceData = dumpAndCompareInstanceData, uploadAllElements = uploadAllElements, validateInstanceVBOIDTable = validateInstanceVBOIDTable, + ---@diagnostic disable-next-line: undefined-global uploadElementRange = uploadElementRange, } diff --git a/modules/graphics/instancevbotable.lua b/modules/graphics/instancevbotable.lua index 28574e06b98..bfa97ab6137 100644 --- a/modules/graphics/instancevbotable.lua +++ b/modules/graphics/instancevbotable.lua @@ -68,7 +68,7 @@ local function makeInstanceVBOTable(layout, maxElements, myName, unitIDattribID) local newVAO = nil newVAO = gl.GetVAO() if newVAO == nil then - goodbye("Failed to create newVAO") + Spring.Echo("Failed to create newVAO") end self.VAO = newVAO if vertexVBO == nil then -- the special case where are using 'vertices' as 'instances' @@ -226,7 +226,7 @@ local function makeVAOandAttach(vertexVBO, instanceVBO, indexVBO) -- Attach a ve local newVAO = nil newVAO = gl.GetVAO() if newVAO == nil then - goodbye("Failed to create newVAO") + Spring.Echo("Failed to create newVAO") end if vertexVBO == nil then -- the special case where are using 'vertices' as 'instances' newVAO:AttachVertexBuffer(instanceVBO) diff --git a/scripts/Units/armmar_lus/weapons.lua b/scripts/Units/armmar_lus/weapons.lua index fa0f87f0f5d..874aa15bfb1 100644 --- a/scripts/Units/armmar_lus/weapons.lua +++ b/scripts/Units/armmar_lus/weapons.lua @@ -1,3 +1,5 @@ +---@diagnostic disable: undefined-global + function DrawWeapon(id) Turn(torso, 2, ang(0), ang(300.00)) Turn(luparm, 1, ang(0), ang(300.000000)) diff --git a/scripts/headers/common_includes_lus.lua b/scripts/headers/common_includes_lus.lua index 53a71e9d2be..a47f42b00a1 100644 --- a/scripts/headers/common_includes_lus.lua +++ b/scripts/headers/common_includes_lus.lua @@ -1,3 +1,5 @@ +---@diagnostic disable: undefined-global + common = { CustomEmitter = function(pieceName, effectName) diff --git a/scripts/include/walk.lua b/scripts/include/walk.lua index 1458d1fe96e..28fc49dabce 100644 --- a/scripts/include/walk.lua +++ b/scripts/include/walk.lua @@ -114,6 +114,7 @@ function poser() end end +---@diagnostic disable: undefined-global function StandStance() Sleep(200) Move(cod, y_axis, 0, now)