forked from mtcontrib/homedecor_modpack
don't deduct sofas from inventory in creative mode
This commit is contained in:
parent
cf44a85684
commit
3ea7d5d84e
@ -25,12 +25,15 @@ minetest.register_node("lrfurn:longsofa", {
|
|||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
||||||
|
local playername = placer:get_player_name()
|
||||||
if minetest.is_protected(pos, placer:get_player_name()) then return true end
|
if minetest.is_protected(pos, placer:get_player_name()) then return true end
|
||||||
|
|
||||||
local fdir = minetest.dir_to_facedir(placer:get_look_dir(), false)
|
local fdir = minetest.dir_to_facedir(placer:get_look_dir(), false)
|
||||||
|
|
||||||
if lrfurn.check_forward(pos, fdir, true, placer) then
|
if lrfurn.check_forward(pos, fdir, true, placer) then
|
||||||
itemstack:take_item()
|
if not creative.is_enabled_for(playername) then
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(placer:get_player_name(), S("No room to place the sofa!"))
|
minetest.chat_send_player(placer:get_player_name(), S("No room to place the sofa!"))
|
||||||
minetest.set_node(pos, { name = "air" })
|
minetest.set_node(pos, { name = "air" })
|
||||||
|
@ -25,12 +25,15 @@ minetest.register_node("lrfurn:sofa", {
|
|||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
||||||
|
local playername = placer:get_player_name()
|
||||||
if minetest.is_protected(pos, placer:get_player_name()) then return true end
|
if minetest.is_protected(pos, placer:get_player_name()) then return true end
|
||||||
|
|
||||||
local fdir = minetest.dir_to_facedir(placer:get_look_dir(), false)
|
local fdir = minetest.dir_to_facedir(placer:get_look_dir(), false)
|
||||||
|
|
||||||
if lrfurn.check_forward(pos, fdir, false, placer) then
|
if lrfurn.check_forward(pos, fdir, false, placer) then
|
||||||
itemstack:take_item()
|
if not creative.is_enabled_for(playername) then
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(placer:get_player_name(), S("No room to place the sofa!"))
|
minetest.chat_send_player(placer:get_player_name(), S("No room to place the sofa!"))
|
||||||
minetest.set_node(pos, { name = "air" })
|
minetest.set_node(pos, { name = "air" })
|
||||||
|
Loading…
Reference in New Issue
Block a user