From 8994468c5c1b2875011abb48577ae41c563b24eb Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 30 May 2017 18:16:36 +0200 Subject: [PATCH] Enable _insta_collect by default in item entities --- mods/ENTITIES/mcl_item_entity/init.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index 060caac676..2b2f12a598 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -1,6 +1,6 @@ --basic settings local item_drop_settings = {} --settings table -item_drop_settings.age = 1 --how old an item has to be before collecting +item_drop_settings.age = 1 --how old a dropped item (_insta_collect==false) has to be before collecting item_drop_settings.radius_magnet = 2 --radius of item magnet item_drop_settings.radius_collect = 0.2 --radius of collection item_drop_settings.player_collect_height = 1.0 --added to their pos y value @@ -172,7 +172,6 @@ function minetest.handle_node_drops(pos, drops, digger) z = -z end obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z}) - obj:get_luaentity()._insta_collect = true end end end @@ -194,6 +193,8 @@ function minetest.item_drop(itemstack, dropper, pos) v.y = v.y*4 + 2 v.z = v.z*4 obj:setvelocity(v) + -- Force collection delay + obj:get_luaentity()._insta_collect = false return itemstack end end @@ -310,6 +311,10 @@ core.register_entity(":__builtin:item", { else self.itemstring = staticdata end + if self._insta_collect == nil then + -- Intentionally default, since delayed collection is rare + self._insta_collect = true + end self._magnet_timer = 0 self._magnet_active = false -- How long ago the last possible collector was detected. nil = none in this session