From b50f0ffff5b11cee43902941873e62a7cc805582 Mon Sep 17 00:00:00 2001 From: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> Date: Tue, 31 Dec 2024 18:57:27 +0000 Subject: [PATCH 1/5] Fix Rocket Control --- exp_legacy/module/modules/control/rockets.lua | 66 +++++++++---------- exp_legacy/module/modules/gui/rocket-info.lua | 21 +++--- 2 files changed, 41 insertions(+), 46 deletions(-) diff --git a/exp_legacy/module/modules/control/rockets.lua b/exp_legacy/module/modules/control/rockets.lua index 528a4363..d6fca7c5 100644 --- a/exp_legacy/module/modules/control/rockets.lua +++ b/exp_legacy/module/modules/control/rockets.lua @@ -59,8 +59,8 @@ Storage.register({ end) --- Gets the silo data for a given silo entity --- @tparam LuaEntity silo the rocket silo entity --- @treturn table the data table for this silo, contains rockets launch, silo status, and its force +--- @param silo LuaEntity Rocket silo entity +--- @return table # Data table for this silo, contains rockets launch, silo status, and its force function Rockets.get_silo_data(silo) local position = silo.position local silo_name = math.floor(position.x) .. ":" .. math.floor(position.y) @@ -68,30 +68,30 @@ function Rockets.get_silo_data(silo) end --- Gets the silo data for a given silo entity --- @tparam string silo_name the silo name that is stored in its data --- @treturn table the data table for this silo, contains rockets launch, silo status, and its force +--- @param silo_name string Silo name that is stored in its data +--- @return table # Data table for this silo, contains rockets launch, silo status, and its force function Rockets.get_silo_data_by_name(silo_name) return rocket_silos[silo_name] end --- Gets the silo entity from its silo name, reverse to get_silo_data --- @tparam string silo_name the silo name that is stored in its data --- @treturn LuaEntity the rocket silo entity +--- @param silo_name string Silo name that is stored in its data +--- @return LuaEntity # Rocket silo entity function Rockets.get_silo_entity(silo_name) local data = rocket_silos[silo_name] return data.entity end --- Gets the rocket stats for a force --- @tparam string force_name the name of the force to get the stats for --- @treturn table the table of stats for the force +--- @param force_name string Name of the force to get the stats for +--- @return table # Stats for the force function Rockets.get_stats(force_name) return rocket_stats[force_name] or {} end --- Gets all the rocket silos that belong to a force --- @tparam string force_name the name of the force to get the silos for --- @treturn table an array of silo data that all belong to this force +--- @param force_name string Name of the force to get the silos for +--- @return table # Array of silo data that all belong to this force function Rockets.get_silos(force_name) local rtn = {} for _, silo_data in pairs(rocket_silos) do @@ -104,23 +104,23 @@ function Rockets.get_silos(force_name) end --- Gets the launch time of a given rocket, due to cleaning not all counts are valid --- @tparam string force_name the name of the force to get the count for --- @tparam number rocket_number the number of the rocket to get the launch time for --- @treturn number the game tick that the rocket was lanuched on +--- @param force_name string Name of the force to get the count for +--- @param rocket_number number Number of the rocket to get the launch time for +--- @return number? # Game tick that the rocket was launched on function Rockets.get_rocket_time(force_name, rocket_number) return rocket_times[force_name] and rocket_times[force_name][rocket_number] or nil end --- Gets the number of rockets that a force has launched --- @tparam string force_name the name of the force to get the count for --- @treturn number the number of rockets that the force has launched +--- @param force_name string the name of the force to get the count for +--- @return number # Number of rockets that the force has launched function Rockets.get_rocket_count(force_name) local force = game.forces[force_name] return force.rockets_launched end --- Gets the total number of rockets launched by all forces --- @treturn number the total number of rockets launched this game +--- @return number # Total number of rockets launched this game function Rockets.get_game_rocket_count() local rtn = 0 for _, force in pairs(game.forces) do @@ -131,9 +131,9 @@ function Rockets.get_game_rocket_count() end --- Gets the rolling average time to launch a rocket --- @tparam string force_name the name of the force to get the average for --- @tparam number count the distance to get the rolling average over --- @treturn number the number of ticks required to launch one rocket +--- @param force_name string Name of the force to get the average for +--- @param count number Distance to get the rolling average over +--- @return number # Number of ticks required to launch one rocket function Rockets.get_rolling_average(force_name, count) local force = game.forces[force_name] local rocket_count = force.rockets_launched @@ -147,14 +147,20 @@ function Rockets.get_rolling_average(force_name, count) return math.floor((last_launch_time - start_rocket_time) / rocket_count) end +--- When a launch is trigger it will wait for the silo to reset +--- @param event EventData.on_rocket_launch_ordered +Event.add(defines.events.on_rocket_launch_ordered, function(event) + local silo_data = Rockets.get_silo_data(event.rocket_silo) + silo_data.launched = silo_data.launched + 1 + silo_data.awaiting_reset = true +end) + --- Event used to update the stats and the hui when a rocket is launched ---- @param event EventData.on_rocket_launched -Event.add(defines.events.on_rocket_launched, function(event) - local entity = event.rocket_silo - local silo_data = Rockets.get_silo_data(entity) - local force = event.rocket_silo.force +--- @param event EventData.on_cargo_pod_finished_ascending +Event.add(defines.events.on_cargo_pod_finished_ascending, function(event) + local force = event.cargo_pod.force local force_name = force.name - local rockets_launched = force.rockets_launched + 1 -- Hasn't updated when this event fires + local rockets_launched = force.rockets_launched --- Handles updates to the rocket stats local stats = rocket_stats[force_name] @@ -183,16 +189,6 @@ Event.add(defines.events.on_rocket_launched, function(event) if remove_rocket > 0 and not table.contains(config.milestones, remove_rocket) then rocket_times[force_name][remove_rocket] = nil end - - --- Adds this 1 to the launch count for this silo - silo_data.launched = silo_data.launched + 1 -end) - ---- When a launch is reiggered it will await reset -Event.add(defines.events.on_rocket_launch_ordered, function(event) - local entity = event.rocket_silo - local silo_data = Rockets.get_silo_data(entity) - silo_data.awaiting_reset = true end) --- Adds a silo to the list when it is built diff --git a/exp_legacy/module/modules/gui/rocket-info.lua b/exp_legacy/module/modules/gui/rocket-info.lua index f7d452a4..3be8db3f 100644 --- a/exp_legacy/module/modules/gui/rocket-info.lua +++ b/exp_legacy/module/modules/gui/rocket-info.lua @@ -140,12 +140,13 @@ local rocket_entry = -- Add the toggle auto launch if the player is allowed it -- Auto launch was removed from the api and no 2.0 equivalent was added -- https://forums.factorio.com/viewtopic.php?f=28&t=118065&p=656502 - --[[if check_player_permissions(player, "toggle_active") then - local flow = parent.add{ type = "flow", name = "toggle-" .. silo_name } + if check_player_permissions(player, "toggle_active") then + parent.add{ type = "flow" } + --[[local flow = parent.add{ type = "flow", name = "toggle-" .. silo_name } local button = toggle_launch(flow) button.tooltip = silo_data.toggle_tooltip - button.sprite = silo_data.toggle_sprite - end]] + button.sprite = silo_data.toggle_sprite]] + end -- Add the remote launch if the player is allowed it if check_player_permissions(player, "remote_launch") then @@ -544,9 +545,9 @@ local function update_rocket_gui_all(force_name) end --- Event used to update the stats when a rocket is launched -Event.add(defines.events.on_rocket_launched, function(event) - local force = event.rocket_silo.force - update_rocket_gui_all(force.name) +--- @param event EventData.on_cargo_pod_finished_ascending +Event.add(defines.events.on_cargo_pod_finished_ascending, function(event) + update_rocket_gui_all(event.cargo_pod.force.name) end) --- Update only the progress gui for a force @@ -560,11 +561,9 @@ local function update_rocket_gui_progress(force_name) end --- Event used to set a rocket silo to be awaiting reset +--- @param event EventData.on_rocket_launch_ordered Event.add(defines.events.on_rocket_launch_ordered, function(event) - local silo = event.rocket_silo - local silo_data = Rockets.get_silo_data(silo) - silo_data.awaiting_reset = true - update_rocket_gui_progress(silo.force.name) + update_rocket_gui_progress(event.rocket_silo.force.name) end) Event.on_nth_tick(150, function() From 2e2e7c8518c589de3d4b9e812dd2f738f88d64f1 Mon Sep 17 00:00:00 2001 From: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> Date: Tue, 31 Dec 2024 18:57:54 +0000 Subject: [PATCH 2/5] Fix types on item transfer --- exp_util/module/module_exports.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exp_util/module/module_exports.lua b/exp_util/module/module_exports.lua index 159ccaad..d9638d98 100644 --- a/exp_util/module/module_exports.lua +++ b/exp_util/module/module_exports.lua @@ -451,6 +451,7 @@ end --- @class Common.copy_items_to_surface_param: Common.get_or_create_storage_param --- @field items ItemStackIdentification[] | LuaInventory The item stacks to copy +--- @field item ItemStackIdentification? Overwritten internally --- Insert a copy of the given items into the found entities. If no entities are found then they will be created if possible. --- @param options Common.copy_items_to_surface_param @@ -467,6 +468,7 @@ end --- @class Common.move_items_to_surface_param: Common.get_or_create_storage_param --- @field items LuaItemStack[] The item stacks to move +--- @field item ItemStackIdentification? Overwritten internally --- Insert a copy of the given items into the found entities. If no entities are found then they will be created if possible. --- @param options Common.move_items_to_surface_param @@ -484,6 +486,7 @@ end --- @class Common.transfer_inventory_to_surface_param: Common.copy_items_to_surface_param --- @field inventory LuaInventory The inventory to transfer +--- @field items (ItemStackIdentification[] | LuaInventory)? Overwritten internally --- Move the given inventory into the found entities. If no entities are found then they will be created if possible. --- @param options Common.transfer_inventory_to_surface_param From 83deb568bf2cce654aada77531c82c813378a635 Mon Sep 17 00:00:00 2001 From: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> Date: Tue, 31 Dec 2024 19:02:50 +0000 Subject: [PATCH 3/5] Fix exp_commands logging --- exp_commands/module/module_exports.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exp_commands/module/module_exports.lua b/exp_commands/module/module_exports.lua index 206d1e5c..a58e8c04 100644 --- a/exp_commands/module/module_exports.lua +++ b/exp_commands/module/module_exports.lua @@ -164,7 +164,7 @@ Commands.server = setmetatable({ --- @param msg LocalisedString? An optional message to be included when a command completes (only has an effect in command callbacks) --- @return Commands.Status, LocalisedString # Should be returned directly without modification function Commands.status.success(msg) - return Commands.status.success, msg or { "exp-commands.success" } + return Commands.status.success, msg == nil and { "exp-commands.success" } or msg end --- Used to signal an error has occurred in a command, data type parser, or permission authority @@ -172,7 +172,7 @@ end --- @param msg LocalisedString? An optional error message to be included in the output, a generic message is used if not provided --- @return Commands.Status, LocalisedString # Should be returned directly without modification function Commands.status.error(msg) - return Commands.status.error, { "exp-commands.error", msg or { "exp-commands.error-default" } } + return Commands.status.error, { "exp-commands.error", msg == nil and { "exp-commands.error-default" } or msg } end --- Used to signal the player is unauthorised to use a command, primarily used by permission authorities but can be used in a command callback @@ -180,7 +180,7 @@ end --- @param msg LocalisedString? An optional error message to be included in the output, a generic message is used if not provided --- @return Commands.Status, LocalisedString # Should be returned directly without modification function Commands.status.unauthorised(msg) - return Commands.status.unauthorised, msg or { "exp-commands.unauthorized", msg or { "exp-commands.unauthorized-default" } } + return Commands.status.unauthorised, { "exp-commands.unauthorized", msg == nil and { "exp-commands.unauthorized-default" } or msg } end --- Used to signal the player provided invalid input to an command, primarily used by data type parsers but can be used in a command callback @@ -188,7 +188,7 @@ end --- @param msg LocalisedString? An optional error message to be included in the output, a generic message is used if not provided --- @return Commands.Status, LocalisedString # Should be returned directly without modification function Commands.status.invalid_input(msg) - return Commands.status.invalid_input, msg or { "exp-commands.invalid-input" } + return Commands.status.invalid_input, msg == nil and { "exp-commands.invalid-input" } or msg end --- Used to signal an internal error has occurred, this is reserved for internal use only @@ -702,7 +702,7 @@ function Commands._event_handler(event) -- Parse the raw argument to get the correct data type local success, status, parsed = Commands.parse_input(input, player, argument.input_parser) if success == false then - log_command("Input parse failed", command, player, event.parameter, { status = valid_command_status[status], index = index, argument = argument, reason = parsed }) + log_command("Input parse failed", command, player, event.parameter, { status = valid_command_status[status], index = index, argument = argument.name, reason = parsed }) return Commands.error{ "exp-commands.invalid-argument", argument.name, parsed } else arguments[index] = parsed From 61888d65151f90f832745144d92fffdcab628004 Mon Sep 17 00:00:00 2001 From: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> Date: Tue, 31 Dec 2024 19:06:56 +0000 Subject: [PATCH 4/5] Added missing asserts to external interface --- exp_legacy/module/expcore/external.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_legacy/module/expcore/external.lua b/exp_legacy/module/expcore/external.lua index e5e7b6dc..d37129e0 100644 --- a/exp_legacy/module/expcore/external.lua +++ b/exp_legacy/module/expcore/external.lua @@ -83,7 +83,7 @@ function External.get_current_server() assert(ext, "No external data was found, use External.valid() to ensure external data exists.") local servers = assert(ext.servers, "No server list was found, please ensure that the external service is running") local server_id = assert(ext.current, "No current id was found, please ensure that the external service is running") - return servers[server_id] + return assert(servers[server_id], "No details found for server with id: " .. tostring(server_id)) end --[[-- Gets the details of the given server @@ -97,7 +97,7 @@ local server = External.get_server_details('eu-01') function External.get_server_details(server_id) assert(ext, "No external data was found, use External.valid() to ensure external data exists.") local servers = assert(ext.servers, "No server list was found, please ensure that the external service is running") - return servers[server_id] + return assert(servers[server_id], "No details found for server with id: " .. tostring(server_id)) end --[[-- Gets the status of the given server @@ -113,7 +113,7 @@ function External.get_server_status(server_id, raw) assert(var, "No external data was found, use External.valid() to ensure external data exists.") local servers = assert(var.status, "No server status was found, please ensure that the external service is running") local current = assert(ext.current, "No current id was found, please ensure that the external service is running") - return not raw and server_id == current and "Current" or servers[server_id] + return not raw and server_id == current and "Current" or assert(servers[server_id], "No status found for server with id: " .. tostring(server_id)) end --[[-- Gets the ups of the current server From b31caf6c85269aa179ac01860cc186f4fbde1f2b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 1 Jan 2025 04:15:48 +0900 Subject: [PATCH 5/5] Add surface area bar to vlayer (#336) * Update vlayer.lua * Update vlayer.lua * Update vlayer.lua * Update vlayer.lua * Update vlayer.lua --- exp_legacy/module/config/vlayer.lua | 57 +++++++++++--------- exp_legacy/module/modules/control/vlayer.lua | 28 ++++++++-- exp_legacy/module/modules/gui/vlayer.lua | 42 ++++++++------- 3 files changed, 78 insertions(+), 49 deletions(-) diff --git a/exp_legacy/module/config/vlayer.lua b/exp_legacy/module/config/vlayer.lua index d3355c6b..602a6188 100644 --- a/exp_legacy/module/config/vlayer.lua +++ b/exp_legacy/module/config/vlayer.lua @@ -15,7 +15,7 @@ return { always_day = false, solar_power_multiplier = 1, min_brightness = 0.15, - ticks_per_day = 25000, + ticks_per_day = 25200, daytime = 0, dusk = 0.25, evening = 0.45, @@ -25,20 +25,20 @@ return { interface_limit = { --- @setting interface_limit Sets the limit for the number of vlayer interfaces that can be created energy = 1, -- >1 allows for disconnected power networks to receive power - circuit = 10, -- No caveats - storage_input = 10, -- No caveats + circuit = 20, -- No caveats + storage_input = 20, -- No caveats storage_output = 1, -- >0 allows for item teleportation (allowed_items only) }, allowed_items = { --- @setting allowed_items List of all items allowed in vlayer storage and their properties --[[ Allowed properties: - starting_value = 0: The amount of the item placed into the vlayer on game start, ignores area requirements - required_area = 0: When greater than 0 the items properties are not applied unless their is sufficient surplus surface area - production = 0: The energy production of the item in MW, used for solar panels - discharge = 0: The energy discharge of the item in MW, used for accumulators - capacity = 0: The energy capacity of the item in MJ, used for accumulators - surface_area = 0: The surface area provided by the item, used for landfill + starting_value : The amount of the item placed into the vlayer on game start, ignores area requirements + required_area : When greater than 0 the items properties are not applied unless their is sufficient surplus surface area + production : The energy production of the item in MW, used for solar panels + discharge : The energy discharge of the item in MW, used for accumulators + capacity : The energy capacity of the item in MJ, used for accumulators + surface_area : The surface area provided by the item, used for landfill ]] ["solar-panel"] = { starting_value = 0, @@ -54,7 +54,7 @@ return { ["landfill"] = { starting_value = 0, required_area = 0, - surface_area = 6, -- Tiles + surface_area = 8, -- Tiles }, ["wood"] = { starting_value = 0, @@ -70,31 +70,40 @@ return { fuel_value = 4, -- MJ power = false, -- turn all coal to power to reduce trash }, + ["solid-fuel"] = { + starting_value = 0, + required_area = 0, + surface_area = 0, + fuel_value = 12, -- MJ + power = false, -- turn all solid fuel to power to reduce trash + }, + ["rocket-fuel"] = { + starting_value = 0, + required_area = 0, + surface_area = 0, + fuel_value = 100, -- MJ + power = false, -- turn all rocket fuel to power to reduce trash + } --[[ - ['iron-ore'] = { + ["iron-ore"] = { starting_value = 0, required_area = 0, - surface_area = 0 + surface_area = 0, }, - ['copper-ore'] = { + ["copper-ore"] = { starting_value = 0, required_area = 0, - surface_area = 0 + surface_area = 0, }, - ['coal'] = { + ["stone"] = { starting_value = 0, required_area = 0, - surface_area = 0 + surface_area = 0, }, - ['stone'] = { + ["uranium-ore"] = { starting_value = 0, required_area = 0, - surface_area = 0 - }, - ['uranium-ore'] = { - starting_value = 0, - required_area = 0, - surface_area = 0 + surface_area = 0, }, ]] }, @@ -170,5 +179,5 @@ return { base_game_equivalent = "accumulator", multiplier = 16384, }, - }, + } } diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index 6533a17b..c63a3e41 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -22,6 +22,7 @@ local vlayer_data = { properties = { total_surface_area = 0, used_surface_area = 0, + total_production = 0, production = 0, discharge = 0, capacity = 0, @@ -155,7 +156,7 @@ local function get_production_multiplier() end if surface.darkness then - -- We are using a real surface, our config does not contain 'darkness' + -- We are using a real surface, our config does not contain "darkness" local brightness = 1 - surface.darkness if brightness >= surface.min_brightness then @@ -212,7 +213,9 @@ function vlayer.allocate_item(item_name, count) assert(item_properties, "Item not allowed in vlayer: " .. tostring(item_name)) if item_properties.production then - vlayer_data.properties.production = vlayer_data.properties.production + item_properties.production * count + local nc = item_properties.production * count + vlayer_data.properties.production = vlayer_data.properties.production + nc + vlayer_data.properties.total_production = vlayer_data.properties.total_production + nc end if item_properties.capacity then @@ -232,6 +235,14 @@ function vlayer.allocate_item(item_name, count) end end +function vlayer.unable_alloc_item_pwr_calc(item_name, count) + local item_properties = config.allowed_items[item_name] + + if item_properties.production then + vlayer_data.properties.total_production = vlayer_data.properties.total_production + item_properties.production * count + end +end + -- For all allowed items, setup their starting values, default 0 for item_name, properties in pairs(config.allowed_items) do vlayer_data.storage.items[item_name] = properties.starting_value or 0 @@ -260,7 +271,9 @@ function vlayer.insert_item(item_name, count) vlayer.allocate_item(item_name, allocate_count) end - vlayer_data.storage.unallocated[item_name] = vlayer_data.storage.unallocated[item_name] + count - allocate_count + local unallocated = count - allocate_count + vlayer_data.storage.unallocated[item_name] = vlayer_data.storage.unallocated[item_name] + unallocated + vlayer.unable_alloc_item_pwr_calc(item_name, unallocated) else vlayer.allocate_item(item_name, count) end @@ -456,6 +469,7 @@ local function handle_unallocated() if allocation_count > 0 then vlayer_data.storage.unallocated[item_name] = vlayer_data.storage.unallocated[item_name] - allocation_count vlayer.allocate_item(item_name, allocation_count) + vlayer.unable_alloc_item_pwr_calc(item_name, -allocation_count) end end end @@ -464,15 +478,19 @@ end function vlayer.get_statistics() local vdp = vlayer_data.properties.production * mega local gdm = get_production_multiplier() + local gsm = get_sustained_multiplier() + local gald = get_actual_land_defecit() return { total_surface_area = vlayer_data.properties.total_surface_area, used_surface_area = vlayer_data.properties.used_surface_area, - remaining_surface_area = get_actual_land_defecit(), + remaining_surface_area = gald, + surface_area = vlayer_data.properties.total_surface_area - gald, production_multiplier = gdm, energy_max = vdp, energy_production = vdp * gdm, - energy_sustained = vdp * get_sustained_multiplier(), + energy_total_production = vlayer_data.properties.total_production * gsm * mega, + energy_sustained = vdp * gsm, energy_capacity = vlayer_data.properties.capacity * mega, energy_storage = vlayer_data.storage.energy, day_time = math.floor(vlayer_data.surface.daytime * vlayer_data.surface.ticks_per_day), diff --git a/exp_legacy/module/modules/gui/vlayer.lua b/exp_legacy/module/modules/gui/vlayer.lua index 43304337..a99860bb 100644 --- a/exp_legacy/module/modules/gui/vlayer.lua +++ b/exp_legacy/module/modules/gui/vlayer.lua @@ -177,9 +177,9 @@ local vlayer_gui_display_item_accumulator_count = font = "heading-2", } ---- Display label for the remaining surface area --- @element vlayer_gui_display_signal_remaining_surface_area_name -local vlayer_gui_display_signal_remaining_surface_area_name = +--- Display label for the surface area +-- @element vlayer_gui_display_signal_surface_area_name +local vlayer_gui_display_signal_surface_area_name = Gui.element{ type = "label", name = "vlayer_display_signal_remaining_surface_area_name", @@ -190,16 +190,16 @@ local vlayer_gui_display_signal_remaining_surface_area_name = width = 200, } -local vlayer_gui_display_signal_remaining_surface_area_count = +local vlayer_gui_display_signal_surface_area_count = Gui.element{ - type = "label", - name = "vlayer_display_signal_remaining_surface_area_count", - caption = "0", - style = "heading_2_label", + type = "progressbar", + name = "vlayer_display_signal_surface_area_count", + caption = "", + value = 0, + style = "electric_satisfaction_statistics_progressbar", }:style{ width = 200, - height = 28, - horizontal_align = "right", + font = "heading-2", } --- Display label for the sustained energy production @@ -217,14 +217,14 @@ local vlayer_gui_display_signal_sustained_name = local vlayer_gui_display_signal_sustained_count = Gui.element{ - type = "label", + type = "progressbar", name = "vlayer_display_signal_sustained_count", - caption = "0", - style = "heading_2_label", + caption = "", + value = 0, + style = "electric_satisfaction_statistics_progressbar", }:style{ width = 200, - height = 28, - horizontal_align = "right", + font = "heading-2", } --- Display label for the current energy production @@ -288,8 +288,8 @@ local vlayer_display_set = vlayer_gui_display_item_solar_count(disp) vlayer_gui_display_item_accumulator_name(disp) vlayer_gui_display_item_accumulator_count(disp) - vlayer_gui_display_signal_remaining_surface_area_name(disp) - vlayer_gui_display_signal_remaining_surface_area_count(disp) + vlayer_gui_display_signal_surface_area_name(disp) + vlayer_gui_display_signal_surface_area_count(disp) vlayer_gui_display_signal_sustained_name(disp) vlayer_gui_display_signal_sustained_count(disp) vlayer_gui_display_signal_production_name(disp) @@ -489,11 +489,13 @@ Event.on_nth_tick(config.update_tick_gui, function(_) val = (items_alloc["accumulator"] / math.max(items["accumulator"], 1)), cap = format_number(items_alloc["accumulator"], false) .. " / " .. format_number(items["accumulator"], false), }, - [vlayer_gui_display_signal_remaining_surface_area_count.name] = { - cap = format_number(stats.remaining_surface_area, false), + [vlayer_gui_display_signal_surface_area_count.name] = { + val = (stats.total_surface_area / math.max(stats.surface_area, 1)), + cap = format_number(stats.remaining_surface_area) }, [vlayer_gui_display_signal_sustained_count.name] = { - cap = format_energy(stats.energy_sustained, "W"), + val = (stats.energy_sustained / math.max(stats.energy_total_production, 1)), + cap = format_energy(stats.energy_sustained, "W") .. " / " .. format_energy(stats.energy_total_production, "W") }, [vlayer_gui_display_signal_production_count.name] = { val = (stats.energy_production / math.max(stats.energy_max, 1)),