lightning bugfixes

pumping bugfix
This commit is contained in:
Joachim Stolberg 2019-11-04 22:53:04 +01:00
parent a2c6433c10
commit 3d75870b9d
13 changed files with 43 additions and 22 deletions

View File

@ -200,6 +200,7 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState
networks = tNode.networks, networks = tNode.networks,
tubelib2_on_update2 = tNode.tubelib2_on_update2, tubelib2_on_update2 = tNode.tubelib2_on_update2,
paramtype = tNode.paramtype,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = table.copy(tNode.groups), groups = table.copy(tNode.groups),
is_ground_content = false, is_ground_content = false,

View File

@ -108,7 +108,7 @@ end
local function node_connections(pos, tlib2) local function node_connections(pos, tlib2)
local node = techage.get_node_lvm(pos) local node = techage.get_node_lvm(pos)
local val = 0 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 if sides then
for dir = 1,6 do for dir = 1,6 do
@ -136,12 +136,12 @@ local function pos_already_reached(pos)
return true return true
end end
-- check if the given pipe dir out of the node is valid -- check if the given pipe dir into the node is valid
local function valid_indir(pos, indir, param2, net_name) local function valid_indir(indir, node, net_name)
local sides = net_def(pos, net_name).sides local ndef = net_def2(node.name, net_name)
if not sides then return false end if not ndef or not ndef.sides or ndef.blocker then return false end
local side = DirToSide[indir_to_dir(indir, param2)] local side = DirToSide[indir_to_dir(indir, node.param2)]
if not sides[side] then return false end if not ndef.sides[side] then return false end
return true return true
end end
@ -154,8 +154,7 @@ local function connection_walk(pos, indir, node, tlib2, clbk)
if outdir ~= Flip[indir] then if outdir ~= Flip[indir] then
local pos2, indir2 = tlib2:get_connected_node_pos(pos, outdir) local pos2, indir2 = tlib2:get_connected_node_pos(pos, outdir)
local node = techage.get_node_lvm(pos2) local node = techage.get_node_lvm(pos2)
if pos2 and not pos_already_reached(pos2) and if pos2 and not pos_already_reached(pos2) and valid_indir(indir2, node, tlib2.tube_type) then
valid_indir(pos2, indir2, node.param2, tlib2.tube_type) then
connection_walk(pos2, indir2, node, tlib2, clbk) connection_walk(pos2, indir2, node, tlib2, clbk)
end end
end end
@ -172,8 +171,7 @@ local function collect_network_nodes(pos, outdir, tlib2)
local net_name = tlib2.tube_type local net_name = tlib2.tube_type
-- outdir corresponds to the indir coming from -- outdir corresponds to the indir coming from
connection_walk(pos, outdir, node, tlib2, function(pos, indir, node) connection_walk(pos, outdir, node, tlib2, function(pos, indir, node)
local ntype = net_def(pos, net_name).ntype local ntype = net_def2(node.name, net_name).ntype
print("collect_network_nodes", P2S(pos), ntype)
if ntype then if ntype then
if not netw[ntype] then netw[ntype] = {} end if not netw[ntype] then netw[ntype] = {} end
netw[ntype][#netw[ntype] + 1] = {pos = pos, indir = indir} 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 -- check if the given pipe dir into the node is valid
-- valid_indir(pos, indir, param2, net_name) -- 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(pos, tlib2)
techage.networks.node_connections = node_connections techage.networks.node_connections = node_connections

View File

@ -40,6 +40,7 @@ minetest.register_node("techage:ta4_reactor", {
fixed = {-1/2, -23/32, -1/2, 1/2, 32/32, 1/2}, fixed = {-1/2, -23/32, -1/2, 1/2, 32/32, 1/2},
}, },
paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
groups = {cracky=2}, groups = {cracky=2},
@ -79,6 +80,7 @@ minetest.register_node("techage:ta4_reactor_stand", {
type = "fixed", type = "fixed",
fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2}, fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2},
}, },
paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
groups = {cracky=2}, groups = {cracky=2},

View File

@ -30,6 +30,7 @@ minetest.register_node("techage:coalboiler_base", {
on_construct = tubelib2.init_mem, on_construct = tubelib2.init_mem,
paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
groups = {cracky=2}, groups = {cracky=2},

View File

@ -247,6 +247,7 @@ minetest.register_node("techage:coalboiler_top", {
minetest.after(0.5, move_to_water, pos) minetest.after(0.5, move_to_water, pos)
end, end,
paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=1}, groups = {cracky=1},
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,

View File

@ -87,6 +87,7 @@ minetest.register_node("techage:coalfirebox", {
fixed = {-13/32, -16/32, -13/32, 13/32, 16/32, 13/32}, fixed = {-13/32, -16/32, -13/32, 13/32, 16/32, 13/32},
}, },
paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
groups = {cracky=2}, groups = {cracky=2},
@ -143,6 +144,7 @@ minetest.register_node("techage:coalfirehole", {
}, },
}, },
paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
pointable = false, pointable = false,
diggable = 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}, {-6/16, -6/16, 6/16, 6/16, 6/16, 12/16},
}, },
}, },
paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
light_source = 8, light_source = 8,
pointable = false, pointable = false,
@ -238,6 +241,7 @@ minetest.register_node("techage:oilfirebox", {
fixed = {-13/32, -16/32, -13/32, 13/32, 16/32, 13/32}, fixed = {-13/32, -16/32, -13/32, 13/32, 16/32, 13/32},
}, },
paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
groups = {cracky=2}, groups = {cracky=2},

