From 082ee900f4cf8058dcc76664e275e31bea72f47f Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 24 Feb 2025 18:02:03 +0900 Subject: [PATCH] . --- exp_legacy/module/config/spawn_area.lua | 88 ++++++++++---------- exp_legacy/module/modules/control/vlayer.lua | 16 ++++ 2 files changed, 60 insertions(+), 44 deletions(-) diff --git a/exp_legacy/module/config/spawn_area.lua b/exp_legacy/module/config/spawn_area.lua index 5540faa0..24455dba 100644 --- a/exp_legacy/module/config/spawn_area.lua +++ b/exp_legacy/module/config/spawn_area.lua @@ -5,77 +5,77 @@ return { spawn_area = { --- @setting spawn_area Settings relating to the whole spawn area -- Enable predefined patches: 128, else: 32 deconstruction_radius = 12, -- @setting deconstruction_radius All entities within this radius will be removed - deconstruction_tile = 'refined-concrete', --- @setting deconstruction_tile Tile to be placed in the deconstruction radius, use nil for map gen + deconstruction_tile = "refined-concrete", --- @setting deconstruction_tile Tile to be placed in the deconstruction radius, use nil for map gen tile_radius = 14, landfill_radius = 16, --- @setting pattern_radius All water within this radius will be land filled }, turrets = { --- @setting turrets Settings relating to adding turrets to spawn enabled = true, --- @setting enabled Whether turrets will be added to spawn - ammo_type = 'uranium-rounds-magazine', --- @setting ammo_type The ammo type that will be used during refills - refill_time = 60*60*5, --- @setting refill_time The time in ticks between each refill of the turrets, only change if having lag issues - offset = {x=0, y=0}, --- @setting offset The position offset to apply to turrets + ammo_type = "uranium-rounds-magazine", --- @setting ammo_type The ammo type that will be used during refills + refill_time = 60 * 60 * 5, --- @setting refill_time The time in ticks between each refill of the turrets, only change if having lag issues + offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to turrets locations = { --- @setting locations The locations of all turrets, this list can change during runtime - {surface=1, position={x=2, y=2}}, - {surface=1, position={x=2, y=-2}}, - {surface=1, position={x=-2, y=2}}, - {surface=1, position={x=-2, y=-2}}, + { surface = 1, position = { x = 2, y = 2 } }, + { surface = 1, position = { x = 2, y = -2 } }, + { surface = 1, position = { x = -2, y = 2 } }, + { surface = 1, position = { x = -2, y = -2 } }, } }, afk_belts = { --- @setting afk_belts Settings relating to adding afk belts to spawn enabled = true, --- @setting enabled Whether afk belts will be added to spawn - belt_type = 'transport-belt', --- @setting belt_type The belt to be used as afk belts + belt_type = "transport-belt", --- @setting belt_type The belt to be used as afk belts protected = true, --- @setting protected Whether belts will be protected from player interaction - offset = {x=0, y=0}, --- @setting offset The position offset to apply to afk belts - locations={ --- @setting locations The locations to spawn afk belts at, given as the top left position - {4, 4}, - {4, -4}, - {-4, 4}, - {-4, -4} + offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to afk belts + locations = { --- @setting locations The locations to spawn afk belts at, given as the top left position + { 4, 4 }, + { 4, -4 }, + { -4, 4 }, + { -4, -4 } } }, water = { --- @setting water Settings relating to adding water to spawn enabled = true, --- @setting enabled Whether water tiles will be added to spawn - water_tile = 'water-mud', --- @setting water_tile The tile to be used as the water tile - offset = {x=0, y=0}, --- @setting offset The position offset to apply to water tiles + water_tile = "water-mud", --- @setting water_tile The tile to be used as the water tile + offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to water tiles locations = { --- @setting locations The location of the water tiles {x,y} -- Each is a 3x3 with the closest tile to 0,0 removed - {5, 6}, {5, 7}, {6, 5}, {6, 6}, {6, 7}, {7, 5}, {7, 6}, {7, 7}, - {5, -7}, {5, -8}, {6, -6}, {6, -7}, {6, -8}, {7, -6}, {7, -7}, {7, -8}, - {-6, 6}, {-6, 7}, {-7, 5}, {-7, 6}, {-7, 7}, {-8, 5}, {-8, 6}, {-8, 7}, - {-6, -7}, {-6, -8}, {-7, -6}, {-7, -7}, {-7, -8}, {-8, -6}, {-8, -7}, {-8, -8}, + { 5, 6 }, { 5, 7 }, { 6, 5 }, { 6, 6 }, { 6, 7 }, { 7, 5 }, { 7, 6 }, { 7, 7 }, + { 5, -7 }, { 5, -8 }, { 6, -6 }, { 6, -7 }, { 6, -8 }, { 7, -6 }, { 7, -7 }, { 7, -8 }, + { -6, 6 }, { -6, 7 }, { -7, 5 }, { -7, 6 }, { -7, 7 }, { -8, 5 }, { -8, 6 }, { -8, 7 }, + { -6, -7 }, { -6, -8 }, { -7, -6 }, { -7, -7 }, { -7, -8 }, { -8, -6 }, { -8, -7 }, { -8, -8 }, } }, entities = { --- @setting entities Settings relating to adding entities to spawn - enabled = true, --- @setting enabled Whether entities will be added to spawn + enabled = true, --- @setting enabled Whether entities will be added to spawn protected = true, --- @setting protected Whether entities will be protected from player interaction operable = true, --- @setting operable Whether entities can be opened by players, must be true if chests are used - offset = {x=0, y=0}, --- @setting offset The position offset to apply to entities + offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to entities locations = { --- @setting locations The location and names of entities {name,x,y} - {'steel-chest', 1, 3}, {'steel-chest', 1, 4}, {'steel-chest', 1, 5}, - {'steel-chest', 3, 1}, {'steel-chest', 4, 1}, {'steel-chest', 5, 1}, - {'steel-chest', 1, -4}, {'steel-chest', 1, -5}, {'steel-chest', 1, -6}, - {'steel-chest', 3, -2}, {'steel-chest', 4, -2}, {'steel-chest', 5, -2}, - {'steel-chest', -2, 3}, {'steel-chest', -2, 4}, {'steel-chest', -2, 5}, - {'steel-chest', -4, 1}, {'steel-chest', -5, 1}, {'steel-chest', -6, 1}, - {'steel-chest', -2, -4}, {'steel-chest', -2, -5}, {'steel-chest', -2, -6}, - {'steel-chest', -4, -2}, {'steel-chest', -5, -2}, {'steel-chest', -6, -2}, - {'medium-electric-pole', 2, 3}, {'medium-electric-pole', 2, -4}, {'medium-electric-pole', -3, 3}, {'medium-electric-pole', -3, -4}, - {'small-lamp', 2, 4}, {'small-lamp', 2, -5}, {'small-lamp', -3, 4}, {'small-lamp', -3, -5}, - {'small-lamp', 4, 2}, {'small-lamp', 4, -3}, {'small-lamp', -5, 2}, {'small-lamp', -5, -3}, - {'stone-wall', 1, 7}, {'stone-wall', 2, 7}, {'stone-wall', 3, 7}, {'stone-wall', 4, 7}, - {'stone-wall', 7, 1}, {'stone-wall', 7, 2}, {'stone-wall', 7, 3}, {'stone-wall', 7, 4}, - {'stone-wall', 1, -8}, {'stone-wall', 2, -8}, {'stone-wall', 3, -8}, {'stone-wall', 4, -8}, - {'stone-wall', 7, -2}, {'stone-wall', 7, -3}, {'stone-wall', 7, -4}, {'stone-wall', 7, -5}, - {'stone-wall', -2, 7}, {'stone-wall', -3, 7}, {'stone-wall', -4, 7}, {'stone-wall', -5, 7}, - {'stone-wall', -8, 1}, {'stone-wall', -8, 2}, {'stone-wall', -8, 3}, {'stone-wall', -8, 4}, - {'stone-wall', -2, -8}, {'stone-wall', -3, -8}, {'stone-wall', -4, -8}, {'stone-wall', -5, -8}, - {'stone-wall', -8, -2}, {'stone-wall', -8, -3}, {'stone-wall', -8, -4}, {'stone-wall', -8, -5}, + { "steel-chest", 1, 3 }, { "steel-chest", 1, 4 }, { "steel-chest", 1, 5 }, + { "steel-chest", 3, 1 }, { "steel-chest", 4, 1 }, { "steel-chest", 5, 1 }, + { "steel-chest", 1, -4 }, { "steel-chest", 1, -5 }, { "steel-chest", 1, -6 }, + { "steel-chest", 3, -2 }, { "steel-chest", 4, -2 }, { "steel-chest", 5, -2 }, + { "steel-chest", -2, 3 }, { "steel-chest", -2, 4 }, { "steel-chest", -2, 5 }, + { "steel-chest", -4, 1 }, { "steel-chest", -5, 1 }, { "steel-chest", -6, 1 }, + { "steel-chest", -2, -4 }, { "steel-chest", -2, -5 }, { "steel-chest", -2, -6 }, + { "steel-chest", -4, -2 }, { "steel-chest", -5, -2 }, { "steel-chest", -6, -2 }, + { "medium-electric-pole", 2, 3 }, { "medium-electric-pole", 2, -4 }, { "medium-electric-pole", -3, 3 }, { "medium-electric-pole", -3, -4 }, + { "small-lamp", 2, 4 }, { "small-lamp", 2, -5 }, { "small-lamp", -3, 4 }, { "small-lamp", -3, -5 }, + { "small-lamp", 4, 2 }, { "small-lamp", 4, -3 }, { "small-lamp", -5, 2 }, { "small-lamp", -5, -3 }, + { "stone-wall", 1, 7 }, { "stone-wall", 2, 7 }, { "stone-wall", 3, 7 }, { "stone-wall", 4, 7 }, + { "stone-wall", 7, 1 }, { "stone-wall", 7, 2 }, { "stone-wall", 7, 3 }, { "stone-wall", 7, 4 }, + { "stone-wall", 1, -8 }, { "stone-wall", 2, -8 }, { "stone-wall", 3, -8 }, { "stone-wall", 4, -8 }, + { "stone-wall", 7, -2 }, { "stone-wall", 7, -3 }, { "stone-wall", 7, -4 }, { "stone-wall", 7, -5 }, + { "stone-wall", -2, 7 }, { "stone-wall", -3, 7 }, { "stone-wall", -4, 7 }, { "stone-wall", -5, 7 }, + { "stone-wall", -8, 1 }, { "stone-wall", -8, 2 }, { "stone-wall", -8, 3 }, { "stone-wall", -8, 4 }, + { "stone-wall", -2, -8 }, { "stone-wall", -3, -8 }, { "stone-wall", -4, -8 }, { "stone-wall", -5, -8 }, + { "stone-wall", -8, -2 }, { "stone-wall", -8, -3 }, { "stone-wall", -8, -4 }, { "stone-wall", -8, -5 }, } }, pattern = { enabled = false, --- @setting enabled Whether pattern tiles will be added to spawn - pattern_tile = 'refined-concrete', --- @setting pattern_tile The tile to be used for the pattern - offset = {x=0, y=0}, --- @setting offset The position offset to apply to pattern tiles + pattern_tile = "refined-concrete", --- @setting pattern_tile The tile to be used for the pattern + offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to pattern tiles locations = { --- @setting locations The location of the pattern tiles {x,y} } }, diff --git a/exp_legacy/module/modules/control/vlayer.lua b/exp_legacy/module/modules/control/vlayer.lua index d01b7bb6..4013381e 100644 --- a/exp_legacy/module/modules/control/vlayer.lua +++ b/exp_legacy/module/modules/control/vlayer.lua @@ -8,6 +8,7 @@ local ExpUtil = require("modules/exp_util") local Storage = require("modules/exp_util/storage") local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event local config = require("modules.exp_legacy.config.vlayer") --- @dep config.vlayer +local config_spawn = require("modules.exp_legacy.config.spawn_area") --- @dep config.spawn_area local mega = 1000000 @@ -37,6 +38,14 @@ local vlayer_data = { surface = table.deep_copy(config.surface), } +local spawn_pole = {} + +for _, v in pairs(config_spawn.entities.location) do + if v[1] == "small-electric-pole" or v[1] == "medium-electric-pole" then + table.insert(spawn_pole, v) + end +end + Storage.register(vlayer_data, function(tbl) vlayer_data = tbl end) @@ -579,6 +588,12 @@ function vlayer.create_circuit_interface(surface, position, circuit, last_user) return interface end +--- Calculate the current power load to provide a better view for the user +local function handle_circuit_power_load() + for index, interface in pairs(vlayer_data.entity_interfaces.circuit) do + end +end + --- Handle all circuit interfaces, updating their signals to match the vlayer statistics local function handle_circuit_interfaces() local stats = vlayer.get_statistics() @@ -787,6 +802,7 @@ Event.on_nth_tick(config.update_tick_storage, function(_) handle_input_interfaces() handle_output_interfaces() handle_unallocated() + handle_circuit_power_load() end) --- Handle all energy and circuit updates