diff options
author | 12Me21 <12Me21.MC@gmail.com> | 2018-09-26 13:41:30 -0400 |
---|---|---|
committer | Pierre-Yves Rollo <dev@pyrollo.com> | 2018-09-26 19:41:30 +0200 |
commit | 44b911be9e57dccea606da2b6907135af75d5033 (patch) | |
tree | c97b4dd72c2817f3cf5498f85cec87d82e2669a0 /signs_api | |
parent | d22362a4acfffa2853974a0682b953a8f867e4e4 (diff) | |
download | display_modpack-44b911be9e57dccea606da2b6907135af75d5033.tar.gz display_modpack-44b911be9e57dccea606da2b6907135af75d5033.tar.bz2 display_modpack-44b911be9e57dccea606da2b6907135af75d5033.zip |
Improve on_rotate functions (#21)
Fixed bugs and improve on_rotate and support color- paramtype2s
Diffstat (limited to 'signs_api')
-rw-r--r-- | signs_api/init.lua | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/signs_api/init.lua b/signs_api/init.lua index 1a4357e..ec3b0e9 100644 --- a/signs_api/init.lua +++ b/signs_api/init.lua @@ -132,18 +132,19 @@ function signs_api.on_place_direction(itemstack, placer, pointed_thing) end -- Handles screwdriver rotation. Direction is affected for direction signs +-- If rotation mode is 2 and sign is directional, swap direction. +-- Otherwise use display_api's on_rotate function. function signs_api.on_rotate(pos, node, player, mode, new_param2) if mode == 2 then local ndef = minetest.registered_nodes[node.name] - if ndef.signs_other_dir then - minetest.swap_node(pos, {name = ndef.signs_other_dir, - param1 = node.param1, param2 = node.param2}) + if ndef.signs_other_dir then + minetest.swap_node(pos, {name = ndef.signs_other_dir, + param1 = node.param1, param2 = node.param2}) display_api.update_entities(pos) - end - else - display_api.on_rotate(pos, node, user, mode, new_param2) + return true + end end - return false; + return display_api.on_rotate(pos, node, user, mode, new_param2) end function signs_api.register_sign(mod, name, model) |