Commit Graph

821 Commits

Author SHA1 Message Date
Loïc Blot 342452f247
Expose vector helpers to CSM 2022-05-21 16:14:36 +02:00
paramat b199634744
Mapgen documentation: Add descriptions to noise parameters
Shorten 'readable names'.
Add a new advanced settings menu section for Biome API noises.
Various minor edits and improvements.
2022-05-21 16:14:35 +02:00
paramat e2a176b887
Cavegen/Mgv5/Mgv7: Add optional giant caverns
Add to MapgenBasic for use by multiple mapgens.
Add to mgv5 and mgv7, enabled by default.

Similar to mgvalleys caverns but half the scale.
Parameters for upper y limit, distance caverns taper to full size, and
noise threshold (full cavern size).
As with mgvalleys caverns are generated first and classic caves are
disabled in any mapchunk containing a cavern, to avoid excessive
spreading volumes of liquids.
This also avoids floating blobs of liquid where a large classic cave
has overgenerated out into a neighbouring previously-generated mapchunk.
2022-05-21 16:14:35 +02:00
Auke Kok 9d9c4cc91f
minetest.after(): simplify further, pause in singleplayer (#5500)
Using the `dtime` value entirely, this will stop the clock
if the game is paused in singleplayer. Since most of the
clocks were fixed a long time ago, this should again be
safe to use.
2022-05-21 16:14:34 +02:00
MarkuBu 61efcfec7d
First commit for fine pointed (#5485) 2022-05-21 16:14:34 +02:00
Diego Martínez 67ca4f86c5
Add functions to strip color information. (#5472) 2022-05-21 16:14:34 +02:00
Loïc Blot 1bbcceb65c
Fix a type bug in colorize function
This bug was introduced by dd2f1d7551bfd70357ad4f3fb180704194272147 and reported by @kilbith
2022-05-21 16:14:33 +02:00
paramat da687589b3
Map generation limit: Make per-world
The setting limits map generation but affects nothing else.
Add 'mapgen_limit' to global mapgen parameters.
Move 'blockpos_over_mapgen_limit()' to the only place it is called
from: map.cpp.
Allow teleportation to any part of the world even if over the set
mapgen limit.
Simplify the reading of this limit in mgvalleys.
Remove the 'map_generation_limit' setting.
2022-05-21 16:14:33 +02:00
red-001 5943ad8975
Change command prefix to "." and add "help" command. 2022-05-21 16:14:32 +02:00
numzero 35edba888b
Add mesh generation delay 2022-05-21 16:14:32 +02:00
Loïc Blot f436404054
Typo fix 2022-05-21 16:14:32 +02:00
red-001 acb03dc956
Add multiline support to colorize. (#5444) 2022-05-21 16:14:31 +02:00
red-001 52662dfcce
Block access to the `io` library 2022-05-21 16:14:31 +02:00
red-001 d210b6d2cf
Give CSM access to use `core.colorize()` (#5113) 2022-05-21 16:14:30 +02:00
Auke Kok 0d606691dd
Fix two nul deref if digging unknown nodes. (#5398)
Introduced by d785456b3fa35faf47cb972fde9e8668382c5e22 (#5162)
2022-05-21 16:14:30 +02:00
Loïc Blot 7af68932f2
Add enable_client_modding param (default: false) 2022-05-21 16:14:29 +02:00
red-001 c38197ed66
Add `on_punchnode` callback 2022-05-21 16:14:29 +02:00
red-001 e02c119936
Add `on_dignode` callback (#5140) 2022-05-21 16:14:29 +02:00
red-001 fb042da4a5
Improve security for client-sided mods (#5100) 2022-05-21 16:14:28 +02:00
Loïc Blot 3d38c234e5
implement client side mod loading (#5123)
* client side mods are located in clientmods/
* move builtin/preview.lua to clientmods/preview/init.lua as a preview mod
* refactor ModConfiguration class to work properly with client and server using child objects
* move some Server constructor mod load code to ModConfiguration to reduce code duplication between client and server
* remove mods.{cpp,h} unused functions
* use UNORDERED_SET instead of std::set in some modspec storages
2022-05-21 16:14:28 +02:00
red-001 0412d35355
Add local formspecs. (#5094) 2022-05-21 16:14:27 +02:00
Loïc Blot b38c00d90f
sound_play & sound_stop support + client_lua_api doc (#5096)
* squashed: CSM: Implement register_globalstep
  * Re-use fatal error mechanism from server to disconnect client on CSM error
  * Little client functions cleanups

* squashed: CSM: add core.after function
  * core.after is shared code between client & server
  * ModApiUtil get_us_time feature enabled for client
2022-05-21 16:14:27 +02:00
red-001 33b76809dd
Add client-sided chat commands (#5092) 2022-05-21 16:14:27 +02:00
Loïc Blot 6a9953bd0f
Add on_death, on_hp_modification & oh_damage_taken callbacks (#5093)
* Add on_death callback
* Add on_hp_modification & on_damage_taken callbacks
* move preview code to preview.lua
2022-05-21 16:14:26 +02:00
Loïc Blot 80f3d77767
Client side modding
* rename GameScripting to ServerScripting
* Make getBuiltinLuaPath static serverside
* Add on_shutdown callback
* Add on_receiving_chat_message & on_sending_chat_message callbacks
* ScriptApiBase: use IGameDef instead of Server
  This permits to share common attribute between client & server
* Enable mod security in client side modding without conditions
2022-05-21 16:14:26 +02:00
Vladislav Tsendrovskii 49602a4a4f
Save metainfo for falling nodes 2022-05-21 16:14:25 +02:00
lhofhansl a25f0a2210
Enable server side occlusion culling by default. 2022-05-21 16:14:25 +02:00
lhofhansl cc4fdda474
Allow server side occlusion culling. 2022-05-21 16:14:24 +02:00
paramat 6838bbf6d0
Climb speed: Increase default setting from 2 to 3 2022-05-21 16:14:24 +02:00
tenplus1 22ca380b87
Optimize item.lua Replace slow ItemStack get_definitions with registered_nodes one's and cached playername as it's used multiple times. Also removed local item = itemstack:peek_item() as it is never used. 2022-05-21 16:14:24 +02:00
zaoqi ebe297520a
Add minetest.spawn_falling_node(pos) (#5339)
* Add minetest.spawn_falling_node(pos)

* lua_api.txt: Add minetest.spawn_falling_node(pos)

* Update minetest.spawn_falling_node(pos)
2022-05-21 16:14:23 +02:00
red-001 ccce7bbd6d
Fix crash that can be caused by the shutdown command. (#5292) 2022-05-21 16:14:23 +02:00
Dániel Juhász 3a111fa7d6
Fixes for colorwallmounted and colorfacedir nodes
Correct node placement prediction for attached colorwallmounted nodes.
Correct placement direction for colorfacedir and colorwallmounted nodes.
Correct detatch mechanism for attached colorwallmounted nodes.
2022-05-21 16:14:22 +02:00
Jean-Patrick Guerrero b62c15b4b1
Multiplayer menu: fix attempt to open nonexistant image
Since local servers and local favorites have no ping value (these
are only provided by the server) we shouldn't load a broken
image filename.

Fixes #5238
2022-05-21 16:14:22 +02:00
tenplus1 560f339872
Statbars.lua: Cache enable_damage setting 2022-05-21 16:14:21 +02:00
red-001 152924b6f2
Add support for the new arguments of `request_shutdown` to the `/shutdown` chatcommand. (#5252) 2022-05-21 16:14:21 +02:00
HybridDog 90478ea779
Mainmenu: Brighter text colours for readability 2022-05-21 16:14:21 +02:00
rubenwardy a41241456a
Use tree to list mods rather than textlist 2022-05-21 16:14:20 +02:00
Wuzzy 3c57053538
Add textures for air and ignore items (#5196) 2022-05-21 16:14:20 +02:00
Auke Kok a938cc30c7
Change default nodetimer_interval to 0.2s. (#5193)
We want to reduce the chance that we get lots and lots of node
timers all happening once a second, because we're better off doing
small bits of work as they are available.

Reducing this to 0.2 seconds will greatly reduce the total amount
of nodetimers that elapse at the same instance, while not effecting
total work load. This results in a far better chance of the server
keeping up with work loads.
2022-05-21 16:14:19 +02:00
Jean-Patrick Guerrero 464935baec
Serverlist: Add ping indicators (#5164) 2022-05-21 16:14:19 +02:00
Nathanaël Courant bfd687d6bf
Make facedir_to_dir and wallmounted_to_dir work with coloured nodes as well. (#5153) 2022-05-21 16:14:18 +02:00
Ezhh afaf7bcff7
Add console height setting (#5136) 2022-05-21 16:14:18 +02:00
paramat 9e91f4ff3c
Zoom FOV: Reduce minimum zoom FOV to 7 degrees
The default of 15 is unchanged.
7 degrees is x10 magnification which is common for binoculars.
Alter hardcoded limits in camera.cpp:
Minimum 7 degrees.
Maximum 160 degrees to match upper limits in advanced settings.
2022-05-21 16:14:18 +02:00
Auke Kok a648fbc2e7
core: Add dir_to_yaw and yaw_to_dir helpers
These are needed to go from things like entity yaw to a vector
and vice versa.
2022-05-21 16:14:17 +02:00
Auke Kok 944e5ca4e9
Vector: Add vector.sort(a, b): return box edges
This function returns the box corners of the smallest box
that includes the two given coordinates.
2022-05-21 16:14:17 +02:00
Loïc Blot e48d06f7c7
Add show_statusline_on_connect setting (#5084)
Add show_statusline_on_connect setting
2022-05-21 16:14:16 +02:00
Elijah Duffy d22ecfcbb3
Add chatcommand unregister and override API (#5076)
Introduces two functions to unregister and override chatcommands.
minetest.unregister_chatcommand("<name>") and
minetest.override_chatcommand("<name>", {<redifinition>})
2022-05-21 16:14:16 +02:00
rubenwardy 14a4e9994c
Add minetest.player_exists() (#5064) 2022-05-21 16:14:16 +02:00
rubenwardy 79c4ab386c
Add search to advanced settings (#4806)
* Add search to advanced settings

* Press enter again to go to next result

* Use keyword based search, auto select best option
2022-05-21 16:14:15 +02:00
Ezhh 3f0a7c339b
Improve priv descriptions (#5047) 2022-05-21 16:14:15 +02:00
red-001 3861ac47bb
Remove client-side chat prediction. (#5055)
Network lag isn't really a big issue with chat and chat prediction makes writing mods harder.
2022-05-21 16:14:14 +02:00
rubenwardy 33b02fcb36
Adjust formspec spacing on the Client tab of the mainmenu 2022-05-21 16:14:14 +02:00
red-001 1b7a21e322
Add keyword based search to serverlist 2022-05-21 16:14:13 +02:00
paramat 30398224b7
Documentation: Correct biome heat / humidity noise parameters
When the new set of biomes was added in MTGame the 'spread' for heat
and humidity noise parameters was increased to 1000, i forgot to update
settingtypes.txt and minetest.conf.
2022-05-21 16:14:13 +02:00
ShadowNinja fc2c76e0fc
Main menu tweaks 2022-05-21 16:14:13 +02:00
ShadowNinja 856a228407
Enable mod security by default 2022-05-21 16:14:12 +02:00
Rui 1d5a04c315
Add staticdata parameter to add_entity (#5009)
* Add staticdata parameter to add_entity
* Add add_entity_with_staticdata to core.features
2022-05-21 16:14:12 +02:00
sfan5 6ecb28d409
builtin/.../falling.lua: Avoid crash when hitting unknown nodes 2022-05-21 16:14:11 +02:00
Ezhh 5bfa146c8d
Make column alignment consistent in advanced settings (#5004) 2022-05-21 16:14:11 +02:00
rubenwardy ec70ea807a
Expose and document chatcommands as minetest.registered_chatcommands 2022-05-21 16:14:10 +02:00
Dorian Wouters 269e50a879
Fix /grant & /revoke not working with custom auth handler (#4974)
core.auth_table is not supposed to be accessed directly.
2022-05-21 16:14:10 +02:00
Auke Kok 47ee10b85c
Redo light.cpp.
Remake the light_decode_table.

The table starts out without pre-filled in values since those
are always discarded by the code apparently. We calculate a
pseudo curve with gamma power function, and then apply a new
adjustment table.

The adjustment table is setup to make the default gamma of 2.2
look decent: not too dark at light level 3 or so, but too dark
at 1 and below to be playable. The curve is much smoother than
before and looks reasonable at the whole range, offering a
pleasant decay of light levels away from lights.

The `display_gamma` setting now actually does something logical:
the game is darker at values below 2.2, and brighter at values
above 2.2. At 3.0, the game is very bright, but still has a good
light scale. At 1.1 or so, the bottom 5 light levels are virtually
black, but you can still see enough detail at light levels 7-8,
so the range and spread is adequate.

I must add that my monitor is somewhat dark to begin with, since
I have a `hc` screen that doesn't dynamic range colors or try to
pull up `black` pixels for me (it is tuned for accurate color and
light levels), so this should look even better on more dynamic
display tunings.
2022-05-21 16:14:10 +02:00
lhofhansl edf1c69372
Process ABMs in a spherical volume instead of cubic
Increase active_block_range default to a 3 mapblock radius.
2022-05-21 16:14:09 +02:00
Zeno- 9d48204b43
Final update to credits before release 2022-05-21 16:14:09 +02:00
paramat e7f217fb2e
Builtin/../falling.lua: Avoid crash when object pos over limit
If the object pos is over limit, 'add entity' will not add an entity,
causing 'obj' to be nil.
2022-05-21 16:14:08 +02:00
sfan5 621916b866
Disable mod security by default (closes #4944) 2022-05-21 16:14:08 +02:00
Auke Kok 980db492e3
Mapgen: Make mgv7 the default in UI
The actual menu default comes from defaultsettings.cpp.
2022-05-21 16:14:07 +02:00
paramat 20ad9bb740
Cavegen: Wider tunnels in mgflat, mgfractal, mgvalleys
As mgv7 is now the default mapgen i re-checked its tunnel width on request,
discovered they needed to be wider, and have made this change.
This commit widens the identical 3D noise tunnels in the other mapgens in
exactly the same way.
2022-05-21 16:14:07 +02:00
sfan5 b9ba9cba1a
Mgv7: Change default cave width to 0.09 2022-05-21 16:14:07 +02:00
Bernardo Sulzbach d3211f2592
Mod dependency lists: Should have platform-independent line breaking
This fixes a bug existing in modmgr.lua as reported by @Wuzzy2 which
caused the mod dependency list to glitch if input was using a line
terminator different than the OS default.

The C++ code does not need any changes as it already trims CR
occurrences on platforms on which the line termination sequence is LF.

Taken into account the size of the depends.txt files used, this should
not introduce a noticeable performance regression.

Fixes #4720
2022-05-21 16:14:06 +02:00
Rogier 59c800886c
Setting limits: Fix message text in advanced settings tab
It would complain that the value should be higher than the lower
bound, when it should be higher than or equal to the lower bound.

Similar issue for the upper bound.
2022-05-21 16:14:06 +02:00
Rogier 7b34af13f5
View range: Set maximum to 4000 nodes
The network protocol does not support larger than 255 mapblocks.
2022-05-21 16:14:05 +02:00
Zeno- dc5c2609ce
Update credits (#4827)
Update credits
2022-05-21 16:14:05 +02:00
lhofhansl 2f079c4f32
Fog: Make fraction of visible distance at which fog starts configurable
Optimise the fetching of global settings 'camera_smoothing',
'cinematic' and 'cinematic_camera_smoothing'.
Cache 'cam_smoothing'.
2022-05-21 16:14:05 +02:00
red-001 0299519ca9
Don't send a join message in singleplayer mode. 2022-05-21 16:14:04 +02:00
sfan5 6e3c875f51
Allow restricting detached inventories to one player
This combats the problem of sending the hundreds of
"creative" / "armor" or whatever detached invs that
exist on popular servers to each and every player
on join or on change of said invs.
2022-05-21 16:14:04 +02:00
orwell96 9c764263a7
Make supplying empty formspec strings close the formspec (#4737)
This will only happen if the formname matches or if formname is "".
2022-05-21 16:14:03 +02:00
paramat b420bbd126
Tool break: Reduce gain of break sounds 2022-05-21 16:14:03 +02:00
Auke Kok 1c75bc27e4
Builtin/../item: Enable tool breaking sounds
If a tool wears out and is destroyed, it's itemstack count
goes to 0, and we can optionally play a breaking sound.

This patch implements playing a breaking sound when this
occurs. Sounds need to be added to the tool itemdef
registration as the sound name string in the .sound.breaks
member.
2022-05-21 16:14:02 +02:00
est31 8fd57dc4bb
Introduce builtin_shared and use it to fix #4778
Fixes #4778 which was about the error:

ServerError: Lua: Runtime error from mod '' in callback item_OnPlace():
/usr/local/share/minetest/builtin/game/item.lua:278: attempt to call global 'check_attached_node' (a nil value)

The issue was a regression of commit 649448a2a91fbf3e944b2f2e739f4e2292af1df0

"Rename nodeupdate and nodeupdate_single and make them part of the official API"
2022-05-21 16:14:02 +02:00
paramat 9299a22081
Mgv7: Add optional floatlands, disabled by default 2022-05-21 16:14:02 +02:00
sfan5 a75a5eb3eb
Revert "Adding particle blend, glow and animation (#4705)"
This reverts commit 93e3555eae2deaeca69ee252cfa9cc9c3e0e49ef.
2022-05-21 16:14:01 +02:00
Foghrye4 cfa39937f9
Adding particle blend, glow and animation (#4705) 2022-05-21 16:14:01 +02:00
est31 b47663d742
Rename nodeupdate and nodeupdate_single and make them part of the official API
Now, the renamed forms of nodeupdate and nodeupdate_single are part of the official API.

As nodeupdate has been used by Minetest Game and in mods despite of not
being part of the official API, we ease the transition by still supporting
it for the 0.4.15 release. After the release, the two functions can be removed.

The removal will not violate the stability promise, as that promise only
includes the official and documented API.

Also, make some formerly global functions local. They most likely haven't
been used by mods, therefore they won't get stubs with deprecation warnings,
hard erroring directly.
2022-05-21 16:14:00 +02:00
paramat f3720d5ee4
Builtin/../falling: Fix bugs caused by 'ignore' nodes
Original commit by t4im, rebased and developed by paramat.
Fix CONTENT_IGNORE being replaced by falling nodes or causing large
areas of sand to collapse into itself.
Format some conditional code for clarity.
Add and clarify some comments.
2022-05-21 16:14:00 +02:00
Wuzzy 8de2093059
Privileges: Only give singleplayer 4 basic privs
- interact
- shout
- privs
- basic_privs
2022-05-21 16:14:00 +02:00
Wuzzy 67fbbcec71
Separate optional from required mod dependencies in main menu (#4721)
* Separate optional from require dep's in main menu

* Simplify modmgr mod dependency listing code
2022-05-21 16:13:59 +02:00
lhofhansl 912d6b1059
Add debug priv, and allow player to display the scene as wire-frame. (#4709) 2022-05-21 16:13:59 +02:00
ShadowNinja eb60afd472
Add version API 2022-05-21 16:13:58 +02:00
Auke Kok f5336937c7
Core.rotate_and_place: Remove unused call to get_look_pitch() 2022-05-21 16:13:58 +02:00
lhofhansl c3f6398f56
Optionally disable optimization that causes underwater and cave rendering glitches. (#4686) 2022-05-21 16:13:57 +02:00
paramat 58821d5d9d
Changes to static object storage limit and error message
Move static object storage force-delete message from errorstream to
warningstream.
Increase 'max objects per block' setting to 64.
Add missing spaces in warning code.
2022-05-21 16:13:57 +02:00
red-001 8b8f204d6d
Chat commands: Trim whitespaces from input of `/privs` command 2022-05-21 16:13:57 +02:00
rubenwardy 94296a9d2a
Builtin: Add vector.floor helper function 2022-05-21 16:13:56 +02:00
ShadowNinja 92b9b13d05
Enable mod security by default 2022-05-21 16:13:56 +02:00
red-001 8ba872f6e4
Builtin/../chatcommands: Add /grantme command 2022-05-21 16:13:55 +02:00
tenplus1 6dae557ad8
Builtin/../falling.lua: Code optimisation 2022-05-21 16:13:55 +02:00
red-001 db4234d742
Add a button for disabling all mods to world config. (#3900) 2022-05-21 16:13:54 +02:00
SmallJoker 984358f7bd
Add missing languages to the settings 2022-05-21 16:13:54 +02:00
HybridDog 8210849b50
VoxelArea: faster iter function (#4490) 2022-05-21 16:13:54 +02:00
Loïc Blot 76ed831877
Chat: new settings to prevent spam
Added the following chat coreside features
* Chat messages length limit
* Message rate limiting
* Message rate kicking

Note:
* handleChat now takes RemotePlayer pointer instead of u16 to remove useless
  lookups
2022-05-21 16:13:53 +02:00
paramat cadfd09355
Builtin/falling: Add fallback vector in case of nil 'wallmounted to dir'
The fallback vector is in case 'wallmounted to dir' is nil due
to voxelmanip placing a wallmounted node without resetting a
pre-existing param2 value that is out-of-range for wallmounted.
The fallback vector corresponds to param2 = 0.
2022-05-21 16:13:53 +02:00
raymoo 222e8090c1
Forceloading: Transient forceloads
Adds a flag to forceload_block which lets you turn off persistence for
that forceload.
2022-05-21 16:13:52 +02:00
Rui 1344513303
Fix typo in core.after (#4560) 2022-05-21 16:13:52 +02:00
paramat eef3643501
Conf.example: Re-add deleted noise parameter documentation
Re-add documentation of noise parameter formats.
Re-add 'mgv5_np_ground' noise parameters in group format.
Both these were deleted through auto-generation of conf.example.
Add note to builtin/mainmenu/dlg_settings_advanced.lua that this
documentation must be preserved.
2022-05-21 16:13:52 +02:00
paramat 2e54664273
Builtin: Change error to warning for light_source > 14 2022-05-21 16:13:51 +02:00
James Stevenson aaf808144d
Increase default font size by 1 2022-05-21 16:13:51 +02:00
est31 d6ef8bb772
Fix a typo and use proper deprecation notification system
Fix a typo pointed out by @thecow275.

Also, use the deprecated notification system which respects the
deprecated_lua_api_handling setting.
2022-05-21 16:13:50 +02:00
paramat a114f7297e
Register.lua: Throw error if node 'light_source' > core.LIGHT_MAX
Add 'core.LIGHT_MAX = 14' to builtin/game/constants.lua with the intention
to replace misplaced 'default.LIGHT_MAX = 14' in Minetest Game.
Add comment in light.h requiring the constant be changed in both places.
Add lighting bug warning to note in lua_api.txt.
There are hundreds of mod uses of 15 which causes a lighting bug.
2022-05-21 16:13:50 +02:00
paly2 716d19077f
Add minetest.unregister_item and minetest.register_alias_force 2022-05-21 16:13:49 +02:00
Rui c774d1e0df
Document keymap_autorun in settingtypes.txt and minetest.conf.example (#4486) 2022-05-21 16:13:49 +02:00
red-001 1c7b95f66f
Settingtypes.txt: Clarify comments, correct spelling 2022-05-21 16:13:49 +02:00
SmallJoker 3102f9f030
Builtin: Disallow registering users with the same name
Prevents duplicate names: 'NickName', 'nickname', 'NICKNAME'.
Skips already registered users, so they can connect as usual.
2022-05-21 16:13:48 +02:00
est31 6213fb1cf6
Client: disable pre v25 init sending by default
Disable the ability to connect to old servers by default to
improve password security.

If people still want to connect to old (0.4.12 and earlier)
servers, they can flip the send_pre_v25_init setting.

Add the ability to detect if we've tried to connect
to a server which only supports the pre v25 init protocol,
and show an apropriate error message. Most times the error
will already be catched at the serverlist level, the
detection mechanism only acts as last resort, because the
"Connection timed out" error message that would be shown
otherwise would be very confusing.

Automatic "fixing" of this condition is not desired,
as it would allow for downgrade attacks.

As already 161 of the 167 servers on the serverlist
support the new srp based auth protocol (> 96%),
the breakage should be minimal.

Follow up of commit

af30183124d40a969040d7de4b3a487feec466e4 "Add option to not send pre v25 init packet"

Also change the pessimistic assumption of masterlist
server versions to optimistic, in order to avoid buggy
behaviour (favourites not in the serverlist would be
denied to connect to, etc).
2022-05-21 16:13:48 +02:00
Xunto bf33a189da
Move on join and on leave messages to lua (#4460) 2022-05-21 16:13:47 +02:00
Tim cae4272b18
Tidy up generate_from_settingtypes.lua a bit.
* Multiline strings
* Table-concat instead of String-concats
* string.rep instead of loop-concat
* string.format %q instead of manual quotation by gsub
* Assert writeable files
* Generate new settings_translation_file
2022-05-21 16:13:47 +02:00
Tim caeafe3a44
Move generation from settingtypes out of dlg_settings_advanced
Avoids unreachable code linter warning by moving generation code
(of minetest.conf.example and settings_translation_file.cpp)
out of dlg_settings_advanced.

Due to passing the settings, also it avoids reading the settings file twice.

Instead of activating the code by changing the active if-clauses,
its activation is now done by uncommenting the loadfile() statement.
2022-05-21 16:13:46 +02:00
Ben Deutsch 6d21a3b8fe
Zooming the camera requires the 'zoom' privilege 2022-05-21 16:13:46 +02:00
Ben Deutsch bb50564ddd
Document zoom_fov in settingtypes.txt and minetest.conf.example 2022-05-21 16:13:46 +02:00
Wuzzy ac759533bd
Main menu, lua_api.txt: Fix mod/texture pack screenshot size issues
Recommend mod screenshot size in lua_api.txt
Adjust displayed screenshot size of texture packs
Document texture pack files in lua_api.txt
2022-05-21 16:13:45 +02:00
Tim 552e304da9
Builtin: Add core.MAP_BLOCKSIZE constant 2022-05-21 16:13:45 +02:00
Tim d03f226194
Builtin: Fix check for a player object in core.check_player_privs
core.check_player_privs accepts as first argument a name or player object, but just tested for a string.
This caused crashes inside builtin, when being passed any unexpected types.

This provides a better (duck-typing like) test, better error reporting.
2022-05-21 16:13:44 +02:00
Tim a1fcfc28ec
Builtin/profiler: Replace game profiler (#4245)
Use the setting "profiler.load" to enable profiling.
Other settings can be found in settingtypes.txt.

* /profiler print [filter] - report statistics to in-game console
* /profiler dump [filter] - report statistics to STDOUT and debug.txt
* /profiler save [format [filter]] - saves statistics to a file in your worldpath
	* txt (default) - same treetable format as used by the dump and print commands
	* csv - ready for spreadsheet import
	* json - useful for adhoc D3 visualizations
	* json_pretty - line wrapped and intended json for humans
	* lua - serialized lua table of the profile-data, for adhoc scripts
* /profiler reset - reset all gathered profile data.
	This can be helpful to discard of any startup measurements that often spike during loading or to get more useful min-values.

[filter] allows limiting the output of the data via substring/pattern matching against the modname.

Note: Serialized data structures might be subject to change with changed or added measurements.
	csv might be the most stable, due to flat structure.

Changes to the previous version include:

* Updated and extended API monitoring
* Correct calculation of average (mean) values (undistorted by idleness)
* Reduce instrumentation overhead.
* Fix crashes related to missing parameters for the future and occasional DIV/0's.
* Prevent issues caused by timetravel (overflow, timejump, NTP corrections)
* Prevent modname clashes with internal names.
* Measure each instrumentation individually and label based on registration order.
* Labeling of ABM's and LBM's for easier classification.
  Giving several ABM's or LBM's the same label will treat them as one.
  Missing labels will be autogenerated based on name or registration order.
* Configurable instrumentation and reporting. Skip e.g. builtin if you don't need it.
* Profile the profiler to measure instrumentation overhead.
2022-05-21 16:13:44 +02:00
rubenwardy c9476e8c2c
Remove cinematic toggle on F8
Also update cinematic mode's description to include mouse
2022-05-21 16:13:44 +02:00
est31 36ebc1f65a
Disable joysticks per default for now
It seems that various different devices register as
Joysticks on linux, and their presence has caused
lots of confusion amongst minetest users.

Therefore, disable the joystick feature.

Closes #4261
Closes #4221
2022-05-21 16:13:43 +02:00
HybridDog 6cbe7ef399
Only allow strings to be passed to minetest.global_exists (#4253)
Sometimes you accidentally forget the quotes when using global_exists, this makes minetest abort if you did so.

M  builtin/common/strict.lua
2022-05-21 16:13:43 +02:00
paramat a51850f7c2
Mgflat/fractal/v7/valleys: Denser 3D noise tunnels
Reduce spread from 96 to primes 61 and 67 (either side of 64)
Prime spreads help to keep 3D noise periodic features unaligned
'cave width' 0.2 to preserve tunnel width
Reduce octaves to 3 to improve network structure
2022-05-21 16:13:42 +02:00
Auke Kok db3e245ff0
Builtin/game/item: Add `place_param2` nodedef field
This allows a nodedef to specify a fixed value for param2 to be
used for all normal placements.

There are several uses for this:

- nodes that require param2 to be set to a non-zero value for
  internal mod use. E.g. leafdecay could use this to detect that
  leaves are played by players.
- force wallmounted or facedir value at placement at placement

This overrides any player look direction or other on-the-fly
param2 setting during placement.
2022-05-21 16:13:42 +02:00
est31 9fe6a3d2b3
Initial Gamepad support
Adds initial ingame gamepad support to minetest.

Full Formspec support is not implemented yet and
can be added by a later change.
2022-05-21 16:13:41 +02:00
Nathanaël Courant 4c2af14cef
Add colored text (not only colored chat).
Add documentation, move files to a proper place and avoid memory leaks.
Make it work with most kind of texts, and allow backgrounds too.
2022-05-21 16:13:41 +02:00
TriBlade9 4108d1bd6b
Colored chat working as expected for both freetype and non-freetype builds. @nerzhul improvements * Add unit tests * Fix coding style * move guiChatConsole.hpp to client/ 2022-05-21 16:13:41 +02:00
Sokomine 71b4fd31ac
protection_bypass priv can now be revoked in singleplayer (#4169) 2022-05-21 16:13:40 +02:00
paramat dea9b57e4b
Item entities: Don't show description as infotext
Partially reverts #3547
Infotext remains optional for objects, empty by default
2022-05-21 16:13:40 +02:00
Wayward One 306a8d1311
Add on_punchnode callback 2022-05-21 16:13:39 +02:00
paramat 2bc30ec0c5
Documentation: Remove incorrect and excessive mapgen flags text 2022-05-21 16:13:39 +02:00
est31 f0f9cda43b
Android: Re-add button to remove singleplayer world
Fixes #4120.
2022-05-21 16:13:38 +02:00
est31 2c07dc8219
Mainmenu: don't show change keys dialog on android
The change keys dialog can't be left. It doesn't make
much sense to show it on Android in the first place,
therefore disable it, just like commit

aed70cb0b652d6cb2272e7b94cd56671b3df6239 'Disable sound and key binding settings in "pause" menu on android'

has disabled it for the esc menu.

Fixes #4115.
2022-05-21 16:13:38 +02:00
Rui b6af7f73ec
Fix #4111 ("Provided world path doesn't exist" if choosing singleplayer on first run")
Bug and whitespace error fixed (Zeno)
2022-05-21 16:13:38 +02:00
est31 026f0a3e8c
Update credits tab 2022-05-21 16:13:37 +02:00
Rui 4cc9542edb
Mainmenu: Remove space under mod list 2022-05-21 16:13:37 +02:00
paramat 3851dc4649
Mapgen: Make 3D noise tunnels' width settable
Correct parameter names mg_valleys to mgvalleys
Remove biome NoiseParams from MapgenValleysParams
Improve format of parameter code
2022-05-21 16:13:36 +02:00
tenplus1 78874e8216
Avoid teleporting player if /teleport coords are out-of-range 2022-05-21 16:13:36 +02:00
Jean-Patrick Guerrero 7c7b72f83d
Android menu: Unified serverlist 2022-05-21 16:13:36 +02:00
rubenwardy 50d7bee97d
Builtin: Add basic_privs setting 2022-05-21 16:13:35 +02:00
SmallJoker 0939c871cf
Mainmenu: Standardize the menu button order and sizes 2022-05-21 16:13:35 +02:00
Nathanaël Courant d39cdbcf4f
Fix mainmenu code downloading the public serverlist twice.
Also, fix a nil error that can happen sometimes in
menu_handle_key_up_down
2022-05-21 16:13:34 +02:00
paramat bf161fe707
Textures: Replace menu background fallback dirt_bg.png with empty sky texture 2022-05-21 16:13:34 +02:00
Auke Kok 807cec58aa
Fix timer initialization.
This fixes the problem that the first timer tick is an
overrun and causes all timers to expire immediately.

replaces #4003
2022-05-21 16:13:33 +02:00
Jean-Patrick Guerrero ee08952a2e
Mainmenu: Code cleaning 2022-05-21 16:13:33 +02:00
Jean-Patrick Guerrero 24d09852ee
Mainmenu: Unify favorite servers with main serverlist 2022-05-21 16:13:33 +02:00
Auke Kok ea243adba1
falling: walk 4 additional diagonally down directions.
This seems very little cost and matches the old behavior more
closely. This will cause some more falling nodes to get added
to falling clusters. With the efficiency of the algorithm, this
really doesn't do much damage.
2022-05-21 16:13:32 +02:00
est31 f762820a7e
Mainmenu: Still support favorites if send_pre_v25_init is disabled
@SmallJoker has noted a bug that servers from the (local) main menu
favorites list can't be opened.

This commit fixes the bug by disabling any main menu based protocol
checks for servers from the favorite list.

Also, it fixes a second bug that happens when a server from the
public serverlist doesn't send its supported protocol versions,
most likely because its running a minetest older than commit [1].
Then we have shown an error msg that the server has enforced
one specific protocol version. This was most likely not the case.

Of course, we can't do anything better than do an assumption on
the protocol versions if they are not known. That assumption
should however be closest to the most often occuring case as
possible.

Also, some little cleanups.

[1]: 5a0ed780f56a5225b3d7c5f64099586e390e5f39 "Server: announce MIN/MAX protocol version supported to serverlist. Client: check serverlist"
2022-05-21 16:13:32 +02:00
SmallJoker f4ed603ee0
mainmenu: Tidy up logic in is_server_protocol_compat() (#3997)
Apply de morgan to simplify the logic.
2022-05-21 16:13:31 +02:00
TriBlade9 c130956370
Add option to disable entity selectionboxes. (#3992)
Setting only loaded once, default value is to enable them.
2022-05-21 16:13:31 +02:00
Auke Kok a3d0df7466
Convert nodeupdate to non-recursive
This took me a while to figure out. We no longer visit all 9 block
around and with the touched node, but instead visit adjacent plus
self. We then walk -non- recursively through all neigbors and if
they cause a nodeupdate, we just keep walking until it ends. On
the way back we prune the tail.

I've tested this with 8000+ sand nodes. Video result is here:

  https://youtu.be/liKKgLefhFQ

Took ~ 10 seconds to process and return to normal.
2022-05-21 16:13:31 +02:00
Rui914 8850a2a73f
Mainmenu: Refactor tab UI code
- Use local variables for tabs in place of globals
 - Merge together if statements where possible
 - Replace manual table searching code with indexof where possible
2022-05-21 16:13:30 +02:00
Rui914 d86bc91f4b
Mainmenu: Move description.txt textbox down
Additionally, fix misc. code style issues
2022-05-21 16:13:30 +02:00
paramat 60e3898c22
Mgv7: Decrease cliff steepness 2022-05-21 16:13:29 +02:00
tenplus1 b6b49f9cc9
stop falling.lua error
2016-03-27 15:47:01: ERROR[Main]: ServerError: Lua: Runtime error from mod '*builtin*' in callback luaentity_Step(): Node name is not set or is not a string!
2016-03-27 15:47:01: ERROR[Main]: stack traceback:
2016-03-27 15:47:01: ERROR[Main]: 	[C]: in function 'add_node'
2016-03-27 15:47:01: ERROR[Main]: 	/usr/share/minetest/builtin/game/falling.lua:96: in function </usr/share/minetest/builtin/game/falling.lua:43>
2022-05-21 16:13:29 +02:00
Rui 215e71efad
Falling: Set acceleration on step again
Commit

65c09a96f41705bb8e75fc5ff4276342be91ed11 "Set acceleration only once in falling node"

has made the acceleration being set only once.
But this has introduced a regression.

Fix #3884.
2022-05-21 16:13:28 +02:00
Rui 3f4c1bb7b8
Credits: Make that easy to add/remove 2022-05-21 16:13:28 +02:00
Auke Kok 400c4dda7a
Make `options` local here.
Undoubtably this may cause problems later if unchecked.

```
2016-03-22 21:57:52: WARNING[Server]: Assignment to undeclared global "options" inside a function at .../sofar/git/minetest/bin/../builtin/game/chatcommands.lua:862.
```
2022-05-21 16:13:28 +02:00
paramat b12c539595
Builtin/game/falling: Re-add comma removed by recent commit 2022-05-21 16:13:27 +02:00
Rui914 8760d15445
Set acceleration only once in falling node 2022-05-21 16:13:27 +02:00
Auke Kok 2f45f007f4
Allow NodeTimer, ABM and block mgmt interval changes.
ABM's are hardcoded to run every 1.0s, NodeTimers are hard coded to
run at every 1.0s. Block mgmt is running every 2.0sec.

However, these timers can be better tuned for both higher and lower
values by server owners. Some server owners want to, and have the
resources to send more packets per second to clients, and so they
may wish to send smaller updates sooner. Right now all ABM's are
coalesced into 1.0 second intervals, resulting in large send queues
to all clients. By reducing the amount of possible timers, one can
get a far better response rate and lower the perception of lag.

On the other side of the camp, some servers may want to increase
these values, which again isn't easily doable.

The global settings abm_interval and nodetimer_interval are set to
current values by default. I've tested with 0.2/0.5 type values
and noticed a greatly improved response and better scattering of
nodetimers, as well as enjoying not faceplanting into doors with
pressure plates anymore.
2022-05-21 16:13:26 +02:00
est31 eaab9d5586
Add option to not send pre v25 init packet
The legacy init packet (pre v25) sends information about the client's
password that a server could use to log in to other servers if the
username and password are the same. All the other benefits of SRP of
protocol v25 are missed if the legacy init packet is still sent during
connection creation.

This patch adds an option to not send the v25 init packet. Not sending
the v25 packet means breaking compat with pre v25 servers, but as the
option is not enabled by default, no servers are affected unless the
user explicitly flips the switch. More than 90% of the servers on the
serverlist support post v25 protocols.

The patch also fixes a bug with greying out of non compliant servers
being done wrongly, the min and max params were mixed.
2022-05-21 16:13:26 +02:00
Diego Martínez 79667b4dc6
Add options for screenshot format and quality 2022-05-21 16:13:26 +02:00
paramat 7f85241781
Documentation: Clarify global and mapgen-specific mapgen flags 2022-05-21 16:13:25 +02:00
Auke Kok 9e994e0e39
Introduce "protection_bypass" privilege.
This privilege allows map protection bypassing for server operators
and world moderators.

Initially I had thought that bypassing protection mods would have been
something that could entirely be done inside mods and minetest_game,
but the concept of protection is defined in core, in the code of
core.is_protected().

I don't feel that it would be logical to introduce a protection
concept in core, but not some way around that for server operators
to maintain map parts that need fixing, de-griefing or cleanup.

Others had noticed the same problems, and proposed a patch to
minetest_game. That patch is fine by itself, but it fails to add
protection bypass functionality for digging normal nodes and placing
nodes.

So, instead, we indroduce the new priv "protection_bypass" in core,
and modify 'on_place_node' and 'node_dig' to allow bypassing node
protections if the player holds this priv.

This priv was tested with protector redo by tenplus1.

A followup patch to Minetest Game will include allowing special checks
for doors, trapdoors, chests in Minetest Game.

Protection mods will likely want to mimic the changes in their relevant
code sections.
2022-05-21 16:13:25 +02:00
Auke Kok da5a169a45
Add consistent monotonic day counter - get_day_count()
I've written several experimental bits of code that revolve around the
need for a consistent calendar, but implementing one is extremely hard
in mods due to time changes and mods overriding core.get_timeofday(),
which will conflict.

The second part of the problem is that doing this from a mod requires
constant maintenance of a settings file.

An implementation in core is trivial, however, and solves all of
these problems at virtually no cost: No extra branches in server
steps, and a single branch when minetest.set_time_of_day(), which is
entirely reasonable.

We store the day_count value in env_meta.txt.

The use case is obvious: This change allows mods to create an actual
virtual calendar, or properly account for seasonal changes, etc..

We add a "/days" chatcommand that displays the current day count. No
permissions are needed. It can only retrieve the day count, not
modify it.
2022-05-21 16:13:24 +02:00
ShadowNinja 96b86f8440
Add AreaStore custom ID API 2022-05-21 16:13:24 +02:00
est31 d1e698f4fb
Add minetest.register_lbm() to run code on block load only 2022-05-21 16:13:23 +02:00
Jean-Patrick Guerrero 7d23793e05
Settings Tab: Regroup dropdown datas in tables 2022-05-21 16:13:23 +02:00
Rui914 32752d2bc5
Faster insertion into table 2022-05-21 16:13:23 +02:00
srfqi 8660983a8e
Add forgotten valleys mapgen in mapgen name
Missing `valleys` in `settingtypes.txt` and `minetest.conf.example`.
2022-05-21 16:13:22 +02:00
Jean-Patrick Guerrero 9f6730de09
Update settings tab + some misc. clean-up 2022-05-21 16:13:22 +02:00
est31 250f67bf2f
Don't generate trailing spaces in minetest.conf.example
If the default value of a setting was empty,
it previously generated a trailing space.
2022-05-21 16:13:21 +02:00
RealBadAngel 3cb36ba9ac
Mapblock mesh: Allow to use VBO 2022-05-21 16:13:21 +02:00
RealBadAngel 362d382289
Remove new_style_water 2022-05-21 16:13:20 +02:00
Jeija d0a7fe455e
Add Lua interface to HTTPFetchRequest
This allows mods to perform both asynchronous and synchronous HTTP
requests. Mods are only granted access to HTTP APIs if either mod
security is disabled or if they are whitelisted in any of the
the secure.http_mods and secure.trusted_mods settings.

Adds httpfetch_caller_alloc_secure to generate random, non-predictable
caller IDs so that lua mods cannot spy on each others HTTP queries.
2022-05-21 16:13:20 +02:00
RealBadAngel 6817425d4d
Camera: remove auto tune FPS, single view range setting 2022-05-21 16:13:20 +02:00
RealBadAngel e0bf406bea
Remove preload_item_visuals code
Closes #3748
2022-05-21 16:13:19 +02:00
BlockMen ae7b3ec177
Restore simple settings tab and add advanced settings as dialog 2022-05-21 16:13:19 +02:00
paramat 41bef56c82
Documentation: Remove now unused 'vertical spawn range' 2022-05-21 16:13:18 +02:00
Diego Martínez 60a5b2ac4d
Initialize facedir and wallmounted tables only once.
This makes the functions a bit faster since they don't
have to recreate the tables every invocation, and makes
the code more readable.

Also, document `wallmounted_to_dir`.

The function was implemented but not documented in `lua_api.txt`.
2022-05-21 16:13:18 +02:00
Kahrl c4db9d23ff
Log /clearobjects mode 2022-05-21 16:13:17 +02:00
Kahrl ed493305e4
Add '/clearobjects quick' 2022-05-21 16:13:17 +02:00
RealBadAngel d8c9c7deac
Filmic HDR tone mapping 2022-05-21 16:13:17 +02:00
RealBadAngel e942240abf
Cleanup selection mesh code, add shaders for halo and selection boxes 2022-05-21 16:13:16 +02:00
Diego Martínez 6dc6ea419e
builtin: Fix `print` crashing on nil "holes".
The engine implementation of `print` packs the varargs into a
table and passes the table directly to `table.concat`. If you
pass any value not supported by `table.concat` (particularly
`nil`), the server crashes. This is unexpected behavior, as
`print` is supposed to be able to work with anything.

This patch changes the implementation so it first converts
all arguments using `tostring`, which fixes the issue and
makes the custom `print` function compatible with the stock
Lua behavior.
2022-05-21 16:13:16 +02:00
RealBadAngel 204f43d9c9
Use meshes to display inventory items 2022-05-21 16:13:15 +02:00
Splizard 35bae38ca3
Add admin command which says who the administator is for the server. 2022-05-21 16:13:15 +02:00
Duane Robertson 3a9235fc1c
Mgvalleys: use standard caves
Replace simple caves with V5 caves, adding unpredictable water and lava
settings and massive caves based on subterrain. Remove fast terrain mode
and accompanying settings. Remove superfluous temperature/humidity
settings. Remove lava/water height setting. Fix errors in humidity
handling and remove humidity_break_point setting. Move cave noises to
generateCaves. Fix minor formatting/naming issues and use
MYMAX/MYMIN/myround.
2022-05-21 16:13:14 +02:00
Auke Kok 3cef28e731
New timer design.
I could honestly not make much sense of the timer implementation
that was here. Instead I've implemented the type of timer algorithm
that I've used before, and tested it instead.

The concept is extremely simple: all timers are put in an ordered
list. We check every server tick if any of the timers have
elapsed, and execute the function associated with this timer.

We know that many timers by themselves cause new timers to be
added to this list, so we iterate *backwards* over the timer
list. This means that new timers being added while timers are
being executed, can never be executed in the same function pass,
as they are always appended to the table *after* the end of
the table, which we will never reach in the current pass over
all the table elements.

We switch time keeping to minetest.get_us_time(). dtime is
likely unreliable and we have our own high-res timer that we
can fix if it is indeed broken. This removes the need to do
any sort of time keeping.
2022-05-21 16:13:14 +02:00
Diego Martínez d10a5cfedb
Fix world config menu ignoring `name` in `mod.conf`. 2022-05-21 16:13:13 +02:00
RealBadAngel 580ea1201e
Show infotext with description for item entities 2022-05-21 16:13:13 +02:00
Rogier e577c35a3c
Fix error message in settings tab overlapping 'save' button
The save button is now fully functional again when an error message
is shown.

After an invalid value is entered in the settings tab dialog, the GUI
label for the error message that is shown was partly overlapping the
'save' button, so that the top half of the button could not be clicked
on.
2022-05-21 16:13:12 +02:00
Duane Robertson e64db54315
Add Valleys mapgen. 2022-05-21 16:13:12 +02:00
paramat bffee113cf
Mgflat: Set blank default spflags. Unhide 2022-05-21 16:13:11 +02:00