diff --git a/init.lua b/init.lua index ab21f66..2de4148 100644 --- a/init.lua +++ b/init.lua @@ -33,34 +33,50 @@ minetest.register_node("scaffolding:scaffolding", { -- many thanks to addi for improveing (rewriteing) my crappy code -- local name = minetest.get_node(pos).name -- get loacation of node - height = 0; -- set hite of scaffolding (not set) + height = 0; + depth = 0; -- !!Note!! depth is not needed at the moment --[[ debug stuff ]] minetest.chat_send_all(string.format("node: %s",name)) minetest.chat_send_all(string.format("node: %s %s %s ",pos.x, pos.y, pos.z )) + -- set pos at bottom of scafolding tower. + repeat + pos.y = pos.y - 1; --every run get one node up + depth = depth - 1 + local current_node = minetest.get_node(pos); --get the node of the new position + minetest.chat_send_all(string.format("found %q at location: %s", + current_node.name, + minetest.pos_to_string(pos) + )) + + until current_node.name ~= "scaffolding:scaffolding" -- will repeat untill it dose not find a scaffolding node + minetest.chat_send_all(string.format("exit loop")) + + -- check height of scaffolding tower -- + repeat pos.y = pos.y + 1; --every run get one node up height = height + 1 local current_node = minetest.get_node(pos); --get the node of the new position - minetest.chat_send_all(string.format("found %q at location: %s", - current_node.name, - minetest.pos_to_string(pos) - )) + minetest.chat_send_all(string.format("found %q at location: %s", + current_node.name, + minetest.pos_to_string(pos) + )) if current_node.name == "air" then minetest.set_node(pos, {name = "scaffolding:scaffolding"} ) itemstack:take_item(1); --//and remove one if its the correct one player:set_wielded_item(itemstack);--//update inventory of the player end - until current_node.name ~= "scaffolding:scaffolding" or height >= 64 --we repeat until we find something else then "scaffolding:scaffolding" - --maybe there should be also another limit, because its currently possible to build infinite towers - minetest.chat_send_all(string.format("exit loop")) + until current_node.name ~= "scaffolding:scaffolding" or height >= 32 --we repeat until we find something else then "scaffolding:scaffolding" + --maybe there should be also another limit, because its currently possible to build infinite towers + minetest.chat_send_all(string.format("exit loop")) - end + end - end, + end, node_box = { type = "fixed", @@ -237,13 +253,30 @@ minetest.register_node("scaffolding:reinforced_scaffolding", { -- many thanks to addi for improveing (rewriteing) my crappy code -- local name = minetest.get_node(pos).name -- get loacation of node - height = 0; -- set hite of scaffolding (not set) + height = 0; + depth = 0; -- !!Note!! depth is not deeded at the moment --[[ debug stuff ]] minetest.chat_send_all(string.format("node: %s",name)) minetest.chat_send_all(string.format("node: %s %s %s ",pos.x, pos.y, pos.z )) + -- set pos at bottom of scafolding tower. + repeat + pos.y = pos.y - 1; --every run get one node up + depth = depth - 1 -- !!Note!! depth is not needed at the moment + + local current_node = minetest.get_node(pos); --get the node of the new position + minetest.chat_send_all(string.format("found %q at location: %s", + current_node.name, + minetest.pos_to_string(pos) + )) + + until current_node.name ~= "scaffolding:iron_scaffolding" -- will repeat untill it dose not find a scaffolding node + minetest.chat_send_all(string.format("exit loop")) + + -- check height of scaffolding tower -- + repeat pos.y = pos.y + 1; --every run get one node up height = height + 1 @@ -258,7 +291,7 @@ minetest.register_node("scaffolding:reinforced_scaffolding", { itemstack:take_item(1); --//and remove one if its the correct one player:set_wielded_item(itemstack);--//update inventory of the player end - until current_node.name ~= "scaffolding:iron_scaffolding" or height >= 64 --we repeat until we find something else then "scaffolding:scaffolding" + until current_node.name ~= "scaffolding:iron_scaffolding" or height >= 32 --we repeat until we find something else then "scaffolding:scaffolding" --maybe there should be also another limit, because its currently possible to build infinite towers minetest.chat_send_all(string.format("exit loop"))