1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-10 18:51:05 +00:00

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

This commit is contained in:
Gefüllte Taubenbrust 2024-06-11 13:59:14 +02:00
commit cd6e304cfa
172 changed files with 27747 additions and 18949 deletions

View file

@ -78,15 +78,12 @@ function dialog_create(name,get_formspec,buttonhandler,eventhandler)
return self
end
-- "message" must already be formspec-escaped, e.g. via fgettext or
-- core.formspec_escape.
function messagebox(name, message)
return dialog_create(name,
function()
return ([[
formspec_version[3]
size[8,3]
textarea[0.375,0.375;7.25,1.2;;;%s]
button[3,1.825;2,0.8;ok;%s]
]]):format(message, fgettext("OK"))
return ui.get_message_formspec("", message, "ok")
end,
function(this, fields)
if fields.ok then

View file

@ -50,6 +50,20 @@ function ui.find_by_name(name)
return ui.childlist[name]
end
--------------------------------------------------------------------------------
-- "title" and "message" must already be formspec-escaped, e.g. via fgettext or
-- core.formspec_escape.
function ui.get_message_formspec(title, message, btn_id)
return table.concat({
"size[14,8]",
"real_coordinates[true]",
"set_focus[", btn_id, ";true]",
"box[0.5,1.2;13,5;#000]",
("textarea[0.5,1.2;13,5;;%s;%s]"):format(title, message),
"button[5,6.6;4,1;", btn_id, ";" .. fgettext("OK") .. "]",
})
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Internal functions not to be called from user
@ -76,6 +90,9 @@ function ui.update()
}
ui.overridden = true
elseif gamedata ~= nil and gamedata.errormessage ~= nil then
-- Note to API users:
-- "gamedata.errormessage" must not be formspec-escaped yet.
-- For translations, fgettext_ne should be used.
local error_message = core.formspec_escape(gamedata.errormessage)
local error_title
@ -84,15 +101,7 @@ function ui.update()
else
error_title = fgettext("An error occurred:")
end
formspec = {
"size[14,8]",
"real_coordinates[true]",
"set_focus[btn_error_confirm;true]",
"box[0.5,1.2;13,5;#000]",
("textarea[0.5,1.2;13,5;;%s;%s]"):format(
error_title, error_message),
"button[5,6.6;4,1;btn_error_confirm;" .. fgettext("OK") .. "]"
}
formspec = {ui.get_message_formspec(error_title, error_message, "btn_error_confirm")}
ui.overridden = true
else
local active_toplevel_ui_elements = 0

View file

@ -41,6 +41,7 @@ core.features = {
item_meta_range = true,
node_interaction_actor = true,
moveresult_new_pos = true,
override_item_remove_fields = true,
}
function core.has_feature(arg)

View file

