|
|
|
@ -49,7 +49,7 @@ function fill_tempsky(p_name, arena)
|
|
|
|
|
temp_sky_settings[p_name] = not arena.celestial_vault and {} or table.copy(arena.celestial_vault)
|
|
|
|
|
|
|
|
|
|
if not temp_sky_settings[p_name].sky then
|
|
|
|
|
temp_sky_settings[p_name].sky = {sky_color = {}, textures = {}}
|
|
|
|
|
temp_sky_settings[p_name].sky = {fog = {}, sky_color = {}, textures = {}}
|
|
|
|
|
end
|
|
|
|
|
if not temp_sky_settings[p_name].sun then
|
|
|
|
|
temp_sky_settings[p_name].sun = {}
|
|
|
|
@ -83,10 +83,10 @@ function get_celvault_formspec(p_name, section)
|
|
|
|
|
"tooltip[stars_btn;" .. S("Stars") .. "]",
|
|
|
|
|
"tooltip[clouds_btn;" .. S("Clouds") .. "]",
|
|
|
|
|
"image_button[0,0;1,1;arenalib_sky_sky.png" .. (section == "sky" and "^[multiply:#777777" or "") .. ";sky_btn;]",
|
|
|
|
|
"image_button[1.6,0;1,1;arenalib_sky_sun.png" .. (section == "sun" and "^[multiply:#777777" or "") .. ";sun_btn;]",
|
|
|
|
|
"image_button[3.2,0;1,1;arenalib_sky_moon.png" .. (section == "moon" and "^[multiply:#777777" or "") .. ";moon_btn;]",
|
|
|
|
|
"image_button[4.8,0;1,1;arenalib_sky_stars.png" .. (section == "stars" and "^[multiply:#777777" or "") .. ";stars_btn;]",
|
|
|
|
|
"image_button[6.4,0;1,1;arenalib_sky_cloud.png" .. (section == "clouds" and "^[multiply:#777777" or "") .. ";clouds_btn;]",
|
|
|
|
|
"image_button[1.68,0;1,1;arenalib_sky_sun.png" .. (section == "sun" and "^[multiply:#777777" or "") .. ";sun_btn;]",
|
|
|
|
|
"image_button[3.36,0;1,1;arenalib_sky_moon.png" .. (section == "moon" and "^[multiply:#777777" or "") .. ";moon_btn;]",
|
|
|
|
|
"image_button[5.04,0;1,1;arenalib_sky_stars.png" .. (section == "stars" and "^[multiply:#777777" or "") .. ";stars_btn;]",
|
|
|
|
|
"image_button[6.72,0;1,1;arenalib_sky_cloud.png" .. (section == "clouds" and "^[multiply:#777777" or "") .. ";clouds_btn;]",
|
|
|
|
|
"container_end[]",
|
|
|
|
|
"container[1,2.2]",
|
|
|
|
|
-- <dove saranno i vari campi a seconda del tipo>
|
|
|
|
@ -133,6 +133,7 @@ function get_sky_params(p_name)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local temp_sky_col = temp_sky.sky_color
|
|
|
|
|
local temp_sky_fog = temp_sky.fog
|
|
|
|
|
local sky_params = {}
|
|
|
|
|
local sky = {
|
|
|
|
|
"label[0,0.25;" .. S("Type") .. "]",
|
|
|
|
@ -159,27 +160,27 @@ function get_sky_params(p_name)
|
|
|
|
|
"label[0,2.1;" .. S("Indoors") .. "]",
|
|
|
|
|
"dropdown[0,2.3;2.5,0.6;indoors;" .. palette_str .. ";" .. (palette_id[colstr(temp_sky_col.indoors)] or 1) .. "]",
|
|
|
|
|
"container_end[]",
|
|
|
|
|
"checkbox[0,5.5;custom_fog_tint;" .. S("Custom fog tint") .. ";" .. (temp_sky_col.fog_tint_type == "custom" and "true" or "false") .. "]"
|
|
|
|
|
"checkbox[0,4.9;custom_fog_tint;" .. S("Custom fog tint") .. ";" .. (temp_sky_col.fog_tint_type == "custom" and "true" or "false") .. "]",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if temp_sky_col.fog_tint_type == "custom" then
|
|
|
|
|
local fog_params = {
|
|
|
|
|
local fog_tint_params = {
|
|
|
|
|
"label[2.6,2.1;" .. S("Fog sun tint") .. "]",
|
|
|
|
|
"dropdown[2.6,2.3;2.5,0.6;fog_sun_tint;" .. palette_str .. ";" .. (palette_id[colstr(temp_sky_col.fog_sun_tint)] or 1) .. "]",
|
|
|
|
|
"label[5.2,2.1;" .. S("Fog moon tint") .. "]",
|
|
|
|
|
"dropdown[5.2,2.3;2.5,0.6;fog_moon_tint;" .. palette_str .. ";" .. (palette_id[colstr(temp_sky_col.fog_moon_tint)] or 1) .. "]"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for k, v in pairs(fog_params) do
|
|
|
|
|
table.insert(sky_params, #sky_params-3, v)
|
|
|
|
|
for k, v in pairs(fog_tint_params) do
|
|
|
|
|
table.insert(sky_params, #sky_params - 3, v)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
sky_params = {
|
|
|
|
|
"container[0,4.5]",
|
|
|
|
|
"label[2.2,0.25;" .. S("Base colour") .. "]",
|
|
|
|
|
"dropdown[2.2,0.5;3.75,0.6;base_color;" .. palette_str .. ";" .. (palette_id[temp_sky.base_color] or 1) .. "]",
|
|
|
|
|
"label[0,-0.1;" .. S("Base colour") .. "]",
|
|
|
|
|
"dropdown[0,0.14;3.75,0.6;base_color;" .. palette_str .. ";" .. (palette_id[temp_sky.base_color] or 1) .. "]",
|
|
|
|
|
"container_end[]"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -201,6 +202,24 @@ function get_sky_params(p_name)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local fog = "checkbox[5.2,4.9;enable_fog;" .. S("Fog") .. ";" .. (temp_sky_fog.fog_distance and "true" or "false") .. "]"
|
|
|
|
|
|
|
|
|
|
table.insert(sky_params, fog)
|
|
|
|
|
|
|
|
|
|
if temp_sky_fog.fog_distance then
|
|
|
|
|
local fog_params = {
|
|
|
|
|
"field[0,5.8;3.75,0.6;fog_distance;" .. S("Fog distance") .. ";" .. temp_sky_fog.fog_distance .. "]",
|
|
|
|
|
"label[3.85,5.62;" .. S("Fog start") .. "]",
|
|
|
|
|
"label[3.85,6.09;0]",
|
|
|
|
|
"label[7.6,6.09;1]",
|
|
|
|
|
"scrollbar[4.2,5.93;3.15,0.3;horizontal;fog_start;" .. (temp_sky_fog.fog_start or 0.5) * 100 .. "]",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for k, v in pairs(fog_params) do
|
|
|
|
|
table.insert(sky_params, v)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
for k, v in pairs(sky_params) do
|
|
|
|
|
table.insert(sky, #sky, v)
|
|
|
|
|
end
|
|
|
|
@ -406,6 +425,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|
|
|
|
local p_name = player:get_player_name()
|
|
|
|
|
local temp_sky = temp_sky_settings[p_name].sky
|
|
|
|
|
local temp_sky_col = temp_sky.sky_color
|
|
|
|
|
local temp_sky_fog = temp_sky.fog
|
|
|
|
|
local temp_sun = temp_sky_settings[p_name].sun
|
|
|
|
|
local temp_moon = temp_sky_settings[p_name].moon
|
|
|
|
|
local temp_stars = temp_sky_settings[p_name].stars
|
|
|
|
@ -533,6 +553,14 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|
|
|
|
temp_sky_col.fog_moon_tint = palette[fields.fog_moon_tint]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if fields.fog_distance then
|
|
|
|
|
temp_sky_fog.fog_distance = tonumber(fields.fog_distance)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if fields.fog_start then
|
|
|
|
|
temp_sky_fog.fog_start = minetest.explode_scrollbar_event(fields.fog_start).value / 100
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if fields.sky_type == "skybox" and fields.top then
|
|
|
|
|
temp_sky.textures[1] = fields.top
|
|
|
|
|
temp_sky.textures[2] = fields.bottom
|
|
|
|
@ -631,10 +659,16 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|
|
|
|
temp_sky_col.fog_tint_type = fields.custom_fog_tint == "true" and "custom" or "default"
|
|
|
|
|
minetest.show_formspec(p_name, "arena_lib:celestial_vault", get_celvault_formspec(p_name, "sky"))
|
|
|
|
|
|
|
|
|
|
elseif fields.sky_type then
|
|
|
|
|
temp_sky.type = fields.sky_type
|
|
|
|
|
elseif fields.enable_fog then
|
|
|
|
|
temp_sky_fog.fog_distance = fields.enable_fog == "true" and 50 or nil
|
|
|
|
|
minetest.show_formspec(p_name, "arena_lib:celestial_vault", get_celvault_formspec(p_name, "sky"))
|
|
|
|
|
|
|
|
|
|
elseif fields.sky_type then
|
|
|
|
|
if temp_sky.type ~= fields.sky_type then
|
|
|
|
|
temp_sky.type = fields.sky_type
|
|
|
|
|
minetest.show_formspec(p_name, "arena_lib:celestial_vault", get_celvault_formspec(p_name, "sky"))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
elseif fields.sun_visible then
|
|
|
|
|
temp_sun.visible = fields.sun_visible == "true" and true or false
|
|
|
|
|
minetest.show_formspec(p_name, "arena_lib:celestial_vault", get_celvault_formspec(p_name, "sun"))
|
|
|
|
@ -667,9 +701,26 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local reset_fog = false
|
|
|
|
|
|
|
|
|
|
-- faccio sparire in tempo reale l'eventuale nebbia rimasta allə giocatorə nell'editor,
|
|
|
|
|
-- in quanto MT richiede che sia -1 per rimuoverla (sennò allo spuntare la casella
|
|
|
|
|
-- per disattivarla, rimarrebbe la nebbia visibile)
|
|
|
|
|
if not temp_sky_fog.fog_distance then
|
|
|
|
|
temp_sky_fog.fog_distance = -1
|
|
|
|
|
temp_sky_fog.fog_start = -1
|
|
|
|
|
reset_fog = true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
player:set_sky(temp_sky)
|
|
|
|
|
player:set_sun(temp_sun)
|
|
|
|
|
player:set_moon(temp_moon)
|
|
|
|
|
player:set_stars(temp_stars)
|
|
|
|
|
player:set_clouds(temp_clouds)
|
|
|
|
|
|
|
|
|
|
-- e qui rimuovo quello che ho fatto su
|
|
|
|
|
if reset_fog then
|
|
|
|
|
temp_sky_fog.fog_distance = nil
|
|
|
|
|
temp_sky_fog.fog_start = nil
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|