View File

@ -75,7 +75,7 @@ end
local function get_network_table(pos, outdir, ntype) 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 -- interfaces and therefore can't have a netID
local pos2 = Pipe:get_connected_node_pos(pos, outdir) local pos2 = Pipe:get_connected_node_pos(pos, outdir)
local mem = tubelib2.get_mem(pos2) local mem = tubelib2.get_mem(pos2)

View File

@ -187,6 +187,7 @@ local nworks = {
pipe = { pipe = {
sides = {L = 1, R = 1}, -- Pipe connection side sides = {L = 1, R = 1}, -- Pipe connection side
ntype = "pump", ntype = "pump",
blocker = true, -- for the connection_walk
}, },
} }

View File

@ -183,9 +183,11 @@ minetest.register_node("techage:ta3_tank", {
end, end,
on_timer = function(pos, elapsed) on_timer = function(pos, elapsed)
local mem = tubelib2.get_mem(pos) local mem = tubelib2.get_mem(pos)
mem.countdown = mem.countdown - 1 if mem.countdown then
M(pos):set_string("formspec", formspec(mem)) mem.countdown = mem.countdown - 1
return mem.countdown > 0 M(pos):set_string("formspec", formspec(mem))
return mem.countdown > 0
end
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
Pipe:after_dig_node(pos) 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", "techage_filling_metal.png^techage_framexl_ta3.png^techage_appl_explosive.png",
}, },
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = {-6/8, -6/8, -6/8, 6/8, 6/8, 6/8}, fixed = {-6/8, -6/8, -6/8, 6/8, 6/8, 6/8},
@ -267,9 +270,11 @@ minetest.register_node("techage:oiltank", {
end, end,
on_timer = function(pos, elapsed) on_timer = function(pos, elapsed)
local mem = tubelib2.get_mem(pos) local mem = tubelib2.get_mem(pos)
mem.countdown = mem.countdown - 1 if mem.countdown then
M(pos):set_string("formspec", formspec(mem)) mem.countdown = mem.countdown - 1
return mem.countdown > 0 M(pos):set_string("formspec", formspec(mem))
return mem.countdown > 0
end
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
Pipe:after_dig_node(pos) Pipe:after_dig_node(pos)
@ -342,9 +347,11 @@ minetest.register_node("techage:ta4_tank", {
end, end,
on_timer = function(pos, elapsed) on_timer = function(pos, elapsed)
local mem = tubelib2.get_mem(pos) local mem = tubelib2.get_mem(pos)
mem.countdown = mem.countdown - 1 if mem.countdown then
M(pos):set_string("formspec", formspec(mem)) mem.countdown = mem.countdown - 1
return mem.countdown > 0 M(pos):set_string("formspec", formspec(mem))
return mem.countdown > 0
end
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
Pipe:after_dig_node(pos) Pipe:after_dig_node(pos)

View File

@ -71,6 +71,7 @@ for idx,pgn in ipairs(tPgns) do
tubelib2.del_mem(pos) tubelib2.del_mem(pos)
end, end,
paramtype = "light",
drawtype = "glasslike", drawtype = "glasslike",
paramtype2 = "facedir", paramtype2 = "facedir",
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),

View File

@ -23,6 +23,7 @@ minetest.register_node("techage:pillar", {
type = "fixed", type = "fixed",
fixed = {-8/32, -16/32, -8/32, 8/32, 16/32, 8/32}, fixed = {-8/32, -16/32, -8/32, 8/32, 16/32, 8/32},
}, },
paramtype = "light",
backface_culling = true, backface_culling = true,
groups = {cracky=1}, groups = {cracky=1},
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,

View File

@ -249,6 +249,8 @@ minetest.register_node("techage:powerswitch_box", {
}, },
}, },
paramtype = "light",
sunlight_propagates = true,
on_place = on_place, on_place = on_place,
on_rotate = on_rotate, on_rotate = on_rotate,
paramtype2 = "facedir", paramtype2 = "facedir",

View File

@ -220,6 +220,7 @@ minetest.register_node("techage:boiler1", {
fixed = {-8/32, -16/32, -8/32, 8/32, 16/32, 8/32}, fixed = {-8/32, -16/32, -8/32, 8/32, 16/32, 8/32},
}, },
paramtype = "light",
groups = {cracky=1}, groups = {cracky=1},
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
is_ground_content = false, is_ground_content = false,
@ -255,6 +256,7 @@ minetest.register_node("techage:boiler2", {
minetest.after(0.5, move_to_water, pos) minetest.after(0.5, move_to_water, pos)
end, end,
paramtype = "light",
groups = {cracky=1}, groups = {cracky=1},
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
is_ground_content = false, is_ground_content = false,