Skip to content
Snippets Groups Projects
Commit 08f7ac57 authored by Casimir's avatar Casimir Committed by sapier
Browse files

Remove buildable_to nodes without dropping item when replaced by a falling node

parent d9df592d
No related branches found
No related tags found
No related merge requests found
...@@ -79,17 +79,24 @@ core.register_entity(":__builtin:falling_node", { ...@@ -79,17 +79,24 @@ 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)
-- remove node and replace it with it's drops -- If it's not air or liquid, remove node and replace it with
local drops = core.get_node_drops(n2.name, "") -- it's drops
core.remove_node(np) if n2.name ~= "air" and (not core.registered_nodes[n2.name] or
local _, dropped_item core.registered_nodes[n2.name].liquidtype == "none") then
for _, dropped_item in ipairs(drops) do core.remove_node(np)
core.add_item(np, dropped_item) if core.registered_nodes[n2.name].buildable_to == false then
end -- Add dropped items
-- Run script hook local drops = core.get_node_drops(n2.name, "")
local _, callback local _, dropped_item
for _, callback in ipairs(core.registered_on_dignodes) do for _, dropped_item in ipairs(drops) do
callback(np, n2, nil) core.add_item(np, dropped_item)
end
end
-- 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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment