Fix placing shared locked signs in creative mode

This commit is contained in:
addi 2016-07-22 16:16:56 +02:00
parent 7a3a058675
commit 1a63436b95
2 changed files with 11 additions and 10 deletions

View File

@ -15,6 +15,7 @@ arrow_signs={}
arrow_signs.formspec = "field[text;Sign text:;${text}]";
local creative = minetest.setting_getbool("creative_mode") or false
arrow_signs.on_place = function(itemstack, placer, pointed_thing)
local posabove = pointed_thing.above
@ -98,16 +99,15 @@ arrow_signs.on_place = function(itemstack, placer, pointed_thing)
place = false
end
if not(place) then
minetest.rotate_node(itemstack, placer, pointed_thing)
if place then
if not creative then
itemstack:take_item()
end
else
itemstack:take_item()
itemstack = minetest.rotate_node(itemstack, placer, pointed_thing)
end
if not minetest.setting_getbool("creative_mode") then
return itemstack
end
return itemstack
end
arrow_signs.savetext = function(pos, formname, fields, sender)

View File

@ -27,8 +27,9 @@ minetest.register_node("arrow_signs:shared_locked", {
legacy_wallmounted = true,
on_place = function(itemstack, placer, pointed_thing)
arrow_signs.on_place(itemstack, placer, pointed_thing);
locks:lock_set_owner( pointed_thing.above, placer, "Shared locked sign" );
itemstack = arrow_signs.on_place(itemstack, placer, pointed_thing);
locks:lock_set_owner( pointed_thing.above, placer, "Shared locked sign");
return itemstack
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)