forked from mtcontrib/homedecor_modpack
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:
parent
6349c53824
commit
f03e71397a
@ -89,7 +89,7 @@ for _, c in ipairs(bookcolors) do
|
|||||||
if data.title and data.title ~= "" then
|
if data.title and data.title ~= "" then
|
||||||
meta:set_string("infotext", data.title)
|
meta:set_string("infotext", data.title)
|
||||||
end
|
end
|
||||||
if not homedecor.expect_infinite_stacks then
|
if not creative.is_enabled_for(plname) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
@ -251,6 +251,7 @@ homedecor.register("swing", {
|
|||||||
place_on = "bottom"
|
place_on = "bottom"
|
||||||
},
|
},
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
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)
|
local isceiling, pos = homedecor.find_ceiling(itemstack, placer, pointed_thing)
|
||||||
if isceiling then
|
if isceiling then
|
||||||
local height = 0
|
local height = 0
|
||||||
@ -263,7 +264,7 @@ homedecor.register("swing", {
|
|||||||
|
|
||||||
if not testreg or not testreg.buildable_to then
|
if not testreg or not testreg.buildable_to then
|
||||||
if i < 1 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
|
return itemstack
|
||||||
else
|
else
|
||||||
break
|
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 })
|
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()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
else
|
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
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
|
@ -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)
|
ctrl_node_def.after_place_node(pos, placer, itemstack, pointed_thing)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not homedecor.expect_infinite_stacks then
|
if not creative.is_enabled_for(placer_name) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -11,12 +11,8 @@ local modpath = minetest.get_modpath("homedecor")
|
|||||||
|
|
||||||
local S = homedecor_i18n.gettext
|
local S = homedecor_i18n.gettext
|
||||||
|
|
||||||
homedecor = {
|
homedecor = {}
|
||||||
modpath = modpath,
|
homedecor.modpath = modpath
|
||||||
|
|
||||||
-- infinite stacks
|
|
||||||
expect_infinite_stacks = minetest.settings:get_bool("creative_mode") and not minetest.get_modpath("unified_inventory")
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Determine if the item being pointed at is the underside of a node (e.g a ceiling)
|
-- 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)
|
function homedecor.find_ceiling(itemstack, placer, pointed_thing)
|
||||||
|
Loading…
Reference in New Issue
Block a user