Compare commits

...

445 Commits

Author SHA1 Message Date
SmallJoker
5ab66da6f7 Bump version to 5.13.0 2025-08-01 14:22:14 +02:00
SmallJoker
919b7c5433 Update credits for 5.13.0
Co-authored-by: sfan5 <sfan5@live.de>
2025-08-01 14:12:18 +02:00
Lars Mueller
613ba689ff Work around #16221 by updating parent chains 2025-08-01 14:12:02 +02:00
Lars Mueller
26aab6ecf2 Fix flakey matrix rotation unit test for now 2025-07-30 23:43:10 +02:00
Abdurahman Elmawi
d949f5ffcb Fix WM grouping confusion on Linux (#16287)
This fixes an issue on some desktops that causes the application window to get improperly grouped & iconified.
2025-07-30 23:42:34 +02:00
sfan5
9ff38bdf7f Sky: Get custom sun and moon tinting to work again
This fixes a regression introduced by commit 58ccf0b.
2025-07-29 20:36:23 +02:00
sfan5
d679261488 Rewrite broken logic in blit_with_alpha2 2025-07-28 11:16:07 +02:00
grorp
7345b54f18 Android: Workaround for partially broken inputs 2025-07-28 11:14:37 +02:00
SmallJoker
0deee5eaf0 Bump network/formspec versions for 5.13.0 2025-07-27 09:00:20 +02:00
sfan5
d8640759d6 Extend error case tests 2025-07-25 12:08:32 +02:00
Zughy
535db2be76 Make max_formspec_size docs clearer 2025-07-22 16:40:07 +02:00
SmallJoker
d60f909566 ParticleSpawner: Fix crash caused by empty texture
no_texture.png is now used as a fallback (if available), like already seen with registered items with empty 'inventory_image'.
2025-07-22 16:39:51 +02:00
goodusername123
c9230c5c09 Improve interop with LuaJIT: Disable 5.0 compatibility defines in Lua config 2025-07-22 16:39:34 +02:00
Lars Müller
643d1cbd8d Docs: Remove outdated glTF status notice
glTF now both unlocks (minor) new features, e.g. constant interpolation, and supports animation.
2025-07-19 21:31:45 +02:00
sfan5
251488b3aa Enforce explicit size limit for media files 2025-07-16 11:42:54 +02:00
sfan5
3cb8ce69d2 Minor cleanups and logging changes 2025-07-16 11:42:54 +02:00
sfan5
77dd86a79c Do not mark system-wide content as updateable
relates to #16302
2025-07-16 11:42:54 +02:00
sfan5
0eabc252b8 Relax path_user sandbox access in mainmenu
fixes #16302
2025-07-16 11:42:54 +02:00
sfan5
e8e5ef0369 Deleted unused parts of blitter 2025-07-16 11:42:21 +02:00
sfan5
158bfa6442 Replace copyToWithAlpha with more appropriate functions
fixes #16316
2025-07-16 11:42:21 +02:00
Lars Müller
23bf50a07c Document & extend testing for rotation conventions (#16200)
* Document Luanti rotation conventions
* Add test for setPitchYawRollRad (entity) rotation conventions
* Test and document that `vector.rotate` uses (extrinsic) Z-X-Y rotation order
2025-07-13 17:11:12 +02:00
updatepo.sh
33940021a1 Run updatepo.sh 2025-07-12 13:42:18 +02:00
SmallJoker
3dd99e1492 updatepo: Drop strings that are obsolete for >1 script run
This automatically removes old (and unused) translation strings such
that the amount of garbage is kept in bounds.
2025-07-12 13:42:18 +02:00
updatepo.sh
15f41eb82e Update minetest.conf.example and translation file 2025-07-12 13:42:18 +02:00
SmallJoker
ef7f1ac28f Settingtypes: Add comments and deduplicate translation strings 2025-07-12 13:42:18 +02:00
Саша Петровић
e1b057ca56 Translated using Weblate (Serbian)
Currently translated at 62.9% (964 of 1531 strings)
2025-07-12 13:42:18 +02:00
GiorgeGi GiorgeGi
717e686ac3 Translated using Weblate (Greek)
Currently translated at 27.8% (427 of 1531 strings)
2025-07-12 13:42:18 +02:00
109247019824
adf6fe95e7 Translated using Weblate (Bulgarian)
Currently translated at 56.4% (864 of 1531 strings)
2025-07-12 13:42:18 +02:00
Hezem \"Human
751bfad09d Translated using Weblate (Kazakh)
Currently translated at 4.3% (67 of 1531 strings)
2025-07-12 13:42:18 +02:00
FedonT
22c3c04f24 Translated using Weblate (Greek)
Currently translated at 22.0% (338 of 1531 strings)
2025-07-12 13:42:18 +02:00
BlackImpostor
84b13998e6 Translated using Weblate (Russian)
Currently translated at 100.0% (1531 of 1531 strings)
2025-07-12 13:42:18 +02:00
nauta-turbidus
b8f870f0e2 Translated using Weblate (Polish)
Currently translated at 86.1% (1319 of 1531 strings)
2025-07-12 13:42:18 +02:00
Lars Mueller
37f922b500 Improve some deprecation warnings 2025-07-12 13:23:49 +02:00
Lars Mueller
8e03e94ea9 Improve script_log_add_source: Log full path for files 2025-07-12 13:23:49 +02:00
Lucas OH
ce2380b58e Include header files in CMake sources (#16297) 2025-07-12 13:23:35 +02:00
Lucas OH
f71e1447c9 Fix downward shadows at time 12000 (#16326) 2025-07-12 13:23:17 +02:00
sfence
4f42b4308c Add persistent unique identifiers for objects (#14135) 2025-07-09 10:40:26 +02:00
et
e0f8243629 Clarify some documentation (#16301) 2025-07-09 10:36:02 +02:00
Lars Müller
61551cfc3a Remove irr namespace (#16309) 2025-07-09 10:35:52 +02:00
SmallJoker
7e22c72492 minetest.conf.example: Document short setting name as fallback (#16313) 2025-07-09 10:35:41 +02:00
Lucas OH
51a453ca7b Formspec: Fix newline conversion on Windows (#16311)
Strings with CR+LF (\r+\n) were wrongly fixed into \r, which is enough to display them correctly, but the missing \n became important once the text was saved/reloaded.

By removing the \r instead of the \n, then the text is displayed correctly and saved correctly.
2025-07-06 22:10:51 +02:00
GiorgeGi GiorgeGi
2a8ee686d9 Translated using Weblate (Greek)
Currently translated at 21.6% (332 of 1531 strings)
2025-07-04 23:53:41 +02:00
Tanavit MINETEST
af4c182286 Translated using Weblate (French)
Currently translated at 100.0% (1531 of 1531 strings)
2025-07-04 23:53:41 +02:00
Тарас Арт
f93d076fa2 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (1531 of 1531 strings)
2025-07-04 23:53:41 +02:00
Kisbenedek Márton
d945792053 Translated using Weblate (Hungarian)
Currently translated at 98.3% (1505 of 1531 strings)
2025-07-04 23:53:41 +02:00
Santi cluke
dbb96b71a2 Translated using Weblate (Spanish)
Currently translated at 89.8% (1376 of 1531 strings)
2025-07-04 23:53:40 +02:00
Curt Jared Orbita
d4491d5f2f Translated using Weblate (Filipino)
Currently translated at 35.2% (540 of 1531 strings)
2025-07-04 23:53:40 +02:00
தமிழ்நேரம்
a41a24dc6c Translated using Weblate (Tamil)
Currently translated at 100.0% (1531 of 1531 strings)
2025-07-04 23:53:40 +02:00
ShiloMazuz
a51b518648 Translated using Weblate (Hebrew)
Currently translated at 30.1% (462 of 1531 strings)
2025-07-04 23:53:40 +02:00
Саша Петровић
94c9636d7c Translated using Weblate (Serbian (Cyrillic script))
Currently translated at 21.9% (336 of 1531 strings)
2025-07-04 23:53:40 +02:00
ButterflyOfFire
47c0be86be Translated using Weblate (Kabyle)
Currently translated at 1.8% (29 of 1531 strings)
2025-07-04 23:53:40 +02:00
ButterflyOfFire
4bfbfccbe0 Added translation using Weblate (Kabyle) 2025-07-04 23:53:40 +02:00
Yof
d1d33ae4bc Translated using Weblate (Ukrainian)
Currently translated at 90.4% (1385 of 1531 strings)
2025-07-04 23:53:40 +02:00
Саша Петровић
5b714aa932 Translated using Weblate (Serbian)
Currently translated at 62.7% (961 of 1531 strings)
2025-07-04 23:53:40 +02:00
Саша Петровић
4378757820 Added translation using Weblate (Serbian) 2025-07-04 23:53:40 +02:00
jhon game
5026ea18f5 Translated using Weblate (Hebrew)
Currently translated at 29.5% (453 of 1531 strings)
2025-07-04 23:53:40 +02:00
ninjum
8e7fbed4e4 Translated using Weblate (Galician)
Currently translated at 94.8% (1452 of 1531 strings)
2025-07-04 23:53:40 +02:00
jhon game
69ad83d9c9 Added translation using Weblate (Hebrew) 2025-07-04 23:53:40 +02:00
gogu
639edcddcf Translated using Weblate (Bavarian)
Currently translated at 6.3% (97 of 1531 strings)
2025-07-04 23:53:40 +02:00
gogu
21df20185c Added translation using Weblate (Bavarian) 2025-07-04 23:53:40 +02:00
Zughy
3865287b8b Translated using Weblate (Italian)
Currently translated at 87.5% (1340 of 1531 strings)
2025-07-04 23:53:40 +02:00
Jorge Rodríguez
d7b876ba0e Translated using Weblate (Spanish)
Currently translated at 88.8% (1361 of 1531 strings)
2025-07-04 23:53:40 +02:00
109247019824
ec7119327a Translated using Weblate (Bulgarian)
Currently translated at 48.4% (742 of 1531 strings)
2025-07-04 23:53:40 +02:00
maxchen32
2f94347af9 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 90.2% (1381 of 1531 strings)
2025-07-04 23:53:40 +02:00
Vesel Sem
17b3d5f381 Translated using Weblate (Slovenian)
Currently translated at 54.8% (839 of 1531 strings)
2025-07-04 23:53:39 +02:00
maxchen32
9a1e83036b Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 89.6% (1373 of 1531 strings)
2025-07-04 23:53:39 +02:00
Тарас Арт
c3d669266e Translated using Weblate (Ukrainian)
Currently translated at 88.8% (1361 of 1531 strings)
2025-07-04 23:53:39 +02:00
Quốc Kiệt Nguyễn Hữu
5f428ffe76 Translated using Weblate (Vietnamese)
Currently translated at 39.2% (601 of 1531 strings)
2025-07-04 23:53:39 +02:00
BreadW
846a3baf68 Translated using Weblate (Japanese)
Currently translated at 100.0% (1531 of 1531 strings)
2025-07-04 23:53:39 +02:00
ROllerozxa
a61a53db9a Translated using Weblate (Swedish)
Currently translated at 67.1% (1028 of 1531 strings)
2025-07-04 23:53:39 +02:00
BlackImpostor
1472379f39 Translated using Weblate (Russian)
Currently translated at 100.0% (1531 of 1531 strings)
2025-07-04 23:53:39 +02:00
Wuzzy
599c93633a Translated using Weblate (German)
Currently translated at 100.0% (1531 of 1531 strings)
2025-07-04 23:53:39 +02:00
lhofhansl
1a58a2fd2b Fix Camera's far clipping plane for large zooms (#16307)
* Make zoomed view beyond 2000 nodes are rendered correctly.
2025-07-03 17:11:36 -07:00
Lucas OH
5b37614d23 Use unique_ptr for trivial ownership (#16300) 2025-07-03 17:32:46 +02:00
Lars Müller
08bc036311 Remove obsolete SMeshBuffer.h (#16308) 2025-07-03 17:32:35 +02:00
sfan5
83a7e22cf7 Do not block in httpfetch_request_clear() (#16303) 2025-07-03 17:32:05 +02:00
DragonWrangler1
80be9bf76e Add keybinding for world close key (#16250)
Fix according to Lua code style guidelines (grorp)

Fix order in defaultsettings.cpp (grorp)

remove unrequired comment, and whitespace

Co-authored-by: y5nw <y5nw@users.noreply.github.com>
Co-authored-by: grorp <grorp@users.noreply.github.com>
2025-07-01 14:31:26 +02:00
lhofhansl
43aad3711b MapBlock::getData be gone (#16292)
* Remove Mapblock::getData and all its uses

* Do not leak ystride, zstride, and nodecount
2025-06-29 13:36:47 -07:00
sfan5
fd0ca20ce9 Add core.get_mapgen_chunksize() (#16289) 2025-06-29 17:19:40 +02:00
Lars
fcbf05fc30 Use MapBlock::copyTo to fill MeshMakeData 2025-06-27 10:36:33 -07:00
sfan5
2d36d32da8 Tune mesh generation interval and thread count 2025-06-26 16:39:26 +02:00
sfan5
2733df78c4 Skip pointless meshgen updates for air blocks 2025-06-26 16:39:26 +02:00
sfan5
6545710c8e Refactor meshgen-related code 2025-06-26 16:39:26 +02:00
lhofhansl
0ea89d4112 Avoid copying empty blocks for mesh-generation (#16286) 2025-06-25 15:05:34 +02:00
sfan5
8eceabd812 Make core.get_node_raw a public API (#16265)
Co-authored-by: Erich Schubert <erich.schubert@tu-dortmund.de>
2025-06-25 15:05:22 +02:00
sfan5
0794145b64 Build benchmarks in one CI run 2025-06-24 14:11:40 +02:00
grorp
90c3479520 ContentDB: Allow hitting "Install" before package info finishes loading (#16247) 2025-06-24 11:50:12 +02:00
Xeno333
da0f8cd6b5 Add documentation index for doc/ as README.md, and small docs fixes (#16253) 2025-06-24 11:49:59 +02:00
DS
48ef7fff23 Revert "Detect mouse moving out of inventory slot" (#16281)
This reverts commit 81d62d01d1.
2025-06-24 11:49:44 +02:00
Lars
1297ccc537 Quick fix for TestMap name collision, introduced in #16274 2025-06-23 13:27:40 -07:00
SmallJoker
fdc149f316 Formspec: Show a player inventory using core.show_formspec (#15963)
'core.show_formspec' now shows and updates the inventory formspec as if
it was opened using the hotkey on client-side.
2025-06-22 22:06:47 +02:00
Lars
d41de3da79 Add test benchmark for Map 2025-06-22 22:06:17 +02:00
Miguel P.L
49f48e0a7c Update links and names in the documentation (#16153) 2025-06-22 22:04:42 +02:00
Jürgen Rühle
81d62d01d1 Detect mouse moving out of inventory slot (#16101) 2025-06-13 23:36:44 +02:00
Xeno333
225d2cf916 Make minimap respect drawtype = "airlike" (#16251) 2025-06-13 23:33:10 +02:00
DS
f75d16c1e6 Fix some misinformation in world_format.md (#16256) 2025-06-13 23:32:55 +02:00
Xeno333
aba2b6638e Add documentation for ValueNoise during load time (#16235) 2025-06-07 14:44:35 +02:00
grorp
e452c2900f Don't force-enable tileable_horizontal/vertical for solid nodes 2025-06-07 14:44:09 +02:00
Lars Mueller
f431c12b85 Fix model[] not supporting float frames 2025-06-07 14:43:53 +02:00
sfan5
38255cb6bb Clean up makeScreenshot() and make message translateable 2025-06-07 14:43:26 +02:00
Gwyndolyn Shafer
b9af44b194 Remove redundant descriptions from key bindings (#16220) 2025-06-07 14:43:03 +02:00
jordan4ibanez
29a9056731 Fix 'core.mod_channel_join' return value documentation (#16218) 2025-06-07 14:42:14 +02:00
siliconsniffer
4454d71d7d Formspec: change tabs with ctrl(+shift)+tab (#16167)
This change makes it easier to go to the next/previous tab using keyboard controls.
2025-06-07 14:41:29 +02:00
Lars Müller
fde6384a09 Fix and clean up skeletal animation (#15722)
* Fix attachments lagging behind their parents (#14818)
* Fix animation blending (#14817)
* Bring back cool guy as another .x smoke test
* Add .x mesh loader unittest
* Do bounding box & matrix calculation at proper point in time
* Remove obsolete `SAnimatedMesh`
2025-06-01 23:21:35 +02:00
JosiahWI
0bb87eb1ff Avoid signal-unsafe operations in POSIX signal handler (#16160) 2025-06-01 15:24:32 +02:00
grorp
56a7f0b7cf Don't break when multiple dialogs are shown on startup (#16204) 2025-06-01 15:24:14 +02:00
sfan5
a2460df316 Print Luanti version after ascii art 2025-06-01 15:23:55 +02:00
SmallJoker
535d757563 Formspec: Move GUI event handling to switch/case 2025-05-30 13:05:13 +02:00
SmallJoker
660b1cf9bf Formspec: remove gotText(wstr) remains
These functions are now unused (no caller).
2025-05-30 13:05:13 +02:00
SmallJoker
fcddac6c07 Formspec: Fix malfunctioning 'Proceed' button on sizeless formspecs 2025-05-30 13:05:13 +02:00
sfan5
9f7501d20a Handle writing to unloaded blocks in MMVManip::blitBackAll()
This could happen before and would just silently discard the data,
but now that Lua can create VManips without loading from map beforehand
we definitely need to handle this case.
2025-05-30 13:03:21 +02:00
sfan5
aa1bab2156 Implement API to create empty VoxelManip 2025-05-30 13:03:21 +02:00
sfan5
6274a8dec4 Refactor MMVManip to get rid of m_loaded_blocks 2025-05-30 13:03:21 +02:00
sfan5
41651c7317 Add C++-side unit tests for MMVManip 2025-05-30 13:03:21 +02:00
sfan5
e03957ec0c Add VoxelManip:close() for explicit free 2025-05-30 13:03:21 +02:00
sfan5
79e0d834fd Rework user limit and checks around join process 2025-05-30 13:02:24 +02:00
sfan5
b580c66b61 Restrict minimum state for ClientInterface::sendToAll 2025-05-30 13:02:24 +02:00
sfan5
9ce9d7f433 Extend check for lingering clinets 2025-05-30 13:02:24 +02:00
Wuzzy
957ebf7368 settingtypes: Add no-c-format flag for xgettext 2025-05-30 13:02:15 +02:00
sfan5
5c2599315c Change nil-component error to deprecation warning 2025-05-28 13:29:30 +02:00
sfan5
6ca9d75f0b Reject NaN and Inf in check_v3d() too
check_v2f() was already doing this
2025-05-28 13:29:30 +02:00
sfan5
ec16fb33d0 Add unit tests for Lua vector reading 2025-05-28 13:29:30 +02:00
sfan5
a5263dc7ed Do not allow vector components to be nil 2025-05-28 13:29:30 +02:00
sfan5
ae35f37bc3 Move one CI run to be on 64-bit ARM 2025-05-28 13:29:20 +02:00
grorp
986cd32f28 Minor lua_api.md improvements (#16169) 2025-05-28 13:29:03 +02:00
SmallJoker
94a9b94baf Formspec: Fix incorrect cell size when using non-default fonts (#16178) 2025-05-27 18:47:41 +02:00
sfan5
da7897a822 Fix texture double-free in main menu
bug introduced in 1214a1d4a6
2025-05-27 13:56:18 +02:00
Josiah VanderZee
fa0c09d202 Do not modify peer timeout on shutdown
Shortening the peer timeout was supposedly necessary at some point
to work around an unknown bug. I was not able to reproduce the bug
running a headless Luanti server on WSL Tumbleweed and connecting with
a client on the Windows host. That is not enough to say the issue no
longer exists. This commit may cause a regression.

The access to change the peer timeout was unsynchronized and done by a
different thread than the sending thread, so it was detected by TSan to
be a data race. Since this patch deletes the code performing the write,
the data race is no longer a concern and no synchronization must be
added.
2025-05-24 22:49:49 +02:00
Josiah VanderZee
e9b32843a5 Make MTP server shutdown flag atomic
I noticed this potential data race while reading the code. I have not
detected it with TSan in practice.
2025-05-24 22:49:49 +02:00
sfan5
1214a1d4a6 Refactor ITextureSource use in main menu (#16135) 2025-05-24 22:49:29 +02:00
sfan5
452160cd00 Clean up read_tiledef and related parts a bit 2025-05-24 22:49:04 +02:00
cx384
d17f22f536 Fix texture coordinates of cuboid drawtypes (#16091)
Fixes issues related to combining animated and world-aligned textures.
Changes texture coordinates of cuboid drawtypes to stay in the [0,1] range, instead of carrying the mapblock alignment and becoming negative after transformations.
2025-05-24 15:59:32 +02:00
SmallJoker
2f1171e2a7 Formspec: Fix broken 9-slice image button with gui_scaling_filter (#16146)
The setting 'gui_scaling_filter = true' previously broke 9-slice images.
With this change, custom button background images now scale the same as
backgrounds created using 'background9[...]' (9-slice images).
2025-05-24 15:58:04 +02:00
sfan5
66aa5f3fac Continue with 5.13.0-dev 2025-05-23 17:43:09 +02:00
sfan5
8f0838506a Bump version to 5.12.0 2025-05-23 17:43:08 +02:00
updatepo.sh
9b2aeb2ca2 Update minetest.conf.example 2025-05-23 17:09:44 +02:00
Josu Igoa
b459d6ee63 Translated using Weblate (Basque)
Currently translated at 21.0% (323 of 1531 strings)
2025-05-23 17:05:47 +02:00
waxtatect
fc1d57b666 Translated using Weblate (French)
Currently translated at 100.0% (1531 of 1531 strings)
2025-05-23 17:05:47 +02:00
Ian Pedras
db561ff094 Translated using Weblate (Portuguese)
Currently translated at 80.6% (1235 of 1531 strings)
2025-05-23 17:05:47 +02:00
BlackImpostor
f6c933d891 Translated using Weblate (Russian)
Currently translated at 100.0% (1531 of 1531 strings)
2025-05-23 17:05:47 +02:00
y5nw
813f67021b Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 88.7% (1358 of 1531 strings)
2025-05-23 17:05:47 +02:00
Linerly
1b9a5074a2 Translated using Weblate (Indonesian)
Currently translated at 100.0% (1531 of 1531 strings)
2025-05-23 17:05:47 +02:00
Francesco Rossi
31e923e51a Translated using Weblate (Italian)
Currently translated at 76.0% (1164 of 1531 strings)
2025-05-23 17:05:47 +02:00
sfan5
95695f1cd2 Translated using Weblate (German)
Currently translated at 99.8% (1528 of 1531 strings)
2025-05-23 17:05:47 +02:00
Lars Müller
7ac5502fdf Fix handling of skinned meshes for nodes
Second try after the revert in 8a28339 due to an unexpected regression.

- Rigidly animated models (e.g. the glTF frog node) were not working correctly,
  since cloning the mesh ignored the transformation matrices.
  Note that scaling the mesh needs to occur *after* transforming the vertices.
- Visual scale did not apply to skinned models,
  as resetting the animation overwrote scaled vertex data with static positions & normals.
  For backwards compatibility, we now apply a 10x scale to static, non-glTF models.

We now do scale static meshes, as the bug that caused meshes not to be scaled was limited to skeletally animated meshes,
hence we ought not to reproduce it for skinned meshes that do not take advantage of skeletal animations (e.g. current MTG doors).

However, glTF models (e.g. Wuzzy's eyeballs) up until recently were always affected due to technical reasons
(using skeletal animation for rigid animation).

Thus, to preserve behavior, we:

1. Do not apply 10x scale to glTF models.
2. Apply 10x scale to obj models.
3. Apply 10x scale to static x or b3d models, but not to animated ones.

See also: #16141
2025-05-20 18:37:33 +02:00
Nathanaëlle Courant
30e33d71cc Main menu: Fix ContentDB aliases for games having the '_game' suffix (#16157) 2025-05-19 10:29:37 +02:00
Daniel Cristian
4700939949 Fix uninitialized variable warning in generate_srp_verifier_and_salt 2025-05-18 21:59:57 +02:00
SmallJoker
56ecf6d332 Mainmenu: Fix error after ESC in dialog windows (#16130)
The error was caused by fd857374, where 'MenuQuit' was processed after 'try_quit'.
This commit fixes the error by moving the special 'MenuQuit' handling to Lua.
2025-05-18 20:41:42 +02:00
sfan5
554dd5ddf4 Update credits for 5.12.0 (#16142) 2025-05-18 12:13:57 +02:00
sfan5
8c8b7cb251 Clean up menus properly on client exit (#16150) 2025-05-18 12:13:48 +02:00
Jan
dca88be81d Remove PrefersNonDefaultGPU from desktop file (#16095) 2025-05-18 12:13:33 +02:00
Lars Müller
a817fdffd2 Complete rename to Luanti in package metadata (#16017) 2025-05-17 15:03:12 +02:00
SmallJoker
3020c192b2 Client: Disable node specular shader effect (#16113)
This feature needs a proper API integration to result in a correct
in-game appearance. See #15898 for details.

This is a band-aid solution for the 5.12.0 release.
2025-05-17 15:02:47 +02:00
y5nw
d11d90fb8d Update settingtypes to reflect scancode-related changes (#16140) 2025-05-16 17:16:23 +02:00
updatepo.sh
d19640d57f Run updatepo.sh 2025-05-14 23:26:56 +02:00
Sepehr
7c5a0d9057 Translated using Weblate (Persian)
Currently translated at 8.7% (133 of 1525 strings)
2025-05-14 23:26:56 +02:00
Zacharias Tyllström
5cc44edab6 Translated using Weblate (Swedish)
Currently translated at 66.7% (1018 of 1525 strings)
2025-05-14 23:26:56 +02:00
Felipe Amaral
2103b0725c Translated using Weblate (Portuguese)
Currently translated at 79.4% (1212 of 1525 strings)
2025-05-14 23:26:56 +02:00
ninjum
ccc46f9515 Translated using Weblate (Galician)
Currently translated at 95.0% (1449 of 1525 strings)
2025-05-14 23:26:56 +02:00
Nana_M
15315e7388 Translated using Weblate (Russian)
Currently translated at 100.0% (1525 of 1525 strings)
2025-05-14 23:26:56 +02:00
Karol1165
faad4d7cea Translated using Weblate (Polish)
Currently translated at 84.4% (1288 of 1525 strings)
2025-05-14 23:26:56 +02:00
Alex Maryson Jr
2e717c2ba6 Translated using Weblate (Russian)
Currently translated at 98.6% (1504 of 1525 strings)
2025-05-14 23:26:56 +02:00
waxtatect
649fef4916 Translated using Weblate (French)
Currently translated at 100.0% (1525 of 1525 strings)
2025-05-14 23:26:56 +02:00
Romeostar
b0ef3ed2d5 Translated using Weblate (Russian)
Currently translated at 98.0% (1495 of 1525 strings)
2025-05-14 23:26:56 +02:00
Wuzzy
e6511c60ed Translated using Weblate (German)
Currently translated at 100.0% (9 of 9 strings)

Translation: Minetest/Minetest Android
Translate-URL: https://hosted.weblate.org/projects/minetest/minetest-android/de/
2025-05-14 23:26:56 +02:00
Linerly
9ff00cdfbb Translated using Weblate (Indonesian)
Currently translated at 100.0% (9 of 9 strings)

Translation: Minetest/Minetest Android
Translate-URL: https://hosted.weblate.org/projects/minetest/minetest-android/id/
2025-05-14 23:26:55 +02:00
sfan5
8a28339ed3 Revert "Fix handling of skinned meshes for nodes"
It literally breaks torches and doors in MTG.
Regardless of whether this is an oversight or not let's not pull this in so close to release.
This reverts commit 612db5b2ca.
2025-05-14 23:21:33 +02:00
Lars Mueller
e039f4c8af Improve mesh scaling factor documentation 2025-05-14 22:28:33 +02:00
Lars Mueller
612db5b2ca Fix handling of skinned meshes for nodes
- Rigidly animated models (e.g. the gltf frog node) were not working correctly,
  since cloning the mesh ignored the transformation matrices.
  Note that scaling the mesh needs to occur *after* transforming the vertices.
- Visual scale did not apply to skinned models,
  as resetting the animation overwrote scaled vertex data with static positions & normals.
  For backwards compatibility, we only apply a 10x scale to static (.obj) models.
2025-05-14 22:28:33 +02:00
y5nw
57c1ab905c Migrate existing keycode-based keybindings (#16049)
Co-authored-by: grorp <gregor.parzefall@posteo.de>
Co-authored-by: sfan5 <sfan5@live.de>
2025-05-14 22:15:15 +02:00
Lars Müller
600763dffc Fix table[] focus regression from f4285a5 (#16136) 2025-05-14 07:25:32 -04:00
grorp
959a8b5b8b Fix black font and menu header when game exits in background (#16131) 2025-05-14 07:23:53 -04:00
sfan5
5f06885ffa Fix printing SER_FMT_VER_HIGHEST_READ in main.cpp 2025-05-13 18:26:47 +02:00
sfan5
94dd3da2aa Prevent mixing in-tree and out-of-tree builds
This is an easy pitfall to encounter when running an Android build.
2025-05-09 20:25:28 +02:00
siliconsniffer
9b2ee1dd5d Remove Irrlicht GUI gradients (#16015)
Co-authored-by: rollerozxa <rollerozxa@voxelmanip.se>
Co-authored-by: grorp <grorp@posteo.de>
2025-05-07 08:56:00 +02:00
lhofhansl
1f9a3b5875 Update src/serverenvironment.cpp
Co-authored-by: sfan5 <sfan5@live.de>
2025-05-05 07:50:45 -07:00
Lars
05513467b6 Some ActiveBlockList improvements 2025-05-05 07:50:45 -07:00
Lars Mueller
34e73da424 Optimize appending to tables in core.serialize and dump 2025-05-04 16:32:17 +02:00
Lars Mueller
747857bffa Implement helpful __tostring for all userdata-based classes 2025-05-04 16:32:17 +02:00
Lars Mueller
9ad23e4384 Revamp dump 2025-05-04 16:32:17 +02:00
Lars Mueller
98b2edeb11 dump[2]: avoid misleading rounding of numbers 2025-05-04 16:32:17 +02:00
Lars Müller
f4285a59ac Purge some dead code (mostly Irrlicht) (#16111)
* Remove obsolete Irrlicht attributes system

* Remove dead GUI element types

* Remove some obsolete Irrlicht headers

* Fix some oopsies from d96f5e1
2025-05-04 16:31:44 +02:00
sfan5
377fa5bb14 Minor improvements to image algorithms
- loop Y around X
- use float over double
2025-05-04 16:31:00 +02:00
sfan5
486fb7cc4d Add caching of generated textures as image 2025-05-03 11:32:41 +02:00
sfan5
9cb78f2dc5 Try to reuse texture objects in TextureSource::rebuildTexture() 2025-05-03 11:32:41 +02:00
sfan5
b841c23701 Clean up TextureSource and related code 2025-05-03 11:32:41 +02:00
sfence
0bdd5f294e Make SDL2 default on macOS (#16039) 2025-05-02 21:28:13 +02:00
sfan5
d795c28af8 Tune polygon offset handling to avoid issues with mesh nodes (#16064) 2025-05-02 21:27:45 +02:00
z-op
c5abecbd3c Improve log messages for core.clear_craft 2025-05-02 21:27:31 +02:00
sfan5
0c7149b8df Build-related fixes (#16102)
- fix mo files rebuilt unnecessarily

- fix CMake policy warnings

- update vcpkg baseline
2025-05-02 21:27:18 +02:00
Lars Müller
d96f5e1c76 MetaDataRef: Make set_float preserve numbers exactly (#16090) 2025-05-02 21:27:00 +02:00
SmallJoker
6f3735281f GUI: restore the Pause Menu after closing the Settings Menu 2025-05-02 21:26:34 +02:00
sfan5
893a74f9d7 Support HEAD and PATCH methods in http api 2025-05-01 10:46:24 +02:00
sfan5
d937cd9b90 Don't restrict multipart requests to POST 2025-05-01 10:46:24 +02:00
sfan5
4164cea58f Fix PUT and DELETE requests without data 2025-05-01 10:46:24 +02:00
Lars Mueller
01e4395977 glTF: Clean up rigid animation 2025-04-26 16:15:05 +02:00
Lars Mueller
5113fcaedd Fix glTF reader not ignoring parent transforms for skinned meshes 2025-04-26 16:15:05 +02:00
sfence
0d414c44da Add testeditor to devtest for easier testing. (#15206)
* Add testeditor to devtest for easier testing.

Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
2025-04-25 05:09:23 +02:00
minlemon
33ae1af79a Add how to run unit tests after compile instructions 2025-04-25 05:08:31 +02:00
minlemon
3497722a9d Replace broken "What is Minetest?" link with archived copy 2025-04-24 20:07:51 +02:00
updatepo.sh
1de0eddb52 Update translation files 2025-04-24 16:53:19 +02:00
updatepo.sh
a9abeab7ee Update minetest.conf.example and dummy file 2025-04-24 16:48:55 +02:00
Roman
568157d9fb Translated using Weblate (Russian)
Currently translated at 100.0% (1392 of 1392 strings)
2025-04-24 16:40:47 +02:00
ninjum
9be6f08cec Translated using Weblate (Galician)
Currently translated at 100.0% (1392 of 1392 strings)
2025-04-24 16:40:47 +02:00
Miguel
697a3169e6 Translated using Weblate (Spanish)
Currently translated at 99.9% (1391 of 1392 strings)
2025-04-24 16:40:47 +02:00
jhon game
a252fc1e55 Translated using Weblate (Hebrew)
Currently translated at 33.6% (468 of 1392 strings)
2025-04-24 16:40:47 +02:00
Divarrek
b022cc3f89 Translated using Weblate (Breton)
Currently translated at 2.0% (29 of 1392 strings)
2025-04-24 16:40:47 +02:00
Divarrek
cbe2067f16 Added translation using Weblate (Breton) 2025-04-24 16:40:47 +02:00
Yof
aa77bda765 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (1392 of 1392 strings)
2025-04-24 16:40:47 +02:00
Ritwik
e9695c788f Translated using Weblate (Hindi)
Currently translated at 27.2% (380 of 1392 strings)
2025-04-24 16:40:47 +02:00
Jun Nogata
7ccab6d37a Translated using Weblate (Japanese)
Currently translated at 100.0% (1392 of 1392 strings)
2025-04-24 16:40:47 +02:00
BlackImpostor
d1153d0cdd Translated using Weblate (Russian)
Currently translated at 100.0% (1392 of 1392 strings)
2025-04-24 16:40:47 +02:00
Siber
dc62a2f212 Translated using Weblate (Turkish)
Currently translated at 84.0% (1170 of 1392 strings)
2025-04-24 16:40:47 +02:00
Денис
02244a1241 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (1392 of 1392 strings)
2025-04-24 16:40:47 +02:00
Денис Савченко
dde892e64c Translated using Weblate (Ukrainian)
Currently translated at 100.0% (1392 of 1392 strings)
2025-04-24 16:40:47 +02:00
Jorge Rodríguez
dac654e6f0 Translated using Weblate (Spanish)
Currently translated at 99.9% (1391 of 1392 strings)
2025-04-24 16:40:47 +02:00
Peter Leth
74804e3d11 Translated using Weblate (Danish)
Currently translated at 51.0% (711 of 1392 strings)
2025-04-24 16:40:46 +02:00
109247019824
8aa043fa9a Translated using Weblate (Bulgarian)
Currently translated at 51.8% (722 of 1392 strings)
2025-04-24 16:40:46 +02:00
Тарас Арт
3f295acbc6 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (1392 of 1392 strings)
2025-04-24 16:40:46 +02:00
Nicolae Crefelean
ee50f7ccf3 Translated using Weblate (Romanian)
Currently translated at 100.0% (8 of 8 strings)

Translation: Minetest/Minetest Android
Translate-URL: https://hosted.weblate.org/projects/minetest/minetest-android/ro/
2025-04-24 16:40:46 +02:00
Nicolae Crefelean
c561a0651a Added translation using Weblate (Romanian) 2025-04-24 16:40:46 +02:00
BX Zhang
00652e1dfc Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 95.1% (1324 of 1392 strings)
2025-04-24 16:40:46 +02:00
Tanavit MINETEST
7b38484c43 Translated using Weblate (French)
Currently translated at 99.7% (1389 of 1392 strings)
2025-04-24 16:40:46 +02:00
meafk qc
3376eb69fc Translated using Weblate (French)
Currently translated at 99.6% (1387 of 1392 strings)
2025-04-24 16:40:46 +02:00
neketos851
f5785ecca4 Translated using Weblate (Ukrainian)
Currently translated at 98.4% (1371 of 1392 strings)
2025-04-24 16:40:46 +02:00
SeaRat
c020c50322 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 92.6% (1290 of 1392 strings)
2025-04-24 16:40:46 +02:00
Тарас Арт
a1cdb0c291 Translated using Weblate (Ukrainian)
Currently translated at 98.0% (1365 of 1392 strings)
2025-04-24 16:40:46 +02:00
Gg Gg
d8874704c9 Translated using Weblate (Slovenian)
Currently translated at 36.7% (512 of 1392 strings)
2025-04-24 16:40:46 +02:00
BreadW
46357d8eb7 Translated using Weblate (Japanese)
Currently translated at 100.0% (1392 of 1392 strings)
2025-04-24 16:40:42 +02:00
waxtatect
02a87ce861 Translated using Weblate (French)
Currently translated at 100.0% (1392 of 1392 strings)
2025-04-24 16:40:42 +02:00
Nana_M
78e34982e7 Translated using Weblate (Russian)
Currently translated at 100.0% (1392 of 1392 strings)
2025-04-24 16:40:42 +02:00
Miguel
efe120d3f6 Translated using Weblate (Spanish)
Currently translated at 99.8% (1390 of 1392 strings)
2025-04-24 16:38:18 +02:00
Muhammad Rifqi Priyo Susanto
3e5d9782cc Android: Persistent notification while ingame (#13125)
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
Co-authored-by: grorp <grorp@posteo.de>
2025-04-24 07:38:52 -04:00
minlemon
409543566a CI: Use gcc-9 and clang-11 with Ubuntu 22.04 (#16076) 2025-04-23 21:45:11 +02:00
Vincent Robinson
233ffbe384 Change exit keybinding and fix bug in allow_close[] 2025-04-23 21:41:32 +02:00
SmallJoker
d6d045aad4 Script: avoid fatal error in deprecated func handler 2025-04-23 21:41:18 +02:00
Lars Müller
dd2e45ee82 Deprecate function support in core.[de]serialize 2025-04-23 21:39:27 +02:00
Desour
f2ea4a4565 Improve mod storage doc a little 2025-04-23 09:31:06 +02:00
Desour
75f757ed2b Improve crafting doc 2025-04-23 09:31:06 +02:00
Desour
974d915b19 Remove creative priv from doc
Fixes https://forum.luanti.org/viewtopic.php?p=444099
2025-04-23 09:31:06 +02:00
Desour
4a8f84b259 Mainmenu: Move core.on_before_close to s_mainmenu like other callbacks, and doc 2025-04-23 09:31:06 +02:00
sfan5
2c83c67b7d Move profiler call out of hot path in ClientMap (#16056) 2025-04-23 09:30:58 +02:00
BuckarooBanzay
6c339c62c6 Switch to smallint for position keys (x,y,z) in postgres backend 2025-04-23 09:30:36 +02:00
sfan5
7c619bdc9a Improve usability of Prometheus metrics backend (#16060) 2025-04-23 09:30:04 +02:00
Lars
00addc3e5d Mark liquid and light updates low priority 2025-04-22 20:36:45 -07:00
Lars
2a3427a39c Fix m_nearest_unsent_d calculation when changed blocks arrive
Uses the nearest cube surface instead of euclidean distance to correctly reset the distance to start scanning from.
2025-04-22 20:36:45 -07:00
Lars
99150fadd1 Some RemoteClient improvements
* Simplications
* Remove RemoteClient::m_blocks_modified
* Remove unneeded nearest_emergefull_d
2025-04-22 20:36:45 -07:00
grorp
0cf1c47f6c Fix scrollbar on ContentDB grid by adding an area label (#16042)
Co-authored-by: rubenwardy <rw@rubenwardy.com>
2025-04-21 12:33:41 +02:00
SmallJoker
5c6e4d35b0 Client: protect against circular attachments (#16038)
The server already includes such check. There must be a desync issue that causes
an ID mismatch, resulting in client crashes. Any such crash must be prevented.
2025-04-21 12:33:19 +02:00
Linn16
c0e42c6588 Use map_compression_level_disk from minetest.conf for --recompress (#16037) 2025-04-21 12:32:58 +02:00
sfan5
900cf896db Move NodeShaderConstantSetter to game.cpp 2025-04-21 12:32:29 +02:00
sfan5
f3c2bbfb48 Change shaders to be defined by input constants rather than drawtype/material type 2025-04-21 12:32:29 +02:00
sfan5
baa4c7cd21 Introduce IShaderConstantSetter abstraction 2025-04-21 12:32:29 +02:00
sfan5
b2c2a6ff47 Rename IShaderConstantSetter 2025-04-21 12:32:29 +02:00
sfan5
4c4e296274 Handle texture filtering sanely to avoid blurriness (#16034) 2025-04-21 12:31:44 +02:00
Lars Mueller
1c5776d13a FATAL_ERROR for orphan object refs in objectrefGetOrCreate 2025-04-20 20:49:10 +02:00
Lars Mueller
c0d10b24a4 Use SPDX-License-Identifiers in builtin 2025-04-20 20:49:10 +02:00
Lars Mueller
e1143783e5 Fix some (MSVC) compiler warnings 2025-04-20 20:49:10 +02:00
Lars Mueller
695d526764 Get rid of _IRR_OVERRIDE_ macro 2025-04-20 20:49:10 +02:00
Lars Mueller
5f1ff453c9 Replace _IRR_DEBUG_BREAK_IF with assertions 2025-04-20 20:49:10 +02:00
Jürgen Rühle
2f464843cb Make it more convenient to customize node drops (#15872)
* Provide tool and digger to get_node_drops

This gives games/mods the ability to modify node drops depending on item
and/or player metadata without overriding node_dig or other workarounds.

* Copy wielded item to prevent modification in get_node_drops

* Also pass node pos to get_node_drops

Allowing properties of the node and its surroundings to affect node drops.

* Copy pos to prevent modification in get_node_drops

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>

* Don't pass empty item stack to get_node_drops if wielded is nil

---------

Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2025-04-20 20:48:48 +02:00
y5nw
23bfb2db72 Move keybinding settings to (Lua-based) setting menu (#15791) 2025-04-20 20:20:49 +02:00
y5nw
c1d2124102 SDL: Send events for X1 and X2 mouse buttons (#16025) 2025-04-20 20:20:33 +02:00
y5nw
bf15036831 Show SDL version in the About tab (#16046) 2025-04-20 20:20:22 +02:00
y5nw
2bb7ed208c Add vcpkg.json (#15863) 2025-04-20 13:28:31 +02:00
Travis Wrightsman
0695541bf5 Fix cross-building by ensuring output path is set 2025-04-17 12:35:31 +02:00
sfence
7375358afd Fix warning in mg_decoration.cpp 2025-04-17 12:35:14 +02:00
Vincent Robinson
fd85737460 Add allow_close[] element to formspecs (#15971) 2025-04-16 16:20:39 -07:00
sfan5
04e82749db Make ETLF_FLIP_Y_UP_RTT work for texture download on GLES 2025-04-15 21:42:47 +02:00
sfan5
cf07b56235 Expand workarounds for format inconsistency with BGRA8888 extension on GLES
fixes #16011
2025-04-15 21:42:47 +02:00
sfan5
37d2bc8a5f Reuse some allocations in ClientMap rendering 2025-04-15 21:42:39 +02:00
sfence
a9c197b1e5 Expand usable range of fill_ratio to about 2.3e-10 (#16026) 2025-04-15 21:42:12 +02:00
sfan5
bdaabad53c Warn if async engine seems stuck (#16010) 2025-04-14 17:18:33 +02:00
DS
60c47c51e0 Optimize name-id-lookup for MapBlock serialization (#16000) 2025-04-14 17:18:21 +02:00
rubenwardy
75862e33b6 ContentDB: Add reviews tab (#15254) 2025-04-13 16:07:01 +01:00
Erich Schubert
78293404c7 Rename perlin noise to value noise (#15858) 2025-04-10 14:39:40 +02:00
sfan5
372e37faf2 Minor correction to how buildbot finds packages 2025-04-10 14:39:21 +02:00
sfan5
124d770823 Fix edge-case where manually set gameid isn't used 2025-04-10 14:39:21 +02:00
sfan5
9d81c02f27 Add/remove/change some log messages for clarity 2025-04-10 14:39:21 +02:00
sfan5
a00b9cab36 Fix operator[] for vector2d and vector3d being potentially UB (#15977)
We don't have a C++ expert on hand, but taking a pointer to one member
and expecting to access another by an offset is very fishy:
- for one, there could theoretically be padding
- the compiler might assume that we are only writing to that first member

The new code has shown to be free for constant parameter values.
Non-constant ones cause the assembly to have branches (why?), but we don't
use that much.
2025-04-08 22:25:45 +02:00
sfan5
46db688cc8 Implement support for array textures in GL driver
note: feature detection was not implemented in the legacy driver, but the code itself probably works.
2025-04-08 22:24:37 +02:00
sfan5
d5bf094f9a Prefer immutable texture storage when available 2025-04-08 22:24:37 +02:00
sfan5
427a7e4998 Split texture initialization code from upload 2025-04-08 22:24:37 +02:00
sfan5
9ff07df45e Fix GLES texture download to handle mipmaps and cubemap type 2025-04-08 22:24:37 +02:00
sfan5
38c3876c4e Drop support for storing mipmap data alongside IImage 2025-04-08 22:24:37 +02:00
sfan5
03affa1bbb Some minor code cleanups 2025-04-08 22:24:37 +02:00
Lars Müller
7689f1f0fd Improve some warning messages (#15990) 2025-04-08 22:24:00 +02:00
Lars Müller
a3648b0b16 Add spatial index for objects (#14631) 2025-04-08 08:44:53 +02:00
cx384
bed36139db Fix struct forward declaration 2025-04-07 01:38:32 +02:00
lhofhansl
6a71095655 Break liquid reflow scan early for all-air blocks (#15975)
Avoid scanning the a newly loaded block if it is all air and no liquid is flowing from above.
2025-04-05 11:01:39 -07:00
cx384
52b974184d Move client code out of ItemDefManager (#15967) 2025-04-04 18:58:14 +02:00
cx384
a6d4cd7c15 Draw node animation for items (#15930) 2025-04-04 18:47:11 +02:00
Elias Åström
1db5a2f950 Add delay between punching and digging node (#15931) 2025-04-04 18:46:27 +02:00
Lars Müller
884f411387 Set CMAKE_POLICY_VERSION_MINIMUM=3.5 to make MSVC CI work again (#15978)
Co-authored-by: Josiah VanderZee <josiah_vanderzee@mediacombb.net>
2025-04-04 18:46:03 +02:00
grorp
66dedf1e21 lua_api.md: Mapblock-related and misc improvements (#15972)
Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: DS <ds.desour@proton.me>
2025-04-03 13:46:06 -04:00
grorp
7dbd3a0744 lua_api.md: More info in LBM run_at_every_load documentation (#15956) 2025-04-02 10:05:23 -04:00
sfan5
47c75b3294 ImageSource: restrict max dimensions to protect from integer overflows (#15965) 2025-04-01 19:12:37 +02:00
Jisk
0179021acc lua_api.md: MAX_WORKING_VOLUME is now 150 million 2025-04-01 19:12:22 +02:00
Lars Müller
2569b50252 Deprecate some legacy item registration logic (#15950) 2025-04-01 19:12:00 +02:00
grorp
c30c94dfaa Add server/client annotations to settingtypes.txt and make use of them (#15756) 2025-04-01 07:55:47 -04:00
lhofhansl
6724068659 Slight fix to #15949 to handle emerge queue full (#15960)
Partially restore the existing logic, and try to enqueue a block as before, if the queue is full it will be handled correctly.
2025-03-31 21:31:10 -07:00
sfan5
1281173e50 Use secure randomness to seed internal RNG 2025-03-30 18:17:19 +02:00
sfan5
785c042f1f Drop gzip support from CZipReader
This allowed reading concatenated gzip-compressed files as if they were an archive.
Aside from being generally uncommon we literally don't need this.
2025-03-30 18:17:19 +02:00
sfan5
ae0f955a0e Add nodiscard attribute to helper functions where it makes sense 2025-03-30 18:17:19 +02:00
sfan5
e6acc4e7ed Delete TestCAO 2025-03-30 18:17:19 +02:00
sfan5
2602d03b34 Split ABM/LBM from serverenvironment.cpp to own file 2025-03-30 18:17:19 +02:00
sfan5
dea95c7339 Reduce transitive includes by moving a class 2025-03-30 18:17:19 +02:00
sfan5
b146673c3d Remove old mystrtok_r for MinGW 2025-03-30 18:17:19 +02:00
sfan5
e73eed247e Apply some refactoring/cleanup to mainly util functions 2025-03-30 18:17:19 +02:00
sfan5
89e3bc8d56 Improve std::hash<SMaterial> implementation 2025-03-30 18:17:19 +02:00
wrrrzr
d7edf0b229 Set StartupWMClass in desktop file
see #15942
2025-03-30 18:17:10 +02:00
wrrrzr
4bc366b984 Refactor createShadowRenderer 2025-03-30 18:16:45 +02:00
cx384
41d43e8d95 Document server texture pack in texture_packs.md (#15951) 2025-03-30 18:16:34 +02:00
y5nw
4cd2273349 Refactor input handler (#15933) 2025-03-30 18:16:20 +02:00
SmallJoker
309c0a0cb6 Formspec: fix clamped scroll offset of scroll_containers larger than 1000px 2025-03-30 18:15:38 +02:00
cx384
882f132062 Document special items 2025-03-30 18:15:11 +02:00
cx384
af1ffce084 Improve hand override documentation 2025-03-30 18:15:11 +02:00
sfan5
a94c9a73ba Move all registration logic into core.register_item for consistency 2025-03-29 10:21:15 +01:00
sfan5
915446417d Improve warning message for registration table reuse 2025-03-29 10:21:15 +01:00
lhofhansl
8f8d7c4088 Check if a block is already in the emege queue before checking occlusion culling and trying to reemerge (#15949) 2025-03-28 11:31:54 -07:00
grorp
b0bc6ce637 TouchControls: Take FOV into account for camera movement (#15936) 2025-03-28 07:43:59 -04:00
lhofhansl
fbc525d683 Restore behavior of emergequeue_limit_total (#15947)
* And make sure `emergequeue_limit_total` is >= max(`emergequeue_limit_diskonly`, `emergequeue_limit_generate`)
2025-03-27 18:59:38 -07:00
sfan5
db15bc6466 Some more random code cleanups 2025-03-26 20:49:43 +01:00
sfan5
f63436c8d3 Add basic unittests for LBMManager 2025-03-26 20:49:43 +01:00
sfan5
7b746d21f9 Make sure generated blocks have their timestamp set
behavior change: newly generated blocks are no longer momentarily activated.
this shouldn't matter for anyone and did not consistently apply to all blocks anyway

addresses issue from #15902 for new maps(!)
2025-03-26 20:49:43 +01:00
sfan5
ed40ea010b Improve edge case handling in LBMManager 2025-03-26 20:49:43 +01:00
sfan5
3dca2cd26a Strip leading colon from LBM names 2025-03-26 20:49:43 +01:00
sfan5
71cd25a798 Preserve LBM ordering when running them
(broken in 811adf5d42)
2025-03-26 20:49:43 +01:00
sfan5
ea1e8797a3 Fix performance bug with applying LBMs 2025-03-26 20:49:43 +01:00
JosiahWI
8fc7bf2af4 Fix core.get_content_info docs and harden implementation (#15925) 2025-03-26 19:03:53 +01:00
SmallJoker
95d6008332 IrrlichtMt: Fix orientation of IRenderTarget-textures (#15932)
Textures created through a render target are flipped along the X axis.
For the same reason, screenshots must be flipped back as well ('IVideoDriver::createScreenShot').

This commit implements the same flipping concept in two places:
1. Batch rendering of images (mostly used by fonts/text)
2. In-world rendering of such textures
2025-03-26 18:32:23 +01:00
grorp
b99f90ed80 Mainmenu: Trim whitespace from player name, address, port 2025-03-26 18:31:44 +01:00
Ricardo Costa
251bf0ec31 Fix possible nullptr dereference in serverpackethandler.cpp 2025-03-26 18:31:27 +01:00
ashtrayoz
b1363fce8e Fix logic inversion for dynamic media (server-side fix) (#15870) 2025-03-24 21:35:20 +01:00
y5nw
4ba438a7ec Improve KeyPress handling (#15923)
* Pass KeyPress by value
* TouchControls: add setting change callback for keybindings
2025-03-21 12:07:51 +01:00
grorp
ead44a27ca TouchControls: Implement an option for dig/place buttons (#15845) 2025-03-21 12:06:44 +01:00
sfan5
1f14b7cb1b Make remote media exclusively use GET for hash set (#15885) 2025-03-19 22:06:34 +01:00
sfan5
a9a3b05cc3 Prevent registration of certain new content after load time 2025-03-19 22:05:01 +01:00
sfan5
ca047c3e58 Warn on core.override_item() after server startup 2025-03-19 22:05:01 +01:00
sfan5
2540667f04 Warn if metatable passed to itemdef registration function 2025-03-19 22:05:01 +01:00
JosiahWI
4125ce877d Do not discover mod directories that fail parsing (#15917)
The root issue of the unit test failure is that all directories that are found in the mod search are counted as mods, even if they are detected to be invalid as such by the parser. For example, the presence of an init.lua file is required, and the parser will return false if one is not found. This return value was completely ignored. Simply counting the mod conditionally on the parsing success makes the modserver tests pass on MSVC.
2025-03-19 18:43:19 +01:00
SmallJoker
f1364b1e0b GUI: Use the client's fonts for 'Open URL?' dialogues
This popup is related to user safety, thus it should not
use server-provided font media files.
2025-03-19 18:42:26 +01:00
SmallJoker
5b2b2c7796 Game: disable 'toggle_sneak_key' while flying 2025-03-19 18:42:26 +01:00
y5nw
cc65c8bd70 SDL: Use scancodes for keybindings (#14964)
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
2025-03-16 20:35:34 +01:00
cx384
e0378737b7 Fix overrideable hand ToolCapabilities and range (#15743) 2025-03-16 20:03:31 +01:00
Xiaochuan Ye
d085f0fb52 Document core.MAP_BLOCKSIZE constant in lua_api.md (#15911) 2025-03-16 20:02:42 +01:00
AFCMS
efded8f0bb Bump OARS content rating to 1.1 2025-03-16 17:57:18 +01:00
Erich Schubert
8ac7c451e1 update documentation 2025-03-16 17:56:58 +01:00
Erich Schubert
1f3cf59c7f Clean up position encoding
We can simply add 0x800800800 to the encoding, then use bit masking.

This works because adding 0x800 maps -2048:2047 to 0x000:0xFFF.
And 0x800800800 is (0x800 << 24 + 0x800 << 12 + 0x800) for x,y,z.

After bitmasking, -0x800 restores the original value range.
2025-03-16 17:56:58 +01:00
Erich Schubert
c439d784ac add unit tests for map block position encoding 2025-03-16 17:56:58 +01:00
sfan5
42ac5b2f40 Mostly deal with problems caused by polygon offset (#15867) 2025-03-16 17:56:32 +01:00
Deve
c07499ccfc Reload font manager in main thread to avoid a crash (#15900) 2025-03-16 17:55:39 +01:00
sfan5
4b85062caf Improve robustness of GL object handling 2025-03-14 11:52:52 +01:00
Lars Müller
077828d0d9 Add table.copy_with_metatables (#15754) 2025-03-14 11:52:42 +01:00
Miguel P.L
8717c7bd00 Fix excessive space on README.md 2025-03-11 20:00:58 +01:00
SmallJoker
23d0fb2d3f builtin: Return 'obj' from 'core.item_drop' (#15880)
This also includes a minor bugfix where 'itemstack' was cleared
even if the object placement failed.
2025-03-11 20:00:35 +01:00
sfan5
afb15978d9 Clean up and compress some pre-join packets (#15881) 2025-03-11 20:00:07 +01:00
sfan5
287880aa27 Refresh win32 toolchain and libraries (#15890) 2025-03-11 19:59:03 +01:00
cx384
b9ed4793ea Move drawItemStack out of hud.h/cpp (#15868) 2025-03-11 10:00:04 +01:00
Alex
dadd097f32 Echo DMs sent with /msg (#15887) 2025-03-11 09:59:51 +01:00
lhofhansl
017318f117 Avoid touching all blocks in range every 0.2s (#15878)
Instead touch these blocks every 4s.
2025-03-08 12:42:50 -08:00
cx384
18ac8b20fa Replace object visual by enum (#15681) 2025-03-06 21:02:11 +01:00
Medley
63701de45f Make Sneak and Aux1 optionally togglable (#15785) 2025-03-06 21:01:43 +01:00
sfan5
7892541383 Various random code cleanups 2025-03-04 19:53:01 +01:00
sfan5
358658fa34 Fix cloud-related bugs
First, this reverts 56123b2fbe,
which un-fixes #15031 but fixes #15798 and #15854.

Then we disable culling for the cloud scene node which fixes #15031 again.
2025-03-04 19:53:01 +01:00
sfan5
68602b2eaf Fix shadow flicker on camera offset update (take 2)
The previous fix never did what it was supposed to, so let's do this.
2025-03-04 19:53:01 +01:00
sfan5
e84ac56e35 Don't try to update uninitialized shadow frustum 2025-03-04 19:53:01 +01:00
sfan5
47c000a293 Add unittest that lints builtin JSON files 2025-03-04 19:53:01 +01:00
sfan5
304ce4cd54 Fix syntax error in credits.json
reported at <https://forum.luanti.org/viewtopic.php?p=442729>

As it happens this didn't affect most users as jsoncpp allows trailing commas
by default since 2019.
2025-03-04 19:53:01 +01:00
sfan5
d54646d342 Improve error handling of map database creation 2025-03-04 19:53:01 +01:00
sfan5
7abaa8d4cd Make Irrlicht identity material const 2025-03-04 19:53:01 +01:00
sfan5
2796283550 Remove broken fall bobbing 2025-03-04 19:53:01 +01:00
sfan5
7602308835 Revert "Restrict relative mouse mode to Wayland users (#15697)"
see #15761
SDL is the only device that supports relative mode and
mouse input is actually somewhat broken if it's *not* enabled.

This reverts commit 45c5ef8798
and 88b007907a.
2025-03-04 19:53:01 +01:00
sfan5
bc43019467 Fix TerminalChatConsole crash
this setting was removed in #15633
2025-03-04 19:53:01 +01:00
sfan5
8449f5f6db Make devtest grass use overlay tiles 2025-03-04 19:53:01 +01:00
Medley
0eb047ca33 Disable debug-breaking locale workaround when debugging (#15859) 2025-03-03 20:33:42 +01:00
wrrrzr
98048cb06d Fix missing includes in skyparams.h 2025-03-03 20:33:19 +01:00
Erich Schubert
6e995972bb check y limits early 2025-03-03 20:33:05 +01:00
Erich Schubert
08fad862aa Code cleanups. Function does not return deco count. 2025-03-03 20:33:05 +01:00
sfan5
c3477a4d08 Adjust Android default view range and mapblock limit 2025-03-01 22:40:10 +01:00
sfan5
062207e696 Enforce minimum client_mapblock_limit depending on view range 2025-03-01 22:40:10 +01:00
SmallJoker
24c1230c7b Client: fix disappearing node inventories on older servers
ee9258ce introduced a logic error, which caused clients to lose
node metadata when they should not and vice-versa.
See also: server.cpp / Server::sendAddNode
2025-03-01 21:05:17 +01:00
sfan5
eb79a76742 Android: update SDL support code (#15853) 2025-03-01 18:27:46 +01:00
millennIumAMbiguity
c0328e5363 Centered title in README.md and added icon 2025-03-01 12:27:43 +01:00
Joshua Gerrish
8d822d8231 Fix compile error with MSVC: string is not a member of std 2025-03-01 12:26:33 +01:00
y5nw
a11b25f3f5 Use fallback font correctly for fonts provided by the server 2025-03-01 12:25:24 +01:00
Lars Mueller
90121dc66f Fix & improve glTF loader matrix decomposition 2025-02-27 12:31:04 +01:00
Lars Mueller
d74af2f1a7 Use matrix4::getRotationRadians 2025-02-27 12:31:04 +01:00
Lars Mueller
b6c71b2379 Improve matrix4::getRotationDegrees a bit, radians 2025-02-27 12:31:04 +01:00
Lars Mueller
c261c26456 Add Irrlicht rotation consistency unit tests 2025-02-27 12:31:04 +01:00
Lars Mueller
5abf220979 Fix random usage in matrix4 tests 2025-02-27 12:31:04 +01:00
Lars Mueller
1ceeea34f4 Extend quaternion tests 2025-02-27 12:31:04 +01:00
Lars Mueller
3ae1fd459a Add quaternion conversion unit tests 2025-02-27 12:31:04 +01:00
Lars Mueller
0e86366324 Add test for matrix4::getRotationDegrees 2025-02-27 12:31:04 +01:00
Erich Schubert
58ad604a4b Note that core.hash_node_position is not a hash function 2025-02-27 12:30:55 +01:00
guinea7pig
415e96184d Update copyright date in README 2025-02-26 12:22:19 +01:00
sfan5
8654e16725 Disable shadow force updates with performance_tradeoffs 2025-02-26 12:22:06 +01:00
sfan5
eb8b449817 Fix shadow performance regression due to force update
broken by: b861f0c5c5
2025-02-26 12:22:06 +01:00
sfan5
22c81e5292 Print if sdl2-compat is in use 2025-02-26 12:21:57 +01:00
sfan5
42a35cec83 Allow looking straight up or down 2025-02-26 12:21:57 +01:00
sfan5
fc8c6742c4 Update Wireshark dissector 2025-02-26 12:21:57 +01:00
sfan5
ee9258cefd Clean up some packet-related code 2025-02-26 12:21:57 +01:00
grorp
5e89371ecd TouchControls: touch_use_crosshair, dig/place simulation refactoring (#15800)
-   get rid of simulated mouse events for digging/placing, use keyboard events
    instead
    -   consistent with other simulated events, less code, no need for a
        pointer position
    -   more correct: touch controls no longer break if you have custom
        dig/place keybindings set
-   move reading of "touch_use_crosshair" setting from Game to TouchControls
2025-02-25 13:19:44 -05:00
Andrii Nemchenko
abcd2e0b81 Re-save active entities more often if they move a certain distance (#15605) 2025-02-22 16:19:19 +01:00
sfan5
d12ce68e64 Show unknown object visuals using unknown_object.png sprite 2025-02-22 16:19:04 +01:00
sfan5
83fd837d75 Clean up TileLayer::applyMaterialOptions 2025-02-22 16:19:04 +01:00
sfan5
7d3f0628c4 Use visual = "node" for builtin falling node entity
This greatly simplifies the code at the expense of some
falling nodes not showing up on older clients.
2025-02-22 16:19:04 +01:00
sfan5
27bbe3a873 CAO 'node' visual (#15683) 2025-02-22 16:19:04 +01:00
sfan5
5a8720a484 Change material sharing for CMeshSceneNode 2025-02-22 16:19:04 +01:00
Andrii Nemchenko
e51221d247 Implement metadata-aware version of InvRef:remove_item() (#15771) 2025-02-22 16:18:48 +01:00
DS
0890125962 SDL Irr device: Ignore +-0.0f y mouse wheel events (#15815)
our code often assumes that it's non-zero, e.g.: `event.MouseInput.Wheel < 0 ? -1 : 1`
2025-02-22 16:17:07 +01:00
DS
0667cbf5a2 Clang-Tidy config: Ignore performance-avoid-endl and performance-inefficient-string-concatenation 2025-02-22 16:16:41 +01:00
sfan5
ba62808fe8 Basic camera control API (#15796) 2025-02-19 18:45:45 +01:00
James Morey
50819ace8f Move clickable_chat_weblinks to Advanced > Miscellaneous (#15799) 2025-02-19 18:45:31 +01:00
et
ef0219c2ed Prevent accidental wallmounted_to_dir poisoning (#15810)
Prior to this commit, if you used a function like `core.wallmounted_to_dir`, and modified its output, it would modify all of the output in the future.
2025-02-18 21:51:33 +01:00
sfan5
f4bdf72aa4 Simplify SQLite3 schema types
see: <https://www.sqlite.org/datatype3.html>
2025-02-18 19:29:06 +01:00
sfan5
cc352f3b66 Add unit tests for MapDatabase implementations 2025-02-18 19:29:06 +01:00
sfan5
215b000793 Split blockpos into three columns in sqlite3 map database 2025-02-18 19:29:06 +01:00
sfan5
e8728acc5c Some cleanups in Database_SQLite3 2025-02-18 19:29:06 +01:00
Desour
166e02955e Decrease fps_max_unfocused from 20 to 10
This used to be the default for android.
There's not much issues now with using a lower value, so a lower default on all platforms
is reasonable.
The only downside I know of is that if you re-focus the window, it can up till the
next client step until it goes back to normal fps, but 10 Hz feels fast enough.
2025-02-15 18:21:01 +01:00
Desour
138111a542 Don't use fps_max_unfocused for server step time on non-singleplayer main-menu-hosted servers
It's unreasonable to change server step time when the hosting user unfocuses their window.
(m_is_paused is already not set if it's not singleplayer.)
2025-02-15 18:21:01 +01:00
Desour
191cb117f9 Don't use fps_max_unfocused for the pause menu
Nowadays, we have things like buttons that change appearance on hover, or scoll bars
in the pause menu. These do not work fine with low fps.
2025-02-15 18:21:01 +01:00
Miguel P.L
a57677120a Correct keycode URL in settingtypes.txt/minetest.conf.example (#15784) 2025-02-15 18:20:45 +01:00
sfan5
75dcd94b90 Optimize add_area_node_boxes in collision code (#15719) 2025-02-15 12:19:17 +01:00
sfan5
d027fc9a88 Enable ipv6_server by default 2025-02-15 12:18:07 +01:00
sfan5
a11d526110 Rework socket IPV6_V6ONLY handling 2025-02-15 12:18:07 +01:00
siliconsniffer
eb797c502a Tweak main menu server list behavior (#15736)
Co-authored-by: Lars Mueller <appgurulars@gmx.de>
2025-02-15 12:17:56 +01:00
Erich Schubert
567b9a997a Collision: more accurate computation with acceleration and long dtime (#15408)
Co-authored-by: SmallJoker <mk939@ymail.com>
2025-02-15 12:17:44 +01:00
Lars Müller
319e270664 Clean up Irrlicht matrices a bit more (#15733) 2025-02-15 12:17:30 +01:00
sfan5
d015944f6c Revert "Disable SDL2 for 5.11.0"
This reverts commit 29cfb6efff.
2025-02-15 12:14:12 +01:00
Lars Müller
b7f01b0cc7 Don't save load_mod_* = false lines in world.mt (#15758) 2025-02-14 22:25:39 +01:00
sfan5
54bf5d62f2 Fix fgettext call in dlg_settings.lua
(#15614)
2025-02-14 22:17:10 +01:00
sfan5
849a583f66 Continue with 5.12.0-dev 2025-02-14 19:38:30 +01:00
sfan5
0cb7735125 Bump version to 5.11.0 2025-02-14 19:38:27 +01:00
sfan5
028949beca Delete empty languages 2025-02-14 19:13:14 +01:00
ninjum
6bdeb10c16 Translated using Weblate (Galician)
Currently translated at 99.9% (1391 of 1392 strings)
2025-02-14 19:11:16 +01:00
BlackImpostor
44cbae8fad Translated using Weblate (Russian)
Currently translated at 100.0% (1392 of 1392 strings)
2025-02-14 19:11:16 +01:00
waxtatect
f7b2d4760f Translated using Weblate (French)
Currently translated at 100.0% (1392 of 1392 strings)
2025-02-14 19:11:16 +01:00
109247019824
1ec19c2ad2 Translated using Weblate (Bulgarian)
Currently translated at 51.7% (721 of 1392 strings)
2025-02-14 19:11:12 +01:00
Linerly
9bfd39f036 Translated using Weblate (Indonesian)
Currently translated at 99.6% (1387 of 1392 strings)
2025-02-14 19:11:12 +01:00
Miguel
cfff6c4fd7 Translated using Weblate (Spanish)
Currently translated at 97.9% (1363 of 1392 strings)
2025-02-14 19:11:12 +01:00
Wuzzy
147dd3d372 Translated using Weblate (German)
Currently translated at 100.0% (1392 of 1392 strings)
2025-02-14 19:11:12 +01:00
sfan5
cda3dc08ca Translated using Weblate (German)
Currently translated at 100.0% (1392 of 1392 strings)
2025-02-14 19:10:19 +01:00
mineplayer
78b4f929ce Translated using Weblate (German)
Currently translated at 100.0% (1392 of 1392 strings)
2025-02-14 19:10:19 +01:00
Desour
2c50066c16 Keep the game paused in pause menu settings
The button_exit[]s were replaced by regular button[]s, to avoid a very short unpause when you
click the btn_settings (probably because it uses ClientEvent stuff).
2025-02-14 16:31:57 +01:00
941 changed files with 80717 additions and 97141 deletions

View File

@@ -1,4 +1,4 @@
Checks: '-*,modernize-use-emplace,modernize-avoid-bind,misc-throw-by-value-catch-by-reference,misc-unconventional-assign-operator,performance-*'
Checks: '-*,modernize-use-emplace,modernize-avoid-bind,misc-throw-by-value-catch-by-reference,misc-unconventional-assign-operator,performance-*,-performance-avoid-endl,performance-inefficient-string-concatenation'
WarningsAsErrors: '-*,modernize-use-emplace,performance-type-promotion-in-math-fn,performance-faster-string-find,performance-implicit-cast-in-loop'
CheckOptions:
- key: performance-unnecessary-value-param.AllowedTypes

View File

@@ -25,16 +25,16 @@ Contributions are welcome! Here's how you can help:
the work, to avoid disappointment.
You may also benefit from discussing on our IRC development channel
[#luanti-dev](http://www.luanti.org/irc/). Note that a proper IRC client
[#luanti-dev](https://docs.luanti.org/about/irc/). Note that a proper IRC client
is required to speak on this channel.
3. Start coding!
- Refer to the
[Lua API](https://github.com/luanti-org/luanti/blob/master/doc/lua_api.md),
[Developer Wiki](https://dev.luanti.org/) and other
[Luanti Documentation](https://docs.luanti.org/) and other
[documentation](https://github.com/luanti-org/luanti/tree/master/doc).
- Follow the [C/C++](https://dev.luanti.org/Code_style_guidelines) and
[Lua](https://dev.luanti.org/Lua_code_style_guidelines) code style guidelines.
- Follow the [C/C++](https://docs.luanti.org/for-engine-devs/code-style-guidelines/) and
[Lua](https://docs.luanti.org/for-engine-devs/lua-code-style-guidelines/) code style guidelines.
- Check your code works as expected and document any changes to the Lua API.
- To avoid conflicting changes between contributions, do not do the following manually. They will be done before each release.
- Run `updatepo.sh` or update `luanti.po{,t}` even if your code adds new translatable strings.
@@ -64,8 +64,8 @@ Contributions are welcome! Here's how you can help:
picture of the project.
2. It works.
3. It follows the code style for
[C/C++](https://dev.luanti.org/Code_style_guidelines) or
[Lua](https://dev.luanti.org/Lua_code_style_guidelines).
[C/C++](https://docs.luanti.org/for-engine-devs/code-style-guidelines/) or
[Lua](https://docs.luanti.org/for-engine-devs/lua-code-style-guidelines/).
4. The code's interfaces are well designed, regardless of other aspects that
might need more work in the future.
5. It uses protocols and formats which include the required compatibility.
@@ -106,7 +106,7 @@ the project page with a list of current languages
Builtin (the component which contains things like server messages, chat command
descriptions, privilege descriptions) is translated separately; it needs to be
translated by editing a `.tr` text file. See
[Translation](https://dev.luanti.org/Translation) for more information.
[Translation](https://docs.luanti.org/for-creators/translation/) for more information.
## Donations
@@ -116,11 +116,11 @@ methods on [our website](http://www.luanti.org/development/#donate).
# Maintaining
* This is a concise version of the
[Rules & Guidelines](https://dev.luanti.org/engine-dev-process/) on the developer wiki.*
[Rules & Guidelines](https://docs.luanti.org/for-engine-devs/) on the Luanti Documentation.*
These notes are for those who have push access Luanti (core developers / maintainers).
- See the [project organisation](https://dev.luanti.org/Organisation) for the people involved.
- See the [project organisation](https://docs.luanti.org/for-engine-devs/organization/) for the people involved.
## Concept approvals and roadmaps
@@ -169,4 +169,4 @@ Submit a :+1: (+1) or "Looks good" comment to show you believe the pull-request
## Releasing a new version
*Refer to [dev.luanti.org/Releasing_Luanti](https://dev.luanti.org/Releasing_Luanti)*
*Refer to [docs.luanti.org/for-engine-devs/releasing-luanti](https://docs.luanti.org/for-engine-devs/releasing-luanti/)*

View File

@@ -14,6 +14,7 @@ on:
- 'cmake/Modules/**'
- 'po/**.po'
- 'util/ci/**'
- 'util/helper_mod/**'
- '.github/workflows/linux.yml'
pull_request:
paths:
@@ -27,6 +28,7 @@ on:
- 'cmake/Modules/**'
- 'po/**.po'
- 'util/ci/**'
- 'util/helper_mod/**'
- '.github/workflows/linux.yml'
env:
@@ -34,28 +36,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
@@ -72,6 +78,8 @@ jobs:
env:
CC: gcc-14
CXX: g++-14
# just to check that they compile correctly
CMAKE_FLAGS: '-DBUILD_BENCHMARKS=1'
- name: Test
run: |
@@ -81,32 +89,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
@@ -132,16 +136,16 @@ jobs:
run: |
./util/test_multiplayer.sh
# Build with prometheus-cpp (server-only)
clang_11_prometheus:
name: "clang_11 (PROMETHEUS=1)"
runs-on: ubuntu-22.04
# Build with prometheus-cpp (server-only), also runs on ARM64
clang_prometheus_arm:
name: "clang (with Prometheus, ARM64)"
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Install deps
run: |
source ./util/ci/common.sh
install_linux_deps clang-11
install_linux_deps --headless clang libluajit-5.1-dev
- name: Build prometheus-cpp
run: ./util/ci/build_prometheus_cpp.sh
@@ -150,8 +154,8 @@ jobs:
run: |
./util/ci/build.sh
env:
CC: clang-11
CXX: clang++-11
CC: clang
CXX: clang++
CMAKE_FLAGS: "-DENABLE_PROMETHEUS=1 -DBUILD_CLIENT=0 -DENABLE_CURSES=0"
- name: Test

View File

@@ -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 \

View File

@@ -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";\

View File

@@ -71,9 +71,7 @@ jobs:
name: VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }}
runs-on: windows-2019
env:
VCPKG_VERSION: 01f602195983451bc83e72f4214af2cbc495aa94
# 2024.05.24
vcpkg_packages: zlib zstd curl[winssl] openal-soft libvorbis libogg libjpeg-turbo sqlite3 freetype luajit gmp jsoncpp opengl-registry
VCPKG_DEFAULT_TRIPLET: ${{matrix.config.vcpkg_triplet}}
strategy:
fail-fast: false
matrix:
@@ -97,19 +95,17 @@ 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.
run: |
cmake ${{matrix.config.generator}} `
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 `
-DENABLE_POSTGRESQL=OFF `
-DENABLE_LUAJIT=TRUE `
-DREQUIRE_LUAJIT=TRUE `

View File

@@ -19,10 +19,10 @@ read_globals = {
"VoxelManip",
"profiler",
"Settings",
"PerlinNoise", "PerlinNoiseMap",
"ValueNoise", "ValueNoiseMap",
string = {fields = {"split", "trim"}},
table = {fields = {"copy", "getn", "indexof", "keyof", "insert_all"}},
table = {fields = {"copy", "copy_with_metatables", "getn", "indexof", "keyof", "insert_all"}},
math = {fields = {"hypot", "round"}},
}
@@ -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",

View File

@@ -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)
@@ -11,12 +14,12 @@ set(CLANG_MINIMUM_VERSION "7.0.1")
# You should not need to edit these manually, use util/bump_version.sh
set(VERSION_MAJOR 5)
set(VERSION_MINOR 11)
set(VERSION_MINOR 13)
set(VERSION_PATCH 0)
set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
# Change to false for releases
set(DEVELOPMENT_BUILD TRUE)
set(DEVELOPMENT_BUILD FALSE)
set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
if(VERSION_EXTRA)
@@ -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"

View File

@@ -102,6 +102,14 @@ grorp:
using the font "undefined medium" (https://undefined-medium.com/),
which is licensed under the SIL Open Font License, Version 1.1
modified by DS
textures/base/pack/dig_btn.png
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
-------------------------------

View File

@@ -1,13 +1,15 @@
Luanti (formerly Minetest)
==========================
![Build Status](https://github.com/luanti-org/luanti/workflows/build/badge.svg)
[![Translation status](https://hosted.weblate.org/widgets/minetest/-/svg-badge.svg)](https://hosted.weblate.org/engage/minetest/?utm_source=widget)
[![License](https://img.shields.io/badge/license-LGPLv2.1%2B-blue.svg)](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)
<div align="center">
<img src="textures/base/pack/logo.png" width="32%">
<h1>Luanti (formerly Minetest)</h1>
<img src="https://github.com/luanti-org/luanti/workflows/build/badge.svg" alt="Build Status">
<a href="https://hosted.weblate.org/engage/minetest/?utm_source=widget"><img src="https://hosted.weblate.org/widgets/minetest/-/svg-badge.svg" alt="Translation status"></a>
<a href="https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html"><img src="https://img.shields.io/badge/license-LGPLv2.1%2B-blue.svg" alt="License"></a>
</div>
<br>
Luanti is a free open-source voxel game engine with easy modding and game creation.
Copyright (C) 2010-2024 Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2010-2025 Perttu Ahola <celeron55@gmail.com>
and contributors (see source file comments and the version control log)
Table of Contents
@@ -26,7 +28,7 @@ Table of Contents
Further documentation
----------------------
- Website: https://www.luanti.org/
- Wiki: https://wiki.luanti.org/
- Luanti Documentation: https://docs.luanti.org/
- Forum: https://forum.luanti.org/
- GitHub: https://github.com/luanti-org/luanti/
- [Developer documentation](doc/developing/)
@@ -55,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) |

View File

@@ -1,5 +1,4 @@
diff --git a/android/app/src/main/java/org/libsdl/app/SDLActivity.java b/android/app/src/main/java/org/libsdl/app/SDLActivity.java
index fd5a056e3..83e3cf657 100644
--- a/android/app/src/main/java/org/libsdl/app/SDLActivity.java
+++ b/android/app/src/main/java/org/libsdl/app/SDLActivity.java
@@ -1345,7 +1345,12 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
@@ -9,7 +8,7 @@ index fd5a056e3..83e3cf657 100644
- if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) {
+ if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE ||
+ /*
+ * CUSTOM ADDITION FOR MINETEST
+ * CUSTOM ADDITION FOR LUANTI
+ * should be upstreamed
+ */
+ (source & InputDevice.SOURCE_MOUSE_RELATIVE) == InputDevice.SOURCE_MOUSE_RELATIVE) {

View File

@@ -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();
}
}

View File

@@ -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";

View File

@@ -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);
}
}

View File

@@ -60,8 +60,8 @@ import java.util.Locale;
public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 2;
private static final int SDL_MINOR_VERSION = 30;
private static final int SDL_MICRO_VERSION = 8;
private static final int SDL_MINOR_VERSION = 32;
private static final int SDL_MICRO_VERSION = 0;
/*
// Display InputType.SOURCE/CLASS of events and devices
//
@@ -790,6 +790,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
SDLActivity.mFullscreenModeActive = false;
}
if (Build.VERSION.SDK_INT >= 28 /* Android 9 (Pie) */) {
window.getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
}
}
} else {
Log.e(TAG, "error handling message, getContext() returned no Activity");
@@ -1347,7 +1350,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE ||
/*
* CUSTOM ADDITION FOR MINETEST
* CUSTOM ADDITION FOR LUANTI
* should be upstreamed
*/
(source & InputDevice.SOURCE_MOUSE_RELATIVE) == InputDevice.SOURCE_MOUSE_RELATIVE) {

View 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>

View File

@@ -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="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>
</resources>
<string name="game_notification_title">Luanti läuft</string>
</resources>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="label">Luanti</string>
<string name="loading">Chargement…</string>
<string name="notification_channel_name">Notification générale</string>
<string name="notification_channel_description">Notifications de Luanti</string>
<string name="unzip_notification_title">Chargement de Luanti</string>
<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>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="label">Luanti</string>
<string name="loading">Cargando…</string>
<string name="notification_channel_name">Notificación xeral</string>
<string name="notification_channel_description">Notificacións de Luanti</string>
<string name="unzip_notification_title">Cargando Luanti</string>
<string name="unzip_notification_description">Menos de 1 minuto…</string>
<string name="ime_dialog_done">Feito</string>
<string name="no_web_browser">Non se atopou ningún navegador web</string>
<string name="game_notification_title">Luanti está en funcionamento</string>
</resources>

View File

@@ -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>
</resources>
<string name="game_notification_title">Luanti sedang berjalan</string>
</resources>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="label">לואנטי</string>
<string name="loading">טוען…</string>
<string name="notification_channel_name">הודעה כללית</string>
<string name="notification_channel_description">התראות מלואנטי</string>
<string name="unzip_notification_title">טוען לואנטי</string>
<string name="game_notification_title">לואנטי רץ</string>
<string name="ime_dialog_done">בוצע</string>
<string name="no_web_browser">לא נמצא דפדפן אינטרנט</string>
<string name="unzip_notification_description">פחות מדקה אחת…</string>
</resources>

View 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>

View File

@@ -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>
</resources>
<string name="game_notification_title">Luanti запущено</string>
</resources>

View File

@@ -0,0 +1,12 @@
<?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>
<string name="game_notification_title">Luanti deluje</string>
</resources>

View File

@@ -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>
</resources>
<string name="game_notification_title">Luanti är igång</string>
</resources>

View File

@@ -8,4 +8,5 @@
<string name="unzip_notification_description">Менше за 1 хвилину…</string>
<string name="ime_dialog_done">Готово</string>
<string name="notification_channel_description">Сповіщення від Luanti</string>
</resources>
<string name="game_notification_title">Luanti працює</string>
</resources>

View File

@@ -8,4 +8,5 @@
<string name="unzip_notification_description">不到1分钟…</string>
<string name="ime_dialog_done">完成</string>
<string name="no_web_browser">未找到网页浏览器</string>
<string name="game_notification_title">Luanti正在运行</string>
</resources>

View File

@@ -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&#8230;</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>

View File

@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
project.ext.set("versionMajor", 5) // Version Major
project.ext.set("versionMinor", 11) // Version Minor
project.ext.set("versionMinor", 13) // Version Minor
project.ext.set("versionPatch", 0) // Version Patch
// ^ keep in sync with cmake

148
android/icons/dig_btn.svg Normal file
View File

@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
inkscape:export-ydpi="24.000002"
inkscape:export-xdpi="24.000002"
inkscape:export-filename="../../textures/base/pack/dig_btn.png"
sodipodi:docname="dig_btn.svg"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)"
id="svg8"
version="1.1"
viewBox="0 0 135.46666 135.46667"
height="512"
width="512"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs2" />
<sodipodi:namedview
inkscape:document-rotation="0"
inkscape:snap-bbox-midpoints="true"
inkscape:snap-others="true"
inkscape:snap-object-midpoints="false"
inkscape:snap-to-guides="true"
inkscape:snap-bbox="true"
showguides="true"
inkscape:snap-page="true"
inkscape:snap-grids="false"
inkscape:pagecheckerboard="false"
inkscape:window-maximized="1"
inkscape:window-y="32"
inkscape:window-x="0"
inkscape:window-height="1011"
inkscape:window-width="1920"
units="px"
showgrid="true"
inkscape:current-layer="layer2"
inkscape:document-units="mm"
inkscape:cy="266.84627"
inkscape:cx="201.24514"
inkscape:zoom="1.4633894"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#404040"
id="base"
inkscape:showpageshadow="2"
inkscape:deskcolor="#d1d1d1">
<inkscape:grid
empopacity="0.25098039"
empcolor="#40ff40"
opacity="0.1254902"
color="#40ff40"
empspacing="4"
spacingy="0.26458333"
spacingx="0.26458333"
id="grid16"
type="xygrid"
originx="0"
originy="0"
units="px"
visible="true" />
</sodipodi:namedview>
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
style="display:inline"
inkscape:label="Layer 2"
id="layer2"
inkscape:groupmode="layer">
<path
inkscape:connector-curvature="0"
id="path7055"
d=""
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path7035"
d=""
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path7005"
d=""
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path5127"
d=""
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<text
transform="scale(1.0078883,0.99217343)"
id="text4716"
y="85.59491"
x="67.78315"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:48.4785px;line-height:1.25;font-family:'Bitstream Vera Sans';-inkscape-font-specification:'Bitstream Vera Sans';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#d9d9d9;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
xml:space="preserve"><tspan
style="fill:#d9d9d9;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
y="85.59491"
x="67.78315"
id="tspan4714"
sodipodi:role="line">LMB</tspan></text>
<flowRoot
transform="scale(0.26458333)"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:'Bitstream Vera Sans';-inkscape-font-specification:'Bitstream Vera Sans';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:none;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"
id="flowRoot4718"
xml:space="preserve"><flowRegion
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"
id="flowRegion4720"><rect
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"
y="124.10143"
x="264.65997"
height="136.37059"
width="157.5838"
id="rect4722" /></flowRegion><flowPara
id="flowPara4724" /></flowRoot>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.6 KiB

148
android/icons/place_btn.svg Normal file
View File

@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
inkscape:export-ydpi="24.000002"
inkscape:export-xdpi="24.000002"
inkscape:export-filename="../../textures/base/pack/place_btn.png"
sodipodi:docname="place_btn.svg"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)"
id="svg8"
version="1.1"
viewBox="0 0 135.46666 135.46667"
height="512"
width="512"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs2" />
<sodipodi:namedview
inkscape:document-rotation="0"
inkscape:snap-bbox-midpoints="true"
inkscape:snap-others="true"
inkscape:snap-object-midpoints="false"
inkscape:snap-to-guides="true"
inkscape:snap-bbox="true"
showguides="true"
inkscape:snap-page="true"
inkscape:snap-grids="false"
inkscape:pagecheckerboard="false"
inkscape:window-maximized="1"
inkscape:window-y="32"
inkscape:window-x="0"
inkscape:window-height="1011"
inkscape:window-width="1920"
units="px"
showgrid="true"
inkscape:current-layer="layer2"
inkscape:document-units="mm"
inkscape:cy="266.84627"
inkscape:cx="201.24514"
inkscape:zoom="1.4633894"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#404040"
id="base"
inkscape:showpageshadow="2"
inkscape:deskcolor="#d1d1d1">
<inkscape:grid
empopacity="0.25098039"
empcolor="#40ff40"
opacity="0.1254902"
color="#40ff40"
empspacing="4"
spacingy="0.26458333"
spacingx="0.26458333"
id="grid16"
type="xygrid"
originx="0"
originy="0"
units="px"
visible="true" />
</sodipodi:namedview>
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
style="display:inline"
inkscape:label="Layer 2"
id="layer2"
inkscape:groupmode="layer">
<path
inkscape:connector-curvature="0"
id="path7055"
d=""
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path7035"
d=""
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path7005"
d=""
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path5127"
d=""
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<text
transform="scale(1.0078883,0.99217343)"
id="text4716"
y="85.59491"
x="67.78315"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:48.4785px;line-height:1.25;font-family:'Bitstream Vera Sans';-inkscape-font-specification:'Bitstream Vera Sans';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#d9d9d9;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
xml:space="preserve"><tspan
style="fill:#d9d9d9;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
y="85.59491"
x="67.78315"
id="tspan4714"
sodipodi:role="line">RMB</tspan></text>
<flowRoot
transform="scale(0.26458333)"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:'Bitstream Vera Sans';-inkscape-font-specification:'Bitstream Vera Sans';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:none;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"
id="flowRoot4718"
xml:space="preserve"><flowRegion
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"
id="flowRegion4720"><rect
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"
y="124.10143"
x="264.65997"
height="136.37059"
width="157.5838"
id="rect4722" /></flowRegion><flowPara
id="flowPara4724" /></flowRoot>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -32,8 +32,8 @@ do
all.registered_craftitems = {}
all.registered_tools = {}
for k, v in pairs(all.registered_items) do
-- Disable further modification
setmetatable(v, {__newindex = {}})
-- Ignore new keys
setmetatable(v, {__newindex = function() end})
-- Reassemble the other tables
if v.type == "node" then
getmetatable(v).__index = all.nodedef_default
@@ -59,6 +59,9 @@ end
local alias_metatable = {
__index = function(t, name)
return rawget(t, core.registered_aliases[name])
end,
__newindex = function()
error("table is read-only")
end
}
setmetatable(core.registered_items, alias_metatable)

View File

@@ -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

View File

@@ -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.
-- Luanti
-- Copyright (C) 2013 sapier
-- SPDX-License-Identifier: LGPL-2.1-or-later
--------------------------------------------------------------------------------
-- TODO improve doc --

View File

@@ -90,7 +90,7 @@ local facedir_to_dir_map = {
1, 4, 3, 2,
}
function core.facedir_to_dir(facedir)
return facedir_to_dir[facedir_to_dir_map[facedir % 32]]
return vector.copy(facedir_to_dir[facedir_to_dir_map[facedir % 32]])
end
function core.dir_to_fourdir(dir)
@@ -110,7 +110,7 @@ function core.dir_to_fourdir(dir)
end
function core.fourdir_to_dir(fourdir)
return facedir_to_dir[facedir_to_dir_map[fourdir % 4]]
return vector.copy(facedir_to_dir[facedir_to_dir_map[fourdir % 4]])
end
function core.dir_to_wallmounted(dir)
@@ -147,7 +147,7 @@ local wallmounted_to_dir = {
vector.new( 0, -1, 0),
}
function core.wallmounted_to_dir(wallmounted)
return wallmounted_to_dir[wallmounted % 8]
return vector.copy(wallmounted_to_dir[wallmounted % 8])
end
function core.dir_to_yaw(dir)

15
builtin/common/menu.lua Normal file
View 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

View File

@@ -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
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
return "{"..table.concat(ret, ", ").."}"
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
--------------------------------------------------------------------------------
@@ -457,18 +536,37 @@ do
end
end
--------------------------------------------------------------------------------
function table.copy(t, seen)
local n = {}
seen = seen or {}
seen[t] = n
for k, v in pairs(t) do
n[(type(k) == "table" and (seen[k] or table.copy(k, seen))) or k] =
(type(v) == "table" and (seen[v] or table.copy(v, seen))) or v
local function table_copy(value, preserve_metatables)
local seen = {}
local function copy(val)
if type(val) ~= "table" then
return val
end
local t = val
if seen[t] then
return seen[t]
end
local res = {}
seen[t] = res
for k, v in pairs(t) do
res[copy(k)] = copy(v)
end
if preserve_metatables then
setmetatable(res, getmetatable(t))
end
return res
end
return n
return copy(value)
end
function table.copy(value)
return table_copy(value, false)
end
function table.copy_with_metatables(value)
return table_copy(value, true)
end
function table.insert_all(t, other)
if table.move then -- LuaJIT
@@ -536,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)

View File

@@ -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

View File

@@ -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.
-- Luanti
-- Copyright (C) 2022 rubenwardy
-- 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,13 +430,83 @@ 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
local critical_keys = {
keymap_drop = true,
keymap_dig = true,
keymap_place = true,
}
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
local is_current_close_world = setting.name == "keymap_close_world"
local is_other_close_world = o.name == "keymap_close_world"
local is_current_critical = critical_keys[setting.name]
local is_other_critical = critical_keys[o.name]
if (is_other_critical or is_current_critical) or
(not is_current_close_world and not is_other_close_world) 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
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
-- API to the in-game formspec API.
-- There's no reason you'd want to adjust mapgen noise parameter settings
-- in-game (they only apply to new worlds), so there's no reason to implement
-- this.
-- in-game (they only apply to new worlds, hidden as [world_creation]),
-- so there's no reason to implement this.
local empty = function()
return { get_formspec = function() return "", 0 end }
end

View File

@@ -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.
-- Luanti
-- Copyright (C) 2015 PilzAdam
-- SPDX-License-Identifier: LGPL-2.1-or-later
local checkboxes = {}

View File

@@ -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.
-- Luanti
-- Copyright (C) 2022 rubenwardy
-- 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,29 +90,14 @@ local function load()
end
loaded = true
full_settings = settingtypes.parse_config_file(false, true)
local change_keys = {
query_text = "Controls",
requires = {
keyboard_mouse = true,
},
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",
requires = {
touchscreen = true,
},
context = "client",
get_formspec = function(self, avail_w)
local btn_w = math.min(avail_w, 6)
return ("button[0,0;%f,0.8;btn_touch_layout;%s]"):format(btn_w, fgettext("Touchscreen layout")), 0.8
@@ -159,13 +130,11 @@ local function load()
{ heading = fgettext_ne("Movement") },
"arm_inertia",
"view_bobbing_amount",
"fall_bobbing_amount",
},
})
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
@@ -174,18 +143,24 @@ local function load()
table.insert(content, idx, shadows_component)
idx = table.indexof(content, "enable_auto_exposure") + 1
local setting_info = get_setting_info("enable_auto_exposure")
local note = component_funcs.note(fgettext_ne("(The game will need to enable automatic exposure as well)"))
note.requires = get_setting_info("enable_auto_exposure").requires
note.requires = setting_info.requires
note.context = setting_info.context
table.insert(content, idx, note)
idx = table.indexof(content, "enable_bloom") + 1
setting_info = get_setting_info("enable_bloom")
note = component_funcs.note(fgettext_ne("(The game will need to enable bloom as well)"))
note.requires = get_setting_info("enable_bloom").requires
note.requires = setting_info.requires
note.context = setting_info.context
table.insert(content, idx, note)
idx = table.indexof(content, "enable_volumetric_lighting") + 1
setting_info = get_setting_info("enable_volumetric_lighting")
note = component_funcs.note(fgettext_ne("(The game will need to enable volumetric lighting as well)"))
note.requires = get_setting_info("enable_volumetric_lighting").requires
note.requires = setting_info.requires
note.context = setting_info.context
table.insert(content, idx, note)
end
@@ -260,6 +235,17 @@ local function load()
["true"] = fgettext_ne("Enabled"),
["false"] = fgettext_ne("Disabled"),
}
get_setting_info("touch_interaction_style").option_labels = {
["tap"] = fgettext_ne("Tap"),
["tap_crosshair"] = fgettext_ne("Tap with crosshair"),
["buttons_crosshair"] = fgettext("Buttons with crosshair"),
}
get_setting_info("touch_punch_gesture").option_labels = {
["short_tap"] = fgettext_ne("Short tap"),
["long_tap"] = fgettext_ne("Long tap"),
}
end
@@ -352,7 +338,18 @@ local function update_filtered_pages(query)
end
local function check_requirements(name, requires)
local shown_contexts = {
common = true,
client = true,
server = INIT ~= "pause_menu" or core.is_internal_server(),
world_creation = INIT ~= "pause_menu",
}
local function check_requirements(name, requires, context)
if context and not shown_contexts[context] then
return false
end
if requires == nil then
return true
end
@@ -360,6 +357,7 @@ local function check_requirements(name, requires)
local video_driver = core.get_active_driver()
local touch_support = core.irrlicht_device_supports_touch()
local touch_controls = core.settings:get("touch_controls")
local touch_interaction_style = core.settings:get("touch_interaction_style")
local special = {
android = PLATFORM == "Android",
desktop = PLATFORM ~= "Android",
@@ -370,6 +368,7 @@ local function check_requirements(name, requires)
keyboard_mouse = not touch_support or (touch_controls == "auto" or not core.is_yes(touch_controls)),
opengl = (video_driver == "opengl" or video_driver == "opengl3"),
gles = video_driver:sub(1, 5) == "ogles",
touch_interaction_style_tap = touch_interaction_style ~= "buttons_crosshair",
}
for req_key, req_value in pairs(requires) do
@@ -411,11 +410,11 @@ function page_has_contents(page, actual_content)
elseif type(item) == "string" then
local setting = get_setting_info(item)
assert(setting, "Unknown setting: " .. item)
if check_requirements(setting.name, setting.requires) then
if check_requirements(setting.name, setting.requires, setting.context) then
return true
end
elseif item.get_formspec then
if check_requirements(item.id, item.requires) then
if check_requirements(item.id, item.requires, item.context) then
return true
end
else
@@ -437,20 +436,22 @@ local function build_page_components(page)
elseif item.heading then
last_heading = item
else
local name, requires
local name, requires, context
if type(item) == "string" then
local setting = get_setting_info(item)
assert(setting, "Unknown setting: " .. item)
name = setting.name
requires = setting.requires
context = setting.context
elseif item.get_formspec then
name = item.id
requires = item.requires
context = item.context
else
error("Unknown content in page: " .. dump(item))
end
if check_requirements(name, requires) then
if check_requirements(name, requires, context) then
if last_heading then
content[#content + 1] = last_heading
last_heading = nil
@@ -517,7 +518,7 @@ local function get_formspec(dialogdata)
("button[0,%f;%f,0.8;back;%s]"):format(
tabsize.height + 0.2, back_w,
fgettext(INIT == "pause_menu" and "Exit" or "Back")),
fgettext("Back")),
("box[%f,%f;%f,0.8;#0000008C]"):format(
back_w + 0.2, tabsize.height + 0.2, checkbox_w),
@@ -632,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
@@ -771,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

View File

@@ -16,7 +16,7 @@ local minetest_example_header = [[
# to the program, eg. "luanti.exe --config ../minetest.conf.example".
# Further documentation:
# https://wiki.luanti.org/
# https://docs.luanti.org/
]]
@@ -44,15 +44,18 @@ local function create_minetest_conf_example(settings)
insert(result, rep("#", entry.level))
insert(result, "# " .. entry.name .. "\n\n")
end
else
else -- any `type` as listed in `settingtypes.txt`
local group_format = false
if entry.noise_params and entry.values then
if entry.type == "noise_params_2d" or entry.type == "noise_params_3d" then
group_format = true
end
end
if entry.comment ~= "" then
for _, comment_line in ipairs(entry.comment:split("\n", true)) do
local comment = entry.comment ~= "" and entry.comment
or entry.readable_name -- fallback to the short description
if comment ~= "" then
for _, comment_line in ipairs(comment:split("\n", true)) do
if comment_line == "" then
insert(result, "#\n")
else
@@ -61,7 +64,7 @@ local function create_minetest_conf_example(settings)
end
end
if entry.type == "key" then
local line = "See https://github.com/minetest/irrlicht/blob/master/include/Keycodes.h"
local line = "See https://docs.luanti.org/for-players/controls/"
insert(result, "# " .. line .. "\n")
end
insert(result, "# type: " .. entry.type)
@@ -102,23 +105,45 @@ end
local translation_file_header = [[
// This file is automatically generated
// It contains a bunch of fake gettext calls, to tell xgettext about the strings in config files
// To update it, refer to the bottom of builtin/mainmenu/dlg_settings_advanced.lua
// To update it, refer to the bottom of builtin/common/settings/init.lua
fake_function() {]]
local function add_translation_string(result, str, seen)
if seen[str] then
return
end
seen[str] = true
-- Prevent gettext from interpreting e.g. "50% of volume" as C-formatted string
-- Documentation: https://www.gnu.org/software/gettext/manual/html_node/c_002dformat-Flag.html
local force_no_c_format = str:find("%", 1, true)
local prefix = force_no_c_format and "/* xgettext:no-c-format */ " or ""
local have_newlines = str:find("\n", 1, true)
if have_newlines then
-- Formatting as "%q" inserts literal newlines. But we want '\n'.
-- Hence, use "%s" and escape relevant characters manually.
str = str:gsub("\n", "\\n")
str = str:gsub("\"", "\\\"")
insert(result, sprintf("\t%sgettext(\"%s\");", prefix, str))
else
insert(result, sprintf("\t%sgettext(%q);", prefix, str))
end
end
local function create_translation_file(settings)
local seen = {} -- to deduplicate entries
local result = { translation_file_header }
for _, entry in ipairs(settings) do
if entry.type == "category" then
insert(result, sprintf("\tgettext(%q);", entry.name))
add_translation_string(result, entry.name, seen)
else
if entry.readable_name then
insert(result, sprintf("\tgettext(%q);", entry.readable_name))
add_translation_string(result, entry.readable_name, seen)
end
if entry.comment ~= "" then
local comment_escaped = entry.comment:gsub("\n", "\\n")
comment_escaped = comment_escaped:gsub("\"", "\\\"")
insert(result, "\tgettext(\"" .. comment_escaped .. "\");")
add_translation_string(result, entry.comment, seen)
end
end
end

View File

@@ -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.
-- Luanti
-- Copyright (C) 2022 rubenwardy
-- SPDX-License-Identifier: LGPL-2.1-or-later
local path = core.get_builtin_path() .. "common" .. DIR_DELIM .. "settings" .. DIR_DELIM

View File

@@ -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.
-- Luanti
-- Copyright (C) 2015 PilzAdam
-- SPDX-License-Identifier: LGPL-2.1-or-later
settingtypes = {}
@@ -40,12 +27,24 @@ local CHAR_CLASSES = {
FLAGS = "[%w_%-%.,]",
}
local valid_contexts = {common = true, client = true, server = true, world_creation = true}
local function check_context_annotation(context, force_context)
if force_context then
return "Context annotations are not allowed, context is always " .. force_context
end
if not valid_contexts[context] then
return "Unknown context"
end
return nil
end
local function flags_to_table(flags)
return flags:gsub("%s+", ""):split(",", true) -- Remove all spaces and split
end
-- returns error message, or nil
local function parse_setting_line(settings, line, read_all, base_level, allow_secure)
local function parse_setting_line(settings, line, read_all, base_level, allow_secure, force_context)
-- strip carriage returns (CR, /r)
line = line:gsub("\r", "")
@@ -69,9 +68,32 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
-- category
local stars, category = line:match("^%[([%*]*)([^%]]+)%]$")
local category_context
if not category then
stars, category, category_context = line:match("^%[([%*]*)([^%]]+)%] %[([^%]]+)%]$")
end
if category then
local category_level = stars:len() + base_level
if settings.current_context_level and
category_level <= settings.current_context_level then
-- The start of this category marks the end of the context annotation's scope.
settings.current_context_level = nil
settings.current_context = nil
end
if category_context then
local err = check_context_annotation(category_context, force_context)
if err then
return err
end
if settings.current_context_level then
return "Category context annotations cannot be nested"
end
settings.current_context_level = category_level
settings.current_context = category_context
end
if settings.current_hide_level then
if settings.current_hide_level < category_level then
-- Skip this category, it's inside a hidden category.
@@ -102,7 +124,8 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
end
-- settings
local first_part, name, readable_name, setting_type = line:match("^"
local function make_pattern(include_context)
return "^"
-- this first capture group matches the whole first part,
-- so we can later strip it from the rest of the line
.. "("
@@ -110,9 +133,19 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
.. CHAR_CLASSES.SPACE .. "*"
.. "%(([^%)]*)%)" -- readable name
.. CHAR_CLASSES.SPACE .. "*"
.. (include_context and (
"%[([^%]]+)%]" -- context annotation
.. CHAR_CLASSES.SPACE .. "*"
) or "")
.. "(" .. CHAR_CLASSES.VARIABLE .. "+)" -- type
.. CHAR_CLASSES.SPACE .. "*"
.. ")")
.. ")"
end
local first_part, name, readable_name, setting_type = line:match(make_pattern(false))
local setting_context
if not first_part then
first_part, name, readable_name, setting_context, setting_type = line:match(make_pattern(true))
end
if not first_part then
return "Invalid line"
@@ -122,6 +155,26 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
return "Tried to add \"secure.\" setting"
end
if setting_context then
local err = check_context_annotation(setting_context, force_context)
if err then
return err
end
end
local context
if force_context then
context = force_context
else
if setting_context then
context = setting_context
elseif settings.current_context_level then
context = settings.current_context
else
return "Missing context annotation"
end
end
local requires = {}
local last_line = #current_comment > 0 and current_comment[#current_comment]:trim()
if last_line and last_line:lower():sub(1, 9) == "requires:" then
@@ -170,6 +223,7 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
min = min,
max = max,
requires = requires,
context = context,
comment = comment,
})
return
@@ -182,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, {
@@ -193,6 +247,7 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
type = setting_type,
default = default,
requires = requires,
context = context,
comment = comment,
})
return
@@ -245,6 +300,7 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
},
values = values,
requires = requires,
context = context,
comment = comment,
noise_params = true,
flags = flags_to_table("defaults,eased,absvalue")
@@ -263,6 +319,7 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
type = "bool",
default = remaining_line,
requires = requires,
context = context,
comment = comment,
})
return
@@ -290,6 +347,7 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
min = min,
max = max,
requires = requires,
context = context,
comment = comment,
})
return
@@ -313,6 +371,7 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
default = default,
values = values:split(",", true),
requires = requires,
context = context,
comment = comment,
})
return
@@ -331,6 +390,7 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
type = setting_type,
default = default,
requires = requires,
context = context,
comment = comment,
})
return
@@ -361,6 +421,7 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
default = default,
possible = flags_to_table(possible),
requires = requires,
context = context,
comment = comment,
})
return
@@ -369,14 +430,14 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
return "Invalid setting type \"" .. setting_type .. "\""
end
local function parse_single_file(file, filepath, read_all, result, base_level, allow_secure)
local function parse_single_file(file, filepath, read_all, result, base_level, allow_secure, force_context)
-- store this helper variable in the table so it's easier to pass to parse_setting_line()
result.current_comment = {}
result.current_hide_level = nil
local line = file:read("*line")
while line do
local error_msg = parse_setting_line(result, line, read_all, base_level, allow_secure)
local error_msg = parse_setting_line(result, line, read_all, base_level, allow_secure, force_context)
if error_msg then
core.log("error", error_msg .. " in " .. filepath .. " \"" .. line .. "\"")
end
@@ -411,7 +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
-- * 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)
@@ -441,7 +501,7 @@ function settingtypes.parse_config_file(read_all, parse_mods)
type = "category",
})
parse_single_file(file, path, read_all, settings, 2, false)
parse_single_file(file, path, read_all, settings, 2, false, "server")
file:close()
end
@@ -474,7 +534,7 @@ function settingtypes.parse_config_file(read_all, parse_mods)
type = "category",
})
parse_single_file(file, path, read_all, settings, 2, false)
parse_single_file(file, path, read_all, settings, 2, false, "server")
file:close()
end
@@ -505,7 +565,7 @@ function settingtypes.parse_config_file(read_all, parse_mods)
type = "category",
})
parse_single_file(file, path, read_all, settings, 2, false)
parse_single_file(file, path, read_all, settings, 2, false, "client")
file:close()
end

View File

@@ -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.
-- Luanti
-- Copyright (C) 2021-2 x2048
-- Copyright (C) 2022-3 rubenwardy
-- SPDX-License-Identifier: LGPL-2.1-or-later
local shadow_levels_labels = {
@@ -84,6 +71,7 @@ return {
requires = {
opengl = true,
},
context = "client",
get_formspec = function(self, avail_w)
local labels = table.copy(shadow_levels_labels)
local idx = detect_mapping_idx()

View File

@@ -19,12 +19,14 @@ function meta:__newindex(name, value)
return
end
local info = getinfo(2, "Sl")
local desc = ("%s:%d"):format(info.short_src, info.currentline)
local warn_key = ("%s\0%d\0%s"):format(info.source, info.currentline, name)
if not warned[warn_key] and info.what ~= "main" and info.what ~= "C" then
core.log("warning", ("Assignment to undeclared global %q inside a function at %s.")
:format(name, desc))
warned[warn_key] = true
if info ~= nil then
local desc = ("%s:%d"):format(info.short_src, info.currentline)
local warn_key = ("%s\0%d\0%s"):format(info.source, info.currentline, name)
if not warned[warn_key] and info.what ~= "main" and info.what ~= "C" then
core.log("warning", ("Assignment to undeclared global %q inside a function at %s.")
:format(name, desc))
warned[warn_key] = true
end
end
declared[name] = true
end
@@ -35,6 +37,9 @@ function meta:__index(name)
return
end
local info = getinfo(2, "Sl")
if info == nil then
return
end
local warn_key = ("%s\0%d\0%s"):format(info.source, info.currentline, name)
if not warned[warn_key] and info.what ~= "C" then
core.log("warning", ("Undeclared global variable %q accessed at %s:%s")

View File

@@ -178,6 +178,35 @@ describe("table", function()
assert.equal(2, table.keyof({[2] = "foo", [3] = "bar"}, "foo"))
assert.equal(3, table.keyof({[1] = "foo", [3] = "bar"}, "bar"))
end)
describe("copy()", function()
it("strips metatables", function()
local v = vector.new(1, 2, 3)
local w = table.copy(v)
assert.are_not.equal(v, w)
assert.same(v, w)
assert.equal(nil, getmetatable(w))
end)
it("preserves referential structure", function()
local t = {{}, {}}
t[1][1] = t[2]
t[2][1] = t[1]
local copy = table.copy(t)
assert.same(t, copy)
assert.equal(copy[1][1], copy[2])
assert.equal(copy[2][1], copy[1])
end)
end)
describe("copy_with_metatables()", function()
it("preserves metatables", function()
local v = vector.new(1, 2, 3)
local w = table.copy_with_metatables(v)
assert.equal(getmetatable(v), getmetatable(w))
assert(vector.check(w))
assert.equal(v, w) -- vector overrides ==
end)
end)
end)
describe("formspec_escape", function()
@@ -201,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)

View File

@@ -93,21 +93,49 @@ describe("serialize", function()
assert_preserves(test_in)
end)
it("strips functions in safe mode", function()
local test_in = {
func = function(a, b)
error("test")
end,
foo = "bar"
}
setfenv(test_in.func, _G)
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")
end,
foo = "bar"
}
setfenv(test_in.func, _G)
local str = core.serialize(test_in)
assert.not_nil(str:find("loadstring"))
local str = core.serialize(test_in)
assert.not_nil(str:find("loadstring"))
local test_out = core.deserialize(str, true)
assert.is_nil(test_out.func)
assert.equals(test_out.foo, "bar")
local test_out = core.deserialize(str, true)
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()

View File

@@ -432,7 +432,32 @@ describe("vector", function()
assert.True(almost_equal({x = 1, y = 0, z = 0},
vector.rotate({x = 1, y = 0, z = 0}, {x = math.pi / 123, y = 0, z = 0})))
end)
it("is counterclockwise", function()
it("rotation order is Z-X-Y", function()
local r = vector.new(1, 2, 3)
for _, v in ipairs({
vector.new(1, 0, 0),
vector.new(0, 1, 0),
vector.new(0, 0, 1),
}) do
local expected = v:rotate(r)
local function try(order)
local rotated = v
for axis in order:gmatch(".") do
local r_axis = vector.zero()
r_axis[axis] = r[axis]
rotated = vector.rotate(rotated, r_axis)
end
return almost_equal(rotated, expected)
end
assert.False(try("xyz"))
assert.False(try("xzy"))
assert.False(try("yxz"))
assert.False(try("yzx"))
assert.True(try("zxy"))
assert.False(try("zyx"))
end
end)
it("is right handed", function()
local v_before1 = {x = 0, y = 1, z = -1}
local v_after1 = vector.rotate(v_before1, {x = math.pi / 4, y = 0, z = 0})
assert.True(almost_equal(vector.normalize(vector.cross(v_after1, v_before1)), {x = 1, y = 0, z = 0}))

View File

@@ -33,7 +33,7 @@ function core.get_node(pos)
return core.vmanip:get_node_at(pos)
end
function core.get_perlin(seed, octaves, persist, spread)
function core.get_value_noise(seed, octaves, persist, spread)
local params
if type(seed) == "table" then
params = table.copy(seed)
@@ -47,12 +47,18 @@ function core.get_perlin(seed, octaves, persist, spread)
}
end
params.seed = core.get_seed(params.seed) -- add mapgen seed
return PerlinNoise(params)
return ValueNoise(params)
end
function core.get_perlin_map(params, size)
function core.get_value_noise_map(params, size)
local params2 = table.copy(params)
params2.seed = core.get_seed(params.seed) -- add mapgen seed
return PerlinNoiseMap(params2, size)
return ValueNoiseMap(params2, size)
end
-- deprecated as of 5.12, as it was not Perlin noise
-- but with no warnings (yet) for compatibility
core.get_perlin = core.get_value_noise
core.get_perlin_map = core.get_value_noise_map
PerlinNoise = ValueNoise
PerlinNoiseMap = ValueNoiseMap

View File

@@ -9,8 +9,8 @@ do
all.registered_craftitems = {}
all.registered_tools = {}
for k, v in pairs(all.registered_items) do
-- Disable further modification
setmetatable(v, {__newindex = {}})
-- Ignore new keys
setmetatable(v, {__newindex = function() end})
-- Reassemble the other tables
if v.type == "node" then
getmetatable(v).__index = all.nodedef_default
@@ -36,6 +36,9 @@ end
local alias_metatable = {
__index = function(t, name)
return rawget(t, core.registered_aliases[name])
end,
__newindex = function()
error("table is read-only")
end
}
setmetatable(core.registered_items, alias_metatable)

View File

@@ -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.
-- Luanti
-- Copyright (C) 2014 sapier
-- Copyright (C) 2023 Gregor Parzefall
-- SPDX-License-Identifier: LGPL-2.1-or-later
local BASE_SPACING = 0.1

View File

@@ -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.
-- Luanti
-- Copyright (C) 2014 sapier
-- SPDX-License-Identifier: LGPL-2.1-or-later
local function dialog_event_handler(self,event)
if self.user_eventhandler == nil or

View File

@@ -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.
-- Luanti
-- Copyright (C) 2014 sapier
-- SPDX-License-Identifier: LGPL-2.1-or-later
--------------------------------------------------------------------------------

View File

@@ -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.
-- Luanti
-- Copyright (C) 2014 sapier
-- SPDX-License-Identifier: LGPL-2.1-or-later
ui = {}
ui.childlist = {}
@@ -131,7 +118,7 @@ function ui.update()
if (active_toplevel_ui_elements > 1) then
core.log("warning", "more than one active ui "..
"element, self most likely isn't intended")
"element, this most likely isn't intended")
end
if (active_toplevel_ui_elements == 0) then
@@ -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

View File

@@ -60,6 +60,8 @@ core.register_on_chat_message(function(name, message)
param = param or ""
core.log("verbose", string.format("Handling chat command %q with params %q", cmd, param))
-- Run core.registered_on_chatcommands callbacks.
if core.run_callbacks(core.registered_on_chatcommands, 5, name, cmd, param) then
return true
@@ -1275,7 +1277,7 @@ core.register_chatcommand("msg", {
core.log("action", "DM from " .. name .. " to " .. sendto
.. ": " .. message)
core.chat_send_player(sendto, S("DM from @1: @2", name, message))
return true, S("Message sent.")
return true, S("DM sent to @1: @2", sendto, message)
end,
})

View File

@@ -61,3 +61,10 @@ function core.register_on_auth_fail(func)
end
end)
end
-- deprecated as of 5.12, as it was not Perlin noise
-- but with no warnings (yet) for compatibility
core.get_perlin = core.get_value_noise
core.get_perlin_map = core.get_value_noise_map
PerlinNoise = ValueNoise
PerlinNoiseMap = ValueNoiseMap

View File

@@ -1,5 +1,4 @@
local builtin_shared = ...
local SCALE = 0.667
local facedir_to_euler = {
{y = 0, x = 0, z = 0},
@@ -36,9 +35,7 @@ local gravity = tonumber(core.settings:get("movement_gravity")) or 9.81
core.register_entity(":__builtin:falling_node", {
initial_properties = {
visual = "item",
visual_size = vector.new(SCALE, SCALE, SCALE),
textures = {},
visual = "node",
physical = true,
is_visible = false,
collide_with_objects = true,
@@ -80,41 +77,15 @@ core.register_entity(":__builtin:falling_node", {
-- Save liquidtype for falling water
self.liquidtype = def.liquidtype
-- Set entity visuals
if def.drawtype == "torchlike" or def.drawtype == "signlike" then
local textures
if def.tiles and def.tiles[1] then
local tile = def.tiles[1]
if type(tile) == "table" then
tile = tile.name
end
if def.drawtype == "torchlike" then
textures = { "("..tile..")^[transformFX", tile }
else
textures = { tile, "("..tile..")^[transformFX" }
end
end
local vsize
if def.visual_scale then
local s = def.visual_scale
vsize = vector.new(s, s, s)
end
self.object:set_properties({
is_visible = true,
visual = "upright_sprite",
visual_size = vsize,
textures = textures,
glow = def.light_source,
})
elseif def.drawtype ~= "airlike" then
local itemstring = node.name
if core.is_colored_paramtype(def.paramtype2) then
itemstring = core.itemstring_with_palette(itemstring, node.param2)
end
-- FIXME: solution needed for paramtype2 == "leveled"
-- Set up entity visuals
-- For compatibility with older clients we continue to use "item" visual
-- for simple situations.
local drawtypes = {normal=true, glasslike=true, allfaces=true, nodebox=true}
local p2types = {none=true, facedir=true, ["4dir"]=true}
if drawtypes[def.drawtype] and p2types[def.paramtype2] and def.use_texture_alpha ~= "blend" then
-- Calculate size of falling node
local s = {}
s.x = (def.visual_scale or 1) * SCALE
local s = vector.zero()
s.x = (def.visual_scale or 1) * 0.667
s.y = s.x
s.z = s.x
-- Compensate for wield_scale
@@ -125,10 +96,31 @@ core.register_entity(":__builtin:falling_node", {
end
self.object:set_properties({
is_visible = true,
wield_item = itemstring,
visual = "item",
wield_item = node.name,
visual_size = s,
glow = def.light_source,
})
-- Rotate as needed
if def.paramtype2 == "facedir" then
local fdir = node.param2 % 32 % 24
local euler = facedir_to_euler[fdir + 1]
if euler then
self.object:set_rotation(euler)
end
elseif def.paramtype2 == "4dir" then
local fdir = node.param2 % 4
local euler = facedir_to_euler[fdir + 1]
if euler then
self.object:set_rotation(euler)
end
end
elseif def.drawtype ~= "airlike" then
self.object:set_properties({
is_visible = true,
node = node,
glow = def.light_source,
})
end
-- Set collision box (certain nodeboxes only for now)
@@ -148,111 +140,6 @@ core.register_entity(":__builtin:falling_node", {
})
end
end
-- Rotate entity
if def.drawtype == "torchlike" then
if (def.paramtype2 == "wallmounted" or def.paramtype2 == "colorwallmounted")
and node.param2 % 8 == 7 then
self.object:set_yaw(-math.pi*0.25)
else
self.object:set_yaw(math.pi*0.25)
end
elseif ((node.param2 ~= 0 or def.drawtype == "nodebox" or def.drawtype == "mesh")
and (def.wield_image == "" or def.wield_image == nil))
or def.drawtype == "signlike"
or def.drawtype == "mesh"
or def.drawtype == "normal"
or def.drawtype == "nodebox" then
if (def.paramtype2 == "facedir" or def.paramtype2 == "colorfacedir") then
local fdir = node.param2 % 32 % 24
-- Get rotation from a precalculated lookup table
local euler = facedir_to_euler[fdir + 1]
if euler then
self.object:set_rotation(euler)
end
elseif (def.paramtype2 == "4dir" or def.paramtype2 == "color4dir") then
local fdir = node.param2 % 4
-- Get rotation from a precalculated lookup table
local euler = facedir_to_euler[fdir + 1]
if euler then
self.object:set_rotation(euler)
end
elseif (def.drawtype ~= "plantlike" and def.drawtype ~= "plantlike_rooted" and
(def.paramtype2 == "wallmounted" or def.paramtype2 == "colorwallmounted" or def.drawtype == "signlike")) then
local rot = node.param2 % 8
if (def.drawtype == "signlike" and def.paramtype2 ~= "wallmounted" and def.paramtype2 ~= "colorwallmounted") then
-- Change rotation to "floor" by default for non-wallmounted paramtype2
rot = 1
end
local pitch, yaw, roll = 0, 0, 0
if def.drawtype == "nodebox" or def.drawtype == "mesh" then
if rot == 0 then
pitch, yaw = math.pi/2, 0
elseif rot == 1 then
pitch, yaw = -math.pi/2, math.pi
elseif rot == 2 then
pitch, yaw = 0, math.pi/2
elseif rot == 3 then
pitch, yaw = 0, -math.pi/2
elseif rot == 4 then
pitch, yaw = 0, math.pi
elseif rot == 6 then
pitch, yaw = math.pi/2, 0
elseif rot == 7 then
pitch, yaw = -math.pi/2, math.pi
end
else
if rot == 1 then
pitch, yaw = math.pi, math.pi
elseif rot == 2 then
pitch, yaw = math.pi/2, math.pi/2
elseif rot == 3 then
pitch, yaw = math.pi/2, -math.pi/2
elseif rot == 4 then
pitch, yaw = math.pi/2, math.pi
elseif rot == 5 then
pitch, yaw = math.pi/2, 0
elseif rot == 6 then
pitch, yaw = math.pi, -math.pi/2
elseif rot == 7 then
pitch, yaw = 0, -math.pi/2
end
end
if def.drawtype == "signlike" then
pitch = pitch - math.pi/2
if rot == 0 then
yaw = yaw + math.pi/2
elseif rot == 1 then
yaw = yaw - math.pi/2
elseif rot == 6 then
yaw = yaw - math.pi/2
pitch = pitch + math.pi
elseif rot == 7 then
yaw = yaw + math.pi/2
pitch = pitch + math.pi
end
elseif def.drawtype == "mesh" or def.drawtype == "normal" or def.drawtype == "nodebox" then
if rot == 0 or rot == 1 then
roll = roll + math.pi
elseif rot == 6 or rot == 7 then
if def.drawtype ~= "normal" then
roll = roll - math.pi/2
end
else
yaw = yaw + math.pi
end
end
self.object:set_rotation({x=pitch, y=yaw, z=roll})
elseif (def.drawtype == "mesh" and def.paramtype2 == "degrotate") then
local p2 = (node.param2 - (def.place_param2 or 0)) % 240
local yaw = (p2 / 240) * (math.pi * 2)
self.object:set_yaw(yaw)
elseif (def.drawtype == "mesh" and def.paramtype2 == "colordegrotate") then
local p2 = (node.param2 % 32 - (def.place_param2 or 0) % 32) % 24
local yaw = (p2 / 24) * (math.pi * 2)
self.object:set_yaw(yaw)
end
end
end,
get_staticdata = function(self)

View File

@@ -45,6 +45,9 @@ core.features = {
abm_without_neighbors = true,
biome_weights = true,
particle_blend_clip = true,
remove_item_match_meta = true,
httpfetch_additional_methods = true,
object_guids = true,
}
function core.has_feature(arg)

View File

@@ -360,13 +360,12 @@ end
function core.item_drop(itemstack, dropper, pos)
local dropper_is_player = dropper and dropper:is_player()
local p = table.copy(pos)
local cnt = itemstack:get_count()
if dropper_is_player then
p.y = p.y + 1.2
end
local item = itemstack:take_item(cnt)
local obj = core.add_item(p, item)
local obj = core.add_item(p, ItemStack(itemstack))
if obj then
itemstack:clear()
if dropper_is_player then
local dir = dropper:get_look_dir()
dir.x = dir.x * 2.9
@@ -375,7 +374,7 @@ function core.item_drop(itemstack, dropper, pos)
obj:set_velocity(dir)
obj:get_luaentity().dropped_by = dropper:get_player_name()
end
return itemstack
return itemstack, obj
end
-- If we reach this, adding the object to the
-- environment failed
@@ -514,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()
@@ -740,16 +740,16 @@ core.noneitemdef_default = { -- This is used for the hand and unknown items
--
local get_node_raw = core.get_node_raw
core.get_node_raw = nil
local get_name_from_content_id = core.get_name_from_content_id
function core.get_node(pos)
local content, param1, param2 = get_node_raw(pos.x, pos.y, pos.z)
return {name = core.get_name_from_content_id(content), param1 = param1, param2 = param2}
return {name = get_name_from_content_id(content), param1 = param1, param2 = param2}
end
function core.get_node_or_nil(pos)
local content, param1, param2, pos_ok = get_node_raw(pos.x, pos.y, pos.z)
return pos_ok and
{name = core.get_name_from_content_id(content), param1 = param1, param2 = param2}
{name = get_name_from_content_id(content), param1 = param1, param2 = param2}
or nil
end

View File

@@ -129,6 +129,8 @@ core.protocol_versions = {
["5.9.1"] = 45,
["5.10.0"] = 46,
["5.11.0"] = 47,
["5.12.0"] = 48,
["5.13.0"] = 49,
}
setmetatable(core.protocol_versions, {__newindex = function()

View File

@@ -61,7 +61,7 @@ local function check_modname_prefix(name)
return name:sub(2)
else
-- Enforce that the name starts with the correct mod name.
local expected_prefix = core.get_current_modname() .. ":"
local expected_prefix = (core.get_current_modname() or "") .. ":"
if name:sub(1, #expected_prefix) ~= expected_prefix then
error("Name " .. name .. " does not follow naming conventions: " ..
"\"" .. expected_prefix .. "\" or \":\" prefix required")
@@ -95,6 +95,7 @@ function core.register_abm(spec)
check_node_list(spec.nodenames, "nodenames")
check_node_list(spec.neighbors, "neighbors")
assert(type(spec.action) == "function", "Required field 'action' of type function")
core.registered_abms[#core.registered_abms + 1] = spec
spec.mod_origin = core.get_current_modname() or "??"
end
@@ -128,127 +129,51 @@ function core.register_entity(name, prototype)
prototype.mod_origin = core.get_current_modname() or "??"
end
function core.register_item(name, itemdef)
-- Check name
if name == nil then
error("Unable to register item: Name is nil")
local function preprocess_node(nodedef)
-- Use the nodebox as selection box if it's not set manually
if nodedef.drawtype == "nodebox" and not nodedef.selection_box then
nodedef.selection_box = nodedef.node_box
elseif nodedef.drawtype == "fencelike" and not nodedef.selection_box then
nodedef.selection_box = {
type = "fixed",
fixed = {-1/8, -1/2, -1/8, 1/8, 1/2, 1/8},
}
end
name = check_modname_prefix(tostring(name))
if forbidden_item_names[name] then
error("Unable to register item: Name is forbidden: " .. name)
end
itemdef.name = name
-- Apply defaults and add to registered_* table
if itemdef.type == "node" then
-- Use the nodebox as selection box if it's not set manually
if itemdef.drawtype == "nodebox" and not itemdef.selection_box then
itemdef.selection_box = itemdef.node_box
elseif itemdef.drawtype == "fencelike" and not itemdef.selection_box then
itemdef.selection_box = {
type = "fixed",
fixed = {-1/8, -1/2, -1/8, 1/8, 1/2, 1/8},
}
end
if itemdef.light_source and itemdef.light_source > core.LIGHT_MAX then
itemdef.light_source = core.LIGHT_MAX
core.log("warning", "Node 'light_source' value exceeds maximum," ..
" limiting to maximum: " ..name)
end
setmetatable(itemdef, {__index = core.nodedef_default})
core.registered_nodes[itemdef.name] = itemdef
elseif itemdef.type == "craft" then
setmetatable(itemdef, {__index = core.craftitemdef_default})
core.registered_craftitems[itemdef.name] = itemdef
elseif itemdef.type == "tool" then
setmetatable(itemdef, {__index = core.tooldef_default})
core.registered_tools[itemdef.name] = itemdef
elseif itemdef.type == "none" then
setmetatable(itemdef, {__index = core.noneitemdef_default})
else
error("Unable to register item: Type is invalid: " .. dump(itemdef))
if nodedef.light_source and nodedef.light_source > core.LIGHT_MAX then
nodedef.light_source = core.LIGHT_MAX
core.log("warning", "Node 'light_source' value exceeds maximum," ..
" limiting it: " .. nodedef.name)
end
-- Flowing liquid uses param2
if itemdef.type == "node" and itemdef.liquidtype == "flowing" then
itemdef.paramtype2 = "flowingliquid"
if nodedef.liquidtype == "flowing" then
nodedef.paramtype2 = "flowingliquid"
end
end
local function preprocess_craft(itemdef)
-- BEGIN Legacy stuff
if itemdef.cookresult_itemstring ~= nil and itemdef.cookresult_itemstring ~= "" then
core.register_craft({
type="cooking",
output=itemdef.cookresult_itemstring,
recipe=itemdef.name,
cooktime=itemdef.furnace_cooktime
})
end
if itemdef.furnace_burntime ~= nil and itemdef.furnace_burntime >= 0 then
core.register_craft({
type="fuel",
recipe=itemdef.name,
burntime=itemdef.furnace_burntime
})
if itemdef.inventory_image == nil and itemdef.image ~= nil then
core.log("deprecated", "The `image` field in craftitem definitions " ..
"is deprecated. Use `inventory_image` instead. " ..
"Craftitem name: " .. itemdef.name, 3)
itemdef.inventory_image = itemdef.image
end
-- END Legacy stuff
itemdef.mod_origin = core.get_current_modname() or "??"
-- Disable all further modifications
getmetatable(itemdef).__newindex = {}
--core.log("Registering item: " .. itemdef.name)
core.registered_items[itemdef.name] = itemdef
core.registered_aliases[itemdef.name] = nil
register_item_raw(itemdef)
end
function core.unregister_item(name)
if not core.registered_items[name] then
core.log("warning", "Not unregistering item " ..name..
" because it doesn't exist.")
return
end
-- Erase from registered_* table
local type = core.registered_items[name].type
if type == "node" then
core.registered_nodes[name] = nil
elseif type == "craft" then
core.registered_craftitems[name] = nil
elseif type == "tool" then
core.registered_tools[name] = nil
end
core.registered_items[name] = nil
unregister_item_raw(name)
end
function core.register_node(name, nodedef)
nodedef.type = "node"
core.register_item(name, nodedef)
end
function core.register_craftitem(name, craftitemdef)
craftitemdef.type = "craft"
-- BEGIN Legacy stuff
if craftitemdef.inventory_image == nil and craftitemdef.image ~= nil then
craftitemdef.inventory_image = craftitemdef.image
end
-- END Legacy stuff
core.register_item(name, craftitemdef)
end
function core.register_tool(name, tooldef)
tooldef.type = "tool"
local function preprocess_tool(tooldef)
tooldef.stack_max = 1
-- BEGIN Legacy stuff
if tooldef.inventory_image == nil and tooldef.image ~= nil then
core.log("deprecated", "The `image` field in tool definitions " ..
"is deprecated. Use `inventory_image` instead. " ..
"Tool name: " .. tooldef.name, 3)
tooldef.inventory_image = tooldef.image
end
if tooldef.tool_capabilities == nil and
(tooldef.full_punch_interval ~= nil or
tooldef.basetime ~= nil or
@@ -261,6 +186,9 @@ function core.register_tool(name, tooldef)
tooldef.dd_crackiness ~= nil or
tooldef.dd_crumbliness ~= nil or
tooldef.dd_cuttability ~= nil) then
core.log("deprecated", "Specifying tool capabilities directly in the tool " ..
"definition is deprecated. Use the `tool_capabilities` field instead. " ..
"Tool name: " .. tooldef.name, 3)
tooldef.tool_capabilities = {
full_punch_interval = tooldef.full_punch_interval,
basetime = tooldef.basetime,
@@ -277,7 +205,7 @@ function core.register_tool(name, tooldef)
end
-- END Legacy stuff
-- This isn't just legacy, but more of a convenience feature
-- Automatically set punch_attack_uses as a convenience feature
local toolcaps = tooldef.tool_capabilities
if toolcaps and toolcaps.punch_attack_uses == nil then
for _, cap in pairs(toolcaps.groupcaps or {}) do
@@ -288,8 +216,126 @@ function core.register_tool(name, tooldef)
end
end
end
end
core.register_item(name, tooldef)
local default_tables = {
node = core.nodedef_default,
craft = core.craftitemdef_default,
tool = core.tooldef_default,
none = core.noneitemdef_default,
}
local preprocess_fns = {
node = preprocess_node,
craft = preprocess_craft,
tool = preprocess_tool,
}
function core.register_item(name, itemdef)
-- Check name
if name == nil then
error("Unable to register item: Name is nil")
end
name = check_modname_prefix(tostring(name))
if forbidden_item_names[name] then
error("Unable to register item: Name is forbidden: " .. name)
end
itemdef.name = name
-- Compatibility stuff depending on type
local fn = preprocess_fns[itemdef.type]
if fn then
fn(itemdef)
end
-- Apply defaults
local defaults = default_tables[itemdef.type]
if defaults == nil then
error("Unable to register item: Type is invalid: " .. dump(itemdef))
end
local old_mt = getmetatable(itemdef)
-- TODO most of these checks should become an error after a while (maybe in 2026?)
if old_mt ~= nil and next(old_mt) ~= nil then
-- Note that even registering multiple identical items with the same table
-- is not allowed, due to the 'name' property.
if old_mt.__index == defaults then
core.log("warning", "Item definition table was reused between registrations. "..
"This is unsupported and broken: " .. name)
else
core.log("warning", "Item definition has a metatable, this is "..
"unsupported and it will be overwritten: " .. name)
end
end
setmetatable(itemdef, {__index = defaults})
-- BEGIN Legacy stuff
if itemdef.cookresult_itemstring ~= nil and itemdef.cookresult_itemstring ~= "" then
core.log("deprecated", "The `cookresult_itemstring` item definition " ..
"field is deprecated. Use `core.register_craft` instead. " ..
"Item name: " .. itemdef.name, 2)
core.register_craft({
type="cooking",
output=itemdef.cookresult_itemstring,
recipe=itemdef.name,
cooktime=itemdef.furnace_cooktime
})
end
if itemdef.furnace_burntime ~= nil and itemdef.furnace_burntime >= 0 then
core.log("deprecated", "The `furnace_burntime` item definition " ..
"field is deprecated. Use `core.register_craft` instead. " ..
"Item name: " .. itemdef.name, 2)
core.register_craft({
type="fuel",
recipe=itemdef.name,
burntime=itemdef.furnace_burntime
})
end
-- END Legacy stuff
itemdef.mod_origin = core.get_current_modname() or "??"
-- Ignore new keys as a failsafe to prevent mistakes
getmetatable(itemdef).__newindex = function() end
-- Add to registered_* tables
if itemdef.type == "node" then
core.registered_nodes[itemdef.name] = itemdef
elseif itemdef.type == "craft" then
core.registered_craftitems[itemdef.name] = itemdef
elseif itemdef.type == "tool" then
core.registered_tools[itemdef.name] = itemdef
end
core.registered_items[itemdef.name] = itemdef
core.registered_aliases[itemdef.name] = nil
register_item_raw(itemdef)
end
local function make_register_item_wrapper(the_type)
return function(name, itemdef)
itemdef.type = the_type
return core.register_item(name, itemdef)
end
end
core.register_node = make_register_item_wrapper("node")
core.register_craftitem = make_register_item_wrapper("craft")
core.register_tool = make_register_item_wrapper("tool")
function core.unregister_item(name)
if not core.registered_items[name] then
core.log("warning", "Not unregistering item " ..name..
" because it doesn't exist.")
return
end
-- Erase from registered_* table
core.registered_nodes[name] = nil
core.registered_craftitems[name] = nil
core.registered_tools[name] = nil
core.registered_items[name] = nil
unregister_item_raw(name)
end
function core.register_alias(name, convert_to)
@@ -300,7 +346,6 @@ function core.register_alias(name, convert_to)
core.log("warning", "Not registering alias, item with same name" ..
" is already defined: " .. name .. " -> " .. convert_to)
else
--core.log("Registering alias: " .. name .. " -> " .. convert_to)
core.registered_aliases[name] = convert_to
register_alias_raw(name, convert_to)
end
@@ -315,7 +360,6 @@ function core.register_alias_force(name, convert_to)
core.log("info", "Removed item " ..name..
" while attempting to force add an alias")
end
--core.log("Registering alias: " .. name .. " -> " .. convert_to)
core.registered_aliases[name] = convert_to
register_alias_raw(name, convert_to)
end
@@ -406,6 +450,7 @@ core.register_item(":", {
groups = {not_in_creative_inventory=1},
})
local itemdefs_finalized = false
function core.override_item(name, redefinition, del_fields)
if redefinition.name ~= nil then
@@ -418,10 +463,16 @@ function core.override_item(name, redefinition, del_fields)
if not item then
error("Attempt to override non-existent item "..name, 2)
end
if itemdefs_finalized then
-- TODO: it's not clear if this needs to be allowed at all?
core.log("warning", "Overriding item " .. name .. " after server startup. " ..
"This is unsupported and can cause problems related to data inconsistency.")
end
for k, v in pairs(redefinition) do
rawset(item, k, v)
end
for _, field in ipairs(del_fields or {}) do
assert(field ~= "name" and field ~= "type")
rawset(item, field, nil)
end
register_item_raw(item)
@@ -568,13 +619,57 @@ core.registered_on_rightclickplayers, core.register_on_rightclickplayer = make_r
core.registered_on_liquid_transformed, core.register_on_liquid_transformed = make_registration()
core.registered_on_mapblocks_changed, core.register_on_mapblocks_changed = make_registration()
-- A bunch of registrations are read by the C++ side once on env init, so we cannot
-- allow them to change afterwards (see s_env.cpp).
-- Nodes and items do not have this problem but there are obvious consistency
-- problems if this would be allowed.
local function freeze_table(t)
-- Freezing a Lua table is not actually possible without some very intrusive
-- metatable hackery, but we can trivially prevent new additions.
local mt = table.copy(getmetatable(t) or {})
mt.__newindex = function()
error("modification forbidden")
end
setmetatable(t, mt)
end
local function generic_reg_error(what)
return function(something)
local described = what
if type(something) == "table" and type(something.name) == "string" then
described = what .. " " .. something.name
elseif type(something) == "string" then
described = what .. " " .. something
end
error("Tried to register " .. described .. " after load time!")
end
end
core.register_on_mods_loaded(function()
core.after(0, function()
setmetatable(core.registered_on_mapblocks_changed, {
__newindex = function()
error("on_mapblocks_changed callbacks must be registered at load time")
end,
})
itemdefs_finalized = true
-- prevent direct modification
freeze_table(core.registered_abms)
freeze_table(core.registered_lbms)
freeze_table(core.registered_items)
freeze_table(core.registered_nodes)
freeze_table(core.registered_craftitems)
freeze_table(core.registered_tools)
freeze_table(core.registered_aliases)
freeze_table(core.registered_on_mapblocks_changed)
-- neutralize registration functions
core.register_abm = generic_reg_error("ABM")
core.register_lbm = generic_reg_error("LBM")
core.register_item = generic_reg_error("item")
core.unregister_item = function(name)
error("Refusing to unregister item " .. name .. " after load time")
end
core.register_alias = generic_reg_error("alias")
core.register_alias_force = generic_reg_error("alias")
core.register_on_mapblocks_changed = generic_reg_error("on_mapblocks_changed callback")
end)
end)

View File

@@ -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.
-- Luanti
-- Copyright (C) 2014 sapier
-- 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

View File

@@ -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.
-- Luanti
-- Copyright (C) 2018-24 rubenwardy
-- 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,57 +577,54 @@ function contentdb.filter_packages(query, by_type)
end
function contentdb.get_full_package_info(package, callback)
assert(package)
if package.full_info then
callback(package.full_info)
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" }
local function get_package_info(key, path)
return function(package, callback)
assert(package)
if package[key] then
callback(package[key])
return
end
local url = base_url ..
"/api/packages/" .. params.package.url_part .. "/for-client/?" ..
"protocol_version=" .. core.urlencode(core.get_max_supp_proto()) ..
"&engine_version=" .. core.urlencode(version.string) ..
"&formspec_version=" .. core.urlencode(core.get_formspec_version()) ..
"&include_images=false"
local http = core.get_http_api()
local response = http.fetch_sync({
url = url,
extra_headers = {
"Accept-Language: " .. table.concat(languages, ", ")
},
})
if not response.succeeded then
return nil
local function fetch(params)
local version = core.get_version()
local base_url = core.settings:get("contentdb_url")
local url = base_url ..
"/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()) ..
"&include_images=false"
local http = core.get_http_api()
local response = http.fetch_sync({
url = url,
extra_headers = {
core.get_http_accept_languages()
},
})
if not response.succeeded then
return nil
end
return core.parse_json(response.data)
end
return core.parse_json(response.data)
end
local function my_callback(value)
package[key] = value
callback(value)
end
local function my_callback(value)
package.full_info = value
callback(value)
end
if not core.handle_async(fetch, { package = package }, my_callback) then
core.log("error", "ERROR: async event failed")
callback(nil)
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()
-- Padding is increased on Android to account for notches
-- TODO: use Android API to determine size of cut outs

View File

@@ -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.
-- Luanti
-- Copyright (C) 2018-20 rubenwardy
-- 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

View File

@@ -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.
-- Luanti
-- Copyright (C) 2018-24 rubenwardy
-- SPDX-License-Identifier: LGPL-2.1-or-later
local function is_still_visible(dlg)
local this = ui.find_by_name("install_dialog")

View File

@@ -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.
-- Luanti
-- Copyright (C) 2018-24 rubenwardy
-- SPDX-License-Identifier: LGPL-2.1-or-later
function get_formspec(data)
local package = data.package

View File

@@ -1,37 +1,68 @@
--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.
-- Luanti
-- Copyright (C) 2018-24 rubenwardy
-- SPDX-License-Identifier: LGPL-2.1-or-later
local function get_info_formspec(size, padding, text)
return table.concat({
"formspec_version[6]",
"size[", size.x, ",", size.y, "]",
"padding[0,0]",
"bgcolor[;true]",
local function get_description_hypertext(package, info, loading_error)
-- Screenshots and description
local hypertext = "<big><b>" .. core.hypertext_escape(package.short_description) .. "</b></big>\n"
"label[4,4.35;", text, "]",
"container[", padding.x, ",", size.y - 0.8 - padding.y, "]",
"button[0,0;2,0.8;back;", fgettext("Back"), "]",
"container_end[]",
})
local screenshots = info and info.screenshots or {{url = package.thumbnail}}
local winfo = core.get_window_info()
local fs_to_px = winfo.size.x / winfo.max_formspec_size.x
for i, ss in ipairs(screenshots) do
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>"
if i ~= #screenshots then
hypertext = hypertext .. "<img name=\"blank.png\" width=" .. (0.25 * fs_to_px) ..
" height=" .. (2.25 * fs_to_px).. ">"
end
end
if info then
hypertext = hypertext .. "\n" .. info.long_description.head
local first = true
local function add_link_button(label, name)
if info[name] then
if not first then
hypertext = hypertext .. " | "
end
hypertext = hypertext .. "<action name=link_" .. name .. ">" .. label .. "</action>"
info.long_description.links["link_" .. name] = info[name]
first = false
end
end
add_link_button(hgettext("Donate"), "donate_url")
add_link_button(hgettext("Website"), "website")
add_link_button(hgettext("Source"), "repo")
add_link_button(hgettext("Issue Tracker"), "issue_tracker")
add_link_button(hgettext("Translate"), "translation_url")
add_link_button(hgettext("Forum Topic"), "forum_url")
hypertext = hypertext .. "\n\n" .. info.long_description.body
elseif loading_error then
hypertext = hypertext .. "\n\n" .. hgettext("Error loading package information")
else
hypertext = hypertext .. "\n\n" .. hgettext("Loading...")
end
-- Fix the path to blank.png. This is needed for bullet indentation,
-- and also used for screenshot spacing.
hypertext = hypertext:gsub("<img name=\"?blank.png\"? ",
"<img name=\"" .. core.hypertext_escape(defaulttexturedir) .. "blank.png\" ")
return hypertext
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 +73,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
@@ -53,18 +84,10 @@ local function get_formspec(data)
assert(data.package.name == info.name)
data.info = info
-- note: get_full_package_info can also return cached info immediately
ui.update()
end)
end
-- get_full_package_info can return cached info immediately, so
-- 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"))
end
return get_info_formspec(size, window_padding, fgettext("Loading..."))
end
end
-- Check installation status
@@ -72,10 +95,14 @@ local function get_formspec(data)
local info = data.info
local info_line =
fgettext("by $1 — $2 downloads — +$3 / $4 / -$5",
local info_line
if info then
info_line = fgettext_ne("by $1 — $2 downloads — +$3 / $4 / -$5",
info.author, info.downloads,
info.reviews.positive, info.reviews.neutral, info.reviews.negative)
else
info_line = fgettext_ne("by $1", package.author)
end
local bottom_buttons_y = H - 0.8
@@ -91,7 +118,7 @@ local function get_formspec(data)
"button[", W - 3, ",", bottom_buttons_y, ";3,0.8;open_contentdb;", fgettext("ContentDB page"), "]",
"style_type[label;font_size=+24;font=bold]",
"label[0,0.4;", core.formspec_escape(info.title), "]",
"label[0,0.4;", core.formspec_escape(package.title), "]",
"style_type[label;font_size=;font=]",
"label[0,1.2;", core.formspec_escape(info_line), "]",
@@ -103,23 +130,25 @@ 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
local label = info and fgettext("Install [$1]", info.download_size) or
fgettext("Install")
formspec[#formspec + 1] = "style[install;bgcolor=green]"
formspec[#formspec + 1] = "button["
formspec[#formspec + 1] = right_button_rect
formspec[#formspec + 1] =";install;"
formspec[#formspec + 1] = fgettext("Install [$1]", info.download_size)
formspec[#formspec + 1] = label
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["
@@ -140,8 +169,12 @@ local function get_formspec(data)
local current_tab = data.current_tab or 1
local tab_titles = {
fgettext("Description"),
fgettext("Information"),
}
if info then
local review_count = info.reviews.positive + info.reviews.neutral + info.reviews.negative
table.insert(tab_titles, fgettext("Information"))
table.insert(tab_titles, fgettext("Reviews") .. core.formspec_escape(" [" .. review_count .. "]"))
end
local tab_body_height = bottom_buttons_y - 2.8
@@ -157,59 +190,53 @@ local function get_formspec(data)
})
if current_tab == 1 then
-- Screenshots and description
local hypertext = "<big><b>" .. core.hypertext_escape(info.short_description) .. "</b></big>\n"
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)
hypertext = hypertext .. "<action name=\"ss_" .. i .. "\"><img name=\"" ..
core.hypertext_escape(path) .. "\" width=" .. (3 * fs_to_px) ..
" height=" .. (2 * fs_to_px) .. "></action>"
if i ~= #info.screenshots then
hypertext = hypertext .. "<img name=\"blank.png\" width=" .. (0.25 * fs_to_px) ..
" height=" .. (2.25 * fs_to_px).. ">"
end
end
hypertext = hypertext .. "\n" .. info.long_description.head
local first = true
local function add_link_button(label, name)
if info[name] then
if not first then
hypertext = hypertext .. " | "
end
hypertext = hypertext .. "<action name=link_" .. name .. ">" .. core.hypertext_escape(label) .. "</action>"
info.long_description.links["link_" .. name] = info[name]
first = false
end
end
add_link_button(fgettext("Donate"), "donate_url")
add_link_button(fgettext("Website"), "website")
add_link_button(fgettext("Source"), "repo")
add_link_button(fgettext("Issue Tracker"), "issue_tracker")
add_link_button(fgettext("Translate"), "translation_url")
add_link_button(fgettext("Forum Topic"), "forum_url")
hypertext = hypertext .. "\n\n" .. info.long_description.body
hypertext = hypertext:gsub("<img name=\"?blank.png\"? ",
"<img name=\"" .. core.hypertext_escape(defaulttexturedir) .. "blank.png\" ")
local hypertext = get_description_hypertext(package, info, data.loading_error)
table.insert_all(formspec, {
"hypertext[0,0;", W, ",", tab_body_height - 0.375,
";desc;", core.formspec_escape(hypertext), "]",
})
elseif current_tab == 2 then
assert(info)
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
assert(info)
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
@@ -264,14 +291,11 @@ local function handle_submit(this, fields)
return true
end
if not info then
return false
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
@@ -289,13 +313,20 @@ local function handle_submit(this, fields)
return true
end
-- The events handled below are only valid if the package info has finished
-- loading.
if not info then
return false
end
if fields.tabs then
this.data.current_tab = tonumber(fields.tabs)
return true
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

View File

@@ -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.
-- Luanti
-- Copyright (C) 2023 rubenwardy
-- SPDX-License-Identifier: LGPL-2.1-or-later
local path = core.get_mainmenu_path() .. DIR_DELIM .. "content"

View File

@@ -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.
-- Luanti
-- Copyright (C) 2013 sapier
-- SPDX-License-Identifier: LGPL-2.1-or-later
--------------------------------------------------------------------------------
local function get_last_folder(text,count)

View File

@@ -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.
-- Luanti
-- Copyright (C) 2023-24 rubenwardy
-- SPDX-License-Identifier: LGPL-2.1-or-later
-- Screenshot

View File

@@ -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.
-- Luanti
-- Copyright (C) 2022 rubenwardy
-- SPDX-License-Identifier: LGPL-2.1-or-later
local mods_dir = "/tmp/.minetest/mods"
local games_dir = "/tmp/.minetest/games"

View File

@@ -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.
-- Luanti
-- Copyright (C) 2023 rubenwardy
-- SPDX-License-Identifier: LGPL-2.1-or-later
update_detector = {}
@@ -127,9 +114,12 @@ function update_detector.get_all()
local ret = {}
local all_content = pkgmgr.get_all()
for _, content in ipairs(all_content) do
assert(content.path and content.path ~= "")
local cdb_id = pkgmgr.get_contentdb_id(content)
if cdb_id then
-- Do not consider content that we cannot modify to be out-of-date.
-- This would be technically correct but confusing for the user.
if cdb_id and core.may_modify_path(content.path) then
-- The backend will account for aliases in `latest_releases`
local latest_release = latest_releases[cdb_id]
if not latest_release and content.type == "game" then

View File

@@ -47,22 +47,19 @@
],
"#": "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",
"Lucas OH",
"Xeno333",
"Miguel P.L",
"siliconsniffer",
"Wuzzy",
"Zemtzov7",
"JosiahWI"
],
"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 +72,7 @@
"stujones11",
"Rogier <rogier777@gmail.com>",
"Gregory Currie (gregorycu)",
"paradust7",
"JacobF",
"Jeija <jeija@mesecons.net>"
]

View File

@@ -21,7 +21,7 @@ local function clients_list_formspec(dialogdata)
"size[6,9.5]",
TOUCH_GUI and "padding[0.01,0.01]" or "",
"hypertext[0,0;6,1.5;;<global margin=5 halign=center valign=middle>",
fgettext("This is the list of clients connected to\n$1",
fgettext("Players connected to\n$1",
"<b>" .. core.hypertext_escape(servername) .. "</b>") .. "]",
"textlist[0.5,1.5;5,6.8;;" .. fmt_formspec_list(clients_list) .. "]",
"button[1.5,8.5;3,0.8;quit;OK]"

View File

@@ -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.
-- Luanti
-- Copyright (C) 2013 sapier
-- SPDX-License-Identifier: LGPL-2.1-or-later
--------------------------------------------------------------------------------
@@ -299,7 +286,7 @@ local function handle_buttons(this, fields)
worldfile:set("load_mod_" .. mod.name, mod.virtual_path)
was_set[mod.name] = true
elseif not was_set[mod.name] then
worldfile:set("load_mod_" .. mod.name, "false")
worldfile:remove("load_mod_" .. mod.name)
end
elseif mod.enabled then
gamedata.errormessage = fgettext_ne("Failed to enable mo" ..

View File

@@ -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.
-- Luanti
-- Copyright (C) 2014 sapier
-- SPDX-License-Identifier: LGPL-2.1-or-later
local function table_to_flags(ftable)
-- Convert e.g. { jungles = true, caves = false } to "jungles,nocaves"

View File

@@ -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.
-- Luanti
-- Copyright (C) 2014 sapier
-- SPDX-License-Identifier: LGPL-2.1-or-later
--------------------------------------------------------------------------------

View File

@@ -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.
-- Luanti
-- Copyright (C) 2014 sapier
-- SPDX-License-Identifier: LGPL-2.1-or-later
local function delete_world_formspec(dialogdata)

View 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
local parent = this.parent
close_dialog(this)
local dlg = create_settings_dlg("controls_keyboard_and_mouse")
dlg:set_parent(parent)
parent: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(parent)
-- 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 parent
end
local dlg = create_rebind_keys_dlg()
dlg:set_parent(parent)
parent:hide()
dlg:show()
ui.update()
return dlg
end

View File

@@ -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.
-- Luanti
-- Copyright (C) 2022 rubenwardy
-- SPDX-License-Identifier: LGPL-2.1-or-later
--------------------------------------------------------------------------------

View File

@@ -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.
-- Luanti
-- Copyright (C) 2023 Gregor Parzefall
-- SPDX-License-Identifier: LGPL-2.1-or-later
---- IMPORTANT ----
-- This whole file can be removed after a while.
@@ -24,7 +11,7 @@
local SETTING_NAME = "no_mtg_notification"
function check_reinstall_mtg()
function check_reinstall_mtg(parent)
-- used to be in minetest.conf
if core.settings:get_bool(SETTING_NAME) then
cache_settings:set_bool(SETTING_NAME, true)
@@ -32,14 +19,14 @@ function check_reinstall_mtg()
end
if cache_settings:get_bool(SETTING_NAME) then
return
return parent
end
local games = core.get_games()
for _, game in ipairs(games) do
if game.id == "minetest" then
cache_settings:set_bool(SETTING_NAME, true)
return
return parent
end
end
@@ -53,24 +40,24 @@ function check_reinstall_mtg()
end
if not mtg_world_found then
cache_settings:set_bool(SETTING_NAME, true)
return
return parent
end
local maintab = ui.find_by_name("maintab")
local dlg = create_reinstall_mtg_dlg()
dlg:set_parent(maintab)
maintab:hide()
dlg:set_parent(parent)
parent:hide()
dlg:show()
ui.update()
return dlg
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({
@@ -87,22 +74,22 @@ end
local function buttonhandler(this, fields)
if fields.reinstall then
local parent = this.parent
-- Don't set "no_mtg_notification" here so that the dialog will be shown
-- again if downloading MTG fails for whatever reason.
this:delete()
local maintab = ui.find_by_name("maintab")
local dlg = create_contentdb_dlg(nil, "minetest/minetest")
dlg:set_parent(maintab)
maintab:hide()
dlg:set_parent(parent)
parent:hide()
dlg:show()
return true
end
if fields.dismiss then
cache_settings:set_bool("no_mtg_notification", true)
cache_settings:set_bool(SETTING_NAME, true)
this:delete()
return true
end

View File

@@ -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.
-- Luanti
-- Copyright (C) 2014 sapier
-- SPDX-License-Identifier: LGPL-2.1-or-later
--------------------------------------------------------------------------------

View File

@@ -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.
-- Luanti
-- Copyright (C) 2013 sapier
-- SPDX-License-Identifier: LGPL-2.1-or-later
mm_game_theme = {}

View File

@@ -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"
-- Luanti
-- Copyright (C) 2014 sapier
-- 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")
@@ -131,7 +112,12 @@ local function init_globals()
tv_main:show()
ui.update()
check_reinstall_mtg()
-- synchronous, chain parents to only show one at a time
local parent = tv_main
parent = migrate_keybindings(parent)
check_reinstall_mtg(parent)
-- asynchronous, will only be shown if we're still on "maintab"
check_new_version()
end

View File

@@ -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.
-- Luanti
-- Copyright (C) 2020 rubenwardy
-- SPDX-License-Identifier: LGPL-2.1-or-later
serverlistmgr = {
-- continent code we detected for ourselves

View File

@@ -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.
-- Luanti
-- Copyright (C) 2013 sapier
-- SPDX-License-Identifier: LGPL-2.1-or-later
local function prepare_credits(dest, source)

View File

@@ -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.
-- Luanti
-- Copyright (C) 2014 sapier
-- Copyright (C) 2018 rubenwardy <rw@rubenwardy.com>
-- SPDX-License-Identifier: LGPL-2.1-or-later
local function get_content_icons(packages_with_updates)

View File

@@ -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.
-- Luanti
-- Copyright (C) 2014 sapier
-- SPDX-License-Identifier: LGPL-2.1-or-later
local current_game, singleplayer_refresh_gamebar

View File

@@ -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.
-- Luanti
-- Copyright (C) 2014 sapier
-- SPDX-License-Identifier: LGPL-2.1-or-later
local function get_sorted_servers()
local servers = {
@@ -190,10 +177,10 @@ local function get_formspec(tabview, name, tabdata)
local max_clients = 5
if #clients_list > max_clients then
retval = retval .. "tooltip[btn_view_clients;" ..
fgettext("Clients:\n$1", table.concat(clients_list, "\n", 1, max_clients)) .. "\n..." .. "]"
fgettext("Players:\n$1", table.concat(clients_list, "\n", 1, max_clients)) .. "\n..." .. "]"
else
retval = retval .. "tooltip[btn_view_clients;" ..
fgettext("Clients:\n$1", table.concat(clients_list, "\n")) .. "]"
fgettext("Players:\n$1", table.concat(clients_list, "\n")) .. "]"
end
retval = retval .. "style[btn_view_clients;padding=6]"
retval = retval .. "image_button[4.5,1.3;0.5,0.5;" .. core.formspec_escape(defaulttexturedir ..
@@ -391,12 +378,15 @@ local function matches_query(server, query)
return name_matches and 50 or description_matches and 0
end
local function search_server_list(input)
local function search_server_list(input, tabdata)
menudata.search_result = nil
if #serverlistmgr.servers < 2 then
return
end
tabdata.pre_search_selection = tabdata.pre_search_selection or find_selected_server()
-- setup the search query
local query = parse_search_input(input)
if not query then
@@ -419,11 +409,23 @@ local function search_server_list(input)
return
end
local current_server = find_selected_server()
table.sort(search_result, function(a, b)
return a.points > b.points
end)
menudata.search_result = search_result
-- Keep current selection if it's in search results
if current_server then
for _, server in ipairs(search_result) do
if server.address == current_server.address and
server.port == current_server.port then
return
end
end
end
-- Find first compatible server (favorite or public)
for _, server in ipairs(search_result) do
if is_server_protocol_compat(server.proto_min, server.proto_max) then
@@ -434,6 +436,7 @@ local function search_server_list(input)
-- If no compatible server found, clear selection
set_selected_server(nil)
end
local function main_button_handler(tabview, fields, name, tabdata)
if fields.te_name then
gamedata.playername = fields.te_name
@@ -471,6 +474,7 @@ local function main_button_handler(tabview, fields, name, tabdata)
end
if event.type == "CHG" then
set_selected_server(server)
tabdata.pre_search_selection = nil
return true
end
end
@@ -484,11 +488,9 @@ local function main_button_handler(tabview, fields, name, tabdata)
if fields.btn_delete_favorite then
local idx = core.get_table_index("servers")
if not idx then return end
local server = tabdata.lookup[idx]
if not server then return end
serverlistmgr.delete_favorite(server)
set_selected_server(server)
serverlistmgr.delete_favorite(tabdata.lookup[idx])
set_selected_server(tabdata.lookup[idx+1])
return true
end
@@ -516,13 +518,16 @@ local function main_button_handler(tabview, fields, name, tabdata)
if fields.btn_mp_clear then
tabdata.search_for = ""
menudata.search_result = nil
set_selected_server(nil)
if tabdata.pre_search_selection then
set_selected_server(tabdata.pre_search_selection)
tabdata.pre_search_selection = nil
end
return true
end
if fields.btn_mp_search or fields.key_enter_field == "te_search" then
tabdata.search_for = fields.te_search
search_server_list(fields.te_search)
search_server_list(fields.te_search, tabdata)
return true
end

View File

@@ -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")

View File

@@ -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.
-- Luanti
-- Copyright (C) 2016 T4im
-- SPDX-License-Identifier: LGPL-2.1-or-later
local S = core.get_translator("__builtin")

View File

@@ -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.
-- Luanti
-- Copyright (C) 2016 T4im
-- 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

View File

@@ -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.
-- Luanti
-- Copyright (C) 2016 T4im
-- SPDX-License-Identifier: LGPL-2.1-or-later
local S = core.get_translator("__builtin")
-- Note: In this file, only messages are translated

View File

@@ -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.
-- Luanti
-- Copyright (C) 2016 T4im
-- 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

View File

@@ -2,9 +2,27 @@
#
# General format:
# name (Readable name) type type_args
# name (Readable name) [context] type type_args
#
# Note that the parts are separated by exactly one space
#
# `context` (optional) is used to document where the setting is read. It can be:
# - common: Read by both client and server.
# - client: Read by the client.
# (Includes settings read by the mainmenu.)
# - server: Read by the server.
# - world_creation: Read at world creation, thus only applied to new worlds.
# (Worlds are commonly created in the mainmenu (part of the client), but
# world creation is conceptually a server-side thing...)
# If not specified, the value is inherited from the context value of the containing
# category instead.
# For the builtin/settingtypes.txt file, every setting needs to have a context defined,
# either via a category containing it or via the setting itself. In game/mod-provided
# settingtypes.txt files, context annotations are invalid.
# Note: For context annotations, it's irrelevant whether changes to a setting
# after startup/game-join will be read. A separate mechanism for declaring that
# is needed.
#
# `type` can be:
# - int
# - string
@@ -13,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
@@ -73,10 +91,14 @@
# * 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]
# Sub-sub-sections have two * etc.
# A context (see above) can be specified optionally: [Section Name] [context]
# Context annotations on categories cannot be nested.
# There shouldn't be too many settings per category.
#
# The top-level categories "Advanced", "Client and Server" and "Mapgen" are
@@ -84,7 +106,7 @@
# They contain settings not intended for the "average user".
[Controls]
[Controls] [client]
[*General]
@@ -111,6 +133,13 @@ doubletap_jump (Double tap jump for fly) bool false
# enabled.
always_fly_fast (Always fly fast) bool true
# If enabled, the "Sneak" key will toggle when pressed.
# This functionality is ignored when fly is enabled.
toggle_sneak_key (Toggle Sneak key) bool false
# If enabled, the "Aux1" key will toggle when pressed.
toggle_aux1_key (Toggle Aux1 key) bool false
# The time in seconds it takes between repeated node placements when holding
# the place button.
#
@@ -151,6 +180,167 @@ 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]
keymap_forward (Move forward) key SYSTEM_SCANCODE_26
# Will also disable autoforward, when active.
keymap_backward (Move backward) key SYSTEM_SCANCODE_22
keymap_left (Move left) key SYSTEM_SCANCODE_4
keymap_right (Move right) key SYSTEM_SCANCODE_7
keymap_jump (Jump) key SYSTEM_SCANCODE_44
# 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
keymap_inventory (Open inventory) key SYSTEM_SCANCODE_12
# Key for moving fast in fast mode.
keymap_aux1 (Aux1) key SYSTEM_SCANCODE_8
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
keymap_rangeselect (Toggle unlimited view range) key
keymap_freemove (Toggle fly) key SYSTEM_SCANCODE_14
keymap_pitchmove (Toggle pitchmove) key
keymap_fastmove (Toggle fast) key SYSTEM_SCANCODE_13
keymap_noclip (Toggle noclip) key SYSTEM_SCANCODE_11
keymap_hotbar_next (Hotbar: select next item) key SYSTEM_SCANCODE_17
keymap_hotbar_previous (Hotbar: select previous item) key SYSTEM_SCANCODE_5
keymap_mute (Mute) key SYSTEM_SCANCODE_16
keymap_increase_volume (Increase volume) key
keymap_decrease_volume (Decrease volume) key
keymap_autoforward (Toggle automatic forward) key
keymap_cinematic (Toggle cinematic mode) key
keymap_minimap (Toggle minimap) key SYSTEM_SCANCODE_25
keymap_screenshot (Screenshot) key SYSTEM_SCANCODE_69
keymap_fullscreen (Toggle fullscreen) key SYSTEM_SCANCODE_68
keymap_drop (Drop item) key SYSTEM_SCANCODE_20
keymap_zoom (Zoom) key SYSTEM_SCANCODE_29
keymap_toggle_hud (Toggle HUD) key SYSTEM_SCANCODE_58
keymap_toggle_chat (Toggle chat log) key SYSTEM_SCANCODE_59
keymap_console (Toggle large chat console) key SYSTEM_SCANCODE_67
keymap_toggle_fog (Toggle fog) key SYSTEM_SCANCODE_60
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
keymap_camera_mode (Toggle camera mode) key SYSTEM_SCANCODE_6
keymap_increase_viewing_range_min (Increase view range) key SYSTEM_SCANCODE_46
keymap_decrease_viewing_range_min (Decrease view range) key SYSTEM_SCANCODE_45
# Modifier key bind for closing your world.
# Requires ESC + the selected key to work.
keymap_close_world (Return to Main Menu) key
keymap_slot1 (Hotbar slot 1) key SYSTEM_SCANCODE_30
keymap_slot2 (Hotbar slot 2) key SYSTEM_SCANCODE_31
keymap_slot3 (Hotbar slot 3) key SYSTEM_SCANCODE_32
keymap_slot4 (Hotbar slot 4) key SYSTEM_SCANCODE_33
keymap_slot5 (Hotbar slot 5) key SYSTEM_SCANCODE_34
keymap_slot6 (Hotbar slot 6) key SYSTEM_SCANCODE_35
keymap_slot7 (Hotbar slot 7) key SYSTEM_SCANCODE_36
keymap_slot8 (Hotbar slot 8) key SYSTEM_SCANCODE_37
keymap_slot9 (Hotbar slot 9) key SYSTEM_SCANCODE_38
keymap_slot10 (Hotbar slot 10) key SYSTEM_SCANCODE_39
keymap_slot11 (Hotbar slot 11) key
keymap_slot12 (Hotbar slot 12) key
keymap_slot13 (Hotbar slot 13) key
keymap_slot14 (Hotbar slot 14) key
keymap_slot15 (Hotbar slot 15) key
keymap_slot16 (Hotbar slot 16) key
keymap_slot17 (Hotbar slot 17) key
keymap_slot18 (Hotbar slot 18) key
keymap_slot19 (Hotbar slot 19) key
keymap_slot20 (Hotbar slot 20) key
keymap_slot21 (Hotbar slot 21) key
keymap_slot22 (Hotbar slot 22) key
keymap_slot23 (Hotbar slot 23) key
keymap_slot24 (Hotbar slot 24) key
keymap_slot25 (Hotbar slot 25) key
keymap_slot26 (Hotbar slot 26) key
keymap_slot27 (Hotbar slot 27) key
keymap_slot28 (Hotbar slot 28) key
keymap_slot29 (Hotbar slot 29) key
keymap_slot30 (Hotbar slot 30) key
keymap_slot31 (Hotbar slot 31) key
keymap_slot32 (Hotbar slot 32) key
[*Touchscreen]
# Enables the touchscreen controls, allowing you to play the game with a touchscreen.
@@ -160,6 +350,36 @@ invert_hotbar_mouse_wheel (Hotbar: Invert mouse wheel direction) bool false
# Requires: touch_support
touch_controls (Touchscreen controls) enum auto auto,true,false
# The kind of digging/placing controls used.
#
# * Tap
# Long/short tap anywhere on the screen to interact.
# Interaction happens at finger position.
#
# * Tap with crosshair
# Long/short tap anywhere on the screen to interact.
# Interaction happens at crosshair position.
#
# * Buttons with crosshair
# Use dedicated dig/place buttons to interact.
# Interaction happens at crosshair position.
#
# Requires: touchscreen
touch_interaction_style (Interaction style) enum tap tap,tap_crosshair,buttons_crosshair
# The gesture for punching players/entities.
# This can be overridden by games and mods.
#
# * Short tap
# Easy to use and well-known from other games that shall not be named.
#
# * Long tap
# Known from the classic Luanti mobile controls.
# Combat is more or less impossible.
#
# Requires: touchscreen, touch_interaction_style_tap
touch_punch_gesture (Punch gesture) enum short_tap short_tap,long_tap
# Touchscreen sensitivity multiplier.
#
# Requires: touchscreen
@@ -175,12 +395,6 @@ touchscreen_threshold (Movement threshold) int 20 0 100
# Requires: touchscreen
touch_long_tap_delay (Threshold for long taps) int 400 100 1000
# Use crosshair to select object instead of whole screen.
# If enabled, a crosshair will be shown and will be used for selecting object.
#
# Requires: touchscreen
touch_use_crosshair (Use crosshair for touch screen) bool false
# Fixes the position of virtual joystick.
# If disabled, virtual joystick will center to first-touch's position.
#
@@ -193,21 +407,7 @@ fixed_virtual_joystick (Fixed virtual joystick) bool false
# Requires: touchscreen
virtual_joystick_triggers_aux1 (Virtual joystick triggers Aux1 button) bool false
# The gesture for punching players/entities.
# This can be overridden by games and mods.
#
# * short_tap
# Easy to use and well-known from other games that shall not be named.
#
# * long_tap
# Known from the classic Luanti mobile controls.
# Combat is more or less impossible.
#
# Requires: touchscreen
touch_punch_gesture (Punch gesture) enum short_tap short_tap,long_tap
[Graphics and Audio]
[Graphics and Audio] [client]
[*Graphics]
@@ -256,8 +456,8 @@ fps_max (Maximum FPS) int 60 1 4294967295
# Vertical screen synchronization. Your system may still force VSync on even if this is disabled.
vsync (VSync) bool false
# Maximum FPS when the window is not focused, or when the game is paused.
fps_max_unfocused (FPS when unfocused or paused) int 20 1 4294967295
# Maximum FPS when the window is not focused.
fps_max_unfocused (FPS when unfocused) int 10 1 4294967295
# View distance in nodes.
viewing_range (Viewing range) int 190 20 4000
@@ -295,10 +495,6 @@ arm_inertia (Arm inertia) bool true
# For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double.
view_bobbing_amount (View bobbing factor) float 1.0 0.0 7.9
# Multiplier for fall bobbing.
# For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double.
fall_bobbing_amount (Fall bobbing factor) float 0.03 0.0 100.0
[**Camera]
# Field of view in degrees.
@@ -615,11 +811,6 @@ enable_volumetric_lighting (Volumetric lighting) bool false
# Requires: enable_dynamic_shadows
enable_translucent_foliage (Translucent foliage) bool false
# Apply specular shading to nodes.
#
# Requires: enable_dynamic_shadows
enable_node_specular (Node specular) bool false
# When enabled, liquid reflections are simulated.
#
# Requires: enable_waving_water, enable_dynamic_shadows
@@ -717,9 +908,6 @@ console_color (Console color) string (0,0,0)
# In-game chat console background alpha (opaqueness, between 0 and 255).
console_alpha (Console alpha) int 200 0 255
# Clickable weblinks (middle-click or Ctrl+left-click) enabled in chat console output.
clickable_chat_weblinks (Chat weblinks) bool true
# Optional override for chat weblink color.
chat_weblink_color (Weblink color) string #8888FF
@@ -752,13 +940,13 @@ contentdb_max_concurrent_downloads (ContentDB Max Concurrent Downloads) int 3 1
[Client and Server]
[*Client]
[*Client] [client]
# Save the map received by the client on disk.
enable_local_map_saving (Saving map received from server) bool false
# URL to the server list displayed in the Multiplayer Tab.
serverlist_url (Serverlist URL) string https://servers.luanti.org
serverlist_url (Serverlist URL) [common] string https://servers.luanti.org
# If enabled, server account registration is separate from login in the UI.
# If disabled, connecting to a server will automatically register a new account.
@@ -768,7 +956,7 @@ enable_split_login_register (Enable split login/register) bool true
# If this is empty the engine will never check for updates.
update_information_url (Update information URL) string https://www.luanti.org/release_info.json
[*Server]
[*Server] [server]
# Name of the player.
# When running a server, a client connecting with this name is admin.
@@ -796,7 +984,7 @@ server_announce (Announce server) bool false
server_announce_send_players (Send player names to the server list) bool true
# Announce to this serverlist.
serverlist_url (Serverlist URL) string https://servers.luanti.org
serverlist_url (Serverlist URL) [common] string https://servers.luanti.org
# Message of the day displayed to players connecting.
motd (Message of the day) string
@@ -835,13 +1023,14 @@ protocol_version_min (Protocol version minimum) int 1 1 65535
# Files that are not present will be fetched the usual way.
remote_media (Remote media) string
# Enable/disable running an IPv6 server.
# Enable IPv6 support for server.
# Note that clients will be able to connect with both IPv4 and IPv6.
# Ignored if bind_address is set.
#
# Requires: enable_ipv6
ipv6_server (IPv6 server) bool false
ipv6_server (IPv6 server) bool true
[*Server Security]
[*Server Security] [server]
# New users need to input this password.
default_password (Default password) string
@@ -901,7 +1090,7 @@ chat_message_limit_per_10sec (Chat message count limit) float 8.0 1.0
# Kick players who sent more than X messages per 10 seconds.
chat_message_limit_trigger_kick (Chat message kick threshold) int 50 1 65535
[*Server Gameplay]
[*Server Gameplay] [server]
# Controls length of day/night cycle.
# Examples:
@@ -909,7 +1098,7 @@ chat_message_limit_trigger_kick (Chat message kick threshold) int 50 1 65535
time_speed (Time speed) int 72 0
# Time of day when a new world is started, in millihours (0-23999).
world_start_time (World start time) int 6125 0 23999
world_start_time (World start time) [world_creation] int 6125 0 23999
# Time in seconds for item entity (dropped items) to live.
# Setting it to -1 disables the feature.
@@ -964,7 +1153,7 @@ movement_liquid_sink (Liquid sinking) float 10.0
movement_gravity (Gravity) float 9.81
[Mapgen]
[Mapgen] [world_creation]
# A chosen map seed for a new map, leave empty for random.
# Will be overridden when creating a new world in the main menu.
@@ -980,7 +1169,7 @@ mg_name (Mapgen name) enum v7 v7,valleys,carpathian,v5,flat,fractal,singlenode,v
water_level (Water level) int 1 -31000 31000
# From how far blocks are generated for clients, stated in mapblocks (16 nodes).
max_block_generate_distance (Max block generate distance) int 10 1 32767
max_block_generate_distance (Max block generate distance) [server] int 10 1 32767
# Limit of map generation, in nodes, in all 6 directions from (0, 0, 0).
# Only mapchunks completely within the mapgen limit are generated.
@@ -1693,12 +1882,12 @@ mgvalleys_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500),
# Enable Lua modding support on client.
# This support is experimental and API can change.
enable_client_modding (Client modding) bool false
enable_client_modding (Client modding) [client] bool false
# Replaces the default main menu with a custom one.
main_menu_script (Main menu script) string
main_menu_script (Main menu script) [client] string
[**Mod Security]
[**Mod Security] [server]
# Prevent mods from doing insecure things like running shell commands.
secure.enable_security (Enable mod security) bool true
@@ -1722,33 +1911,33 @@ secure.http_mods (HTTP mods) string
# - info
# - verbose
# - trace
debug_log_level (Debug log level) enum action ,none,error,warning,action,info,verbose,trace
debug_log_level (Debug log level) [common] enum action ,none,error,warning,action,info,verbose,trace
# If the file size of debug.txt exceeds the number of megabytes specified in
# this setting when it is opened, the file is moved to debug.txt.1,
# deleting an older debug.txt.1 if it exists.
# debug.txt is only moved if this setting is positive.
debug_log_size_max (Debug log file size threshold) int 50 1
debug_log_size_max (Debug log file size threshold) [common] int 50 1
# Minimal level of logging to be written to chat.
chat_log_level (Chat log level) enum error ,none,error,warning,action,info,verbose,trace
chat_log_level (Chat log level) [client] enum error ,none,error,warning,action,info,verbose,trace
# Handling for deprecated Lua API calls:
# - none: Do not log deprecated calls
# - log: mimic and log backtrace of deprecated call (default).
# - error: abort on usage of deprecated call (suggested for mod developers).
deprecated_lua_api_handling (Deprecated Lua API handling) enum log none,log,error
deprecated_lua_api_handling (Deprecated Lua API handling) [common] enum log none,log,error
# Enable random user input (only used for testing).
random_input (Random input) bool false
random_input (Random input) [client] bool false
# Enable random mod loading (mainly used for testing).
random_mod_load_order (Random mod load order) bool false
random_mod_load_order (Random mod load order) [server] bool false
# Enable mod channels support.
enable_mod_channels (Mod channels) bool false
enable_mod_channels (Mod channels) [server] bool false
[**Mod Profiler]
[**Mod Profiler] [server]
# Load the game profiler to collect game profiling data.
# Provides a /profiler command to access the compiled profile.
@@ -1788,24 +1977,15 @@ instrument.builtin (Builtin) bool false
# * Instrument the sampler being used to update the statistics.
instrument.profiler (Profiler) bool false
[**Engine Profiler]
[**Engine Profiler] [common]
# Print the engine's profiling data in regular intervals (in seconds).
# 0 = disable. Useful for developers.
profiler_print_interval (Engine profiling data print interval) int 0 0
[*Advanced]
# Enable IPv6 support (for both client and server).
# Required for IPv6 connections to work at all.
enable_ipv6 (IPv6) bool true
# If enabled, invalid world data won't cause the server to shut down.
# Only enable this if you know what you are doing.
ignore_world_load_errors (Ignore world errors) bool false
[**Graphics]
[**Graphics] [client]
# Enables debug and error-checking in the OpenGL driver.
opengl_debug (OpenGL debug) bool false
@@ -1833,11 +2013,11 @@ transparency_sorting_group_by_buffers (Transparency Sorting Group by Buffers) bo
cloud_radius (Cloud radius) int 12 8 62
# Delay between mesh updates on the client in ms. Increasing this will slow
# down the rate of mesh updates, thus reducing jitter on slower clients.
mesh_generation_interval (Mapblock mesh generation delay) int 0 0 50
# down the rate of mesh updates, which can help reduce jitter.
mesh_generation_interval (Mapblock mesh generation delay) int 0 0 25
# Number of threads to use for mesh generation.
# Value of 0 (default) will let Luanti autodetect the number of available threads.
# Value of 0 (default) will let Luanti automatically choose the number of threads.
mesh_generation_threads (Mapblock mesh generation threads) int 0 0 8
# All mesh buffers with less than this number of vertices will be merged
@@ -1860,7 +2040,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
@@ -1872,7 +2052,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.
@@ -1909,12 +2089,12 @@ shadow_update_frames (Map shadows update frames) int 16 1 32
# Requires: enable_post_processing, enable_bloom
enable_bloom_debug (Enable Bloom Debug) bool false
[**Sound]
[**Sound] [client]
# Comma-separated list of AL and ALC extensions that should not be used.
# Useful for testing. See al_extensions.[h,cpp] for details.
sound_extensions_blacklist (Sound Extensions Blacklist) string
[**Font]
[**Font] [client]
font_bold (Font bold by default) bool false
@@ -1964,7 +2144,7 @@ mono_font_path_bold_italic (Bold and italic monospace font path) filepath fonts/
# This font will be used for certain languages or if the default font is unavailable.
fallback_font_path (Fallback font path) filepath fonts/DroidSansFallbackFull.ttf
[**Lighting]
[**Lighting] [client]
# Gradient of light curve at minimum light level.
# Controls the contrast of the lowest light levels.
@@ -1990,43 +2170,50 @@ lighting_boost_spread (Light curve boost spread) float 0.2 0.0 0.4
[**Networking]
# 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
prometheus_listener_address (Prometheus listener address) string 127.0.0.1:30000
# Enable IPv6 support (for both client and server).
# Required for IPv6 connections to work at all.
enable_ipv6 (IPv6) [common] bool true
# Maximum size of the outgoing chat queue.
# Prometheus listener address.
# 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.
# 0 to disable queueing and -1 to make the queue size unlimited.
max_out_chat_queue_size (Maximum size of the outgoing chat queue) int 20 -1 32767
max_out_chat_queue_size (Maximum size of the client's outgoing chat queue) [client] int 20 -1 32767
# Timeout for client to remove unused map data from memory, in seconds.
client_unload_unused_data_timeout (Mapblock unload timeout) float 600.0 0.0
client_unload_unused_data_timeout (Mapblock unload timeout) [client] float 600.0 0.0
# Maximum number of mapblocks for client to be kept in memory.
# Set to -1 for unlimited amount.
client_mapblock_limit (Mapblock limit) int 7500 -1 2147483647
# Note that there is an internal dynamic minimum number of blocks that
# won't be deleted, depending on the current view range.
# Set to -1 for no limit.
client_mapblock_limit (Mapblock limit) [client] int 7500 -1 2147483647
# Maximum number of blocks that are simultaneously sent per client.
# The maximum total count is calculated dynamically:
# max_total = ceil((#clients + max_users) * per_client / 4)
max_simultaneous_block_sends_per_client (Maximum simultaneous block sends per client) int 40 1 4294967295
max_simultaneous_block_sends_per_client (Maximum simultaneous block sends per client) [server] int 40 1 4294967295
# To reduce lag, block transfers are slowed down when a player is building something.
# This determines how long they are slowed down after placing or removing a node.
full_block_send_enable_min_time_from_building (Delay in sending blocks after building) float 2.0 0.0
full_block_send_enable_min_time_from_building (Delay in sending blocks after building) [server] float 2.0 0.0
# Maximum number of packets sent per send step in the low-level networking code.
# You generally don't need to change this, however busy servers may benefit from a higher number.
max_packets_per_iteration (Max. packets per iteration) int 1024 1 65535
max_packets_per_iteration (Max. packets per iteration) [common] int 1024 1 65535
# Compression level to use when sending mapblocks to the client.
# -1 - use default compression level
# 0 - least compression, fastest
# 9 - best compression, slowest
map_compression_level_net (Map Compression Level for Network Transfer) int -1 -1 9
map_compression_level_net (Map Compression Level for Network Transfer) [server] int -1 -1 9
[**Server]
[**Server] [server]
# Format of player chat messages. The following strings are valid placeholders:
# @name, @message, @timestamp (optional)
@@ -2046,7 +2233,7 @@ kick_msg_crash (Crash message) string This server has experienced an internal er
# Set this to true if your server is set up to restart automatically.
ask_reconnect_on_crash (Ask to reconnect after crash) bool false
[**Server/Env Performance]
[**Server/Env Performance] [server]
# Length of a server tick (the interval at which everything is generally updated),
# stated in seconds.
@@ -2097,14 +2284,14 @@ max_objects_per_block (Maximum objects per block) int 256 256 65535
active_block_mgmt_interval (Active block management interval) float 2.0 0.0
# Length of time between Active Block Modifier (ABM) execution cycles, stated in seconds.
abm_interval (ABM interval) float 1.0 0.0
abm_interval (ABM interval) float 1.0 0.1 30.0
# The time budget allowed for ABMs to execute on each step
# (as a fraction of the ABM Interval)
abm_time_budget (ABM time budget) float 0.2 0.1 0.9
# Length of time between NodeTimer execution cycles, stated in seconds.
nodetimer_interval (NodeTimer interval) float 0.2 0.0
nodetimer_interval (NodeTimer interval) float 0.2 0.1 1.0
# Max liquids processed per step.
liquid_loop_max (Liquid loop max) int 100000 1 4294967295
@@ -2139,7 +2326,7 @@ server_side_occlusion_culling (Server-side occlusion culling) bool true
# Stated in MapBlocks (16 nodes).
block_cull_optimize_distance (Block cull optimize distance) int 25 2 2047
[**Mapgen]
[**Mapgen] [server]
# Size of mapchunks generated by mapgen, stated in mapblocks (16 nodes).
# WARNING: There is no benefit, and there are several dangers, in
@@ -2147,7 +2334,7 @@ block_cull_optimize_distance (Block cull optimize distance) int 25 2 2047
# Reducing this value increases cave and dungeon density.
# Altering this value is for special usage, leaving it unchanged is
# recommended.
chunksize (Chunk size) int 5 1 10
chunksize (Chunk size) [world_creation] int 5 1 10
# Dump the mapgen debug information.
enable_mapgen_debug_info (Mapgen debug) bool false
@@ -2175,7 +2362,7 @@ emergequeue_limit_generate (Per-player limit of queued blocks to generate) int 1
# 'on_generated'. For many users the optimum setting may be '1'.
num_emerge_threads (Number of emerge threads) int 1 0 32767
[**cURL]
[**cURL] [common]
# Maximum time an interactive request (e.g. server list fetch) may take, stated in milliseconds.
curl_timeout (cURL interactive timeout) int 20000 1000 2147483647
@@ -2190,44 +2377,68 @@ 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.
clickable_chat_weblinks (Chat weblinks) [client] bool true
# If enabled, invalid world data won't cause the server to shut down.
# Only enable this if you know what you are doing.
ignore_world_load_errors (Ignore world errors) [server] bool false
# Adjust the detected display density, used for scaling UI elements.
display_density_factor (Display Density Scaling Factor) float 1 0.5 5.0
display_density_factor (Display Density Scaling Factor) [client] float 1 0.5 5.0
# Windows systems only: Start Luanti with the command line window in the background.
# Contains the same information as the file debug.txt (default name).
enable_console (Enable console window) bool false
enable_console (Enable console window) [common] bool false
# Number of extra blocks that can be loaded by /clearobjects at once.
# This is a trade-off between SQLite transaction overhead and
# memory consumption (4096=100MB, as a rule of thumb).
max_clearobjects_extra_loaded_blocks (Max. clearobjects extra blocks) int 4096 0 4294967295
max_clearobjects_extra_loaded_blocks (Max. clearobjects extra blocks) [server] int 4096 0 4294967295
# World directory (everything in the world is stored here).
# Not needed if starting from the main menu.
map-dir (Map directory) path
map-dir (Map directory) [server] path
# See https://www.sqlite.org/pragma.html#pragma_synchronous
sqlite_synchronous (Synchronous SQLite) enum 2 0,1,2
sqlite_synchronous (Synchronous SQLite) [server] enum 2 0,1,2
# Compression level to use when saving mapblocks to disk.
# -1 - use default compression level
# 0 - least compression, fastest
# 9 - best compression, slowest
map_compression_level_disk (Map Compression Level for Disk Storage) int -1 -1 9
map_compression_level_disk (Map Compression Level for Disk Storage) [server] int -1 -1 9
# Enable usage of remote media server (if provided by server).
# Remote servers offer a significantly faster way to download media (e.g. textures)
# when connecting to the server.
enable_remote_media_server (Connect to external media server) bool true
enable_remote_media_server (Connect to external media server) [client] bool true
# File in client/serverlist/ that contains your favorite servers displayed in the
# Multiplayer Tab.
serverlist_file (Serverlist file) string favoriteservers.json
serverlist_file (Serverlist file) [client] string favoriteservers.json
[*Gamepads]
[*Gamepads] [client]
# Enable joysticks. Requires a restart to take effect
enable_joysticks (Enable joysticks) bool false
@@ -2250,7 +2461,7 @@ joystick_deadzone (Joystick dead zone) int 2048 0 65535
joystick_frustum_sensitivity (Joystick frustum sensitivity) float 170.0 0.001
[*Hide: Temporary Settings]
[*Hide: Temporary Settings] [common]
# Path to texture directory. All textures are first searched from here.
texture_path (Texture path) path
@@ -2309,226 +2520,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 -

View File

@@ -44,8 +44,6 @@ centroid varying float nightRatio;
varying float perspective_factor;
#endif
varying float area_enable_parallax;
varying highp vec3 eyeVec;
// Color of the light emitted by the light sources.
const vec3 artificialLight = vec3(1.04, 1.04, 1.04);

60
doc/README.md Normal file
View File

@@ -0,0 +1,60 @@
# Documentation
This directory contains mostly reference documentation for the Luanti engine.
For a less prescriptive and more guiding documentation, also look at:
https://docs.luanti.org
Note that the inner workings of the engine are not well documented. It's most
often better to read the code.
Markdown files are written in a way that they can also be read in plain text.
When modifying, please keep it that way!
Here is a list with descriptions of relevant files:
## Server Modding
- [lua_api.md](lua_api.md): Server Modding API reference. (Not only the Lua part,
but also file structure and everything else.)
If you want to make a mod or game, look here!
A rendered version is also available at <https://api.luanti.org/>.
- [builtin_entities.md](builtin_entities.md): Doc for entities predefined by the
engine (in builtin), i.e. dropped items and falling nodes.
## Client-Side Content
- [texture_packs.md](texture_packs.md): Layout and description of Luanti's
texture packs structure and configuration.
- [client_lua_api.md](client_lua_api.md): Client-Provided Client-Side Modding
(CPCSM) API reference.
## Mainmenu scripting
- [menu_lua_api.md](menu_lua_api.md): API reference for the mainmenu scripting
environment.
- [fst_api.txt](fst_api.txt): Formspec Toolkit API, included in builtin for the
main menu.
## Formats and Protocols
- [world_format.md](world_format.md): Structure of Luanti world directories and
format of the files therein.
Note: If you want to write your own deserializer, it will be easier to read
the `serialize()` and `deSerialize()` functions of the various structures in
C++, e.g. `MapBlock::deSerialize()`.
- [protocol.txt](protocol.txt): *Rough* outline of Luanti's network protocol.
## Misc.
- [compiling/](compiling/): Compilation instructions, and options.
- [ides/](ides/): Instructions for configuring certain IDEs for engine development.
- [developing/](developing/): Information about Luanti development.
Note: [developing/profiling.md](developing/profiling.md) can be useful for
modders and server owners!
- [android.md](android.md): Android quirks.
- [direction.md](direction.md): Information related to the future direction of
Luanti. Commonly referred to as the roadmap document.
- [breakages.md](breakages.md): List of planned breakages for the next major
release, i.e. 6.0.0.
- [docker_server.md](docker_server.md): Information about our Docker server
images in the ghcr.

View File

@@ -42,7 +42,7 @@ configuration file can usually be found at:
* After 5.4.2:
* `/sdcard/Android/data/net.minetest.minetest/` or `/storage/emulated/0/Android/data/net.minetest.minetest/` if stored on the device
* `/storage/emulated/(varying folder name)/Android/data/net.minetest.minetest/` if stored on the SD card
* [Learn more about Android directory](https://wiki.luanti.org/Accessing_Android_Data_Directory)
* [Learn more about Android directory](https://docs.luanti.org/for-players/mobile/)
## Useful settings

View File

@@ -23,3 +23,6 @@ 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`.
* introduce strict type checking for all instances of `v3s16` / `v3f` read from Lua

Some files were not shown because too many files have changed in this diff Show More