aboutsummaryrefslogtreecommitdiff
path: root/builtin/game/item.lua
AgeCommit message (Collapse)Author
2018-12-10Add eat sound (#7956)Wuzzy
2018-08-30get_node_drops: Make empty drop return empty table (#7592)tenplus1
This stops get_node_drops from returning an empty string when using drop = "" and instead returns the supposed empty table instead {}
2018-07-17Builtin: Replace deprecated function calls (#7561)SmallJoker
2018-03-29core.rotate_node: Do not trigger after_place_node (#6900)SmallJoker
2017-12-14Add callback to preserve node metadata as item metadataashtrayoz
2017-12-12Builtin: Fix handle_node_drops crash with nil diggerSmallJoker
2017-10-28Fix default item callbacks to work with nil users (#5819)raymoo
* 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`
2017-09-13Item drop: Tune to land exactly 2 nodes away with level view (#6410)Paramat
2017-08-26Check item_drop amount clientside (#6242)rubenwardy
2017-08-14Make dropped items colorableDániel Juhász
2017-06-24Helper methods for hardware colorization (#5870)Dániel Juhász
2017-06-20Automatic item and node colorization (#5640)Dániel Juhász
* 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
2017-05-06Use a settings object for the main settingsShadowNinja
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.
2017-03-15Fix two nul deref if digging unknown nodes. (#5398)Auke Kok
Introduced by d785456b3fa35faf47cb972fde9e8668382c5e22 (#5162)
2017-03-10Optimize item.luatenplus1
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.
2017-02-18Fixes for colorwallmounted and colorfacedir nodesDániel Juhász
Correct node placement prediction for attached colorwallmounted nodes. Correct placement direction for colorfacedir and colorwallmounted nodes. Correct detatch mechanism for attached colorwallmounted nodes.
2017-01-31Make facedir_to_dir and wallmounted_to_dir work with coloured nodes as well. ↵Nathanaël Courant
(#5153)
2017-01-23core: Add dir_to_yaw and yaw_to_dir helpersAuke Kok
These are needed to go from things like entity yaw to a vector and vice versa.
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-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-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-02-11Initialize facedir and wallmounted tables only once.Diego Martinez
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`.
2016-01-07Liquids: Flow into and destroy 'floodable' nodesparamat
Add new node property 'floodable', default false Define "air" as floodable = true in C++ and lua
2015-12-20Fix missing localization for objHybridDog
2015-12-02Add on_secondary_use when right clicking an item in the airAlex Ford
2015-11-12Add the player name to dropped itemsRobert Zenz
The player name is now added in the field "dropped_by" on the created entity.
2015-10-04Added minetest.wallmounted_to_dirFernando Carmona Varo
2015-09-29Some map border related fixesest31
1. Check for entity addition success in spawn_item implementation 2. Check for success in item_drop callback, so that the player doesn't lose the item if they are outside bounds and try to drop it. 3. When existing player joins game, check that their position is inside map bounds. If not, set their position to the return value of findSpawnPos(). 4. Make findSpawnPos() respect the border 2 fixes a lua crash if a player drops an item outside map bounds. 3 fixes an assertion crash if a player leaves when being outside map bounds, and then rejoins.
2015-08-12SAPI: Track last executed mod and include in error messageskwolekr
2015-02-16Fix minetest.item_eat's replace_with_item, fixes #2292rubenwardy
2014-06-10New feature: drop a item instead a stack while...Lord89James
sneaking
2014-05-26Add item eat callbackrubenwardy
2014-05-08Use "core" namespace internallyShadowNinja
2014-05-07Organize builtin into subdirectoriesShadowNinja