mirror of
https://github.com/minetest-mods/item_drop.git
synced 2024-12-23 06:12:30 +01:00
Use minetest.after instead of globalstep
This commit is contained in:
parent
31e8c9b0cc
commit
04c441768f
17
init.lua
17
init.lua
@ -1,5 +1,3 @@
|
|||||||
local timer = 0
|
|
||||||
|
|
||||||
if minetest.settings:get_bool("enable_item_pickup") ~= false then
|
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_gain = tonumber(minetest.settings:get("item_pickup_gain")) or 0.4
|
||||||
local pickup_radius = tonumber(minetest.settings:get("item_pickup_radius")) or 0.75
|
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
|
end
|
||||||
local damage_enabled = minetest.settings:get_bool("enable_damage")
|
local damage_enabled = minetest.settings:get_bool("enable_damage")
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
local function pickupfunc()
|
||||||
|
|
||||||
timer = timer + dtime
|
|
||||||
if timer < 0.2 then return end
|
|
||||||
timer = 0
|
|
||||||
|
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
for _,player in ipairs(minetest.get_connected_players()) do
|
||||||
local keys_pressed = not key_triggered
|
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
|
end
|
||||||
end)
|
end
|
||||||
|
|
||||||
|
local function pickup_step()
|
||||||
|
pickupfunc()
|
||||||
|
minetest.after(0.2, pickup_step)
|
||||||
|
end
|
||||||
|
minetest.after(3.0, pickup_step)
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.settings:get_bool("enable_item_drop") ~= false then
|
if minetest.settings:get_bool("enable_item_drop") ~= false then
|
||||||
|
Loading…
Reference in New Issue
Block a user