Compare commits

...

8 Commits

15 changed files with 790 additions and 657 deletions

View File

@@ -1,114 +1,166 @@
--- @meta
---Version: 5.18
---@meta
--- @class ItemStack
--- @overload fun(x:ItemStack|ItemStackString|ItemStackTable|nil):ItemStack
---An `ItemStack` is a stack of items.
---
---`ItemStack([x])`: returns an `ItemStack`.
---
---`x`: (optional) Is one of the following:
--- * `nil` value: Empty stack
--- * `string` value: an `"itemstring"`.
--- * `table` value: `ItemStack` Table format.
--- * The `name` field is mandatory.
---@class ItemStack
---@overload fun(x:ItemStack|ItemStackString|ItemStackTable|nil):ItemStack
ItemStack = {}
--- @class ItemStackTable: table
--- @field name string
--- @field count number
--- @field wear number
--- @field metadata string
---@class ItemStackTable: table
---@field name string
---@field count number
---@field wear number
---@field metadata string
--- @alias ItemStackString string
---@alias ItemStackString string
--- Put some item or stack onto this stack, returns leftover ItemStack
--- @param item ItemStack|ItemStackString|ItemStackTable
--- @return self
function ItemStack:add_item(item) end
--- Increases wear by amount if the item is a tool, otherwise does nothing.
--- Wear is only added if the item is a tool. Adding wear might destroy the item.
--- @param amount number Valid amount range is [0,65536]
--- @return boolean Returns true if the item is (or was) a tool.
function ItemStack:add_wear(amount) end
--- Removes all items from the stack, making it empty
--- @return boolean it seams that it always return `true`
function ItemStack:clear() end
--- Returns number of items on the stack
--- @return integer
function ItemStack:get_count() end
--- Returns true/false (success), clears item on failure
--- @param count number count > 0 && count <= 65535 -- or clears
--- @return boolean
function ItemStack:set_count(count) end
--- @return ItemDefinition returns the item definition table
function ItemStack:get_definition() end
--- Returns get_stack_max() - get_count()
--- @return number
function ItemStack:get_free_space() end
--- @return ItemStackMetaRef
function ItemStack:get_meta() end
--- Returns a string, for compatibility reasons this is equal to get_meta():get_string("")
--- @deprecated
function ItemStack:get_metadata() end
--- Returns item name (e.g. "default:stone")
--- @return ItemStackString
function ItemStack:get_name() end
--- Returns true/false (success), clears item on failure
--- @param item_name string
--- @return boolean
function ItemStack:set_name(item_name) end
--- Returns the maximum size of the stack (depends on the item)
--- @return number
function ItemStack:get_stack_max() end
--- Returns the digging properties of the item, or those of the hand if none are defined for this item type
--- @return table
function ItemStack:get_tool_capabilities() end
--- Returns tool wear (0-65535), 0 for non-tools
--- @return number
function ItemStack:get_wear() end
--- Returns true/false (success), clears item on failure
--- @param wear number wear <= 65535, otherwise clears
--- @return boolean
function ItemStack:set_wear(wear) end
--- Return true if stack is empty
--- @return boolean
---Returns true if stack is empty.
---@return boolean
function ItemStack:is_empty() end
--- Returns true if the item name refers to a defined item type
--- @return boolean
function ItemStack:is_known() end
---Returns item name (e.g. `"default:stone"`).
---@return string
function ItemStack:get_name() end
--- Returns true if item or stack can be fully added to this one
--- @param item ItemStack|ItemStackString|ItemStackTable
--- @return boolean
function ItemStack:item_fits(item) end
---Sets the item name.
---
---Returns `false` if the stack was cleared, `true` otherwise.
---@param item_name string
---@return boolean
function ItemStack:set_name(item_name) end
--- Copy (don't remove) up to n items from this stack; returns copied ItemStack; if n is omitted, n=1 is used
--- @param count number
--- @return ItemStack
function ItemStack:peek_item(count) end
---Returns amount of items on the stack.
---@return integer
function ItemStack:get_count() end
--- Replace the contents of this stack (item can also be an itemstring or table)
--- @param item ItemStack|ItemStackString|ItemStackTable
--- @return boolean seams always `true`
---Sets amount of items in the stack.
---
---Returns `false` if the stack was cleared, `true` otherwise.
---@param count integer
---@return boolean
function ItemStack:set_count(count) end
---Returns tool wear (integer in range [0, 65535]), `0` for non-tools.
---@return integer
function ItemStack:get_wear() end
---Set tool wear.
---
---Returns `false` if the stack was cleared, `true` otherwise
---@param wear integer
---@return boolean
function ItemStack:set_wear(wear) end
---@return ItemStackMetaRef
function ItemStack:get_meta() end
---@deprecated
function ItemStack:get_metadata() end
---@deprecated
function ItemStack:set_metadata() end
---Returns the description shown in inventory list tooltips.
---@return string
function ItemStack:get_description() end
---Returns the short description.
---@return string
function ItemStack:get_short_description() end
---Removes all items from the stack, making it empty.
function ItemStack:clear() end
---Replace the contents of this stack.
---@param item ItemStack|ItemStackString|ItemStackTable
function ItemStack:replace(item) end
--- Take (and remove) up to n items from this stack; returns taken ItemStack; if n is omitted, n=1 is used
--- @param count? number
--- @return ItemStack
function ItemStack:take_item(count) end
--- Returns the stack in itemstring form
--- @return string
---Returns the stack in `itemstring` form.
---@return string
function ItemStack:to_string() end
--- Returns the stack in Lua table form or `nil` if empty.
--- @return table|nil
---Returns the stack in Lua table form.
---
---Returns `nil` if the stack is empty
---@return ItemStackTable?
function ItemStack:to_table() end
---Returns the maximum size of the stack (depends on the item).
---@return integer
function ItemStack:get_stack_max() end
---Returns `get_stack_max() - get_count()`.
---@return integer
function ItemStack:get_free_space() end
---Returns `true` if the item name refers to a defined item type.
---@return boolean
function ItemStack:is_known() end
---Returns the item definition table.
---
---Returns the definition of the `unknown` item if the item is not registered.
---@return ItemDefinition|NodeDefinition
function ItemStack:get_definition() end
---Returns the digging properties of the item,
---or those of the hand if none are defined for this item type.
---@return ItemDefinition.tool_capabilities_table
function ItemStack:get_tool_capabilities() end
---Increases wear by `amount` if the item is a tool, otherwise does nothing.
---@param amount integer
function ItemStack:add_wear(amount) end
---Increases wear in such a way that,
---if only this function is called, the item breaks after `max_uses` times.
---
---Does nothing if item is not a tool or if `max_uses` is `0`.
---@param max_uses integer
function ItemStack:add_wear_by_uses(max_uses) end
---Returns the wear bar parameters of the item,
---or nil if none are defined for this item type or in the stack's meta.
---@return ItemDefinition.wearbar_color_table
function ItemStack:get_wear_bar_params() end
---Put some item or stack onto this stack.
---
---Returns leftover ItemStack.
---@param item ItemStack|ItemStackString|ItemStackTable
---@return self
function ItemStack:add_item(item) end
---Returns `true` if item or stack can be fully added to this one
---@param item ItemStack|ItemStackString|ItemStackTable
---@return boolean
function ItemStack:item_fits(item) end
---Take (and remove) up to `n` items from this stack.
---@param count number? default: `1`
---@return ItemStack
function ItemStack:take_item(count) end
---Copy (don't remove) up to `n` items from this stack.
---@param count number? default: `1`
---@return ItemStack
function ItemStack:peek_item(count) end
---Returns `true` if this stack is identical to other.
---
---**Note**: stack1:to_string() == stack2:to_string() is not reliable,
---as stack metadata can be serialized in arbitrary order.
---
---**Note**: if other is an itemstring or table representation of an ItemStack,
---this will always return false, even if it is "equivalent".
---@param other ItemStack|ItemStackString|ItemStackTable
---@return boolean
function ItemStack:equals(other) end

View File

@@ -1,15 +1,47 @@
--- @meta
---Version: 5.18
---@meta
--- ItemStack metadata: reference extra data and functionality stored in a stack.
--- Can be obtained via `item:get_meta()`.
---@alias ItemStackMetaRef.IntKey
---|string
---|'palette_index' -- TODO: уточнить, точно ли в int?
---|'count_alignment'
---@alias ItemStackMetaRef.FloatKey
---|string
---|'range'
---@alias ItemStackMetaRef.StringKey
---|string
---|'description'
---|'short_description'
---|'inventory_image'
---|'inventory_overlay'
---|'wield_image'
---|'wield_overlay'
---|'wield_scale'
---|'color'
---|'count_meta'
---ItemStack metadata: reference extra data and functionality stored in a stack.
---
--- @class ItemStackMetaRef: MetaDataRef
---Can be obtained via `item:get_meta()`.
---@class ItemStackMetaRef: MetaDataRef
---@field get_int fun(self, key:ItemStackMetaRef.IntKey):integer
---@field set_int fun(self, key:ItemStackMetaRef.IntKey, value:integer)
---@field get_float fun(self, key:ItemStackMetaRef.FloatKey):number
---@field set_float fun(self, key:ItemStackMetaRef.FloatKey, value:number)
---@field get_string fun(self, key:ItemStackMetaRef.StringKey):string
---@field set_string fun(self, key:ItemStackMetaRef.StringKey, value:string)
ItemStackMetaRef = {}
--- * Overrides the item's tool capabilities
--- * A nil value will clear the override data and restore the original behavior.
---Overrides the item's tool capabilities.
---
---A `nil` value will clear the override data and restore the original behavior.
---@param tool_capabilities ItemDefinition.tool_capabilities_table
function ItemStackMetaRef:set_tool_capabilities(tool_capabilities) end
--- * Overrides the item's wear bar parameters (see "Wear Bar Color" section)
--- * A nil value will clear the override data and restore the original behavior.
---Overrides the item's wear bar parameters (see "Wear Bar Color" section)
---
---A `nil` value will clear the override data and restore the original behavior.
---@param wear_bar_params ItemDefinition.wearbar_color_table
function ItemStackMetaRef:set_wear_bar_params(wear_bar_params) end

View File

@@ -308,7 +308,7 @@ function Player:hud_set_hotbar_itemcount(count) end
function Player:hud_get_hotbar_itemcount() end
--- Sets background image for hotbar.
--- @param string
--- @param texturename string
function Player:hud_set_hotbar_image(texturename) end
--- Returns texturename.
@@ -316,7 +316,7 @@ function Player:hud_set_hotbar_image(texturename) end
function Player:hud_get_hotbar_image() end
--- Sets image for selected item of hotbar.
--- @param string
--- @param texturename string
function Player:hud_set_hotbar_selected_image(texturename) end
--- Returns texturename.

View File

@@ -239,57 +239,6 @@ function core.get_hit_params(groups, tool_capabilities , time_from_last_punch) e
-- Translations
--- is a simple wrapper around
--- `core.translate`, and `core.get_translator(textdomain)(str, ...)` is
--- equivalent to `core.translate(textdomain, str, ...)`.
--- It is intended to be used in the following way, so that it avoids verbose
--- repetitions of `core.translate`:
---
--- local S = core.get_translator(textdomain)
--- S(str, ...)
---
--- As an extra commodity, if `textdomain` is nil, it is assumed to be "" instead.
---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3329-L3338)
---
--- @param text_domain string
--- @return fun(str: string, ...):string
function core.get_translator(text_domain) end
--- translates the string `str` with
--- the given `textdomain` for disambiguation. The textdomain must match the
--- textdomain specified in the translation file in order to get the string
--- translated. This can be used so that a string is translated differently in
--- different contexts.
--- It is advised to use the name of the mod as textdomain whenever possible, to
--- avoid clashes with other mods.
--- This function must be given a number of arguments equal to the number of
--- arguments the translated string expects.
--- Arguments are literal strings -- they will not be translated, so if you want
--- them to be, they need to come as outputs of `core.translate` as well.
---
--- For instance, suppose we want to translate "@1 Wool" with "@1" being replaced
--- by the translation of "Red". We can do the following:
---
--- local S = core.get_translator()
--- S("@1 Wool", S("Red"))
---
--- This will be displayed as "Red Wool" on old clients and on clients that do
--- not have localization enabled. However, if we have for instance a translation
--- file named `wool.fr.tr` containing the following:
---
--- \@1 Wool=Laine @1
--- Red=Rouge
---
--- this will be displayed as "Laine Rouge" on clients with a French locale.
---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3340-L3365)
---
--- @param textdomain string
--- @param str string
--- @return string
function core.translate(textdomain, str, ...) end

