mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-11 15:54:52 +09:00
.
This commit is contained in:
1 parent
1e395f5893
commit
5166c35bf7
1 file changed
+32
-24
@@ -159,6 +159,8 @@ allowed_items["landfill"] = {
|
||||
local vlayer_data = {
|
||||
}
|
||||
|
||||
default_surface(game.surfaces["nauvis"].index)
|
||||
|
||||
Storage.register(vlayer_data, function(tbl)
|
||||
vlayer_data = tbl
|
||||
end)
|
||||
@@ -698,35 +700,41 @@ 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
|
||||
return
|
||||
end
|
||||
if not vlayer_data[event.surface_index] then
|
||||
vlayer_data[event.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(event.surface_index)
|
||||
end
|
||||
|
||||
--- Move items between the interfaces and storage
|
||||
|
||||
Reference in new issue
Block a user