Custom sky per arena

master
Zughy 2022-01-07 22:14:41 +00:00
parent a8af85a18b
commit 4f7c905a8a
44 changed files with 929 additions and 141 deletions

18
DOCS.md
View File

@ -33,6 +33,7 @@
* [2.2.2.5 Spawners](#2225-spawners)
* [2.2.2.6 Signs](#2226-signs)
* [2.2.2.7 Music](#2227-music)
* [2.2.2.8 Celestial vault](#2228-celestial-vault)
* [2.2.3 Enabling an arena](#223-enabling-an-arena)
* [2.3 Arena phases](#23-arena-phases)
* [2.4 Spectate mode](#24-spectate-mode)
@ -336,7 +337,7 @@ The function calling the editor is
`arena_lib.enter_editor(sender, mod, arena_name)`
#### 2.2.2 CLI
If you don't want to rely on the hotbar, or you want both the editor and the commands via chat, here's how the commands work. Note that there actually is another parameter at the end of each of these functions named `in_editor` but, since it's solely used by the editor itself in order to run less checks, I chose to odmit it (it's in `set_spawner` too).
If you don't want to rely on the hotbar, or you want both the editor and the commands via chat, here's how the commands work. Note that there actually is another parameter at the end of each of these functions named `in_editor` but, since it's solely used by the editor itself in order to run less checks, I chose to omit it (it's in `set_spawner` too).
##### 2.2.2.1 Players management
`arena_lib.change_players_amount(sender, mod, arena_name, min_players, max_players)` changes the amount of players in a specific arena. It also works by specifying only one field (such as `([...] myarena, 3)` or `([...] myarena, nil, 6)`). It returns true if it succeeded.
@ -393,6 +394,21 @@ ChatCmdBuilder.new("NAMEOFYOURCOMMAND", function(cmd)
##### 2.2.2.7 Music
`arena_lib.set_bgm(sender, mod, arena_name, track, title, author, volume, pitch)` sets the background music of the arena. The audio file (`track`) must be inside the `sounds` folder of the minigame mod (NOT arena_lib's), and `.ogg` shall be omitted from the string. If `track` is nil, `arena.bgm` will be set to `nil` too
##### 2.2.2.8 Celestial vault
By default, arenas celestial vault reflects the celestial vault of the player before entering the match (meaning there are no default values inside arena_lib).
`arena_lib.set_celestial_vault(sender, mod, arena_name, element, params)` allows you to change parts of the vault, forcing it to players entering the arena. `element` is a string representing the part of the vault to be changed (`"sky"`, `"sun"`, `"moon"`, `"stars"`, `"clouds"`, or the explained later `"all"`), and `params` a table with the new values. This table is the same as the one used in the Minetest API `set_sky(...)`, `set_sun(...)` etc. functions, so for instance doing
```lua
local sun_params = {
scale = 2.5,
sunrise_visible = false
}
arena_lib.set_celestial_vault(sender, mod, arena, "sun", sun_params)
```
will increase the size of the sun inside the arena and hide the sunrise texture. `params` can also be `nil`, and in that case will remove any custom setting previously set.
Last but not least, the special element `"all"` allows you to change everything, and it needs a table with the following optional parameters: `{sky={...}, sun={...}, moon={...}, stars={...}, clouds={...}}`. If `params` is nil, it'll reset the whole celestial vault.
#### 2.2.3 Enabling an arena
When a sign has been set, it won't work. This because an arena must be enabled manually via
`arena_lib.enable_arena(sender, mod, arena_name)` or by using the Enable and Leave button in the editor.

View File

@ -20,3 +20,45 @@ arena_lib.SERVER_PHYSICS = {
-- "mod_db" = store in the arena_lib mod database
-- "external_db" = store in an external database -TODO: NOT YET IMPLEMENTED
arena_lib.STORE_INVENTORY_MODE = "mod_db"
-- instead of letting modders put whatever colour they want in the sky settings,
-- arena_lib offers a curated palette to pick from. The palette is Zughy 32 (yes,
-- that's me) => https://lospec.com/palette-list/zughy-32. I invite you *not* to
-- edit it manually; instead, if you want to change it, pick your favourite from
-- Lospec: https://lospec.com/palette-list, edit the list and it'll be
-- automatically updated in game. Do not remove "_default" and keep all letters
-- uppercase
arena_lib.PALETTE = {
_default = "",
skin_cocoa = "#5E3643",
skin_toffee = "#7A444A",
skin_bronze = "#A05B5E",
skin_almond = "#BF7958",
skin_beige = "#EEA160",
skin_vanilla = "#F4CCA1",
green_light = "#B6D53C",
green = "#71AA34",
green_dark = "#397B44",
green_deep = "#3C5956",
black = "#302C2E",
grey_dark = "#5A5353",
grey = "#7D7071",
grey_light = "#A0938E",
grey_fog = "#CFC6B8",
white = "#DFF6F5",
celeste = "#8AEBF1",
blue_sky = "#28CCDF",
azure = "#3978A8",
blue = "#394778",
blue_dark = "#39314B",
purple_dark = "#564064",
purple = "#8E478C",
magenta = "#CD6093",
pink = "#FFAEB6",
yellow = "#F4B41B",
orange = "#F47E1B",
red = "#E6482E",
red_dark = "#A93B3B",
purple_mauve = "#827094",
blue_spruce = "#4F546B"
}

View File

@ -22,6 +22,7 @@ dofile(srcpath .. "/editor/tools_bgm.lua")
dofile(srcpath .. "/editor/tools_players.lua")
dofile(srcpath .. "/editor/tools_settings.lua")
dofile(srcpath .. "/editor/tools_sign.lua")
dofile(srcpath .. "/editor/tools_sky.lua")
dofile(srcpath .. "/editor/tools_spawner.lua")
dofile(srcpath .. "/hud/hud_main.lua")
dofile(srcpath .. "/hud/hud_waypoints.lua")

0
locale/arena_lib.es.tr Normal file → Executable file
View File

View File

@ -1,4 +1,4 @@
# version 5.0.0
# version 5.1.0-dev
# author(s): Zughy
# reviewer(s):
# textdomain: arena_lib
@ -38,6 +38,13 @@ Sign of arena @1 successfully removed=Cartello dell'arena @1 rimosso con success
[!] There is already a sign for this arena!=[!] Esiste già un cartello per quest'arena!
[!] There is no sign to remove assigned to @1!=[!] Non c'è nessun cartello da rimuovere assegnato a @1!
Sign of arena @1 successfully set=Cartello dell'arena @1 impostato con successo
All=Tutto
Sky=Cielo
Sun=Sole
Moon=Luna
Stars=Stelle
Clouds=Nuvole
(@1) Celestial vault of arena @2 successfully overwritten=(@1) Volta celeste dell'arena @2 sovrascritta con successo
Background music of arena @1 successfully overwritten=Musica di sottofondo dell'arena @1 sovrascritta con successo
[!] Timers are not enabled in this mod!=[!] I timer non sono abilitati in questa mod!
Arena @1's timer is now @2 seconds=Il timer dell'arena @1 è ora @2 secondi
@ -201,6 +208,43 @@ Are you sure you want to delete arena @1?=Sei sicuro/a di voler eliminare l'aren
Cancel=Annulla
Yes=Sì
# editor/tools_sky.lua
Reset=Ripristina
Type=Tipo
Day sky=Cielo diurno
Dawn sky=Cielo alba
Night sky=Cielo notturno
Day horizon=Orizz. diurno
Dawn horizon=Orizz. alba
Night horizon=Orizz. notturno
Indoors=Al chiuso
Custom fog tint=Personalizza tinta nebbia
Fog sun tint=Tinta nebbia sole
Fog moon tint=Tinta nebbia luna
Base colour=Colore base
Top=Sopra
Bottom=Sotto
West=Ovest
East=Est
North=Nord
South=Sud
Visible sun=Sole visibile
Visible sunrise=Alba visibile
Texture=Texture
Tonemap=Mappa tonale
Size=Dimensione
Sunrise texture=Texture alba
Visible moon=Luna visibile
Visible stars=Stelle visibili
Colour=Colore
Count=Quantità
Clouds must be enabled first to change their parameters=Vanno prima abilitate le nuvole per poterne cambiare i parametri
Density=Densità
Ambient=Ambiente
Thickness=Spessore
Height=Altezza
Speed=Velocità
# editor/tools_spawner.lua
Add spawner=Aggiungi spawner
Remove spawner=Rimuovi spawner

View File

@ -1,4 +1,4 @@
# version 5.0.0
# version 5.1.0-dev
# author(s):
# reviewer(s):
# textdomain: arena_lib
@ -38,6 +38,13 @@ Sign of arena @1 successfully removed=
[!] There is already a sign for this arena!=
[!] There is no sign to remove assigned to @1!=
Sign of arena @1 successfully set=
All=
Sky=
Sun=
Moon=
Stars=
Clouds=
(@1) Celestial vault of arena @2 successfully overwritten=
Background music of arena @1 successfully overwritten=
[!] Timers are not enabled in this mod!=
Arena @1's timer is now @2 seconds=
@ -201,6 +208,43 @@ Are you sure you want to delete arena @1?=
Cancel=
Yes=
# editor/tools_sky.lua
Reset=
Type=
Day sky=
Dawn sky=
Night sky=
Day horizon=
Dawn horizon=
Night horizon=
Indoors=
Custom fog tint=
Fog sun tint=
Fog moon tint=
Base colour=
Top=
Bottom=
West=
East=
North=
South=
Visible sun=
Visible sunrise=
Texture=
Tonemap=
Size=
Sunrise texture=
Visible moon=
Visible stars=
Colour=
Count=
Clouds must be enabled first to change their parameters=
Density=
Ambient=
Thickness=
Height=
Speed=
# editor/tools_spawner.lua
Add spawner=
Remove spawner=

View File

@ -33,9 +33,10 @@ local arena_default = {
players_amount_per_team = nil,
spectators_amount = 0,
spectators_amount_per_team = nil,
spawn_points = {}, -- KEY: ids, VALUE: {pos, teamID}
spawn_points = {}, -- KEY: ids, VALUE: {pos, teamID}
max_players = 4,
min_players = 2,
celestial_vault = {}, -- sky = {...}, sun = {...}, moon = {...}, stars = {...}, clouds = {...}
bgm = nil,
initial_time = nil,
current_time = nil,
@ -621,7 +622,7 @@ function arena_lib.set_spawner(sender, mod, arena_name, teamID_or_name, param, I
-- se overwrite, sovrascrivo
if param == "overwrite" then
-- è inutile specificare un team. Avviso per non confondere
-- è inutile specificare una squadra. Avviso per non confondere
if team then
minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] No team must be specified for this function!")))
return end
@ -838,6 +839,41 @@ end
function arena_lib.set_celestial_vault(sender, mod, arena_name, element, params, in_editor)
local id, arena = arena_lib.get_arena_by_name(mod, arena_name)
if not in_editor then
if not ARENA_LIB_EDIT_PRECHECKS_PASSED(sender, arena) then return end
end
if params ~= nil and type(params) ~= "table" then
minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] Parameters don't seem right!")))
return end
-- sovrascrivi tutti
if element == "all" then
arena.celestial_vault = params or {} -- se passano 'nil', evito che cancellino la proprietà
-- sovrascrivine uno specifico
elseif element == "sky" or element == "sun" or element == "moon" or element == "stars" or element == "clouds" then
arena.celestial_vault[element] = params
-- oppure type non è un parametro contemplato
else
minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] Parameters don't seem right!")))
return
end
element = element:gsub("^%l", string.upper) -- per non tradurre sia Sky che sky
update_storage(false, mod, id, arena)
minetest.chat_send_player(sender, arena_lib.mods[mod].prefix .. S("(@1) Celestial vault of arena @2 successfully overwritten", S(element), arena.name))
end
function arena_lib.set_bgm(sender, mod, arena_name, track, title, author, volume, pitch, in_editor)
local id, arena = arena_lib.get_arena_by_name(mod, arena_name)
@ -1102,6 +1138,11 @@ function init_storage(mod, mod_ref)
arena.past_present_players_inside = {}
to_update = true
end
if not arena.celestial_vault then
arena.celestial_vault = {}
to_update = true
end
--^------------------ LEGACY UPDATE, to remove in 7.0 -------------------^
-- gestione squadre

51
src/api/in_game.lua Normal file → Executable file
View File

@ -664,6 +664,36 @@ function operations_before_entering_arena(mod_ref, mod, arena, arena_ID, p_name)
local player = minetest.get_player_by_name(p_name)
-- cambio eventuale volta celeste
if next(arena.celestial_vault) then
local celvault = arena.celestial_vault
if celvault.sky then
players_temp_storage[p_name].celvault_sky = arena_lib.temp.get_sky(player)
player:set_sky(celvault.sky)
end
if celvault.sun then
players_temp_storage[p_name].celvault_sun = player:get_sun()
player:set_sun(celvault.sun)
end
if celvault.moon then
players_temp_storage[p_name].celvault_moon = player:get_moon()
player:set_moon(celvault.moon)
end
if celvault.stars then
players_temp_storage[p_name].celvault_stars = player:get_stars()
player:set_stars(celvault.stars)
end
if celvault.clouds then
players_temp_storage[p_name].celvault_clouds = player:get_clouds()
player:set_clouds(celvault.clouds)
end
end
-- nascondo i nomi se l'opzione è abilitata
if not mod_ref.show_nametags then
player:set_nametag_attributes({color = {a = 0, r = 255, g = 255, b = 255}})
@ -768,6 +798,27 @@ function operations_before_leaving_arena(mod_ref, arena, p_name, reason)
local player = minetest.get_player_by_name(p_name)
-- reimposto eventuale volta celeste
if next(arena.celestial_vault) then
local celvault = arena.celestial_vault
if celvault.sky then
player:set_sky(players_temp_storage[p_name].celvault_sky)
end
if celvault.sun then
player:set_sun(players_temp_storage[p_name].celvault_sun)
end
if celvault.moon then
player:set_moon(players_temp_storage[p_name].celvault_moon)
end
if celvault.stars then
player:set_stars(players_temp_storage[p_name].celvault_stars)
end
if celvault.clouds then
player:set_clouds(players_temp_storage[p_name].celvault_clouds)
end
end
-- svuoto eventualmente l'inventario e ripristino gli oggetti
if not mod_ref.keep_inventory then
player:get_inventory():set_list("main", {})

0
src/api/misc.lua Normal file → Executable file
View File

0
src/api/teams.lua Normal file → Executable file
View File

View File

@ -214,6 +214,7 @@ function arena_lib.print_arena_info(sender, mod, arena_name)
minetest.colorize("#eea160", S("Sign: ")) .. minetest.colorize("#cfc6b8", sign_pos) .. "\n" ..
minetest.colorize("#eea160", S("Spawn points: ")) .. minetest.colorize("#cfc6b8", #arena.spawn_points .. " ( " .. spawners_pos .. ")") .. "\n" ..
time ..
minetest.colorize("#eea160", S("Custom sky: ")) .. minetest.colorize("#cfc6b8", minetest.serialize(arena.celestial_vault)) .. "\n" ..
minetest.colorize("#eea160", S("Properties: ")) .. minetest.colorize("#cfc6b8", properties) .. "\n" ..
minetest.colorize("#eea160", S("Temp properties: ")) .. minetest.colorize("#cfc6b8", temp_properties) .. "\n" ..
minetest.colorize("#eea160", S("Team properties: ")) .. minetest.colorize("#cfc6b8", team_properties)

View File

@ -6,6 +6,7 @@ local editor_tools = {
"arena_lib:editor_players",
"arena_lib:editor_spawners",
"arena_lib:editor_signs",
"arena_lib:editor_sky",
"arena_lib:editor_bgm",
"arena_lib:editor_settings",
"",
@ -89,9 +90,19 @@ function arena_lib.enter_editor(sender, mod, arena_name)
end
-- sennò salvo le info
else
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,
hotbar_slots = player:hud_get_hotbar_itemcount(),
hotbar_bg = player:hud_get_hotbar_image()
}
@ -104,8 +115,18 @@ function arena_lib.enter_editor(sender, mod, arena_name)
player:get_meta():set_string("arena_lib_editor.mod", mod)
player:get_meta():set_string("arena_lib_editor.arena", arena_name)
player:hud_set_hotbar_itemcount(9)
player:hud_set_hotbar_image("arenalib_gui_hotbar9.png")
player:hud_set_hotbar_itemcount(10)
player:hud_set_hotbar_image("arenalib_gui_hotbar10.png")
-- imposto volta celeste, controllando ogni elemento onde evitare un ripristino causa passaggio zero argomenti
if next(arena.celestial_vault) then
local celvault = arena.celestial_vault
if celvault.sky then player:set_sky(celvault.sky) end
if celvault.sun then player:set_sun(celvault.sun) end
if celvault.moon then player:set_moon(celvault.moon) end
if celvault.stars then player:set_stars(celvault.stars) end
if celvault.clouds then player:set_clouds(celvault.clouds) end
end
-- se c'è almeno uno spawner, teletrasporto
if next(arena.spawn_points) then
@ -124,13 +145,16 @@ end
function arena_lib.quit_editor(player)
local mod = player:get_meta():get_string("arena_lib_editor.mod")
local arena_name = player:get_meta():get_string("arena_lib_editor.arena")
local id, arena = arena_lib.get_arena_by_name(mod, arena_name)
if arena_name == "" then return end
local p_name = player:get_player_name()
local inv = players_in_edit_mode[p_name].inv
local pos = players_in_edit_mode[p_name].pos
local celvault = table.copy(players_in_edit_mode[p_name].celvault)
local hotbar_slots = players_in_edit_mode[p_name].hotbar_slots
local hotbar_bg = players_in_edit_mode[p_name].hotbar_bg
@ -152,6 +176,15 @@ function arena_lib.quit_editor(player)
-- teletrasporto
player:set_pos(pos)
-- ripristino volta celeste
if next(arena.celestial_vault) then
player:set_sky(celvault.sky)
player:set_sun(celvault.sun)
player:set_moon(celvault.moon)
player:set_stars(celvault.stars)
player:set_clouds(celvault.clouds)
end
-- restituisco l'inventario
minetest.after(0, function()
if not minetest.get_player_by_name(p_name) then return end

1
src/editor/tools_bgm.lua Normal file → Executable file
View File

@ -13,6 +13,7 @@ local bgm_tools = {
"",
"",
"",
"",
"arena_lib:editor_return",
"arena_lib:editor_quit",
}

View File

@ -10,6 +10,7 @@ local players_tools = {
"", -- arena_lib:players_teams_on/off
"",
"",
"",
"arena_lib:editor_return",
"arena_lib:editor_quit",
}

View File

@ -12,6 +12,7 @@ local settings_tools = {
"", -- timer_off/_on
"",
"",
"",
"arena_lib:settings_delete",
"",
"arena_lib:editor_return",

View File

@ -7,6 +7,7 @@ local spawners_tools = {
"",
"",
"",
"",
"arena_lib:editor_return",
"arena_lib:editor_quit",
}
@ -40,6 +41,8 @@ minetest.register_tool("arena_lib:sign_add", {
})
minetest.register_tool("arena_lib:sign_remove", {
description = S("Remove sign"),

View File

@ -1,7 +1,15 @@
local S = minetest.get_translator("arena_lib")
local function get_sky_formspec() end
local function get_sun_formspec() end
local function fill_tempsky() end
local function get_celvault_formspec() end
local function get_sky_params() end
local function get_sun_params() end
local function get_moon_params() end
local function get_stars_params() end
local function get_clouds_params() end
local function colstr() end
local function get_palette_col_and_sorted_table() end
local function compare_elem() end
local temp_sky_settings = {} -- KEY = p_name; VALUE = {all the sky settings}
local sky_tools = {
@ -12,6 +20,7 @@ local sky_tools = {
"",
"",
"",
"",
"arena_lib:editor_return",
"arena_lib:editor_quit",
}
@ -33,43 +42,9 @@ minetest.register_tool("arena_lib:editor_sky", {
local id, arena = arena_lib.get_arena_by_name(mod, arena_name)
local p_name = user:get_player_name()
temp_sky_settings[p_name] = table.copy(arena.sky)
fill_tempsky(p_name, arena)
local temp_sky = temp_sky_settings[p_name]
if not temp_sky.sky_parameters then
temp_sky.sky_parameters = {}
if not temp_sky.sky_color then
temp_sky.sky_parameters.sky_color = {}
end
if not temp_sky.textures then
temp_sky.sky_parameters.textures = {}
end
end
if not temp_sky.sun_parameters then
temp_sky.sun_parameters = {}
end
if not temp_sky.moon_parameters then
temp_sky.moon_parameters = {}
end
if not temp_sky.stars_parameters then
temp_sky.stars_parameters = {}
end
if not temp_sky.clouds_parameters then
temp_sky.clouds_parameters = {}
if not temp_sky.clouds_parameters.speed then
temp_sky.clouds_parameters.speed = {}
end
end
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_sky_formspec(p_name))
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "sky"))
end
})
@ -85,110 +60,352 @@ end
---------------FUNZIONI LOCALI----------------
----------------------------------------------
function get_sky_formspec(p_name)
function fill_tempsky(p_name, arena)
temp_sky_settings[p_name] = table.copy(arena.celestial_vault)
local temp_sky = temp_sky_settings[p_name].sky_parameters
local fog_tint_ID = 1
local fog_tint_sun = ""
local fog_tint_moon = ""
local sky_type = 1
if next(temp_sky) then
if temp_sky.sky_color.fog_tint_type == "custom" then
fog_tint_ID = 2
fog_tint_sun = "field[2.6,2;2.5,0.6;fog_sun_tint;Fog sun tint;" .. (temp_sky.fog_sun_tint or "") .. "]"
fog_tint_moon = "field[5.2,2;2.5,0.6;fog_moon_tint;Fog moon tint;" .. (temp_sky.fog_moon_tint or "") .. "]"
end
if temp_sky.type == "skybox" then
sky_type = 2
elseif temp_sky.type == "plain" then
sky_type = 3
end
if not temp_sky_settings[p_name].sky then
temp_sky_settings[p_name].sky = {sky_color = {}, textures = {}}
end
if not temp_sky_settings[p_name].sun then
temp_sky_settings[p_name].sun = {}
end
if not temp_sky_settings[p_name].moon then
temp_sky_settings[p_name].moon = {}
end
if not temp_sky_settings[p_name].stars then
temp_sky_settings[p_name].stars = {}
end
if not temp_sky_settings[p_name].clouds then
temp_sky_settings[p_name].clouds = {speed = {}}
end
end
function get_celvault_formspec(p_name, section)
local formspec = {
"formspec_version[4]",
"size[9.9,13]",
"size[9.72,10]",
"position[0.5,0.5]",
"no_prepend[]",
"style_type[image_button;border=false]",
-- bottoni
"container[1,1]",
"image_button[0,0;1.5,1;arenalib_editor_sky.png;sky;]",
"image_button[1.6,0;1.5,1;arenalib_editor_sky.png;sky;]",
"image_button[3.2,0;1.5,1;arenalib_editor_sky.png;sky;]",
"image_button[4.8,0;1.5,1;arenalib_editor_sky.png;sky;]",
"image_button[6.4,0;1.5,1;arenalib_editor_sky.png;sky;]",
"tooltip[sky_btn;" .. S("Sky") .."]",
"tooltip[sun_btn;" .. S("Sun") .."]",
"tooltip[moon_btn;" .. S("Moon") .."]",
"tooltip[stars_btn;" .. S("Stars") .. "]",
"tooltip[clouds_btn;" .. S("Clouds") .. "]",
"image_button[0,0;1,1;arenalib_sky_sky.png;sky_btn;]",
"image_button[1.6,0;1,1;arenalib_sky_sun.png;sun_btn;]",
"image_button[3.2,0;1,1;arenalib_sky_moon.png;moon_btn;]",
"image_button[4.8,0;1,1;arenalib_sky_stars.png;stars_btn;]",
"image_button[6.4,0;1,1;arenalib_sky_cloud.png;clouds_btn;]",
"container_end[]",
"container[1,2.2]",
-- colore base e tipo di tinta della nebbia
"field[0,0.5;3.75,0.6;base_color;Base color;" .. (temp_sky.base_color or "") .. "]",
"label[4.2,0.33;Fog tint type]",
"dropdown[4.15,0.5;3.75,0.6;fog_tint_type;default,custom;".. fog_tint_ID .. ";]",
"container[0,1.8]",
-- colori vari
"field[0,0;2.5,0.6;day_sky;Day sky;" .. (temp_sky.day_sky or "" ) .. "]",
"field[2.6,0;2.5,0.6;day_horizon;Day horizon;" .. (temp_sky.day_horizon or "" ) .. "]",
"field[5.2,0;2.5,0.6;dawn_sky;Dawn sky;" .. (temp_sky.dawn_sky or "" ) .. "]",
"field[0,1;2.5,0.6;dawn_horizon;Dawn horizon;" .. (temp_sky.dawn_horizon or "" ) .. "]",
"field[2.6,1;2.5,0.6;night_sky;Night sky;" .. (temp_sky.night_sky or "" ) .. "]",
"field[5.2,1;2.5,0.6;night_horizon;Night horizon;" .. (temp_sky.night_horizon or "" ) .. "]",
"field[0,2;2.5,0.6;indoors;Indoors;" .. (temp_sky.indoors or "" ) .. "]",
fog_tint_sun,
fog_tint_moon,
"container_end[]",
-- nuvole e tipo di cielo
"checkbox[0,5.2;clouds;Clouds;" .. (temp_sky.clouds or "true") .. "]",
"label[4.15,4.83;Type]",
"dropdown[4.15,5;3.75,0.6;type;regular,skybox,plain;" .. sky_type .. ";]",
-- skybox, dettagli
-- (vedere if sotto)
"image_button[3.05,9.7;1.9,0.7;arenalib_editor_sky.png;apply;" .. S("Apply") .."]",
-- <dove saranno i vari campi a seconda del tipo>
"button[2,6.7;1.9,0.7;reset;" .. S("Reset") .."]",
"button[4,6.7;1.9,0.7;apply;" .. S("Apply") .."]",
"container_end[]",
}
-- eventuali parametri skybox
if next(temp_sky) then
if temp_sky.type == "skybox" then
local fields = {}
if section == "sky" then
fields = get_sky_params(p_name)
elseif section == "sun" then
fields = get_sun_params(p_name)
elseif section == "moon" then
fields = get_moon_params(p_name)
elseif section == "stars" then
fields = get_stars_params(p_name)
else
fields = get_clouds_params(p_name)
end
for k,v in pairs(fields) do
table.insert(formspec, #formspec-2, v)
end
return table.concat(formspec, "")
end
function get_sky_params(p_name)
local temp_sky = temp_sky_settings[p_name].sky
local clouds = true
local sky_type = 1
if temp_sky.clouds ~= nil and temp_sky.clouds == false then
clouds = false
end
if temp_sky.type == "skybox" then
sky_type = 2
elseif temp_sky.type == "plain" then
sky_type = 3
end
local temp_sky_col = temp_sky.sky_color
local palette_str, palette_id = get_palette_col_and_sorted_table() -- palette id KEY = hex value, VALUE = id
local sky_params = {}
local sky = {
"label[0,0.25;" .. S("Type") .. "]",
"dropdown[0,0.5;3.75,0.6;sky_type;regular,skybox,plain;" .. sky_type .. ";]",
"checkbox[4.2,0.78;sky_clouds;" .. S("Clouds") .. ";" .. tostring(clouds) .. "]"
}
if sky_type == 1 then
sky_params = {
"container[0,1.6]",
"label[0,0;" .. S("Day sky") .. "]",
"dropdown[0,0.2;2.5,0.6;day_sky;" .. palette_str .. ";" .. (palette_id[colstr(temp_sky_col.day_sky)] or 1) .. "]",
"label[2.6,0;" .. S("Dawn sky") .. "]",
"dropdown[2.6,0.2;2.5,0.6;dawn_sky;" .. palette_str .. ";" .. (palette_id[colstr(temp_sky_col.dawn_sky)] or 1) .. "]",
"label[5.2,0;" .. S("Night sky") .. "]",
"dropdown[5.2,0.2;2.5,0.6;night_sky;" .. palette_str .. ";" .. (palette_id[colstr(temp_sky_col.night_sky)] or 1) .. "]",
"label[0,1.05;" .. S("Day horizon") .. "]",
"dropdown[0,1.25;2.5,0.6;day_horizon;" .. palette_str .. ";" .. (palette_id[colstr(temp_sky_col.day_horizon)] or 1) .. "]",
"label[2.6,1.05;" .. S("Dawn horizon") .. "]",
"dropdown[2.6,1.25;2.5,0.6;dawn_horizon;" .. palette_str .. ";" .. (palette_id[colstr(temp_sky_col.dawn_horizon)] or 1) .. "]",
"label[5.2,1.05;" .. S("Night horizon") .. "]",
"dropdown[5.2,1.25;2.5,0.6;night_horizon;" .. palette_str .. ";" .. (palette_id[colstr(temp_sky_col.night_horizon)] or 1) .. "]",
"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") .. "]"
}
if temp_sky_col.fog_tint_type == "custom" then
local fog_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)
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) .. "]",
"container_end[]"
}
if sky_type == 2 then
local skybox = {
"container[0,6.5]",
"field[0,0;3.75,0.6;top;Top;" .. (temp_sky.textures[1] or "" ) .. "]",
"field[4.15,0;3.75,0.6;bottom;Bottom;" .. (temp_sky.textures[2] or "") .. "]",
"field[0,1;3.75,0.6;west;West;" .. (temp_sky.textures[3] or "") .. "]",
"field[4.15,1;3.75,0.6;east;East;" .. (temp_sky.textures[4] or "") .. "]",
"field[0,2;3.75,0.6;north;North;" .. (temp_sky.textures[5] or "") .. "]",
"field[4.15,2;3.75,0.6;south;South;" .. (temp_sky.textures[6] or "") .. "]",
"container[0,1.6]",
"field[0,0;3.75,0.6;top;" .. S("Top") .. ";" .. (temp_sky.textures[1] or "" ) .. "]",
"field[4.15,0;3.75,0.6;bottom;" .. S("Bottom") .. ";" .. (temp_sky.textures[2] or "") .. "]",
"field[0,1;3.75,0.6;west;" .. S("West") .. ";" .. (temp_sky.textures[3] or "") .. "]",
"field[4.15,1;3.75,0.6;east;" .. S("East") .. ";" .. (temp_sky.textures[4] or "") .. "]",
"field[0,2;3.75,0.6;north;" .. S("North") .. ";" .. (temp_sky.textures[5] or "") .. "]",
"field[4.15,2;3.75,0.6;south;" .. S("South") .. ";" .. (temp_sky.textures[6] or "") .. "]",
"container_end[]",
}
for k, v in pairs(skybox) do
table.insert(formspec, #formspec-1, v)
table.insert(sky_params, #sky_params-3, v)
end
end
end
return table.concat(formspec, "")
for k, v in pairs(sky_params) do
table.insert(sky, #sky, v)
end
return sky
end
function get_sun_formspec(p_name)
function get_sun_params(p_name)
local temp_sun = temp_sky_settings[p_name].sun_parameters
local temp_sun = temp_sky_settings[p_name].sun
local is_sun_visible = temp_sun.visible ~= false
local is_sunrise_visible = temp_sun.sunrise_visible ~= false
local formspec = {
"formspec_version[4]",
"size[9.9,13]",
"position[0.5,0.5]",
"no_prepend[]",
local sun = {
"checkbox[0,0.78;sun_visible;" .. S("Visible sun") .. ";" .. tostring(is_sun_visible) .. "]",
"checkbox[4,0.78;sunrise_visible;" .. S("Visible sunrise") .. ";" .. tostring(is_sunrise_visible) .. "]",
"container[0,1.6]",
"container_end[]"
}
return table.concat(formspec, "")
if is_sun_visible then
local sun_params = {
"field[0,0;3.75,0.6;sun_texture;" .. S("Texture") .. ";" .. (temp_sun.texture or "sun.png") .. "]",
"field[0,1;3.75,0.6;sun_tonemap;" .. S("Tonemap") .. ";" .. (temp_sun.tonemap or "sun_tonemap.png") .. "]",
"field[0,2;1,0.6;sun_size;" .. S("Size") .. ";" .. (temp_sun.scale or 1) .. "]"
}
for k, v in pairs(sun_params) do
table.insert(sun, #sun, v)
end
end
if is_sunrise_visible then
local sunrise_params = {
"field[4.15,0;3.75,0.6;sunrise_texture;" .. S("Sunrise texture") .. ";" .. (temp_sun.sunrise or "sunrisebg.png") .. "]",
}
for k, v in pairs(sunrise_params) do
table.insert(sun, #sun, v)
end
end
return sun
end
function get_moon_params(p_name)
local temp_moon = temp_sky_settings[p_name].moon
local is_moon_visible = temp_moon.visible ~= false
local moon = {
"checkbox[0,0.78;moon_visible;" .. S("Visible moon") .. ";" .. tostring(is_moon_visible) .. "]",
}
if is_moon_visible then
local moon_params = {
"container[0,1.6]",
"field[0,0;3.75,0.6;moon_texture;" .. S("Texture") ..";" .. (temp_moon.texture or "moon.png") .. "]",
"field[0,1;3.75,0.6;moon_tonemap;" .. S("Tonemap") .. ";" .. (temp_moon.tonemap or "moon_tonemap.png") .. "]",
"field[0,2;1,0.6;moon_size;" .. S("Size") .. ";" .. (temp_moon.scale or 1 ) .. "]",
"container_end[]"
}
for k, v in pairs(moon_params) do
table.insert(moon, #moon, v)
end
end
return moon
end
function get_stars_params(p_name)
local temp_stars = temp_sky_settings[p_name].stars
local are_stars_visible = temp_stars.visible ~= false
local stars = {
"checkbox[0,0.78;stars_visible;" .. S("Visible stars") .. ";" .. tostring(are_stars_visible) .. "]",
}
if are_stars_visible then
local palette_str, palette_id = get_palette_col_and_sorted_table()
local stars_params = {
"field[6.9,0.7;1,0.6;stars_size;" .. S("Size") .. ";" .. (temp_stars.scale or 1) .. "]",
"container[0,1.6]",
"label[0,-0.2;" .. S("Colour") .. "]",
"dropdown[0,0;3.75,0.6;stars_color;" .. palette_str .. ";" .. (palette_id[temp_stars.star_color] or 1) .. "]",
"field[4.15,0;3.75,0.6;stars_count;" .. S("Count") .. ";" .. (temp_stars.count or 1000) .. "]",
"container_end[]"
}
for k, v in pairs(stars_params) do
table.insert(stars, #stars, v)
end
end
return stars
end
function get_clouds_params(p_name)
local temp_clouds = temp_sky_settings[p_name].clouds
local are_clouds_visible = temp_sky_settings[p_name].sky.clouds ~= false
local clouds = {}
if not are_clouds_visible then
clouds = {
"hypertext[0,0.85;7,1;name; <global size=18 font=mono halign=center color=#e6482e><b>" .. S("Clouds must be enabled first to change their parameters") .. "</b>]",
}
else
local palette_str, palette_id = get_palette_col_and_sorted_table()
clouds = {
"container[0,0.5]",
"label[0,0;" .. S("Density") .. "]",
"label[0,0.5;0]",
"label[7.6,0.5;1]",
"scrollbaroptions[min=0;max=100;arrows=hide]",
"scrollbar[0.3,0.35;7.15,0.3;horizontal;clouds_density;" .. ((temp_clouds.density or 0.4) * 100) .. "]",
"label[0,1.2;" .. S("Colour") .. "]",
"dropdown[0,1.4;3.75,0.6;clouds_color;" .. palette_str .. ";" .. (palette_id[temp_clouds.color] or 1) .. "]",
"label[4.15,1.2;" .. S("Ambient") .. "]",
"dropdown[4.15,1.4;3.75,0.6;clouds_ambient;" .. palette_str .. ";" .. (palette_id[temp_clouds.ambient] or 1) .. "]",
"label[0,2.25;" .. S("Thickness") .. "]",
"field[0,2.45;1,0.6;clouds_thickness;;" .. (temp_clouds.thickness or 16) .. "]",
"label[1.7,2.25;" .. S("Height") .. "]",
"field[1.7,2.45;1,0.6;clouds_height;;" .. (temp_clouds.height or 120) .. "]",
"label[4.15,2.25;" .. S("Speed") .. "]",
"label[4.15,2.75;X]",
"field[4.45,2.45;1,0.6;clouds_speed_x;;" .. (temp_clouds.speed.x or 0) .. "]",
"label[5.8,2.75;Z]",
"field[6.1,2.45;1,0.6;clouds_speed_z;;" .. (temp_clouds.speed.x or -2) .. "]",
"container_end[]"
}
end
return clouds
end
function colstr(col)
if type(col) == "table" then
return minetest.rgba(col.r, col.g, col.b)
else
return col
end
end
function get_palette_col_and_sorted_table()
-- inverto chiavi con valori
local inverted = {}
for k in pairs(arena_lib.PALETTE) do
table.insert(inverted, k)
end
table.sort(inverted, function(a, b) return a:lower() < b:lower() end)
local palette = ""
local palette_table = {}
local i = 1
for _, col in pairs(inverted) do
palette = palette .. col .. ","
palette_table[arena_lib.PALETTE[col]] = i
i = i+1
end
return palette:sub(1, -2), palette_table
end
function compare_elem(t1,t2)
return minetest.serialize(t1) == minetest.serialize(t2)
end
----------------------------------------------
---------------GESTIONE CAMPI-----------------
----------------------------------------------
@ -198,31 +415,129 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "arena_lib:settings_sky" then return end
local p_name = player:get_player_name()
local temp_sky = temp_sky_settings[p_name].sky_parameters
local temp_sky = temp_sky_settings[p_name].sky
local temp_sky_col = temp_sky.sky_color
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
local temp_clouds = temp_sky_settings[p_name].clouds
minetest.chat_send_player(p_name, dump(fields))
local mod = player:get_meta():get_string("arena_lib_editor.mod")
local arena_name = player:get_meta():get_string("arena_lib_editor.arena")
local id, arena = arena_lib.get_arena_by_name(mod, arena_name)
local celvault = arena.celestial_vault
-- se abbandona...
if fields.quit then
if next(celvault) then
if celvault.sky then player:set_sky(celvault.sky) end
if celvault.sun then player:set_sun(celvault.sun) end
if celvault.moon then player:set_moon(celvault.moon) end
if celvault.stars then player:set_stars(celvault.stars) end
if celvault.clouds then player:set_clouds(celvault.clouds) end
else
arena_lib.temp.reset_celestial_vault(player)
end
temp_sky_settings[p_name] = nil
return
-- ...o se ripristina, non c'è bisogno di andare oltre
elseif fields.reset then
arena_lib.set_celestial_vault(p_name, mod, arena_name, "all", nil, true)
arena_lib.temp.reset_celestial_vault(player)
fill_tempsky(p_name, arena)
-- TODO: there is some Minetest related bug that doesn't allow to instantly update dropdown fields.
-- Too tired to backtrack for now and open an issue, maybe one day
minetest.close_formspec(p_name, "arena_lib:settings_sky")
-- riapro il formspec sul quale mi trovavo
minetest.after(0.1, function()
if fields.day_sky then
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "sky"))
elseif fields.sun_size then
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "sun"))
elseif fields.moon_size then
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "moon"))
elseif fields.stars_count then
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "stars"))
else
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "clouds"))
end
end)
return
end
temp_sky.base_color = fields.base_color
temp_sky.day_sky = fields.day_sky
temp_sky.day_horizon = fields.day_horizon
temp_sky.dawn_sky = fields.dawn_sky
temp_sky.dawn_horizon = fields.dawn_horizon
temp_sky.night_sky = fields.night_sky
temp_sky.night_horizon = fields.night_horizon
temp_sky.indoors = fields.indoors
temp_sky.clouds = fields.clouds or temp_sky.clouds
if temp_sky.sky_color.fog_tint_type == "custom" then
temp_sky.fog_sun_tint = fields.fog_sun_tint
temp_sky.fog_moon_tint = fields.fog_moon_tint
-- se cambia sezione, non c'è bisogno di controllare il resto (dato che viene automatico cambiare
-- e poi premere "Applica")
if fields.sky_btn then
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "sky"))
return
elseif fields.sun_btn then
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "sun"))
return
elseif fields.moon_btn then
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "moon"))
return
elseif fields.stars_btn then
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "stars"))
return
elseif fields.clouds_btn then
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "clouds"))
return
end
if temp_sky.textures then
local palette = arena_lib.PALETTE
--
-- aggiorna i vari parametri
--
-- cielo
if fields.base_color then
temp_sky.base_color = palette[fields.base_color]
end
if fields.day_sky then
temp_sky_col.day_sky = palette[fields.day_sky]
end
if fields.day_horizon then
temp_sky_col.day_horizon = palette[fields.day_horizon]
end
if fields.dawn_sky then
temp_sky_col.dawn_sky = palette[fields.dawn_sky]
end
if fields.dawn_horizon then
temp_sky_col.dawn_horizon = palette[fields.dawn_horizon]
end
if fields.night_sky then
temp_sky_col.night_sky = palette[fields.night_sky]
end
if fields.night_horizon then
temp_sky_col.night_horizon = palette[fields.night_horizon]
end
if fields.indoors then
temp_sky_col.indoors = palette[fields.indoors]
end
if fields.fog_sun_tint then
temp_sky_col.fog_sun_tint = palette[fields.fog_sun_tint]
end
if fields.fog_moon_tint then
temp_sky_col.fog_moon_tint = palette[fields.fog_moon_tint]
end
if fields.sky_type == "skybox" and fields.top then
temp_sky.textures[1] = fields.top
temp_sky.textures[2] = fields.bottom
temp_sky.textures[3] = fields.west
@ -231,15 +546,127 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
temp_sky.textures[6] = fields.south
end
if fields.type then
temp_sky.type = fields.type
if fields.type == "skybox" and not temp_sky.textures then
temp_sky.textures = {}
end
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_sky_formspec(p_name))
elseif fields.fog_tint_type then
temp_sky.sky_color.fog_tint_type = fields.fog_tint_type
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_sky_formspec(p_name))
-- sole
if fields.sun_texture then
temp_sun.texture = fields.sun_texture
end
if fields.sun_tonemap then
temp_sun.tonemap = fields.sun_tonemap
end
if fields.sunrise_texture then
temp_sun.sunrise = fields.sunrise_texture
end
if fields.sun_size then
temp_sun.scale = tonumber(fields.sun_size) or temp_sun.scale
end
-- luna
if fields.moon_texture then
temp_moon.texture = fields.moon_texture
end
if fields.moon_tonemap then
temp_moon.tonemap = fields.moon_tonemap
end
if fields.moon_size then
temp_moon.scale = tonumber(fields.moon_size) or temp_moon.scale
end
-- stelle
if fields.stars_color then
temp_stars.star_color = palette[fields.stars_color]
end
if fields.stars_count then
temp_stars.count = tonumber(fields.stars_count) or temp_stars.count
end
if fields.stars_size then
temp_stars.scale = tonumber(fields.stars_size) or temp_stars.scale
end
-- nuvole
if fields.clouds_density then
temp_clouds.density = minetest.explode_scrollbar_event(fields.clouds_density).value / 100
end
if fields.clouds_color then
temp_clouds.color = palette[fields.clouds_color]
end
if fields.clouds_ambient then
temp_clouds.ambient = palette[fields.clouds_ambient]
end
if fields.clouds_thickness then
temp_clouds.thickness = tonumber(fields.clouds_thickness) or temp_clouds.thickness
end
if fields.clouds_height then
temp_clouds.height = tonumber(fields.clouds_height) or temp_clouds.height
end
if fields.clouds_speed_x then
temp_clouds.speed.x = tonumber(fields.clouds_speed_x) or temp_clouds.speed.x
end
if fields.clouds_speed_z then
temp_clouds.speed.z = tonumber(fields.clouds_speed_z) or temp_clouds.speed.z
end
-- controlla i vari campi che aggiornano il formspec
if fields.sky_clouds then
temp_sky.clouds = fields.sky_clouds == "true" and true or false
elseif fields.custom_fog_tint then
temp_sky_col.fog_tint_type = fields.custom_fog_tint == "true" and "custom" or "default"
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "sky"))
elseif fields.sky_type then
temp_sky.type = fields.sky_type
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "sky"))
elseif fields.sun_visible then
temp_sun.visible = fields.sun_visible == "true" and true or false
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "sun"))
elseif fields.sunrise_visible then
temp_sun.sunrise_visible = fields.sunrise_visible == "true" and true or false
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "sun"))
elseif fields.moon_visible then
temp_moon.visible = fields.moon_visible == "true" and true or false
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "moon"))
elseif fields.stars_visible then
temp_stars.visible = fields.stars_visible == "true" and true or false
minetest.show_formspec(p_name, "arena_lib:settings_sky", get_celvault_formspec(p_name, "stars"))
end
-- applica
if fields.apply then
local same_sky = compare_elem(arena.celestial_vault.sky or {textures={}, sky_color={}}, temp_sky_settings[p_name].sky)
local same_sun = compare_elem(arena.celestial_vault.sun or {}, temp_sky_settings[p_name].sun)
local same_moon = compare_elem(arena.celestial_vault.moon or {}, temp_sky_settings[p_name].moon)
local same_stars = compare_elem(arena.celestial_vault.stars or {}, temp_sky_settings[p_name].stars)
local same_clouds = compare_elem(arena.celestial_vault.clouds or {speed={}}, temp_sky_settings[p_name].clouds)
if not same_sky then arena_lib.set_celestial_vault(p_name, mod, arena_name, "sky", temp_sky_settings[p_name].sky, true) end
if not same_sun then arena_lib.set_celestial_vault(p_name, mod, arena_name, "sun", temp_sky_settings[p_name].sun, true) end
if not same_moon then arena_lib.set_celestial_vault(p_name, mod, arena_name, "moon", temp_sky_settings[p_name].moon, true) end
if not same_stars then arena_lib.set_celestial_vault(p_name, mod, arena_name, "stars", temp_sky_settings[p_name].stars, true) end
if not same_clouds then arena_lib.set_celestial_vault(p_name, mod, arena_name, "clouds", temp_sky_settings[p_name].clouds, true) end
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)
end)

