1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-16 18:01:40 +00:00

Merge remote-tracking branch 'upstream/master' into Visuals-Vol-2

This commit is contained in:
Gefüllte Taubenbrust 2024-12-22 19:08:52 +01:00
commit e7c7441429
285 changed files with 8894 additions and 4654 deletions

View file

@ -44,6 +44,7 @@ core.features = {
bulk_lbms = true,
abm_without_neighbors = true,
biome_weights = true,
particle_blend_clip = true,
}
function core.has_feature(arg)

View file

@ -36,11 +36,7 @@ end
function core.setting_get_pos(name)
local value = core.settings:get(name)
if not value then
return nil
end
return core.string_to_pos(value)
return core.settings:get_pos(name)
end

View file

@ -1,7 +1,7 @@
local static_spawnpoint_string = core.settings:get("static_spawnpoint")
if static_spawnpoint_string and
static_spawnpoint_string ~= "" and
not core.setting_get_pos("static_spawnpoint") then
not core.settings:get_pos("static_spawnpoint") then
error('The static_spawnpoint setting is invalid: "' ..
static_spawnpoint_string .. '"')
end

View file

@ -0,0 +1,49 @@
-- Luanti
-- Copyright (C) 2024 siliconsniffer
-- SPDX-License-Identifier: LGPL-2.1-or-later
local function clients_list_formspec(dialogdata)
local TOUCH_GUI = core.settings:get_bool("touch_gui")
local clients_list = dialogdata.server.clients_list
local servername = dialogdata.server.name
local function fmt_formspec_list(clients_list)
local escaped = {}
for i, str in ipairs(clients_list) do
escaped[i] = core.formspec_escape(str)
end
return table.concat(escaped, ",")
end
local formspec = {
"formspec_version[8]",
"size[6,9.5]",
TOUCH_GUI and "padding[0.01,0.01]" or "",
"hypertext[0,0;6,1.5;;<global margin=5 halign=center valign=middle>",
fgettext("This is the list of clients connected to\n$1",
"<b>" .. core.hypertext_escape(servername) .. "</b>") .. "]",
"textlist[0.5,1.5;5,6.8;;" .. fmt_formspec_list(clients_list) .. "]",
"button[1.5,8.5;3,0.8;quit;OK]"
}
return table.concat(formspec, "")
end
local function clients_list_buttonhandler(this, fields)
if fields.quit then
this:delete()
return true
end
return false
end
function create_clientslist_dialog(server)
local retval = dialog_create("dlg_clients_list",
clients_list_formspec,
clients_list_buttonhandler,
nil)
retval.data.server = server
return retval
end

View file

