aboutsummaryrefslogtreecommitdiff
path: root/builtin/game
AgeCommit message (Collapse)Author
2016-12-31Fix /grant & /revoke not working with custom auth handler (#4974)Dorian Wouters
core.auth_table is not supposed to be accessed directly.
2016-12-21Builtin/../falling.lua: Avoid crash when object pos over limitparamat
If the object pos is over limit, 'add entity' will not add an entity, causing 'obj' to be nil.
2016-12-03Don't send a join message in singleplayer mode.red-001
2016-11-28Allow restricting detached inventories to one playersfan5
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.
2016-11-23Make supplying empty formspec strings close the formspec (#4737)orwell96
This will only happen if the formname matches or if formname is "".
2016-11-20Tool break: Reduce gain of break soundsparamat
2016-11-18Builtin/../item: Enable tool breaking soundsAuke Kok
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.
2016-11-16Introduce builtin_shared and use it to fix #4778est31
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"
2016-11-14Rename nodeupdate and nodeupdate_single and make them part of the official APIest31
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.
2016-11-07Builtin/../falling: Fix bugs caused by 'ignore' nodesparamat
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.
2016-11-07Privileges: Only give singleplayer 4 basic privsWuzzy
- interact - shout - privs - basic_privs
2016-11-04Add debug priv, and allow player to display the scene as wire-frame. (#4709)lhofhansl
2016-10-20Chat commands: Trim whitespaces from input of `/privs` commandred-001
2016-10-16Builtin/../chatcommands: Add /grantme commandred-001
2016-10-14Builtin/../falling.lua: Code optimisationtenplus1
2016-10-08VoxelArea: faster iter function (#4490)HybridDog
2016-10-03Builtin/falling: Add fallback vector in case of nil 'wallmounted to dir'paramat
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.
2016-10-03Forceloading: Transient forceloadsraymoo
Adds a flag to forceload_block which lets you turn off persistence for that forceload.
2016-10-01Fix typo in core.after (#4560)Rui
2016-09-21Builtin: Change error to warning for light_source > 14paramat
2016-09-17Register.lua: Throw error if node 'light_source' > core.LIGHT_MAXparamat
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.
2016-09-08Add minetest.unregister_item and minetest.register_alias_forcepaly2
2016-08-29Builtin: Disallow registering users with the same nameSmallJoker
Prevents duplicate names: 'NickName', 'nickname', 'NICKNAME'. Skips already registered users, so they can connect as usual.
2016-08-22Move on join and on leave messages to lua (#4460)Xunto
2016-08-10Zooming the camera requires the 'zoom' privilegeBen Deutsch
2016-07-26Builtin: Add core.MAP_BLOCKSIZE constantTim
2016-07-26Builtin: Fix check for a player object in core.check_player_privsTim
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.
2016-07-12Builtin/profiler: Replace game profiler (#4245)Tim
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.
2016-06-17Builtin/game/item: Add `place_param2` nodedef fieldAuke Kok
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.
2016-05-31Add colored text (not only colored chat).Ekdohibs
Add documentation, move files to a proper place and avoid memory leaks. Make it work with most kind of texts, and allow backgrounds too.
2016-05-31Colored chat working as expected for both freetype and non-freetype builds. ↵TriBlade9
@nerzhul improvements * Add unit tests * Fix coding style * move guiChatConsole.hpp to client/
2016-05-30protection_bypass priv can now be revoked in singleplayer (#4169)Sokomine
2016-05-22Item entities: Don't show description as infotextparamat
Partially reverts #3547 Infotext remains optional for objects, empty by default
2016-05-17Add on_punchnode callbackWayward One
2016-04-29Avoid teleporting player if /teleport coords are out-of-rangetenplus1
2016-04-28Builtin: Add basic_privs settingrubenwardy
2016-04-21Fix timer initialization.Auke Kok
This fixes the problem that the first timer tick is an overrun and causes all timers to expire immediately. replaces #4003
2016-04-20falling: walk 4 additional diagonally down directions.Auke Kok
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.
2016-04-11Convert nodeupdate to non-recursiveAuke Kok
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-29stop falling.lua errortenplus1
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>
2016-03-25Falling: Set acceleration on step againRui
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.
2016-03-24Make `options` local here.Auke Kok
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. ```
2016-03-19Builtin/game/falling: Re-add comma removed by recent commitparamat
2016-03-19Set acceleration only once in falling nodeRui914
2016-03-11Introduce "protection_bypass" privilege.Auke Kok
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.
2016-03-09Add consistent monotonic day counter - get_day_count()Auke Kok
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.
2016-03-07Add AreaStore custom ID APIShadowNinja
2016-03-07Add minetest.register_lbm() to run code on block load onlyest31
2016-03-06Faster insertion into tableRui914
2016-02-22Add Lua interface to HTTPFetchRequestJeija
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.