This commit is contained in:
phidias authored and GitHub committed 2026-11-12 21:19:40 +09:00
1 parent 6fe044b171
commit 80ec53b93b
4 files changed
+31 -27

No files matched your search

+25 -21
View File
@@ -41,7 +41,7 @@ end
--- Statistics shown as progress bars, in display order --- Statistics shown as progress bars, in display order
--- @type { name: string, caption: LocalisedString, tooltip: LocalisedString }[] --- @type { name: string, caption: LocalisedString, tooltip: LocalisedString }[]
local stats = {} local stats = {}
for _, name in ipairs{ "production", "capacity", "sustained", "surface-area" } do for _, name in ipairs{ "production", "sustained", "capacity", "surface-area" } do
stats[#stats + 1] = { stats[#stats + 1] = {
name = name, name = name,
caption = { "exp-gui_vlayer.caption-stat-" .. name }, caption = { "exp-gui_vlayer.caption-stat-" .. name },
@@ -155,26 +155,42 @@ function Elements.stats_table.calculate_display_data(s_index)
local statistics = Vlayer.get_statistics(s_index) local statistics = Vlayer.get_statistics(s_index)
local items = Vlayer.get_items(s_index) local items = Vlayer.get_items(s_index)
local allocated = Vlayer.get_allocated_items(s_index) local allocated = Vlayer.get_allocated_items(s_index)
local en_prod = ceil(statistics.energy_production) local energy_production = ceil(statistics.energy_production)
local sustained = ceil(statistics.energy_sustained) / max(statistics.energy_total_production, 1) local energy_max = ceil(statistics.energy_max)
local production = en_prod / max(ceil(statistics.energy_max), 1) local energy_sustained = ceil(statistics.energy_sustained)
local limit_production = min(statistics.energy_input_limit, energy_production)
local production = limit_production / max(energy_max, 1)
local limit_sustained = min(statistics.energy_input_limit, energy_sustained)
local sustained = lim_sus / max(statistics.energy_total_production, 1)
local capacity = statistics.energy_storage / max(statistics.energy_capacity, 1) local capacity = statistics.energy_storage / max(statistics.energy_capacity, 1)
local limit = min(statistics.energy_input_limit, en_prod)
local surface_area = statistics.remaining_surface_area / max(statistics.total_surface_area, 1) local surface_area = statistics.remaining_surface_area / max(statistics.total_surface_area, 1)
return { return {
production = { production = {
value = production, value = production,
caption = format_string( caption = format_string(
"%s ~ %s / %s", "%s (%s) / %s",
format_energy(limit, "W"), format_energy(energy_production, "W"),
format_energy(statistics.energy_production, "W"), format_energy(limit_production, "W"),
format_energy(statistics.energy_max, "W") format_energy(energy_max, "W")
), ),
tooltip = format_string( tooltip = format_string(
"%.1f %%", "%.1f %%",
production * 100 production * 100
), ),
}, },
sustained = {
value = sustained,
caption = format_string(
"%s (%s) / %s",
format_energy(energy_sustained, "W"),
format_energy(limit_sustained, "W"),
format_energy(statistics.energy_total_production, "W")
),
tooltip = format_string(
"%.1f %%",
sustained * 100
),
},
capacity = { capacity = {
value = capacity, value = capacity,
caption = format_string( caption = format_string(
@@ -187,18 +203,6 @@ function Elements.stats_table.calculate_display_data(s_index)
capacity * 100 capacity * 100
), ),
}, },
sustained = {
value = sustained,
caption = format_string(
"%s / %s",
format_energy(statistics.energy_sustained, "W"),
format_energy(statistics.energy_total_production, "W")
),
tooltip = format_string(
"%.1f %%",
sustained * 100
),
},
["surface-area"] = { ["surface-area"] = {
value = min(max(surface_area / 0.1, 0), 1), value = min(max(surface_area / 0.1, 0), 1),
caption = format_number( caption = format_number(
+2 -2
View File
@@ -472,10 +472,10 @@ tooltip-main=Virtual Layer
selection-name=vlayer selection-name=vlayer
caption-stat-production=[virtual-signal=signal-P] Current Production caption-stat-production=[virtual-signal=signal-P] Current Production
tooltip-stat-production=Power production right now, out of the production in full daylight tooltip-stat-production=Power production right now, out of the production in full daylight
caption-stat-capacity=[virtual-signal=signal-E] Battery Charge
tooltip-stat-capacity=Stored energy out of the accumulator capacity
caption-stat-sustained=[virtual-signal=signal-S] Sustained Production caption-stat-sustained=[virtual-signal=signal-S] Sustained Production
tooltip-stat-sustained=Power production averaged over a day, out of what every stored solar panel could give tooltip-stat-sustained=Power production averaged over a day, out of what every stored solar panel could give
caption-stat-capacity=[virtual-signal=signal-E] Battery Charge
tooltip-stat-capacity=Stored energy out of the accumulator capacity
caption-stat-surface-area=[virtual-signal=signal-R] Remaining Surface caption-stat-surface-area=[virtual-signal=signal-R] Remaining Surface
tooltip-stat-surface-area=Remaining surface area, insert landfill to increase it tooltip-stat-surface-area=Remaining surface area, insert landfill to increase it
type-energy=Energy type-energy=Energy
+2 -2
View File
@@ -491,10 +491,10 @@ tooltip-main=Vlayer 介面
selection-name=vlayer selection-name=vlayer
caption-stat-production=[virtual-signal=signal-P] 現時產能 caption-stat-production=[virtual-signal=signal-P] 現時產能
tooltip-stat-production=現時電力產能 tooltip-stat-production=現時電力產能
caption-stat-capacity=[virtual-signal=signal-E] 電池電量
tooltip-stat-capacity=現時電池電量 / 電池最大容量
caption-stat-sustained=[virtual-signal=signal-S] 持續產能 caption-stat-sustained=[virtual-signal=signal-S] 持續產能
tooltip-stat-sustained=持續電力產能 tooltip-stat-sustained=持續電力產能
caption-stat-capacity=[virtual-signal=signal-E] 電池電量
tooltip-stat-capacity=現時電池電量 / 電池最大容量
caption-stat-surface-area=[virtual-signal=signal-R] 餘下土地 caption-stat-surface-area=[virtual-signal=signal-R] 餘下土地
tooltip-stat-surface-area=餘下土地。 放入堆填來增加 tooltip-stat-surface-area=餘下土地。 放入堆填來增加
type-energy=電力 type-energy=電力
+2 -2
View File
@@ -491,10 +491,10 @@ tooltip-main=Vlayer 介面
selection-name=vlayer selection-name=vlayer
caption-stat-production=[virtual-signal=signal-P] 現時產能 caption-stat-production=[virtual-signal=signal-P] 現時產能
tooltip-stat-production=現時電力產能 tooltip-stat-production=現時電力產能
caption-stat-capacity=[virtual-signal=signal-E] 電池電量
tooltip-stat-capacity=現時電池電量 / 電池最大容量
caption-stat-sustained=[virtual-signal=signal-S] 持續產能 caption-stat-sustained=[virtual-signal=signal-S] 持續產能
tooltip-stat-sustained=持續電力產能 tooltip-stat-sustained=持續電力產能
caption-stat-capacity=[virtual-signal=signal-E] 電池電量
tooltip-stat-capacity=現時電池電量 / 電池最大容量
caption-stat-surface-area=[virtual-signal=signal-R] 餘下土地 caption-stat-surface-area=[virtual-signal=signal-R] 餘下土地
tooltip-stat-surface-area=餘下土地。 放入堆填來增加 tooltip-stat-surface-area=餘下土地。 放入堆填來增加
type-energy=電力 type-energy=電力