init function

This commit is contained in:
AFCMS 2021-03-19 10:23:22 +01:00
parent 59892abf6d
commit 8611d27f1d
2 changed files with 14 additions and 15 deletions

View File

@ -222,21 +222,8 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
-- Add liquid bucket and put it into inventory, if possible. -- Add liquid bucket and put it into inventory, if possible.
-- Drop new bucket otherwise. -- Drop new bucket otherwise.
if new_bucket then if minetest.is_creative_enabled(user:get_player_name()) then --TODO
if itemstack:get_count() == 1 then itemstack:take_item()
return new_bucket
else
local inv = user:get_inventory()
if inv:room_for_item("main", new_bucket) then
inv:add_item("main", new_bucket)
else
minetest.add_item(user:get_pos(), new_bucket)
end
if not minetest.is_creative_enabled(user:get_player_name()) then
itemstack:take_item()
end
return itemstack
end
end end
end, end,
_on_dispense = function(stack, pos, droppos, dropnode, dropdir) _on_dispense = function(stack, pos, droppos, dropnode, dropdir)

View File

@ -4,6 +4,18 @@ 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() and minetest.is_creative_enabled(user:get_player_name()) then
if itemstack:get_count() == 1 then
return itemstack
else
local inv = user:get_inventory()
if inv:room_for_item("main", itemstack) then
inv:add_item("main", itemstack)
else
minetest.add_item(user:get_pos(), new_bucket)
end
end
end
end end
-- Convenience function because the cauldron nodeboxes are very similar -- Convenience function because the cauldron nodeboxes are very similar