From 96b41b66623897ff59b11288efbe542034ed74af Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 10 Nov 2026 02:24:25 +0900 Subject: [PATCH] func --- exp_scenario/module/control/vlayer.lua | 58 +++++++++++++------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/exp_scenario/module/control/vlayer.lua b/exp_scenario/module/control/vlayer.lua index 30f3160c..f2e442c7 100644 --- a/exp_scenario/module/control/vlayer.lua +++ b/exp_scenario/module/control/vlayer.lua @@ -159,6 +159,35 @@ allowed_items["landfill"] = { local vlayer_data = { } +local function default_surface(surface_index) + if vlayer_data[surface_index] then + return + end + + vlayer_data[surface_index] = { + interfaces = { + energy = {}, + circuit = {}, + storage_input = {}, + storage_output = {}, + }, + properties = { + total_surface_area = 0, + used_surface_area = 0, + total_production = 0, + production = 0, + input_limit = 0, + output_limit = 0, + capacity = 0, + }, + storage = { + items = {}, + unallocated = {}, + energy = 0, + } + } +end + default_surface(1) Storage.register(vlayer_data, function(tbl) @@ -700,35 +729,6 @@ local function handle_energy_interfaces() end end -local function default_surface(surface_index) - if vlayer_data[surface_index] then - return - end - - vlayer_data[surface_index] = { - interfaces = { - energy = {}, - circuit = {}, - storage_input = {}, - storage_output = {}, - }, - properties = { - total_surface_area = 0, - used_surface_area = 0, - total_production = 0, - production = 0, - input_limit = 0, - output_limit = 0, - capacity = 0, - }, - storage = { - items = {}, - unallocated = {}, - energy = 0, - } - } -end - local function update_surface(event) -- global surface will have its data point to the main surface if config.global_surface then