ide-helper: improve ItemDefinition class docs.
This commit is contained in:
@@ -1,121 +1,141 @@
|
|||||||
--- @class ItemDefinition
|
--- @class ItemDefinition
|
||||||
local ItemDefinition = {
|
local ItemDefinition = {
|
||||||
|
--- Can contain new lines. "\n" has to be used as new line character.
|
||||||
|
--- See also: `get_description` in [`ItemStack`]
|
||||||
|
--- @type string
|
||||||
description = "",
|
description = "",
|
||||||
-- Can contain new lines. "\n" has to be used as new line character.
|
|
||||||
-- See also: `get_description` in [`ItemStack`]
|
|
||||||
|
|
||||||
|
--- Must not contain new lines.
|
||||||
|
--- Defaults to nil.
|
||||||
|
--- Use an [`ItemStack`] to get the short description, e.g.:
|
||||||
|
--- ItemStack(itemname):get_short_description()
|
||||||
|
--- @type string
|
||||||
short_description = "",
|
short_description = "",
|
||||||
-- Must not contain new lines.
|
|
||||||
-- Defaults to nil.
|
|
||||||
-- Use an [`ItemStack`] to get the short description, e.g.:
|
|
||||||
-- ItemStack(itemname):get_short_description()
|
|
||||||
|
|
||||||
|
--- key = name, value = rating; rating = <number>.
|
||||||
|
--- If rating not applicable, use 1.
|
||||||
|
--- e.g. {wool = 1, fluffy = 3}
|
||||||
|
--- {soil = 2, outerspace = 1, crumbly = 1}
|
||||||
|
--- {bendy = 2, snappy = 1},
|
||||||
|
--- {hard = 1, metal = 1, spikes = 1}
|
||||||
|
--- @type table<string,number>
|
||||||
groups = {},
|
groups = {},
|
||||||
-- key = name, value = rating; rating = <number>.
|
|
||||||
-- If rating not applicable, use 1.
|
|
||||||
-- e.g. {wool = 1, fluffy = 3}
|
|
||||||
-- {soil = 2, outerspace = 1, crumbly = 1}
|
|
||||||
-- {bendy = 2, snappy = 1},
|
|
||||||
-- {hard = 1, metal = 1, spikes = 1}
|
|
||||||
|
|
||||||
|
--- Texture shown in the inventory GUI
|
||||||
|
--- Defaults to a 3D rendering of the node if left empty.
|
||||||
|
--- @type string
|
||||||
inventory_image = "",
|
inventory_image = "",
|
||||||
-- Texture shown in the inventory GUI
|
|
||||||
-- Defaults to a 3D rendering of the node if left empty.
|
|
||||||
|
|
||||||
|
--- An overlay texture which is not affected by colorization
|
||||||
|
--- @type string
|
||||||
inventory_overlay = "",
|
inventory_overlay = "",
|
||||||
-- An overlay texture which is not affected by colorization
|
|
||||||
|
|
||||||
|
--- Texture shown when item is held in hand
|
||||||
|
--- Defaults to a 3D rendering of the node if left empty.
|
||||||
|
--- @type string
|
||||||
wield_image = "",
|
wield_image = "",
|
||||||
-- Texture shown when item is held in hand
|
|
||||||
-- Defaults to a 3D rendering of the node if left empty.
|
|
||||||
|
|
||||||
|
--- Like inventory_overlay but only used in the same situation as wield_image
|
||||||
|
--- @type string
|
||||||
wield_overlay = "",
|
wield_overlay = "",
|
||||||
-- Like inventory_overlay but only used in the same situation as wield_image
|
|
||||||
|
|
||||||
|
--- Scale for the item when held in hand
|
||||||
|
--- @type Position scale vector
|
||||||
wield_scale = {x = 1, y = 1, z = 1},
|
wield_scale = {x = 1, y = 1, z = 1},
|
||||||
-- Scale for the item when held in hand
|
|
||||||
|
|
||||||
|
--- An image file containing the palette of a node.
|
||||||
|
--- You can set the currently used color as the "palette_index" field of
|
||||||
|
--- the item stack metadata.
|
||||||
|
--- The palette is always stretched to fit indices between 0 and 255, to
|
||||||
|
--- ensure compatibility with "colorfacedir" (and similar) nodes.
|
||||||
|
--- @type string
|
||||||
palette = "",
|
palette = "",
|
||||||
-- An image file containing the palette of a node.
|
|
||||||
-- You can set the currently used color as the "palette_index" field of
|
|
||||||
-- the item stack metadata.
|
|
||||||
-- The palette is always stretched to fit indices between 0 and 255, to
|
|
||||||
-- ensure compatibility with "colorfacedir" (and similar) nodes.
|
|
||||||
|
|
||||||
|
--- Color the item is colorized with. The palette overrides this.
|
||||||
|
--- @type string|ColorSpec
|
||||||
color = "#ffffffff",
|
color = "#ffffffff",
|
||||||
-- Color the item is colorized with. The palette overrides this.
|
|
||||||
|
|
||||||
|
--- Maximum amount of items that can be in a single stack.
|
||||||
|
--- The default can be changed by the setting `default_stack_max`
|
||||||
|
--- @type number
|
||||||
stack_max = 99,
|
stack_max = 99,
|
||||||
-- Maximum amount of items that can be in a single stack.
|
|
||||||
-- The default can be changed by the setting `default_stack_max`
|
|
||||||
|
|
||||||
|
--- Range of node and object pointing that is possible with this item held
|
||||||
|
--- @type number
|
||||||
range = 4.0,
|
range = 4.0,
|
||||||
-- Range of node and object pointing that is possible with this item held
|
|
||||||
|
|
||||||
|
--- If true, item can point to all liquid nodes (`liquidtype ~= "none"`),
|
||||||
|
--- even those for which `pointable = false`
|
||||||
|
--- @type boolean
|
||||||
liquids_pointable = false,
|
liquids_pointable = false,
|
||||||
-- If true, item can point to all liquid nodes (`liquidtype ~= "none"`),
|
|
||||||
-- even those for which `pointable = false`
|
|
||||||
|
|
||||||
|
--- When used for nodes: Defines amount of light emitted by node.
|
||||||
|
--- Otherwise: Defines texture glow when viewed as a dropped item
|
||||||
|
--- To set the maximum (14), use the value 'minetest.LIGHT_MAX'.
|
||||||
|
--- A value outside the range 0 to minetest.LIGHT_MAX causes undefined
|
||||||
|
--- behavior.
|
||||||
|
--- @type number
|
||||||
light_source = 0,
|
light_source = 0,
|
||||||
-- When used for nodes: Defines amount of light emitted by node.
|
|
||||||
-- Otherwise: Defines texture glow when viewed as a dropped item
|
|
||||||
-- To set the maximum (14), use the value 'minetest.LIGHT_MAX'.
|
|
||||||
-- A value outside the range 0 to minetest.LIGHT_MAX causes undefined
|
|
||||||
-- behavior.
|
|
||||||
|
|
||||||
-- See "Tool Capabilities" section for an example including explanation
|
--- See "Tool Capabilities" section for an example including explanation
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
max_drop_level = 0,
|
max_drop_level = 0,
|
||||||
|
--- For example:
|
||||||
|
--- `choppy = {times = {2.50, 1.40, 1.00}, uses = 20, maxlevel = 2}`,
|
||||||
groupcaps = {
|
groupcaps = {
|
||||||
-- For example:
|
--- For example:
|
||||||
choppy = {times = {2.50, 1.40, 1.00}, uses = 20, maxlevel = 2},
|
choppy = {times = {2.50, 1.40, 1.00}, uses = 20, maxlevel = 2},
|
||||||
},
|
},
|
||||||
damage_groups = {groupname = damage},
|
--- Damage values must be between -32768 and 32767 (2^15)
|
||||||
-- Damage values must be between -32768 and 32767 (2^15)
|
--- @type table<string,number>
|
||||||
|
damage_groups = {groupname = 7},
|
||||||
|
|
||||||
|
--- Amount of uses this tool has for attacking players and entities
|
||||||
|
--- by punching them (0 = infinite uses).
|
||||||
|
--- For compatibility, this is automatically set from the first
|
||||||
|
--- suitable groupcap using the formula "uses * 3^(maxlevel - 1)".
|
||||||
|
--- It is recommend to set this explicitly instead of relying on the
|
||||||
|
--- fallback behavior.
|
||||||
|
--- @type number
|
||||||
punch_attack_uses = nil,
|
punch_attack_uses = nil,
|
||||||
-- Amount of uses this tool has for attacking players and entities
|
|
||||||
-- by punching them (0 = infinite uses).
|
|
||||||
-- For compatibility, this is automatically set from the first
|
|
||||||
-- suitable groupcap using the formula "uses * 3^(maxlevel - 1)".
|
|
||||||
-- It is recommend to set this explicitly instead of relying on the
|
|
||||||
-- fallback behavior.
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
--- If nil and item is node, prediction is made automatically.
|
||||||
|
--- If nil and item is not a node, no prediction is made.
|
||||||
|
--- If "" and item is anything, no prediction is made.
|
||||||
|
--- Otherwise should be name of node which the client immediately places
|
||||||
|
--- on ground when the player places the item. Server will always update
|
||||||
|
--- with actual result shortly.
|
||||||
|
--- @type string
|
||||||
node_placement_prediction = nil,
|
node_placement_prediction = nil,
|
||||||
-- If nil and item is node, prediction is made automatically.
|
|
||||||
-- If nil and item is not a node, no prediction is made.
|
|
||||||
-- If "" and item is anything, no prediction is made.
|
|
||||||
-- Otherwise should be name of node which the client immediately places
|
|
||||||
-- on ground when the player places the item. Server will always update
|
|
||||||
-- with actual result shortly.
|
|
||||||
|
|
||||||
|
--- if "", no prediction is made.
|
||||||
|
--- if "air", node is removed.
|
||||||
|
--- Otherwise should be name of node which the client immediately places
|
||||||
|
--- upon digging. Server will always update with actual result shortly.
|
||||||
|
--- @type string
|
||||||
node_dig_prediction = "air",
|
node_dig_prediction = "air",
|
||||||
-- if "", no prediction is made.
|
|
||||||
-- if "air", node is removed.
|
|
||||||
-- Otherwise should be name of node which the client immediately places
|
|
||||||
-- upon digging. Server will always update with actual result shortly.
|
|
||||||
|
|
||||||
|
--- Definition of item sounds to be played at various events.
|
||||||
|
--- All fields in this table are optional.
|
||||||
sound = {
|
sound = {
|
||||||
-- Definition of item sounds to be played at various events.
|
|
||||||
-- All fields in this table are optional.
|
|
||||||
|
|
||||||
|
--- When tool breaks due to wear. Ignored for non-tools
|
||||||
--- @type SimpleSoundSpec
|
--- @type SimpleSoundSpec
|
||||||
breaks = nil,
|
breaks = nil,
|
||||||
-- When tool breaks due to wear. Ignored for non-tools
|
|
||||||
|
|
||||||
|
--- When item is eaten with `minetest.do_item_eat`
|
||||||
--- @type SimpleSoundSpec
|
--- @type SimpleSoundSpec
|
||||||
eat = nil,
|
eat = nil,
|
||||||
-- When item is eaten with `minetest.do_item_eat`
|
|
||||||
|
|
||||||
|
--- When item is used with the 'punch/mine' key pointing at a node or entity
|
||||||
--- @type SimpleSoundSpec
|
--- @type SimpleSoundSpec
|
||||||
punch_use = nil,
|
punch_use = nil,
|
||||||
-- When item is used with the 'punch/mine' key pointing at a node or entity
|
|
||||||
|
|
||||||
|
--- When item is used with the 'punch/mine' key pointing at nothing (air)
|
||||||
--- @type SimpleSoundSpec
|
--- @type SimpleSoundSpec
|
||||||
punch_use_air = nil,
|
punch_use_air = nil,
|
||||||
-- When item is used with the 'punch/mine' key pointing at nothing (air)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
--- When the 'place' key was pressed with the item in hand
|
--- When the 'place' key was pressed with the item in hand
|
||||||
|
|||||||
@@ -261,6 +261,7 @@ function minetest.log(level, text) end
|
|||||||
--- @param node_definition NodeDefinition table with node definition properties.
|
--- @param node_definition NodeDefinition table with node definition properties.
|
||||||
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4471-L4471)
|
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4471-L4471)
|
||||||
function minetest.register_node(name, node_definition) end
|
function minetest.register_node(name, node_definition) end
|
||||||
|
--- @param item_definition ItemDefinition
|
||||||
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4472-L4472)
|
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4472-L4472)
|
||||||
function minetest.register_craftitem(name, item_definition) end
|
function minetest.register_craftitem(name, item_definition) end
|
||||||
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4473-L4473)
|
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4473-L4473)
|
||||||
|
|||||||
Reference in New Issue
Block a user