punching stuck falling entity drops as item
This commit is contained in:
parent
2e1aba1aa1
commit
b0ccbd644f
15
init.lua
15
init.lua
@ -264,6 +264,21 @@ core.register_entity(":__builtin:falling_node", {
|
||||
end
|
||||
end,
|
||||
|
||||
-- incase falling entity is stuck, punching drops as item to recover
|
||||
on_punch = function(self, puncher, tflp, tool_caps, dir, damage)
|
||||
|
||||
if puncher and puncher:is_player() then
|
||||
|
||||
local drops = core.get_node_drops(self.node, "")
|
||||
|
||||
for _, dropped_item in pairs(drops) do
|
||||
core.add_item(self.object:get_pos(), dropped_item)
|
||||
end
|
||||
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
|
||||
-- used to simulate a little lag
|
||||
|
Loading…
x
Reference in New Issue
Block a user