Skip to content

Commit 282f53d

Browse files
committedJun 8, 2014
Allow custom liquids to have drops
1 parent 1cea2f1 commit 282f53d

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed
 

‎builtin/game/falling.lua

+14-19
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,17 @@ core.register_entity(":__builtin:falling_node", {
7979
local np = {x=bcp.x, y=bcp.y+1, z=bcp.z}
8080
-- Check what's here
8181
local n2 = core.get_node(np)
82-
-- If it's not air or liquid, remove node and replace it with
83-
-- it's drops
84-
if n2.name ~= "air" and (not core.registered_nodes[n2.name] or
85-
core.registered_nodes[n2.name].liquidtype == "none") then
86-
local drops = core.get_node_drops(n2.name, "")
87-
core.remove_node(np)
88-
-- Add dropped items
89-
local _, dropped_item
90-
for _, dropped_item in ipairs(drops) do
91-
core.add_item(np, dropped_item)
92-
end
93-
-- Run script hook
94-
local _, callback
95-
for _, callback in ipairs(core.registered_on_dignodes) do
96-
callback(np, n2, nil)
97-
end
82+
-- remove node and replace it with it's drops
83+
local drops = core.get_node_drops(n2.name, "")
84+
core.remove_node(np)
85+
local _, dropped_item
86+
for _, dropped_item in ipairs(drops) do
87+
core.add_item(np, dropped_item)
88+
end
89+
-- Run script hook
90+
local _, callback
91+
for _, callback in ipairs(core.registered_on_dignodes) do
92+
callback(np, n2, nil)
9893
end
9994
-- Create node and remove entity
10095
core.add_node(np, self.node)
@@ -168,7 +163,7 @@ function nodeupdate_single(p, delay)
168163
core.registered_nodes[n_bottom.name].liquidtype == "none") and
169164
(n.name ~= n_bottom.name or (core.registered_nodes[n_bottom.name].leveled and
170165
core.get_node_level(p_bottom) < core.get_node_max_level(p_bottom))) and
171-
(not core.registered_nodes[n_bottom.name].walkable or
166+
(not core.registered_nodes[n_bottom.name].walkable or
172167
core.registered_nodes[n_bottom.name].buildable_to) then
173168
if delay then
174169
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)
180175
end
181176
end
182177
end
183-
178+
184179
if core.get_item_group(n.name, "attached_node") ~= 0 then
185180
if not check_attached_node(p, n) then
186181
drop_attached_node(p)
@@ -194,7 +189,7 @@ function nodeupdate(p, delay)
194189
p.x = math.floor(p.x+0.5)
195190
p.y = math.floor(p.y+0.5)
196191
p.z = math.floor(p.z+0.5)
197-
192+
198193
for x = -1,1 do
199194
for y = -1,1 do
200195
for z = -1,1 do

0 commit comments

Comments
 (0)
Please sign in to comment.