forked from Mirrorlandia_minetest/minetest
Allow custom liquids to have drops
This commit is contained in:
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)
|
||||||
@ -168,7 +163,7 @@ function nodeupdate_single(p, delay)
|
|||||||
core.registered_nodes[n_bottom.name].liquidtype == "none") and
|
core.registered_nodes[n_bottom.name].liquidtype == "none") and
|
||||||
(n.name ~= n_bottom.name or (core.registered_nodes[n_bottom.name].leveled and
|
(n.name ~= n_bottom.name or (core.registered_nodes[n_bottom.name].leveled and
|
||||||
core.get_node_level(p_bottom) < core.get_node_max_level(p_bottom))) and
|
core.get_node_level(p_bottom) < core.get_node_max_level(p_bottom))) and
|
||||||
(not core.registered_nodes[n_bottom.name].walkable or
|
(not core.registered_nodes[n_bottom.name].walkable or
|
||||||
core.registered_nodes[n_bottom.name].buildable_to) then
|
core.registered_nodes[n_bottom.name].buildable_to) then
|
||||||
if delay then
|
if delay then
|
||||||
core.after(0.1, nodeupdate_single, {x=p.x, y=p.y, z=p.z}, false)
|
core.after(0.1, nodeupdate_single, {x=p.x, y=p.y, z=p.z}, false)
|
||||||
@ -180,7 +175,7 @@ function nodeupdate_single(p, delay)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if core.get_item_group(n.name, "attached_node") ~= 0 then
|
if core.get_item_group(n.name, "attached_node") ~= 0 then
|
||||||
if not check_attached_node(p, n) then
|
if not check_attached_node(p, n) then
|
||||||
drop_attached_node(p)
|
drop_attached_node(p)
|
||||||
@ -194,7 +189,7 @@ function nodeupdate(p, delay)
|
|||||||
p.x = math.floor(p.x+0.5)
|
p.x = math.floor(p.x+0.5)
|
||||||
p.y = math.floor(p.y+0.5)
|
p.y = math.floor(p.y+0.5)
|
||||||
p.z = math.floor(p.z+0.5)
|
p.z = math.floor(p.z+0.5)
|
||||||
|
|
||||||
for x = -1,1 do
|
for x = -1,1 do
|
||||||
for y = -1,1 do
|
for y = -1,1 do
|
||||||
for z = -1,1 do
|
for z = -1,1 do
|
||||||
|
Loading…
Reference in New Issue
Block a user