Add files via upload
This commit is contained in:
31
utils.lua
31
utils.lua
@@ -101,6 +101,21 @@ end
|
||||
|
||||
|
||||
|
||||
-- check for pipeworks
|
||||
if minetest.global_exists ("pipeworks") then
|
||||
utils.pipeworks_supported = true
|
||||
utils.pipeworks_after_place = pipeworks.after_place
|
||||
utils.pipeworks_after_dig = pipeworks.after_dig
|
||||
else
|
||||
utils.pipeworks_supported = false
|
||||
utils.pipeworks_after_place = function (pos)
|
||||
end
|
||||
utils.pipeworks_after_dig = function (pos)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function utils.on_destroy (itemstack)
|
||||
local stack = ItemStack (itemstack)
|
||||
|
||||
@@ -210,6 +225,22 @@ end
|
||||
|
||||
|
||||
|
||||
function utils.is_same_item (item1, item2)
|
||||
local copy1 = ItemStack (stack1)
|
||||
local copy2 = ItemStack (stack2)
|
||||
|
||||
if copy1 and copy2 then
|
||||
copy1:set_count (1)
|
||||
copy2:set_count (1)
|
||||
|
||||
return copy1:to_string () == copy2:to_string ()
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
|
||||
function utils.destroy_node (pos)
|
||||
local node = utils.get_far_node (pos)
|
||||
|
||||
|
Reference in New Issue
Block a user