mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Implement metadata-aware version of InvRef:remove_item() (#15771)
This commit is contained in:
parent
0890125962
commit
e51221d247
6 changed files with 41 additions and 24 deletions
|
@ -5689,6 +5689,8 @@ Utilities
|
|||
biome_weights = true,
|
||||
-- Particles can specify a "clip" blend mode (5.11.0)
|
||||
particle_blend_clip = true,
|
||||
-- The `match_meta` optional parameter is available for `InvRef:remove_item()` (5.12.0)
|
||||
remove_item_match_meta = true,
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -7872,13 +7874,15 @@ An `InvRef` is a reference to an inventory.
|
|||
can be fully added to the list
|
||||
* `contains_item(listname, stack, [match_meta])`: returns `true` if
|
||||
the stack of items can be fully taken from the list.
|
||||
If `match_meta` is false, only the items' names are compared
|
||||
(default: `false`).
|
||||
* `remove_item(listname, stack)`: take as many items as specified from the
|
||||
list, returns the items that were actually removed (as an `ItemStack`)
|
||||
-- note that any item metadata is ignored, so attempting to remove a specific
|
||||
unique item this way will likely remove the wrong one -- to do that use
|
||||
`set_stack` with an empty `ItemStack`.
|
||||
* If `match_meta` is `true`, item metadata is also considered when comparing
|
||||
items. Otherwise, only the items names are compared. Default: `false`
|
||||
* The method ignores wear.
|
||||
* `remove_item(listname, stack, [match_meta])`: take as many items as specified from the
|
||||
list, returns the items that were actually removed (as an `ItemStack`).
|
||||
* If `match_meta` is `true` (available since feature `remove_item_match_meta`),
|
||||
item metadata is also considered when comparing items. Otherwise, only the
|
||||
items names are compared. Default: `false`
|
||||
* The method ignores wear.
|
||||
* `get_location()`: returns a location compatible to
|
||||
`core.get_inventory(location)`.
|
||||
* returns `{type="undefined"}` in case location is not known
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue