forked from VoxeLibre/VoxeLibre
init function
This commit is contained in:
parent
59892abf6d
commit
8611d27f1d
|
@ -222,22 +222,9 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
|
|||
|
||||
-- Add liquid bucket and put it into inventory, if possible.
|
||||
-- Drop new bucket otherwise.
|
||||
if new_bucket then
|
||||
if itemstack:get_count() == 1 then
|
||||
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
|
||||
if minetest.is_creative_enabled(user:get_player_name()) then --TODO
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
end,
|
||||
_on_dispense = function(stack, pos, droppos, dropnode, dropdir)
|
||||
-- Fill empty bucket with liquid or drop bucket if no liquid
|
||||
|
|
|
@ -4,6 +4,18 @@ mcl_cauldrons = {}
|
|||
-- Cauldron mod, adds cauldrons.
|
||||
|
||||
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
|
||||
|
||||
-- Convenience function because the cauldron nodeboxes are very similar
|
||||
|
|
Loading…
Reference in New Issue