try to fix give function

This commit is contained in:
AFCMS 2021-03-19 14:58:25 +01:00
parent d00490c86f
commit 64b49ba719
1 changed files with 8 additions and 8 deletions

View File

@ -4,9 +4,9 @@ mcl_cauldrons = {}
-- Cauldron mod, adds cauldrons. -- Cauldron mod, adds cauldrons.
local function give_item(user, itemstack) local function give_item(user, itemstack)
if itemstack and user:is_player() then local inv = user:get_inventory()
local inv = user:get_inventory() if inv then
if false then --minetest.is_creative_enabled(user:get_player_name()) then --[[if false then --minetest.is_creative_enabled(user:get_player_name()) then
if inv:contains_item("main", itemstack) then if inv:contains_item("main", itemstack) then
return false return false
else else
@ -16,13 +16,13 @@ local function give_item(user, itemstack)
minetest.add_item(user:get_pos(), itemstack) minetest.add_item(user:get_pos(), itemstack)
end end
end end
else]]
if inv:room_for_item("main", itemstack) then
inv:add_item("main", itemstack)
else else
if inv:room_for_item("main", itemstack) then minetest.add_item(user:get_pos(), itemstack)
inv:add_item("main", itemstack)
else
minetest.add_item(user:get_pos(), itemstack)
end
end end
--end
end end
return itemstack return itemstack
end end