From 395089dfd83a797ef408a28a8087276b8845bd3d Mon Sep 17 00:00:00 2001 From: Fixer Date: Sun, 15 Jul 2018 13:27:52 +0300 Subject: [PATCH 01/16] Wrench: Allow picking up with protection_bypass privilege (#393) This allows admins to move other players locked chests/etc without hassle (relocating flying chests). --- wrench/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrench/init.lua b/wrench/init.lua index bae77aa..adb80c9 100644 --- a/wrench/init.lua +++ b/wrench/init.lua @@ -120,7 +120,7 @@ minetest.register_tool("wrench:wrench", { return end local meta = minetest.get_meta(pos) - if def.owned then + if def.owned and not minetest.check_player_privs(placer, "protection_bypass") then local owner = meta:get_string("owner") if owner and owner ~= player_name then minetest.log("action", player_name.. From 68fac3ed7b28d05d71f26a8dcd1be49ba376afaf Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Sun, 15 Jul 2018 13:28:34 +0300 Subject: [PATCH 02/16] Fix wooden chest formspec (#429) --- technic_chests/init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/technic_chests/init.lua b/technic_chests/init.lua index 3565987..6b1a1b2 100644 --- a/technic_chests/init.lua +++ b/technic_chests/init.lua @@ -15,3 +15,11 @@ dofile(modpath.."/silver_chest.lua") dofile(modpath.."/gold_chest.lua") dofile(modpath.."/mithril_chest.lua") +minetest.register_lbm({ + name = "technic_chests:fix_wooden_chests", + nodenames = {"default:chest"}, + action = function(pos, node) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "") + end +}) From 0fcc7a14c2d60e22d41b66b9008119171aff1681 Mon Sep 17 00:00:00 2001 From: Thomas--S Date: Mon, 16 Jul 2018 17:25:43 +0200 Subject: [PATCH 03/16] Replace old nodeupdate() with new minetest.check_for_falling() (#391) --- technic/machines/other/constructor.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/technic/machines/other/constructor.lua b/technic/machines/other/constructor.lua index 5847fdb..0a62a7c 100644 --- a/technic/machines/other/constructor.lua +++ b/technic/machines/other/constructor.lua @@ -99,7 +99,7 @@ local function make_on(mark, length) if node.name == "technic:constructor_mk"..mark.."_off" then technic.swap_node(pos, "technic:constructor_mk"..mark.."_on") - nodeupdate(pos) + minetest.check_for_falling(pos) for i = 1, length do place_pos = vector.add(place_pos, dir) local place_node = minetest.get_node(place_pos) @@ -113,7 +113,7 @@ local function make_off(mark) return function(pos, node) if node.name == "technic:constructor_mk"..mark.."_on" then technic.swap_node(pos,"technic:constructor_mk"..mark.."_off") - nodeupdate(pos) + minetest.check_for_falling(pos) end end end From 6af0376c23e000b7e2cd4db2659ff5d632c4e60b Mon Sep 17 00:00:00 2001 From: HybridDog Date: Mon, 16 Jul 2018 17:25:53 +0200 Subject: [PATCH 04/16] Use a:iter instead of for loops for sulfur generation (#423) --- technic_worldgen/oregen.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/technic_worldgen/oregen.lua b/technic_worldgen/oregen.lua index 8e7af91..16a3b8d 100644 --- a/technic_worldgen/oregen.lua +++ b/technic_worldgen/oregen.lua @@ -141,17 +141,20 @@ minetest.register_on_generated(function(minp, maxp, seed) for y = minp.y + math.floor(grid_size / 2), maxp.y, grid_size do for z = minp.z + math.floor(grid_size / 2), maxp.z, grid_size do local c = data[a:index(x, y, z)] - if (c == c_lava or c == c_lava_flowing) and sulfur_noise:get3d({x = x, y = z, z = z}) >= 0.4 then - for xx = math.max(minp.x, x - grid_size), math.min(maxp.x, x + grid_size) do - for yy = math.max(minp.y, y - grid_size), math.min(maxp.y, y + grid_size) do - for zz = math.max(minp.z, z - grid_size), math.min(maxp.z, z + grid_size) do - local i = a:index(xx, yy, zz) + if (c == c_lava or c == c_lava_flowing) + and sulfur_noise:get3d({x = x, y = z, z = z}) >= 0.4 then + for i in a:iter( + math.max(minp.x, x - grid_size), + math.max(minp.y, y - grid_size), + math.max(minp.z, z - grid_size), + math.min(maxp.x, x + grid_size), + math.min(maxp.y, y + grid_size), + math.min(maxp.z, z + grid_size) + ) do if data[i] == c_stone and pr:next(1, 10) <= 7 then data[i] = c_sulfur end end - end - end end end end From 41f175986d18ef9cf697b95e4570555471068857 Mon Sep 17 00:00:00 2001 From: HybridDog Date: Mon, 16 Jul 2018 17:26:39 +0200 Subject: [PATCH 05/16] Show EU power values more readable (#424) Add the EU_string helper function In comparison to pretty_num it uses SI prefixes, adds "EU" (e.g. kEU) and rounds the number for readability Add a constant_digit_count boolean setting --- technic/doc/api.md | 7 ++- technic/helpers.lua | 65 +++++++++++++++++------ technic/machines/LV/solar_panel.lua | 5 +- technic/machines/MV/wind_mill.lua | 3 +- technic/machines/power_monitor.lua | 2 +- technic/machines/register/battery_box.lua | 5 +- technic/machines/register/solar_array.lua | 5 +- technic/machines/supply_converter.lua | 4 +- technic/machines/switching_station.lua | 6 +-- 9 files changed, 72 insertions(+), 30 deletions(-) diff --git a/technic/doc/api.md b/technic/doc/api.md index 2e5b6d3..178ab0a 100644 --- a/technic/doc/api.md +++ b/technic/doc/api.md @@ -11,9 +11,12 @@ switching station handles the network activity. Helper functions ---------------- +* `technic.EU_string(num)` + * Converts num to a human-readable string (see pretty_num) + and adds the `EU` unit + * Use this function when showing players energy values * `technic.pretty_num(num)` - * Converts the number `num` to a human-readable string. - * Use this function when showing players power values. + * Converts the number `num` to a human-readable string with SI prefixes * `technic.swap_node(pos, nodename)` * Same as `mintest.swap_node` but it only changes the nodename. * It uses `minetest.get_node` before swapping to ensure the new nodename diff --git a/technic/helpers.lua b/technic/helpers.lua index 5780f27..5963b68 100644 --- a/technic/helpers.lua +++ b/technic/helpers.lua @@ -1,23 +1,56 @@ -local digit_sep_esc -do - local sep = technic.config:get("digit_separator") - sep = tonumber(sep) and string.char(sep) or sep or " " - -- Escape for gsub - for magic in ("().%+-*?[^$"):gmatch(".") do - if sep == magic then - sep = "%"..sep - end +local constant_digit_count = technic.config:get("constant_digit_count") + +-- converts a number to a readable string with SI prefix, e.g. 10000 → "10 k", +-- 15 → "15 ", 0.1501 → "150.1 m" +-- a non-breaking space (U+a0) instead of a usual one is put after number +-- The precision is 4 digits +local prefixes = {[-8] = "y", [-7] = "z", [-6] = "a", [-5] = "f", [-4] = "p", + [-3] = "n", [-2] = "µ", [-1] = "m", [0] = "", [1] = "k", [2] = "M", + [3] = "G", [4] = "T", [5] = "P", [6] = "E", [7] = "Z", [8] = "Y"} +function technic.pretty_num(num) + -- the small number added is due to floating point inaccuracy + local b = math.floor(math.log10(math.abs(num)) +0.000001) + local pref_i + if b ~= 0 then + -- b is decremented by 1 to avoid a single digit with many decimals, + -- e.g. instead of 1.021 MEU, 1021 kEU is shown + pref_i = math.floor((b - 1) / 3) + else + -- as special case, avoid showing e.g. 1100 mEU instead of 1.1 EU + pref_i = 0 end - digit_sep_esc = sep + if not prefixes[pref_i] then + -- This happens for 0, nan, inf, very big values, etc. + if num == 0 then + -- handle 0 explicilty to avoid showing "-0" + if not constant_digit_count then + return "0 " + end + -- gives 0.000 + return string.format("%.3f ", 0) + end + return string.format("%.4g ", num) + end + + num = num * 10 ^ (-3 * pref_i) + if constant_digit_count then + local comma_digits_cnt = 3 - (b - 3 * pref_i) + return string.format("%." .. comma_digits_cnt .. "f %s", + num, prefixes[pref_i]) + end + return string.format("%.4g %s", num, prefixes[pref_i]) end +-- some unittests +assert(technic.pretty_num(-0) == "0 ") +assert(technic.pretty_num(0) == "0 ") +assert(technic.pretty_num(1234) == "1234 ") +assert(technic.pretty_num(123456789) == "123.5 M") -function technic.pretty_num(num) - local str, k = tostring(num), nil - repeat - str, k = str:gsub("^(-?%d+)(%d%d%d)", "%1"..digit_sep_esc.."%2") - until k == 0 - return str + +-- used to display power values +function technic.EU_string(num) + return technic.pretty_num(num) .. "EU" end diff --git a/technic/machines/LV/solar_panel.lua b/technic/machines/LV/solar_panel.lua index a06ddb8..c072b13 100644 --- a/technic/machines/LV/solar_panel.lua +++ b/technic/machines/LV/solar_panel.lua @@ -35,7 +35,8 @@ local run = function(pos, node) local charge_to_give = math.floor((light + pos1.y) * 3) charge_to_give = math.max(charge_to_give, 0) charge_to_give = math.min(charge_to_give, 200) - meta:set_string("infotext", S("@1 Active (@2 EU)", machine_name, technic.pretty_num(charge_to_give))) + meta:set_string("infotext", S("@1 Active (@2)", machine_name, + technic.EU_string(charge_to_give))) meta:set_int("LV_EU_supply", charge_to_give) else meta:set_string("infotext", S("%s Idle"):format(machine_name)) @@ -54,7 +55,7 @@ minetest.register_node("technic:solar_panel", { active = false, drawtype = "nodebox", paramtype = "light", - is_ground_content = true, + is_ground_content = true, node_box = { type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, diff --git a/technic/machines/MV/wind_mill.lua b/technic/machines/MV/wind_mill.lua index 28a075d..9df12b9 100644 --- a/technic/machines/MV/wind_mill.lua +++ b/technic/machines/MV/wind_mill.lua @@ -60,7 +60,8 @@ local run = function(pos, node) elseif check == true then local power = math.min(pos.y * 100, 5000) meta:set_int("MV_EU_supply", power) - meta:set_string("infotext", S("@1 (@2 EU)", machine_name, technic.pretty_num(power))) + meta:set_string("infotext", S("@1 (@2)", machine_name, + technic.EU_string(power))) end -- check == nil: assume nothing has changed end diff --git a/technic/machines/power_monitor.lua b/technic/machines/power_monitor.lua index 4d722a2..7e8b850 100644 --- a/technic/machines/power_monitor.lua +++ b/technic/machines/power_monitor.lua @@ -55,7 +55,7 @@ minetest.register_abm({ local demand = sw_meta:get_int("demand") meta:set_string("infotext", S("Power Monitor. Supply: @1 Demand: @2", - technic.pretty_num(supply), technic.pretty_num(demand))) + technic.EU_string(supply), technic.EU_string(demand))) else meta:set_string("infotext",S("Power Monitor Has No Network")) end diff --git a/technic/machines/register/battery_box.lua b/technic/machines/register/battery_box.lua index 84e992c..7f25dfd 100644 --- a/technic/machines/register/battery_box.lua +++ b/technic/machines/register/battery_box.lua @@ -255,8 +255,9 @@ function technic.register_battery_box(data) local charge_percent = math.floor(current_charge / max_charge * 100) meta:set_string("formspec", formspec..add_on_off_buttons(meta, ltier, charge_percent)) - local infotext = S("@1 Battery Box: @2/@3", tier, - technic.pretty_num(current_charge), technic.pretty_num(max_charge)) + local infotext = S("@1 Battery Box: @2 / @3", tier, + technic.EU_string(current_charge), + technic.EU_string(max_charge)) if eu_input == 0 then infotext = S("%s Idle"):format(infotext) end diff --git a/technic/machines/register/solar_array.lua b/technic/machines/register/solar_array.lua index 422bfcf..03f11d9 100644 --- a/technic/machines/register/solar_array.lua +++ b/technic/machines/register/solar_array.lua @@ -30,14 +30,15 @@ function technic.register_solar_array(data) local charge_to_give = math.floor((light + pos.y) * data.power) charge_to_give = math.max(charge_to_give, 0) charge_to_give = math.min(charge_to_give, data.power * 50) - meta:set_string("infotext", S("@1 Active (@2 EU)", machine_name, technic.pretty_num(charge_to_give))) + meta:set_string("infotext", S("@1 Active (@2)", machine_name, + technic.EU_string(charge_to_give))) meta:set_int(tier.."_EU_supply", charge_to_give) else meta:set_string("infotext", S("%s Idle"):format(machine_name)) meta:set_int(tier.."_EU_supply", 0) end end - + minetest.register_node("technic:solar_array_"..ltier, { tiles = {"technic_"..ltier.."_solar_array_top.png", "technic_"..ltier.."_solar_array_bottom.png", "technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png", diff --git a/technic/machines/supply_converter.lua b/technic/machines/supply_converter.lua index 8527bcf..9202c4a 100644 --- a/technic/machines/supply_converter.lua +++ b/technic/machines/supply_converter.lua @@ -149,7 +149,9 @@ local run = function(pos, node, run_stage) meta:set_int(from.."_EU_supply", 0) meta:set_int(to.."_EU_demand", 0) meta:set_int(to.."_EU_supply", input * remain) - meta:set_string("infotext", S("@1 (@2 @3 -> @4 @5)", machine_name, technic.pretty_num(input), from, technic.pretty_num(input * remain), to)) + meta:set_string("infotext", S("@1 (@2 @3 -> @4 @5)", machine_name, + technic.EU_string(input), from, + technic.EU_string(input * remain), to)) else meta:set_string("infotext", S("%s Has Bad Cabling"):format(machine_name)) if to then diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua index 21d394b..d645847 100644 --- a/technic/machines/switching_station.lua +++ b/technic/machines/switching_station.lua @@ -361,9 +361,9 @@ minetest.register_abm({ end --dprint("Total BA demand:"..BA_eu_demand) - meta:set_string("infotext", - S("@1. Supply: @2 Demand: @3", - machine_name, technic.pretty_num(PR_eu_supply), technic.pretty_num(RE_eu_demand))) + meta:set_string("infotext", S("@1. Supply: @2 Demand: @3", + machine_name, technic.EU_string(PR_eu_supply), + technic.EU_string(RE_eu_demand))) -- If mesecon signal and power supply or demand changed then -- send them via digilines. From fb93388f06fe87ee75aaaf04cf6edcf01a26d981 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Thu, 19 Jul 2018 14:36:21 +0200 Subject: [PATCH 06/16] Replace deprecated invsize[] with size[] --- technic/machines/LV/cnc.lua | 2 +- technic/machines/MV/tool_workshop.lua | 2 +- technic/machines/other/injector.lua | 2 +- technic/machines/register/generator.lua | 2 +- technic/machines/register/machine_base.lua | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/technic/machines/LV/cnc.lua b/technic/machines/LV/cnc.lua index 58ec6ba..fdfec99 100644 --- a/technic/machines/LV/cnc.lua +++ b/technic/machines/LV/cnc.lua @@ -48,7 +48,7 @@ local twosize_products = { } local cnc_formspec = - "invsize[9,11;]".. + "size[9,11;]".. "label[1,0;"..S("Choose Milling Program:").."]".. "image_button[1,0.5;1,1;technic_cnc_slope.png;slope; ]".. "image_button[2,0.5;1,1;technic_cnc_slope_edge.png;slope_edge; ]".. diff --git a/technic/machines/MV/tool_workshop.lua b/technic/machines/MV/tool_workshop.lua index 6679d1d..a220ac0 100644 --- a/technic/machines/MV/tool_workshop.lua +++ b/technic/machines/MV/tool_workshop.lua @@ -19,7 +19,7 @@ minetest.register_craft({ local workshop_demand = {5000, 3500, 2000} local workshop_formspec = - "invsize[8,9;]".. + "size[8,9;]".. "list[current_name;src;3,1;1,1;]".. "label[0,0;"..S("%s Tool Workshop"):format("MV").."]".. "list[current_name;upgrade1;1,3;1,1;]".. diff --git a/technic/machines/other/injector.lua b/technic/machines/other/injector.lua index b34dd79..4fe78b2 100644 --- a/technic/machines/other/injector.lua +++ b/technic/machines/other/injector.lua @@ -55,7 +55,7 @@ minetest.register_craft({ local function set_injector_formspec(meta) local is_stack = meta:get_string("mode") == "whole stacks" meta:set_string("formspec", - "invsize[8,9;]".. + "size[8,9;]".. "item_image[0,0;1,1;technic:injector]".. "label[1,0;"..S("Self-Contained Injector").."]".. (is_stack and diff --git a/technic/machines/register/generator.lua b/technic/machines/register/generator.lua index 7805bf0..87ef6e7 100644 --- a/technic/machines/register/generator.lua +++ b/technic/machines/register/generator.lua @@ -35,7 +35,7 @@ function technic.register_generator(data) for k, v in pairs(groups) do active_groups[k] = v end local generator_formspec = - "invsize[8,9;]".. + "size[8,9;]".. "label[0,0;"..S("Fuel-Fired %s Generator"):format(tier).."]".. "list[current_name;src;3,1;1,1;]".. "image[4,1;1,1;default_furnace_fire_bg.png]".. diff --git a/technic/machines/register/machine_base.lua b/technic/machines/register/machine_base.lua index 0c6a6b3..14cf998 100644 --- a/technic/machines/register/machine_base.lua +++ b/technic/machines/register/machine_base.lua @@ -44,7 +44,7 @@ function technic.register_base_machine(data) for k, v in pairs(groups) do active_groups[k] = v end local formspec = - "invsize[8,9;]".. + "size[8,9;]".. "list[current_name;src;"..(4-input_size)..",1;"..input_size..",1;]".. "list[current_name;dst;5,1;2,2;]".. "list[current_player;main;0,5;8,4;]".. From 80c6a14566e5688bbfd06dbffb984143cbf53fe1 Mon Sep 17 00:00:00 2001 From: HybridDog Date: Sat, 21 Jul 2018 19:09:27 +0200 Subject: [PATCH 07/16] Tidy up ore registrations (#422) --- technic_worldgen/oregen.lua | 252 ++++++++++++++++++++---------------- 1 file changed, 141 insertions(+), 111 deletions(-) diff --git a/technic_worldgen/oregen.lua b/technic_worldgen/oregen.lua index 16a3b8d..fb7ac84 100644 --- a/technic_worldgen/oregen.lua +++ b/technic_worldgen/oregen.lua @@ -1,132 +1,157 @@ -local uranium_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 420, octaves = 3, persist = 0.7} +local uranium_params = { + offset = 0, + scale = 1, + spread = {x = 100, y = 100, z = 100}, + seed = 420, + octaves = 3, + persist = 0.7 +} local uranium_threshold = 0.55 -local chromium_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 421, octaves = 3, persist = 0.7} +local chromium_params = { + offset = 0, + scale = 1, + spread = {x = 100, y = 100, z = 100}, + seed = 421, + octaves = 3, + persist = 0.7 +} local chromium_threshold = 0.55 -local zinc_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 422, octaves = 3, persist = 0.7} +local zinc_params = { + offset = 0, + scale = 1, + spread = {x = 100, y = 100, z = 100}, + seed = 422, + octaves = 3, + persist = 0.7 +} local zinc_threshold = 0.5 -local lead_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 423, octaves = 3, persist = 0.7} +local lead_params = { + offset = 0, + scale = 1, + spread = {x = 100, y = 100, z = 100}, + seed = 423, + octaves = 3, + persist = 0.7 +} local lead_threshold = 0.3 minetest.register_ore({ - ore_type = "scatter", - ore = "technic:mineral_uranium", - wherein = "default:stone", - clust_scarcity = 8*8*8, - clust_num_ores = 4, - clust_size = 3, - y_min = -300, - y_max = -80, - noise_params = uranium_params, + ore_type = "scatter", + ore = "technic:mineral_uranium", + wherein = "default:stone", + clust_scarcity = 8*8*8, + clust_num_ores = 4, + clust_size = 3, + y_min = -300, + y_max = -80, + noise_params = uranium_params, noise_threshold = uranium_threshold, }) minetest.register_ore({ - ore_type = "scatter", - ore = "technic:mineral_chromium", - wherein = "default:stone", - clust_scarcity = 8*8*8, - clust_num_ores = 2, - clust_size = 3, - y_min = -200, - y_max = -100, - noise_params = chromium_params, + ore_type = "scatter", + ore = "technic:mineral_chromium", + wherein = "default:stone", + clust_scarcity = 8*8*8, + clust_num_ores = 2, + clust_size = 3, + y_min = -200, + y_max = -100, + noise_params = chromium_params, noise_threshold = chromium_threshold, }) minetest.register_ore({ - ore_type = "scatter", - ore = "technic:mineral_chromium", - wherein = "default:stone", - clust_scarcity = 6*6*6, - clust_num_ores = 2, - clust_size = 3, - y_min = -31000, - y_max = -200, - flags = "absheight", - noise_params = chromium_params, + ore_type = "scatter", + ore = "technic:mineral_chromium", + wherein = "default:stone", + clust_scarcity = 6*6*6, + clust_num_ores = 2, + clust_size = 3, + y_min = -31000, + y_max = -200, + flags = "absheight", + noise_params = chromium_params, noise_threshold = chromium_threshold, }) minetest.register_ore({ - ore_type = "scatter", - ore = "technic:mineral_zinc", - wherein = "default:stone", - clust_scarcity = 8*8*8, - clust_num_ores = 5, - clust_size = 7, - y_min = -32, - y_max = 2, - noise_params = zinc_params, + ore_type = "scatter", + ore = "technic:mineral_zinc", + wherein = "default:stone", + clust_scarcity = 8*8*8, + clust_num_ores = 5, + clust_size = 7, + y_min = -32, + y_max = 2, + noise_params = zinc_params, noise_threshold = zinc_threshold, }) minetest.register_ore({ - ore_type = "scatter", - ore = "technic:mineral_zinc", - wherein = "default:stone", - clust_scarcity = 6*6*6, - clust_num_ores = 4, - clust_size = 3, - y_min = -31000, - y_max = -32, - flags = "absheight", - noise_params = zinc_params, + ore_type = "scatter", + ore = "technic:mineral_zinc", + wherein = "default:stone", + clust_scarcity = 6*6*6, + clust_num_ores = 4, + clust_size = 3, + y_min = -31000, + y_max = -32, + flags = "absheight", + noise_params = zinc_params, noise_threshold = zinc_threshold, }) minetest.register_ore({ - ore_type = "scatter", - ore = "technic:mineral_lead", - wherein = "default:stone", - clust_scarcity = 9*9*9, - clust_num_ores = 5, - clust_size = 3, - y_min = -16, - y_max = 16, - noise_params = lead_params, + ore_type = "scatter", + ore = "technic:mineral_lead", + wherein = "default:stone", + clust_scarcity = 9*9*9, + clust_num_ores = 5, + clust_size = 3, + y_min = -16, + y_max = 16, + noise_params = lead_params, noise_threshold = lead_threshold, }) minetest.register_ore({ - ore_type = "scatter", - ore = "technic:mineral_lead", - wherein = "default:stone", - clust_scarcity = 8*8*8, - clust_num_ores = 5, - clust_size = 3, - y_min = -128, - y_max = -16, - noise_params = lead_params, + ore_type = "scatter", + ore = "technic:mineral_lead", + wherein = "default:stone", + clust_scarcity = 8*8*8, + clust_num_ores = 5, + clust_size = 3, + y_min = -128, + y_max = -16, + noise_params = lead_params, noise_threshold = lead_threshold, }) minetest.register_ore({ - ore_type = "scatter", - ore = "technic:mineral_lead", - wherein = "default:stone", - clust_scarcity = 6*6*6, - clust_num_ores = 5, - clust_size = 3, - y_min = -31000, - y_max = -128, - flags = "absheight", - noise_params = lead_params, + ore_type = "scatter", + ore = "technic:mineral_lead", + wherein = "default:stone", + clust_scarcity = 6*6*6, + clust_num_ores = 5, + clust_size = 3, + y_min = -31000, + y_max = -128, + flags = "absheight", + noise_params = lead_params, noise_threshold = lead_threshold, }) -- Sulfur local sulfur_buf = {} -local sulfur_noise= nil +local sulfur_noise -minetest.register_on_generated(function(minp, maxp, seed) +minetest.register_on_generated(function(minp, maxp) local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") - local a = VoxelArea:new{ - MinEdge = {x = emin.x, y = emin.y, z = emin.z}, - MaxEdge = {x = emax.x, y = emax.y, z = emax.z}, - } + local a = VoxelArea:new({MinEdge=emin, MaxEdge=emax}) local data = vm:get_data(sulfur_buf) local pr = PseudoRandom(17 * minp.x + 42 * minp.y + 101 * minp.z) sulfur_noise = sulfur_noise or minetest.get_perlin(9876, 3, 0.5, 100) @@ -142,7 +167,7 @@ minetest.register_on_generated(function(minp, maxp, seed) for z = minp.z + math.floor(grid_size / 2), maxp.z, grid_size do local c = data[a:index(x, y, z)] if (c == c_lava or c == c_lava_flowing) - and sulfur_noise:get3d({x = x, y = z, z = z}) >= 0.4 then + and sulfur_noise:get_3d({x = x, y = z, z = z}) >= 0.4 then for i in a:iter( math.max(minp.x, x - grid_size), math.max(minp.y, y - grid_size), @@ -166,32 +191,37 @@ end) if technic.config:get_bool("enable_marble_generation") then -minetest.register_ore({ - ore_type = "sheet", - ore = "technic:marble", - wherein = "default:stone", - clust_scarcity = 1, - clust_num_ores = 1, - clust_size = 3, - y_min = -31000, - y_max = -50, - noise_threshold = 0.4, - noise_params = {offset=0, scale=15, spread={x=150, y=150, z=150}, seed=23, octaves=3, persist=0.70} -}) + minetest.register_ore({ + ore_type = "sheet", + ore = "technic:marble", + wherein = "default:stone", + clust_scarcity = 1, + clust_num_ores = 1, + clust_size = 3, + y_min = -31000, + y_max = -50, + noise_threshold = 0.4, + noise_params = { + offset = 0, scale = 15, spread = {x = 150, y = 150, z = 150}, + seed = 23, octaves = 3, persist = 0.70 + } + }) end if technic.config:get_bool("enable_granite_generation") then -minetest.register_ore({ - ore_type = "sheet", - ore = "technic:granite", - wherein = "default:stone", - clust_scarcity = 1, - clust_num_ores = 1, - clust_size = 4, - y_min = -31000, - y_max = -150, - noise_threshold = 0.4, - noise_params = {offset=0, scale=15, spread={x=130, y=130, z=130}, seed=24, octaves=3, persist=0.70} -}) + minetest.register_ore({ + ore_type = "sheet", + ore = "technic:granite", + wherein = "default:stone", + clust_scarcity = 1, + clust_num_ores = 1, + clust_size = 4, + y_min = -31000, + y_max = -150, + noise_threshold = 0.4, + noise_params = { + offset = 0, scale = 15, spread = {x = 130, y = 130, z = 130}, + seed = 24, octaves = 3, persist = 0.70 + } + }) end - From f013d2dd1f76fe1e84203a81210b9a9b1987fbdd Mon Sep 17 00:00:00 2001 From: HybridDog Date: Sat, 21 Jul 2018 19:10:32 +0200 Subject: [PATCH 08/16] Mining laser fixes (#421) Do not remove air and group:hot nodes instead of using a fixed list Abort mining when encountering an unknown node Add random to the smoke puff particle Set mining laser tool range to 0 --- technic/tools/mining_lasers.lua | 84 ++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 37 deletions(-) diff --git a/technic/tools/mining_lasers.lua b/technic/tools/mining_lasers.lua index ef1eecb..6015e5a 100644 --- a/technic/tools/mining_lasers.lua +++ b/technic/tools/mining_lasers.lua @@ -4,43 +4,43 @@ local mining_lasers_list = { {"2", 14, 200000, 2000}, {"3", 21, 650000, 3000}, } +local allow_entire_discharging = true local S = technic.getter minetest.register_craft({ - output = 'technic:laser_mk1', + output = "technic:laser_mk1", recipe = { - {'default:diamond', 'technic:brass_ingot', 'default:obsidian_glass'}, - {'', 'technic:brass_ingot', 'technic:red_energy_crystal'}, - {'', '', 'default:copper_ingot'}, + {"default:diamond", "technic:brass_ingot", "default:obsidian_glass"}, + {"", "technic:brass_ingot", "technic:red_energy_crystal"}, + {"", "", "default:copper_ingot"}, } }) minetest.register_craft({ - output = 'technic:laser_mk2', + output = "technic:laser_mk2", recipe = { - {'default:diamond', 'technic:carbon_steel_ingot', 'technic:laser_mk1'}, - {'', 'technic:carbon_steel_ingot', 'technic:green_energy_crystal'}, - {'', '', 'default:copper_ingot'}, + {"default:diamond", "technic:carbon_steel_ingot", "technic:laser_mk1"}, + {"", "technic:carbon_steel_ingot", "technic:green_energy_crystal"}, + {"", "", "default:copper_ingot"}, } }) minetest.register_craft({ - output = 'technic:laser_mk3', + output = "technic:laser_mk3", recipe = { - {'default:diamond', 'technic:carbon_steel_ingot', 'technic:laser_mk2'}, - {'', 'technic:carbon_steel_ingot', 'technic:blue_energy_crystal'}, - {'', '', 'default:copper_ingot'}, + {"default:diamond", "technic:carbon_steel_ingot", "technic:laser_mk2"}, + {"", "technic:carbon_steel_ingot", "technic:blue_energy_crystal"}, + {"", "", "default:copper_ingot"}, } }) local function laser_node(pos, node, player) local def = minetest.registered_nodes[node.name] - if def and def.liquidtype ~= "none" then + if def.liquidtype ~= "none" and def.buildable_to then minetest.remove_node(pos) minetest.add_particle({ pos = pos, - velocity = {x=0, y=2, z=0}, - acceleration = {x=0, y=-1, z=0}, - expirationtime = 1.5, + velocity = {x = 0, y = 1.5 + math.random(), z = 0}, + acceleration = {x = 0, y = -1, z = 0}, size = 6 + math.random() * 2, texture = "smoke_puff.png^[transform" .. math.random(0, 7), }) @@ -49,11 +49,15 @@ local function laser_node(pos, node, player) minetest.node_dig(pos, node, player) end -local no_destroy = { - ["air"] = true, - ["default:lava_source"] = true, - ["default:lava_flowing"] = true, -} +local keep_node = {air = true} +local function can_keep_node(name) + if keep_node[name] ~= nil then + return keep_node[name] + end + keep_node[name] = minetest.get_item_group(name, "hot") ~= 0 + return keep_node[name] +end + local function laser_shoot(player, range, particle_texture, sound) local player_pos = player:getpos() local player_name = player:get_player_name() @@ -61,12 +65,12 @@ local function laser_shoot(player, range, particle_texture, sound) local start_pos = vector.new(player_pos) -- Adjust to head height - start_pos.y = start_pos.y + 1.6 + start_pos.y = start_pos.y + (player:get_properties().eye_height or 1.625) minetest.add_particle({ - pos = startpos, + pos = start_pos, velocity = dir, acceleration = vector.multiply(dir, 50), - expirationtime = range / 11, + expirationtime = (math.sqrt(1 + 100 * (range + 0.4)) - 1) / 50, size = 1, texture = particle_texture .. "^[transform" .. math.random(0, 7), }) @@ -76,42 +80,48 @@ local function laser_shoot(player, range, particle_texture, sound) minetest.record_protection_violation(pos, player_name) break end - local node = minetest.get_node_or_nil(pos) - if not node then + local node = minetest.get_node(pos) + if node.name == "ignore" + or not minetest.registered_nodes[node.name] then break end - if not no_destroy[node.name] then + if not can_keep_node(node.name) then laser_node(pos, node, player) end end end - for _, m in pairs(mining_lasers_list) do technic.register_power_tool("technic:laser_mk"..m[1], m[3]) minetest.register_tool("technic:laser_mk"..m[1], { description = S("Mining Laser Mk%d"):format(m[1]), inventory_image = "technic_mining_laser_mk"..m[1]..".png", + range = 0, stack_max = 1, wear_represents = "technic_RE_charge", on_refill = technic.refill_RE_charge, on_use = function(itemstack, user) local meta = minetest.deserialize(itemstack:get_metadata()) - if not meta or not meta.charge then + if not meta or not meta.charge or meta.charge == 0 then return end - -- If there's enough charge left, fire the laser - if meta.charge >= m[4] then - laser_shoot(user, m[2], "technic_laser_beam_mk"..m[1]..".png", "technic_laser_mk"..m[1]) - if not technic.creative_mode then - meta.charge = meta.charge - m[4] - technic.set_RE_wear(itemstack, meta.charge, m[3]) - itemstack:set_metadata(minetest.serialize(meta)) + local range = m[2] + if meta.charge < m[4] then + if not allow_entire_discharging then + return end + -- If charge is too low, give the laser a shorter range + range = range * meta.charge / m[4] + end + laser_shoot(user, range, "technic_laser_beam_mk" .. m[1] .. ".png", + "technic_laser_mk" .. m[1]) + if not technic.creative_mode then + meta.charge = math.max(meta.charge - m[4], 0) + technic.set_RE_wear(itemstack, meta.charge, m[3]) + itemstack:set_metadata(minetest.serialize(meta)) end return itemstack end, }) end - From d1b54a573c6287ea1d63b9c3f979c39058b1331a Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Sat, 21 Jul 2018 20:11:12 +0300 Subject: [PATCH 09/16] Use tin from MTG instead of `moreores` (#401) Register tin dust unconditionally --- technic/crafts.lua | 2 +- technic/machines/register/alloy_recipes.lua | 2 +- technic/machines/register/battery_box.lua | 2 +- technic/machines/register/grinder_recipes.lua | 6 +++--- technic/radiation.lua | 4 ++-- technic/tools/mining_drill.lua | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/technic/crafts.lua b/technic/crafts.lua index 14bafd3..5d3ae04 100644 --- a/technic/crafts.lua +++ b/technic/crafts.lua @@ -164,7 +164,7 @@ minetest.register_craft({ recipe = { {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'}, {'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, - {'moreores:tin_ingot', 'moreores:tin_ingot', 'moreores:tin_ingot'}, + {'default:tin_ingot', 'default:tin_ingot', 'default:tin_ingot'}, } }) diff --git a/technic/machines/register/alloy_recipes.lua b/technic/machines/register/alloy_recipes.lua index bd09bd6..3aeacd5 100644 --- a/technic/machines/register/alloy_recipes.lua +++ b/technic/machines/register/alloy_recipes.lua @@ -13,7 +13,7 @@ end local recipes = { {"technic:copper_dust 3", "technic:tin_dust", "technic:bronze_dust 4"}, - {"default:copper_ingot 3", "moreores:tin_ingot", "default:bronze_ingot 4"}, + {"default:copper_ingot 3", "default:tin_ingot", "default:bronze_ingot 4"}, {"technic:wrought_iron_dust", "technic:coal_dust", "technic:carbon_steel_dust", 3}, {"technic:wrought_iron_ingot", "technic:coal_dust", "technic:carbon_steel_ingot", 3}, {"technic:carbon_steel_dust", "technic:coal_dust", "technic:cast_iron_dust", 3}, diff --git a/technic/machines/register/battery_box.lua b/technic/machines/register/battery_box.lua index 7f25dfd..d10b705 100644 --- a/technic/machines/register/battery_box.lua +++ b/technic/machines/register/battery_box.lua @@ -18,7 +18,7 @@ minetest.register_craft({ output = "technic:battery", recipe = { {"group:wood", "default:copper_ingot", "group:wood"}, - {"group:wood", "moreores:tin_ingot", "group:wood"}, + {"group:wood", "default:tin_ingot", "group:wood"}, {"group:wood", "default:copper_ingot", "group:wood"}, } }) diff --git a/technic/machines/register/grinder_recipes.lua b/technic/machines/register/grinder_recipes.lua index fa55e7a..1f4047c 100644 --- a/technic/machines/register/grinder_recipes.lua +++ b/technic/machines/register/grinder_recipes.lua @@ -15,6 +15,7 @@ local recipes = { {"default:desert_stone", "default:desert_sand"}, {"default:gold_lump", "technic:gold_dust 2"}, {"default:iron_lump", "technic:wrought_iron_dust 2"}, + {"default:tin_lump", "technic:tin_dust 2"}, {"technic:chromium_lump", "technic:chromium_dust 2"}, {"technic:uranium_lump", "technic:uranium_dust 2"}, {"technic:zinc_lump", "technic:zinc_dust 2"}, @@ -43,7 +44,6 @@ end if minetest.get_modpath("moreores") then table.insert(recipes, {"moreores:mithril_lump", "technic:mithril_dust 2"}) table.insert(recipes, {"moreores:silver_lump", "technic:silver_dust 2"}) - table.insert(recipes, {"moreores:tin_lump", "technic:tin_dust 2"}) end if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then @@ -94,9 +94,9 @@ register_dust("Gold", "default:gold_ingot") register_dust("Mithril", "moreores:mithril_ingot") register_dust("Silver", "moreores:silver_ingot") register_dust("Stainless Steel", "technic:stainless_steel_ingot") -register_dust("Stone", "default:stone") +register_dust("Stone", "default:stone") register_dust("Sulfur", nil) -register_dust("Tin", "moreores:tin_ingot") +register_dust("Tin", "default:tin_ingot") register_dust("Wrought Iron", "technic:wrought_iron_ingot") register_dust("Zinc", "technic:zinc_ingot") if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then diff --git a/technic/radiation.lua b/technic/radiation.lua index 722b0ac..a4c49c6 100644 --- a/technic/radiation.lua +++ b/technic/radiation.lua @@ -54,6 +54,7 @@ local rad_resistance_node = { ["default:lava_source"] = 17, ["default:mese"] = 21, ["default:mossycobble"] = 15, + ["default:tinblock"] = 37, ["pbj_pup:pbj_pup"] = 10000, ["pbj_pup:pbj_pup_candies"] = 10000, ["gloopblocks:rainbow_block_diagonal"] = 5000, @@ -76,6 +77,7 @@ local rad_resistance_node = { ["default:stone_with_gold"] = 34, ["default:stone_with_iron"] = 20, ["default:stone_with_mese"] = 17, + ["default:stone_with_tin"] = 19, ["default:stonebrick"] = 17, ["default:water_flowing"] = 2.8, ["default:water_source"] = 5.6, @@ -141,10 +143,8 @@ local rad_resistance_node = { ["moreblocks:wood_tile_up"] = 1.7, ["moreores:mineral_mithril"] = 18, ["moreores:mineral_silver"] = 21, - ["moreores:mineral_tin"] = 19, ["moreores:mithril_block"] = 26, ["moreores:silver_block"] = 53, - ["moreores:tin_block"] = 37, ["snow:snow_brick"] = 2.8, ["technic:brass_block"] = 43, ["technic:carbon_steel_block"] = 40, diff --git a/technic/tools/mining_drill.lua b/technic/tools/mining_drill.lua index bc426e7..1cf7491 100644 --- a/technic/tools/mining_drill.lua +++ b/technic/tools/mining_drill.lua @@ -6,7 +6,7 @@ local S = technic.getter minetest.register_craft({ output = 'technic:mining_drill', recipe = { - {'moreores:tin_ingot', 'technic:diamond_drill_head', 'moreores:tin_ingot'}, + {'default:tin_ingot', 'technic:diamond_drill_head', 'default:tin_ingot'}, {'technic:stainless_steel_ingot', 'technic:motor', 'technic:stainless_steel_ingot'}, {'', 'technic:red_energy_crystal', 'default:copper_ingot'}, } From 9b40d02fbd9e8c39c5c64cc7de89a7fe45382f04 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sat, 4 Aug 2018 09:57:30 +0200 Subject: [PATCH 10/16] Revert get_3d to deprecated get3d for 0.4.x compatibility --- technic_worldgen/oregen.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/technic_worldgen/oregen.lua b/technic_worldgen/oregen.lua index fb7ac84..4fd41fd 100644 --- a/technic_worldgen/oregen.lua +++ b/technic_worldgen/oregen.lua @@ -167,7 +167,7 @@ minetest.register_on_generated(function(minp, maxp) for z = minp.z + math.floor(grid_size / 2), maxp.z, grid_size do local c = data[a:index(x, y, z)] if (c == c_lava or c == c_lava_flowing) - and sulfur_noise:get_3d({x = x, y = z, z = z}) >= 0.4 then + and sulfur_noise:get3d({x = x, y = z, z = z}) >= 0.4 then for i in a:iter( math.max(minp.x, x - grid_size), math.max(minp.y, y - grid_size), From 86a04d860e1f59ec481ab07662c0adfb420a4693 Mon Sep 17 00:00:00 2001 From: ChimneySwift Date: Sat, 25 Aug 2018 20:22:18 +1000 Subject: [PATCH 11/16] manual.md: Corrections and straightening of facts (#406) - There are manuals for all of the modpacks Technic depends on (possibly this is recent) - Tin is now part of minetest_game - Minor typo fixes --- manual.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/manual.md b/manual.md index 4ad01fc..edca994 100644 --- a/manual.md +++ b/manual.md @@ -14,8 +14,13 @@ The technic modpack depends on some other modpacks: * pipeworks, which supports the automation of item transport * moreores, which provides some additional ore types -This manual doesn't explain how to use these other modpacks, which ought -to (but actually don't) have their own manuals. +This manual doesn't explain how to use these other modpacks, which have +their own manuals: + +* [Minetest Game Documentation](https://wiki.minetest.net/Main_Page) +* [Mesecons Documentation](http://mesecons.net/items.html) +* [Pipeworks Documentation](https://github.com/minetest-mods/pipeworks/wiki) +* [Moreores Forum Post](https://forum.minetest.net/viewtopic.php?t=549) Recipes for constructable items in technic are generally not guessable, and are also not specifically documented here. You should use a @@ -68,10 +73,11 @@ own for its electrical conductivity, or as the base component of alloys. Although common, it is very heavily used, and most of the time it will be the material that most limits your activity. -Tin is supplied by the moreores mod. It is found from elevation +8 -downwards, with no elevation-dependent variations in abundance beyond -that point. It is a common metal. Its main use in pure form is as a -component of electrical batteries. Apart from that its main purpose is +Tin is part of the basic Minetest game (having migrated there from +moreores). It is found from elevation +8 downwards, with no +elevation-dependent variations in abundance beyond that point. +It is a common metal. Its main use in pure form is as a component +of electrical batteries. Apart from that its main purpose is as the secondary ingredient in bronze (the base being copper), but bronze is itself little used. Its abundance is well in excess of its usage, so you will usually have a surplus of it. @@ -986,7 +992,7 @@ through a side. The furnace, alloy furnace, grinder, extractor, compressor, and centrifuge have much in common. Each implements some industrial process that -transforms items into other items, and they manner in which they present +transforms items into other items, and the manner in which they present these processes as powered machines is essentially identical. Most of the processing machines operate on inputs of only a single type @@ -1011,7 +1017,7 @@ input slot, this is perfectly simple behavior. The alloy furnace is more complex: it will put an arriving item in either input slot, preferring to stack it with existing items of the same type. It doesn't matter which slot each of the alloy furnace's inputs is in, so it doesn't matter that -there's no direct control ovar that, but there is a risk that supplying +there's no direct control over that, but there is a risk that supplying a lot of one item type through tubes will result in both slots containing the same type of item, leaving no room for the second input. @@ -1195,7 +1201,7 @@ power generators ### fuel-fired generators ### -The fiel-fired generators are electrical power generators that generate +The fuel-fired generators are electrical power generators that generate power by the combustion of fuel. Versions of them are available for all three voltages (LV, MV, and HV). These are all capable of burning any type of combustible fuel, such as coal. They are relatively easy From 2e7859c35e55b842752c6533edae2dd19290fabc Mon Sep 17 00:00:00 2001 From: Tanmaya Meher Date: Sat, 25 Aug 2018 15:54:14 +0530 Subject: [PATCH 12/16] New MV Hydro Machine (#412) * New MV hydro with upgraded power The LV hydro is easy to make giving lot of power. The New hydro MV will put a tier system to it; thereby giving more incentive to player to pursue MV hydro plus a little survival aspect. This is a result of [Detailed discussion which is here](https://github.com/minetest-mods/technic/issues/411). Thanks to VanessaE for a good talk and support and enthusiasm to make one :) This will now produce around 175 EU (in between 150-200, so basically average). The MV hydro will give 10x more power than this one. :) --- technic/machines/LV/water_mill.lua | 10 +- technic/machines/MV/hydro_turbine.lua | 105 ++++++++++++++++++ technic/machines/MV/init.lua | 1 + .../textures/technic_hydro_turbine_side.png | Bin 0 -> 752 bytes .../textures/technic_hydro_turbine_top.png | Bin 0 -> 671 bytes .../technic_hydro_turbine_top_active.png | Bin 0 -> 669 bytes 6 files changed, 110 insertions(+), 6 deletions(-) create mode 100644 technic/machines/MV/hydro_turbine.lua create mode 100644 technic/textures/technic_hydro_turbine_side.png create mode 100644 technic/textures/technic_hydro_turbine_top.png create mode 100644 technic/textures/technic_hydro_turbine_top_active.png diff --git a/technic/machines/LV/water_mill.lua b/technic/machines/LV/water_mill.lua index 5d871f0..33834ec 100644 --- a/technic/machines/LV/water_mill.lua +++ b/technic/machines/LV/water_mill.lua @@ -1,6 +1,6 @@ -- A water mill produces LV EUs by exploiting flowing water across it --- It is a LV EU supplyer and fairly low yield (max 120EUs) --- It is a little under half as good as the thermal generator. +-- It is a LV EU supplyer and fairly low yield (max 180EUs) +-- It is a little over half as good as the thermal generator. local S = technic.getter @@ -29,11 +29,9 @@ end local run = function(pos, node) local meta = minetest.get_meta(pos) local water_flow = 0 - local lava_nodes = 0 local production_level = 0 local eu_supply = 0 - local max_output = 35 * 45 -- four param2's at 15 makes 60, cap it lower for "overload protection" - -- (plus we want the gen to report 100% if three sides have full flow) + local max_output = 4 * 45 -- keeping it around 180, little more than previous 150 :) local positions = { {x=pos.x+1, y=pos.y, z=pos.z}, @@ -49,7 +47,7 @@ local run = function(pos, node) end end - eu_supply = math.min(35 * water_flow, max_output) + eu_supply = math.min(4 * water_flow, max_output) production_level = math.floor(100 * eu_supply / max_output) meta:set_int("LV_EU_supply", eu_supply) diff --git a/technic/machines/MV/hydro_turbine.lua b/technic/machines/MV/hydro_turbine.lua new file mode 100644 index 0000000..36aac91 --- /dev/null +++ b/technic/machines/MV/hydro_turbine.lua @@ -0,0 +1,105 @@ +-- A Hydro Turbine produces MV EUs by exploiting flowing water across it +-- It is a MV EU supplyer and fairly high yield (max 1800EUs) + +local S = technic.getter + +local cable_entry = "^technic_cable_connection_overlay.png" + +minetest.register_alias("hydro_turbine", "technic:hydro_turbine") + +minetest.register_craft({ + output = 'technic:hydro_turbine', + recipe = { + {'technic:stainless_steel_ingot', 'technic:water_mill', 'technic:stainless_steel_ingot'}, + {'technic:water_mill', 'technic:mv_transformer', 'technic:water_mill'}, + {'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'}, + } +}) + +local function get_water_flow(pos) + local node = minetest.get_node(pos) + if minetest.get_item_group(node.name, "water") == 3 then + return node.param2 -- returns approx. water flow, if any + end + return 0 +end + +--- +-- 10 times better than LV hydro because of 2 extra water mills and 4 stainless steel, a transformer and whatnot ;P. +-- Man hydro turbines are tough and long lasting. So, give it some value :) +local run = function(pos, node) + local meta = minetest.get_meta(pos) + local water_flow = 0 + local production_level = 0 + local eu_supply = 0 + local max_output = 40 * 45 -- Generates 1800EU/s + + local positions = { + {x=pos.x+1, y=pos.y, z=pos.z}, + {x=pos.x-1, y=pos.y, z=pos.z}, + {x=pos.x, y=pos.y, z=pos.z+1}, + {x=pos.x, y=pos.y, z=pos.z-1}, + } + + for _, p in pairs(positions) do + water_flow = water_flow + get_water_flow(p) + end + + eu_supply = math.min(40 * water_flow, max_output) + production_level = math.floor(100 * eu_supply / max_output) + + meta:set_int("MV_EU_supply", eu_supply) + + meta:set_string("infotext", + S("Hydro %s Generator"):format("MV").." ("..production_level.."%)") + if production_level > 0 and + minetest.get_node(pos).name == "technic:hydro_turbine" then + technic.swap_node(pos, "technic:hydro_turbine_active") + meta:set_int("MV_EU_supply", 0) + return + end + if production_level == 0 then + technic.swap_node(pos, "technic:hydro_turbine") + end +end + +minetest.register_node("technic:hydro_turbine", { + description = S("Hydro %s Generator"):format("MV"), + tiles = { + "technic_hydro_turbine_top.png", + "technic_machine_bottom.png"..cable_entry, + "technic_hydro_turbine_side.png", + "technic_hydro_turbine_side.png", + "technic_hydro_turbine_side.png", + "technic_hydro_turbine_side.png" + }, + paramtype2 = "facedir", + groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, + technic_machine=1, technic_mv=1}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", S("Hydro %s Generator"):format("MV")) + meta:set_int("MV_EU_supply", 0) + end, + technic_run = run, +}) + +minetest.register_node("technic:hydro_turbine_active", { + description = S("Hydro %s Generator"):format("MV"), + tiles = {"technic_hydro_turbine_top_active.png", "technic_machine_bottom.png", + "technic_hydro_turbine_side.png", "technic_hydro_turbine_side.png", + "technic_hydro_turbine_side.png", "technic_hydro_turbine_side.png"}, + paramtype2 = "facedir", + groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, + technic_machine=1, technic_mv=1, not_in_creative_inventory=1}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + drop = "technic:hydro_turbine", + technic_run = run, + technic_disabled_machine_name = "technic:hydro_turbine", +}) + +technic.register_machine("MV", "technic:hydro_turbine", technic.producer) +technic.register_machine("MV", "technic:hydro_turbine_active", technic.producer) diff --git a/technic/machines/MV/init.lua b/technic/machines/MV/init.lua index 72a98b6..7092fda 100644 --- a/technic/machines/MV/init.lua +++ b/technic/machines/MV/init.lua @@ -13,6 +13,7 @@ if technic.config:get_bool("enable_wind_mill") then end dofile(path.."/generator.lua") dofile(path.."/solar_array.lua") +dofile(path.."/hydro_turbine.lua") -- Machines dofile(path.."/alloy_furnace.lua") diff --git a/technic/textures/technic_hydro_turbine_side.png b/technic/textures/technic_hydro_turbine_side.png new file mode 100644 index 0000000000000000000000000000000000000000..eeb5ab2a817dda197a1615e5c2179235bc6dd1aa GIT binary patch literal 752 zcmVgZ&OzrdCz=mXA4q z!5`)5aAbAqlB+8l-Ko;az1J^Fz*(IakZ2O4Xbs5_uM1_PXRxGJ$$#rXqpU$ zfsripY(OdGldCH=K3YK)AV-oV1LIz|fhxO|LRQn1!%qiDl?X7re9F>!dNbjR1wXt# ziK$}MZd%apG})k!8l<3oG5@{gIb+3Aq0zDcSBgvDVx%YO?7)Q*l10qd$- z7wcQ8uy=j_lm&YPj{Y->7(rkTpPcZC0F6rp0!z~sFip()))&4+=EpoW&VogVnYr=w zKMNDEuV9jf--)FomJj&){R3z=O}UWay=!m!QJBQRx^;NbrjE+Q^jp_Bw=jqYnKe|* zJH(onK{lu&@bRE`?wobsrmps!n%`(zCPgj7*TJ{xdP zPq?=t9avpqnIJ>^LIL`Hj#>B-U%cRoXqPMuSwGN_im_&zhGFO$xhS$MO9&}C)-1~j ik}UB?!zPj;B>w|CocR7;s8aj@0000Zgp5QhDq5JHHGw(uELwR`0D8OMno=XR3KX4$p^Ar(+R@PnBaX=KUQ%slTqD9cl& zGvr*kAcWG4$&912Hc=8FAsCmW>g%#9(7H^RM0rNt)S#*@qh zQPi6?6H&1RHAt)!5 zB~Tw{xhQm|v>Jx`v<@myDUA@uflO&pq_$Gi)KVVL%LwhGaqhif-?_$CrXMWhcsdMj zY!RmM`fbh%KF!^Hbf#1o``u8XEMs1{lZyAQffu$esbpc~qvO&?@$RrL!!-5IwL`}^ zVI)S@sUvx0=&f}q{M%CTvX0>{$@EX=f@M8Kx)_e{zjLINg5?SrGc9| z(^%M=sxY-qmAKp8nNkB2$|V6Wjh1=No4)yP^3T^5gn;4sa`UyS%=vs!iY7QjeXC8u zt3CRgvOw(NLd(q{{RD4E9E_M7lHr)002ovPDHLk FV1jZ`MYR9` literal 0 HcmV?d00001 diff --git a/technic/textures/technic_hydro_turbine_top_active.png b/technic/textures/technic_hydro_turbine_top_active.png new file mode 100644 index 0000000000000000000000000000000000000000..54ff90ff4eb396144ffee4b2c2ee2c7bfb3d73fb GIT binary patch literal 669 zcmV;O0%HA%P)Q>%Vxbs;~Y+ zMVTvIAn)sEe@B!TOcor~tx2*73BkA|jcel{uve!Z?ySt*YEMYMy(_)8#lJSkvNyXg~PQHpY#X zaXcSJKlKRHbp5gv6`z-3IeAknjKg7UP*JcT-buxs@8E@PYbsfsgy?j1NxD0%$8nyW z_x(69P8dm%wW=TLCrHrE_GYuY-EKdlJjcs2O34rFvaY@#Y@F;L%asB%f%BYYp zf-Vyzln{~%$y?XhPB)#N=dNih@D`JplJNfFs7kgAH^=kw@^D5owA%M!xY4y@k|tS5 zY2@d@bQZRzsZ6VLC2n`Orq;lON=d*=qh(q0&UH`l|Lf!DPfcSkmxEF?!!dHbHWjzF z{BoYa!*?IvJ%9P))tjrUw^vu!uiw7E2E}POEu*zM3T}~B3}VB~fLVSTDh)vN>$iJG zuXD2qIlL*h?00000NkvXXu0mjf DS};SM literal 0 HcmV?d00001 From d74c250a40d11df0d466f750e30e5575e3212706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Thu, 16 Aug 2018 12:43:02 +0200 Subject: [PATCH 13/16] Preserve active timers at frame move Previously timers were not copied over to the new nodes when frames move. This lead to blinky plants from mesecons to stop working after a platform has moved, and buttons getting stuck in their pressed state. Now the timers state for active timers are copied from the old node positions to the new node positions. --- technic/machines/other/frames.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/technic/machines/other/frames.lua b/technic/machines/other/frames.lua index 5459289..2e2a830 100644 --- a/technic/machines/other/frames.lua +++ b/technic/machines/other/frames.lua @@ -114,7 +114,17 @@ local function move_nodes_vect(poslist,vect,must_not_move,owner) for _, pos in ipairs(poslist) do local node = minetest.get_node(pos) local meta = minetest.get_meta(pos):to_table() - nodelist[#(nodelist)+1] = {oldpos = pos, pos = vector.add(pos, vect), node = node, meta = meta} + local timer = minetest.get_node_timer(pos) + nodelist[#nodelist+1] = { + oldpos = pos, + pos = vector.add(pos, vect), + node = node, + meta = meta, + timer = { + timeout = timer:get_timeout(), + elapsed = timer:get_elapsed() + } + } end local objects = {} for _, pos in ipairs(poslist) do @@ -133,6 +143,10 @@ local function move_nodes_vect(poslist,vect,must_not_move,owner) minetest.set_node(npos, n.node) local meta = minetest.get_meta(npos) meta:from_table(n.meta) + local timer = minetest.get_node_timer(npos) + if n.timer.timeout ~= 0 or n.timer.elapsed ~= 0 then + timer:set(n.timer.timeout, n.timer.elapsed) + end for __,pos in ipairs(poslist) do if npos.x == pos.x and npos.y == pos.y and npos.z == pos.z then table.remove(poslist, __) From 488f80d95095efeae38e08884b5ba34724e1bf71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Thu, 16 Aug 2018 13:47:43 +0200 Subject: [PATCH 14/16] Clean file frames.lua to make more readable - "#(array)" replaced with "#array" - "(a and b) or c" replaced with "a and b or c" - Cleaned some other places with unnecessary parenthesis - "a,b" replaced with "a, b" - "a+b" replaced with "a + b" (and for all other binops) - "{a, b, c}" replaced with "{ a, b, c }" - "-n + a" replaced with "a - n" - Removed trailing whitespace - Blank lines added in some very dense places - Very long lines broken into shorter lines - Use modern functions like vector.new and vector.round - Align with spaces instead of tabs --- technic/machines/other/frames.lua | 641 +++++++++++++++++------------- 1 file changed, 365 insertions(+), 276 deletions(-) diff --git a/technic/machines/other/frames.lua b/technic/machines/other/frames.lua index 2e2a830..d5c60a3 100644 --- a/technic/machines/other/frames.lua +++ b/technic/machines/other/frames.lua @@ -1,56 +1,71 @@ - local S = technic.getter frames = {} -local infinite_stacks = minetest.settings:get_bool("creative_mode") and minetest.get_modpath("unified_inventory") == nil +local infinite_stacks = minetest.settings:get_bool("creative_mode") + and minetest.get_modpath("unified_inventory") == nil local frames_pos = {} -- Helpers -local function get_face(pos,ppos,pvect) +local function get_face(pos, ppos, pvect) -- Raytracer to get which face has been clicked - ppos={x=ppos.x-pos.x,y=ppos.y-pos.y+1.5,z=ppos.z-pos.z} - if pvect.x>0 then - local t=(-0.5-ppos.x)/pvect.x - local y_int=ppos.y+t*pvect.y - local z_int=ppos.z+t*pvect.z - if y_int>-0.45 and y_int<0.45 and z_int>-0.45 and z_int<0.45 then return 1 end - elseif pvect.x<0 then - local t=(0.5-ppos.x)/pvect.x - local y_int=ppos.y+t*pvect.y - local z_int=ppos.z+t*pvect.z - if y_int>-0.45 and y_int<0.45 and z_int>-0.45 and z_int<0.45 then return 2 end + ppos = { x = ppos.x - pos.x, y = ppos.y - pos.y + 1.5, z = ppos.z - pos.z } + + if pvect.x > 0 then + local t = (-0.5 - ppos.x) / pvect.x + local y_int = ppos.y + t * pvect.y + local z_int = ppos.z + t * pvect.z + if y_int > -0.45 and y_int < 0.45 and z_int > -0.45 and z_int < 0.45 then + return 1 + end + elseif pvect.x < 0 then + local t = (0.5 - ppos.x) / pvect.x + local y_int = ppos.y + t * pvect.y + local z_int = ppos.z + t * pvect.z + if y_int > -0.45 and y_int < 0.45 and z_int > -0.45 and z_int < 0.45 then + return 2 + end end - if pvect.y>0 then - local t=(-0.5-ppos.y)/pvect.y - local x_int=ppos.x+t*pvect.x - local z_int=ppos.z+t*pvect.z - if x_int>-0.45 and x_int<0.45 and z_int>-0.45 and z_int<0.45 then return 3 end - elseif pvect.y<0 then - local t=(0.5-ppos.y)/pvect.y - local x_int=ppos.x+t*pvect.x - local z_int=ppos.z+t*pvect.z - if x_int>-0.45 and x_int<0.45 and z_int>-0.45 and z_int<0.45 then return 4 end + + if pvect.y > 0 then + local t = (-0.5 - ppos.y) / pvect.y + local x_int = ppos.x + t * pvect.x + local z_int = ppos.z + t * pvect.z + if x_int > -0.45 and x_int < 0.45 and z_int > -0.45 and z_int < 0.45 then + return 3 + end + elseif pvect.y < 0 then + local t = (0.5 - ppos.y) / pvect.y + local x_int = ppos.x + t * pvect.x + local z_int = ppos.z + t * pvect.z + if x_int > -0.45 and x_int < 0.45 and z_int > -0.45 and z_int < 0.45 then + return 4 + end end - if pvect.z>0 then - local t=(-0.5-ppos.z)/pvect.z - local x_int=ppos.x+t*pvect.x - local y_int=ppos.y+t*pvect.y - if x_int>-0.45 and x_int<0.45 and y_int>-0.45 and y_int<0.45 then return 5 end - elseif pvect.z<0 then - local t=(0.5-ppos.z)/pvect.z - local x_int=ppos.x+t*pvect.x - local y_int=ppos.y+t*pvect.y - if x_int>-0.45 and x_int<0.45 and y_int>-0.45 and y_int<0.45 then return 6 end + + if pvect.z > 0 then + local t = (-0.5 - ppos.z) / pvect.z + local x_int = ppos.x + t * pvect.x + local y_int = ppos.y + t * pvect.y + if x_int > -0.45 and x_int < 0.45 and y_int > -0.45 and y_int < 0.45 then + return 5 + end + elseif pvect.z < 0 then + local t = (0.5 - ppos.z) / pvect.z + local x_int = ppos.x + t * pvect.x + local y_int = ppos.y + t * pvect.y + if x_int > -0.45 and x_int < 0.45 and y_int > -0.45 and y_int < 0.45 then + return 6 + end end end local function lines(str) local t = {} local function helper(line) table.insert(t, line) return "" end - helper((str:gsub("(.-)\r?\n", helper))) + helper(str:gsub("(.-)\r?\n", helper)) return t end @@ -63,12 +78,14 @@ end local function pos_from_string(str) local l = lines(str) - return {x = tonumber(l[1]), y = tonumber(l[2]), z = tonumber(l[3])} + return { x = tonumber(l[1]), y = tonumber(l[2]), z = tonumber(l[3]) } end -local function pos_in_list(l,pos) - for _,p in ipairs(l) do - if p.x==pos.x and p.y==pos.y and p.z==pos.z then return true end +local function pos_in_list(l, pos) + for _, p in ipairs(l) do + if p.x == pos.x and p.y == pos.y and p.z == pos.z then + return true + end end return false end @@ -80,42 +97,42 @@ local function table_empty(table) return true end -local function add_table(table,toadd) +local function add_table(table, toadd) local i = 1 while true do o = table[i] if o == toadd then return end if o == nil then break end - i = i+1 + i = i + 1 end table[i] = toadd end -local function move_nodes_vect(poslist,vect,must_not_move,owner) +local function move_nodes_vect(poslist, vect, must_not_move, owner) if minetest.is_protected then - for _,pos in ipairs(poslist) do - local npos=vector.add(pos,vect) + for _, pos in ipairs(poslist) do + local npos = vector.add(pos, vect) if minetest.is_protected(pos, owner) or minetest.is_protected(npos, owner) then return end end end - for _,pos in ipairs(poslist) do - local npos=vector.add(pos,vect) + + for _, pos in ipairs(poslist) do + local npos = vector.add(pos, vect) local name = minetest.get_node(npos).name - if ((name~="air" and minetest.registered_nodes[name].liquidtype=="none") or frames_pos[pos_to_string(npos)]) and not(pos_in_list(poslist,npos)) then + if (name ~= "air" and minetest.registered_nodes[name].liquidtype == "none" or + frames_pos[pos_to_string(npos)]) and not pos_in_list(poslist, npos) then return end - --[[if pos.x==must_not_move.x and pos.y==must_not_move.y and pos.z==must_not_move.z then - return - end]] end + local nodelist = {} for _, pos in ipairs(poslist) do local node = minetest.get_node(pos) local meta = minetest.get_meta(pos):to_table() local timer = minetest.get_node_timer(pos) - nodelist[#nodelist+1] = { + nodelist[#nodelist + 1] = { oldpos = pos, pos = vector.add(pos, vect), node = node, @@ -126,19 +143,22 @@ local function move_nodes_vect(poslist,vect,must_not_move,owner) } } end + local objects = {} for _, pos in ipairs(poslist) do - for _,object in ipairs(minetest.get_objects_inside_radius(pos, 1)) do + for _, object in ipairs(minetest.get_objects_inside_radius(pos, 1)) do local entity = object:get_luaentity() if not entity or not mesecon.is_mvps_unmov(entity.name) then add_table(objects, object) end end end + for _, obj in ipairs(objects) do obj:setpos(vector.add(obj:getpos(), vect)) end - for _,n in ipairs(nodelist) do + + for _, n in ipairs(nodelist) do local npos = n.pos minetest.set_node(npos, n.node) local meta = minetest.get_meta(npos) @@ -147,123 +167,136 @@ local function move_nodes_vect(poslist,vect,must_not_move,owner) if n.timer.timeout ~= 0 or n.timer.elapsed ~= 0 then timer:set(n.timer.timeout, n.timer.elapsed) end - for __,pos in ipairs(poslist) do + for __, pos in ipairs(poslist) do if npos.x == pos.x and npos.y == pos.y and npos.z == pos.z then table.remove(poslist, __) break end end end + for __, pos in ipairs(poslist) do minetest.remove_node(pos) end + for _, callback in ipairs(mesecon.on_mvps_move) do callback(nodelist) end end local function is_supported_node(name) - return ((string.find(name, "tube") ~= nil) and (string.find(name, "pipeworks") ~= nil)) + return string.find(name, "tube") and string.find(name, "pipeworks") end - -- Frames -for xm=0,1 do -for xp=0,1 do -for ym=0,1 do -for yp=0,1 do -for zm=0,1 do -for zp=0,1 do +for xm = 0, 1 do +for xp = 0, 1 do +for ym = 0, 1 do +for yp = 0, 1 do +for zm = 0, 1 do +for zp = 0, 1 do -local a=8/16 -local b=7/16 -local nodeboxes= { - { -a, -a, -a, -b, a, -b }, - { -a, -a, b, -b, a, a }, - { b, -a, b, a, a, a }, - { b, -a, -a, a, a, -b }, + local a = 8 / 16 + local b = 7 / 16 + local nodeboxes = { + { -a, -a, -a, -b, a, -b }, + { -a, -a, b, -b, a, a }, - { -b, b, -a, b, a, -b }, - { -b, -a, -a, b, -b, -b }, - - { -b, b, b, b, a, a }, - { -b, -a, b, b, -b, a }, + { b, -a, b, a, a, a }, + { b, -a, -a, a, a, -b }, - { b, b, -b, a, a, b }, - { b, -a, -b, a, -b, b }, + { -b, b, -a, b, a, -b }, + { -b, -a, -a, b, -b, -b }, - { -a, b, -b, -b, a, b }, - { -a, -a, -b, -b, -b, b }, + { -b, b, b, b, a, a }, + { -b, -a, b, b, -b, a }, + + { b, b, -b, a, a, b }, + { b, -a, -b, a, -b, b }, + + { -a, b, -b, -b, a, b }, + { -a, -a, -b, -b, -b, b }, } - - if yp==0 then - table.insert(nodeboxes, {-b,b,-b, b,a,b}) - end - if ym==0 then - table.insert(nodeboxes, {-b,-a,-b, b,-b,b}) - end - if xp==0 then - table.insert(nodeboxes, {b,b,b,a,-b,-b}) - end - if xm==0 then - table.insert(nodeboxes, {-a,-b,-b,-b,b,b}) - end - if zp==0 then - table.insert(nodeboxes, {-b,-b,b, b,b,a}) - end - if zm==0 then - table.insert(nodeboxes, {-b,-b,-a, b,b,-b}) - end - - local nameext=tostring(xm)..tostring(xp)..tostring(ym)..tostring(yp)..tostring(zm)..tostring(zp) - local groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2} - if nameext~="111111" then groups.not_in_creative_inventory=1 end - - minetest.register_node("technic:frame_"..nameext,{ + if yp == 0 then + table.insert(nodeboxes, { -b, b, -b, b, a, b }) + end + if ym == 0 then + table.insert(nodeboxes, { -b, -a, -b, b, -b, b }) + end + if xp == 0 then + table.insert(nodeboxes, { b, b, b, a, -b, -b }) + end + if xm == 0 then + table.insert(nodeboxes, { -a, -b, -b, -b, b, b }) + end + if zp == 0 then + table.insert(nodeboxes, { -b, -b, b, b, b, a }) + end + if zm == 0 then + table.insert(nodeboxes, { -b, -b, -a, b, b, -b }) + end + + local nameext = string.format("%d%d%d%d%d%d", xm, xp, ym, yp, zm, zp) + local groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 } + if nameext ~= "111111" then groups.not_in_creative_inventory = 1 end + + + minetest.register_node("technic:frame_"..nameext, { description = S("Frame"), - tiles = {"technic_frame.png"}, - groups=groups, + tiles = { "technic_frame.png" }, + groups = groups, drawtype = "nodebox", node_box = { type = "fixed", - fixed=nodeboxes, + fixed = nodeboxes, }, selection_box = { - type="fixed", - fixed={-0.5,-0.5,-0.5,0.5,0.5,0.5} + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } }, paramtype = "light", - frame=1, - drop="technic:frame_111111", + frame = 1, + drop = "technic:frame_111111", sunlight_propagates = true, - frame_connect_all=function(nodename) - l2={} - l1={{x=-1,y=0,z=0},{x=1,y=0,z=0},{x=0,y=-1,z=0},{x=0,y=1,z=0},{x=0,y=0,z=-1},{x=0,y=0,z=1}} - for i,dir in ipairs(l1) do - if string.sub(nodename,-7+i,-7+i)=="1" then - l2[#(l2)+1]=dir + + frame_connect_all = function(nodename) + l2 = {} + l1 = { + { x = -1, y = 0, z = 0 }, { x = 1, y = 0, z = 0 }, + { x = 0, y = -1, z = 0 }, { x = 0, y = 1, z = 0 }, + { x = 0, y = 0, z = -1 }, { x = 0, y = 0, z = 1 } + } + for i, dir in ipairs(l1) do + if string.sub(nodename, -7 + i, -7 + i) == "1" then + l2[#l2 + 1] = dir end end return l2 end, - on_punch=function(pos,node,puncher) - local ppos=puncher:getpos() - local pvect=puncher:get_look_dir() - local pface=get_face(pos,ppos,pvect) - if pface==nil then return end - local nodename=node.name - local newstate=tostring(1-tonumber(string.sub(nodename,-7+pface,-7+pface))) - if pface<=5 then - nodename=string.sub(nodename,1,-7+pface-1)..newstate..string.sub(nodename,-7+pface+1) + + on_punch = function(pos, node, puncher) + local ppos = puncher:getpos() + local pvect = puncher:get_look_dir() + local pface = get_face(pos, ppos, pvect) + + if pface == nil then return end + + local nodename = node.name + local newstate = tostring(1 - tonumber(string.sub(nodename, pface - 7, pface - 7))) + if pface <= 5 then + nodename = string.sub(nodename, 1, pface - 7 - 1)..newstate..string.sub(nodename, pface - 7 + 1) else - nodename=string.sub(nodename,1,-2)..newstate + nodename = string.sub(nodename, 1, -2)..newstate end - node.name=nodename - minetest.set_node(pos,node) + + node.name = nodename + minetest.set_node(pos, node) end, + on_place = function(itemstack, placer, pointed_thing) local pos = pointed_thing.above + if minetest.is_protected(pos, placer:get_player_name()) then minetest.log("action", placer:get_player_name() .. " tried to place " .. itemstack:get_name() @@ -272,21 +305,25 @@ local nodeboxes= { minetest.record_protection_violation(pos, placer:get_player_name()) return itemstack end + if pos == nil then return end + local node = minetest.get_node(pos) if node.name ~= "air" then if is_supported_node(node.name) then obj = minetest.add_entity(pos, "technic:frame_entity") - obj:get_luaentity():set_node({name=itemstack:get_name()}) + obj:get_luaentity():set_node({ name = itemstack:get_name() }) end else - minetest.set_node(pos, {name = itemstack:get_name()}) + minetest.set_node(pos, { name = itemstack:get_name() }) end + if not infinite_stacks then itemstack:take_item() end return itemstack end, + on_rightclick = function(pos, node, placer, itemstack, pointed_thing) if is_supported_node(itemstack:get_name()) then if minetest.is_protected(pos, placer:get_player_name()) then @@ -297,15 +334,15 @@ local nodeboxes= { minetest.record_protection_violation(pos, placer:get_player_name()) return itemstack end - - minetest.set_node(pos, {name = itemstack:get_name()}) - + + minetest.set_node(pos, { name = itemstack:get_name() }) + local take_item = true local def = minetest.registered_items[itemstack:get_name()] -- Run callback if def.after_place_node then -- Copy place_to because callback can modify it - local pos_copy = {x=pos.x, y=pos.y, z=pos.z} + local pos_copy = vector.new(pos) if def.after_place_node(pos_copy, placer, itemstack) then take_item = false end @@ -315,9 +352,9 @@ local nodeboxes= { local _, callback for _, callback in ipairs(minetest.registered_on_placenodes) do -- Copy pos and node because callback can modify them - local pos_copy = {x=pos.x, y=pos.y, z=pos.z} - local newnode_copy = {name=def.name, param1=0, param2=0} - local oldnode_copy = {name="air", param1=0, param2=0} + local pos_copy = { x = pos.x, y = pos.y, z = pos.z } + local newnode_copy = { name = def.name, param1 = 0, param2 = 0 } + local oldnode_copy = { name = "air", param1 = 0, param2 = 0 } if callback(pos_copy, newnode_copy, placer, oldnode_copy, itemstack) then take_item = false end @@ -326,13 +363,13 @@ local nodeboxes= { if take_item then itemstack:take_item() end - + obj = minetest.add_entity(pos, "technic:frame_entity") - obj:get_luaentity():set_node({name=node.name}) - + obj:get_luaentity():set_node({ name = node.name }) + return itemstack else - --local pointed_thing = {type = "node", under = pos} + --local pointed_thing = { type = "node", under = pos } if pointed_thing then return minetest.item_place_node(itemstack, placer, pointed_thing) end @@ -350,25 +387,27 @@ end minetest.register_entity("technic:frame_entity", { initial_properties = { physical = true, - collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5}, + collisionbox = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, visual = "wielditem", textures = {}, - visual_size = {x=0.667, y=0.667}, + visual_size = { x = 0.667, y = 0.667 }, }, node = {}, set_node = function(self, node) self.node = node - local pos = self.object:getpos() - pos = {x = math.floor(pos.x+0.5), y = math.floor(pos.y+0.5), z = math.floor(pos.z+0.5)} + local pos = vector.round(self.object:getpos()) frames_pos[pos_to_string(pos)] = node.name + local stack = ItemStack(node.name) local itemtable = stack:to_table() local itemname = nil + if itemtable then itemname = stack:to_table().name end + local item_texture = nil local item_type = "" if minetest.registered_items[itemname] then @@ -377,7 +416,7 @@ minetest.register_entity("technic:frame_entity", { end prop = { is_visible = true, - textures = {node.name}, + textures = { node.name }, } self.object:set_properties(prop) end, @@ -387,18 +426,17 @@ minetest.register_entity("technic:frame_entity", { end, on_activate = function(self, staticdata) - self.object:set_armor_groups({immortal=1}) - self:set_node({name=staticdata}) + self.object:set_armor_groups({ immortal = 1 }) + self:set_node({ name = staticdata }) end, - + dig = function(self) - minetest.handle_node_drops(self.object:getpos(), {ItemStack("technic:frame_111111")}, self.last_puncher) - local pos = self.object:getpos() - pos = {x = math.floor(pos.x+0.5), y = math.floor(pos.y+0.5), z = math.floor(pos.z+0.5)} + minetest.handle_node_drops(self.object:getpos(), { ItemStack("technic:frame_111111") }, self.last_puncher) + local pos = vector.round(self.object:getpos()) frames_pos[pos_to_string(pos)] = nil self.object:remove() end, - + on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir) local pos = self.object:getpos() if self.damage_object == nil then @@ -410,35 +448,43 @@ minetest.register_entity("technic:frame_entity", { else self.damage_object:get_luaentity().remaining_time = 0.25 end + self.last_puncher = puncher local ppos = puncher:getpos() local pvect = puncher:get_look_dir() - local pface = get_face(pos,ppos,pvect) + local pface = get_face(pos, ppos, pvect) if pface == nil then return end local nodename = self.node.name - local newstate = tostring(1-tonumber(string.sub(nodename, -7+pface, -7+pface))) + local newstate = tostring(1 - tonumber(string.sub(nodename, pface - 7, pface - 7))) + if pface <= 5 then - nodename = string.sub(nodename, 1, -7+pface-1)..newstate..string.sub(nodename, -7+pface+1) + nodename = string.sub(nodename, 1, pface - 7 - 1)..newstate..string.sub(nodename, pface - 7 + 1) else nodename = string.sub(nodename, 1, -2)..newstate end + self.node.name = nodename self:set_node(self.node) end, - + on_rightclick = function(self, clicker) local pos = self.object:getpos() local ppos = clicker:getpos() local pvect = clicker:get_look_dir() local pface = get_face(pos, ppos, pvect) - if pface == nil then return end - local pos_under = {x = math.floor(pos.x+0.5), y = math.floor(pos.y+0.5), z = math.floor(pos.z+0.5)} - local pos_above = {x = pos_under.x, y = pos_under.y, z = pos_under.z} - local index = ({"x", "y", "z"})[math.floor((pface+1)/2)] - pos_above[index] = pos_above[index] + 2*((pface+1)%2) - 1 - local pointed_thing = {type = "node", under = pos_under, above = pos_above} + + if pface == nil then + return + end + + local pos_under = vector.round(pos) + local pos_above = { x = pos_under.x, y = pos_under.y, z = pos_under.z } + local index = ({ "x", "y", "z" })[math.floor((pface + 1) / 2)] + pos_above[index] = pos_above[index] + 2 * ((pface + 1)%2) - 1 + local pointed_thing = { type = "node", under = pos_under, above = pos_above } local itemstack = clicker:get_wielded_item() local itemdef = minetest.registered_items[itemstack:get_name()] + if itemdef ~= nil then itemdef.on_place(itemstack, clicker, pointed_thing) end @@ -449,9 +495,9 @@ local crack = "crack_anylength.png^[verticalframe:5:0" minetest.register_entity("technic:damage_entity", { initial_properties = { visual = "cube", - visual_size = {x=1.01, y=1.01}, - textures = {crack, crack, crack, crack, crack, crack}, - collisionbox = {0, 0, 0, 0, 0, 0}, + visual_size = { x = 1.01, y = 1.01 }, + textures = { crack, crack, crack, crack, crack, crack }, + collisionbox = { 0, 0, 0, 0, 0, 0 }, physical = false, }, on_step = function(self, dtime) @@ -474,7 +520,7 @@ minetest.register_entity("technic:damage_entity", { self.frame_object:dig() end local ct = "crack_anylength.png^[verticalframe:5:"..self.texture_index - self.object:set_properties({textures = {ct, ct, ct, ct, ct, ct}}) + self.object:set_properties({ textures = { ct, ct, ct, ct, ct, ct } }) end end, }) @@ -485,7 +531,11 @@ mesecon.register_on_mvps_move(function(moved_nodes) local to_move = {} for _, n in ipairs(moved_nodes) do if frames_pos[pos_to_string(n.oldpos)] ~= nil then - to_move[#to_move+1] = {pos = n.pos, oldpos = n.oldpos, name = frames_pos[pos_to_string(n.oldpos)]} + to_move[#to_move + 1] = { + pos = n.pos, + oldpos = n.oldpos, + name = frames_pos[pos_to_string(n.oldpos)] + } frames_pos[pos_to_string(n.oldpos)] = nil end end @@ -495,7 +545,8 @@ mesecon.register_on_mvps_move(function(moved_nodes) local objects = minetest.get_objects_inside_radius(t.oldpos, 0.1) for _, obj in ipairs(objects) do local entity = obj:get_luaentity() - if entity and (entity.name == "technic:frame_entity" or entity.name == "technic:damage_entity") then + if entity and (entity.name == "technic:frame_entity" or + entity.name == "technic:damage_entity") then obj:setpos(t.pos) end end @@ -505,7 +556,7 @@ end) minetest.register_on_dignode(function(pos, node) if frames_pos[pos_to_string(pos)] ~= nil then - minetest.set_node(pos, {name = frames_pos[pos_to_string(pos)]}) + minetest.set_node(pos, { name = frames_pos[pos_to_string(pos)] }) frames_pos[pos_to_string(pos)] = nil local objects = minetest.get_objects_inside_radius(pos, 0.1) for _, obj in ipairs(objects) do @@ -518,87 +569,109 @@ minetest.register_on_dignode(function(pos, node) end) -- Frame motor -local function connected(pos,c,adj) - for _,vect in ipairs(adj) do - local pos1=vector.add(pos,vect) - local nodename=minetest.get_node(pos1).name +local function connected(pos, c, adj) + for _, vect in ipairs(adj) do + local pos1 = vector.add(pos, vect) + local nodename = minetest.get_node(pos1).name if frames_pos[pos_to_string(pos1)] then nodename = frames_pos[pos_to_string(pos1)] end - if not(pos_in_list(c,pos1)) and nodename~="air" and - (minetest.registered_nodes[nodename].frames_can_connect==nil or - minetest.registered_nodes[nodename].frames_can_connect(pos1,vect)) then - c[#(c)+1]=pos1 - if minetest.registered_nodes[nodename].frame==1 then - local adj=minetest.registered_nodes[nodename].frame_connect_all(nodename) - connected(pos1,c,adj) + if not pos_in_list(c, pos1) and nodename ~= "air" and + (minetest.registered_nodes[nodename].frames_can_connect == nil or + minetest.registered_nodes[nodename].frames_can_connect(pos1, vect)) then + c[#c + 1] = pos1 + if minetest.registered_nodes[nodename].frame == 1 then + local adj = minetest.registered_nodes[nodename].frame_connect_all(nodename) + connected(pos1, c, adj) end end end end local function get_connected_nodes(pos) - c={pos} - local nodename=minetest.get_node(pos).name + c = { pos } + local nodename = minetest.get_node(pos).name if frames_pos[pos_to_string(pos)] then nodename = frames_pos[pos_to_string(pos)] end - connected(pos,c,minetest.registered_nodes[nodename].frame_connect_all(nodename)) + connected(pos, c, minetest.registered_nodes[nodename].frame_connect_all(nodename)) return c end local function frame_motor_on(pos, node) - local dirs = {{x=0,y=1,z=0},{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=-1,z=0}} - local nnodepos = vector.add(pos, dirs[math.floor(node.param2/4)+1]) + local dirs = { + { x = 0, y = 1, z = 0 }, { x = 0, y = 0, z = 1 }, + { x = 0, y = 0, z = -1 }, { x = 1, y = 0, z = 0 }, + { x = -1, y = 0, z = 0 }, { x = 0, y = -1, z = 0 } + } + local nnodepos = vector.add(pos, dirs[math.floor(node.param2 / 4) + 1]) local dir = minetest.facedir_to_dir(node.param2) - local nnode=minetest.get_node(nnodepos) + local nnode = minetest.get_node(nnodepos) + if frames_pos[pos_to_string(nnodepos)] then nnode.name = frames_pos[pos_to_string(nnodepos)] end + local meta = minetest.get_meta(pos) if meta:get_int("last_moved") == minetest.get_gametime() then return end + local owner = meta:get_string("owner") - if minetest.registered_nodes[nnode.name].frame==1 then - local connected_nodes=get_connected_nodes(nnodepos) - move_nodes_vect(connected_nodes,dir,pos,owner) + if minetest.registered_nodes[nnode.name].frame == 1 then + local connected_nodes = get_connected_nodes(nnodepos) + move_nodes_vect(connected_nodes, dir, pos, owner) end + minetest.get_meta(vector.add(pos, dir)):set_int("last_moved", minetest.get_gametime()) end -minetest.register_node("technic:frame_motor",{ +minetest.register_node("technic:frame_motor", { description = S("Frame Motor"), - tiles = {"pipeworks_filter_top.png^[transformR90", "technic_lv_cable.png", "technic_lv_cable.png", - "technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"}, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon=2}, + tiles = { + "pipeworks_filter_top.png^[transformR90", "technic_lv_cable.png", "technic_lv_cable.png", + "technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png" + }, + groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, mesecon = 2 }, paramtype2 = "facedir", - mesecons={effector={action_on=frame_motor_on}}, + mesecons = { effector = { action_on = frame_motor_on } }, + after_place_node = function(pos, placer, itemstack) local meta = minetest.get_meta(pos) meta:set_string("owner", placer:get_player_name()) end, - frames_can_connect=function(pos,dir) + + frames_can_connect = function(pos, dir) local node = minetest.get_node(pos) - local dir2 = ({{x=0,y=1,z=0},{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=-1,z=0}})[math.floor(node.param2/4)+1] - return dir2.x~=-dir.x or dir2.y~=-dir.y or dir2.z~=-dir.z + local dir2 = ({ + { x= 0 , y = 1, z = 0 }, { x = 0, y = 0, z = 1 }, + { x = 0, y = 0, z = -1 }, { x = 1, y = 0, z = 0 }, + { x = -1, y = 0, z = 0 }, { x = 0, y = -1, z = 0 } + })[math.floor(node.param2 / 4) + 1] + return dir2.x ~= -dir.x or dir2.y ~= -dir.y or dir2.z ~= -dir.z end }) -- Templates -local function template_connected(pos,c,connectors) - for _,vect in ipairs({{x=0,y=1,z=0},{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=-1,z=0}}) do - local pos1=vector.add(pos,vect) - local nodename=minetest.get_node(pos1).name - if not(pos_in_list(c,pos1)) and (nodename=="technic:template" or nodename == "technic:template_connector")then +local function template_connected(pos, c, connectors) + local vects = { + { x = 0, y = 1, z = 0 }, { x = 0, y = 0, z = 1 }, + { x = 0, y = 0, z = -1 }, { x = 1, y = 0, z = 0 }, + { x = -1, y = 0, z = 0 }, { x = 0, y = -1, z = 0 } + } + for _, vect in ipairs(vects) do + local pos1 = vector.add(pos, vect) + local nodename = minetest.get_node(pos1).name + if not pos_in_list(c, pos1) and (nodename == "technic:template" or + nodename == "technic:template_connector") then local meta = minetest.get_meta(pos1) if meta:get_string("connected") == "" then - c[#(c)+1]=pos1 - template_connected(pos1,c,connectors) + c[#c + 1] = pos1 + template_connected(pos1, c, connectors) if nodename == "technic:template_connector" then - connectors[#connectors+1] = pos1 + connectors[#connectors + 1] = pos1 end end end @@ -606,14 +679,14 @@ local function template_connected(pos,c,connectors) end local function get_templates(pos) - local c = {pos} + local c = { pos } local connectors if minetest.get_node(pos).name == "technic:template_connector" then - connectors = {pos} + connectors = { pos } else connectors = {} end - template_connected(pos,c,connectors) + template_connected(pos, c, connectors) return c, connectors end @@ -629,7 +702,7 @@ end local function save_node(pos) local node = minetest.get_node(pos) if node.name == "air" then - minetest.set_node(pos, {name="technic:template"}) + minetest.set_node(pos, { name = "technic:template" }) return end if node.name == "technic:template" then @@ -638,6 +711,7 @@ local function save_node(pos) meta:set_string("connected", "") return end + local meta = minetest.get_meta(pos) local meta0 = meta:to_table() for _, list in pairs(meta0.inventory) do @@ -645,8 +719,9 @@ local function save_node(pos) list[key] = stack:to_string() end end + node.meta = meta0 - minetest.set_node(pos, {name="technic:template"}) + minetest.set_node(pos, { name = "technic:template" }) return node end @@ -664,38 +739,40 @@ end local function expand_template(pos) local meta = minetest.get_meta(pos) local c = meta:get_string("connected") + if c == "" then return end c = minetest.deserialize(c) + for _, vect in ipairs(c) do local pos1 = vector.add(pos, vect) local saved_node = save_node(pos1) local meta1 = minetest.get_meta(pos1) if saved_node ~= nil then meta1:set_string("saved_node", minetest.serialize(saved_node)) - else - --meta1:set_string("saved_node", "") end end end local function compress_templates(pos) local templates, connectors = get_templates(pos) + if #connectors == 0 then - connectors = {pos} + connectors = { pos } end + for _, cn in ipairs(connectors) do local meta = minetest.get_meta(cn) local c = {} - for _,p in ipairs(templates) do + for _, p in ipairs(templates) do local np = vector.subtract(p, cn) - if not pos_in_list(c,np) then - c[#c+1] = np + if not pos_in_list(c, np) then + c[#c + 1] = np end end local cc = {} - for _,p in ipairs(connectors) do + for _, p in ipairs(connectors) do local np = vector.subtract(p, cn) - if (np.x ~= 0 or np.y ~= 0 or np.z ~= 0) then + if np.x ~= 0 or np.y ~= 0 or np.z ~= 0 then cc[pos_to_string(np)] = true end end @@ -703,10 +780,10 @@ local function compress_templates(pos) meta:set_string("connected", minetest.serialize(c)) meta:set_string("connectors_connected", minetest.serialize(cc)) end - - for _,p in ipairs(templates) do + + for _, p in ipairs(templates) do if not pos_in_list(connectors, p) then - minetest.set_node(p, {name = "air"}) + minetest.set_node(p, { name = "air" }) end end end @@ -715,11 +792,12 @@ local function template_drops(pos, node, oldmeta, digger) local c = oldmeta.fields.connected local cc = oldmeta.fields.connectors_connected local drops + if c == "" or c == nil then - drops = {"technic:template 1"} + drops = { "technic:template 1" } else if cc == "" or cc == nil then - drops = {"technic:template 1"} + drops = { "technic:template 1" } else local dcc = minetest.deserialize(cc) if not table_empty(dcc) then @@ -730,22 +808,23 @@ local function template_drops(pos, node, oldmeta, digger) local meta = minetest.get_meta(p) local d = minetest.deserialize(meta:get_string("connectors_connected")) if d ~= nil then - d[pos_to_string({x=-ssp.x, y=-ssp.y, z=-ssp.z})] = nil + d[pos_to_string({ x = -ssp.x, y = -ssp.y, z = -ssp.z })] = nil meta:set_string("connectors_connected", minetest.serialize(d)) end end else local stack_max = 99 - local num = #(minetest.deserialize(c)) + local num = #minetest.deserialize(c) drops = {} while num > stack_max do - drops[#drops+1] = "technic:template "..stack_max + drops[#drops + 1] = "technic:template "..stack_max num = num - stack_max end - drops[#drops+1] = "technic:template "..num + drops[#drops + 1] = "technic:template "..num end end end + minetest.handle_node_drops(pos, drops, digger) end @@ -758,44 +837,44 @@ local function template_on_destruct(pos, node) end end -minetest.register_node("technic:template",{ +minetest.register_node("technic:template", { description = S("Template"), - tiles = {"technic_mv_cable.png"}, + tiles = { "technic_mv_cable.png" }, drop = "", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 }, on_destruct = template_on_destruct, after_dig_node = template_drops, - on_punch = function(pos,node,puncher) + on_punch = function(pos, node, puncher) swap_template(pos, "technic:template_disabled") end }) -minetest.register_node("technic:template_disabled",{ +minetest.register_node("technic:template_disabled", { description = S("Template"), - tiles = {"technic_hv_cable.png"}, + tiles = { "technic_hv_cable.png" }, drop = "", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, + groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1 }, on_destruct = template_on_destruct, after_dig_node = template_drops, - on_punch = function(pos,node,puncher) + on_punch = function(pos, node, puncher) local meta = minetest.get_meta(pos) swap_template(pos, "technic:template_connector") end }) -minetest.register_node("technic:template_connector",{ +minetest.register_node("technic:template_connector", { description = S("Template"), - tiles = {"technic_lv_cable.png"}, + tiles = { "technic_lv_cable.png" }, drop = "", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, + groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1 }, on_destruct = template_on_destruct, after_dig_node = template_drops, - on_punch = function(pos,node,puncher) + on_punch = function(pos, node, puncher) swap_template(pos, "technic:template") end }) -minetest.register_craftitem("technic:template_replacer",{ +minetest.register_craftitem("technic:template_replacer", { description = S("Template (replacing)"), inventory_image = "technic_template_replacer.png", on_place = function(itemstack, placer, pointed_thing) @@ -815,12 +894,12 @@ minetest.register_craftitem("technic:template_replacer",{ end }) -minetest.register_tool("technic:template_tool",{ +minetest.register_tool("technic:template_tool", { description = S("Template Tool"), inventory_image = "technic_template_tool.png", on_use = function(itemstack, puncher, pointed_thing) local pos = pointed_thing.under - if pos == nil or (minetest.is_protected and minetest.is_protected(pos, puncher:get_player_name())) then + if pos == nil or minetest.is_protected and minetest.is_protected(pos, puncher:get_player_name()) then return nil end local node = minetest.get_node(pos) @@ -832,7 +911,7 @@ minetest.register_tool("technic:template_tool",{ else compress_templates(pos) end - + end }) @@ -845,40 +924,50 @@ local function get_template_nodes(pos) if connected == "" then return {} end local adj = minetest.deserialize(connected) local c = {} - for _,vect in ipairs(adj) do - local pos1=vector.add(pos,vect) - local nodename=minetest.get_node(pos1).name - if not(pos_in_list(c,pos1)) and nodename~="air" then - c[#(c)+1]=pos1 + for _, vect in ipairs(adj) do + local pos1 = vector.add(pos, vect) + local nodename = minetest.get_node(pos1).name + if not(pos_in_list(c, pos1)) and nodename ~= "air" then + c[#c + 1] = pos1 end end return c end local function template_motor_on(pos, node) - local dirs = {{x=0,y=1,z=0},{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=-1,z=0}} - local nnodepos = vector.add(pos, dirs[math.floor(node.param2/4)+1]) + local dirs = { + { x = 0, y = 1, z = 0 }, { x = 0, y = 0, z = 1 }, + { x = 0, y = 0, z = -1 }, { x = 1, y = 0, z = 0 }, + { x = -1, y = 0, z = 0 }, { x = 0, y = -1, z = 0 } + } + local nnodepos = vector.add(pos, dirs[math.floor(node.param2 / 4) + 1]) local dir = minetest.facedir_to_dir(node.param2) - local nnode=minetest.get_node(nnodepos) + local nnode = minetest.get_node(nnodepos) local meta = minetest.get_meta(pos) if meta:get_int("last_moved") == minetest.get_gametime() then return end local owner = meta:get_string("owner") if nnode.name == "technic:template" then - local connected_nodes=get_template_nodes(nnodepos) - move_nodes_vect(connected_nodes,dir,pos,owner) + local connected_nodes = get_template_nodes(nnodepos) + move_nodes_vect(connected_nodes, dir, pos, owner) end minetest.get_meta(vector.add(pos, dir)):set_int("last_moved", minetest.get_gametime()) end -minetest.register_node("technic:template_motor",{ +minetest.register_node("technic:template_motor", { description = S("Template Motor"), - tiles = {"pipeworks_filter_top.png^[transformR90", "technic_lv_cable.png", "technic_lv_cable.png", - "technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"}, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon=2}, + tiles = { + "pipeworks_filter_top.png^[transformR90", + "technic_lv_cable.png", + "technic_lv_cable.png", + "technic_lv_cable.png", + "technic_lv_cable.png", + "technic_lv_cable.png" + }, + groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, mesecon = 2 }, paramtype2 = "facedir", - mesecons={effector={action_on=template_motor_on}}, + mesecons = { effector = { action_on = template_motor_on } }, after_place_node = function(pos, placer, itemstack) local meta = minetest.get_meta(pos) meta:set_string("owner", placer:get_player_name()) @@ -889,54 +978,54 @@ minetest.register_node("technic:template_motor",{ minetest.register_craft({ output = 'technic:frame_111111', recipe = { - {'', 'default:stick', ''}, - {'default:stick', 'technic:brass_ingot', 'default:stick'}, - {'', 'default:stick', ''}, + { '', 'default:stick', '' }, + { 'default:stick', 'technic:brass_ingot', 'default:stick' }, + { '', 'default:stick', '' }, } }) minetest.register_craft({ output = 'technic:frame_motor', recipe = { - {'', 'technic:frame_111111', ''}, - {'group:mesecon_conductor_craftable', 'technic:motor', 'group:mesecon_conductor_craftable'}, - {'', 'technic:frame_111111', ''}, + { '', 'technic:frame_111111', '' }, + { 'group:mesecon_conductor_craftable', 'technic:motor', 'group:mesecon_conductor_craftable' }, + { '', 'technic:frame_111111', '' }, } }) minetest.register_craft({ output = 'technic:template 10', recipe = { - {'', 'technic:brass_ingot', ''}, - {'technic:brass_ingot', 'default:mese_crystal', 'technic:brass_ingot'}, - {'', 'technic:brass_ingot', ''}, + { '', 'technic:brass_ingot', '' }, + { 'technic:brass_ingot', 'default:mese_crystal', 'technic:brass_ingot' }, + { '', 'technic:brass_ingot', '' }, } }) minetest.register_craft({ output = 'technic:template_replacer', - recipe = {{'technic:template'}} + recipe = { { 'technic:template' } } }) minetest.register_craft({ output = 'technic:template', - recipe = {{'technic:template_replacer'}} + recipe = { { 'technic:template_replacer' } } }) minetest.register_craft({ output = 'technic:template_motor', recipe = { - {'', 'technic:template', ''}, - {'group:mesecon_conductor_craftable', 'technic:motor', 'group:mesecon_conductor_craftable'}, - {'', 'technic:template', ''}, + { '', 'technic:template', '' }, + { 'group:mesecon_conductor_craftable', 'technic:motor', 'group:mesecon_conductor_craftable' }, + { '', 'technic:template', '' }, } }) minetest.register_craft({ output = 'technic:template_tool', recipe = { - {'', 'technic:template', ''}, - {'default:mese_crystal', 'default:stick', 'default:mese_crystal'}, - {'', 'default:stick', ''}, + { '', 'technic:template', '' }, + { 'default:mese_crystal', 'default:stick', 'default:mese_crystal' }, + { '', 'default:stick', '' }, } }) From 29f746369f756651c60031a7c86194d79d47a4ce Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Sat, 25 Aug 2018 15:24:52 -0400 Subject: [PATCH 15/16] Switch to colored itemstacks (#438) with full crafting recipes (requires Unified Dyes commit 2a816534 or later) --- extranodes/init.lua | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/extranodes/init.lua b/extranodes/init.lua index eb54067..f6ab93a 100644 --- a/extranodes/init.lua +++ b/extranodes/init.lua @@ -151,18 +151,13 @@ if minetest.get_modpath("unifieddyes") then iclip_def.palette = "unifieddyes_palette_colorwallmounted.png" iclip_def.after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) - unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing) end - iclip_def.after_dig_node = unifieddyes.after_dig_node iclip_def.groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, ud_param2_colorable = 1} iclipfence_def.paramtype2 = "color" iclipfence_def.palette = "unifieddyes_palette_extended.png" iclipfence_def.on_construct = unifieddyes.on_construct - iclipfence_def.after_place_node = unifieddyes.recolor_on_place - iclipfence_def.after_dig_node = unifieddyes.after_dig_node iclipfence_def.groups = {fence=1, choppy=1, snappy=1, oddly_breakable_by_hand=1, ud_param2_colorable = 1} - iclipfence_def.place_param2 = 171 -- medium amber, low saturation, closest color to default:wood end minetest.register_node(":technic:insulator_clip", iclip_def) @@ -185,3 +180,29 @@ minetest.register_craft({ { "technic:raw_latex", "default:fence_wood", "technic:raw_latex"}, } }) + +if minetest.get_modpath("unifieddyes") then + + unifieddyes.register_color_craft({ + output = "technic:insulator_clip_fencepost", + palette = "extended", + type = "shapeless", + neutral_node = "technic:insulator_clip_fencepost", + recipe = { + "NEUTRAL_NODE", + "MAIN_DYE" + } + }) + + unifieddyes.register_color_craft({ + output = "technic:insulator_clip", + palette = "wallmounted", + type = "shapeless", + neutral_node = "technic:insulator_clip", + recipe = { + "NEUTRAL_NODE", + "MAIN_DYE" + } + }) + +end From 92dd0f4af891043f8554f730964f63db8b5e3dc8 Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Thu, 23 Aug 2018 19:59:53 -0400 Subject: [PATCH 16/16] Add a new type of cable clip Uses Zeg9's steel mod's "steel:strut_mount" or streetsmod's "streets:steel_support" as the base/blocky part, with an overlay copied from the steel mod to make it look like the clip is fixed to the strut with a steel band. Textures will adjust to match whichever mod is installed, preferring the steel mod. Can be crafted from any of these standard/shaped recipes: - - - - f d - f - or - s - - m - - i - f = fencepost-shaped clip m = steel mod strut with mount s = steel mod strut without mount, or streets mod steel support i = default steel ingot d = dye (optional, see below) If the user has Unified Dyes (commit 2a816534 or later), the clip can be dyed (well, the white part anyway :-) ), either by adding a portion of dye as above, or by crafting an existing clip + dye. Uses "colorwallmounted" mode for 32-color support. --- extranodes/depends.txt | 2 + extranodes/init.lua | 107 +++++++- ...echnic_steel_strut_with_insulator_clip.obj | 246 ++++++++++++++++++ .../textures/technic_steel_strut_overlay.png | Bin 0 -> 123 bytes 4 files changed, 353 insertions(+), 2 deletions(-) create mode 100644 extranodes/models/technic_steel_strut_with_insulator_clip.obj create mode 100644 extranodes/textures/technic_steel_strut_overlay.png diff --git a/extranodes/depends.txt b/extranodes/depends.txt index 15b9ef5..4dcb99e 100644 --- a/extranodes/depends.txt +++ b/extranodes/depends.txt @@ -4,3 +4,5 @@ concrete unifieddyes? intllib? moreblocks? +steel? +streetsmod? diff --git a/extranodes/init.lua b/extranodes/init.lua index f6ab93a..1f65c29 100644 --- a/extranodes/init.lua +++ b/extranodes/init.lua @@ -103,7 +103,7 @@ if minetest.get_modpath("moreblocks") then end local iclip_def = { - description = "Insulator/cable clip", + description = S("Insulator/cable clip"), drawtype = "mesh", mesh = "technic_insulator_clip.obj", tiles = {"technic_insulator_clip.png"}, @@ -113,7 +113,7 @@ local iclip_def = { } local iclipfence_def = { - description = "Insulator/cable clip", + description = S("Insulator/cable clip"), tiles = {"technic_insulator_clip.png"}, is_ground_content = false, paramtype = "light", @@ -146,6 +146,36 @@ local iclipfence_def = { sounds = default.node_sound_stone_defaults(), } +local sclip_tex = { + "technic_insulator_clip.png", + { name = "strut.png^steel_strut_overlay.png", color = "white" }, + { name = "strut.png", color = "white" } +} + +local streetsmod = minetest.get_modpath("streets") or minetest.get_modpath ("steelsupport") +-- cheapie's fork breaks it into several individual mods, with differernt names for the same content. + +if streetsmod then + sclip_tex = { + "technic_insulator_clip.png", + { name = "streets_support.png^technic_steel_strut_overlay.png", color = "white" }, + { name = "streets_support.png", color = "white" } + } +end + +local sclip_def = { + description = S("Steel strut with insulator/cable clip"), + drawtype = "mesh", + mesh = "technic_steel_strut_with_insulator_clip.obj", + tiles = sclip_tex, + paramtype = "light", + paramtype2 = "wallmounted", + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), + groups = { choppy=1, cracky=1 }, + backface_culling = false +} + if minetest.get_modpath("unifieddyes") then iclip_def.paramtype2 = "colorwallmounted" iclip_def.palette = "unifieddyes_palette_colorwallmounted.png" @@ -158,10 +188,18 @@ if minetest.get_modpath("unifieddyes") then iclipfence_def.palette = "unifieddyes_palette_extended.png" iclipfence_def.on_construct = unifieddyes.on_construct iclipfence_def.groups = {fence=1, choppy=1, snappy=1, oddly_breakable_by_hand=1, ud_param2_colorable = 1} + + sclip_def.paramtype2 = "colorwallmounted" + sclip_def.palette = "unifieddyes_palette_colorwallmounted.png" + sclip_def.after_place_node = function(pos, placer, itemstack, pointed_thing) + unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) + end + sclip_def.groups = {choppy=1, cracky=1, ud_param2_colorable = 1} end minetest.register_node(":technic:insulator_clip", iclip_def) minetest.register_node(":technic:insulator_clip_fencepost", iclipfence_def) +minetest.register_node(":technic:steel_strut_with_insulator_clip", sclip_def) minetest.register_craft({ output = "technic:insulator_clip", @@ -181,6 +219,37 @@ minetest.register_craft({ } }) +local steelmod = minetest.get_modpath("steel") + +if steelmod then + minetest.register_craft({ + output = "technic:steel_strut_with_insulator_clip", + recipe = { + {"technic:insulator_clip_fencepost"}, + {"steel:strut_mount"} + } + }) + + minetest.register_craft({ + output = "technic:steel_strut_with_insulator_clip", + recipe = { + {"technic:insulator_clip_fencepost", "" }, + {"steel:strut", "default:steel_ingot" }, + } + }) + +end + +if streetsmod then + minetest.register_craft({ + output = "technic:steel_strut_with_insulator_clip", + recipe = { + {"technic:insulator_clip_fencepost", "" }, + {"streets:steel_support", "default:steel_ingot" }, + } + }) +end + if minetest.get_modpath("unifieddyes") then unifieddyes.register_color_craft({ @@ -205,4 +274,38 @@ if minetest.get_modpath("unifieddyes") then } }) + unifieddyes.register_color_craft({ + output = "technic:steel_strut_with_insulator_clip", + palette = "wallmounted", + type = "shapeless", + neutral_node = "", + recipe = { + "technic:steel_strut_with_insulator_clip", + "MAIN_DYE" + } + }) + + if steelmod then + unifieddyes.register_color_craft({ + output = "technic:steel_strut_with_insulator_clip", + palette = "wallmounted", + neutral_node = "", + recipe = { + { "technic:insulator_clip_fencepost", "MAIN_DYE" }, + { "steel:strut_mount", "" }, + } + }) + end + + if streetsmod then + unifieddyes.register_color_craft({ + output = "technic:steel_strut_with_insulator_clip", + palette = "wallmounted", + neutral_node = "technic:steel_strut_with_insulator_clip", + recipe = { + { "technic:insulator_clip_fencepost", "MAIN_DYE" }, + { "streets:steel_support", "default:steel_ingot" }, + } + }) + end end diff --git a/extranodes/models/technic_steel_strut_with_insulator_clip.obj b/extranodes/models/technic_steel_strut_with_insulator_clip.obj new file mode 100644 index 0000000..7226d1e --- /dev/null +++ b/extranodes/models/technic_steel_strut_with_insulator_clip.obj @@ -0,0 +1,246 @@ +# Blender v2.79 (sub 0) OBJ File: 'technic steel strut with insulator clip.blend' +# www.blender.org +o Cube_Cube_Material.001 +v -0.375000 0.500532 -0.250000 +v -0.249997 0.562500 -0.249997 +v 0.249997 0.562500 -0.249997 +v 0.375000 0.500532 -0.250000 +v 0.249997 0.562500 0.249997 +v 0.375000 0.500532 0.250000 +v -0.249997 0.562500 0.249997 +v -0.375000 0.500532 0.250000 +v 0.187500 0.562500 -0.187500 +v -0.168668 0.718750 0.168668 +v 0.168668 0.718750 0.168668 +v 0.187500 0.750000 0.187500 +v -0.187500 0.750000 0.187500 +v 0.168668 0.718750 -0.168668 +v 0.187500 0.750000 -0.187500 +v -0.168668 0.718750 -0.168668 +v -0.187500 0.750000 -0.187500 +v 0.250000 0.750000 -0.250000 +v 0.250000 0.750000 0.250000 +v -0.250000 0.750000 -0.250000 +v -0.250000 1.250000 -0.250000 +v 0.250000 1.250000 -0.250000 +v 0.250000 1.250000 0.250000 +v -0.250000 1.250000 0.250000 +v -0.250000 0.750000 0.250000 +v -0.168668 0.593750 0.168668 +v 0.168668 0.593750 0.168668 +v 0.187500 0.625000 0.187500 +v -0.187500 0.625000 0.187500 +v 0.168668 0.593750 -0.168668 +v 0.187500 0.625000 -0.187500 +v -0.168668 0.593750 -0.168668 +v -0.187500 0.625000 -0.187500 +v -0.168668 0.656250 0.168668 +v 0.168668 0.656250 0.168668 +v 0.187500 0.687500 0.187500 +v -0.187500 0.687500 0.187500 +v 0.168668 0.656250 -0.168668 +v 0.187500 0.687500 -0.187500 +v -0.168668 0.656250 -0.168668 +v -0.187500 0.687500 -0.187500 +v 0.187500 0.562500 0.187500 +v -0.187500 0.562500 0.187500 +v -0.187500 0.562500 -0.187500 +v -0.499468 -0.499468 -0.499468 +v -0.499468 0.500000 -0.499468 +v 0.499468 -0.499468 -0.499468 +v -0.499468 -0.499468 0.499468 +v -0.499468 0.500000 0.499468 +v 0.499468 -0.499468 0.499468 +v 0.499468 0.500000 -0.499468 +v 0.499468 0.500000 0.499468 +vt 1.000000 0.875000 +vt 0.937500 0.750000 +vt 0.937500 0.250000 +vt 1.000000 0.125000 +vt 0.250000 0.875000 +vt 0.250000 0.750000 +vt 0.750000 0.750000 +vt 0.750000 0.875000 +vt 0.000000 0.125000 +vt 0.062500 0.250000 +vt 0.062500 0.750000 +vt 0.000000 0.875000 +vt 0.750000 0.250000 +vt 0.687500 0.687500 +vt 0.687500 0.312500 +vt 0.312500 0.687500 +vt 0.250000 0.250000 +vt 0.312500 0.312500 +vt 0.331332 1.218750 +vt 0.668668 1.218750 +vt 0.687500 1.250000 +vt 0.312500 1.250000 +vt 0.531250 0.666667 +vt 0.531250 0.333333 +vt 0.500000 0.312500 +vt 0.500000 0.687500 +vt 0.531250 0.333333 +vt 0.531250 0.666667 +vt 0.500000 0.687500 +vt 0.500000 0.312500 +vt 0.331332 1.218750 +vt 0.668668 1.218750 +vt 0.687500 1.250000 +vt 0.312500 1.250000 +vt 0.687500 0.312500 +vt 0.750000 0.250000 +vt 0.750000 0.750000 +vt 0.687500 0.687500 +vt 0.500000 0.250000 +vt 0.500000 0.750000 +vt 0.000000 0.750000 +vt 0.000000 0.250000 +vt 0.500000 0.250000 +vt 0.000000 0.250000 +vt 0.000000 0.750000 +vt 0.500000 0.750000 +vt 0.500000 0.250000 +vt 0.500000 0.750000 +vt 0.000000 0.750000 +vt 0.000000 0.250000 +vt 0.000000 0.250000 +vt 0.500000 0.750000 +vt 0.250000 0.250000 +vt 0.750000 0.250000 +vt 0.750000 0.750000 +vt 0.250000 0.750000 +vt 0.250000 0.750000 +vt 0.312500 0.687500 +vt 0.250000 0.250000 +vt 0.312500 0.312500 +vt 0.250000 0.125000 +vt 0.750000 0.125000 +vt 0.331332 1.093750 +vt 0.668668 1.093750 +vt 0.687500 1.125000 +vt 0.312500 1.125000 +vt 0.656250 0.666667 +vt 0.656250 0.333333 +vt 0.625000 0.312500 +vt 0.625000 0.687500 +vt 0.656250 0.333333 +vt 0.656250 0.666667 +vt 0.625000 0.687500 +vt 0.625000 0.312500 +vt 0.331332 1.093750 +vt 0.668668 1.093750 +vt 0.687500 1.125000 +vt 0.312500 1.125000 +vt 0.331332 1.156250 +vt 0.668668 1.156250 +vt 0.687500 1.187500 +vt 0.312500 1.187500 +vt 0.593750 0.666667 +vt 0.593750 0.333333 +vt 0.562500 0.312500 +vt 0.562500 0.687500 +vt 0.593750 0.333333 +vt 0.593750 0.666667 +vt 0.562500 0.687500 +vt 0.562500 0.312500 +vt 0.331332 1.156250 +vt 0.668668 1.156250 +vt 0.687500 1.187500 +vt 0.312500 1.187500 +vt 0.312500 1.062500 +vt 0.687500 1.062500 +vt 0.687500 0.312500 +vt 0.687500 0.312500 +vt 0.687500 0.687500 +vt 0.312500 1.062500 +vt 0.687500 1.062500 +vt 0.000000 0.750000 +vt 0.000000 0.250000 +vt 1.000000 0.250000 +vt 1.000000 0.750000 +vt 1.000000 1.000000 +vt -0.000000 1.000000 +vt 0.000000 -0.000000 +vt 1.000000 -0.000000 +vt 1.000000 1.000000 +vt -0.000000 1.000000 +vt 0.000000 -0.000000 +vt 1.000000 -0.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 1.000000 1.000000 +vt 1.000000 -0.000000 +vt 1.000000 1.000000 +vt 1.000000 1.000000 +vt 0.000000 0.000000 +vt -0.000000 0.000000 +vn 0.0000 0.0000 -1.0000 +vn 0.4442 0.8960 -0.0000 +vn 0.0000 0.0000 1.0000 +vn 0.0000 1.0000 -0.0000 +vn 0.0000 -0.5161 0.8565 +vn 0.8565 -0.5161 0.0000 +vn -0.8565 -0.5161 0.0000 +vn 0.0000 -0.5161 -0.8565 +vn -0.0000 -1.0000 -0.0000 +vn 1.0000 -0.0000 0.0000 +vn -1.0000 0.0000 -0.0000 +vn -0.4442 0.8960 -0.0000 +vn -0.0000 0.5161 0.8565 +vn 0.8565 0.5161 -0.0000 +vn -0.8565 0.5161 -0.0000 +vn 0.0000 0.5161 -0.8565 +g Cube_Cube_Material.001_Cube_Cube_Material.001_clip +s 1 +f 1/1/1 2/2/1 3/3/1 4/4/1 +f 4/5/2 3/6/2 5/7/2 6/8/2 +f 6/9/3 5/10/3 7/11/3 8/12/3 +f 7/13/4 5/7/4 42/14/4 43/15/4 +f 5/7/4 3/6/4 9/16/4 42/14/4 +f 2/17/4 7/13/4 43/15/4 44/18/4 +f 3/6/4 2/17/4 44/18/4 9/16/4 +f 10/19/5 11/20/5 12/21/5 13/22/5 +f 11/23/6 14/24/6 15/25/6 12/26/6 +f 16/27/7 10/28/7 13/29/7 17/30/7 +f 14/31/8 16/32/8 17/33/8 15/34/8 +f 15/35/9 18/36/9 19/37/9 12/38/9 +f 20/39/1 21/40/1 22/41/1 18/42/1 +f 18/43/10 22/44/10 23/45/10 19/46/10 +f 19/47/3 23/48/3 24/49/3 25/50/3 +f 21/51/11 20/39/11 25/52/11 24/49/11 +f 21/53/4 24/54/4 23/55/4 22/56/4 +f 12/38/9 19/37/9 25/57/9 13/58/9 +f 13/58/9 25/57/9 20/59/9 17/60/9 +f 17/60/9 20/59/9 18/36/9 15/35/9 +f 2/17/12 1/61/12 8/62/12 7/13/12 +f 26/63/5 27/64/5 28/65/5 29/66/5 +f 27/67/6 30/68/6 31/69/6 28/70/6 +f 32/71/7 26/72/7 29/73/7 33/74/7 +f 30/75/8 32/76/8 33/77/8 31/78/8 +f 34/79/5 35/80/5 36/81/5 37/82/5 +f 35/83/6 38/84/6 39/85/6 36/86/6 +f 40/87/7 34/88/7 37/89/7 41/90/7 +f 38/91/8 40/92/8 41/93/8 39/94/8 +f 37/82/13 36/81/13 11/20/13 10/19/13 +f 36/86/14 39/85/14 14/24/14 11/23/14 +f 41/90/15 37/89/15 10/28/15 16/27/15 +f 39/94/16 41/93/16 16/32/16 14/31/16 +f 43/95/13 42/96/13 27/64/13 26/63/13 +f 42/14/14 9/97/14 30/68/14 27/67/14 +f 44/98/15 43/99/15 26/72/15 32/71/15 +f 9/100/16 44/101/16 32/76/16 30/75/16 +f 29/66/13 28/65/13 35/80/13 34/79/13 +f 28/70/14 31/69/14 38/84/14 35/83/14 +f 33/74/15 29/73/15 34/88/15 40/87/15 +f 31/78/16 33/77/16 40/92/16 38/91/16 +f 8/102/9 1/103/9 4/104/9 6/105/9 +g Cube_Cube_Material.001_Cube_Cube_Material.001_sides_with_band +s off +f 47/106/10 51/107/10 52/108/10 50/109/10 +f 48/110/11 49/111/11 46/112/11 45/113/11 +f 47/114/9 50/115/9 48/116/9 45/117/9 +f 51/118/4 46/112/4 49/111/4 52/119/4 +g Cube_Cube_Material.001_Cube_Cube_Material.001_sides_without_band +f 45/113/1 46/120/1 51/107/1 47/121/1 +f 50/109/3 52/119/3 49/111/3 48/122/3 diff --git a/extranodes/textures/technic_steel_strut_overlay.png b/extranodes/textures/technic_steel_strut_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..fd5bcb28e52d5a14a1ffa6874ebbff5c012c1c86 GIT binary patch literal 123 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`PM$7~Ar_~T6C_xB`1tt#YZ^8j zJ#nBxN!-BDz`$V7{|}8Ry#}^EJV4OI#H1q4aQU!HrUKs{@rZM=I}B#c&}3l