Using Screwdriver rotates the signs clockwise. Fix issue #2

This commit is contained in:
addi 2016-09-07 16:47:21 +02:00
parent 4a3efd37e4
commit 7d93f60b74
4 changed files with 53 additions and 7 deletions

View File

@ -94,6 +94,50 @@ arrow_signs.on_place = function(itemstack, placer, pointed_thing)
return minetest.item_place_node(itemstack, placer, pointed_thing, param2) return minetest.item_place_node(itemstack, placer, pointed_thing, param2)
end end
local matrix = {
-- Mounted on Ground (-Y)
[10]=19,
[19]=4,
[4]=13,
[13]=10,
-- Mounted on Top (+Y)
[8]=17,
[17]=6,
[6]=15,
[15]=8,
-- Mounted at South (-Z)
[2]=18, -- down
[18]=22, -- left
[22]=14, -- up
[14]=2, -- right
-- Mounted at North (+Z)
[0]=12, -- down
[12]=20, -- left
[20]=16, -- up
[16]=0, -- right
-- Mounted at West (-X)
[3]=7, -- down
[7]=21, -- left
[21]=11, -- up
[11]=3, -- right
-- Mounted at East (+X)
[1]=9, -- down
[9]=23, -- left
[23]=5, -- up
[5]=1, -- right
}
arrow_signs.on_rotate = function(pos, node, player, mode, new_param2)
node.param2 = matrix[node.param2] or 0 --in case of error
minetest.swap_node(pos,node)
return true
end
arrow_signs.savetext = function(pos, formname, fields, sender) arrow_signs.savetext = function(pos, formname, fields, sender)
if fields.text then if fields.text then
local playername = sender:get_player_name() or "" local playername = sender:get_player_name() or ""

View File

@ -1,7 +1,7 @@
--[[ --[[
Shared Locked Arrow sign Shared Locked Arrow sign
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
]] ]]
minetest.register_node("arrow_signs:shared_locked", { minetest.register_node("arrow_signs:shared_locked", {
@ -24,7 +24,7 @@ minetest.register_node("arrow_signs:shared_locked", {
locks:lock_set_owner( pointed_thing.above, placer, "Shared locked sign"); locks:lock_set_owner( pointed_thing.above, placer, "Shared locked sign");
return itemstack return itemstack
end, end,
on_rotate = arrow_signs.on_rotate,
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
-- prepare the lock of the sign -- prepare the lock of the sign

View File

@ -1,7 +1,7 @@
--[[ --[[
Steel Arrow Sign Steel Arrow Sign
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
]] ]]
@ -20,6 +20,7 @@ minetest.register_node("arrow_signs:steel", {
groups = {cracky = 2}, groups = {cracky = 2},
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
on_place = arrow_signs.on_place, on_place = arrow_signs.on_place,
on_rotate = arrow_signs.on_rotate,
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("formspec", arrow_signs.formspec) meta:set_string("formspec", arrow_signs.formspec)

View File

@ -1,7 +1,7 @@
--[[ --[[
Wooden Arrow sign Wooden Arrow sign
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
]] ]]
@ -20,6 +20,7 @@ minetest.register_node("arrow_signs:wall", {
groups = {choppy = 2, flammable = 2, oddly_breakable_by_hand = 3}, groups = {choppy = 2, flammable = 2, oddly_breakable_by_hand = 3},
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
on_place = arrow_signs.on_place, on_place = arrow_signs.on_place,
on_rotate = arrow_signs.on_rotate,
on_construct = function(pos) on_construct = function(pos)
--local n = minetest.get_node(pos) --local n = minetest.get_node(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)