Add item flight time setting, set it to 5 seconds by default

This commit is contained in:
Hybrid Dog 2017-09-08 20:42:28 +02:00
parent 3bc3a4bd25
commit da2fb1df20
2 changed files with 7 additions and 1 deletions

@ -5,6 +5,8 @@ if minetest.settings:get_bool("item_drop.enable_item_pickup") ~= false then
minetest.settings:get("item_drop.pickup_radius")) or 0.75 minetest.settings:get("item_drop.pickup_radius")) or 0.75
local magnet_radius = tonumber( local magnet_radius = tonumber(
minetest.settings:get("item_drop.magnet_radius")) or -1 minetest.settings:get("item_drop.magnet_radius")) or -1
local magnet_time = tonumber(
minetest.settings:get("item_drop.magnet_time")) or 5.0
local pickup_age = tonumber( local pickup_age = tonumber(
minetest.settings:get("item_drop.pickup_age")) or 0.5 minetest.settings:get("item_drop.pickup_age")) or 0.5
local key_triggered = minetest.settings:get_bool( local key_triggered = minetest.settings:get_bool(
@ -145,7 +147,7 @@ if minetest.settings:get_bool("item_drop.enable_item_pickup") ~= false then
physical = false physical = false
}) })
minetest.after(1.0, afterflight, object, inv) minetest.after(magnet_time, afterflight, object, inv)
end end
end end
end end

@ -24,5 +24,9 @@ item_drop.pickup_radius (Pickup radius) float 0.75
#flying #flying
item_drop.magnet_radius (Magnet radius) float -1 item_drop.magnet_radius (Magnet radius) float -1
#Item flight duration, items flying for more than this time are added to the
#player's inventory
item_drop.magnet_time (Magnet time) float 5.0
#Time delay in seconds after autopicking an item if it's dropped by a player #Time delay in seconds after autopicking an item if it's dropped by a player
item_drop.pickup_age (Pickup age) float 0.5 item_drop.pickup_age (Pickup age) float 0.5