Remove possibility to jump from an editor into another (debatably useful and probably bugged)

master
Zughy 2022-04-03 00:39:00 +02:00
parent d4b63dd616
commit eaab3e07b3
2 changed files with 20 additions and 37 deletions

View File

@ -60,16 +60,12 @@ function arena_lib.enter_editor(sender, mod, arena_name)
local id, arena = arena_lib.get_arena_by_name(mod, arena_name) local id, arena = arena_lib.get_arena_by_name(mod, arena_name)
-- (non uso ARENA_LIB_EDIT_PRECHECKS_PASSED perché sono più le eccezioni che altro) -- se il giocatore sta già modificando un'arena
-- se l'arena non esiste, annullo if arena_lib.is_player_in_edit_mode(sender) then
if arena == nil then minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] You must leave the editor first!")))
minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] This arena doesn't exist!")))
return end return end
-- se c'è già qualcuno (sender incluso), annullo if not ARENA_LIB_EDIT_PRECHECKS_PASSED(sender, arena, true) then return end
if arena_lib.is_arena_in_edit_mode(arena.name) then
minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] There must be no one inside the editor of the arena to perform this command! (now inside: @1)", arenas_in_edit_mode[arena_name])))
return end
-- se l'arena è abilitata, provo a disabilitiarla -- se l'arena è abilitata, provo a disabilitiarla
if arena.enabled then if arena.enabled then
@ -77,36 +73,23 @@ function arena_lib.enter_editor(sender, mod, arena_name)
end end
local player = minetest.get_player_by_name(sender) local player = minetest.get_player_by_name(sender)
local p_cvault = {}
-- se era già in un altro editor, lo rimuovo dal vecchio -- salvo le info
if players_in_edit_mode[sender] then p_cvault.sky = arena_lib.temp.get_sky(player)
arena_lib.remove_waypoints(sender) p_cvault.sun = player:get_sun()
p_cvault.moon = player:get_moon()
p_cvault.stars = player:get_stars()
p_cvault.clouds = player:get_clouds()
for a_name, pl_name in pairs(arenas_in_edit_mode) do players_in_edit_mode[sender] = {
if pl_name == sender then inv = player:get_inventory():get_list("main"),
arenas_in_edit_mode[a_name] = nil pos = player:get_pos(),
end celvault = p_cvault,
end lighting = {light = player:get_day_night_ratio()},
-- sennò salvo le info hotbar_slots = player:hud_get_hotbar_itemcount(),
else hotbar_bg = player:hud_get_hotbar_image()
}
local p_cvault = {}
p_cvault.sky = arena_lib.temp.get_sky(player)
p_cvault.sun = player:get_sun()
p_cvault.moon = player:get_moon()
p_cvault.stars = player:get_stars()
p_cvault.clouds = player:get_clouds()
players_in_edit_mode[sender] = {
inv = player:get_inventory():get_list("main"),
pos = player:get_pos(),
celvault = p_cvault,
lighting = {light = player:get_day_night_ratio()},
hotbar_slots = player:hud_get_hotbar_itemcount(),
hotbar_bg = player:hud_get_hotbar_image()
}
end
-- metto l'arena in modalità edit, associandoci il giocatore -- metto l'arena in modalità edit, associandoci il giocatore
arenas_in_edit_mode[arena_name] = sender arenas_in_edit_mode[arena_name] = sender

View File

@ -45,7 +45,7 @@ end
---------------------------------------------- ----------------------------------------------
arena_lib.temp = {} arena_lib.temp = {}
-- proper get_sky() => https://github.com/minetest/minetest/issues/11890 -- to remove in MT 5.6
function arena_lib.temp.get_sky(player) function arena_lib.temp.get_sky(player)
local get_sky = {player:get_sky()} local get_sky = {player:get_sky()}
local p_sky = {} local p_sky = {}