From 02381f5ffddfc61f7f4e04cd760d83dca204b892 Mon Sep 17 00:00:00 2001 From: varttist Date: Sat, 7 Nov 2026 19:25:10 +0300 Subject: [PATCH] `core_namespace`: 5.18 update --- core_namespace/registration/environment.lua | 137 ++++++++------------ core_namespace/registration/gameplay.lua | 71 ++-------- 2 files changed, 68 insertions(+), 140 deletions(-) diff --git a/core_namespace/registration/environment.lua b/core_namespace/registration/environment.lua index e7177c2..8507759 100644 --- a/core_namespace/registration/environment.lua +++ b/core_namespace/registration/environment.lua @@ -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 (":"). ---- @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 (":"). +---@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 (":"). ---- @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 (":"). +---@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 (":"). +---@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 (`":"`). For renaming: its old name. ---- @param original_name string @itemstring (`":"`). 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 (`":"`). For renaming: its old name. ---- @param original_name string @itemstring (`":"`). 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 diff --git a/core_namespace/registration/gameplay.lua b/core_namespace/registration/gameplay.lua index b99739f..1783397 100644 --- a/core_namespace/registration/gameplay.lua +++ b/core_namespace/registration/gameplay.lua @@ -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