Skip to content

Commit

Permalink
punching stuck falling entity drops as item
Browse files Browse the repository at this point in the history
  • Loading branch information
tenplus1 committed Jan 9, 2021
1 parent 2e1aba1 commit b0ccbd6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b0ccbd6

Please sign in to comment.