diff options
Diffstat (limited to 'computer')
-rw-r--r-- | computer/computers.lua | 8 | ||||
-rw-r--r-- | computer/init.lua | 10 | ||||
-rw-r--r-- | computer/tetris.lua | 3 |
3 files changed, 15 insertions, 6 deletions
diff --git a/computer/computers.lua b/computer/computers.lua index cf7c6ac..47ce2e1 100644 --- a/computer/computers.lua +++ b/computer/computers.lua @@ -29,6 +29,7 @@ minetest.register_node("computer:vanio", { on_rightclick = function(pos, node, clicker, itemstack) node.name = "computer:vanio_off" minetest.set_node(pos, node) + return itemstack end }) @@ -48,6 +49,7 @@ minetest.register_node("computer:vanio_off", { on_rightclick = function(pos, node, clicker, itemstack) node.name = "computer:vanio" minetest.set_node(pos, node) + return itemstack end }) @@ -168,6 +170,7 @@ minetest.register_node("computer:monitor", { on_rightclick = function(pos, node, clicker, itemstack) node.name = "computer:monitor_on" minetest.set_node(pos, node) + return itemstack end }) @@ -186,6 +189,7 @@ minetest.register_node("computer:monitor_on", { on_rightclick = function(pos, node, clicker, itemstack) node.name = "computer:monitor" minetest.set_node(pos, node) + return itemstack end }) @@ -294,12 +298,13 @@ minetest.register_node("computer:server", { on_rightclick = function(pos, node, clicker, itemstack) node.name = "computer:server_on" minetest.set_node(pos, node) + return itemstack end, on_place = function(itemstack, placer, pointed_thing) local pos = pointed_thing.above if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then minetest.chat_send_player( placer:get_player_name(), "Not enough vertical space to place a server!" ) - return + return itemstack end return minetest.item_place(itemstack, placer, pointed_thing) end @@ -333,5 +338,6 @@ minetest.register_node("computer:server_on", { on_rightclick = function(pos, node, clicker, itemstack) node.name = "computer:server" minetest.set_node(pos, node) + return itemstack end }) diff --git a/computer/init.lua b/computer/init.lua index 975f04f..bb690ed 100644 --- a/computer/init.lua +++ b/computer/init.lua @@ -27,11 +27,12 @@ computer.register = function (name, def) node_box = def.node_box, selection_box = def.node_box, on_rightclick = function (pos, node, clicker, itemstack) - if (def.on_turn_off) then - if (def.on_turn_off(pos, node, clicker, itemstack)) then return end + if def.on_turn_off and def.on_turn_off(pos, node, clicker, itemstack) then + return itemstack end node.name = OFFSTATE minetest.set_node(pos, node) + return itemstack end }) minetest.register_node(OFFSTATE, { @@ -50,11 +51,12 @@ computer.register = function (name, def) node_box = def.node_box_off or def.node_box, selection_box = def.node_box_off or def.node_box, on_rightclick = function (pos, node, clicker, itemstack) - if (def.on_turn_on) then - if (def.on_turn_on(pos, node, clicker, itemstack)) then return end + if def.on_turn_on and def.on_turn_on(pos, node, clicker, itemstack) then + return itemstack end node.name = ONSTATE minetest.set_node(pos, node) + return itemstack end, drop = ONSTATE }) diff --git a/computer/tetris.lua b/computer/tetris.lua index 5a9ffed..5f0b71c 100644 --- a/computer/tetris.lua +++ b/computer/tetris.lua @@ -276,7 +276,8 @@ minetest.register_node("computer:tetris_arcade", { end if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then minetest.chat_send_player(placer:get_player_name(), "No room for place the Arcade!") - return end + return itemstack + end local dir = placer:get_look_dir() local node = {name="computer:tetris_arcade", param1=0, param2 = minetest.dir_to_facedir(dir)} minetest.set_node(pos, node) |