1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-22 16:10:18 +01:00

get rid of last vestages of "infinite stacks" special handling

just checks for creative mode/priv directly instead, as needed.
This commit is contained in:
Vanessa Ezekowitz 2017-08-12 17:52:29 -04:00
parent 6349c53824
commit f03e71397a
4 changed files with 8 additions and 11 deletions

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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)