Move code of making anvils destroy items when falling

This commit is contained in:
NO11 2021-07-05 12:28:14 +00:00
parent d45e1c07bd
commit 4afdea56db
1 changed files with 4 additions and 1 deletions

View File

@ -19,7 +19,10 @@ local function deal_falling_damage(self, dtime)
end
self._hit = self._hit or {}
for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
if mcl_util.get_hp(obj) > 0 and not self._hit[obj] then
local entity = obj:get_luaentity()
if entity and entity.name == "__builtin:item" then
obj:remove()
elseif mcl_util.get_hp(obj) > 0 and not self._hit[obj] then
self._hit[obj] = true
local way = self._startpos.y - pos.y
local damage = (way - 1) * 2