View File

@ -21,6 +21,7 @@ local spawners_tools_noteam = {
"arena_lib:spawner_deleteall",
"",
"",
"",
"arena_lib:editor_return",
"arena_lib:editor_quit",
}

0
src/minigame_settings.lua Normal file → Executable file
View File

0
src/spectate/spectate_hand.lua Normal file → Executable file
View File

0
src/spectate/spectate_main.lua Normal file → Executable file
View File

0
src/spectate/spectate_tools.lua Normal file → Executable file
View File

View File

@ -36,3 +36,84 @@ function AL_value_to_string(value)
end
end
----------------------------------------------
-------------ASPETTANDO MINETEST--------------
----------------------------------------------
arena_lib.temp = {}
-- proper get_sky() => https://github.com/minetest/minetest/issues/11890
function arena_lib.temp.get_sky(player)
local get_sky = {player:get_sky()}
local p_sky = {}
p_sky.base_color = (type(get_sky[1]) ~= "table") and get_sky[1] or table.copy(get_sky[1])
p_sky.type = get_sky[2]
p_sky.sky_color = table.copy(player:get_sky_color())
p_sky.textures = table.copy(get_sky[3])
p_sky.clouds = get_sky[4]
return p_sky
end
-- proper celestial vault reset => https://github.com/minetest/minetest/pull/11922
function arena_lib.temp.reset_celestial_vault(player)
local sky = {
base_color = "#ffffff",
type = "regular",
clouds = true,
sky_color = {
day_sky = "#61b5f5",
day_horizon = "#90d3f6",
dawn_sky = "#b4bafa",
dawn_horizon = "#bac1f0",
night_sky = "#006bff",
night_horizon = "#4090ff",
indoors = "#646464",
fog_tint_type = "default",
fog_sun_tint = "#f47d1d",
fog_moon_tint = "#7f99cc"
}
}
local sun = {
visible = true,
sunrise_visible = true,
texture = "sun.png",
tonemap = "sun_tonemap.png",
sunrise = "sunrisebg.png",
scale = 1
}
local moon = {
visible = true,
texture = "moon.png",
tonemap = "moon_tonemap.png",
scale = 1
}
local stars = {
visible = true,
count = 1000,
star_color = "#ebebff69",
scale = 1
}
local clouds = {
density = 0.4,
color = "#fff0f0e5",
ambient = "#000000",
thickness = 16,
height = 120,
speed = { x = 0, z = -2}
}
player:set_sky(sky)
player:set_sun(sun)
player:set_moon(moon)
player:set_stars(stars)
player:set_clouds(clouds)
end

0
textures/arenalib_editor_bgm.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 190 B

BIN
textures/arenalib_editor_sky.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

0
textures/arenalib_gui_hotbar2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 126 B

After

Width:  |  Height:  |  Size: 126 B

0
textures/arenalib_gui_hotbar3.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 132 B

After

Width:  |  Height:  |  Size: 132 B

0
textures/arenalib_gui_hotbar4.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 140 B

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 B

0
textures/arenalib_infobox.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

0
textures/arenalib_infobox_quit.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 102 B

After

Width:  |  Height:  |  Size: 102 B

0
textures/arenalib_infobox_spectate.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 118 B

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

0
textures/arenalib_spectate_changeplayer.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 168 B

After

Width:  |  Height:  |  Size: 168 B

0
textures/arenalib_spectate_changeteam.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 187 B

0
textures/arenalib_tool_bgm_test.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 148 B

0
textures/arenalib_tool_bgm_test_stop.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 134 B

After

Width:  |  Height:  |  Size: 134 B

0
textures/arenalib_tool_settings_nameauthor.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 154 B

0
textures/arenalib_winparticle.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 103 B

After

Width:  |  Height:  |  Size: 103 B