Allow custom liquids to have drops

This commit is contained in:
sfan5 2014-06-08 22:53:48 +02:00
parent 1cea2f1b49
commit 282f53ddb7

@ -79,22 +79,17 @@ core.register_entity(":__builtin:falling_node", {
local np = {x=bcp.x, y=bcp.y+1, z=bcp.z} local np = {x=bcp.x, y=bcp.y+1, z=bcp.z}
-- Check what's here -- Check what's here
local n2 = core.get_node(np) local n2 = core.get_node(np)
-- If it's not air or liquid, remove node and replace it with -- remove node and replace it with it's drops
-- it's drops local drops = core.get_node_drops(n2.name, "")
if n2.name ~= "air" and (not core.registered_nodes[n2.name] or core.remove_node(np)
core.registered_nodes[n2.name].liquidtype == "none") then local _, dropped_item
local drops = core.get_node_drops(n2.name, "") for _, dropped_item in ipairs(drops) do
core.remove_node(np) core.add_item(np, dropped_item)
-- Add dropped items end
local _, dropped_item -- Run script hook
for _, dropped_item in ipairs(drops) do local _, callback
core.add_item(np, dropped_item) for _, callback in ipairs(core.registered_on_dignodes) do
end callback(np, n2, nil)
-- Run script hook
local _, callback
for _, callback in ipairs(core.registered_on_dignodes) do
callback(np, n2, nil)
end
end end
-- Create node and remove entity -- Create node and remove entity
core.add_node(np, self.node) core.add_node(np, self.node)