From 1b4628e4917179b664485fecf9ffd37fb0a24db1 Mon Sep 17 00:00:00 2001 From: 1F616EMO~nya Date: Mon, 15 Jan 2024 21:16:46 +0800 Subject: [PATCH] Avoid falling nodes eating digger heads (#94) If the interval of the digtron is too short (e.g. 1s) while the falling time of nodes in front of the digtron is too long, digtrons may run into them. Previously, this would result in falling nodes destroying the digger head. With this change, the digtron absorbs the falling node and puts it into its inventory. --- util.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/util.lua b/util.lua index c9b54b6..c6396e1 100644 --- a/util.lua +++ b/util.lua @@ -337,6 +337,14 @@ digtron.damage_creatures = function(player, source_pos, target_pos, amount, item table.insert(items_dropped, lua_entity.itemstring) lua_entity.itemstring = "" obj:remove() + elseif lua_entity.name == "__builtin:falling_node" then + -- Eat all falling nodes in front of the digtron + -- to avoid them eating away our digger heads + local drops = minetest.get_node_drops(lua_entity.node, "") + for _, item in pairs(drops) do + table.insert(items_dropped, item) + end + obj:remove() else if obj.add_velocity ~= nil then obj:add_velocity(velocity)