From: oilboi <47129783+oilboi@users.noreply.github.com> Date: Wed, 1 Jul 2020 03:15:47 +0000 (-0400) Subject: Allow rightclicking a piston to change it's direction X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=93a8e24033889205a66fcbda029684c92ba0ea1b;p=Crafter.git Allow rightclicking a piston to change it's direction --- diff --git a/mods/redstone/piston.lua b/mods/redstone/piston.lua index 0273c3a..dacd1ef 100644 --- a/mods/redstone/piston.lua +++ b/mods/redstone/piston.lua @@ -205,6 +205,12 @@ minetest.register_node("redstone:piston_off", { }) redstone.update(pos) end, + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + local look = clicker:get_look_dir() + look = vector.multiply(look,-1) + local dir = minetest.dir_to_facedir(look, true) + minetest.swap_node(pos,{name="redstone:piston_off",param2=dir}) + end, after_place_node = function(pos, placer, itemstack, pointed_thing) local look = placer:get_look_dir() look = vector.multiply(look,-1) @@ -517,6 +523,12 @@ minetest.register_node("redstone:sticky_piston_off", { }) redstone.update(pos) end, + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + local look = clicker:get_look_dir() + look = vector.multiply(look,-1) + local dir = minetest.dir_to_facedir(look, true) + minetest.swap_node(pos,{name="redstone:sticky_piston_off",param2=dir}) + end, --reverse the direction to face the player after_place_node = function(pos, placer, itemstack, pointed_thing) local look = placer:get_look_dir()