Bump MT minimum version to 5.9 and clean up code

This commit is contained in:
marco_a 2024-10-05 21:22:27 +02:00
parent d86d85429b
commit fe63dd9d18
4 changed files with 17 additions and 30 deletions

View File

@ -2,4 +2,4 @@ name = arena_lib
description = Library to easily create mini-games
depends = audio_lib, lib_chatcmdbuilder, signs_lib
optional_depends = parties
min_minetest_version = 5.8
min_minetest_version = 5.9

View File

@ -47,19 +47,15 @@ local function load_world_folder()
for _, f_name in pairs(minetest.get_dir_list(dir, false)) do
-- NOT REALLY DYNAMIC MEDIA, since it's run when the server launches and there are no players online
-- it's just to load these tracks from the world folder (so that `sound_play` recognises them without the full path)
minetest.dynamic_add_media({filepath = dir .. "/" .. f_name}, function(name) end)
minetest.dynamic_add_media({filepath = dir .. "/" .. f_name})
end
for _, subdir in pairs(minetest.get_dir_list(dir, true)) do
iterate_dirs(dir .. "/" .. subdir)
end
end
-- TEMP MT 5.9: per ora non si possono aggiungere contenuti dinamici all'avvio
-- del server. Poi rimuovi anche 2° param da dynamic_add_media qui in alto
minetest.after(0.1, function()
iterate_dirs(wrld_dir .. "/BGM")
iterate_dirs(wrld_dir .. "/Thumbnails")
end)
iterate_dirs(wrld_dir .. "/BGM")
iterate_dirs(wrld_dir .. "/Thumbnails")
end
end

View File

@ -470,23 +470,19 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
player:set_clouds()
fill_tempsky(p_name, arena)
-- TEMP MT 5.9: close e after da rimuovere grazie a https://github.com/minetest/minetest/pull/14010
minetest.close_formspec(p_name, "arena_lib:celestial_vault")
-- riapro il formspec sul quale mi trovavo
minetest.after(0.1, function()
if fields.day_sky then
minetest.show_formspec(p_name, "arena_lib:celestial_vault", get_celvault_formspec(p_name, "sky"))
elseif fields.sun_size then
minetest.show_formspec(p_name, "arena_lib:celestial_vault", get_celvault_formspec(p_name, "sun"))
elseif fields.moon_size then
minetest.show_formspec(p_name, "arena_lib:celestial_vault", get_celvault_formspec(p_name, "moon"))
elseif fields.stars_count then
minetest.show_formspec(p_name, "arena_lib:celestial_vault", get_celvault_formspec(p_name, "stars"))
else
minetest.show_formspec(p_name, "arena_lib:celestial_vault", get_celvault_formspec(p_name, "clouds"))
end
end)
if fields.day_sky then
minetest.show_formspec(p_name, "arena_lib:celestial_vault", get_celvault_formspec(p_name, "sky"))
elseif fields.sun_size then
minetest.show_formspec(p_name, "arena_lib:celestial_vault", get_celvault_formspec(p_name, "sun"))
elseif fields.moon_size then
minetest.show_formspec(p_name, "arena_lib:celestial_vault", get_celvault_formspec(p_name, "moon"))
elseif fields.stars_count then
minetest.show_formspec(p_name, "arena_lib:celestial_vault", get_celvault_formspec(p_name, "stars"))
else
minetest.show_formspec(p_name, "arena_lib:celestial_vault", get_celvault_formspec(p_name, "clouds"))
end
return
end

View File

@ -183,13 +183,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
minetest.delete_particlespawner(temp_particles[p_name].ID or -1)
temp_particles[p_name] = {}
-- TEMP MT 5.9: close e after da rimuovere grazie a https://github.com/minetest/minetest/pull/14010
minetest.close_formspec(p_name, "arena_lib:weather")
-- riapro il formspec sul quale mi trovavo
minetest.after(0.1, function()
minetest.show_formspec(p_name, "arena_lib:weather", get_weather_formspec(p_name, curr_section[p_name]))
end)
minetest.show_formspec(p_name, "arena_lib:weather", get_weather_formspec(p_name, curr_section[p_name]))
return
end