diff --git a/homedecor/books.lua b/homedecor/books.lua index 639ba8d7..a480d686 100644 --- a/homedecor/books.lua +++ b/homedecor/books.lua @@ -89,7 +89,7 @@ for _, c in ipairs(bookcolors) do if data.title and data.title ~= "" then meta:set_string("infotext", data.title) end - if not homedecor.expect_infinite_stacks then + if not creative.is_enabled_for(plname) then itemstack:take_item() end return itemstack diff --git a/homedecor/exterior.lua b/homedecor/exterior.lua index 074fa952..4eed35c9 100644 --- a/homedecor/exterior.lua +++ b/homedecor/exterior.lua @@ -251,6 +251,7 @@ homedecor.register("swing", { place_on = "bottom" }, on_place = function(itemstack, placer, pointed_thing) + local placer_name = placer:get_player_name() or "" local isceiling, pos = homedecor.find_ceiling(itemstack, placer, pointed_thing) if isceiling then local height = 0 @@ -263,7 +264,7 @@ homedecor.register("swing", { if not testreg or not testreg.buildable_to then if i < 1 then - minetest.chat_send_player(placer:get_player_name(), "No room under there to hang a swing.") + minetest.chat_send_player(placer_name, "No room under there to hang a swing.") return itemstack else break @@ -279,11 +280,11 @@ homedecor.register("swing", { minetest.set_node({ x=pos.x, y=pos.y-height, z=pos.z }, { name = "homedecor:swing", param2 = fdir }) - if not homedecor.expect_infinite_stacks then + if not creative.is_enabled_for(placer_name) then itemstack:take_item() end else - minetest.chat_send_player(placer:get_player_name(), "You have to point at the bottom side of an overhanging object to place a swing.") + minetest.chat_send_player(placer_name, "You have to point at the bottom side of an overhanging object to place a swing.") end return itemstack end, diff --git a/homedecor/handlers/expansion.lua b/homedecor/handlers/expansion.lua index 2c9b7ddd..c010bf43 100644 --- a/homedecor/handlers/expansion.lua +++ b/homedecor/handlers/expansion.lua @@ -104,7 +104,7 @@ local function stack(itemstack, placer, fdir, pos, def, pos2, node1, node2, poin ctrl_node_def.after_place_node(pos, placer, itemstack, pointed_thing) end - if not homedecor.expect_infinite_stacks then + if not creative.is_enabled_for(placer_name) then itemstack:take_item() end end diff --git a/homedecor/init.lua b/homedecor/init.lua index f845c799..e38cd817 100644 --- a/homedecor/init.lua +++ b/homedecor/init.lua @@ -11,12 +11,8 @@ local modpath = minetest.get_modpath("homedecor") local S = homedecor_i18n.gettext -homedecor = { - modpath = modpath, - - -- infinite stacks - expect_infinite_stacks = minetest.settings:get_bool("creative_mode") and not minetest.get_modpath("unified_inventory") -} +homedecor = {} +homedecor.modpath = modpath -- Determine if the item being pointed at is the underside of a node (e.g a ceiling) function homedecor.find_ceiling(itemstack, placer, pointed_thing)