From 3d75870b9decc6340922bc3403c5a0e4534e1082 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Mon, 4 Nov 2019 22:53:04 +0100 Subject: [PATCH] lightning bugfixes pumping bugfix --- basis/consumer.lua | 1 + basis/networks.lua | 22 ++++++++++------------ chemistry/ta4_reactor.lua | 2 ++ coal_power_station/boiler_base.lua | 1 + coal_power_station/boiler_top.lua | 1 + coal_power_station/firebox.lua | 4 ++++ liquids/liquid.lua | 2 +- liquids/pump.lua | 1 + liquids/tank.lua | 25 ++++++++++++++++--------- nodes/gateblock.lua | 1 + nodes/pillar.lua | 1 + power/powerswitch.lua | 2 ++ steam_engine/boiler.lua | 2 ++ 13 files changed, 43 insertions(+), 22 deletions(-) diff --git a/basis/consumer.lua b/basis/consumer.lua index 4b6402b..9419c75 100644 --- a/basis/consumer.lua +++ b/basis/consumer.lua @@ -200,6 +200,7 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState networks = tNode.networks, tubelib2_on_update2 = tNode.tubelib2_on_update2, + paramtype = tNode.paramtype, paramtype2 = "facedir", groups = table.copy(tNode.groups), is_ground_content = false, diff --git a/basis/networks.lua b/basis/networks.lua index ac88286..492fa80 100644 --- a/basis/networks.lua +++ b/basis/networks.lua @@ -108,7 +108,7 @@ end local function node_connections(pos, tlib2) local node = techage.get_node_lvm(pos) local val = 0 - local sides = net_def(pos, tlib2.tube_type).sides + local sides = net_def2(node.name, tlib2.tube_type).sides if sides then for dir = 1,6 do @@ -136,12 +136,12 @@ local function pos_already_reached(pos) return true end --- check if the given pipe dir out of the node is valid -local function valid_indir(pos, indir, param2, net_name) - local sides = net_def(pos, net_name).sides - if not sides then return false end - local side = DirToSide[indir_to_dir(indir, param2)] - if not sides[side] then return false end +-- check if the given pipe dir into the node is valid +local function valid_indir(indir, node, net_name) + local ndef = net_def2(node.name, net_name) + if not ndef or not ndef.sides or ndef.blocker then return false end + local side = DirToSide[indir_to_dir(indir, node.param2)] + if not ndef.sides[side] then return false end return true end @@ -154,8 +154,7 @@ local function connection_walk(pos, indir, node, tlib2, clbk) if outdir ~= Flip[indir] then local pos2, indir2 = tlib2:get_connected_node_pos(pos, outdir) local node = techage.get_node_lvm(pos2) - if pos2 and not pos_already_reached(pos2) and - valid_indir(pos2, indir2, node.param2, tlib2.tube_type) then + if pos2 and not pos_already_reached(pos2) and valid_indir(indir2, node, tlib2.tube_type) then connection_walk(pos2, indir2, node, tlib2, clbk) end end @@ -172,8 +171,7 @@ local function collect_network_nodes(pos, outdir, tlib2) local net_name = tlib2.tube_type -- outdir corresponds to the indir coming from connection_walk(pos, outdir, node, tlib2, function(pos, indir, node) - local ntype = net_def(pos, net_name).ntype - print("collect_network_nodes", P2S(pos), ntype) + local ntype = net_def2(node.name, net_name).ntype if ntype then if not netw[ntype] then netw[ntype] = {} end netw[ntype][#netw[ntype] + 1] = {pos = pos, indir = indir} @@ -222,7 +220,7 @@ techage.networks.side_to_outdir = side_to_outdir -- check if the given pipe dir into the node is valid -- valid_indir(pos, indir, param2, net_name) -techage.networks.valid_indir = valid_indir +--techage.networks.valid_indir = valid_indir -- techage.networks.node_connections(pos, tlib2) techage.networks.node_connections = node_connections diff --git a/chemistry/ta4_reactor.lua b/chemistry/ta4_reactor.lua index 2b1de0f..af11433 100644 --- a/chemistry/ta4_reactor.lua +++ b/chemistry/ta4_reactor.lua @@ -40,6 +40,7 @@ minetest.register_node("techage:ta4_reactor", { fixed = {-1/2, -23/32, -1/2, 1/2, 32/32, 1/2}, }, + paramtype = "light", paramtype2 = "facedir", on_rotate = screwdriver.disallow, groups = {cracky=2}, @@ -79,6 +80,7 @@ minetest.register_node("techage:ta4_reactor_stand", { type = "fixed", fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2}, }, + paramtype = "light", paramtype2 = "facedir", on_rotate = screwdriver.disallow, groups = {cracky=2}, diff --git a/coal_power_station/boiler_base.lua b/coal_power_station/boiler_base.lua index 548e2c3..ec68701 100644 --- a/coal_power_station/boiler_base.lua +++ b/coal_power_station/boiler_base.lua @@ -30,6 +30,7 @@ minetest.register_node("techage:coalboiler_base", { on_construct = tubelib2.init_mem, + paramtype = "light", paramtype2 = "facedir", on_rotate = screwdriver.disallow, groups = {cracky=2}, diff --git a/coal_power_station/boiler_top.lua b/coal_power_station/boiler_top.lua index 405fc0f..a044ac4 100644 --- a/coal_power_station/boiler_top.lua +++ b/coal_power_station/boiler_top.lua @@ -247,6 +247,7 @@ minetest.register_node("techage:coalboiler_top", { minetest.after(0.5, move_to_water, pos) end, + paramtype = "light", paramtype2 = "facedir", groups = {cracky=1}, on_rotate = screwdriver.disallow, diff --git a/coal_power_station/firebox.lua b/coal_power_station/firebox.lua index 6ac5fab..a663efa 100644 --- a/coal_power_station/firebox.lua +++ b/coal_power_station/firebox.lua @@ -87,6 +87,7 @@ minetest.register_node("techage:coalfirebox", { fixed = {-13/32, -16/32, -13/32, 13/32, 16/32, 13/32}, }, + paramtype = "light", paramtype2 = "facedir", on_rotate = screwdriver.disallow, groups = {cracky=2}, @@ -143,6 +144,7 @@ minetest.register_node("techage:coalfirehole", { }, }, + paramtype = "light", paramtype2 = "facedir", pointable = false, diggable = false, @@ -177,6 +179,7 @@ minetest.register_node("techage:coalfirehole_on", { {-6/16, -6/16, 6/16, 6/16, 6/16, 12/16}, }, }, + paramtype = "light", paramtype2 = "facedir", light_source = 8, pointable = false, @@ -238,6 +241,7 @@ minetest.register_node("techage:oilfirebox", { fixed = {-13/32, -16/32, -13/32, 13/32, 16/32, 13/32}, }, + paramtype = "light", paramtype2 = "facedir", on_rotate = screwdriver.disallow, groups = {cracky=2}, diff --git a/liquids/liquid.lua b/liquids/liquid.lua index 15acae6..4c48551 100644 --- a/liquids/liquid.lua +++ b/liquids/liquid.lua @@ -75,7 +75,7 @@ end local function get_network_table(pos, outdir, ntype) - -- jump to the next node because pumps have to network + -- jump to the next node because pumps have two network -- interfaces and therefore can't have a netID local pos2 = Pipe:get_connected_node_pos(pos, outdir) local mem = tubelib2.get_mem(pos2) diff --git a/liquids/pump.lua b/liquids/pump.lua index 70c3470..d2b2472 100644 --- a/liquids/pump.lua +++ b/liquids/pump.lua @@ -187,6 +187,7 @@ local nworks = { pipe = { sides = {L = 1, R = 1}, -- Pipe connection side ntype = "pump", + blocker = true, -- for the connection_walk }, } diff --git a/liquids/tank.lua b/liquids/tank.lua index d5ecb77..e92ff45 100644 --- a/liquids/tank.lua +++ b/liquids/tank.lua @@ -183,9 +183,11 @@ minetest.register_node("techage:ta3_tank", { end, on_timer = function(pos, elapsed) local mem = tubelib2.get_mem(pos) - mem.countdown = mem.countdown - 1 - M(pos):set_string("formspec", formspec(mem)) - return mem.countdown > 0 + if mem.countdown then + mem.countdown = mem.countdown - 1 + M(pos):set_string("formspec", formspec(mem)) + return mem.countdown > 0 + end end, after_dig_node = function(pos, oldnode, oldmetadata, digger) Pipe:after_dig_node(pos) @@ -233,6 +235,7 @@ minetest.register_node("techage:oiltank", { "techage_filling_metal.png^techage_framexl_ta3.png^techage_appl_explosive.png", }, drawtype = "nodebox", + paramtype = "light", node_box = { type = "fixed", fixed = {-6/8, -6/8, -6/8, 6/8, 6/8, 6/8}, @@ -267,9 +270,11 @@ minetest.register_node("techage:oiltank", { end, on_timer = function(pos, elapsed) local mem = tubelib2.get_mem(pos) - mem.countdown = mem.countdown - 1 - M(pos):set_string("formspec", formspec(mem)) - return mem.countdown > 0 + if mem.countdown then + mem.countdown = mem.countdown - 1 + M(pos):set_string("formspec", formspec(mem)) + return mem.countdown > 0 + end end, after_dig_node = function(pos, oldnode, oldmetadata, digger) Pipe:after_dig_node(pos) @@ -342,9 +347,11 @@ minetest.register_node("techage:ta4_tank", { end, on_timer = function(pos, elapsed) local mem = tubelib2.get_mem(pos) - mem.countdown = mem.countdown - 1 - M(pos):set_string("formspec", formspec(mem)) - return mem.countdown > 0 + if mem.countdown then + mem.countdown = mem.countdown - 1 + M(pos):set_string("formspec", formspec(mem)) + return mem.countdown > 0 + end end, after_dig_node = function(pos, oldnode, oldmetadata, digger) Pipe:after_dig_node(pos) diff --git a/nodes/gateblock.lua b/nodes/gateblock.lua index 253c7f0..3c24324 100644 --- a/nodes/gateblock.lua +++ b/nodes/gateblock.lua @@ -71,6 +71,7 @@ for idx,pgn in ipairs(tPgns) do tubelib2.del_mem(pos) end, + paramtype = "light", drawtype = "glasslike", paramtype2 = "facedir", sounds = default.node_sound_stone_defaults(), diff --git a/nodes/pillar.lua b/nodes/pillar.lua index 45c48c8..94c3082 100644 --- a/nodes/pillar.lua +++ b/nodes/pillar.lua @@ -23,6 +23,7 @@ minetest.register_node("techage:pillar", { type = "fixed", fixed = {-8/32, -16/32, -8/32, 8/32, 16/32, 8/32}, }, + paramtype = "light", backface_culling = true, groups = {cracky=1}, on_rotate = screwdriver.disallow, diff --git a/power/powerswitch.lua b/power/powerswitch.lua index 49dae02..b3f6433 100644 --- a/power/powerswitch.lua +++ b/power/powerswitch.lua @@ -249,6 +249,8 @@ minetest.register_node("techage:powerswitch_box", { }, }, + paramtype = "light", + sunlight_propagates = true, on_place = on_place, on_rotate = on_rotate, paramtype2 = "facedir", diff --git a/steam_engine/boiler.lua b/steam_engine/boiler.lua index 742f3b3..4233a55 100644 --- a/steam_engine/boiler.lua +++ b/steam_engine/boiler.lua @@ -220,6 +220,7 @@ minetest.register_node("techage:boiler1", { fixed = {-8/32, -16/32, -8/32, 8/32, 16/32, 8/32}, }, + paramtype = "light", groups = {cracky=1}, on_rotate = screwdriver.disallow, is_ground_content = false, @@ -255,6 +256,7 @@ minetest.register_node("techage:boiler2", { minetest.after(0.5, move_to_water, pos) end, + paramtype = "light", groups = {cracky=1}, on_rotate = screwdriver.disallow, is_ground_content = false,