From fa384d055338584a6c15700cf3d023a63ac90d6c Mon Sep 17 00:00:00 2001 From: notnotmelon Date: Sat, 9 Nov 2024 19:27:53 -0600 Subject: [PATCH] Rewrote all code related to `LuaEntity.circuit_wire_connection_points` --- prototypes/buildings/borax-mine.lua | 5 +-- prototypes/buildings/niobium-mine.lua | 5 +-- prototypes/buildings/tailings-pond.lua | 44 ++++---------------- prototypes/circuit-connector-definitions.lua | 12 ++++++ 4 files changed, 24 insertions(+), 42 deletions(-) diff --git a/prototypes/buildings/borax-mine.lua b/prototypes/buildings/borax-mine.lua index 578fe0a9..06997aea 100644 --- a/prototypes/buildings/borax-mine.lua +++ b/prototypes/buildings/borax-mine.lua @@ -119,9 +119,8 @@ for i = 1, 4 do width = 12, height = 12 }, - --circuit_wire_connection_points = circuit_connector_definitions['borax-mine-mkxx'].points, - --circuit_connector_sprites = circuit_connector_definitions['borax-mine-mkxx'].sprites, - --circuit_wire_max_distance = default_circuit_wire_max_distance, + circuit_connector = circuit_connector_definitions["borax-mine-mkxx"], + circuit_wire_max_distance = _G.default_circuit_wire_max_distance, graphics_set = { animation = dry_graphics }, diff --git a/prototypes/buildings/niobium-mine.lua b/prototypes/buildings/niobium-mine.lua index 1c806b16..da69d1c5 100644 --- a/prototypes/buildings/niobium-mine.lua +++ b/prototypes/buildings/niobium-mine.lua @@ -125,9 +125,8 @@ ENTITY { width = 12, height = 12 }, - --circuit_wire_connection_points = circuit_connector_definitions['niobium-mine'].points, - --circuit_connector_sprites = circuit_connector_definitions['niobium-mine'].sprites, - --circuit_wire_max_distance = default_circuit_wire_max_distance, + circuit_connector = circuit_connector_definitions["niobium-mine"], + circuit_wire_max_distance = _G.default_circuit_wire_max_distance, graphics_set = { animation = dry_graphics }, diff --git a/prototypes/buildings/tailings-pond.lua b/prototypes/buildings/tailings-pond.lua index a5246cd0..26b0f23a 100644 --- a/prototypes/buildings/tailings-pond.lua +++ b/prototypes/buildings/tailings-pond.lua @@ -45,13 +45,6 @@ for y = 0, 2112 - 352, 352 do end data:extend(pictures) -local blank_png = { - filename = "__core__/graphics/empty.png", - height = 1, - priority = "extra-high", - width = 1 -} - ENTITY { type = "storage-tank", name = "tailings-pond", @@ -67,8 +60,7 @@ ENTITY { dying_explosion = "storage-tank-explosion", collision_box = {{-8.9, -8.9}, {8.9, 8.9}}, selection_box = {{-9, -9}, {9, 9}}, - fluid_box = - { + fluid_box = { volume = 1000000, pipe_picture = { north = { @@ -120,11 +112,11 @@ ENTITY { } } }, - west = blank_png + west = py.empty_image() }, pipe_covers = { - north = blank_png, - east = blank_png, + north = py.empty_image(), + east = py.empty_image(), south = { layers = { { @@ -213,10 +205,8 @@ ENTITY { impact_category = "metal-large", open_sound = {filename = "__base__/sound/car-metal-impact-1.ogg", volume = 0.15}, close_sound = {filename = "__base__/sound/car-metal-impact-1.ogg", volume = 0.15}, - working_sound = - { - sound = - { + working_sound = { + sound = { filename = "__base__/sound/storage-tank.ogg", volume = 0.6 }, @@ -224,24 +214,6 @@ ENTITY { audible_distance_modifier = 0.5, max_sounds_per_type = 3 }, - circuit_wire_connection_points = { - { - shadow = {red = {2.546875, -2.4375}, green = {2.546875, -2.4375}}, - wire = {red = {2.546875, -2.4375}, green = {2.546875, -2.4375}} - }, - { - shadow = {red = {2.546875, -2.4375}, green = {2.546875, -2.4375}}, - wire = {red = {2.546875, -2.4375}, green = {2.546875, -2.4375}} - }, - { - shadow = {red = {2.546875, -2.4375}, green = {2.546875, -2.4375}}, - wire = {red = {2.546875, -2.4375}, green = {2.546875, -2.4375}} - }, - { - shadow = {red = {2.546875, -2.4375}, green = {2.546875, -2.4375}}, - wire = {red = {2.546875, -2.4375}, green = {2.546875, -2.4375}} - } - }, + circuit_connector = circuit_connector_definitions["tailings-pond"], circuit_wire_max_distance = 9, - circuit_connector_sprites = _G.circuit_connector_definitions["storage-tank"].sprites -} +} \ No newline at end of file diff --git a/prototypes/circuit-connector-definitions.lua b/prototypes/circuit-connector-definitions.lua index 2bf17194..1c14b749 100644 --- a/prototypes/circuit-connector-definitions.lua +++ b/prototypes/circuit-connector-definitions.lua @@ -23,3 +23,15 @@ circuit_connector_definitions["niobium-mine"] = circuit_connector_definitions.cr {variation = 18, main_offset = util.by_pixel(-84, -5), shadow_offset = util.by_pixel(-78, 7), show_shadow = false} } ) + +circuit_connector_definitions["tailings-pond"] = circuit_connector_definitions.create_vector + ( + universal_connector_template, + { --Directions are horizontal in/outputs, vertical in/outputs. + --Remaining orientations are not used, but required to give the data the correct shape. + {variation = 1, main_offset = {-4.25, 3.3}, shadow_offset = {-4.25, 3.3}, show_shadow = true}, + {variation = 1, main_offset = {-4.25, 3.3}, shadow_offset = {-4.25, 3.3}, show_shadow = true}, + {variation = 1, main_offset = {-4.25, 3.3}, shadow_offset = {-4.25, 3.3}, show_shadow = true}, + {variation = 1, main_offset = {-4.25, 3.3}, shadow_offset = {-4.25, 3.3}, show_shadow = true}, + } + )