Use item_entity_ttl setting for item lifetime

This commit is contained in:
Wuzzy 2019-10-23 09:35:43 +02:00
parent 8456571847
commit 1bc976a3db
2 changed files with 4 additions and 12 deletions

View File

@ -97,12 +97,13 @@ minetest.register_entity(
end,
on_step = function(self, dtime)
local time = tonumber(minetest.settings:get("remove_items"))
if not time then time = 600 end
local time_to_live = tonumber(minetest.settings:get("item_entity_ttl"))
if not time_to_live then time_to_live = 900 end
if not self.timer then self.timer = 0 end
self.timer = self.timer + dtime
if time ~= 0 and (self.timer > time) then
if time_to_live ~= -1 and (self.timer > time_to_live) then
minetest.log("action", "[builtin_item] Item entity removed due to timeout at "..minetest.pos_to_string(self.object:get_pos()))
self.object:remove()
return
end

View File

@ -156,15 +156,6 @@ function minetest.handle_node_drops(pos, drops, digger)
z = -z
end
obj:set_velocity({x=1/x, y=obj:get_velocity().y, z=1/z})
-- FIXME this doesnt work for deactiveted objects
if minetest.settings:get("remove_items") and tonumber(minetest.settings:get("remove_items")) then
minetest.after(tonumber(minetest.settings:get("remove_items")), function(obj)
if obj then
obj:remove()
end
end, obj)
end
end
end
end