Log a warning instead of erroring

master
Lars Mueller 2022-01-09 19:03:43 +01:00
parent 89ab22838e
commit 339ee40f9c
1 changed files with 16 additions and 10 deletions

View File

@ -11,15 +11,7 @@ function epidermis.dynamic_add_media(path, on_all_received, ephemeral)
end
assert(not existing_path)
assert(modlib.file.exists(path))
local to_receive = {}
for player in modlib.minetest.connected_players() do
local name = player:get_player_name()
if minetest.get_player_information(name).protocol_version < 39 then
minetest.kick_player(name, "Your Minetest client is outdated (< 5.3) and can't receive dynamic media. Rejoin to get the added media.")
else
to_receive[name] = true
end
end
local arg = path
if minetest.features.dynamic_add_media_table then
arg = {filepath = path}
@ -29,11 +21,25 @@ function epidermis.dynamic_add_media(path, on_all_received, ephemeral)
arg.ephemeral = false
end
end
local to_receive = {}
for player in modlib.minetest.connected_players() do
local name = player:get_player_name()
if minetest.get_player_information(name).protocol_version < 39 then
minetest.kick_player(name, "Your Minetest client is outdated (< 5.3) and can't receive dynamic media. Rejoin to get the added media.")
else
to_receive[name] = true
end
end
if not next(to_receive) then
minetest.dynamic_add_media(arg, error)
minetest.dynamic_add_media(arg, function(name)
minetest.log("warning", name .. " received media despite not being connected")
end)
on_all_received()
return
end
minetest.dynamic_add_media(arg, function(name)
if name == nil then
on_all_received()