feat(lagre): tabel med kolonner for bygningsstatistik + gitter for gårdens beholdning, egen tooltip; brugermanual på dansk og engelsk (v1.15.2.0)

This commit is contained in:
2026-09-24 02:11:45 +02:00
parent 31168b895a
commit a11c8e46df
12 changed files with 714 additions and 57 deletions
+25
View File
@@ -65,3 +65,28 @@ function ADStorageStats.splitTroughConsumption(perDay, levels, weights)
if best ~= nil then result[best] = perDay end
return result
end
-- Deler en liste i rækker á `size` celler (gitter i fanen Lagre). Tom liste giver én tom række,
-- så bygningen stadig får sin navnerække.
function ADStorageStats.chunk(list, size)
local rows, current = {}, {}
for _, value in ipairs(list or {}) do
table.insert(current, value)
if #current == size then
table.insert(rows, current)
current = {}
end
end
if #current > 0 or #rows == 0 then
table.insert(rows, current)
end
return rows
end
-- "-14.4k +3.6k": forbrug med minus, produktion med plus pr. døgn; intet = "-".
function ADStorageStats.rateText(consumption, production, format)
local parts = {}
if (consumption or 0) > 0 then table.insert(parts, "-" .. format(consumption)) end
if (production or 0) > 0 then table.insert(parts, "+" .. format(production)) end
return #parts > 0 and table.concat(parts, " ") or "-"
end