@ -110,7 +110,7 @@ if core.set_push_moveresult1 then
standing_on_object = b2,
collisions = {{
type = "node",
axis = AXES[axis],
axis = AXES[axis + 1],
node_pos = vector.new(npx, npy, npz),
new_pos = vector.new(v0x, v0y, v0z),
old_velocity = vector.new(v1x, v1y, v1z),

View file

@ -404,7 +404,7 @@ core.register_item(":", {
})
function core.override_item(name, redefinition)
function core.override_item(name, redefinition, del_fields)
if redefinition.name ~= nil then
error("Attempt to redefine name of "..name.." to "..dump(redefinition.name), 2)
end
@ -418,6 +418,9 @@ function core.override_item(name, redefinition)
for k, v in pairs(redefinition) do
rawset(item, k, v)
end
for _, field in ipairs(del_fields or {}) do
rawset(item, field, nil)
end
register_item_raw(item)
end

View file

@ -71,7 +71,9 @@ local function download_and_extract(param)
os.remove(filename)
if tempfolder == "" then
return {
msg = fgettext_ne("Failed to extract \"$1\" (unsupported file type or broken archive)", package.title),
msg = fgettext_ne("Failed to extract \"$1\" " ..
"(insufficient disk space, unsupported file type or broken archive)",
package.title),
}
end

View file

@ -117,7 +117,7 @@ local function resolve_auto_install_spec()
end
if not resolved then
gamedata.errormessage = fgettext("The package $1 was not found.", auto_install_spec)
gamedata.errormessage = fgettext_ne("The package $1 was not found.", auto_install_spec)
ui.update()
auto_install_spec = nil

View file

@ -66,35 +66,45 @@ local function get_formspec(data)
message_bg = mt_color_orange
end
local ENABLE_TOUCH = core.settings:get_bool("enable_touch")
local w = ENABLE_TOUCH and 14 or 7
local padded_w = w - 2*0.375
local dropdown_w = ENABLE_TOUCH and 10.2 or 4.25
local button_w = (padded_w - 0.25) / 3
local button_pad = button_w / 2
local formspec = {
"formspec_version[3]",
"size[7,7.85]",
"size[", w, ",9.05]",
ENABLE_TOUCH and "padding[0.01,0.01]" or "position[0.5,0.55]",
"style[title;border=false]",
"box[0,0;7,0.5;#3333]",
"button[0,0;7,0.5;title;", fgettext("Install $1", package.title) , "]",
"box[0,0;", w, ",0.8;#3333]",
"button[0,0;", w, ",0.8;title;", fgettext("Install $1", package.title) , "]",
"container[0.375,0.70]",
"container[0.375,1]",
"label[0,0.25;", fgettext("Base Game:"), "]",
"dropdown[2,0;4.25,0.5;selected_game;", table.concat(game_list, ","), ";", selected_game_idx, "]",
"label[0,0.4;", fgettext("Base Game:"), "]",
"dropdown[", padded_w - dropdown_w, ",0;", dropdown_w, ",0.8;selected_game;",
table.concat(game_list, ","), ";", selected_game_idx, "]",
"label[0,0.8;", fgettext("Dependencies:"), "]",
"label[0,1.1;", fgettext("Dependencies:"), "]",
"tablecolumns[color;text;color;text]",
"table[0,1.1;6.25,3;packages;", table.concat(formatted_deps, ","), "]",
"table[0,1.4;", padded_w, ",3;packages;", table.concat(formatted_deps, ","), "]",
"container_end[]",
"checkbox[0.375,5.1;will_install_deps;",
"checkbox[0.375,5.7;will_install_deps;",
fgettext("Install missing dependencies"), ";",
will_install_deps and "true" or "false", "]",
"box[0,5.4;7,1.2;", message_bg, "]",
"textarea[0.375,5.5;6.25,1;;;", message, "]",
"box[0,6;", w, ",1.8;", message_bg, "]",
"textarea[0.375,6.1;", padded_w, ",1.6;;;", message, "]",
"container[1.375,6.85]",
"button[0,0;2,0.8;install_all;", fgettext("Install"), "]",
"button[2.25,0;2,0.8;cancel;", fgettext("Cancel"), "]",
"container[", 0.375 + button_pad, ",8.05]",
"button[0,0;", button_w, ",0.8;install_all;", fgettext("Install"), "]",
"button[", 0.25 + button_w, ",0;", button_w, ",0.8;cancel;", fgettext("Cancel"), "]",
"container_end[]",
}

View file

@ -723,6 +723,11 @@ local function eventhandler(event)
mm_game_theme.set_engine(true)
return true
end
if event == "FullscreenChange" then
-- Refresh the formspec to keep the fullscreen checkbox up to date.
ui.update()
return true
end
return false
end

View file

@ -156,10 +156,18 @@ local function get_formspec(tabview, name, tabdata)
-- Point the player to ContentDB when no games are found
if #pkgmgr.games == 0 then
local W = tabview.width
local H = tabview.height
local hypertext = "<global valign=middle halign=center size=18>" ..
fgettext_ne("Minetest is a game-creation platform that allows you to play many different games.") .. "\n" ..
fgettext_ne("Minetest doesn't come with a game by default.") .. " " ..
fgettext_ne("You need to install a game before you can create a world.")
local button_y = H * 2/3 - 0.6
return table.concat({
"style[label_button;border=false]",
"button[2.75,1.5;10,1;label_button;", fgettext("You have no games installed."), "]",
"button[5.25,3.5;5,1.2;game_open_cdb;", fgettext("Install a game"), "]"})
"hypertext[0.375,0;", W - 2*0.375, ",", button_y, ";ht;", core.formspec_escape(hypertext), "]",
"button[5.25,", button_y, ";5,1.2;game_open_cdb;", fgettext("Install a game"), "]"})
end
local retval = ""

View file

@ -265,8 +265,8 @@ undersampling (Undersampling) int 1 1 8
[**Graphics Effects]
# Makes all liquids opaque
opaque_water (Opaque liquids) bool false
# Allows liquids to be translucent.
translucent_liquids (Translucent liquids) bool true
# Leaves style:
# - Fancy: all faces visible
@ -381,8 +381,7 @@ crosshair_alpha (Crosshair alpha) int 255 0 255
[**Fog]
# Whether to fog out the end of the visible area. This option only works
# with the 'debug' privilege.
# Whether to fog out the end of the visible area.
enable_fog (Fog) bool true
# Make fog and sky colors depend on daytime (dawn/sunset) and view direction.
@ -1785,6 +1784,9 @@ deprecated_lua_api_handling (Deprecated Lua API handling) enum log none,log,erro
# Enable random user input (only used for testing).
random_input (Random input) bool false
# Enable random mod loading (mainly used for testing).
random_mod_load_order (Random mod load order) bool false
# Enable mod channels support.
enable_mod_channels (Mod channels) bool false
@ -2421,6 +2423,9 @@ keymap_minimap (Minimap key) key KEY_KEY_V
# Key for taking screenshots.
keymap_screenshot (Screenshot) key KEY_F12
# Key for toggling fullscreen mode.
keymap_fullscreen (Fullscreen key) key KEY_F11
# Key for dropping the currently selected item.
keymap_drop (Drop item key) key KEY_KEY_Q
@ -2532,7 +2537,7 @@ keymap_toggle_chat (Chat toggle key) key KEY_F2
# Key for toggling the display of the large chat console.
keymap_console (Large chat console key) key KEY_F10
# Key for toggling the display of fog. Only usable with 'debug' privilege.
# Key for toggling the display of fog.
keymap_toggle_fog (Fog toggle key) key KEY_F3
# Key for toggling the camera update. Only usable with 'debug' privilege.
@ -2544,6 +2549,9 @@ keymap_toggle_debug (Debug info toggle key) key KEY_F5
# Key for toggling the display of the profiler. Used for development.
keymap_toggle_profiler (Profiler toggle key) key KEY_F6
# Key for toggling the display of mapblock boundaries.
keymap_toggle_block_bounds (Block bounds toggle key) key
# Key for switching between first- and third-person camera.
keymap_camera_mode (Toggle camera mode key) key KEY_KEY_C