Fix potentially dangerous minetest.after calls
This commit is contained in:
parent
3b6904d9ad
commit
8c851f07e4
@ -85,14 +85,14 @@ function achievements.trigger_achievement(player, aname, times)
|
||||
achievements.achievements[name][aname] = -1
|
||||
minetest.after(
|
||||
2.0,
|
||||
function()
|
||||
function(name, aname)
|
||||
minetest.chat_send_all(
|
||||
minetest.colorize(
|
||||
"#0f0",
|
||||
"*** " .. S("@1 has earned the achievement “@2”.",
|
||||
name,
|
||||
achievements.registered_achievements[aname].title)))
|
||||
end)
|
||||
end, name, aname)
|
||||
end
|
||||
|
||||
delayed_save()
|
||||
@ -173,7 +173,7 @@ end
|
||||
|
||||
-- Add callback functions
|
||||
|
||||
minetest.after(0, on_load)
|
||||
minetest.register_on_mods_loaded(on_load)
|
||||
|
||||
minetest.register_on_shutdown(on_shutdown)
|
||||
|
||||
|
@ -66,9 +66,11 @@ local function step(dtime)
|
||||
texture = "bubble.png"
|
||||
})
|
||||
|
||||
minetest.after(0.15, function()
|
||||
minetest.after(0.15, function(name)
|
||||
if particlespawners[name] then
|
||||
minetest.delete_particlespawner(particlespawners[name])
|
||||
end)
|
||||
end
|
||||
end, name)
|
||||
end
|
||||
|
||||
if minetest.get_item_group(minetest.get_node(player_pos).name, "water") > 0 then
|
||||
|
@ -219,9 +219,11 @@ local function on_item_eat(hpdata, replace_with_item, itemstack,
|
||||
texture = "magicpuff.png"
|
||||
})
|
||||
|
||||
minetest.after(0.15, function()
|
||||
minetest.after(0.15, function(name)
|
||||
if particlespawner[name] then
|
||||
minetest.delete_particlespawner(particlespawners[name])
|
||||
end)
|
||||
end
|
||||
end, name)
|
||||
|
||||
player_effects.apply_effect(player, "hunger_eating")
|
||||
|
||||
|
@ -138,7 +138,9 @@ function minetest.handle_node_drops(pos, drops, digger)
|
||||
-- FIXME this doesnt work for deactiveted objects
|
||||
if minetest.settings:get("remove_items") and tonumber(minetest.settings:get("remove_items")) then
|
||||
minetest.after(tonumber(minetest.settings:get("remove_items")), function(obj)
|
||||
if obj then
|
||||
obj:remove()
|
||||
end
|
||||
end, obj)
|
||||
end
|
||||
end
|
||||
|
@ -125,7 +125,7 @@ local function on_globalstep(dtime)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.after(0, on_load)
|
||||
minetest.register_on_mods_loaded(on_load)
|
||||
|
||||
minetest.register_on_shutdown(on_shutdown)
|
||||
|
||||
|
@ -231,7 +231,7 @@ local function on_load()
|
||||
end
|
||||
end
|
||||
|
||||
minetest.after(0, on_load)
|
||||
minetest.register_on_mods_loaded(on_load)
|
||||
|
||||
-- Nodes
|
||||
|
||||
|
@ -455,8 +455,4 @@ function village.spawn_village(pos, pr)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.after(
|
||||
0,
|
||||
function()
|
||||
village.load_villages()
|
||||
end)
|
||||
minetest.register_on_mods_loaded(village.load_villages)
|
||||
|
@ -98,9 +98,9 @@ minetest.register_lbm(
|
||||
|
||||
minetest.after(
|
||||
2.0,
|
||||
function()
|
||||
function(pos, pr)
|
||||
village.spawn_village(pos, pr)
|
||||
end)
|
||||
end, pos, pr)
|
||||
else
|
||||
minetest.log("action", "[village] Cannot spawn village, too near the static spawnpoint")
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user