From 04c441768fee284585475047ee9d3e733def908e Mon Sep 17 00:00:00 2001 From: Hybrid Dog Date: Wed, 6 Sep 2017 13:29:48 +0200 Subject: [PATCH] Use minetest.after instead of globalstep --- init.lua | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/init.lua b/init.lua index 9c33f9d..72fa873 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,3 @@ -local timer = 0 - if minetest.settings:get_bool("enable_item_pickup") ~= false then local pickup_gain = tonumber(minetest.settings:get("item_pickup_gain")) or 0.4 local pickup_radius = tonumber(minetest.settings:get("item_pickup_radius")) or 0.75 @@ -10,12 +8,7 @@ if minetest.settings:get_bool("enable_item_pickup") ~= false then end local damage_enabled = minetest.settings:get_bool("enable_damage") - minetest.register_globalstep(function(dtime) - - timer = timer + dtime - if timer < 0.2 then return end - timer = 0 - + local function pickupfunc() for _,player in ipairs(minetest.get_connected_players()) do local keys_pressed = not key_triggered @@ -106,7 +99,13 @@ if minetest.settings:get_bool("enable_item_pickup") ~= false then end end end - end) + end + + local function pickup_step() + pickupfunc() + minetest.after(0.2, pickup_step) + end + minetest.after(3.0, pickup_step) end if minetest.settings:get_bool("enable_item_drop") ~= false then