Enable _insta_collect by default in item entities
This commit is contained in:
parent
fb26d6d274
commit
8994468c5c
|
@ -1,6 +1,6 @@
|
||||||
--basic settings
|
--basic settings
|
||||||
local item_drop_settings = {} --settings table
|
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_magnet = 2 --radius of item magnet
|
||||||
item_drop_settings.radius_collect = 0.2 --radius of collection
|
item_drop_settings.radius_collect = 0.2 --radius of collection
|
||||||
item_drop_settings.player_collect_height = 1.0 --added to their pos y value
|
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
|
z = -z
|
||||||
end
|
end
|
||||||
obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z})
|
obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z})
|
||||||
obj:get_luaentity()._insta_collect = true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -194,6 +193,8 @@ function minetest.item_drop(itemstack, dropper, pos)
|
||||||
v.y = v.y*4 + 2
|
v.y = v.y*4 + 2
|
||||||
v.z = v.z*4
|
v.z = v.z*4
|
||||||
obj:setvelocity(v)
|
obj:setvelocity(v)
|
||||||
|
-- Force collection delay
|
||||||
|
obj:get_luaentity()._insta_collect = false
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -310,6 +311,10 @@ core.register_entity(":__builtin:item", {
|
||||||
else
|
else
|
||||||
self.itemstring = staticdata
|
self.itemstring = staticdata
|
||||||
end
|
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_timer = 0
|
||||||
self._magnet_active = false
|
self._magnet_active = false
|
||||||
-- How long ago the last possible collector was detected. nil = none in this session
|
-- How long ago the last possible collector was detected. nil = none in this session
|
||||||
|
|
Loading…
Reference in New Issue
Block a user