View File

@@ -1,24 +1,20 @@
--- @meta
---Version: 5.18
---@meta
--- Equivalent to `core.log(table.concat({...}, "\t"))`
---Calls `core.log` with all arguments converted to string and separated by tabs (similar to print).
---
--- Calls `core.log()` with all arguments converted to string and separated by tabs (similar to print).
---
--- @param ... any
---@param ... any
function core.debug(...) end
--- @alias LogLevel
--- | "none"
--- | "error"
--- | "warning"
--- | "action"
--- | "info"
--- | "verbose"
---@alias LogLevel
---| "none"
---| "error"
---| "warning"
---| "action"
---| "info"
---| "verbose"
--- Logs a message at the specified log level.
---
--- @overload fun(text:string)
--- @param level? LogLevel # [Optional] is one of `"none"`, `"error"`, `"warning"`, `"action"`, `"info"`, or `"verbose"`. Default is `"none"`.
--- @param text string
---@overload fun(text:string)
---@param level LogLevel?
---@param text string
function core.log(level, text) end

View File

@@ -1,122 +1,93 @@
--- @meta
---Version: 5.18
---@meta
--- Environment ---
--- * register a node with its definition
--- * Note: you must pass a clean table that hasn't already been used for another registration to this function, as it will be modified.
--- @param name string technical node name ("<mod>:<node>").
--- @param node_definition NodeDefinition table with node definition properties.
---Register a node with its definition.
---
---**Note**: you must pass a clean table that hasn't already been used
---for another registration to this function, as it will be modified.
---@param name string technical node name ("<mod>:<node>").
---@param node_definition NodeDefinition table with node definition properties.
function core.register_node(name, node_definition) end
--- * register an item with its definition
--- * Note: you must pass a clean table that hasn't already been used for another registration to this function, as it will be modified.
--- @param name string technical item name ("<mod>:<item>").
--- @param item_definition ItemDefinition table with item definition properties.
---Register an item with its definition.
---
---**Note**: you must pass a clean table that hasn't already been used
---for another registration to this function, as it will be modified.
---@param name string technical item name ("<mod>:<item>").
---@param item_definition ItemDefinition table with item definition properties.
function core.register_craftitem(name, item_definition) end
--- * register a tool item with its definition
--- * Note: you must pass a clean table that hasn't already been used for another registration to this function, as it will be modified.
--- @param name string
--- @param item_definition ItemDefinition
---Register a tool item with its definition.
---
---**Note**: you must pass a clean table that hasn't already been used
---for another registration to this function, as it will be modified.
---@param name string technical item name ("<mod>:<item>").
---@param item_definition ItemDefinition table with item definition properties.
function core.register_tool(name, item_definition) end
--- Overrides fields of an item registered with register_node/tool/craftitem.
--- * `redefinition` is a table of fields `[name] = new_value`, overwriting fields of or adding fields to the existing definition.
--- * Note: Item must already be defined, (opt)depend on the mod defining it.
--- * Example: `core.override_item("default:mese", { light_source = core.LIGHT_MAX }, { "sounds" })`:
--- Overwrites the `light_source` field, removes the `sounds` from the definition of the mese block.
---Overrides fields of an item registered with register_node/tool/craftitem.
---
--- @param name string
--- @param redefinition ItemDefinition|NodeDefinition
function core.override_item(name, redefinition) end
---**Note**: Item must already be defined.
---@param name string
---@param redefinition ItemDefinition|NodeDefinition
---@param del_fields string[]
function core.override_item(name, redefinition, del_fields) end
--- Unregisters the item from the engine, and deletes the entry with key
--- `name` from `core.registered_items` and from the associated item table
--- according to its nature (e.g. `core.registered_nodes`)
---
--- @param name string
---Unregisters the item from the engine, and deletes the entry with key name
---from `core.registered_items` and from the associated item table according
---to its nature (e.g. `core.registered_nodes`)
---@param name string
function core.unregister_item(name) end
--- @param name string
--- @param entity_definition EntityDefinition
---@param name string
---@param entity_definition EntityDefinition
function core.register_entity(name, entity_definition) end
--- @param abm_definition ABMDefinition
---@param abm_definition ABMDefinition
function core.register_abm(abm_definition) end
--- @param lbm_definition LBMDefinition
---@param lbm_definition LBMDefinition
function core.register_lbm(lbm_definition) end
--- * Also use this to set the 'mapgen aliases' needed in a game for the core
--- mapgens. See [Mapgen aliases](https://api.luanti.org/aliases/#mapgen-aliases) section.
---Also use this to set the 'mapgen aliases' needed in a game for the core mapgens.
---
--- @param alias string @itemstring (`"<mod>:<node>"`). For renaming: its old name.
--- @param original_name string @itemstring (`"<mod>:<node>"`). For renaming: its new name.
---See [Mapgen aliases](https://api.luanti.org/core-namespace-reference/#mapgen-aliases) section above.
---
---Does nothing if an item named alias is already registered.
---@param alias string
---@param original_name string
function core.register_alias(alias, original_name) end
--- * Forces an alias to be created, even if an alias with the same name
--- already exists.
--- @param alias string @itemstring (`"<mod>:<node>"`). For renaming: its old name.
--- @param original_name string @itemstring (`"<mod>:<node>"`). For renaming: its new name.
---Same as core.register_alias, but an already registered item named alias is unregistered first.
---@param alias string
---@param original_name string
function core.register_alias_force(alias, original_name) end
--- * Returns an integer object handle uniquely identifying the registered ore on success.
--- * The order of ore registrations determines the order of ore generation.
---
--- @param ore_definition OreDefinition
--- @return integer
---@param ore_definition OreDefinition
---@return integer
function core.register_ore(ore_definition) end
--- * Returns an integer object handle uniquely identifying the registered
--- biome on success. To get the biome ID, use `core.get_biome_id`.
---
--- @param biome_definition BiomeDefinition
--- @return integer
---@param biome_definition BiomeDefinition
---@return integer
function core.register_biome(biome_definition) end
--- * Unregisters the biome from the engine, and deletes the entry with key
--- `name` from `core.registered_biomes`.
--- * Warning: This alters the biome to biome ID correspondences, so any
--- decorations or ores using the 'biomes' field must afterwards be cleared
--- and re-registered.
---
--- @param name string
---@param name string
function core.unregister_biome(name) end
--- * Returns an integer object handle uniquely identifying the registered
--- decoration on success. To get the decoration ID, use
--- `core.get_decoration_id`.
--- * The order of decoration registrations determines the order of decoration
--- generation.
---
--- @param decoration_definition DecorationDefinition
--- @return integer
---@param decoration_definition DecorationDefinition
---@return integer
function core.register_decoration(decoration_definition) end
--- * Returns an integer object handle uniquely identifying the registered
--- schematic on success.
--- * If the schematic is loaded from a file, the `name` field is set to the
--- filename.
--- * If the function is called when loading the mod, and `name` is a relative
--- path, then the current mod path will be prepended to the schematic
--- filename.
---
--- @param schematic SchematicSpecifier|string
--- @param replacements? table?
--- @return integer
function core.register_schematic(schematic, replacements) end
---@param schematic_definition SchematicSpecifier|string
---@return integer
function core.register_schematic(schematic_definition) end
--- * Clears all biomes currently registered.
--- * Warning: Clearing and re-registering biomes alters the biome to biome ID
--- correspondences, so any decorations or ores using the 'biomes' field must
--- afterwards be cleared and re-registered.
function core.clear_registered_biomes() end
--- * Clears all decorations currently registered.
function core.clear_registered_decorations() end
--- * Clears all ores currently registered.
function core.clear_registered_ores() end
--- * Clears all schematics currently registered.
function core.clear_registered_schematics() end

View File

@@ -1,72 +1,29 @@
--- @meta
---Version: 5.18
---@meta
--- Gameplay ---
--- Registers a crafting recipe.
--- * Check recipe table syntax for different types below.
--- [TODO]: Link to recipe table syntax documentation.
--- @param recipe table
---@param recipe table
function core.register_craft(recipe) end
--- * Will erase existing craft based either on output item or on input recipe.
--- * Specify either output or input only. If you specify both, input will be
--- ignored. For input use the same recipe table syntax as for
--- `core.register_craft(recipe)`. For output specify only the item,
--- without a quantity.
--- * Returns false if no erase candidate could be found, otherwise returns true.
--- * **Warning**! The type field ("shaped", "cooking" or any other) will be
--- ignored if the recipe contains output. Erasing is then done independently
--- from the crafting method.
---
--- @param recipe table
--- @return boolean
---@param recipe table
---@return boolean
function core.clear_craft(recipe) end
--- Registers a chatcommand.
--- * `cmd` is the name of the command without the leading slash.
--- * `chatcommand_definition` is a table containing the following fields:
--- * `description` (string) A short description of the command.
--- * `params` (string) A string describing the parameters of the command.
--- * `privs` (table) A table specifying the privileges required to use the command.
--- * `func` (function) The function to be called when the command is executed. \
--- It receives two parameters:
--- * `name` (string) the name of the player who executed the command, and
--- * `param` (string) the parameters passed to the command.
---
--- It should return two values:
--- * `success` (boolean) and
--- * `message` (string).
---
--- If `success` is false, `message` will be sent to the player as an error message. \
--- If `success` is true, `message` will be sent as a regular chat message.
--- If it returns `false` and no `message`, the help message is shown.
---
--- @param cmd string
--- @param chatcommand_definition ChatCommandDefinition
---@param cmd string
---@param chatcommand_definition ChatCommandDefinition
function core.register_chatcommand(cmd, chatcommand_definition) end
--- Overrides fields of a chatcommand registered with `register_chatcommand`.
---
--- @param name string
--- @param redefinition ChatCommandDefinition
---@param name string
---@param redefinition ChatCommandDefinition
function core.override_chatcommand(name, redefinition) end
--- Unregisters a chatcommands registered with `register_chatcommand`.
---
--- @param name string
---@param name string
function core.unregister_chatcommand(name) end
--- Registers a privilege.
--- * `definition` can be a description or a definition table
--- * If it is a description, the priv will be granted to singleplayer and admin by default.
--- * To allow players with `basic_privs` to grant, see the `basic_privs` minetest.conf setting.
---
--- @param name string
--- @param definition string|PrivilegeDefinition
---@param name string
---@param definition string|PrivilegeDefinition
function core.register_privilege(name, definition) end
--- Registers an authentication handler.
--- * Registers an auth handler that overrides the builtin one.
--- * This function can be called by a single mod once only.
---
--- @param authentication_handler_definition AuthenticationHandlerDefinition
---@param authentication_handler_definition AuthenticationHandlerDefinition
function core.register_authentication_handler(authentication_handler_definition) end

View File

@@ -0,0 +1,60 @@
---Version: 5.18
---@meta
--- Translations ---
---Is a simple wrapper around `core.translate` and `core.translate_n`.
---
---After `local S, PS = core.get_translator(textdomain)`,
---we have `S(str, ...)` equivalent to `core.translate(textdomain, str, ...)`, and
---`PS(str, str_plural, n, ...)` to `core.translate_n(textdomain, str, str_plural, n, ...)`.
---It is intended to be used in the following way,
---so that it avoids verbose repetitions of `core.translate`:
---```lua
--- local S, PS = core.get_translator(textdomain)
--- S(str, ...)
---```
---
---As an extra commodity, if `textdomain` is nil, it is assumed to be `""` instead.
---@param textdomain string?
---@return fun(str:string, ...):string, fun(str:string, ...):string
function core.get_translator(textdomain) end
---Translates the string `str` with the given `textdomain` for disambiguation.
---
---The textdomain must match the textdomain specified in the translation file
---in order to get the string translated. This can be used so that a string
---is translated differently in different contexts. It is advised to use
---the name of the mod as textdomain whenever possible, to avoid clashes with other mods.
---
---This function must be given an amount of arguments equal to the amount of arguments
---the translated string expects. Arguments are literal strings -- they will not be translated.
---@param textdomain string
---@param str string
---@param ... string
---@return string
function core.translate(textdomain, str, ...) end
---Translates the string `str` with the given `textdomain` for disambiguation.
---
---The value of `n`, which must be a nonnegative integer,
---is used to decide whether to use the singular or the plural version of the string.
---
---Depending on the locale of the client, the choice between singular and plural
---might be more complicated, but the choice will be done automatically using the value of `n`.
---@param textdomain string
---@param str string
---@param str_plural string
---@param n string
---@param ... string
---@return string
function core.translate_n(textdomain, str, str_plural, n, ...) end
---Resolves translations in the given string just like the client would,
---using the translation files for `lang_code`. For this to have any effect,
---the string needs to contain translation markup,
---e.g. `core.get_translated_string("fr", S("Hello"))`.
---@param lang_code string
---@param str string
---@return string
function core.get_translated_string(lang_code, str) end

View File

@@ -1,370 +1,288 @@
--- @meta
---Version: 5.18
---@meta
--- Utilities ---
--- Returns the currently loading mod's name, when loading a mod.
--- - Returns nil if not loading a mod.
--- - Only works during mod loading (i.e. when a mod calls this function from
--- its top-level scope, or from a function called during mod loading).
--- - Useful for libraries to determine which mod is loading them, for
--- example to access that mod's mod storage.
--- @see core.get_modpath
--- @see core.get_modnames
--- @see core.get_worldpath
--- @return string returns the currently loading mod's name, when loading a mod.
---Returns the currently loading mod's name, when loading a mod.
---@return string
function core.get_current_modname() end
--- Returns the directory path for a mod, e.g. "/home/user/.minetest/usermods/modname".
--- - Returns nil if the mod is not enabled or does not exist (not installed).
--- - Works regardless of whether the mod has been loaded yet.
--- - Useful for loading additional `.lua` modules or static data from a mod, or checking if a mod is enabled.
--- @param mod_name string
--- @return string
function core.get_modpath(mod_name) end
---Returns the directory path for a mod, e.g. `"/home/user/.minetest/"`
---@param modname string
---@return string?
function core.get_modpath(modname) end
--- Returns a list of enabled mods, sorted alphabetically.
--- - Does not include disabled mods, even if they are installed.
--- @return table
function core.get_modnames() end
---Returns a list of the mods' names that are loaded or are yet to be loaded during startup.
---@param load_order boolean?
function core.get_modnames(load_order) end
--- @class GameInfo
--- @field id string
--- @field title string
--- @field author string
--- @field path string The root directory of the game.
---@class Core.GameInfo
---@field id string
---@field title string
---@field author string
---@field path string The root directory of the game.
--- Returns a table containing information about the current game.
--- Note that other meta information (e.g. version/release number)
--- can be manually read from `game.conf` in the game's root directory.
---Returns a table containing information about the current game.
---
--- @return GameInfo
---Note that other meta information (e.g. version/release number)
---can be manually read from game.conf in the game's root directory.
---@return Core.GameInfo
function core.get_game_info() end
--- Returns e.g. "/home/user/.minetest/world"
--- - Useful for storing custom data
--- @return string
---Returns e.g. `"/home/user/.minetest/world"`.
---@return string
function core.get_worldpath() end
--- Returns e.g. "/home/user/.minetest/mod_data/mymod"
--- - Useful for storing custom data independently of worlds.
--- - Must be called during mod load time.
--- - Can read or write to this directory at any time.
--- - It's possible that multiple Minetest instances are running at the same time, which may lead to corruption if you are not careful.
--- @return string
---Returns e.g. `"/home/user/.minetest/mod_data/mymod"`
---@return string
function core.get_mod_data_path() end
--- @return boolean
---Returns `true` if the server is running in singleplayer mode, `false` otherwise.
---@return boolean
function core.is_singleplayer() end
---@class Core.Features
---@field glasslike_framed boolean
---@field nodebox_as_selectionbox boolean
---@field get_all_craft_recipes_works boolean
---@field use_texture_alpha boolean
---@field no_legacy_abms boolean
---@field texture_names_parens boolean
---@field area_store_custom_ids boolean
---@field add_entity_with_staticdata boolean
---@field no_chat_message_prediction boolean
---@field object_use_texture_alpha boolean
---@field object_independent_selectionbox boolean
---@field httpfetch_binary_data boolean
---@field formspec_version_element boolean
---@field area_store_persistent_ids boolean
---@field pathfinder_works boolean
---@field object_step_has_moveresult boolean
---@field direct_velocity_on_players boolean
---@field use_texture_alpha_string_modes boolean
---@field degrotate_240_steps boolean
---@field abm_min_max_y boolean
---@field dynamic_add_media_table boolean
---@field particlespawner_tweenable boolean
---@field get_sky_as_table boolean
---@field get_light_data_buffer boolean
---@field mod_storage_on_disk boolean
---@field compress_zstd boolean
---@field sound_params_start_time boolean
---@field physics_overrides_v2 boolean
---@field hud_def_type_field boolean
---@field random_state_restore boolean
---@field after_order_expiry_registration boolean
---@field wallmounted_rotate boolean
---@field item_specific_pointabilities boolean
---@field blocking_pointability_type boolean
---@field dynamic_add_media_startup boolean
---@field dynamic_add_media_filepath boolean
---@field lsystem_decoration_type boolean
---@field item_meta_range boolean
---@field node_interaction_actor boolean
---@field moveresult_new_pos boolean
---@field override_item_remove_fields boolean
---@field hotbar_hud_element boolean
---@field bulk_lbms boolean
---@field abm_without_neighbors boolean
---@field biome_weights boolean
---@field particle_blend_clip boolean
---@field remove_item_match_meta boolean
---@field httpfetch_additional_methods boolean
---@field object_guids boolean
---@field on_timer_four_args boolean
---@field particlespawner_exclude_player boolean
---@field generate_decorations_biomes boolean
---@field chunksize_vector boolean
---@field item_image_animation boolean
---@field get_modnames_load_order boolean
---@field set_camera_resettable boolean
---@field hud_hideable_field boolean
---@field compress_raw_deflate boolean
---@field get_all_craft_recipes_fuel boolean
---@field get_all_craft_recipes_replacements boolean
--- Table containing API feature flags
--- @type table
core.features = {
--- @since 0.4.7
glasslike_framed = true,
--- @since 0.4.7
nodebox_as_selectionbox = true,
--- @since 0.4.7
get_all_craft_recipes_works = true,
--- The transparency channel of textures can optionally be used on nodes
--- @since 0.4.7
use_texture_alpha = true,
--- Tree and grass ABMs are no longer done from C++
--- @since 0.4.8
no_legacy_abms = true,
--- Texture grouping is possible using parentheses
--- @since 0.4.11
texture_names_parens = true,
--- Unique Area ID for AreaStore:insert_area
--- @since 0.4.14
area_store_custom_ids = true,
--- add_entity supports passing initial staticdata to on_activate
--- @since 0.4.16
add_entity_with_staticdata = true,
--- Chat messages are no longer predicted
--- @since 0.4.16
no_chat_message_prediction = true,
--- The transparency channel of textures can optionally be used on
--- objects (ie: players and lua entities)
--- @since 5.0.0
object_use_texture_alpha = true,
--- Object selectionbox is settable independently from collisionbox
--- @since 5.0.0
object_independent_selectionbox = true,
--- Specifies whether binary data can be uploaded or downloaded using the HTTP API
--- @since 5.1.0
httpfetch_binary_data = true,
--- Whether formspec_version[<version>] may be used
--- @since 5.1.0
formspec_version_element = true,
--- Whether AreaStore's IDs are kept on save/load
--- @since 5.1.0
area_store_persistent_ids = true,
--- Whether core.find_path is functional
--- @since 5.2.0
pathfinder_works = true,
--- Whether Collision info is available to an objects' on_step
--- @since 5.3.0
object_step_has_moveresult = true,
--- Whether get_velocity() and add_velocity() can be used on players
--- @since 5.4.0
direct_velocity_on_players = true,
--- nodedef's use_texture_alpha accepts new string modes
--- @since 5.4.0
use_texture_alpha_string_modes = true,
--- degrotate param2 rotates in units of 1.5° instead of 2°
--- thus changing the range of values from 0-179 to 0-240
--- @since 5.5.0
degrotate_240_steps = true,
--- ABM supports min_y and max_y fields in definition
--- @since 5.5.0
abm_min_max_y = true,
--- dynamic_add_media supports passing a table with options
--- @since 5.5.0
dynamic_add_media_table = true,
--- particlespawners support texpools and animation of properties,
--- particle textures support smooth fade and scale animations, and
--- sprite-sheet particle animations can by synced to the lifetime
--- of individual particles
--- @since 5.6.0
particlespawner_tweenable = true,
--- allows get_sky to return a table instead of separate values
--- @since 5.6.0
get_sky_as_table = true,
--- VoxelManip:get_light_data accepts an optional buffer argument
--- @since 5.7.0
get_light_data_buffer = true,
--- When using a mod storage backend that is not "files" or "dummy",
--- the amount of data in mod storage is not constrained by
--- the amount of RAM available.
--- @since 5.7.0
mod_storage_on_disk = true,
--- "zstd" method for compress/decompress
--- @since 5.7.0
compress_zstd = true,
--- Sound parameter tables support start_time
--- @since 5.8.0
sound_params_start_time = true,
--- New fields for set_physics_override: speed_climb, speed_crouch,
--- liquid_fluidity, liquid_fluidity_smooth, liquid_sink,
--- acceleration_default, acceleration_air
--- @since 5.8.0
physics_overrides_v2 = true,
--- In HUD definitions the field `type` is used and `hud_elem_type` is deprecated
--- @since 5.9.0
hud_def_type_field = true,
--- PseudoRandom and PcgRandom state is restorable
--- PseudoRandom has get_state method
--- PcgRandom has get_state and set_state methods
--- @since 5.9.0
random_state_restore = true,
--- core.after guarantees that coexisting jobs are executed primarily
--- in order of expiry and secondarily in order of registration
--- @since 5.9.0
after_order_expiry_registration = true,
--- wallmounted nodes mounted at floor or ceiling may additionally
--- be rotated by 90° with special param2 values
--- @since 5.9.0
wallmounted_rotate = true,
--- Availability of the `pointabilities` property in the item definition
--- @since 5.9.0
item_specific_pointabilities = true,
--- Nodes `pointable` property can be `"blocking"`
--- @since 5.9.0
blocking_pointability_type = true,
--- dynamic_add_media can be called at startup when leaving callback as `nil`
--- @since 5.9.0
dynamic_add_media_startup = true,
--- dynamic_add_media supports `filename` and `filedata` parameters
--- @since 5.9.0
dynamic_add_media_filepath = true,
--- L-system decoration type
--- @since 5.9.0
lsystem_decoration_type = true,
--- Overrideable pointing range using the itemstack meta key `"range"`
--- @since 5.9.0
item_meta_range = true,
--- Allow passing an optional "actor" ObjectRef to the following functions:
--- core.place_node, core.dig_node, core.punch_node
--- @since 5.9.0
node_interaction_actor = true,
--- "new_pos" field in entity moveresult
--- @since 5.9.0
moveresult_new_pos = true,
--- Allow removing definition fields in `core.override_item`
override_item_remove_fields = true,
}
---Table containing server-side API feature flags.
---@type Core.Features
core.features = nil
--- Returns `boolean, missing_features`
--- * `arg`: string or table in format `{foo=true, bar=true}`
--- * `missing_features`: `{foo=true, bar=true}`
--- @param arg string|table
--- @return boolean,table<string,boolean>
---Checks for server-side feature availability.
---@param arg string|table
---@return boolean
---@return table<string,boolean> missing_features
function core.has_feature(arg) end
--- Table containing information
--- about a player. Example return value:
--- ```lua
--- {
--- address = "127.0.0.1", -- IP address of client
--- ip_version = 4, -- IPv4 / IPv6
--- connection_uptime = 200, -- seconds since client connected
--- protocol_version = 32, -- protocol version used by client
--- formspec_version = 2, -- supported formspec version
--- lang_code = "fr" -- Language code used for translation
--- -- the following keys can be missing if no stats have been collected yet
--- min_rtt = 0.01, -- minimum round trip time
--- max_rtt = 0.2, -- maximum round trip time
--- avg_rtt = 0.02, -- average round trip time
--- min_jitter = 0.01, -- minimum packet time jitter
--- max_jitter = 0.5, -- maximum packet time jitter
--- avg_jitter = 0.03, -- average packet time jitter
--- -- the following information is available in a debug build only!!!
--- -- DO NOT USE IN MODS
--- --ser_vers = 26, -- serialization version used by client
--- --major = 0, -- major version number
--- --minor = 4, -- minor version number
--- --patch = 10, -- patch version number
--- --vers_string = "0.4.9-git", -- full version string
--- --state = "Active" -- current client state
--- }
--- ```
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4400-L4425)
---@class Core.PlayerInformation
---@field address string
---@field ip_version integer
---@field connection_uptime integer
---@field protocol_version integer
---@field formspec_version integer
---@field lang_code string
---@field min_rtt number?
---@field max_rtt number?
---@field avg_rtt number?
---@field min_jitter number?
---@field max_jitter number?
---@field avg_jitter number?
---@field version_string string
--- The following information is available in a debug build only!!!
-- -@field serialization_version integer?
-- -@field major integer?
-- -@field minor integer?
-- -@field patch integer?
-- -@field state string?
---Table containing information about a player.
---@param player_name string
---@return Core.PlayerInformation
function core.get_player_information(player_name) end
---Table mapping Luanti versions to corresponding protocol versions for modder convenience.
---
---For example, to check whether a client has at least the feature set of Luanti 5.8.0
---or newer, you could do:
---```lua
--- core.get_player_information(player_name).protocol_version >= core.protocol_versions["5.8.0"]
---```
---@type table<string, integer>
core.protocol_versions = nil
--- Will only be present if the client sent this information (requires v5.7+)
---
--- Note that none of these things are constant, they are likely to change during a client
--- connection as the player resizes the window and moves it between monitors
---
--- real_gui_scaling and real_hud_scaling can be used instead of DPI.
--- OSes don't necessarily give the physical DPI, as they may allow user configuration.
--- real_*_scaling is just OS DPI / 96 but with another level of user configuration.
--- ```lua
--- {
--- -- Current size of the in-game render target (pixels).
--- --
--- -- This is usually the window size, but may be smaller in certain situations,
--- -- such as side-by-side mode.
--- size = {
--- x = 1308,
--- y = 577,
--- },
---
--- -- Estimated maximum formspec size before Minetest will start shrinking the
--- -- formspec to fit. For a fullscreen formspec, use a size 10-20% larger than
--- -- this and `padding[-0.01,-0.01]`.
--- max_formspec_size = {
--- x = 20,
--- y = 11.25
--- },
---
--- -- GUI Scaling multiplier
--- -- Equal to the setting `gui_scaling` multiplied by `dpi / 96`
--- real_gui_scaling = 1,
---
--- -- HUD Scaling multiplier
--- -- Equal to the setting `hud_scaling` multiplied by `dpi / 96`
--- real_hud_scaling = 1,
---
--- -- Whether the touchscreen controls are enabled.
--- -- Usually (but not always) `true` on Android.
--- -- Requires at least Minetest 5.9.0 on the client. For older clients, it
--- -- is always set to `false`.
--- touch_controls = false,
--- }
--- ```
---@class Core.PlayerWindowInformation
---@field size {x:integer,y:integer}
---@field max_formspec_size {x:integer,y:integer}
---@field real_gui_scaling number
---@field real_hud_scaling number
---@field touch_controls boolean
---@param player_name string
---@return Core.PlayerWindowInformation
function core.get_player_window_information(player_name) end
--- Returns success.
--- * Creates a directory specified by `path`, creating parent directories
--- if they don't exist.
---Returns `true` if the given path exists else `false`.
---@param path string
---@return boolean
function core.path_exists(path) end
---Creates a directory specified by path, creating parent directories if they don't exist.
---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4427-L4429)
---Returns success.
---@param path string
---@return boolean success
function core.mkdir(path) end
--- Removes a directory specified by path.
--- If recursive is set to true, the directory is recursively removed. Otherwise, the directory will only be removed if it is empty.
--- Returns true on success, false on failure.
--- @param path string
--- @param recursive boolean
--- @return boolean
---Removes a directory specified by path.
---
---If `recursive` is set to `true`, the directory is recursively removed.
---Otherwise, the directory will only be removed if it is empty.
---@param path string
---@param recursive boolean
---@return boolean success
function core.rmdir(path, recursive) end
--- Copies a directory specified by path to destination
--- Any files in destination will be overwritten if they already exist.
--- Returns true on success, false on failure.
--- @param source string
--- @param destination string
--- @return boolean
---Copies a directory specified by source to destination.
---
---Any files in `destination` will be overwritten if they already exist.
---@param source string
---@param destination string
---@return boolean success
function core.cpdir(source, destination) end
--- Moves a directory specified by path to destination.
--- If the destination is a non-empty directory, then the move will fail.
--- Returns true on success, false on failure.
--- @param source string
--- @param destination string
--- @return boolean
---Moves a directory specified by source to destination.
---
---If the `destination` is a non-empty directory, then the move will fail.
--- @param source string
--- @param destination string
--- @return boolean success
function core.mvdir(source, destination) end
--- Returns list of entry names
--- * `is_dir` [Optional] is one of:
--- * nil: return all entries,
--- * true: return only subdirectory names, or
--- * false: return only file names.
---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4430-L4434)
---Returns list of entry names
---@param path string
---@param is_dir boolean? is one of:
--- * `nil`: return all entries
--- * `true`: return only subdirectory names
--- * `false`: return only file names
---@return string[]
function core.get_dir_list(path, is_dir) end
--- Returns boolean indicating success
--- * Replaces contents of file at path with new contents in a safe (atomic)
--- way. Use this instead of below code when writing e.g. database files:
--- `local f = io.open(path, "wb"); f:write(content); f:close()`
---Replaces contents of file at path with new contents in a safe (atomic) way.
---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4435-L4438)
---Use this instead of below code when writing e.g. database files:
---```lua
--- local f = io.open(path, "wb"); f:write(content); f:close()
---```
---@param path string
---@param content string
function core.safe_file_write(path, content) end
--- Returns a table containing components of the
--- engine version. Components:
--- * `project`: Name of the project, eg, "Minetest"
--- * `string`: Simple version, eg, "1.2.3-dev"
--- * `hash`: Full git version (only set if available),
--- eg, "1.2.3-dev-01234567-dirty".
--- Use this for informational purposes only. The information in the returned
--- table does not represent the capabilities of the engine, nor is it
--- reliable or verifiable. Compatible forks will have a different name and
--- version entirely. To check for the presence of engine features, test
--- whether the functions exported by the wanted features exist. For example:
--- `if core.check_for_falling then ... end`.
---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4439-L4450)
---@class Core.Version
---@field project string
---@field string string
---@field proto_min integer
---@field proto_max integer
---@field hash string
---@field is_dev string
---Returns a table containing components of the engine version.
---@return Core.Version
function core.get_version() end
--- Returns the sha1 hash of data
--- * `data`: string of data to hash
--- * `raw`: [Optional] return raw bytes instead of hex digits, default: false
---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4451-L4453)
---Returns the sha1 hash of data.
---@param data string string of data to hash
---@param raw boolean? return raw bytes instead of hex digits, default: `false`
---@return string
function core.sha1(data, raw) end
--- Returns the sha256 hash of `data`
--- @param data string string of data to hash
--- @param raw boolean optional. return raw bytes instead of hex digits, default: false
---Returns the sha256 hash of data
---@param data string string of data to hash
---@param raw boolean? return raw bytes instead of hex digits, default: `false`
---@return string
function core.sha256(data, raw) end
--- Converts a ColorSpec to a ColorString. If the ColorSpec is invalid, returns `nil`.
--- @param colorspec ColorSpec The ColorSpec to convert.
--- @return ColorString?
---Converts a `ColorSpec` to a `ColorString`.
---
---If the ColorSpec is invalid, returns `nil`.
---@param colorspec ColorSpec
---@return ColorString?
function core.colorspec_to_colorstring(colorspec) end
--- Converts a ColorSpec to a raw string of four bytes in an RGBA layout, returned as a string.
--- @param colorspec ColorSpec The ColorSpec to convert.
--- @return string?
---Converts a `ColorSpec` to a raw string of four bytes in an RGBA layout,
---returned as a string.
---@param colorspec ColorSpec
---@return string?
function core.colorspec_to_bytes(colorspec) end
--- Converts a ColorSpec into RGBA table form. If the ColorSpec is invalid, returns nil. You can use this to parse ColorStrings.
--- @param colorspec ColorSpec The ColorSpec to convert.
--- @return {r:number, g:number, b:number, a:number}?
---Converts a `ColorSpec` into RGBA table form.
---
---If the ColorSpec is invalid, returns `nil`. You can use this to parse `ColorStrings`.
---@param colorspec ColorSpec
---@return ColorTable?
function core.colorspec_to_table(colorspec) end
---Returns a `"day-night ratio"` value (as accepted by `ObjectRef:override_day_night_ratio`)
---that is equivalent to the given `"time of day"` value (as returned by `core.get_timeofday`).
---@param time_of_day number?
function core.time_to_day_night_ratio(time_of_day) end
---Encode a PNG image and return it in string form.
---@param width integer Width of the image (integer in range [u32])
---@param height integer Height of the image (integer in range [u32])
---@param data table Image data, one of:
--- * array table of ColorSpec, length must be `width*height`
--- * string with raw RGBA pixels, length must be `width*height*4`
---@param compression integer? Optional zlib compression level, integer in range [0, 9].
--- The data is one-dimensional, starting in the upper left
--- corner of the image and laid out in scanlines going from
--- left to right, then top to bottom.
--- You can use colorspec_to_bytes to generate raw RGBA values.
--- Palettes are not supported at the moment. You may use this
--- to procedurally generate textures during server init.
---@return string
function core.encode_png(width, height, data, compression) end
---Encodes reserved URI characters by a percent sign followed by two hex digits.
---
---See [RFC 3986, section 2.3](https://datatracker.ietf.org/doc/html/rfc3986#section-2.3).
---@param str string
function core.urlencode(str) end

View File

@@ -8,4 +8,5 @@
---This `ItemDefinition` class is a combination of `ItemDefinition.Settings`
---and `ItemDefinition.Callbacks` and to some extent corresponds to the original.
---@class ItemDefinition : ItemDefinition.Settings, ItemDefinition.Callbacks
---@field [string] any
local ItemDefinition = {}

View File

@@ -0,0 +1,20 @@
---Version: 5.18
---@meta
---@class ItemDefinition.Groups
---@field [string] integer?
local ItemDefinition = {}
--- Luanti groups ---
---Special group for inventory mods to indicate that the item should be hidden in item lists.
---@type integer?
ItemDefinition.not_in_creative_inventory = nil
---If set to 1 for a tool, it cannot be repaired using the `"toolrepair"` crafting recipe.
---@type integer?
ItemDefinition.disable_repair = nil
--- SMC groups ---

View File

@@ -34,7 +34,7 @@ Settings.short_description = nil
--- {bendy = 2, snappy = 1},
--- {hard = 1, metal = 1, spikes = 1}
---```
---@type table<string,integer>?
---@type ItemDefinition.Groups?
Settings.groups = nil
---Texture shown in the inventory GUI.

View File

@@ -0,0 +1,150 @@
---Version: 5.18
---@meta
---@class NodeDefinition.Groups : ItemDefinition.Groups
---@field [string] integer?
local NodeDefinition = {}
--- Luanti groups ---
---The node is `'attached'` to a neighboring node.
---
---It checks whether the node it is attached to is walkable.
---If it isn't, the node will drop as an item.
---
--- * `1`: if the node is wallmounted, the node is attached in the wallmounted direction.
--- Otherwise, the node is attached to the node below.
--- * `2`: if the node is facedir or 4dir, the facedir or 4dir direction is checked.
--- No effect for other nodes. Note: The "attaching face" of this node is tile № 5 (back face).
--- * `3`: the node is always attached to the node below.
--- * `4`: the node is always attached to the node above.
---@type integer?
NodeDefinition.attached_node = nil
---Value is bounce speed in percent.
---
---If positive, jump/sneak on floor impact will increase/decrease bounce height.
---
---Negative value is the same bounciness, but non-controllable.
---@type integer?
NodeDefinition.bouncy = nil
---Makes nodes of raillike drawtype with same group value connect to each other
---@type integer?
NodeDefinition.connect_to_raillike = nil
---Player can always pick up node without reducing tool wear
--- * `2`: the node always gets the digging time 0.5 seconds (rail, sign)
--- * `3`: the node always gets the digging time 0 seconds (torch)
---@type integer?
NodeDefinition.connect_to_raillike = nil
---Player (and possibly other things) cannot jump from node or
---if their feet are in the node.
---
---**Note**: not supported for `new_move = false`.
---@type integer?
NodeDefinition.disable_jump = nil
---Player (and possibly other things) cannot actively descend in node using `Sneak` or `Aux1`
---key (for liquids and climbable nodes only).
---
---**Note**: not supported for `new_move = false`.
---@type integer?
NodeDefinition.disable_descend = nil
---Modifies the fall damage suffered when hitting the top of this node.
---
---There's also an armor group with the same name.
---
---The final player damage is determined by the following formula:
---```lua
--- damage =
--- collision speed
--- * ((node_fall_damage_add_percent + 100) / 100) -- node group
--- * ((player_fall_damage_add_percent + 100) / 100) -- player armor group
--- - (14)
---```
---
---Negative damage values are discarded as no damage.
---@type integer?
NodeDefinition.fall_damage_add_percent = nil
---If there is no walkable node under the node it will fall.
---
---It also falls if the node below is `buildable_to`.
---@type integer?
NodeDefinition.falling_node = nil
---The node will not fall through liquids (liquidtype ~= "none")
---
---A liquid source with `groups = {falling_node = 1, float = 1}`
---will fall through flowing liquids.
---@type integer?
NodeDefinition.float = nil
---Can be used to give an additional sense of progression in the game.
---@type integer?
NodeDefinition.level = nil
---Players and items will slide on the node.
---
---Slipperiness rises steadily with `slippery` value, starting at `1`.
---@type integer?
NodeDefinition.slippery = nil
---Can be added to nodes that shouldn't logically be breakable by the hand but are.
---
---Somewhat similar to dig_immediate, but times are more like `{[1]=3.50,[2]=2.00,[3]=0.70}`
---and this does not override the digging speed of an item if it can dig at
---a faster speed than this suggests for the hand.
NodeDefinition.oddly_breakable_by_hand = nil
--- SMC groups digging time defining group ---
---Digging time defining group.
---
---Suitable for items that can be cut (режущийся).
---@type integer?
NodeDefinition.cutting = nil
---Digging time defining group.
---
---Suitable for items that can be crash (раскалываемый).
---@type integer?
NodeDefinition.crushing = nil
---Digging time defining group.
---
---Suitable for items that can be chop (рубящийся).
---@type integer?
NodeDefinition.chopping = nil
---Digging time defining group.
---
---Suitable for items that can be dig (вскапывающийся).
---@type integer?
NodeDefinition.digging = nil
--- SMC node types groups ---
---@type integer?
NodeDefinition.slabs = nil
---@type integer?
NodeDefinition.stairs = nil
--- SMC special groups ---
---A group for the automatic registration of node segments (slabs and stairs).
--- * `1`: registration only slabs
--- * `2`: registration only stairs
--- * `3`: registration slabs & stairs
---@type integer?
NodeDefinition.segments = nil

View File

@@ -4,6 +4,22 @@
---@class NodeDefinition.Settings : ItemDefinition.Settings
local Settings = {}
---Table of groups-characteristics of Item.
---```
--- 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 NodeDefinition.Groups?
Settings.groups = nil
---@alias Node.Settings.drawtype
---|'normal'
---|'airlike'

View File

@@ -1,22 +1,33 @@
--- @meta
---Version: 5.18
---@meta
--- Colors ---
--- A ColorString is a string that represents a color. It can be one of the following:
--- * a named color, e.g. `"red"`, `"blue"`, `"green"`, etc.
--- (see [CSS Color Module Level 4](https://www.w3.org/TR/css-color-4/#named-colors) for a full list of named colors)
--- * a named color with alpha, e.g. `"red#08"`, `"blue#FF"`, `"green#F"`, etc.
--- * an RGB or RGBA hex color code, e.g. `"#RRGGBB"` or `"#RRGGBBAA"`, where `RR`, `GG`, `BB`, and `AA` are two-digit hexadecimal numbers representing the red, green, blue, and alpha (opacity) components of the color.
--- * e.g. `"#FF0000"` for red, `"#00FF00"` for green, `"#0000FF"` for blue, etc.
--- * a shorthand hex color code, e.g. `"#RGB"` or `"#RGBA"`, where `R`, `G`, `B`, and `A` are single-digit hexadecimal numbers representing the red, green, blue, and alpha (opacity) components of the color.
--- @alias ColorString string
--- * `"#RGB"` defines a color in hexadecimal format, fully opaque.
--- * `"#RGBA"` defines a color in hexadecimal format, with an alpha channel.
--- * `"#RRGGBB"` defines a color in hexadecimal format, fully opaque.
--- * `"#RRGGBBAA"` defines a color in hexadecimal format, with an alpha channel.
---
---Named colors are also supported and are equivalent to
---[CSS Color Module Level 4](https://www.w3.org/TR/css-color-4/#named-color).
---To specify the value of the alpha channel,
---append `#A` or `#AA` to the end of the color name (e.g. `"darkgreen#08"`).
---@alias ColorString string
---@class ColorTable
---@field r integer
---@field g integer
---@field b integer
---@field a integer
--- A ColorSpec specifies a 32-bit color. It can be written in any of the following forms:
--- * table form: Each element ranging from 0..255 (a, if absent, defaults to 255):
--- `colorspec = {a=255, r=0, g=255, b=0}`
--- * numerical form: The raw integer value of an ARGB8 quad:
--- `colorspec = 0xFF00FF00`
--- * string form: A ColorString (defined above):
--- `colorspec = "green"`
--- @alias ColorSpec {r:number, g:number, b:number, a:number}|ColorString|number
---A ColorSpec specifies a 32-bit color. It can be written in any of the following forms:
--- * table form: Each element ranging from 0..255 (a, if absent, defaults to 255):
---
--- `colorspec = {a=255, r=0, g=255, b=0}`
--- * numerical form: The raw integer value of an ARGB8 quad:
---
--- `colorspec = 0xFF00FF00`
--- * string form: A ColorString (defined above):
---
--- `colorspec = "green"`
---@alias ColorSpec ColorTable|ColorString|integer