@ -55,6 +55,7 @@ dofile(menupath .. DIR_DELIM .. "dlg_register.lua")
dofile(menupath .. DIR_DELIM .. "dlg_rename_modpack.lua")
dofile(menupath .. DIR_DELIM .. "dlg_version_info.lua")
dofile(menupath .. DIR_DELIM .. "dlg_reinstall_mtg.lua")
dofile(menupath .. DIR_DELIM .. "dlg_clients_list.lua")
local tabs = {
content = dofile(menupath .. DIR_DELIM .. "tab_content.lua"),

View file

@ -123,6 +123,22 @@ local function load()
end,
}
local touchscreen_layout = {
query_text = "Touchscreen layout",
requires = {
touchscreen = true,
},
get_formspec = function(self, avail_w)
local btn_w = math.min(avail_w, 6)
return ("button[0,0;%f,0.8;btn_touch_layout;%s]"):format(btn_w, fgettext("Touchscreen layout")), 0.8
end,
on_submit = function(self, fields)
if fields.btn_touch_layout then
core.show_touchscreen_layout()
end
end,
}
add_page({
id = "accessibility",
title = fgettext_ne("Accessibility"),
@ -151,6 +167,8 @@ local function load()
load_settingtypes()
table.insert(page_by_id.controls_keyboard_and_mouse.content, 1, change_keys)
-- insert after "touch_controls"
table.insert(page_by_id.controls_touchscreen.content, 2, touchscreen_layout)
do
local content = page_by_id.graphics_and_audio_effects.content
local idx = table.indexof(content, "enable_dynamic_shadows")

View file

@ -16,7 +16,7 @@ local minetest_example_header = [[
# to the program, eg. "luanti.exe --config ../minetest.conf.example".
# Further documentation:
# https://wiki.minetest.net/
# https://wiki.luanti.org/
]]

View file

@ -55,6 +55,51 @@ local function get_sorted_servers()
return servers
end
local function is_selected_fav(server)
local address = core.settings:get("address")
local port = tonumber(core.settings:get("remote_port"))
for _, fav in ipairs(serverlistmgr.get_favorites()) do
if address == fav.address and port == fav.port then
return true
end
end
return false
end
-- Persists the selected server in the "address" and "remote_port" settings
local function set_selected_server(server)
if server == nil then -- reset selection
core.settings:remove("address")
core.settings:remove("remote_port")
return
end
local address = server.address
local port = server.port
gamedata.serverdescription = server.description
if address and port then
core.settings:set("address", address)
core.settings:set("remote_port", port)
end
end
local function find_selected_server()
local address = core.settings:get("address")
local port = tonumber(core.settings:get("remote_port"))
for _, server in ipairs(serverlistmgr.servers) do
if server.address == address and server.port == port then
return server
end
end
for _, server in ipairs(serverlistmgr.get_favorites()) do
if server.address == address and server.port == port then
return server
end
end
end
local function get_formspec(tabview, name, tabdata)
-- Update the cached supported proto info,
-- it may have changed after a change by the settings menu.
@ -107,17 +152,51 @@ local function get_formspec(tabview, name, tabdata)
retval = retval .. "button[0.25,6;2.5,0.75;btn_mp_register;" .. fgettext("Register") .. "]"
end
if tabdata.selected then
if gamedata.fav then
retval = retval .. "tooltip[btn_delete_favorite;" .. fgettext("Remove favorite") .. "]"
retval = retval .. "style[btn_delete_favorite;padding=6]"
retval = retval .. "image_button[5,1.3;0.5,0.5;" .. core.formspec_escape(defaulttexturedir ..
"server_favorite_delete.png") .. ";btn_delete_favorite;]"
end
local selected_server = find_selected_server()
if selected_server then
if gamedata.serverdescription then
retval = retval .. "textarea[0.25,1.85;5.25,2.7;;;" ..
core.formspec_escape(gamedata.serverdescription) .. "]"
end
local clients_list = selected_server.clients_list
local can_view_clients_list = clients_list and #clients_list > 0
if can_view_clients_list then
table.sort(clients_list, function(a, b)
return a:lower() < b:lower()
end)
local max_clients = 5
if #clients_list > max_clients then
retval = retval .. "tooltip[btn_view_clients;" ..
fgettext("Clients:\n$1", table.concat(clients_list, "\n", 1, max_clients)) .. "\n..." .. "]"
else
retval = retval .. "tooltip[btn_view_clients;" ..
fgettext("Clients:\n$1", table.concat(clients_list, "\n")) .. "]"
end
retval = retval .. "style[btn_view_clients;padding=6]"
retval = retval .. "image_button[4.5,1.3;0.5,0.5;" .. core.formspec_escape(defaulttexturedir ..
"server_view_clients.png") .. ";btn_view_clients;]"
end
if selected_server.url then
retval = retval .. "tooltip[btn_server_url;" .. fgettext("Open server website") .. "]"
retval = retval .. "style[btn_server_url;padding=6]"
retval = retval .. "image_button[" .. (can_view_clients_list and "4" or "4.5") .. ",1.3;0.5,0.5;" ..
core.formspec_escape(defaulttexturedir .. "server_url.png") .. ";btn_server_url;]"
end
if is_selected_fav() then
retval = retval .. "tooltip[btn_delete_favorite;" .. fgettext("Remove favorite") .. "]"
retval = retval .. "style[btn_delete_favorite;padding=6]"
retval = retval .. "image_button[5,1.3;0.5,0.5;" ..
core.formspec_escape(defaulttexturedir .. "server_favorite_delete.png") .. ";btn_delete_favorite;]"
else
retval = retval .. "tooltip[btn_add_favorite;" .. fgettext("Add favorite") .. "]"
retval = retval .. "style[btn_add_favorite;padding=6]"
retval = retval .. "image_button[5,1.3;0.5,0.5;" ..
core.formspec_escape(defaulttexturedir .. "server_favorite.png") .. ";btn_add_favorite;]"
end
end
retval = retval .. "container_end[]"
@ -175,11 +254,17 @@ local function get_formspec(tabview, name, tabdata)
retval = retval .. table.concat(rows, ",")
if tabdata.selected then
retval = retval .. ";" .. tabdata.selected .. "]"
else
retval = retval .. ";0]"
local selected_row_idx = 0
if selected_server then
for i, server in pairs(tabdata.lookup) do
if selected_server.address == server.address and
selected_server.port == server.port then
selected_row_idx = i
break
end
end
end
retval = retval .. ";" .. selected_row_idx .. "]"
return retval
end
@ -231,35 +316,6 @@ local function search_server_list(input)
menudata.search_result = search_result
end
local function set_selected_server(tabdata, idx, server)
-- reset selection
if idx == nil or server == nil then
tabdata.selected = nil
core.settings:set("address", "")
core.settings:set("remote_port", "30000")
return
end
local address = server.address
local port = server.port
gamedata.serverdescription = server.description
gamedata.fav = false
for _, fav in ipairs(serverlistmgr.get_favorites()) do
if address == fav.address and port == fav.port then
gamedata.fav = true
break
end
end
if address and port then
core.settings:set("address", address)
core.settings:set("remote_port", port)
end
tabdata.selected = idx
end
local function main_button_handler(tabview, fields, name, tabdata)
if fields.te_name then
gamedata.playername = fields.te_name
@ -290,19 +346,23 @@ local function main_button_handler(tabview, fields, name, tabdata)
gamedata.serverdescription = server.description
if gamedata.address and gamedata.port then
core.settings:set("address", gamedata.address)
core.settings:set("remote_port", gamedata.port)
set_selected_server(server)
core.start()
end
return true
end
if event.type == "CHG" then
set_selected_server(tabdata, event.row, server)
set_selected_server(server)
return true
end
end
end
if fields.btn_add_favorite then
serverlistmgr.add_favorite(find_selected_server())
return true
end
if fields.btn_delete_favorite then
local idx = core.get_table_index("servers")
if not idx then return end
@ -310,8 +370,20 @@ local function main_button_handler(tabview, fields, name, tabdata)
if not server then return end
serverlistmgr.delete_favorite(server)
-- the server at [idx+1] will be at idx once list is refreshed
set_selected_server(tabdata, idx, tabdata.lookup[idx+1])
set_selected_server(server)
return true
end
if fields.btn_server_url then
core.open_url_dialog(find_selected_server().url)
return true
end
if fields.btn_view_clients then
local dlg = create_clientslist_dialog(find_selected_server())
dlg:set_parent(tabview)
tabview:hide()
dlg:show()
return true
end
@ -325,8 +397,8 @@ local function main_button_handler(tabview, fields, name, tabdata)
tabdata.search_for = fields.te_search
search_server_list(fields.te_search:lower())
if menudata.search_result then
-- first server in row 2 due to header
set_selected_server(tabdata, 2, menudata.search_result[1])
-- Note: This clears the selection if there are no results
set_selected_server(menudata.search_result[1])
end
return true
@ -353,8 +425,6 @@ local function main_button_handler(tabview, fields, name, tabdata)
local idx = core.get_table_index("servers")
local server = idx and tabdata.lookup[idx]
set_selected_server(tabdata)
if server and server.address == gamedata.address and
server.port == gamedata.port then

View file

@ -77,8 +77,11 @@
# Sections are marked by a single line in the format: [Section Name]
# Sub-section are marked by adding * in front of the section name: [*Sub-section]
# Sub-sub-sections have two * etc.
# There shouldn't be too much settings per category; settings that shouldn't be
# modified by the "average user" should be in (sub-)categories called "Advanced".
# There shouldn't be too many settings per category.
#
# The top-level categories "Advanced", "Client and Server" and "Mapgen" are
# handled specially and its contents only shown when a checkbox is checked.
# They contain settings not intended for the "average user".
[Controls]
@ -410,10 +413,12 @@ anisotropic_filter (Anisotropic filtering) bool false
# * None - No antialiasing (default)
#
# * FSAA - Hardware-provided full-screen antialiasing
# (incompatible with Post Processing and Undersampling)
# A.K.A multi-sample antialiasing (MSAA)
# Smoothens out block edges but does not affect the insides of textures.
# A restart is required to change this option.
#
# If Post Processing is disabled, changing FSAA requires a restart.
# Also, if Post Processing is disabled, FSAA will not work together with
# undersampling or a non-default "3d_mode" setting.
#
# * FXAA - Fast approximate antialiasing
# Applies a post-processing filter to detect and smoothen high-contrast edges.
@ -469,6 +474,7 @@ performance_tradeoffs (Tradeoffs for performance) bool false
# Adds particles when digging a node.
enable_particles (Digging particles) bool true
[**Waving Nodes]
# Set to true to enable waving leaves.
@ -535,12 +541,6 @@ shadow_map_texture_size (Shadow map texture size) int 2048 128 8192
# Requires: enable_dynamic_shadows, opengl
shadow_map_texture_32bit (Shadow map texture in 32 bits) bool true
# Enable Poisson disk filtering.
# On true uses Poisson disk to make "soft shadows". Otherwise uses PCF filtering.
#
# Requires: enable_dynamic_shadows, opengl
shadow_poisson_filter (Poisson filtering) bool true
# Define shadow filtering quality.
# This simulates the soft shadows effect by applying a PCF or Poisson disk
# but also uses more resources.
@ -554,14 +554,6 @@ shadow_filters (Shadow filter quality) enum 1 0,1,2
# Requires: enable_dynamic_shadows, opengl
shadow_map_color (Colored shadows) bool false
# Spread a complete update of shadow map over given number of frames.
# Higher values might make shadows laggy, lower values
# will consume more resources.
# Minimum value: 1; maximum value: 16
#
# Requires: enable_dynamic_shadows, opengl
shadow_update_frames (Map shadows update frames) int 8 1 16
# Set the soft shadow radius size.
# Lower values mean sharper shadows, bigger values mean softer shadows.
# Minimum value: 1.0; maximum value: 15.0
@ -805,7 +797,7 @@ contentdb_max_concurrent_downloads (ContentDB Max Concurrent Downloads) int 3 1
enable_local_map_saving (Saving map received from server) bool false
# URL to the server list displayed in the Multiplayer Tab.
serverlist_url (Serverlist URL) string servers.luanti.org
serverlist_url (Serverlist URL) string https://servers.luanti.org
# If enabled, account registration is separate from login in the UI.
# If disabled, new accounts will be registered automatically when logging in.
@ -843,7 +835,7 @@ server_announce (Announce server) bool false
server_announce_send_players (Send player names to the server list) bool true
# Announce to this serverlist.
serverlist_url (Serverlist URL) string servers.luanti.org
serverlist_url (Serverlist URL) string https://servers.luanti.org
# Message of the day displayed to players connecting.
motd (Message of the day) string
@ -1853,6 +1845,9 @@ ignore_world_load_errors (Ignore world errors) bool false
[**Graphics]
# Enables debug and error-checking in the OpenGL driver.
opengl_debug (OpenGL debug) bool false
# Path to shader directory. If no path is defined, default location will be used.
shader_path (Shader path) path
@ -1866,6 +1861,11 @@ video_driver (Video driver) enum ,opengl,opengl3,ogles2
# Set to 0 to disable it entirely.
transparency_sorting_distance (Transparency Sorting Distance) int 16 0 128
# Draw transparency sorted triangles grouped by their mesh buffers.
# This breaks transparency sorting between mesh buffers, but avoids situations
# where transparency sorting would be very slow otherwise.
transparency_sorting_group_by_buffers (Transparency Sorting Group by Buffers) bool true
# Radius of cloud area stated in number of 64 node cloud squares.
# Values larger than 26 will start to produce sharp cutoffs at cloud area corners.
cloud_radius (Cloud radius) int 12 1 62
@ -1919,8 +1919,26 @@ texture_min_size (Base texture size) int 64 1 32768
# Systems with a low-end GPU (or no GPU) would benefit from smaller values.
client_mesh_chunk (Client Mesh Chunksize) int 1 1 16
# Enables debug and error-checking in the OpenGL driver.
opengl_debug (OpenGL debug) bool false
# Decide the color depth of the texture used for the post-processing pipeline.
# Reducing this can improve performance, but might cause some effects (e.g. bloom)
# to not work.
#
# Requires: enable_post_processing
post_processing_texture_bits (Color depth for post-processing texture) enum 16 8,10,16
# Enable Poisson disk filtering.
# On true uses Poisson disk to make "soft shadows". Otherwise uses PCF filtering.
#
# Requires: enable_dynamic_shadows, opengl
shadow_poisson_filter (Poisson filtering) bool true
# Spread a complete update of shadow map over given number of frames.
# Higher values might make shadows laggy, lower values
# will consume more resources.
# Minimum value: 1; maximum value: 16
#
# Requires: enable_dynamic_shadows, opengl
shadow_update_frames (Map shadows update frames) int 8 1 16
# Set to true to render debugging breakdown of the bloom effect.
# In debug mode, the screen is split into 4 quadrants: