1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

builtin: Return 'obj' from 'core.item_drop' (#15880)

This also includes a minor bugfix where 'itemstack' was cleared
even if the object placement failed.
This commit is contained in:
SmallJoker 2025-03-11 20:00:35 +01:00 committed by GitHub
parent afb15978d9
commit 23d0fb2d3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 6 deletions

View file

@ -6937,8 +6937,13 @@ Defaults for the `on_place` and `on_drop` item definition functions
* Parameters are the same as in `on_pickup`.
* Returns the leftover itemstack.
* `core.item_drop(itemstack, dropper, pos)`
* Drop the item
* returns the leftover itemstack
* Converts `itemstack` to an in-world Lua entity.
* `itemstack` (`ItemStack`) is modified (cleared) on success.
* In versions < 5.12.0, `itemstack` was cleared in all cases.
* `dropper` (`ObjectRef`) is optional.
* Returned values on success:
1. leftover itemstack
2. `ObjectRef` of the spawned object (provided since 5.12.0)
* `core.item_eat(hp_change[, replace_with_item])`
* Returns `function(itemstack, user, pointed_thing)` as a
function wrapper for `core.do_item_eat`.