Document new meaning of immortal=1 for players
Disable breathing if player is immortal
Hide builtin statbars if player immortal (delayed)
Co-authored-by: ClobberXD <ClobberXD@gmail.com>
saves the forceloaded blocks periodically.
checks every 10 seconds if the forceloaded blocks got changed in-game
and persists them on-disk if that's the case
* Add sounds for falling and attached nodes
The sound specified in `node_definition.sounds.fall` is used.
When a falling node is spawned at a position or an attached node drops, the sound is played at this position.
* allow all sorts of soundspecs
Centralize HUD updating in update_builtin_statbars.
Fixes race condition in 'on joinplayer' that causes stat bar bugs.
Correctly scales stat bars to custom max values set by mods.
Delay was converted from the param string and not the delay value, thus never using the actual given delay value when used in combination with other string values in the param, in this case reconnect and the shutdown messsage.
Prevents falling node entities entering the ignore at a world edge and
resting on unloaded nodes 16 nodes below, unreachable, undiggable and
still being processed by 'on step' because they don't revert to nodes.
A useful function that applies 'core.is_protected()' to a 3D lattice of
points evenly spaced throughout a defined volume, with a parameter for
the maximum spacing of points.
* Add player deletion method to auth handler (fixes#6653)
* Support iterating over the auth database
There was no way to do this previously and a recent commit
broke doing this the "hacky" way by accessing `core.auth_table`.
Falling nodes should make a sound. This can only be done here,
so for simplicity we just call the sound_play() here with the node
place sound. We ignore any gain value in the sound spec since a
falling node should be loud, so the 1.0 default gain makes sense
here.
* Fix default item callbacks to work with nil users
* item.lua: Handle node drops for invalid players
The if-condition for the dropping loop is the same as `inv`, which means that the 2nd possible definition of `give_item` is never used.
Remove redundant `local _, dropped_item`
Implement network communication for channels
* Implement ModChannel manager server side to route incoming messages from clients to other clients
* Add signal handler switch on client & ModChannelMgr on client to handle channels
* Add Lua API bindings + client packet sending + unittests
* Implement server message sending
* Add callback from received message handler to Lua API using registration method
* Abort set_item when it does nothing
* Do not adjust dropped item size linearly
Instead use cube root because the item count is proportional to the volume, not to the length.
* Make the item rotate slower when it's bigger
Bigger items chafe more on the ground, so they can't rotate as fast as small ones
* Fix items flying in air
* Implement minetest.register_on_userlimit_check
This new callback permits to bypass the max_users parameter with new mods condition, based on player name or IP
Only one mod needs to permit it.
Move core part for builtin privileges checks to builtin
* Respect object property hp_max field for players
This allows modders to configure the maximal HP per player
* Statbars: Downscale bar to full 20 HP when exceeding this value
Add default max HP for players and breath constants to builtin
Document the constants
* Rename PLAYER_MAX_HP -> PLAYER_MAX_HP_DEFAULT
* Load client-side mods into memory before executing them.
This removes the remaining filesystem access that client-sided mods had and it will hopefully make then more secure.
* Lua Virtual filesystem: don't load the files into memory just scan the filenames into memory.
* Fix the issues with backtrace
* fix most of the issues
* fix code style.
* add a comment
* Automatic item and node colorization
Now nodes with a palette yield colored item stacks, and colored items
place colored nodes by default. The client predicts the colorization.
* Backwards compatibility
* Use nil
* Style fixes
* Fix code style
* Document changes
Allow players to clear their own inventory or that of another player with /clearinv command. server privilege is required to clear another player's inventory, no privileges are required to clear your own inventory.'
This unifies the settings APIs.
This also unifies the sync and async registration APIs, since the async
registration API did not support adding non-functions to the API table.
* Player data to Database
Add player data into databases (SQLite3 & PG only)
PostgreSQL & SQLite: better POO Design for databases
Add --migrate-players argument to server + deprecation warning
* Remove players directory if empty
Adds the possibility to colorize item stacks based on their metadata.
In the item/node definition you can specify palette (an image file)
and color (fallback color if the item has no palette or metadata).
Then you can add palette_index to the metadata.
Dropped itemstacks with different colors do not merge.
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.
* 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
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.
Correct node placement prediction for attached colorwallmounted nodes.
Correct placement direction for colorfacedir and colorwallmounted nodes.
Correct detatch mechanism for attached colorwallmounted nodes.
Introduces two functions to unregister and override chatcommands.
minetest.unregister_chatcommand("<name>") and
minetest.override_chatcommand("<name>", {<redifinition>})
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.
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.
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"
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.
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.
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.
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.
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.
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.
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.
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.
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.
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>
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.
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.
```
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.
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.
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.
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`.
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.
The callback can now be invoked with either the player object or name as
the first parameter, and with either a table or a list of strings, like
this:
minetest.check_player_privs(player_name, { shout = true, fly = true })
minetest.check_player_privs(player_name, "shout", "fly")
minetest.check_player_privs(player, { shout = true, fly = true })
minetest.check_player_privs(player, "shout", "fly")
- Add warning log level
- Change debug_log_level setting to enumeration string
- Map Irrlicht log events to MT log events
- Encapsulate log_* functions and global variables into a class, Logger
- Unify dstream with standard logging mechanism
- Unify core.debug() with standard core.log() script API