diff --git a/classes/InvRef.lua b/classes/InvRef.lua index 60680d2..8f4b85f 100644 --- a/classes/InvRef.lua +++ b/classes/InvRef.lua @@ -51,29 +51,34 @@ function InvRef:get_lists() end function InvRef:set_lists(lists) end --- add item somewhere in list, returns leftover ItemStack --- @param list_name string ---- @param stack ItemStack +--- @param stack ItemStack|ItemStackString --- @return ItemStack leftover ItemStack function InvRef:add_item(list_name, stack) end --- returns true if the stack of items can be fully added to the list --- @param list_name string ---- @param stack ItemStack +--- @param stack ItemStack|ItemStackString +--- --- @return boolean function InvRef:room_for_item(list_name, stack) end --- returns true if the stack of items can be fully taken from the list --- @overload fun(list_name:string, stack:ItemStack):boolean --- @param list_name string ---- @param stack ItemStack +--- @param stack ItemStack|ItemStackString --- @param match_meta boolean If `match_meta` is false, only the items' names are compared (default: `false`). --- @return boolean function InvRef:contains_item(list_name, stack, match_meta) end ---- 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`. ---- @param list_name string ---- @param stack ItemStack + +--- 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. +--- +--- @param list_name string +--- @param stack ItemStack|ItemStackString +--- @param match_meta? boolean since `remove_item_match_meta` +--- --- @return ItemStack -function InvRef:remove_item(list_name, stack) end +function InvRef:remove_item(list_name, stack, match_meta) end --- returns a location compatible to `minetest.get_inventory(location)`. e.g. --- * `{type="player", name="celeron55"}` --- * `{type="node", pos={x=, y=, z=}}` diff --git a/classes/vector.lua b/classes/vector.lua index a740d32..cb8c1c4 100644 --- a/classes/vector.lua +++ b/classes/vector.lua @@ -7,12 +7,12 @@ --- @operator sub(vector): vector --- @operator mul(number): vector --- @operator div(number): vector -local vector = {} +vector = {} --- Creates a new vector `(a, b, c)`. --- * Deprecated: `vector.new()` does the same as `vector.zero()` and --- `vector.new(v)` does the same as `vector.copy(v)` ---- @param x number +--- @param x number|Position --- @param y? number --- @param z? number --- @return vector @@ -180,9 +180,10 @@ function vector:subtract(x) end --- Returns a scaled vector. --- - Deprecated: If `scalar` is a vector: Returns the Schur product. +--- @param self vector --- @param scalar number|vector --- @return vector -function vector:multiply(scalar) end +function vector.multiply(self, scalar) end --- Returns a scaled vector. --- - Deprecated: If `scalar` is a vector: Returns the Schur quotient. diff --git a/core_namespace.lua b/core_namespace.lua index ec6dc65..abd91f0 100644 --- a/core_namespace.lua +++ b/core_namespace.lua @@ -58,7 +58,10 @@ PseudoRandom = {} -- `minetest.` / `core.` functions -- -minetest = {} +core = {} +--- for backward compatibilit +--- @legacy +minetest = core -- Escape sequences: @@ -1695,7 +1698,7 @@ function minetest.item_place(itemstack, placer, pointed_thing, param2) end --- * returns the leftover itemstack --- --- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L5376-L5378) ---- @param itemstack ItemStack +--- @param itemstack ItemStack|ItemStackString --- @param dropper Player|ObjectRef --- @param pos Position --- @return ItemStack