use after(0) rather than mods_loaded

This commit is contained in:
Olive 2024-10-22 18:01:43 +01:00
parent de6b7c681d
commit f248d4e05f
1 changed files with 3 additions and 7 deletions

View File

@ -9,8 +9,7 @@ wizards_api.wizards = {}
local runtime = false -- must only be used at run-time due to silly call-back requirement for add_media
function wizards_api.load_wizards(path) function wizards_api.load_wizards(path)
local files = core.get_dir_list(path, false) local files = core.get_dir_list(path, false)
local dirs = core.get_dir_list(path, true) local dirs = core.get_dir_list(path, true)
@ -29,7 +28,7 @@ function wizards_api.load_wizards(path)
filename = "wizards_api_"..conf.name..part..".png", filename = "wizards_api_"..conf.name..part..".png",
filepath = path.."/"..conf.name..part..".png", filepath = path.."/"..conf.name..part..".png",
ephemeral = false, ephemeral = false,
}, (runtime and function(name) end or nil)) }, function() end)
end end
wizards_api.wizards[conf.name] = conf wizards_api.wizards[conf.name] = conf
@ -179,11 +178,8 @@ function wizards_api.set_wizard(playername, wizname)
inv:set_stack("hand", 1, hand) inv:set_stack("hand", 1, hand)
end end
core.after(0, function()
core.register_on_mods_loaded(function()
wizards_api.load_wizards(wizpath) wizards_api.load_wizards(wizpath)
runtime = true
end) end)
core.register_on_joinplayer(function(player) core.register_on_joinplayer(function(player)