mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Merge remote-tracking branch 'upstream/master' into Visuals-Vol-2
This commit is contained in:
commit
e05544b84e
340 changed files with 73244 additions and 25967 deletions
40
.github/workflows/linux.yml
vendored
40
.github/workflows/linux.yml
vendored
|
@ -34,28 +34,32 @@ env:
|
|||
|
||||
jobs:
|
||||
# Older gcc version (should be close to our minimum supported version)
|
||||
gcc_7:
|
||||
runs-on: ubuntu-20.04
|
||||
gcc_9:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install deps
|
||||
run: |
|
||||
source ./util/ci/common.sh
|
||||
install_linux_deps g++-7
|
||||
install_linux_deps g++-9
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./util/ci/build.sh
|
||||
env:
|
||||
CC: gcc-7
|
||||
CXX: g++-7
|
||||
# Test fallback SHA implementations
|
||||
CMAKE_FLAGS: '-DENABLE_OPENSSL=0'
|
||||
CC: gcc-9
|
||||
CXX: g++-9
|
||||
CMAKE_FLAGS: '-DCMAKE_C_FLAGS="-fsanitize=address" -DCMAKE_CXX_FLAGS="-fsanitize=address"'
|
||||
|
||||
- name: Test
|
||||
- name: Unittest
|
||||
run: |
|
||||
./bin/luanti --run-unittests
|
||||
|
||||
# Do this here because we have ASan and error paths are sensitive to dangling pointers
|
||||
- name: Test error cases
|
||||
run: |
|
||||
./util/test_error_cases.sh
|
||||
|
||||
# Current gcc version
|
||||
gcc_14:
|
||||
runs-on: ubuntu-24.04
|
||||
|
@ -81,32 +85,28 @@ jobs:
|
|||
../bin/luanti --run-unittests
|
||||
|
||||
# Older clang version (should be close to our minimum supported version)
|
||||
clang_7:
|
||||
runs-on: ubuntu-20.04
|
||||
clang_11:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install deps
|
||||
run: |
|
||||
source ./util/ci/common.sh
|
||||
install_linux_deps clang-7 llvm-7
|
||||
install_linux_deps clang-11
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./util/ci/build.sh
|
||||
env:
|
||||
CC: clang-7
|
||||
CXX: clang++-7
|
||||
CMAKE_FLAGS: '-DCMAKE_C_FLAGS="-fsanitize=address" -DCMAKE_CXX_FLAGS="-fsanitize=address"'
|
||||
CC: clang-11
|
||||
CXX: clang++-11
|
||||
# Test fallback SHA implementations
|
||||
CMAKE_FLAGS: '-DENABLE_OPENSSL=0'
|
||||
|
||||
- name: Unittest
|
||||
- name: Test
|
||||
run: |
|
||||
./bin/luanti --run-unittests
|
||||
|
||||
# Do this here because we have ASan and error paths are sensitive to dangling pointers
|
||||
- name: Test error cases
|
||||
run: |
|
||||
./util/test_error_cases.sh
|
||||
|
||||
# Current clang version
|
||||
clang_18:
|
||||
runs-on: ubuntu-24.04
|
||||
|
|
2
.github/workflows/macos.yml
vendored
2
.github/workflows/macos.yml
vendored
|
@ -45,7 +45,7 @@ jobs:
|
|||
mkdir build
|
||||
cd build
|
||||
cmake .. \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=13 \
|
||||
-DCMAKE_FIND_FRAMEWORK=LAST \
|
||||
-DCMAKE_INSTALL_PREFIX=../build/macos/ \
|
||||
-DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE \
|
||||
|
|
2
.github/workflows/whitespace_checks.yml
vendored
2
.github/workflows/whitespace_checks.yml
vendored
|
@ -92,7 +92,7 @@ jobs:
|
|||
- name: Check indent spaces
|
||||
run: |
|
||||
if git ls-files |\
|
||||
grep -E '^src/.*\.cpp$|^src/.*\.[ch]$|\.lua' |\
|
||||
grep -E '^src/.*\.cpp$|^src/.*\.[ch]$|\.lua$' |\
|
||||
xargs grep -n -P '^\t*[ ]';\
|
||||
then\
|
||||
echo -e "\033[0;31mFound incorrect indent whitespaces";\
|
||||
|
|
10
.github/workflows/windows.yml
vendored
10
.github/workflows/windows.yml
vendored
|
@ -71,9 +71,7 @@ jobs:
|
|||
name: VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }}
|
||||
runs-on: windows-2019
|
||||
env:
|
||||
VCPKG_VERSION: d5ec528843d29e3a52d745a64b469f810b2cedbf
|
||||
# 2025.02.14
|
||||
vcpkg_packages: zlib zstd curl[winssl] openal-soft libvorbis libogg libjpeg-turbo sqlite3 freetype luajit gmp jsoncpp sdl2
|
||||
VCPKG_DEFAULT_TRIPLET: ${{matrix.config.vcpkg_triplet}}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
@ -97,13 +95,9 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Restore from cache and run vcpkg
|
||||
uses: lukka/run-vcpkg@v7
|
||||
uses: lukka/run-vcpkg@v11
|
||||
with:
|
||||
vcpkgArguments: ${{env.vcpkg_packages}}
|
||||
vcpkgDirectory: '${{ github.workspace }}\vcpkg'
|
||||
appendedCacheKey: ${{ matrix.config.vcpkg_triplet }}
|
||||
vcpkgGitCommitId: ${{ env.VCPKG_VERSION }}
|
||||
vcpkgTriplet: ${{ matrix.config.vcpkg_triplet }}
|
||||
|
||||
- name: CMake
|
||||
# Note: See #15976 for why CMAKE_POLICY_VERSION_MINIMUM=3.5 is set.
|
||||
|
|
12
.luacheckrc
12
.luacheckrc
|
@ -33,6 +33,13 @@ globals = {
|
|||
"_",
|
||||
}
|
||||
|
||||
stds.menu_common = {
|
||||
globals = {
|
||||
"mt_color_grey", "mt_color_blue", "mt_color_lightblue", "mt_color_green",
|
||||
"mt_color_dark_green", "mt_color_orange", "mt_color_red",
|
||||
},
|
||||
}
|
||||
|
||||
files["builtin/client/register.lua"] = {
|
||||
globals = {
|
||||
debug = {fields={"getinfo"}},
|
||||
|
@ -73,11 +80,16 @@ files["builtin/common/filterlist.lua"] = {
|
|||
}
|
||||
|
||||
files["builtin/mainmenu"] = {
|
||||
std = "+menu_common",
|
||||
globals = {
|
||||
"gamedata",
|
||||
},
|
||||
}
|
||||
|
||||
files["builtin/common/settings"] = {
|
||||
std = "+menu_common",
|
||||
}
|
||||
|
||||
files["builtin/common/tests"] = {
|
||||
read_globals = {
|
||||
"describe",
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
cmake_minimum_required(VERSION 3.12)
|
||||
if(POLICY CMP0177)
|
||||
cmake_policy(SET CMP0177 NEW)
|
||||
endif()
|
||||
|
||||
# This can be read from ${PROJECT_NAME} after project() is called
|
||||
project(luanti)
|
||||
|
@ -262,8 +265,8 @@ install(FILES "minetest.conf.example" DESTINATION "${EXAMPLE_CONF_DIR}")
|
|||
|
||||
if(UNIX AND NOT APPLE)
|
||||
install(FILES "doc/luanti.6" "doc/luantiserver.6" DESTINATION "${MANDIR}/man6")
|
||||
install(FILES "misc/net.minetest.minetest.desktop" DESTINATION "${XDG_APPS_DIR}")
|
||||
install(FILES "misc/net.minetest.minetest.metainfo.xml" DESTINATION "${METAINFODIR}")
|
||||
install(FILES "misc/org.luanti.luanti.desktop" DESTINATION "${XDG_APPS_DIR}")
|
||||
install(FILES "misc/org.luanti.luanti.metainfo.xml" DESTINATION "${METAINFODIR}")
|
||||
install(FILES "misc/luanti.svg" DESTINATION "${ICONDIR}/hicolor/scalable/apps")
|
||||
install(FILES "misc/luanti-xorg-icon-128.png"
|
||||
DESTINATION "${ICONDIR}/hicolor/128x128/apps"
|
||||
|
|
|
@ -106,6 +106,11 @@ grorp:
|
|||
textures/base/pack/place_btn.png
|
||||
derived by editing the text in aux1_btn.svg
|
||||
|
||||
Material Design, Google (Apache license v2.0):
|
||||
textures/base/pack/contentdb_thumb_up.png
|
||||
textures/base/pack/contentdb_thumb_down.png
|
||||
textures/base/pack/contentdb_neutral.png
|
||||
|
||||
License of Luanti source code
|
||||
-------------------------------
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ Some can be changed in the key config dialog in the settings tab.
|
|||
| T | Chat |
|
||||
| / | Command |
|
||||
| Esc | Pause menu/abort/exit (pauses only singleplayer game) |
|
||||
| Shift + Esc | Exit directly to main menu from anywhere, bypassing pause menu |
|
||||
| + | Increase view range |
|
||||
| - | Decrease view range |
|
||||
| K | Enable/disable fly mode (needs fly privilege) |
|
||||
|
|
|
@ -22,14 +22,19 @@ package net.minetest.minetest;
|
|||
|
||||
import org.libsdl.app.SDLActivity;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
|
@ -91,6 +96,9 @@ public class GameActivity extends SDLActivity {
|
|||
saveSettings();
|
||||
}
|
||||
|
||||
private NotificationManager mNotifyManager;
|
||||
private boolean gameNotificationShown = false;
|
||||
|
||||
public void showTextInputDialog(String hint, String current, int editType) {
|
||||
runOnUiThread(() -> showTextInputDialogUI(hint, current, editType));
|
||||
}
|
||||
|
@ -263,4 +271,67 @@ public class GameActivity extends SDLActivity {
|
|||
public boolean hasPhysicalKeyboard() {
|
||||
return getContext().getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS;
|
||||
}
|
||||
|
||||
// TODO: share code with UnzipService.createNotification
|
||||
private void updateGameNotification() {
|
||||
if (mNotifyManager == null) {
|
||||
mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
}
|
||||
|
||||
if (!gameNotificationShown) {
|
||||
mNotifyManager.cancel(MainActivity.NOTIFICATION_ID_GAME);
|
||||
return;
|
||||
}
|
||||
|
||||
Notification.Builder builder;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
builder = new Notification.Builder(this, MainActivity.NOTIFICATION_CHANNEL_ID);
|
||||
} else {
|
||||
builder = new Notification.Builder(this);
|
||||
}
|
||||
|
||||
Intent notificationIntent = new Intent(this, GameActivity.class);
|
||||
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
| Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
int pendingIntentFlag = 0;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
pendingIntentFlag = PendingIntent.FLAG_MUTABLE;
|
||||
}
|
||||
PendingIntent intent = PendingIntent.getActivity(this, 0,
|
||||
notificationIntent, pendingIntentFlag);
|
||||
|
||||
builder.setContentTitle(getString(R.string.game_notification_title))
|
||||
.setSmallIcon(R.mipmap.ic_launcher)
|
||||
.setContentIntent(intent)
|
||||
.setOngoing(true);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// This avoids a stuck notification if the app is killed while
|
||||
// in-game: (1) if the user closes the app from the "Recents" screen
|
||||
// or (2) if the system kills the app while it is in background.
|
||||
// onStop is called too early to remove the notification and
|
||||
// onDestroy is often not called at all, so there's this hack instead.
|
||||
builder.setTimeoutAfter(16000);
|
||||
|
||||
// Replace the notification just before it expires as long as the app is
|
||||
// running (and we're still in-game).
|
||||
final Handler handler = new Handler(Looper.getMainLooper());
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (gameNotificationShown) {
|
||||
updateGameNotification();
|
||||
}
|
||||
}
|
||||
}, 15000);
|
||||
}
|
||||
|
||||
mNotifyManager.notify(MainActivity.NOTIFICATION_ID_GAME, builder.build());
|
||||
}
|
||||
|
||||
|
||||
public void setPlayingNowNotification(boolean show) {
|
||||
gameNotificationShown = show;
|
||||
updateGameNotification();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,8 @@ import static net.minetest.minetest.UnzipService.*;
|
|||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
public static final String NOTIFICATION_CHANNEL_ID = "Minetest channel";
|
||||
public static final int NOTIFICATION_ID_UNZIP = 1;
|
||||
public static final int NOTIFICATION_ID_GAME = 2;
|
||||
|
||||
private final static int versionCode = BuildConfig.VERSION_CODE;
|
||||
private static final String SETTINGS = "MinetestSettings";
|
||||
|
|
|
@ -51,7 +51,6 @@ public class UnzipService extends IntentService {
|
|||
public static final int SUCCESS = -1;
|
||||
public static final int FAILURE = -2;
|
||||
public static final int INDETERMINATE = -3;
|
||||
private final int id = 1;
|
||||
private NotificationManager mNotifyManager;
|
||||
private boolean isSuccess = true;
|
||||
private String failureMessage;
|
||||
|
@ -100,11 +99,14 @@ public class UnzipService extends IntentService {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: share code with GameActivity.updateGameNotification
|
||||
@NonNull
|
||||
private Notification.Builder createNotification() {
|
||||
Notification.Builder builder;
|
||||
if (mNotifyManager == null)
|
||||
if (mNotifyManager == null) {
|
||||
mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
}
|
||||
|
||||
Notification.Builder builder;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
builder = new Notification.Builder(this, MainActivity.NOTIFICATION_CHANNEL_ID);
|
||||
} else {
|
||||
|
@ -128,7 +130,7 @@ public class UnzipService extends IntentService {
|
|||
.setOngoing(true)
|
||||
.setProgress(0, 0, true);
|
||||
|
||||
mNotifyManager.notify(id, builder.build());
|
||||
mNotifyManager.notify(MainActivity.NOTIFICATION_ID_UNZIP, builder.build());
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
@ -200,14 +202,14 @@ public class UnzipService extends IntentService {
|
|||
} else {
|
||||
notificationBuilder.setProgress(100, progress, false);
|
||||
}
|
||||
mNotifyManager.notify(id, notificationBuilder.build());
|
||||
mNotifyManager.notify(MainActivity.NOTIFICATION_ID_UNZIP, notificationBuilder.build());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
mNotifyManager.cancel(id);
|
||||
mNotifyManager.cancel(MainActivity.NOTIFICATION_ID_UNZIP);
|
||||
publishProgress(null, R.string.loading, isSuccess ? SUCCESS : FAILURE);
|
||||
}
|
||||
}
|
||||
|
|
11
android/app/src/main/res/values-br/strings.xml
Normal file
11
android/app/src/main/res/values-br/strings.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="unzip_notification_title">O kargañ Luanti</string>
|
||||
<string name="label">Luanti</string>
|
||||
<string name="loading">O kargañ…</string>
|
||||
<string name="notification_channel_description">Evezhiadennoù gant Luanti</string>
|
||||
<string name="unzip_notification_description">Nebeutoc\'h eget ur vunutenn…</string>
|
||||
<string name="ime_dialog_done">Graet</string>
|
||||
<string name="no_web_browser">Merdeer web ebet bet kavet</string>
|
||||
<string name="notification_channel_name">Evezhiadennoù hollek</string>
|
||||
</resources>
|
|
@ -1,11 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="label">Luanti</string>
|
||||
<string name="loading">Lädt…</string>
|
||||
<string name="loading">Laden …</string>
|
||||
<string name="unzip_notification_title">Luanti lädt</string>
|
||||
<string name="unzip_notification_description">Weniger als 1 Minute …</string>
|
||||
<string name="ime_dialog_done">Fertig</string>
|
||||
<string name="no_web_browser">Kein Web-Browser gefunden</string>
|
||||
<string name="no_web_browser">Keinen Web-Browser gefunden</string>
|
||||
<string name="notification_channel_name">Allgemeine Benachrichtigung</string>
|
||||
<string name="notification_channel_description">Benachrichtigungen von Luanti</string>
|
||||
<string name="game_notification_title">Luanti läuft</string>
|
||||
</resources>
|
|
@ -8,4 +8,5 @@
|
|||
<string name="unzip_notification_description">Moins d\'une minute…</string>
|
||||
<string name="ime_dialog_done">Terminé</string>
|
||||
<string name="no_web_browser">Aucun navigateur web trouvé</string>
|
||||
<string name="game_notification_title">Luanti est en cours d\'exécution</string>
|
||||
</resources>
|
||||
|
|
|
@ -8,4 +8,5 @@
|
|||
<string name="unzip_notification_description">Kurang dari 1 menit…</string>
|
||||
<string name="notification_channel_description">Pemberitahuan dari Luanti</string>
|
||||
<string name="unzip_notification_title">Memuat Luanti…</string>
|
||||
<string name="game_notification_title">Luanti sedang berjalan</string>
|
||||
</resources>
|
11
android/app/src/main/res/values-ro/strings.xml
Normal file
11
android/app/src/main/res/values-ro/strings.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="label">Luanti</string>
|
||||
<string name="loading">Se încarcă…</string>
|
||||
<string name="notification_channel_name">Notificare generală</string>
|
||||
<string name="notification_channel_description">Notificări de la Luanti</string>
|
||||
<string name="unzip_notification_title">Luanti pornește</string>
|
||||
<string name="unzip_notification_description">Sub 1 minut…</string>
|
||||
<string name="ime_dialog_done">Gata</string>
|
||||
<string name="no_web_browser">Niciun navigator web găsit</string>
|
||||
</resources>
|
|
@ -1,11 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="unzip_notification_title">Загрузка Luanti</string>
|
||||
<string name="unzip_notification_description">Меньше чам за 1 минуту…</string>
|
||||
<string name="unzip_notification_description">Менее 1 минуты…</string>
|
||||
<string name="ime_dialog_done">Готово</string>
|
||||
<string name="label">Luаnti</string>
|
||||
<string name="notification_channel_description">Уведомления от Luanti</string>
|
||||
<string name="notification_channel_name">Основные уведомления</string>
|
||||
<string name="loading">Загрузка…</string>
|
||||
<string name="no_web_browser">Не найдено веб-браузера</string>
|
||||
<string name="game_notification_title">Luanti запущено</string>
|
||||
</resources>
|
11
android/app/src/main/res/values-sl/strings.xml
Normal file
11
android/app/src/main/res/values-sl/strings.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="no_web_browser">Ni bil najden spletni brskalnik</string>
|
||||
<string name="notification_channel_name">Glavno obvestilo</string>
|
||||
<string name="loading">Nalaganje …</string>
|
||||
<string name="unzip_notification_description">Manj kot 1 minuta …</string>
|
||||
<string name="label">Luanti</string>
|
||||
<string name="notification_channel_description">Obvestilo od Luantia</string>
|
||||
<string name="ime_dialog_done">Končano!l</string>
|
||||
<string name="unzip_notification_title">Nalaganje Luantia</string>
|
||||
</resources>
|
|
@ -4,8 +4,9 @@
|
|||
<string name="loading">Laddar…</string>
|
||||
<string name="unzip_notification_description">Mindre än 1 minut…</string>
|
||||
<string name="ime_dialog_done">Färdig</string>
|
||||
<string name="no_web_browser">Ingen webbläsare kunde hittas</string>
|
||||
<string name="notification_channel_name">Generell notis</string>
|
||||
<string name="notification_channel_description">Notiser från Luanti</string>
|
||||
<string name="no_web_browser">Ingen webbläsare hittades</string>
|
||||
<string name="notification_channel_name">Allmän notifikation</string>
|
||||
<string name="notification_channel_description">Notifikationer från Luanti</string>
|
||||
<string name="unzip_notification_title">Laddar Luanti</string>
|
||||
<string name="game_notification_title">Luanti är igång</string>
|
||||
</resources>
|
|
@ -6,6 +6,7 @@
|
|||
<string name="notification_channel_description">Notifications from Luanti</string>
|
||||
<string name="unzip_notification_title">Loading Luanti</string>
|
||||
<string name="unzip_notification_description">Less than 1 minute…</string>
|
||||
<string name="game_notification_title">Luanti is running</string>
|
||||
<string name="ime_dialog_done">Done</string>
|
||||
<string name="no_web_browser">No web browser found</string>
|
||||
</resources>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
core.log("info", "Initializing asynchronous environment")
|
||||
|
||||
|
||||
function core.job_processor(func, serialized_param)
|
||||
local param = core.deserialize(serialized_param)
|
||||
|
||||
|
@ -7,3 +8,15 @@ function core.job_processor(func, serialized_param)
|
|||
|
||||
return retval or core.serialize(nil)
|
||||
end
|
||||
|
||||
|
||||
function core.get_http_accept_languages()
|
||||
local languages
|
||||
local current_language = core.get_language()
|
||||
if current_language ~= "" then
|
||||
languages = { current_language, "en;q=0.8" }
|
||||
else
|
||||
languages = { "en" }
|
||||
end
|
||||
return "Accept-Language: " .. table.concat(languages, ", ")
|
||||
end
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2013 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- TODO improve doc --
|
||||
|
|
15
builtin/common/menu.lua
Normal file
15
builtin/common/menu.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
-- Luanti
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
-- These colors are used by the main menu and the settings menu
|
||||
mt_color_grey = "#AAAAAA"
|
||||
mt_color_blue = "#6389FF"
|
||||
mt_color_lightblue = "#99CCFF"
|
||||
mt_color_green = "#72FF63"
|
||||
mt_color_dark_green = "#25C191"
|
||||
mt_color_orange = "#FF8800"
|
||||
mt_color_red = "#FF3300"
|
||||
|
||||
function core.are_keycodes_equal(k1, k2)
|
||||
return core.normalize_keycode(k1) == core.normalize_keycode(k2)
|
||||
end
|
|
@ -7,18 +7,21 @@ local math = math
|
|||
local function basic_dump(o)
|
||||
local tp = type(o)
|
||||
if tp == "number" then
|
||||
return tostring(o)
|
||||
local s = tostring(o)
|
||||
if tonumber(s) == o then
|
||||
return s
|
||||
end
|
||||
-- Prefer an exact representation over a compact representation.
|
||||
-- e.g. basic_dump(0.3) == "0.3",
|
||||
-- but basic_dump(0.1 + 0.2) == "0.30000000000000004"
|
||||
-- so the user can see that 0.1 + 0.2 ~= 0.3
|
||||
return string.format("%.17g", o)
|
||||
elseif tp == "string" then
|
||||
return string.format("%q", o)
|
||||
elseif tp == "boolean" then
|
||||
return tostring(o)
|
||||
elseif tp == "nil" then
|
||||
return "nil"
|
||||
-- Uncomment for full function dumping support.
|
||||
-- Not currently enabled because bytecode isn't very human-readable and
|
||||
-- dump's output is intended for humans.
|
||||
--elseif tp == "function" then
|
||||
-- return string.format("loadstring(%q)", string.dump(o))
|
||||
elseif tp == "userdata" then
|
||||
return tostring(o)
|
||||
else
|
||||
|
@ -105,65 +108,141 @@ function dump2(o, name, dumped)
|
|||
return string.format("%s = {}\n%s", name, table.concat(t))
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- This dumps values in a one-statement format.
|
||||
|
||||
-- This dumps values in a human-readable expression format.
|
||||
-- If possible, the resulting string should evaluate to an equivalent value if loaded and executed.
|
||||
-- For example, {test = {"Testing..."}} becomes:
|
||||
-- [[{
|
||||
-- test = {
|
||||
-- "Testing..."
|
||||
-- }
|
||||
-- }]]
|
||||
-- This supports tables as keys, but not circular references.
|
||||
-- It performs poorly with multiple references as it writes out the full
|
||||
-- table each time.
|
||||
-- The indent field specifies a indentation string, it defaults to a tab.
|
||||
-- Use the empty string to disable indentation.
|
||||
-- The dumped and level arguments are internal-only.
|
||||
|
||||
function dump(o, indent, nested, level)
|
||||
local t = type(o)
|
||||
if not level and t == "userdata" then
|
||||
-- when userdata (e.g. player) is passed directly, print its metatable:
|
||||
return "userdata metatable: " .. dump(getmetatable(o))
|
||||
end
|
||||
if t ~= "table" then
|
||||
return basic_dump(o)
|
||||
end
|
||||
|
||||
-- Contains table -> true/nil of currently nested tables
|
||||
nested = nested or {}
|
||||
if nested[o] then
|
||||
return "<circular reference>"
|
||||
end
|
||||
nested[o] = true
|
||||
function dump(value, indent)
|
||||
indent = indent or "\t"
|
||||
level = level or 1
|
||||
local newline = indent == "" and "" or "\n"
|
||||
|
||||
local ret = {}
|
||||
local dumped_indexes = {}
|
||||
for i, v in ipairs(o) do
|
||||
ret[#ret + 1] = dump(v, indent, nested, level + 1)
|
||||
dumped_indexes[i] = true
|
||||
end
|
||||
for k, v in pairs(o) do
|
||||
if not dumped_indexes[k] then
|
||||
if type(k) ~= "string" or not is_valid_identifier(k) then
|
||||
k = "["..dump(k, indent, nested, level + 1).."]"
|
||||
end
|
||||
v = dump(v, indent, nested, level + 1)
|
||||
ret[#ret + 1] = k.." = "..v
|
||||
local rope = {}
|
||||
local write
|
||||
do
|
||||
-- Keeping the length of the table as a local variable is *much*
|
||||
-- faster than invoking the length operator.
|
||||
-- See https://gitspartv.github.io/LuaJIT-Benchmarks/#test12.
|
||||
local i = 0
|
||||
function write(str)
|
||||
i = i + 1
|
||||
rope[i] = str
|
||||
end
|
||||
end
|
||||
nested[o] = nil
|
||||
if indent ~= "" then
|
||||
local indent_str = "\n"..string.rep(indent, level)
|
||||
local end_indent_str = "\n"..string.rep(indent, level - 1)
|
||||
return string.format("{%s%s%s}",
|
||||
indent_str,
|
||||
table.concat(ret, ","..indent_str),
|
||||
end_indent_str)
|
||||
|
||||
local n_refs = {}
|
||||
local function count_refs(val)
|
||||
if type(val) ~= "table" then
|
||||
return
|
||||
end
|
||||
return "{"..table.concat(ret, ", ").."}"
|
||||
local tbl = val
|
||||
if n_refs[tbl] then
|
||||
n_refs[tbl] = n_refs[tbl] + 1
|
||||
return
|
||||
end
|
||||
n_refs[tbl] = 1
|
||||
for k, v in pairs(tbl) do
|
||||
count_refs(k)
|
||||
count_refs(v)
|
||||
end
|
||||
end
|
||||
count_refs(value)
|
||||
|
||||
local refs = {}
|
||||
local cur_ref = 1
|
||||
local function write_value(val, level)
|
||||
if type(val) ~= "table" then
|
||||
write(basic_dump(val))
|
||||
return
|
||||
end
|
||||
|
||||
local tbl = val
|
||||
if refs[tbl] then
|
||||
write(refs[tbl])
|
||||
return
|
||||
end
|
||||
|
||||
if n_refs[val] > 1 then
|
||||
refs[val] = ("getref(%d)"):format(cur_ref)
|
||||
write(("setref(%d)"):format(cur_ref))
|
||||
cur_ref = cur_ref + 1
|
||||
end
|
||||
write("{")
|
||||
if next(tbl) == nil then
|
||||
write("}")
|
||||
return
|
||||
end
|
||||
write(newline)
|
||||
|
||||
local function write_entry(k, v)
|
||||
write(indent:rep(level))
|
||||
write("[")
|
||||
write_value(k, level + 1)
|
||||
write("] = ")
|
||||
write_value(v, level + 1)
|
||||
write(",")
|
||||
write(newline)
|
||||
end
|
||||
|
||||
local keys = {string = {}, number = {}}
|
||||
for k in pairs(tbl) do
|
||||
local t = type(k)
|
||||
if keys[t] then
|
||||
table.insert(keys[t], k)
|
||||
end
|
||||
end
|
||||
|
||||
-- Write string-keyed entries
|
||||
table.sort(keys.string)
|
||||
for _, k in ipairs(keys.string) do
|
||||
local v = val[k]
|
||||
if is_valid_identifier(k) then
|
||||
write(indent:rep(level))
|
||||
write(k)
|
||||
write(" = ")
|
||||
write_value(v, level + 1)
|
||||
write(",")
|
||||
write(newline)
|
||||
else
|
||||
write_entry(k, v)
|
||||
end
|
||||
end
|
||||
|
||||
-- Write number-keyed entries
|
||||
local len = 0
|
||||
for i in ipairs(tbl) do
|
||||
len = i
|
||||
end
|
||||
if #keys.number == len then -- table is a list
|
||||
for _, v in ipairs(tbl) do
|
||||
write(indent:rep(level))
|
||||
write_value(v, level + 1)
|
||||
write(",")
|
||||
write(newline)
|
||||
end
|
||||
else -- table harbors arbitrary number keys
|
||||
table.sort(keys.number)
|
||||
for _, k in ipairs(keys.number) do
|
||||
write_entry(k, tbl[k])
|
||||
end
|
||||
end
|
||||
|
||||
-- Write all remaining entries
|
||||
for k, v in pairs(val) do
|
||||
if not keys[type(k)] then
|
||||
write_entry(k, v)
|
||||
end
|
||||
end
|
||||
|
||||
write(indent:rep(level - 1))
|
||||
write("}")
|
||||
end
|
||||
write_value(value, 1)
|
||||
return table.concat(rope)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
@ -555,6 +634,10 @@ if core.gettext then -- for client and mainmenu
|
|||
function fgettext(text, ...)
|
||||
return core.formspec_escape(fgettext_ne(text, ...))
|
||||
end
|
||||
|
||||
function hgettext(text, ...)
|
||||
return core.hypertext_escape(fgettext_ne(text, ...))
|
||||
end
|
||||
end
|
||||
|
||||
local ESCAPE_CHAR = string.char(0x1b)
|
||||
|
|
|
@ -190,11 +190,41 @@ local function serialize(value, write)
|
|||
dump(value)
|
||||
end
|
||||
|
||||
-- Whether `value` recursively contains a function
|
||||
local function contains_function(value)
|
||||
local seen = {}
|
||||
local function check(val)
|
||||
if type(val) == "function" then
|
||||
return true
|
||||
end
|
||||
if type(val) == "table" then
|
||||
if seen[val] then
|
||||
return false
|
||||
end
|
||||
seen[val] = true
|
||||
for k, v in pairs(val) do
|
||||
if check(k) or check(v) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
return check(value)
|
||||
end
|
||||
|
||||
function core.serialize(value)
|
||||
if contains_function(value) then
|
||||
core.log("deprecated", "Support for dumping functions in `core.serialize` is deprecated.")
|
||||
end
|
||||
local rope = {}
|
||||
-- Keeping the length of the table as a local variable is *much*
|
||||
-- faster than invoking the length operator.
|
||||
-- See https://gitspartv.github.io/LuaJIT-Benchmarks/#test12.
|
||||
local i = 0
|
||||
serialize(value, function(text)
|
||||
-- Faster than table.insert(rope, text) on PUC Lua 5.1
|
||||
rope[#rope + 1] = text
|
||||
i = i + 1
|
||||
rope[i] = text
|
||||
end)
|
||||
return table_concat(rope)
|
||||
end
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2022 rubenwardy
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
local make = {}
|
||||
|
||||
|
@ -37,6 +24,7 @@ local make = {}
|
|||
-- * `fs` is a string for the formspec.
|
||||
-- Components should be relative to `0,0`, and not exceed `avail_w` or the returned `used_height`.
|
||||
-- * `used_height` is the space used by components in `fs`.
|
||||
-- * `spacing`: (Optional) the vertical margin to be added before the component (default 0.25)
|
||||
-- * `on_submit = function(self, fields, parent)`:
|
||||
-- * `fields`: submitted formspec fields
|
||||
-- * `parent`: the fstk element for the settings UI, use to show dialogs
|
||||
|
@ -442,6 +430,59 @@ local function make_noise_params(setting)
|
|||
}
|
||||
end
|
||||
|
||||
function make.key(setting)
|
||||
local btn_bind = "bind_" .. setting.name
|
||||
local btn_clear = "unbind_" .. setting.name
|
||||
local function add_conflict_warnings(fs, height)
|
||||
local value = core.settings:get(setting.name)
|
||||
if value == "" then
|
||||
return height
|
||||
end
|
||||
for _, o in ipairs(core.full_settingtypes) do
|
||||
if o.type == "key" and o.name ~= setting.name and core.are_keycodes_equal(core.settings:get(o.name), value) then
|
||||
table.insert(fs, ("label[0,%f;%s]"):format(height + 0.3,
|
||||
core.colorize(mt_color_orange, fgettext([[Conflicts with "$1"]], fgettext(o.readable_name)))))
|
||||
height = height + 0.6
|
||||
end
|
||||
end
|
||||
return height
|
||||
end
|
||||
return {
|
||||
info_text = setting.comment,
|
||||
setting = setting,
|
||||
spacing = 0.1,
|
||||
|
||||
get_formspec = function(self, avail_w)
|
||||
self.resettable = core.settings:has(setting.name)
|
||||
local btn_bind_width = math.max(2.5, avail_w/2)
|
||||
local value = core.settings:get(setting.name)
|
||||
local fs = {
|
||||
("label[0,0.4;%s]"):format(get_label(setting)),
|
||||
("button_key[%f,0;%f,0.8;%s;%s]"):format(
|
||||
btn_bind_width, btn_bind_width-0.8,
|
||||
btn_bind, core.formspec_escape(value)),
|
||||
("image_button[%f,0;0.8,0.8;%s;%s;]"):format(avail_w - 0.8,
|
||||
core.formspec_escape(defaulttexturedir .. "clear.png"),
|
||||
btn_clear),
|
||||
("tooltip[%s;%s]"):format(btn_clear, fgettext("Remove keybinding")),
|
||||
}
|
||||
local height = 0.8
|
||||
height = add_conflict_warnings(fs, height)
|
||||
return table.concat(fs), height
|
||||
end,
|
||||
|
||||
on_submit = function(self, fields)
|
||||
if fields[btn_bind] then
|
||||
core.settings:set(setting.name, fields[btn_bind])
|
||||
return true
|
||||
elseif fields[btn_clear] then
|
||||
core.settings:set(setting.name, "")
|
||||
return true
|
||||
end
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
if INIT == "pause_menu" then
|
||||
-- Making the noise parameter dialog work in the pause menu settings would
|
||||
-- require porting "FSTK" (at least the dialog API) from the mainmenu formspec
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2015 PilzAdam
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
|
||||
local checkboxes = {}
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2022 rubenwardy
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
|
||||
local path = core.get_builtin_path() .. "common" .. DIR_DELIM .. "settings" .. DIR_DELIM
|
||||
|
@ -22,7 +9,6 @@ local component_funcs = dofile(path .. "components.lua")
|
|||
local shadows_component = dofile(path .. "shadows_component.lua")
|
||||
|
||||
local loaded = false
|
||||
local full_settings
|
||||
local info_icon_path = core.formspec_escape(defaulttexturedir .. "settings_info.png")
|
||||
local reset_icon_path = core.formspec_escape(defaulttexturedir .. "settings_reset.png")
|
||||
local all_pages = {}
|
||||
|
@ -32,7 +18,7 @@ local filtered_page_by_id = page_by_id
|
|||
|
||||
|
||||
local function get_setting_info(name)
|
||||
for _, entry in ipairs(full_settings) do
|
||||
for _, entry in ipairs(core.full_settingtypes) do
|
||||
if entry.type ~= "category" and entry.name == name then
|
||||
return entry
|
||||
end
|
||||
|
@ -70,7 +56,7 @@ local function load_settingtypes()
|
|||
end
|
||||
end
|
||||
|
||||
for _, entry in ipairs(full_settings) do
|
||||
for _, entry in ipairs(core.full_settingtypes) do
|
||||
if entry.type == "category" then
|
||||
if entry.level == 0 then
|
||||
section = entry.name
|
||||
|
@ -104,24 +90,7 @@ local function load()
|
|||
end
|
||||
loaded = true
|
||||
|
||||
full_settings = settingtypes.parse_config_file(false, true)
|
||||
|
||||
local change_keys = {
|
||||
query_text = "Controls",
|
||||
requires = {
|
||||
keyboard_mouse = true,
|
||||
},
|
||||
context = "client",
|
||||
get_formspec = function(self, avail_w)
|
||||
local btn_w = math.min(avail_w, 3)
|
||||
return ("button[0,0;%f,0.8;btn_change_keys;%s]"):format(btn_w, fgettext("Controls")), 0.8
|
||||
end,
|
||||
on_submit = function(self, fields)
|
||||
if fields.btn_change_keys then
|
||||
core.show_keys_menu()
|
||||
end
|
||||
end,
|
||||
}
|
||||
core.full_settingtypes = settingtypes.parse_config_file(false, true)
|
||||
|
||||
local touchscreen_layout = {
|
||||
query_text = "Touchscreen layout",
|
||||
|
@ -166,7 +135,6 @@ 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
|
||||
|
@ -550,7 +518,7 @@ local function get_formspec(dialogdata)
|
|||
|
||||
("button[0,%f;%f,0.8;back;%s]"):format(
|
||||
tabsize.height + 0.2, back_w,
|
||||
INIT == "pause_menu" and fgettext("Exit") or fgettext("Back")),
|
||||
fgettext("Back")),
|
||||
|
||||
("box[%f,%f;%f,0.8;#0000008C]"):format(
|
||||
back_w + 0.2, tabsize.height + 0.2, checkbox_w),
|
||||
|
@ -665,7 +633,13 @@ local function get_formspec(dialogdata)
|
|||
fs[#fs + 1] = "container_end[]"
|
||||
|
||||
if used_h > 0 then
|
||||
y = y + used_h + 0.25
|
||||
local spacing = 0.25
|
||||
local next_comp = dialogdata.components[i + 1]
|
||||
if next_comp and next_comp.spacing then
|
||||
spacing = next_comp.spacing
|
||||
end
|
||||
|
||||
y = y + used_h + spacing
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -804,11 +778,11 @@ end
|
|||
|
||||
|
||||
if INIT == "mainmenu" then
|
||||
function create_settings_dlg()
|
||||
function create_settings_dlg(page_id)
|
||||
load()
|
||||
local dlg = dialog_create("dlg_settings", get_formspec, buttonhandler, eventhandler)
|
||||
|
||||
dlg.data.page_id = update_filtered_pages("")
|
||||
dlg.data.page_id = page_id or update_filtered_pages("")
|
||||
|
||||
return dlg
|
||||
end
|
||||
|
|
|
@ -61,7 +61,7 @@ local function create_minetest_conf_example(settings)
|
|||
end
|
||||
end
|
||||
if entry.type == "key" then
|
||||
local line = "See https://github.com/luanti-org/luanti/blob/master/irr/include/Keycodes.h"
|
||||
local line = "See https://docs.luanti.org/for-players/controls/"
|
||||
insert(result, "# " .. line .. "\n")
|
||||
end
|
||||
insert(result, "# type: " .. entry.type)
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2022 rubenwardy
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
local path = core.get_builtin_path() .. "common" .. DIR_DELIM .. "settings" .. DIR_DELIM
|
||||
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2015 PilzAdam
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
settingtypes = {}
|
||||
|
||||
|
@ -249,9 +236,9 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
|
|||
if not default then
|
||||
return "Invalid string setting"
|
||||
end
|
||||
if setting_type == "key" and not read_all then
|
||||
-- ignore key type if read_all is false
|
||||
return
|
||||
|
||||
if setting_type == "key" then
|
||||
requires.keyboard_mouse = true
|
||||
end
|
||||
|
||||
table.insert(settings, {
|
||||
|
@ -485,8 +472,6 @@ function settingtypes.parse_config_file(read_all, parse_mods)
|
|||
-- TODO: Support game/mod settings in the pause menu too
|
||||
-- Note that this will need to work different from how it's done in the
|
||||
-- mainmenu:
|
||||
-- * ~~Only if in singleplayer / on local server, not on remote servers~~
|
||||
-- (done now: context annotations)
|
||||
-- * Only show settings for the active game and mods
|
||||
-- (add API function to get them, can return nil if on a remote server)
|
||||
-- (names are probably not enough, will need paths for uniqueness)
|
||||
|
|
|
@ -1,20 +1,7 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2021-2 x2048
|
||||
-- Copyright (C) 2022-3 rubenwardy
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
|
||||
local shadow_levels_labels = {
|
||||
|
|
|
@ -230,3 +230,124 @@ describe("math", function()
|
|||
assert.equal(0, math.round(-0.49999999999999994))
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("dump", function()
|
||||
local function test_expression(expr)
|
||||
local chunk = assert(loadstring("return " .. expr))
|
||||
local refs = {}
|
||||
setfenv(chunk, {
|
||||
setref = function(id)
|
||||
refs[id] = {}
|
||||
return function(fields)
|
||||
for k, v in pairs(fields) do
|
||||
refs[id][k] = v
|
||||
end
|
||||
return refs[id]
|
||||
end
|
||||
end,
|
||||
getref = function(id)
|
||||
return assert(refs[id])
|
||||
end,
|
||||
})
|
||||
assert.equal(expr, dump(chunk()))
|
||||
end
|
||||
|
||||
it("nil", function()
|
||||
test_expression("nil")
|
||||
end)
|
||||
|
||||
it("booleans", function()
|
||||
test_expression("false")
|
||||
test_expression("true")
|
||||
end)
|
||||
|
||||
describe("numbers", function()
|
||||
it("formats integers nicely", function()
|
||||
test_expression("42")
|
||||
end)
|
||||
it("avoids misleading rounding", function()
|
||||
test_expression("0.3")
|
||||
assert.equal("0.30000000000000004", dump(0.1 + 0.2))
|
||||
end)
|
||||
end)
|
||||
|
||||
it("strings", function()
|
||||
test_expression('"hello world"')
|
||||
test_expression([["hello \"world\""]])
|
||||
end)
|
||||
|
||||
describe("tables", function()
|
||||
it("empty", function()
|
||||
test_expression("{}")
|
||||
end)
|
||||
|
||||
it("lists", function()
|
||||
test_expression([[
|
||||
{
|
||||
false,
|
||||
true,
|
||||
"foo",
|
||||
1,
|
||||
2,
|
||||
}]])
|
||||
end)
|
||||
|
||||
it("number keys", function()
|
||||
test_expression([[
|
||||
{
|
||||
[0.5] = false,
|
||||
[1.5] = true,
|
||||
[2.5] = "foo",
|
||||
}]])
|
||||
end)
|
||||
|
||||
it("dicts", function()
|
||||
test_expression([[{
|
||||
a = 1,
|
||||
b = 2,
|
||||
c = 3,
|
||||
}]])
|
||||
end)
|
||||
|
||||
it("mixed", function()
|
||||
test_expression([[{
|
||||
a = 1,
|
||||
b = 2,
|
||||
c = 3,
|
||||
["d e"] = true,
|
||||
"foo",
|
||||
"bar",
|
||||
}]])
|
||||
end)
|
||||
|
||||
it("nested", function()
|
||||
test_expression([[{
|
||||
a = {
|
||||
1,
|
||||
{},
|
||||
},
|
||||
b = "foo",
|
||||
c = {
|
||||
[0.5] = 0.1,
|
||||
[1.5] = 0.2,
|
||||
},
|
||||
}]])
|
||||
end)
|
||||
|
||||
it("circular references", function()
|
||||
test_expression([[setref(1){
|
||||
child = {
|
||||
parent = getref(1),
|
||||
},
|
||||
other_child = {
|
||||
parent = getref(1),
|
||||
},
|
||||
}]])
|
||||
end)
|
||||
|
||||
it("supports variable indent", function()
|
||||
assert.equal('{1,2,3,{foo = "bar",},}', dump({1, 2, 3, {foo = "bar"}}, ""))
|
||||
assert.equal('{\n "x",\n "y",\n}', dump({"x", "y"}, " "))
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
|
|
@ -93,7 +93,16 @@ describe("serialize", function()
|
|||
assert_preserves(test_in)
|
||||
end)
|
||||
|
||||
it("strips functions in safe mode", function()
|
||||
describe("safe mode", function()
|
||||
setup(function()
|
||||
assert(not core.log)
|
||||
-- logging a deprecation warning will be attempted
|
||||
function core.log() end
|
||||
end)
|
||||
teardown(function()
|
||||
core.log = nil
|
||||
end)
|
||||
it("functions are stripped", function()
|
||||
local test_in = {
|
||||
func = function(a, b)
|
||||
error("test")
|
||||
|
@ -109,6 +118,25 @@ describe("serialize", function()
|
|||
assert.is_nil(test_out.func)
|
||||
assert.equals(test_out.foo, "bar")
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("deprecation warnings", function()
|
||||
before_each(function()
|
||||
assert(not core.log)
|
||||
core.log = spy.new(function(level)
|
||||
assert(level == "deprecated")
|
||||
end)
|
||||
end)
|
||||
after_each(function()
|
||||
core.log = nil
|
||||
end)
|
||||
it("dumping functions", function()
|
||||
local t = {f = function() end, g = function() end}
|
||||
t.t = t
|
||||
core.serialize(t)
|
||||
assert.spy(core.log).was.called(1) -- should have been called exactly *once*
|
||||
end)
|
||||
end)
|
||||
|
||||
it("vectors work", function()
|
||||
local v = vector.new(1, 2, 3)
|
||||
|
|
|
@ -1,20 +1,7 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2014 sapier
|
||||
-- Copyright (C) 2023 Gregor Parzefall
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
|
||||
local BASE_SPACING = 0.1
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2014 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--this program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
local function dialog_event_handler(self,event)
|
||||
if self.user_eventhandler == nil or
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2014 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2014 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
ui = {}
|
||||
ui.childlist = {}
|
||||
|
@ -179,6 +166,10 @@ end
|
|||
--------------------------------------------------------------------------------
|
||||
--------------------------------------------------------------------------------
|
||||
core.button_handler = function(fields)
|
||||
if fields["try_quit"] and not fields["key_enter"] then
|
||||
core.event_handler("MenuQuit")
|
||||
return
|
||||
end
|
||||
if fields["btn_reconnect_yes"] then
|
||||
gamedata.reconnect_requested = false
|
||||
gamedata.errormessage = nil
|
||||
|
|
|
@ -46,6 +46,7 @@ core.features = {
|
|||
biome_weights = true,
|
||||
particle_blend_clip = true,
|
||||
remove_item_match_meta = true,
|
||||
httpfetch_additional_methods = true,
|
||||
}
|
||||
|
||||
function core.has_feature(arg)
|
||||
|
|
|
@ -513,7 +513,8 @@ function core.node_dig(pos, node, digger)
|
|||
.. node.name .. " at " .. core.pos_to_string(pos))
|
||||
|
||||
local wielded = digger and digger:get_wielded_item()
|
||||
local drops = core.get_node_drops(node, wielded and wielded:get_name())
|
||||
local drops = core.get_node_drops(node, wielded and wielded:get_name(),
|
||||
wielded and ItemStack(wielded), digger, vector.copy(pos))
|
||||
|
||||
if wielded then
|
||||
local wdef = wielded:get_definition()
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2014 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
-- Global menu data
|
||||
menudata = {}
|
||||
|
@ -34,7 +21,6 @@ function check_cache_age(key, max_age)
|
|||
end
|
||||
|
||||
function core.on_before_close()
|
||||
-- called before the menu is closed, either exit or to join a game
|
||||
cache_settings:write()
|
||||
end
|
||||
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2018-24 rubenwardy
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
if not core.get_http_api then
|
||||
return
|
||||
|
@ -41,6 +28,7 @@ contentdb = {
|
|||
REASON_DEPENDENCY = "dependency",
|
||||
}
|
||||
|
||||
-- API documentation: https://content.luanti.org/help/api/
|
||||
|
||||
local function get_download_url(package, reason)
|
||||
local base_url = core.settings:get("contentdb_url")
|
||||
|
@ -182,14 +170,16 @@ function contentdb.get_package_by_id(id)
|
|||
end
|
||||
|
||||
|
||||
function contentdb.calculate_package_id(type, author, name)
|
||||
local id = author:lower() .. "/"
|
||||
local function strip_game_suffix(type, name)
|
||||
if (type == nil or type == "game") and #name > 5 and name:sub(#name - 4) == "_game" then
|
||||
id = id .. name:sub(1, #name - 5)
|
||||
return name:sub(1, #name - 5)
|
||||
else
|
||||
id = id .. name
|
||||
return name
|
||||
end
|
||||
return id
|
||||
end
|
||||
|
||||
function contentdb.calculate_package_id(type, author, name)
|
||||
return author:lower() .. "/" .. strip_game_suffix(type, name)
|
||||
end
|
||||
|
||||
|
||||
|
@ -398,7 +388,6 @@ local function fetch_pkgs()
|
|||
local url = base_url ..
|
||||
"/api/packages/?type=mod&type=game&type=txp&protocol_version=" ..
|
||||
core.get_max_supp_proto() .. "&engine_version=" .. core.urlencode(version.string)
|
||||
|
||||
for _, item in pairs(core.settings:get("contentdb_flag_blacklist"):split(",")) do
|
||||
item = item:trim()
|
||||
if item ~= "" then
|
||||
|
@ -406,19 +395,11 @@ local function fetch_pkgs()
|
|||
end
|
||||
end
|
||||
|
||||
local languages
|
||||
local current_language = core.get_language()
|
||||
if current_language ~= "" then
|
||||
languages = { current_language, "en;q=0.8" }
|
||||
else
|
||||
languages = { "en" }
|
||||
end
|
||||
|
||||
local http = core.get_http_api()
|
||||
local response = http.fetch_sync({
|
||||
url = url,
|
||||
extra_headers = {
|
||||
"Accept-Language: " .. table.concat(languages, ", ")
|
||||
core.get_http_accept_languages()
|
||||
},
|
||||
})
|
||||
if not response.succeeded then
|
||||
|
@ -448,7 +429,7 @@ function contentdb.set_packages_from_api(packages)
|
|||
-- We currently don't support name changing
|
||||
local suffix = "/" .. package.name
|
||||
if alias:sub(-#suffix) == suffix then
|
||||
contentdb.aliases[alias:lower()] = package.id
|
||||
contentdb.aliases[strip_game_suffix(packages.type, alias:lower())] = package.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -596,27 +577,19 @@ function contentdb.filter_packages(query, by_type)
|
|||
end
|
||||
|
||||
|
||||
function contentdb.get_full_package_info(package, callback)
|
||||
local function get_package_info(key, path)
|
||||
return function(package, callback)
|
||||
assert(package)
|
||||
if package.full_info then
|
||||
callback(package.full_info)
|
||||
if package[key] then
|
||||
callback(package[key])
|
||||
return
|
||||
end
|
||||
|
||||
local function fetch(params)
|
||||
local version = core.get_version()
|
||||
local base_url = core.settings:get("contentdb_url")
|
||||
|
||||
local languages
|
||||
local current_language = core.get_language()
|
||||
if current_language ~= "" then
|
||||
languages = { current_language, "en;q=0.8" }
|
||||
else
|
||||
languages = { "en" }
|
||||
end
|
||||
|
||||
local url = base_url ..
|
||||
"/api/packages/" .. params.package.url_part .. "/for-client/?" ..
|
||||
"/api/packages/" .. params.package.url_part .. params.path .. "?" ..
|
||||
"protocol_version=" .. core.urlencode(core.get_max_supp_proto()) ..
|
||||
"&engine_version=" .. core.urlencode(version.string) ..
|
||||
"&formspec_version=" .. core.urlencode(core.get_formspec_version()) ..
|
||||
|
@ -625,7 +598,7 @@ function contentdb.get_full_package_info(package, callback)
|
|||
local response = http.fetch_sync({
|
||||
url = url,
|
||||
extra_headers = {
|
||||
"Accept-Language: " .. table.concat(languages, ", ")
|
||||
core.get_http_accept_languages()
|
||||
},
|
||||
})
|
||||
if not response.succeeded then
|
||||
|
@ -636,15 +609,20 @@ function contentdb.get_full_package_info(package, callback)
|
|||
end
|
||||
|
||||
local function my_callback(value)
|
||||
package.full_info = value
|
||||
package[key] = value
|
||||
callback(value)
|
||||
end
|
||||
|
||||
if not core.handle_async(fetch, { package = package }, my_callback) then
|
||||
if not core.handle_async(fetch, { package = package, path = path }, my_callback) then
|
||||
core.log("error", "ERROR: async event failed")
|
||||
callback(nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
contentdb.get_full_package_info = get_package_info("full_info", "/for-client/")
|
||||
contentdb.get_package_reviews = get_package_info("reviews", "/for-client/reviews/")
|
||||
|
||||
|
||||
function contentdb.get_formspec_padding()
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2018-20 rubenwardy
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
if not core.get_http_api then
|
||||
function create_contentdb_dlg()
|
||||
|
@ -323,9 +310,17 @@ local function get_formspec(dlgdata)
|
|||
})
|
||||
local img_w = cell_h * 3 / 2
|
||||
|
||||
-- Use as much of the available space as possible (so no padding on the
|
||||
-- right/bottom), but don't quite allow the text to touch the border.
|
||||
local text_w = cell_w - img_w - 0.25 - 0.025
|
||||
local text_h = cell_h - 0.25 - 0.025
|
||||
|
||||
local start_idx = (cur_page - 1) * num_per_page + 1
|
||||
for i=start_idx, math.min(#contentdb.packages, start_idx+num_per_page-1) do
|
||||
local package = contentdb.packages[i]
|
||||
local text = core.colorize(mt_color_green, package.title) ..
|
||||
core.colorize("#BFBFBF", " by " .. package.author) .. "\n" ..
|
||||
package.short_description
|
||||
|
||||
table.insert_all(formspec, {
|
||||
"container[",
|
||||
|
@ -340,13 +335,14 @@ local function get_formspec(dlgdata)
|
|||
"image[0,0;", img_w, ",", cell_h, ";",
|
||||
core.formspec_escape(get_screenshot(package, package.thumbnail, 2)), "]",
|
||||
|
||||
"label[", img_w + 0.25 + 0.05, ",0.5;",
|
||||
core.formspec_escape(
|
||||
core.colorize(mt_color_green, package.title) ..
|
||||
core.colorize("#BFBFBF", " by " .. package.author)), "]",
|
||||
"label[", img_w + 0.25, ",0.25;", text_w, ",", text_h, ";",
|
||||
core.formspec_escape(text), "]",
|
||||
|
||||
"textarea[", img_w + 0.25, ",0.75;", cell_w - img_w - 0.25, ",", cell_h - 0.75, ";;;",
|
||||
core.formspec_escape(package.short_description), "]",
|
||||
-- Add a tooltip in case the label overflows and the short description is cut off.
|
||||
"tooltip[", img_w + 0.25, ",0.25;", text_w, ",", text_h, ";",
|
||||
-- Text in tooltips doesn't wrap automatically, so we do it manually to
|
||||
-- avoid everything being one long line.
|
||||
core.formspec_escape(core.wrap_text(package.short_description, 80)), "]",
|
||||
|
||||
"style[view_", i, ";border=false]",
|
||||
"style[view_", i, ":hovered;bgimg=", core.formspec_escape(defaulttexturedir .. "button_hover_semitrans.png"), "]",
|
||||
|
@ -362,7 +358,7 @@ local function get_formspec(dlgdata)
|
|||
end
|
||||
|
||||
table.insert_all(formspec, {
|
||||
"container[", cell_w - 0.625,",", 0.25, "]",
|
||||
"container[", cell_w - 0.625,",", 0.125, "]",
|
||||
})
|
||||
|
||||
if package.downloading then
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2018-24 rubenwardy
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
local function is_still_visible(dlg)
|
||||
local this = ui.find_by_name("install_dialog")
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2018-24 rubenwardy
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
function get_formspec(data)
|
||||
local package = data.package
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2018-24 rubenwardy
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
|
||||
local function get_info_formspec(size, padding, text)
|
||||
|
@ -32,6 +19,7 @@ end
|
|||
|
||||
|
||||
local function get_formspec(data)
|
||||
local package = data.package
|
||||
local window_padding = contentdb.get_formspec_padding()
|
||||
local size = contentdb.get_formspec_size()
|
||||
size.x = math.min(size.x, 20)
|
||||
|
@ -42,7 +30,7 @@ local function get_formspec(data)
|
|||
if not data.loading and not data.loading_error then
|
||||
data.loading = true
|
||||
|
||||
contentdb.get_full_package_info(data.package, function(info)
|
||||
contentdb.get_full_package_info(package, function(info)
|
||||
data.loading = false
|
||||
|
||||
if info == nil then
|
||||
|
@ -61,7 +49,7 @@ local function get_formspec(data)
|
|||
-- check to see if that happened
|
||||
if not data.info then
|
||||
if data.loading_error then
|
||||
return get_info_formspec(size, window_padding, fgettext("No packages could be retrieved"))
|
||||
return get_info_formspec(size, window_padding, fgettext("Error loading package information"))
|
||||
end
|
||||
return get_info_formspec(size, window_padding, fgettext("Loading..."))
|
||||
end
|
||||
|
@ -103,15 +91,15 @@ local function get_formspec(data)
|
|||
|
||||
local left_button_rect = "0,0;2.875,1"
|
||||
local right_button_rect = "3.125,0;2.875,1"
|
||||
if data.package.downloading then
|
||||
if package.downloading then
|
||||
formspec[#formspec + 1] = "animated_image[5,0;1,1;downloading;"
|
||||
formspec[#formspec + 1] = core.formspec_escape(defaulttexturedir)
|
||||
formspec[#formspec + 1] = "cdb_downloading.png;3;400;]"
|
||||
elseif data.package.queued then
|
||||
elseif package.queued then
|
||||
formspec[#formspec + 1] = "style[queued;border=false]"
|
||||
formspec[#formspec + 1] = "image_button[5,0;1,1;" .. core.formspec_escape(defaulttexturedir)
|
||||
formspec[#formspec + 1] = "cdb_queued.png;queued;]"
|
||||
elseif not data.package.path then
|
||||
elseif not package.path then
|
||||
formspec[#formspec + 1] = "style[install;bgcolor=green]"
|
||||
formspec[#formspec + 1] = "button["
|
||||
formspec[#formspec + 1] = right_button_rect
|
||||
|
@ -119,7 +107,7 @@ local function get_formspec(data)
|
|||
formspec[#formspec + 1] = fgettext("Install [$1]", info.download_size)
|
||||
formspec[#formspec + 1] = "]"
|
||||
else
|
||||
if data.package.installed_release < data.package.release then
|
||||
if package.installed_release < package.release then
|
||||
-- The install_ action also handles updating
|
||||
formspec[#formspec + 1] = "style[install;bgcolor=#28ccdf]"
|
||||
formspec[#formspec + 1] = "button["
|
||||
|
@ -137,10 +125,12 @@ local function get_formspec(data)
|
|||
formspec[#formspec + 1] = "]"
|
||||
end
|
||||
|
||||
local review_count = info.reviews.positive + info.reviews.neutral + info.reviews.negative
|
||||
local current_tab = data.current_tab or 1
|
||||
local tab_titles = {
|
||||
fgettext("Description"),
|
||||
fgettext("Information"),
|
||||
fgettext("Reviews") .. core.formspec_escape(" [" .. review_count .. "]"),
|
||||
}
|
||||
|
||||
local tab_body_height = bottom_buttons_y - 2.8
|
||||
|
@ -162,7 +152,7 @@ local function get_formspec(data)
|
|||
local winfo = core.get_window_info()
|
||||
local fs_to_px = winfo.size.x / winfo.max_formspec_size.x
|
||||
for i, ss in ipairs(info.screenshots) do
|
||||
local path = get_screenshot(data.package, ss.url, 2)
|
||||
local path = get_screenshot(package, ss.url, 2)
|
||||
hypertext = hypertext .. "<action name=\"ss_".. i .. "\"><img name=\"" ..
|
||||
core.hypertext_escape(path) .. "\" width=" .. (3 * fs_to_px) ..
|
||||
" height=" .. (2 * fs_to_px) .. "></action>"
|
||||
|
@ -194,22 +184,54 @@ local function get_formspec(data)
|
|||
|
||||
hypertext = hypertext .. "\n\n" .. info.long_description.body
|
||||
|
||||
-- Fix the path to blank.png. This is needed for bullet indentation.
|
||||
hypertext = hypertext:gsub("<img name=\"?blank.png\"? ",
|
||||
"<img name=\"" .. core.hypertext_escape(defaulttexturedir) .. "blank.png\" ")
|
||||
|
||||
table.insert_all(formspec, {
|
||||
"hypertext[0,0;", W, ",", tab_body_height - 0.375,
|
||||
";desc;", core.formspec_escape(hypertext), "]",
|
||||
|
||||
})
|
||||
|
||||
elseif current_tab == 2 then
|
||||
local hypertext = info.info_hypertext.head .. info.info_hypertext.body
|
||||
|
||||
table.insert_all(formspec, {
|
||||
"hypertext[0,0;", W, ",", tab_body_height - 0.375,
|
||||
";info;", core.formspec_escape(hypertext), "]",
|
||||
})
|
||||
elseif current_tab == 3 then
|
||||
if not package.reviews and not data.reviews_error and not data.reviews_loading then
|
||||
data.reviews_loading = true
|
||||
|
||||
contentdb.get_package_reviews(package, function(reviews)
|
||||
if not reviews then
|
||||
data.reviews_error = true
|
||||
end
|
||||
ui.update()
|
||||
end)
|
||||
end
|
||||
|
||||
if package.reviews then
|
||||
local hypertext = package.reviews.head .. package.reviews.body
|
||||
-- Provide correct path to blank.png image. This is needed for bullet indentation.
|
||||
hypertext = hypertext:gsub("<img name=\"?blank.png\"? ",
|
||||
"<img name=\"" .. core.hypertext_escape(defaulttexturedir) .. "blank.png\" ")
|
||||
-- Placeholders in reviews hypertext for icons
|
||||
hypertext = hypertext:gsub("<thumbsup>",
|
||||
"<img name=\"" .. core.hypertext_escape(defaulttexturedir) .. "contentdb_thumb_up.png\" width=24>")
|
||||
hypertext = hypertext:gsub("<thumbsdown>",
|
||||
"<img name=\"" .. core.hypertext_escape(defaulttexturedir) .. "contentdb_thumb_down.png\" width=24>")
|
||||
hypertext = hypertext:gsub("<neutral>",
|
||||
"<img name=\"" .. core.hypertext_escape(defaulttexturedir) .. "contentdb_neutral.png\" width=24>")
|
||||
table.insert_all(formspec, {
|
||||
"hypertext[0,0;", W, ",", tab_body_height - 0.375,
|
||||
";reviews;", core.formspec_escape(hypertext), "]",
|
||||
})
|
||||
elseif data.reviews_error then
|
||||
table.insert_all(formspec, {"label[2,2;", fgettext("Error loading reviews"), "]"} )
|
||||
else
|
||||
table.insert_all(formspec, {"label[2,2;", fgettext("Loading..."), "]"} )
|
||||
end
|
||||
else
|
||||
error("Unknown tab " .. current_tab)
|
||||
end
|
||||
|
@ -269,9 +291,10 @@ local function handle_submit(this, fields)
|
|||
end
|
||||
|
||||
if fields.open_contentdb then
|
||||
local url = ("%s/packages/%s/?protocol_version=%d"):format(
|
||||
core.settings:get("contentdb_url"), package.url_part,
|
||||
core.get_max_supp_proto())
|
||||
local version = core.get_version()
|
||||
local url = core.settings:get("contentdb_url") .. "/packages/" .. package.url_part ..
|
||||
"/?protocol_version=" .. core.urlencode(core.get_max_supp_proto()) ..
|
||||
"&engine_version=" .. core.urlencode(version.string)
|
||||
core.open_url(url)
|
||||
return true
|
||||
end
|
||||
|
@ -295,7 +318,8 @@ local function handle_submit(this, fields)
|
|||
end
|
||||
|
||||
if handle_hypertext_event(this, fields.desc, info.long_description) or
|
||||
handle_hypertext_event(this, fields.info, info.info_hypertext) then
|
||||
handle_hypertext_event(this, fields.info, info.info_hypertext) or
|
||||
(package.reviews and handle_hypertext_event(this, fields.reviews, package.reviews)) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2023 rubenwardy
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
local path = core.get_mainmenu_path() .. DIR_DELIM .. "content"
|
||||
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2013 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
local function get_last_folder(text,count)
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2023-24 rubenwardy
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
|
||||
-- Screenshot
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2022 rubenwardy
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
local mods_dir = "/tmp/.minetest/mods"
|
||||
local games_dir = "/tmp/.minetest/games"
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2023 rubenwardy
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
|
||||
update_detector = {}
|
||||
|
|
|
@ -47,22 +47,20 @@
|
|||
],
|
||||
"#": "For updating active/previous contributors, see the script in ./util/gather_git_credits.py",
|
||||
"contributors": [
|
||||
"JosiahWI",
|
||||
"Erich Schubert",
|
||||
"wrrrzr",
|
||||
"1F616EMO",
|
||||
"red-001 <red-001@outlook.ie>",
|
||||
"veprogames",
|
||||
"paradust7",
|
||||
"AFCMS",
|
||||
"siliconsniffer",
|
||||
"Wuzzy",
|
||||
"Zemtzov7"
|
||||
"JosiahWI",
|
||||
"veprogames",
|
||||
"Miguel P.L",
|
||||
"AFCMS"
|
||||
],
|
||||
"previous_contributors": [
|
||||
"Ælla Chiana Moskopp (erle) <erle@dieweltistgarnichtso.net> [Logo]",
|
||||
"numzero",
|
||||
"red-001 <red-001@outlook.ie>",
|
||||
"Giuseppe Bilotta",
|
||||
"HybridDog",
|
||||
"ClobberXD",
|
||||
"Dániel Juhász (juhdanad) <juhdanad@gmail.com>",
|
||||
"MirceaKitsune <mirceakitsune@gmail.com>",
|
||||
|
@ -75,6 +73,7 @@
|
|||
"stujones11",
|
||||
"Rogier <rogier777@gmail.com>",
|
||||
"Gregory Currie (gregorycu)",
|
||||
"paradust7",
|
||||
"JacobF",
|
||||
"Jeija <jeija@mesecons.net>"
|
||||
]
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2013 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2014 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
local function table_to_flags(ftable)
|
||||
-- Convert e.g. { jungles = true, caves = false } to "jungles,nocaves"
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2014 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2014 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
|
||||
local function delete_world_formspec(dialogdata)
|
||||
|
|
108
builtin/mainmenu/dlg_rebind_keys.lua
Normal file
108
builtin/mainmenu/dlg_rebind_keys.lua
Normal file
|
@ -0,0 +1,108 @@
|
|||
-- Luanti
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
-- Modified based on dlg_reinstall_mtg.lua
|
||||
-- Note that this is only needed for migrating from <5.11 to 5.12.
|
||||
|
||||
local doc_url = "https://docs.luanti.org/for-players/controls/"
|
||||
local SETTING_NAME = "no_keycode_migration_warning"
|
||||
|
||||
local function get_formspec(dialogdata)
|
||||
local markup = table.concat({
|
||||
"<big>" .. hgettext("Keybindings changed") .. "</big>",
|
||||
hgettext("The input handling system was reworked in Luanti 5.12.0."),
|
||||
hgettext("As a result, your keybindings may have been changed."),
|
||||
hgettext("Check out the key settings or refer to the documentation:"),
|
||||
("<action name='doc_url'><style color='cyan' hovercolor='orangered'>%s</style></action>"):format(doc_url),
|
||||
}, "\n")
|
||||
|
||||
return table.concat({
|
||||
"formspec_version[6]",
|
||||
"size[12,7]",
|
||||
"hypertext[0.5,0.5;11,4.7;text;", core.formspec_escape(markup), "]",
|
||||
"container[0.5,5.7]",
|
||||
"button[0,0;4,0.8;dismiss;", fgettext("Close"), "]",
|
||||
"button[4.5,0;6.5,0.8;reconfigure;", fgettext("Open settings"), "]",
|
||||
"container_end[]",
|
||||
})
|
||||
end
|
||||
|
||||
local function close_dialog(this)
|
||||
cache_settings:set_bool(SETTING_NAME, true)
|
||||
this:delete()
|
||||
end
|
||||
|
||||
local function buttonhandler(this, fields)
|
||||
if fields.reconfigure then
|
||||
close_dialog(this)
|
||||
|
||||
local maintab = ui.find_by_name("maintab")
|
||||
|
||||
local dlg = create_settings_dlg("controls_keyboard_and_mouse")
|
||||
dlg:set_parent(maintab)
|
||||
maintab:hide()
|
||||
dlg:show()
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
if fields.dismiss then
|
||||
close_dialog(this)
|
||||
return true
|
||||
end
|
||||
|
||||
if fields.text == "action:doc_url" then
|
||||
core.open_url(doc_url)
|
||||
end
|
||||
end
|
||||
|
||||
local function eventhandler(event)
|
||||
if event == "DialogShow" then
|
||||
mm_game_theme.set_engine()
|
||||
return true
|
||||
elseif event == "MenuQuit" then
|
||||
-- Don't allow closing the dialog with ESC, but still allow exiting
|
||||
-- Luanti
|
||||
core.close()
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function create_rebind_keys_dlg()
|
||||
local dlg = dialog_create("dlg_rebind_keys", get_formspec,
|
||||
buttonhandler, eventhandler)
|
||||
return dlg
|
||||
end
|
||||
|
||||
function migrate_keybindings()
|
||||
-- Show migration dialog if the user upgraded from an earlier version
|
||||
-- and this has not yet been shown before, *or* if keys settings had to be changed
|
||||
if core.is_first_run then
|
||||
cache_settings:set_bool(SETTING_NAME, true)
|
||||
end
|
||||
local has_migration = not cache_settings:get_bool(SETTING_NAME)
|
||||
|
||||
-- normalize all existing key settings, this converts them from KEY_KEY_C to SYSTEM_SCANCODE_6
|
||||
local settings = core.settings:to_table()
|
||||
for name, value in pairs(settings) do
|
||||
if name:match("^keymap_") then
|
||||
local normalized = core.normalize_keycode(value)
|
||||
if value ~= normalized then
|
||||
has_migration = true
|
||||
core.settings:set(name, normalized)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not has_migration then
|
||||
return
|
||||
end
|
||||
|
||||
local maintab = ui.find_by_name("maintab")
|
||||
|
||||
local dlg = create_rebind_keys_dlg()
|
||||
dlg:set_parent(maintab)
|
||||
maintab:hide()
|
||||
dlg:show()
|
||||
ui.update()
|
||||
end
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2022 rubenwardy
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2023 Gregor Parzefall
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
---- IMPORTANT ----
|
||||
-- This whole file can be removed after a while.
|
||||
|
@ -67,10 +54,10 @@ end
|
|||
|
||||
local function get_formspec(dialogdata)
|
||||
local markup = table.concat({
|
||||
"<big>", fgettext("Minetest Game is no longer installed by default"), "</big>\n",
|
||||
fgettext("For a long time, Luanti shipped with a default game called \"Minetest Game\". " ..
|
||||
"<big>", hgettext("Minetest Game is no longer installed by default"), "</big>\n",
|
||||
hgettext("For a long time, Luanti shipped with a default game called \"Minetest Game\". " ..
|
||||
"Since version 5.8.0, Luanti ships without a default game."), "\n",
|
||||
fgettext("If you want to continue playing in your Minetest Game worlds, you need to reinstall Minetest Game."),
|
||||
hgettext("If you want to continue playing in your Minetest Game worlds, you need to reinstall Minetest Game."),
|
||||
})
|
||||
|
||||
return table.concat({
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2014 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2013 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
|
||||
mm_game_theme = {}
|
||||
|
|
|
@ -1,27 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2014 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
mt_color_grey = "#AAAAAA"
|
||||
mt_color_blue = "#6389FF"
|
||||
mt_color_lightblue = "#99CCFF"
|
||||
mt_color_green = "#72FF63"
|
||||
mt_color_dark_green = "#25C191"
|
||||
mt_color_orange = "#FF8800"
|
||||
mt_color_red = "#FF3300"
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
MAIN_TAB_W = 15.5
|
||||
MAIN_TAB_H = 7.1
|
||||
|
@ -35,6 +14,7 @@ local basepath = core.get_builtin_path()
|
|||
defaulttexturedir = core.get_texturepath_share() .. DIR_DELIM .. "base" ..
|
||||
DIR_DELIM .. "pack" .. DIR_DELIM
|
||||
|
||||
dofile(basepath .. "common" .. DIR_DELIM .. "menu.lua")
|
||||
dofile(basepath .. "common" .. DIR_DELIM .. "filterlist.lua")
|
||||
dofile(basepath .. "fstk" .. DIR_DELIM .. "buttonbar.lua")
|
||||
dofile(basepath .. "fstk" .. DIR_DELIM .. "dialog.lua")
|
||||
|
@ -55,6 +35,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_rebind_keys.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "dlg_clients_list.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "dlg_server_list_mods.lua")
|
||||
|
||||
|
@ -132,6 +113,7 @@ local function init_globals()
|
|||
ui.update()
|
||||
|
||||
check_reinstall_mtg()
|
||||
migrate_keybindings()
|
||||
check_new_version()
|
||||
end
|
||||
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2020 rubenwardy
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
serverlistmgr = {
|
||||
-- continent code we detected for ourselves
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2013 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
|
||||
local function prepare_credits(dest, source)
|
||||
|
|
|
@ -1,20 +1,7 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2014 sapier
|
||||
-- Copyright (C) 2018 rubenwardy <rw@rubenwardy.com>
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
|
||||
local function get_content_icons(packages_with_updates)
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2014 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
|
||||
local current_game, singleplayer_refresh_gamebar
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2014 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
local function get_sorted_servers()
|
||||
local servers = {
|
||||
|
|
|
@ -8,5 +8,6 @@ defaulttexturedir = ""
|
|||
local builtin_shared = {}
|
||||
|
||||
assert(loadfile(commonpath .. "register.lua"))(builtin_shared)
|
||||
assert(loadfile(commonpath .. "menu.lua"))(builtin_shared)
|
||||
assert(loadfile(pausepath .. "register.lua"))(builtin_shared)
|
||||
dofile(commonpath .. "settings" .. DIR_DELIM .. "init.lua")
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2016 T4im
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
local S = core.get_translator("__builtin")
|
||||
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2016 T4im
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
local format, pairs, type = string.format, pairs, type
|
||||
local core, get_current_modname = core, core.get_current_modname
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2016 T4im
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
local S = core.get_translator("__builtin")
|
||||
-- Note: In this file, only messages are translated
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
-- Luanti
|
||||
-- Copyright (C) 2016 T4im
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
local setmetatable = setmetatable
|
||||
local pairs, format = pairs, string.format
|
||||
local min, max, huge = math.min, math.max, math.huge
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
# - enum
|
||||
# - path
|
||||
# - filepath
|
||||
# - key (will be ignored in GUI, since a special key change dialog exists)
|
||||
# - key
|
||||
# - flags
|
||||
# - noise_params_2d
|
||||
# - noise_params_3d
|
||||
|
@ -91,6 +91,8 @@
|
|||
# * touchscreen / keyboard_mouse
|
||||
# * opengl / gles
|
||||
# * You can negate any requirement by prepending with !
|
||||
# * The "keyboard_mouse" requirement is automatically added to settings with the
|
||||
# "key" type.
|
||||
#
|
||||
# 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]
|
||||
|
@ -178,6 +180,228 @@ enable_hotbar_mouse_wheel (Hotbar: Enable mouse wheel for selection) bool true
|
|||
# Requires: keyboard_mouse
|
||||
invert_hotbar_mouse_wheel (Hotbar: Invert mouse wheel direction) bool false
|
||||
|
||||
[**Keybindings]
|
||||
|
||||
# Key for moving the player forward.
|
||||
keymap_forward (Move forward) key SYSTEM_SCANCODE_26
|
||||
|
||||
# Key for moving the player backward.
|
||||
# Will also disable autoforward, when active.
|
||||
keymap_backward (Move backward) key SYSTEM_SCANCODE_22
|
||||
|
||||
# Key for moving the player left.
|
||||
keymap_left (Move left) key SYSTEM_SCANCODE_4
|
||||
|
||||
# Key for moving the player right.
|
||||
keymap_right (Move right) key SYSTEM_SCANCODE_7
|
||||
|
||||
# Key for jumping.
|
||||
keymap_jump (Jump) key SYSTEM_SCANCODE_44
|
||||
|
||||
# Key for sneaking.
|
||||
# Also used for climbing down and descending in water if aux1_descends is disabled.
|
||||
keymap_sneak (Sneak) key SYSTEM_SCANCODE_225
|
||||
|
||||
# Key for digging, punching or using something.
|
||||
# (Note: The actual meaning might vary on a per-game basis.)
|
||||
keymap_dig (Dig/punch/use) key KEY_LBUTTON
|
||||
|
||||
# Key for placing an item/block or for using something.
|
||||
# (Note: The actual meaning might vary on a per-game basis.)
|
||||
keymap_place (Place/use) key KEY_RBUTTON
|
||||
|
||||
# Key for opening the inventory.
|
||||
keymap_inventory (Open inventory) key SYSTEM_SCANCODE_12
|
||||
|
||||
# Key for moving fast in fast mode.
|
||||
keymap_aux1 (Aux1) key SYSTEM_SCANCODE_8
|
||||
|
||||
# Key for opening the chat window.
|
||||
keymap_chat (Open chat) key SYSTEM_SCANCODE_23
|
||||
|
||||
# Key for opening the chat window to type commands.
|
||||
keymap_cmd (Command) key SYSTEM_SCANCODE_56
|
||||
|
||||
# Key for opening the chat window to type local commands.
|
||||
keymap_cmd_local (Local command) key SYSTEM_SCANCODE_55
|
||||
|
||||
# Key for toggling unlimited view range.
|
||||
keymap_rangeselect (Range select) key
|
||||
|
||||
# Key for toggling flying.
|
||||
keymap_freemove (Toggle fly) key SYSTEM_SCANCODE_14
|
||||
|
||||
# Key for toggling pitch move mode.
|
||||
keymap_pitchmove (Toggle pitchmove) key
|
||||
|
||||
# Key for toggling fast mode.
|
||||
keymap_fastmove (Toggle fast) key SYSTEM_SCANCODE_13
|
||||
|
||||
# Key for toggling noclip mode.
|
||||
keymap_noclip (Toggle noclip) key SYSTEM_SCANCODE_11
|
||||
|
||||
# Key for selecting the next item in the hotbar.
|
||||
keymap_hotbar_next (Hotbar: select next item) key SYSTEM_SCANCODE_17
|
||||
|
||||
# Key for selecting the previous item in the hotbar.
|
||||
keymap_hotbar_previous (Hotbar: select previous item) key SYSTEM_SCANCODE_5
|
||||
|
||||
# Key for muting the game.
|
||||
keymap_mute (Mute) key SYSTEM_SCANCODE_16
|
||||
|
||||
# Key for increasing the volume.
|
||||
keymap_increase_volume (Increase volume) key
|
||||
|
||||
# Key for decreasing the volume.
|
||||
keymap_decrease_volume (Decrease volume) key
|
||||
|
||||
# Key for toggling autoforward.
|
||||
keymap_autoforward (Toggle automatic forward) key
|
||||
|
||||
# Key for toggling cinematic mode.
|
||||
keymap_cinematic (Toggle cinematic mode) key
|
||||
|
||||
# Key for toggling display of minimap.
|
||||
keymap_minimap (Toggle minimap) key SYSTEM_SCANCODE_25
|
||||
|
||||
# Key for taking screenshots.
|
||||
keymap_screenshot (Screenshot) key SYSTEM_SCANCODE_69
|
||||
|
||||
# Key for toggling fullscreen mode.
|
||||
keymap_fullscreen (Toggle fullscreen) key SYSTEM_SCANCODE_68
|
||||
|
||||
# Key for dropping the currently selected item.
|
||||
keymap_drop (Drop item) key SYSTEM_SCANCODE_20
|
||||
|
||||
# Key to use view zoom when possible.
|
||||
keymap_zoom (Zoom) key SYSTEM_SCANCODE_29
|
||||
|
||||
# Key for toggling the display of the HUD.
|
||||
keymap_toggle_hud (Toggle HUD) key SYSTEM_SCANCODE_58
|
||||
|
||||
# Key for toggling the display of chat.
|
||||
keymap_toggle_chat (Toggle chat log) key SYSTEM_SCANCODE_59
|
||||
|
||||
# Key for toggling the display of the large chat console.
|
||||
keymap_console (Large chat console) key SYSTEM_SCANCODE_67
|
||||
|
||||
# Key for toggling the display of fog.
|
||||
keymap_toggle_fog (Toggle fog) key SYSTEM_SCANCODE_60
|
||||
|
||||
# Key for toggling the display of debug info.
|
||||
keymap_toggle_debug (Toggle debug info) key SYSTEM_SCANCODE_62
|
||||
|
||||
# Key for toggling the display of the profiler. Used for development.
|
||||
keymap_toggle_profiler (Toggle profiler) key SYSTEM_SCANCODE_63
|
||||
|
||||
# Key for toggling the display of mapblock boundaries.
|
||||
keymap_toggle_block_bounds (Toggle block bounds) key
|
||||
|
||||
# Key for switching between first- and third-person camera.
|
||||
keymap_camera_mode (Toggle camera mode) key SYSTEM_SCANCODE_6
|
||||
|
||||
# Key for increasing the viewing range.
|
||||
keymap_increase_viewing_range_min (Increase view range) key SYSTEM_SCANCODE_46
|
||||
|
||||
# Key for decreasing the viewing range.
|
||||
keymap_decrease_viewing_range_min (Decrease view range) key SYSTEM_SCANCODE_45
|
||||
|
||||
# Key for selecting the first hotbar slot.
|
||||
keymap_slot1 (Hotbar slot 1) key SYSTEM_SCANCODE_30
|
||||
|
||||
# Key for selecting the second hotbar slot.
|
||||
keymap_slot2 (Hotbar slot 2) key SYSTEM_SCANCODE_31
|
||||
|
||||
# Key for selecting the third hotbar slot.
|
||||
keymap_slot3 (Hotbar slot 3) key SYSTEM_SCANCODE_32
|
||||
|
||||
# Key for selecting the fourth hotbar slot.
|
||||
keymap_slot4 (Hotbar slot 4) key SYSTEM_SCANCODE_33
|
||||
|
||||
# Key for selecting the fifth hotbar slot.
|
||||
keymap_slot5 (Hotbar slot 5) key SYSTEM_SCANCODE_34
|
||||
|
||||
# Key for selecting the sixth hotbar slot.
|
||||
keymap_slot6 (Hotbar slot 6) key SYSTEM_SCANCODE_35
|
||||
|
||||
# Key for selecting the seventh hotbar slot.
|
||||
keymap_slot7 (Hotbar slot 7) key SYSTEM_SCANCODE_36
|
||||
|
||||
# Key for selecting the eighth hotbar slot.
|
||||
keymap_slot8 (Hotbar slot 8) key SYSTEM_SCANCODE_37
|
||||
|
||||
# Key for selecting the ninth hotbar slot.
|
||||
keymap_slot9 (Hotbar slot 9) key SYSTEM_SCANCODE_38
|
||||
|
||||
# Key for selecting the tenth hotbar slot.
|
||||
keymap_slot10 (Hotbar slot 10) key SYSTEM_SCANCODE_39
|
||||
|
||||
# Key for selecting the 11th hotbar slot.
|
||||
keymap_slot11 (Hotbar slot 11) key
|
||||
|
||||
# Key for selecting the 12th hotbar slot.
|
||||
keymap_slot12 (Hotbar slot 12) key
|
||||
|
||||
# Key for selecting the 13th hotbar slot.
|
||||
keymap_slot13 (Hotbar slot 13) key
|
||||
|
||||
# Key for selecting the 14th hotbar slot.
|
||||
keymap_slot14 (Hotbar slot 14) key
|
||||
|
||||
# Key for selecting the 15th hotbar slot.
|
||||
keymap_slot15 (Hotbar slot 15) key
|
||||
|
||||
# Key for selecting the 16th hotbar slot.
|
||||
keymap_slot16 (Hotbar slot 16) key
|
||||
|
||||
# Key for selecting the 17th hotbar slot.
|
||||
keymap_slot17 (Hotbar slot 17) key
|
||||
|
||||
# Key for selecting the 18th hotbar slot.
|
||||
keymap_slot18 (Hotbar slot 18) key
|
||||
|
||||
# Key for selecting the 19th hotbar slot.
|
||||
keymap_slot19 (Hotbar slot 19) key
|
||||
|
||||
# Key for selecting the 20th hotbar slot.
|
||||
keymap_slot20 (Hotbar slot 20) key
|
||||
|
||||
# Key for selecting the 21st hotbar slot.
|
||||
keymap_slot21 (Hotbar slot 21) key
|
||||
|
||||
# Key for selecting the 22nd hotbar slot.
|
||||
keymap_slot22 (Hotbar slot 22) key
|
||||
|
||||
# Key for selecting the 23rd hotbar slot.
|
||||
keymap_slot23 (Hotbar slot 23) key
|
||||
|
||||
# Key for selecting the 24th hotbar slot.
|
||||
keymap_slot24 (Hotbar slot 24) key
|
||||
|
||||
# Key for selecting the 25th hotbar slot.
|
||||
keymap_slot25 (Hotbar slot 25) key
|
||||
|
||||
# Key for selecting the 26th hotbar slot.
|
||||
keymap_slot26 (Hotbar slot 26) key
|
||||
|
||||
# Key for selecting the 27th hotbar slot.
|
||||
keymap_slot27 (Hotbar slot 27) key
|
||||
|
||||
# Key for selecting the 28th hotbar slot.
|
||||
keymap_slot28 (Hotbar slot 28) key
|
||||
|
||||
# Key for selecting the 29th hotbar slot.
|
||||
keymap_slot29 (Hotbar slot 29) key
|
||||
|
||||
# Key for selecting the 30th hotbar slot.
|
||||
keymap_slot30 (Hotbar slot 30) key
|
||||
|
||||
# Key for selecting the 31st hotbar slot.
|
||||
keymap_slot31 (Hotbar slot 31) key
|
||||
|
||||
# Key for selecting the 32nd hotbar slot.
|
||||
keymap_slot32 (Hotbar slot 32) key
|
||||
|
||||
[*Touchscreen]
|
||||
|
||||
# Enables the touchscreen controls, allowing you to play the game with a touchscreen.
|
||||
|
@ -678,10 +902,10 @@ enable_tinted_fog (Tinted fog) bool false
|
|||
# Requires: enable_dynamic_shadows
|
||||
enable_translucent_foliage (Translucent foliage) bool false
|
||||
|
||||
# Apply specular shading to nodes.
|
||||
# When enabled, liquid reflections are simulated.
|
||||
#
|
||||
# Requires: enable_dynamic_shadows
|
||||
enable_node_specular (Node specular) bool false
|
||||
# Requires: enable_waving_water, enable_dynamic_shadows
|
||||
enable_water_reflections (Liquid reflections) bool false
|
||||
|
||||
[*Audio]
|
||||
|
||||
|
@ -1850,7 +2074,6 @@ instrument.profiler (Profiler) bool false
|
|||
# 0 = disable. Useful for developers.
|
||||
profiler_print_interval (Engine profiling data print interval) int 0 0
|
||||
|
||||
|
||||
[*Advanced]
|
||||
|
||||
[**Graphics] [client]
|
||||
|
@ -1908,7 +2131,7 @@ world_aligned_mode (World-aligned textures mode) enum enable disable,enable,forc
|
|||
# World-aligned textures may be scaled to span several nodes. However,
|
||||
# the server may not send the scale you want, especially if you use
|
||||
# a specially-designed texture pack; with this option, the client tries
|
||||
# to determine the scale automatically basing on the texture size.
|
||||
# to determine the scale automatically based on the texture size.
|
||||
# See also texture_min_size.
|
||||
# Warning: This option is EXPERIMENTAL!
|
||||
autoscale_mode (Autoscaling mode) enum disable disable,enable,force
|
||||
|
@ -1920,7 +2143,7 @@ autoscale_mode (Autoscaling mode) enum disable disable,enable,force
|
|||
# This setting is ONLY applied if any of the mentioned filters are enabled.
|
||||
# This is also used as the base node texture size for world-aligned
|
||||
# texture autoscaling.
|
||||
texture_min_size (Base texture size) int 64 1 32768
|
||||
texture_min_size (Base texture size) int 192 192 16384
|
||||
|
||||
# Side length of a cube of map blocks that the client will consider together
|
||||
# when generating meshes.
|
||||
|
@ -2043,9 +2266,10 @@ lighting_boost_spread (Light curve boost spread) float 0.2 0.0 0.4
|
|||
enable_ipv6 (IPv6) [common] bool true
|
||||
|
||||
# Prometheus listener address.
|
||||
# If Luanti is compiled with ENABLE_PROMETHEUS option enabled,
|
||||
# enable metrics listener for Prometheus on that address.
|
||||
# Metrics can be fetched on http://127.0.0.1:30000/metrics
|
||||
# If Luanti is compiled with Prometheus support, this setting
|
||||
# enables the metrics listener for Prometheus on that address.
|
||||
# By default you can fetch metrics from http://127.0.0.1:30000/metrics.
|
||||
# An empty value disables the metrics listener.
|
||||
prometheus_listener_address (Prometheus listener address) [server] string 127.0.0.1:30000
|
||||
|
||||
# Maximum size of the client's outgoing chat queue.
|
||||
|
@ -2244,6 +2468,23 @@ curl_parallel_limit (cURL parallel limit) int 8 1 2147483647
|
|||
# Maximum time a file download (e.g. a mod download) may take, stated in milliseconds.
|
||||
curl_file_download_timeout (cURL file download timeout) int 300000 5000 2147483647
|
||||
|
||||
[**Client Debugging] [client]
|
||||
|
||||
# Key for toggling the camera update. Only usable with 'debug' privilege.
|
||||
keymap_toggle_update_camera (Toggle camera update) key
|
||||
|
||||
# Key for switching to the previous entry in Quicktune.
|
||||
keymap_quicktune_prev (Quicktune: select previous entry) key
|
||||
|
||||
# Key for switching to the next entry in Quicktune.
|
||||
keymap_quicktune_next (Quicktune: select next entry) key
|
||||
|
||||
# Key for decrementing the selected value in Quicktune.
|
||||
keymap_quicktune_dec (Quicktune: decrement value) key
|
||||
|
||||
# Key for incrementing the selected value in Quicktune.
|
||||
keymap_quicktune_inc (Quicktune: increment value) key
|
||||
|
||||
[**Miscellaneous]
|
||||
|
||||
# Clickable weblinks (middle-click or Ctrl+left-click) enabled in chat console output.
|
||||
|
@ -2370,226 +2611,3 @@ show_technical_names (Show technical names) bool false
|
|||
|
||||
# Controlled by a checkbox in the settings menu.
|
||||
show_advanced (Show advanced settings) bool false
|
||||
|
||||
# Key for moving the player forward.
|
||||
keymap_forward (Forward key) key KEY_KEY_W
|
||||
|
||||
# Key for moving the player backward.
|
||||
# Will also disable autoforward, when active.
|
||||
keymap_backward (Backward key) key KEY_KEY_S
|
||||
|
||||
# Key for moving the player left.
|
||||
keymap_left (Left key) key KEY_KEY_A
|
||||
|
||||
# Key for moving the player right.
|
||||
keymap_right (Right key) key KEY_KEY_D
|
||||
|
||||
# Key for jumping.
|
||||
keymap_jump (Jump key) key KEY_SPACE
|
||||
|
||||
# Key for sneaking.
|
||||
# Also used for climbing down and descending in water if aux1_descends is disabled.
|
||||
keymap_sneak (Sneak key) key KEY_LSHIFT
|
||||
|
||||
# Key for digging, punching or using something.
|
||||
# (Note: The actual meaning might vary on a per-game basis.)
|
||||
keymap_dig (Dig/punch/use key) key KEY_LBUTTON
|
||||
|
||||
# Key for placing an item/block or for using something.
|
||||
# (Note: The actual meaning might vary on a per-game basis.)
|
||||
keymap_place (Place/use key) key KEY_RBUTTON
|
||||
|
||||
# Key for opening the inventory.
|
||||
keymap_inventory (Inventory key) key KEY_KEY_I
|
||||
|
||||
# Key for moving fast in fast mode.
|
||||
keymap_aux1 (Aux1 key) key KEY_KEY_E
|
||||
|
||||
# Key for opening the chat window.
|
||||
keymap_chat (Chat key) key KEY_KEY_T
|
||||
|
||||
# Key for opening the chat window to type commands.
|
||||
keymap_cmd (Command key) key /
|
||||
|
||||
# Key for opening the chat window to type local commands.
|
||||
keymap_cmd_local (Command key) key .
|
||||
|
||||
# Key for toggling unlimited view range.
|
||||
keymap_rangeselect (Range select key) key
|
||||
|
||||
# Key for toggling flying.
|
||||
keymap_freemove (Fly key) key KEY_KEY_K
|
||||
|
||||
# Key for toggling pitch move mode.
|
||||
keymap_pitchmove (Pitch move key) key
|
||||
|
||||
# Key for toggling fast mode.
|
||||
keymap_fastmove (Fast key) key KEY_KEY_J
|
||||
|
||||
# Key for toggling noclip mode.
|
||||
keymap_noclip (Noclip key) key KEY_KEY_H
|
||||
|
||||
# Key for selecting the next item in the hotbar.
|
||||
keymap_hotbar_next (Hotbar next key) key KEY_KEY_N
|
||||
|
||||
# Key for selecting the previous item in the hotbar.
|
||||
keymap_hotbar_previous (Hotbar previous key) key KEY_KEY_B
|
||||
|
||||
# Key for muting the game.
|
||||
keymap_mute (Mute key) key KEY_KEY_M
|
||||
|
||||
# Key for increasing the volume.
|
||||
keymap_increase_volume (Inc. volume key) key
|
||||
|
||||
# Key for decreasing the volume.
|
||||
keymap_decrease_volume (Dec. volume key) key
|
||||
|
||||
# Key for toggling autoforward.
|
||||
keymap_autoforward (Automatic forward key) key
|
||||
|
||||
# Key for toggling cinematic mode.
|
||||
keymap_cinematic (Cinematic mode key) key
|
||||
|
||||
# Key for toggling display of minimap.
|
||||
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
|
||||
|
||||
# Key to use view zoom when possible.
|
||||
keymap_zoom (View zoom key) key KEY_KEY_Z
|
||||
|
||||
# Key for selecting the first hotbar slot.
|
||||
keymap_slot1 (Hotbar slot 1 key) key KEY_KEY_1
|
||||
|
||||
# Key for selecting the second hotbar slot.
|
||||
keymap_slot2 (Hotbar slot 2 key) key KEY_KEY_2
|
||||
|
||||
# Key for selecting the third hotbar slot.
|
||||
keymap_slot3 (Hotbar slot 3 key) key KEY_KEY_3
|
||||
|
||||
# Key for selecting the fourth hotbar slot.
|
||||
keymap_slot4 (Hotbar slot 4 key) key KEY_KEY_4
|
||||
|
||||
# Key for selecting the fifth hotbar slot.
|
||||
keymap_slot5 (Hotbar slot 5 key) key KEY_KEY_5
|
||||
|
||||
# Key for selecting the sixth hotbar slot.
|
||||
keymap_slot6 (Hotbar slot 6 key) key KEY_KEY_6
|
||||
|
||||
# Key for selecting the seventh hotbar slot.
|
||||
keymap_slot7 (Hotbar slot 7 key) key KEY_KEY_7
|
||||
|
||||
# Key for selecting the eighth hotbar slot.
|
||||
keymap_slot8 (Hotbar slot 8 key) key KEY_KEY_8
|
||||
|
||||
# Key for selecting the ninth hotbar slot.
|
||||
keymap_slot9 (Hotbar slot 9 key) key KEY_KEY_9
|
||||
|
||||
# Key for selecting the tenth hotbar slot.
|
||||
keymap_slot10 (Hotbar slot 10 key) key KEY_KEY_0
|
||||
|
||||
# Key for selecting the 11th hotbar slot.
|
||||
keymap_slot11 (Hotbar slot 11 key) key
|
||||
|
||||
# Key for selecting the 12th hotbar slot.
|
||||
keymap_slot12 (Hotbar slot 12 key) key
|
||||
|
||||
# Key for selecting the 13th hotbar slot.
|
||||
keymap_slot13 (Hotbar slot 13 key) key
|
||||
|
||||
# Key for selecting the 14th hotbar slot.
|
||||
keymap_slot14 (Hotbar slot 14 key) key
|
||||
|
||||
# Key for selecting the 15th hotbar slot.
|
||||
keymap_slot15 (Hotbar slot 15 key) key
|
||||
|
||||
# Key for selecting the 16th hotbar slot.
|
||||
keymap_slot16 (Hotbar slot 16 key) key
|
||||
|
||||
# Key for selecting the 17th hotbar slot.
|
||||
keymap_slot17 (Hotbar slot 17 key) key
|
||||
|
||||
# Key for selecting the 18th hotbar slot.
|
||||
keymap_slot18 (Hotbar slot 18 key) key
|
||||
|
||||
# Key for selecting the 19th hotbar slot.
|
||||
keymap_slot19 (Hotbar slot 19 key) key
|
||||
|
||||
# Key for selecting the 20th hotbar slot.
|
||||
keymap_slot20 (Hotbar slot 20 key) key
|
||||
|
||||
# Key for selecting the 21st hotbar slot.
|
||||
keymap_slot21 (Hotbar slot 21 key) key
|
||||
|
||||
# Key for selecting the 22nd hotbar slot.
|
||||
keymap_slot22 (Hotbar slot 22 key) key
|
||||
|
||||
# Key for selecting the 23rd hotbar slot.
|
||||
keymap_slot23 (Hotbar slot 23 key) key
|
||||
|
||||
# Key for selecting the 24th hotbar slot.
|
||||
keymap_slot24 (Hotbar slot 24 key) key
|
||||
|
||||
# Key for selecting the 25th hotbar slot.
|
||||
keymap_slot25 (Hotbar slot 25 key) key
|
||||
|
||||
# Key for selecting the 26th hotbar slot.
|
||||
keymap_slot26 (Hotbar slot 26 key) key
|
||||
|
||||
# Key for selecting the 27th hotbar slot.
|
||||
keymap_slot27 (Hotbar slot 27 key) key
|
||||
|
||||
# Key for selecting the 28th hotbar slot.
|
||||
keymap_slot28 (Hotbar slot 28 key) key
|
||||
|
||||
# Key for selecting the 29th hotbar slot.
|
||||
keymap_slot29 (Hotbar slot 29 key) key
|
||||
|
||||
# Key for selecting the 30th hotbar slot.
|
||||
keymap_slot30 (Hotbar slot 30 key) key
|
||||
|
||||
# Key for selecting the 31st hotbar slot.
|
||||
keymap_slot31 (Hotbar slot 31 key) key
|
||||
|
||||
# Key for selecting the 32nd hotbar slot.
|
||||
keymap_slot32 (Hotbar slot 32 key) key
|
||||
|
||||
# Key for toggling the display of the HUD.
|
||||
keymap_toggle_hud (HUD toggle key) key KEY_F1
|
||||
|
||||
# Key for toggling the display of chat.
|
||||
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.
|
||||
keymap_toggle_fog (Fog toggle key) key KEY_F3
|
||||
|
||||
# Key for toggling the camera update. Only usable with 'debug' privilege.
|
||||
keymap_toggle_update_camera (Camera update toggle key) key
|
||||
|
||||
# Key for toggling the display of debug info.
|
||||
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
|
||||
|
||||
# Key for increasing the viewing range.
|
||||
keymap_increase_viewing_range_min (View range increase key) key +
|
||||
|
||||
# Key for decreasing the viewing range.
|
||||
keymap_decrease_viewing_range_min (View range decrease key) key -
|
||||
|
|
|
@ -23,3 +23,5 @@ This list is largely advisory and items may be reevaluated once the time comes.
|
|||
* stop reading initial properties from bare entity def
|
||||
* change particle default blend mode to `clip`
|
||||
* remove built-in knockback and related functions entirely
|
||||
* remove `safe` parameter from `core.serialize`, always enforce `safe = true`.
|
||||
possibly error when `loadstring` calls are encountered in `core.deserialize`.
|
||||
|
|
|
@ -23,6 +23,7 @@ General options and their default values:
|
|||
PRECOMPILE_HEADERS=FALSE - Precompile some headers (experimental; requires CMake 3.16 or later)
|
||||
PRECOMPILED_HEADERS_PATH= - Path to a file listing all headers to precompile (default points to src/precompiled_headers.txt)
|
||||
USE_SDL2=TRUE - Build with SDL2; Enables IrrlichtMt device SDL2
|
||||
USE_SDL2_STATIC=TRUE - Links with SDL2::SDL2-static instead of SDL2::SDL2
|
||||
ENABLE_CURL=ON - Build with cURL; Enables use of online mod repo, public serverlist and remote media fetching via http
|
||||
ENABLE_CURSES=ON - Build with (n)curses; Enables a server side terminal (command line option: --terminal)
|
||||
ENABLE_GETTEXT=ON - Build with Gettext; Allows using translations
|
||||
|
|
|
@ -90,6 +90,10 @@ Run it:
|
|||
|
||||
./bin/luanti
|
||||
|
||||
Run unit tests:
|
||||
|
||||
./bin/luanti --run-unittests
|
||||
|
||||
- Use `cmake . -LH` to see all CMake options and their current state.
|
||||
- If you want to install it system-wide (or are making a distribution package),
|
||||
you will want to use `-DRUN_IN_PLACE=FALSE`.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
The long-term roadmaps, aims, and guiding philosophies are set out using the
|
||||
following documents:
|
||||
|
||||
* [What is Minetest?](http://c55.me/blog/?p=1491)
|
||||
* [What is Minetest? (archived)](https://web.archive.org/web/20160328054721/http://c55.me/blog/?p=1491)
|
||||
* [celeron55's roadmap](https://forum.luanti.org/viewtopic.php?t=9177)
|
||||
* [celeron55's comment in "A clear mission statement for Minetest is missing"](https://github.com/luanti-org/luanti/issues/3476#issuecomment-167399287)
|
||||
* [Core developer to-do/wish lists](https://forum.luanti.org/viewforum.php?f=7)
|
||||
|
|
120
doc/lua_api.md
120
doc/lua_api.md
|
@ -518,6 +518,15 @@ stripping out the file extension:
|
|||
|
||||
Supported texture formats are PNG (`.png`), JPEG (`.jpg`) and Targa (`.tga`).
|
||||
|
||||
Luanti generally uses nearest-neighbor upscaling for textures to preserve the crisp
|
||||
look of pixel art (low-res textures).
|
||||
Users can optionally enable bilinear and/or trilinear filtering. However, to avoid
|
||||
everything becoming blurry, textures smaller than 192px will either not be filtered,
|
||||
or will be upscaled to that minimum resolution first without filtering.
|
||||
|
||||
This is subject to change to move more control to the Lua API, but you can rely on
|
||||
low-res textures not suddenly becoming filtered.
|
||||
|
||||
Texture modifiers
|
||||
-----------------
|
||||
|
||||
|
@ -2833,6 +2842,9 @@ Version History
|
|||
* Add field_enter_after_edit[] (experimental)
|
||||
* Formspec version 8 (5.10.0)
|
||||
* scroll_container[]: content padding parameter
|
||||
* Formspec version 9 (5.12.0)
|
||||
* Add allow_close[]
|
||||
* label[]: Add "area label" variant
|
||||
|
||||
Elements
|
||||
--------
|
||||
|
@ -2903,6 +2915,13 @@ Elements
|
|||
* For information on converting forms to the new coordinate system, see `Migrating
|
||||
to Real Coordinates`.
|
||||
|
||||
### `allow_close[<bool>]`
|
||||
|
||||
* When set to false, the formspec will not close when the user tries to close
|
||||
it with the Escape key or similar. Default true.
|
||||
* The formspec can still be closed with `*_exit[]` elements and
|
||||
`core.close_formspec()`, regardless of this setting.
|
||||
|
||||
### `container[<X>,<Y>]`
|
||||
|
||||
* Start of a container block, moves all physical elements in the container by
|
||||
|
@ -3138,9 +3157,11 @@ Elements
|
|||
### `textarea[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]`
|
||||
|
||||
* Same as fields above, but with multi-line input
|
||||
* Text is wrapped to fit within the given bounds.
|
||||
* If the text overflows, a vertical scrollbar is added.
|
||||
* If the name is empty, the textarea is read-only and
|
||||
the background is not shown, which corresponds to a multi-line label.
|
||||
See also `label[<X>,<Y>;<W>,<H>;<label>]` for an alternative.
|
||||
|
||||
### `label[<X>,<Y>;<label>]`
|
||||
|
||||
|
@ -3155,6 +3176,16 @@ Elements
|
|||
half a coordinate. With the old system, newlines are spaced 2/5 of
|
||||
an inventory slot.
|
||||
|
||||
### `label[<X>,<Y>;<W>,<H>;<label>]`
|
||||
|
||||
* The "area label" formspec element displays the text set in `label`
|
||||
at the specified position and size.
|
||||
* Text is wrapped to fit within the given bounds.
|
||||
* If the text overflows, it is currently simply truncated, but this behavior is
|
||||
subject to change. There is no scrollbar.
|
||||
* See also `textarea` for an alternative.
|
||||
* Only available with the new coordinate system.
|
||||
|
||||
### `hypertext[<X>,<Y>;<W>,<H>;<name>;<text>]`
|
||||
* Displays a static formatted text with hyperlinks.
|
||||
* **Note**: This element is currently unstable and subject to change.
|
||||
|
@ -4131,9 +4162,11 @@ Helper functions
|
|||
* `obj`: arbitrary variable
|
||||
* `name`: string, default: `"_"`
|
||||
* `dumped`: table, default: `{}`
|
||||
* `dump(obj, dumped)`: returns a string which makes `obj` human-readable
|
||||
* `obj`: arbitrary variable
|
||||
* `dumped`: table, default: `{}`
|
||||
* `dump(value, indent)`: returns a string which makes `value` human-readable
|
||||
* `value`: arbitrary value
|
||||
* Circular references are supported. Every table is dumped only once.
|
||||
* `indent`: string to use for indentation, default: `"\t"`
|
||||
* `""` disables indentation & line breaks (compact output)
|
||||
* `math.hypot(x, y)`
|
||||
* Get the hypotenuse of a triangle with legs x and y.
|
||||
Useful for distance calculation.
|
||||
|
@ -5564,7 +5597,6 @@ provided by the Luanti engine and can be used by mods:
|
|||
* `fly`: can use "fly mode" to move freely above the ground without falling.
|
||||
* `noclip`: can use "noclip mode" to fly through solid nodes (e.g. walls).
|
||||
* `teleport`: can use `/teleport` command to move to any point in the world.
|
||||
* `creative`: can access creative inventory.
|
||||
* `bring`: can teleport other players to oneself.
|
||||
* `give`: can use `/give` and `/giveme` commands to give any item
|
||||
in the game to oneself or others.
|
||||
|
@ -5750,6 +5782,8 @@ Utilities
|
|||
particle_blend_clip = true,
|
||||
-- The `match_meta` optional parameter is available for `InvRef:remove_item()` (5.12.0)
|
||||
remove_item_match_meta = true,
|
||||
-- The HTTP API supports the HEAD and PATCH methods (5.12.0)
|
||||
httpfetch_additional_methods = true,
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -6206,8 +6240,10 @@ Call these functions only at load time!
|
|||
* `table`: See `core.explode_table_event`
|
||||
* `scrollbar`: See `core.explode_scrollbar_event`
|
||||
* Special case: `["quit"]="true"` is sent when the user actively
|
||||
closed the form by mouse click, keypress or through a button_exit[]
|
||||
closed the form by mouse click, keypress or through a `button_exit[]`
|
||||
element.
|
||||
* Special case: `["try_quit"]="true"` is sent when the user tries to
|
||||
close the formspec, but the formspec used `allow_close[false]`.
|
||||
* Special case: `["key_enter"]="true"` is sent when the user pressed
|
||||
the Enter key and the focus was either nowhere (causing the formspec
|
||||
to be closed) or on a button. If the focus was on a text field,
|
||||
|
@ -6901,11 +6937,16 @@ Item handling
|
|||
given `param2` value.
|
||||
* Returns `nil` if the given `paramtype2` does not contain color
|
||||
information.
|
||||
* `core.get_node_drops(node, toolname)`
|
||||
* Returns list of itemstrings that are dropped by `node` when dug
|
||||
with the item `toolname` (not limited to tools).
|
||||
* `core.get_node_drops(node, toolname[, tool, digger, pos])`
|
||||
* Returns list of itemstrings that are dropped by `node` when dug with the
|
||||
item `toolname` (not limited to tools). The default implementation doesn't
|
||||
use `tool`, `digger`, and `pos`, but these are provided by `core.node_dig`
|
||||
since 5.12.0 for games/mods implementing customized drops.
|
||||
* `node`: node as table or node name
|
||||
* `toolname`: name of the item used to dig (can be `nil`)
|
||||
* `tool`: `ItemStack` used to dig (can be `nil`)
|
||||
* `digger`: the ObjectRef that digs the node (can be `nil`)
|
||||
* `pos`: the pos of the dug node (can be `nil`)
|
||||
* `core.get_craft_result(input)`: returns `output, decremented_input`
|
||||
* `input.method` = `"normal"` or `"cooking"` or `"fuel"`
|
||||
* `input.width` = for example `3`
|
||||
|
@ -7572,16 +7613,22 @@ Misc.
|
|||
* Example: `write_json({10, {a = false}})`,
|
||||
returns `'[10, {"a": false}]'`
|
||||
* `core.serialize(table)`: returns a string
|
||||
* Convert a table containing tables, strings, numbers, booleans and `nil`s
|
||||
into string form readable by `core.deserialize`
|
||||
* Convert a value into string form readable by `core.deserialize`.
|
||||
* Supports tables, strings, numbers, booleans and `nil`.
|
||||
* Support for dumping function bytecode is **deprecated**.
|
||||
* Note: To obtain a human-readable representation of a value, use `dump` instead.
|
||||
* Example: `serialize({foo="bar"})`, returns `'return { ["foo"] = "bar" }'`
|
||||
* `core.deserialize(string[, safe])`: returns a table
|
||||
* Convert a string returned by `core.serialize` into a table
|
||||
* `string` is loaded in an empty sandbox environment.
|
||||
* Will load functions if safe is false or omitted. Although these functions
|
||||
cannot directly access the global environment, they could bypass this
|
||||
restriction with maliciously crafted Lua bytecode if mod security is
|
||||
disabled.
|
||||
* Will load functions if `safe` is `false` or omitted.
|
||||
Although these functions cannot directly access the global environment,
|
||||
they could bypass this restriction with maliciously crafted Lua bytecode
|
||||
if mod security is disabled.
|
||||
* Will silently strip functions embedded via calls to `loadstring`
|
||||
(typically bytecode dumped by `core.serialize`) if `safe` is `true`.
|
||||
You should not rely on this if possible.
|
||||
* Example: `core.deserialize("return loadstring('')", true)` will be `nil`.
|
||||
* This function should not be used on untrusted data, regardless of the
|
||||
value of `safe`. It is fine to serialize then deserialize user-provided
|
||||
data, but directly providing user input to deserialize is always unsafe.
|
||||
|
@ -8124,8 +8171,8 @@ of the `${k}` syntax in formspecs is not deprecated.
|
|||
The value will be converted into a string when stored.
|
||||
* `get_int(key)`: Returns `0` if key not present.
|
||||
* `set_float(key, value)`
|
||||
* The range for the value is system-dependent (usually 32 bits).
|
||||
The value will be converted into a string when stored.
|
||||
* Store a number (a 64-bit float) exactly.
|
||||
* The value will be converted into a string when stored.
|
||||
* `get_float(key)`: Returns `0` if key not present.
|
||||
* `get_keys()`: returns a list of all keys in the metadata.
|
||||
* `to_table()`:
|
||||
|
@ -9271,7 +9318,7 @@ The settings have the format `key = value`. Example:
|
|||
`StorageRef`
|
||||
------------
|
||||
|
||||
Mod metadata: per mod metadata, saved automatically.
|
||||
Mod metadata: per mod and world metadata, saved automatically.
|
||||
Can be obtained via `core.get_mod_storage()` during load time.
|
||||
|
||||
WARNING: This storage backend is incapable of saving raw binary data due
|
||||
|
@ -9372,7 +9419,8 @@ Player properties need to be saved manually.
|
|||
-- to scale the entity along both horizontal axes.
|
||||
|
||||
mesh = "model.obj",
|
||||
-- File name of mesh when using "mesh" visual
|
||||
-- File name of mesh when using "mesh" visual.
|
||||
-- For legacy reasons, this uses a 10x scale for meshes: 10 units = 1 node.
|
||||
|
||||
textures = {},
|
||||
-- Number of required textures depends on visual:
|
||||
|
@ -10144,6 +10192,13 @@ Used by `core.register_node`.
|
|||
|
||||
mesh = "",
|
||||
-- File name of mesh when using "mesh" drawtype
|
||||
-- The center of the node is the model origin.
|
||||
-- For legacy reasons, this uses a different scale depending on the mesh:
|
||||
-- 1. For glTF models: 10 units = 1 node (consistent with the scale for entities).
|
||||
-- 2. For obj models: 1 unit = 1 node.
|
||||
-- 3. For b3d and x models: 1 unit = 1 node if static, otherwise 10 units = 1 node.
|
||||
-- Using static glTF or obj models is recommended.
|
||||
-- You can use the `visual_scale` multiplier to achieve the expected scale.
|
||||
|
||||
selection_box = {
|
||||
-- see [Node boxes] for possibilities
|
||||
|
@ -10450,6 +10505,16 @@ table format. The accepted parameters are listed below.
|
|||
|
||||
Recipe input items can either be specified by item name (item count = 1)
|
||||
or by group (see "Groups in crafting recipes" for details).
|
||||
Only the item name (and groups) matter for matching a recipe, i.e. meta and count
|
||||
are ignored.
|
||||
|
||||
If multiple recipes match the input of a craft grid, one of them is chosen by the
|
||||
following priority rules:
|
||||
|
||||
* Shaped recipes are preferred over shapeless recipes, which in turn are preferred
|
||||
over tool repair.
|
||||
* Otherwise, recipes without groups are preferred over recipes with groups.
|
||||
* Otherwise, earlier registered recipes are preferred.
|
||||
|
||||
The following sections describe the types and syntaxes of recipes.
|
||||
|
||||
|
@ -10469,6 +10534,10 @@ For example, for a 3x3 recipe, the `recipes` table must have
|
|||
In order to craft the recipe, the players' crafting grid must
|
||||
have equal or larger dimensions (both width and height).
|
||||
|
||||
Empty slots outside of the recipe's extents are ignored, e.g. a 3x3
|
||||
recipe where only the bottom right 2x2 slots are filled is the same
|
||||
as the corresponding 2x2 recipe without the empty slots.
|
||||
|
||||
Parameters:
|
||||
|
||||
* `type = "shaped"`: (optional) specifies recipe type as shaped
|
||||
|
@ -11789,22 +11858,22 @@ Used by `HTTPApiTable.fetch` and `HTTPApiTable.fetch_async`.
|
|||
|
||||
```lua
|
||||
{
|
||||
url = "http://example.org",
|
||||
url = "https://example.org",
|
||||
|
||||
timeout = 10,
|
||||
-- Timeout for request to be completed in seconds. Default depends on engine settings.
|
||||
|
||||
method = "GET", "POST", "PUT" or "DELETE"
|
||||
method = "GET", "HEAD", "POST", "PUT", "PATCH" or "DELETE"
|
||||
-- The http method to use. Defaults to "GET".
|
||||
|
||||
data = "Raw request data string" OR {field1 = "data1", field2 = "data2"},
|
||||
-- Data for the POST, PUT or DELETE request.
|
||||
data = "Raw request data string" or {field1 = "data1", field2 = "data2"},
|
||||
-- Data for the POST, PUT, PATCH or DELETE request.
|
||||
-- Accepts both a string and a table. If a table is specified, encodes
|
||||
-- table as x-www-form-urlencoded key-value pairs.
|
||||
|
||||
user_agent = "ExampleUserAgent",
|
||||
-- Optional, if specified replaces the default Luanti user agent with
|
||||
-- given string
|
||||
-- given string.
|
||||
|
||||
extra_headers = { "Accept-Language: en-us", "Accept-Charset: utf-8" },
|
||||
-- Optional, if specified adds additional headers to the HTTP request.
|
||||
|
@ -11814,7 +11883,7 @@ Used by `HTTPApiTable.fetch` and `HTTPApiTable.fetch_async`.
|
|||
multipart = boolean
|
||||
-- Optional, if true performs a multipart HTTP request.
|
||||
-- Default is false.
|
||||
-- Post only, data must be array
|
||||
-- Not allowed for GET or HEAD method and `data` must be a table.
|
||||
|
||||
post_data = "Raw POST request data string" OR {field1 = "data1", field2 = "data2"},
|
||||
-- Deprecated, use `data` instead. Forces `method = "POST"`.
|
||||
|
@ -11842,7 +11911,8 @@ Passed to `HTTPApiTable.fetch` callback. Returned by
|
|||
code = 200,
|
||||
-- HTTP status code
|
||||
|
||||
data = "response"
|
||||
data = "",
|
||||
-- Response body
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@ Callbacks
|
|||
* `core.event_handler(event)`
|
||||
* `event`: `"MenuQuit"`, `"KeyEnter"`, `"ExitButton"`, `"EditBoxEnter"` or
|
||||
`"FullscreenChange"`
|
||||
* `core.on_before_close()`: called before the menu is closed, either to exit or
|
||||
to join a game
|
||||
|
||||
|
||||
Gamedata
|
||||
|
@ -217,7 +219,6 @@ GUI
|
|||
doing tiling (background only)
|
||||
* `core.set_clouds(<true/false>)`
|
||||
* `core.set_topleft_text(text)`
|
||||
* `core.show_keys_menu()`
|
||||
* `core.show_touchscreen_layout()`
|
||||
* `core.show_path_select_dialog(formname, caption, is_file_select)`
|
||||
* shows a path select dialog
|
||||
|
|
280
games/devtest/mods/testeditor/init.lua
Normal file
280
games/devtest/mods/testeditor/init.lua
Normal file
|
@ -0,0 +1,280 @@
|
|||
local S = core.get_translator("testeditor")
|
||||
local F = core.formspec_escape
|
||||
|
||||
local function val_to_lua_str(v)
|
||||
if type(v) == "string" then
|
||||
return "\"" .. v .. "\""
|
||||
elseif type(v) == "table" then
|
||||
return tostring(dump(v)):gsub("\n", "")
|
||||
else
|
||||
return tostring(v)
|
||||
end
|
||||
end
|
||||
|
||||
local editor_formspecs = {}
|
||||
|
||||
--- Updates the fields `.index_to_key` and `.list` based on `.data`
|
||||
local function update_formspec_list(formspec)
|
||||
assert(formspec)
|
||||
|
||||
-- Get sorted keys of the formspec fields in `formspec.data`
|
||||
local datalist = {}
|
||||
for k,_ in pairs(formspec.data) do
|
||||
table.insert(datalist, k)
|
||||
end
|
||||
table.sort(datalist)
|
||||
|
||||
-- Build list of table values
|
||||
local props = {}
|
||||
for i, k in ipairs(datalist) do
|
||||
local v = formspec.data[k]
|
||||
props[#props + 1] = F(("%s = %s"):format(k, val_to_lua_str(v)))
|
||||
end
|
||||
|
||||
formspec.index_to_key = datalist
|
||||
formspec.list = table.concat(props, ",")
|
||||
end
|
||||
|
||||
local function show_editor_formspec(playername)
|
||||
local formspec = editor_formspecs[playername]
|
||||
local sel = formspec.selindex or ""
|
||||
local key = formspec.index_to_key[sel]
|
||||
local value = ""
|
||||
if formspec.data[key] ~= nil then
|
||||
value = val_to_lua_str(formspec.data[key])
|
||||
end
|
||||
local title = formspec.title
|
||||
if not formspec.actual then
|
||||
title = S("@1 - NOT APPLIED CHANGES", title)
|
||||
end
|
||||
core.show_formspec(playername, "testeditor:editor",
|
||||
"size[11,9]"..
|
||||
"label[0,0;"..F(title).."]"..
|
||||
"textlist[0,0.5;11,6.5;editor_data;"..formspec.list..";"..sel..";false]"..
|
||||
"field[0.2,7.75;7,1;key;"..F(S("Key"))..";"..F(formspec.key).."]"..
|
||||
"field_close_on_enter[key;false]"..
|
||||
"field[0.2,8.75;8,1;value;"..F(S("Value"))..";"..F(value).."]"..
|
||||
"button[8,7.5;3,1;submit_key;"..F(S("Add/Change key")).."]"..
|
||||
"field_close_on_enter[value;false]"..
|
||||
"button[8,8.5;3,1;submit_value;"..F(S("Submit and apply")).."]"
|
||||
)
|
||||
end
|
||||
|
||||
local function editor_formspec_create(playername, wrapper)
|
||||
local data = wrapper.read_cb(playername)
|
||||
editor_formspecs[playername] = {
|
||||
title = wrapper.title,
|
||||
read_cb = wrapper.read_cb,
|
||||
write_cb = wrapper.write_cb,
|
||||
data = data,
|
||||
key = "",
|
||||
actual = true,
|
||||
}
|
||||
update_formspec_list(editor_formspecs[playername])
|
||||
show_editor_formspec(playername)
|
||||
end
|
||||
|
||||
-- Use loadstring to parse param as a Lua value
|
||||
local function use_loadstring(param, player)
|
||||
-- For security reasons, require 'server' priv, just in case
|
||||
-- someone is actually crazy enough to run this on a public server.
|
||||
local privs = core.get_player_privs(player:get_player_name())
|
||||
if not privs.server then
|
||||
return false, "You need 'server' privilege to change object properties!"
|
||||
end
|
||||
if not param then
|
||||
return false, "Failed: parameter is nil"
|
||||
end
|
||||
--[[ DANGER ZONE ]]
|
||||
-- Interpret string as Lua value
|
||||
local func, errormsg = loadstring("return (" .. param .. ")")
|
||||
if not func then
|
||||
return false, "loadstring failed: " .. errormsg
|
||||
end
|
||||
|
||||
-- Apply sandbox here using setfenv
|
||||
setfenv(func, {})
|
||||
|
||||
-- Run it
|
||||
local good, errOrResult = pcall(func)
|
||||
if not good then
|
||||
-- A Lua error was thrown
|
||||
return false, "pcall failed: " .. errOrResult
|
||||
end
|
||||
|
||||
-- errOrResult will be the value
|
||||
return true, errOrResult
|
||||
end
|
||||
|
||||
core.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if not (player and player:is_player()) then
|
||||
return
|
||||
end
|
||||
if formname ~= "testeditor:editor" then
|
||||
return
|
||||
end
|
||||
|
||||
local name = player:get_player_name()
|
||||
local formspec = editor_formspecs[name]
|
||||
if not formspec then
|
||||
return
|
||||
end
|
||||
|
||||
if fields.editor_data then
|
||||
local expl = core.explode_textlist_event(fields.editor_data)
|
||||
if expl.type == "DCL" or expl.type == "CHG" then
|
||||
formspec.selindex = expl.index
|
||||
formspec.key = formspec.index_to_key[expl.index]
|
||||
show_editor_formspec(name)
|
||||
return
|
||||
end
|
||||
end
|
||||
if fields.key_enter_field == "key" or fields.submit_key then
|
||||
local success, str = use_loadstring(fields.value, player)
|
||||
if success then
|
||||
local key = fields.key
|
||||
formspec.data[key] = str
|
||||
update_formspec_list(formspec)
|
||||
formspec.actual = false
|
||||
else
|
||||
core.chat_send_player(name, str)
|
||||
return
|
||||
end
|
||||
show_editor_formspec(name)
|
||||
if fields.submit_value then
|
||||
formspec.write_cb(name, formspec.data)
|
||||
end
|
||||
return
|
||||
end
|
||||
if fields.key_enter_field == "value" or fields.submit_value then
|
||||
local success, str = use_loadstring(fields.value, player)
|
||||
if success then
|
||||
local key = formspec.index_to_key[formspec.selindex]
|
||||
formspec.data[key] = str
|
||||
update_formspec_list(formspec)
|
||||
formspec.actual = false
|
||||
else
|
||||
core.chat_send_player(name, str)
|
||||
return
|
||||
end
|
||||
show_editor_formspec(name)
|
||||
if fields.submit_value then
|
||||
formspec.write_cb(name, formspec.data)
|
||||
formspec.data = formspec.read_cb(name)
|
||||
update_formspec_list(formspec)
|
||||
formspec.actual = true
|
||||
end
|
||||
return
|
||||
end
|
||||
end)
|
||||
|
||||
local function create_read_cb(func)
|
||||
return
|
||||
function(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if player then
|
||||
return player[func](player)
|
||||
end
|
||||
return {}
|
||||
end
|
||||
end
|
||||
local function create_write_cb(func)
|
||||
return
|
||||
function(name, data)
|
||||
local player = core.get_player_by_name(name)
|
||||
if player then
|
||||
return player[func](player, data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local wrappers = {
|
||||
armor = {
|
||||
title = S("Properties editor of armor groups (get_armor_groups/set_armor_groups)"),
|
||||
read_cb = create_read_cb("get_armor_groups"),
|
||||
write_cb = create_write_cb("set_armor_groups")
|
||||
},
|
||||
nametag = {
|
||||
title = S("Properties editor of nametag (get_nametag/set_nametag)"),
|
||||
read_cb = create_read_cb("get_nametag_attributes"),
|
||||
write_cb = create_write_cb("set_nametag_attributes")
|
||||
},
|
||||
physics = {
|
||||
title = S("Properties editor of physics_override (get_physics_override/set_physics_override)"),
|
||||
read_cb = create_read_cb("get_physics_override"),
|
||||
write_cb = create_write_cb("set_physics_override")
|
||||
},
|
||||
hud_flags = {
|
||||
title = S("Properties editor of hud_flags (hud_get_flags/hud_set_flags)"),
|
||||
read_cb = create_read_cb("hud_get_flags"),
|
||||
write_cb = create_write_cb("hud_set_flags")
|
||||
},
|
||||
sky = {
|
||||
title = S("Properties editor of sky (get_sky/set_sky)"),
|
||||
read_cb =
|
||||
function(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if player then
|
||||
return player:get_sky(true)
|
||||
end
|
||||
return {}
|
||||
end,
|
||||
write_cb = create_write_cb("set_sky")
|
||||
},
|
||||
sun = {
|
||||
title = S("Properties editor of sun (get_sun/set_sun)"),
|
||||
read_cb = create_read_cb("get_sun"),
|
||||
write_cb = create_write_cb("set_sun")
|
||||
},
|
||||
moon = {
|
||||
title = S("Properties editor of moon (get_moon/set_moon)"),
|
||||
read_cb = create_read_cb("get_moon"),
|
||||
write_cb = create_write_cb("set_moon")
|
||||
},
|
||||
stars = {
|
||||
title = S("Properties editor of stars (get_stars/set_stars)"),
|
||||
read_cb = create_read_cb("get_stars"),
|
||||
write_cb = create_write_cb("set_stars")
|
||||
},
|
||||
clouds = {
|
||||
title = S("Properties editor of clouds (get_clouds/set_clouds)"),
|
||||
read_cb = create_read_cb("get_clouds"),
|
||||
write_cb = create_write_cb("set_clouds")
|
||||
},
|
||||
lighting = {
|
||||
title = S("Properties editor of lighting (get_lighting/set_lighting)"),
|
||||
read_cb = create_read_cb("get_lighting"),
|
||||
write_cb = create_write_cb("set_lighting")
|
||||
},
|
||||
flags = {
|
||||
title = S("Properties editor of flags (get_flags/set_flags)"),
|
||||
read_cb = create_read_cb("get_flags"),
|
||||
write_cb = create_write_cb("set_flags")
|
||||
}
|
||||
}
|
||||
|
||||
local editor_params
|
||||
do
|
||||
local params = {}
|
||||
for key, _ in pairs(wrappers) do
|
||||
params[#params + 1] = key
|
||||
end
|
||||
editor_params = table.concat(params, "|")
|
||||
end
|
||||
|
||||
core.register_chatcommand("player_editor", {
|
||||
params = "<"..editor_params..">",
|
||||
description = "Open editor for some player data",
|
||||
func = function(name, param)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
if wrappers[param] then
|
||||
editor_formspec_create(name, wrappers[param])
|
||||
else
|
||||
return false, S("Use with @1.", editor_params)
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
2
games/devtest/mods/testeditor/mod.conf
Normal file
2
games/devtest/mods/testeditor/mod.conf
Normal file
|
@ -0,0 +1,2 @@
|
|||
name = testeditor
|
||||
description = Commands for create formspec for edit some things like sky etc.
|
|
@ -339,10 +339,11 @@ local pages = {
|
|||
[[
|
||||
formspec_version[3]
|
||||
size[12,13]
|
||||
allow_close[false]
|
||||
image_button[0,0;1,1;logo.png;rc_image_button_1x1;1x1]
|
||||
image_button[1,0;2,2;logo.png;rc_image_button_2x2;2x2]
|
||||
image_button_exit[1,0;2,2;logo.png;rc_image_button_2x2;2x2 exit]
|
||||
button[0,2;1,1;rc_button_1x1;1x1]
|
||||
button[1,2;2,2;rc_button_2x2;2x2]
|
||||
button_exit[1,2;2,2;rc_button_2x2;2x2 exit]
|
||||
item_image[0,4;1,1;air]
|
||||
item_image[1,4;2,2;air]
|
||||
item_image_button[0,6;1,1;testformspec:node;rc_item_image_button_1x1;1x1]
|
||||
|
@ -575,6 +576,10 @@ core.register_on_player_receive_fields(function(player, formname, fields)
|
|||
if fields.submit_window then
|
||||
show_test_formspec(player:get_player_name())
|
||||
end
|
||||
|
||||
if fields.try_quit then
|
||||
core.chat_send_player(player:get_player_name(), "Quit attempt received")
|
||||
end
|
||||
end)
|
||||
|
||||
core.register_chatcommand("test_formspec", {
|
||||
|
|
|
@ -8,6 +8,8 @@ compare_meta:from_table({
|
|||
c = "3",
|
||||
d = "4",
|
||||
e = "e",
|
||||
["0.3"] = "0.29999999999999999",
|
||||
["0.1+0.2"] = "0.30000000000000004",
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -21,6 +23,9 @@ local function test_metadata(meta)
|
|||
meta:set_string("", "!")
|
||||
meta:set_string("", "")
|
||||
|
||||
meta:set_float("0.3", 0.3)
|
||||
meta:set_float("0.1+0.2", 0.1 + 0.2)
|
||||
|
||||
assert(meta:equals(compare_meta))
|
||||
|
||||
local tab = meta:to_table()
|
||||
|
@ -29,6 +34,8 @@ local function test_metadata(meta)
|
|||
assert(tab.fields.c == "3")
|
||||
assert(tab.fields.d == "4")
|
||||
assert(tab.fields.e == "e")
|
||||
assert(tab.fields["0.3"] == "0.29999999999999999")
|
||||
assert(tab.fields["0.1+0.2"] == "0.30000000000000004")
|
||||
|
||||
local keys = meta:get_keys()
|
||||
assert(table.indexof(keys, "a") > 0)
|
||||
|
@ -36,7 +43,7 @@ local function test_metadata(meta)
|
|||
assert(table.indexof(keys, "c") > 0)
|
||||
assert(table.indexof(keys, "d") > 0)
|
||||
assert(table.indexof(keys, "e") > 0)
|
||||
assert(#keys == 5)
|
||||
assert(#keys == 7)
|
||||
|
||||
assert(not meta:contains(""))
|
||||
assert(meta:contains("a"))
|
||||
|
@ -55,6 +62,8 @@ local function test_metadata(meta)
|
|||
assert(meta:get_float("a") == 1.0)
|
||||
assert(meta:get_int("e") == 0)
|
||||
assert(meta:get_float("e") == 0.0)
|
||||
assert(meta:get_float("0.3") == 0.3)
|
||||
assert(meta:get_float("0.1+0.2") == 0.1 + 0.2)
|
||||
|
||||
meta:set_float("f", 1.1)
|
||||
meta:set_string("g", "${f}")
|
||||
|
|
|
@ -21,6 +21,4 @@ Copyright (C) 2002-2012 Nikolaus Gebhardt
|
|||
the Irrlicht Engine in your product, you must acknowledge somewhere in your
|
||||
documentation that you've used the IJPG code. It would also be nice to mention
|
||||
that you use the Irrlicht Engine, the zlib, libPng and aesGladman. See the
|
||||
corresponding license files for further informations. It is also possible to disable
|
||||
usage of those additional libraries by defines in the IrrCompileConfig.h header and
|
||||
recompiling the engine.
|
||||
corresponding license files for further informations.
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
// Copyright (C) 2002-2012 Nikolaus Gebhardt
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace io
|
||||
{
|
||||
|
||||
//! Types of attributes available for IAttributes
|
||||
enum E_ATTRIBUTE_TYPE
|
||||
{
|
||||
// integer attribute
|
||||
EAT_INT = 0,
|
||||
|
||||
// float attribute
|
||||
EAT_FLOAT,
|
||||
|
||||
// boolean attribute
|
||||
EAT_BOOL,
|
||||
|
||||
// known attribute type count
|
||||
EAT_COUNT,
|
||||
|
||||
// unknown attribute
|
||||
EAT_UNKNOWN
|
||||
};
|
||||
|
||||
} // end namespace io
|
||||
} // end namespace irr
|
|
@ -24,9 +24,6 @@ enum EGUI_ELEMENT_TYPE
|
|||
//! A combo box (IGUIComboBox)
|
||||
EGUIET_COMBO_BOX,
|
||||
|
||||
//! A context menu (IGUIContextMenu)
|
||||
EGUIET_CONTEXT_MENU,
|
||||
|
||||
//! A menu (IGUIMenu)
|
||||
EGUIET_MENU,
|
||||
|
||||
|
@ -36,54 +33,30 @@ enum EGUI_ELEMENT_TYPE
|
|||
//! A file open dialog (IGUIFileOpenDialog)
|
||||
EGUIET_FILE_OPEN_DIALOG,
|
||||
|
||||
//! A color select open dialog (IGUIColorSelectDialog)
|
||||
EGUIET_COLOR_SELECT_DIALOG,
|
||||
|
||||
//! A in/out fader (IGUIInOutFader)
|
||||
EGUIET_IN_OUT_FADER,
|
||||
|
||||
//! An image (IGUIImage)
|
||||
EGUIET_IMAGE,
|
||||
|
||||
//! A list box (IGUIListBox)
|
||||
EGUIET_LIST_BOX,
|
||||
|
||||
//! A mesh viewer (IGUIMeshViewer)
|
||||
EGUIET_MESH_VIEWER,
|
||||
|
||||
//! A message box (IGUIWindow)
|
||||
EGUIET_MESSAGE_BOX,
|
||||
|
||||
//! A modal screen
|
||||
EGUIET_MODAL_SCREEN,
|
||||
|
||||
//! A scroll bar (IGUIScrollBar)
|
||||
EGUIET_SCROLL_BAR,
|
||||
|
||||
//! A spin box (IGUISpinBox)
|
||||
EGUIET_SPIN_BOX,
|
||||
|
||||
//! A static text (IGUIStaticText)
|
||||
EGUIET_STATIC_TEXT,
|
||||
|
||||
//! A table (GUITable)
|
||||
EGUIET_TABLE,
|
||||
|
||||
//! A tab (IGUITab)
|
||||
EGUIET_TAB,
|
||||
|
||||
//! A tab control
|
||||
EGUIET_TAB_CONTROL,
|
||||
|
||||
//! A Table
|
||||
EGUIET_TABLE,
|
||||
|
||||
//! A tool bar (IGUIToolBar)
|
||||
EGUIET_TOOL_BAR,
|
||||
|
||||
//! A Tree View
|
||||
EGUIET_TREE_VIEW,
|
||||
|
||||
//! A window
|
||||
EGUIET_WINDOW,
|
||||
|
||||
//! Unknown type.
|
||||
EGUIET_ELEMENT,
|
||||
|
||||
|
@ -98,36 +71,5 @@ enum EGUI_ELEMENT_TYPE
|
|||
|
||||
};
|
||||
|
||||
//! Names for built-in element types
|
||||
const c8 *const GUIElementTypeNames[] = {
|
||||
"button",
|
||||
"checkBox",
|
||||
"comboBox",
|
||||
"contextMenu",
|
||||
"menu",
|
||||
"editBox",
|
||||
"fileOpenDialog",
|
||||
"colorSelectDialog",
|
||||
"inOutFader",
|
||||
"image",
|
||||
"listBox",
|
||||
"meshViewer",
|
||||
"messageBox",
|
||||
"modalScreen",
|
||||
"scrollBar",
|
||||
"spinBox",
|
||||
"staticText",
|
||||
"tab",
|
||||
"tabControl",
|
||||
"table",
|
||||
"toolBar",
|
||||
"treeview",
|
||||
"window",
|
||||
"element",
|
||||
"root",
|
||||
"profiler",
|
||||
0,
|
||||
};
|
||||
|
||||
} // end namespace gui
|
||||
} // end namespace irr
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
// Copyright (C) 2002-2012 Nikolaus Gebhardt
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "IReferenceCounted.h"
|
||||
#include "EAttributes.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
class ITexture;
|
||||
} // end namespace video
|
||||
namespace io
|
||||
{
|
||||
|
||||
//! Provides a generic interface for attributes and their values and the possibility to serialize them
|
||||
class IAttributes : public virtual IReferenceCounted
|
||||
{
|
||||
public:
|
||||
//! Returns the type of an attribute
|
||||
//! \param attributeName: Name for the attribute
|
||||
virtual E_ATTRIBUTE_TYPE getAttributeType(const c8 *attributeName) const = 0;
|
||||
|
||||
//! Returns if an attribute with a name exists
|
||||
virtual bool existsAttribute(const c8 *attributeName) const = 0;
|
||||
|
||||
//! Removes all attributes
|
||||
virtual void clear() = 0;
|
||||
|
||||
/*
|
||||
|
||||
Integer Attribute
|
||||
|
||||
*/
|
||||
|
||||
//! Adds an attribute as integer
|
||||
virtual void addInt(const c8 *attributeName, s32 value) = 0;
|
||||
|
||||
//! Sets an attribute as integer value
|
||||
virtual void setAttribute(const c8 *attributeName, s32 value) = 0;
|
||||
|
||||
//! Gets an attribute as integer value
|
||||
//! \param attributeName: Name of the attribute to get.
|
||||
//! \param defaultNotFound Value returned when attributeName was not found
|
||||
//! \return Returns value of the attribute previously set by setAttribute()
|
||||
virtual s32 getAttributeAsInt(const c8 *attributeName, irr::s32 defaultNotFound = 0) const = 0;
|
||||
|
||||
/*
|
||||
|
||||
Float Attribute
|
||||
|
||||
*/
|
||||
|
||||
//! Adds an attribute as float
|
||||
virtual void addFloat(const c8 *attributeName, f32 value) = 0;
|
||||
|
||||
//! Sets a attribute as float value
|
||||
virtual void setAttribute(const c8 *attributeName, f32 value) = 0;
|
||||
|
||||
//! Gets an attribute as float value
|
||||
//! \param attributeName: Name of the attribute to get.
|
||||
//! \param defaultNotFound Value returned when attributeName was not found
|
||||
//! \return Returns value of the attribute previously set by setAttribute()
|
||||
virtual f32 getAttributeAsFloat(const c8 *attributeName, irr::f32 defaultNotFound = 0.f) const = 0;
|
||||
|
||||
/*
|
||||
Bool Attribute
|
||||
*/
|
||||
|
||||
//! Adds an attribute as bool
|
||||
virtual void addBool(const c8 *attributeName, bool value) = 0;
|
||||
|
||||
//! Sets an attribute as boolean value
|
||||
virtual void setAttribute(const c8 *attributeName, bool value) = 0;
|
||||
|
||||
//! Gets an attribute as boolean value
|
||||
//! \param attributeName: Name of the attribute to get.
|
||||
//! \param defaultNotFound Value returned when attributeName was not found
|
||||
//! \return Returns value of the attribute previously set by setAttribute()
|
||||
virtual bool getAttributeAsBool(const c8 *attributeName, bool defaultNotFound = false) const = 0;
|
||||
};
|
||||
|
||||
} // end namespace io
|
||||
} // end namespace irr
|
|
@ -19,7 +19,6 @@ namespace io
|
|||
class IReadFile;
|
||||
class IWriteFile;
|
||||
class IFileList;
|
||||
class IAttributes;
|
||||
|
||||
//! The FileSystem manages files and archives and provides access to them.
|
||||
/** It manages where files are, so that modules which use the the IO do not
|
||||
|
|
|
@ -662,13 +662,6 @@ public:
|
|||
return type == Type;
|
||||
}
|
||||
|
||||
//! Returns the type name of the gui element.
|
||||
/** This is needed serializing elements. */
|
||||
virtual const c8 *getTypeName() const
|
||||
{
|
||||
return GUIElementTypeNames[Type];
|
||||
}
|
||||
|
||||
//! Returns the name of the element.
|
||||
/** \return Name as character string. */
|
||||
virtual const c8 *getName() const
|
||||
|
|
|
@ -130,26 +130,18 @@ public:
|
|||
|
||||
//! Sets a new GUI Skin
|
||||
/** You can use this to change the appearance of the whole GUI
|
||||
Environment. You can set one of the built-in skins or implement your
|
||||
own class derived from IGUISkin and enable it using this method.
|
||||
To set for example the built-in Windows classic skin, use the following
|
||||
code:
|
||||
\code
|
||||
gui::IGUISkin* newskin = environment->createSkin(gui::EGST_WINDOWS_CLASSIC);
|
||||
environment->setSkin(newskin);
|
||||
newskin->drop();
|
||||
\endcode
|
||||
Environment.
|
||||
\param skin New skin to use.
|
||||
*/
|
||||
virtual void setSkin(IGUISkin *skin) = 0;
|
||||
|
||||
//! Creates a new GUI Skin based on a template.
|
||||
//! Creates a new GUI Skin.
|
||||
/** Use setSkin() to set the created skin.
|
||||
\param type The type of the new skin.
|
||||
\return Pointer to the created skin.
|
||||
If you no longer need it, you should call IGUISkin::drop().
|
||||
See IReferenceCounted::drop() for more information. */
|
||||
virtual IGUISkin *createSkin(EGUI_SKIN_TYPE type) = 0;
|
||||
virtual IGUISkin *createSkin() = 0;
|
||||
|
||||
//! Creates the image list from the given texture.
|
||||
/** \param texture Texture to split into images
|
||||
|
|
|
@ -17,42 +17,6 @@ class IGUIFont;
|
|||
class IGUISpriteBank;
|
||||
class IGUIElement;
|
||||
|
||||
//! Enumeration of available default skins.
|
||||
/** To set one of the skins, use the following code, for example to set
|
||||
the Windows classic skin:
|
||||
\code
|
||||
gui::IGUISkin* newskin = environment->createSkin(gui::EGST_WINDOWS_CLASSIC);
|
||||
environment->setSkin(newskin);
|
||||
newskin->drop();
|
||||
\endcode
|
||||
*/
|
||||
enum EGUI_SKIN_TYPE
|
||||
{
|
||||
//! Default windows look and feel
|
||||
EGST_WINDOWS_CLASSIC = 0,
|
||||
|
||||
//! Like EGST_WINDOWS_CLASSIC, but with metallic shaded windows and buttons
|
||||
EGST_WINDOWS_METALLIC,
|
||||
|
||||
//! Burning's skin
|
||||
EGST_BURNING_SKIN,
|
||||
|
||||
//! An unknown skin, not serializable at present
|
||||
EGST_UNKNOWN,
|
||||
|
||||
//! this value is not used, it only specifies the number of skin types
|
||||
EGST_COUNT
|
||||
};
|
||||
|
||||
//! Names for gui element types
|
||||
const c8 *const GUISkinTypeNames[EGST_COUNT + 1] = {
|
||||
"windowsClassic",
|
||||
"windowsMetallic",
|
||||
"burning",
|
||||
"unknown",
|
||||
0,
|
||||
};
|
||||
|
||||
//! Enumeration for skin colors
|
||||
enum EGUI_DEFAULT_COLOR
|
||||
{
|
||||
|
@ -570,9 +534,6 @@ public:
|
|||
If the pointer is null, no clipping will be performed. */
|
||||
virtual void draw2DRectangle(IGUIElement *element, const video::SColor &color,
|
||||
const core::rect<s32> &pos, const core::rect<s32> *clip = 0) = 0;
|
||||
|
||||
//! get the type of this skin
|
||||
virtual EGUI_SKIN_TYPE getType() const { return EGST_UNKNOWN; }
|
||||
};
|
||||
|
||||
} // end namespace gui
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "IIndexBuffer.h"
|
||||
#include "EHardwareBufferFlags.h"
|
||||
#include "EPrimitiveTypes.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -121,7 +122,7 @@ public:
|
|||
/** \return Pointer to indices array. */
|
||||
inline const u16 *getIndices() const
|
||||
{
|
||||
_IRR_DEBUG_BREAK_IF(getIndexBuffer()->getType() != video::EIT_16BIT);
|
||||
assert(getIndexBuffer()->getType() == video::EIT_16BIT);
|
||||
return static_cast<const u16*>(getIndexBuffer()->getData());
|
||||
}
|
||||
|
||||
|
@ -129,7 +130,7 @@ public:
|
|||
/** \return Pointer to indices array. */
|
||||
inline u16 *getIndices()
|
||||
{
|
||||
_IRR_DEBUG_BREAK_IF(getIndexBuffer()->getType() != video::EIT_16BIT);
|
||||
assert(getIndexBuffer()->getType() == video::EIT_16BIT);
|
||||
return static_cast<u16*>(getIndexBuffer()->getData());
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "irrTypes.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -118,7 +119,7 @@ public:
|
|||
bool drop() const
|
||||
{
|
||||
// someone is doing bad reference counting.
|
||||
_IRR_DEBUG_BREAK_IF(ReferenceCounter <= 0)
|
||||
assert(ReferenceCounter > 0);
|
||||
|
||||
--ReferenceCounter;
|
||||
if (!ReferenceCounter) {
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "dimension2d.h"
|
||||
#include "SColor.h"
|
||||
#include "ESceneNodeTypes.h"
|
||||
#include "SceneParameters.h" // IWYU pragma: export
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -20,7 +19,6 @@ struct SEvent;
|
|||
namespace io
|
||||
{
|
||||
class IReadFile;
|
||||
class IAttributes;
|
||||
class IWriteFile;
|
||||
class IFileSystem;
|
||||
} // end namespace io
|
||||
|
@ -373,11 +371,6 @@ public:
|
|||
/** All scene nodes are removed. */
|
||||
virtual void clear() = 0;
|
||||
|
||||
//! Get interface to the parameters set in this scene.
|
||||
/** String parameters can be used by plugins and mesh loaders.
|
||||
See COLLADA_CREATE_SCENE_INSTANCES and DMF_USE_MATERIALS_DIRS */
|
||||
virtual io::IAttributes *getParameters() = 0;
|
||||
|
||||
//! Get current render pass.
|
||||
/** All scene nodes are being rendered in a specific order.
|
||||
First lights, cameras, sky boxes, solid geometry, and then transparent
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <list>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -268,7 +269,7 @@ public:
|
|||
return false;
|
||||
|
||||
// The iterator must be set since the parent is not null.
|
||||
_IRR_DEBUG_BREAK_IF(!child->ThisIterator.has_value());
|
||||
assert(child->ThisIterator.has_value());
|
||||
auto it = *child->ThisIterator;
|
||||
child->ThisIterator = std::nullopt;
|
||||
child->Parent = nullptr;
|
||||
|
|
|
@ -25,7 +25,6 @@ namespace irr
|
|||
{
|
||||
namespace io
|
||||
{
|
||||
class IAttributes;
|
||||
class IReadFile;
|
||||
class IWriteFile;
|
||||
} // end namespace io
|
||||
|
@ -127,23 +126,6 @@ public:
|
|||
\param flag When true the feature is disabled, otherwise it is enabled. */
|
||||
virtual void disableFeature(E_VIDEO_DRIVER_FEATURE feature, bool flag = true) = 0;
|
||||
|
||||
//! Get attributes of the actual video driver
|
||||
/** The following names can be queried for the given types:
|
||||
MaxTextures (int) The maximum number of simultaneous textures supported by the driver. This can be less than the supported number of textures of the driver. Use _IRR_MATERIAL_MAX_TEXTURES_ to adapt the number.
|
||||
MaxSupportedTextures (int) The maximum number of simultaneous textures supported by the fixed function pipeline of the (hw) driver. The actual supported number of textures supported by the engine can be lower.
|
||||
MaxAnisotropy (int) Number of anisotropy levels supported for filtering. At least 1, max is typically at 16 or 32.
|
||||
MaxAuxBuffers (int) Special render buffers, which are currently not really usable inside Irrlicht. Only supported by OpenGL
|
||||
MaxMultipleRenderTargets (int) Number of render targets which can be bound simultaneously. Rendering to MRTs is done via shaders.
|
||||
MaxIndices (int) Number of indices which can be used in one render call (i.e. one mesh buffer).
|
||||
MaxTextureSize (int) Dimension that a texture may have, both in width and height.
|
||||
MaxGeometryVerticesOut (int) Number of vertices the geometry shader can output in one pass. Only OpenGL so far.
|
||||
MaxTextureLODBias (float) Maximum value for LOD bias. Is usually at around 16, but can be lower on some systems.
|
||||
Version (int) Version of the driver. Should be Major*100+Minor
|
||||
ShaderLanguageVersion (int) Version of the high level shader language. Should be Major*100+Minor.
|
||||
AntiAlias (int) Number of Samples the driver uses for each pixel. 0 and 1 means anti aliasing is off, typical values are 2,4,8,16,32
|
||||
*/
|
||||
virtual const io::IAttributes &getDriverAttributes() const = 0;
|
||||
|
||||
//! Sets transformation matrices.
|
||||
/** \param state Transformation type to be set, e.g. view,
|
||||
world, or projection.
|
||||
|
@ -1132,7 +1114,6 @@ public:
|
|||
|
||||
//! Only used by the engine internally.
|
||||
/** Passes the global material flag AllowZWriteOnTransparent.
|
||||
Use the SceneManager attribute to set this value from your app.
|
||||
\param flag Default behavior is to disable ZWrite, i.e. false. */
|
||||
virtual void setAllowZWriteOnTransparent(bool flag) = 0;
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (C) 2002-2012 Nikolaus Gebhardt
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#pragma once
|
||||
|
||||
// these are obsolete and never pre-defined
|
||||
|
||||
#define IRRCALLCONV
|
||||
|
||||
#define IRRLICHT_API
|
|
@ -13,9 +13,9 @@
|
|||
#include "ITimer.h"
|
||||
#include "IOSOperator.h"
|
||||
#include "irrArray.h"
|
||||
#include "IrrCompileConfig.h"
|
||||
#include "position2d.h"
|
||||
#include "SColor.h" // video::ECOLOR_FORMAT
|
||||
#include <string>
|
||||
#include <variant>
|
||||
|
||||
namespace irr
|
||||
|
@ -44,7 +44,7 @@ class IContextManager;
|
|||
class IImage;
|
||||
class ITexture;
|
||||
class IVideoDriver;
|
||||
extern "C" IRRLICHT_API bool IRRCALLCONV isDriverSupported(E_DRIVER_TYPE driver);
|
||||
extern "C" bool isDriverSupported(E_DRIVER_TYPE driver);
|
||||
} // end namespace video
|
||||
|
||||
//! The Irrlicht device. You can create it with createDevice() or createDeviceEx().
|
||||
|
@ -332,6 +332,12 @@ public:
|
|||
used. */
|
||||
virtual E_DEVICE_TYPE getType() const = 0;
|
||||
|
||||
//! Get the version string of the underlying system (e.g. SDL)
|
||||
virtual std::string getVersionString() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
//! Get the display density in dots per inch.
|
||||
//! Returns 0.0f on failure.
|
||||
virtual float getDisplayDensity() const = 0;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "EMaterialTypes.h" // IWYU pragma: export
|
||||
#include "EMaterialProps.h" // IWYU pragma: export
|
||||
#include "SMaterialLayer.h"
|
||||
#include "IrrCompileConfig.h" // for IRRLICHT_API
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -472,7 +471,7 @@ public:
|
|||
};
|
||||
|
||||
//! global const identity Material
|
||||
IRRLICHT_API extern const SMaterial IdentityMaterial;
|
||||
extern const SMaterial IdentityMaterial;
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "CVertexBuffer.h"
|
||||
#include "CIndexBuffer.h"
|
||||
#include "S3DVertex.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -200,7 +201,7 @@ public:
|
|||
//! append the vertices and indices to the current buffer
|
||||
void append(const void *const vertices, u32 numVertices, const u16 *const indices, u32 numIndices) override
|
||||
{
|
||||
_IRR_DEBUG_BREAK_IF(true);
|
||||
assert(false);
|
||||
}
|
||||
|
||||
//! Describe what kind of primitive geometry is used by the meshbuffer
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue