forked from mtcontrib/arrow_signs
Fix placing shared locked signs in creative mode
This commit is contained in:
parent
7a3a058675
commit
1a63436b95
16
init.lua
16
init.lua
@ -15,6 +15,7 @@ arrow_signs={}
|
|||||||
|
|
||||||
arrow_signs.formspec = "field[text;Sign text:;${text}]";
|
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)
|
arrow_signs.on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
|
||||||
local posabove = pointed_thing.above
|
local posabove = pointed_thing.above
|
||||||
@ -98,16 +99,15 @@ arrow_signs.on_place = function(itemstack, placer, pointed_thing)
|
|||||||
place = false
|
place = false
|
||||||
end
|
end
|
||||||
|
|
||||||
if not(place) then
|
if place then
|
||||||
minetest.rotate_node(itemstack, placer, pointed_thing)
|
if not creative then
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
else
|
else
|
||||||
itemstack:take_item()
|
itemstack = minetest.rotate_node(itemstack, placer, pointed_thing)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
return itemstack
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
arrow_signs.savetext = function(pos, formname, fields, sender)
|
arrow_signs.savetext = function(pos, formname, fields, sender)
|
||||||
|
@ -27,8 +27,9 @@ minetest.register_node("arrow_signs:shared_locked", {
|
|||||||
legacy_wallmounted = true,
|
legacy_wallmounted = true,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
arrow_signs.on_place(itemstack, placer, pointed_thing);
|
itemstack = arrow_signs.on_place(itemstack, placer, pointed_thing);
|
||||||
locks:lock_set_owner( pointed_thing.above, placer, "Shared locked sign" );
|
locks:lock_set_owner( pointed_thing.above, placer, "Shared locked sign");
|
||||||
|
return itemstack
|
||||||
end,
|
end,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
Loading…
Reference in New Issue
Block a user