ide-helper: improve NodeDefinition annotations.

This commit is contained in:
alek13
2025-05-03 04:50:12 +03:00
parent 9e25f0d467
commit 11b45c4fe3

View File

@@ -18,7 +18,7 @@ local NodeDefinition = {
---
--- Textures of node; +Y, -Y, +X, -X, +Z, -Z
--- List can be shortened to needed length.
--- @type string[]|TileDefinition[]
--- @type table<number,string|TileDefinition>
tiles = nil,
--- {tile definition 1, def2, def3, def4, def5, def6}
@@ -28,13 +28,13 @@ local NodeDefinition = {
--- texture. If the texture name is an empty string, that overlay is not
--- drawn. Since such tiles are drawn twice, it is not recommended to use
--- overlays on very common nodes.
--- @type string[]
--- @type table<number,string|TileDefinition>
overlay_tiles = nil,
--- {tile definition 1, Tile definition 2},
--- Special textures of node; used rarely.
--- List can be shortened to needed length.
--- @type string[]
--- @type table<number,string|TileDefinition>
special_tiles = nil,
--- The node's original color will be multiplied with this color.
@@ -447,7 +447,7 @@ local NodeDefinition = {
--- default: minetest.node_punch
--- Called when puncher (an ObjectRef) punches the node at pos.
--- By default calls minetest.register_on_punchnode callbacks.
--- @type fun(pos:Position, node, puncher:Player|ObjectRef|nil, pointed_thing:pointed_thing)
--- @type fun(pos:Position, node:Node, puncher:Player|ObjectRef|nil, pointed_thing:pointed_thing)
on_punch = nil,
--- default: nil
@@ -459,14 +459,14 @@ local NodeDefinition = {
--- Note: pointed_thing can be nil, if a mod calls this function.
--- This function does not get triggered by clients <=0.4.16 if the
--- "formspec" node metadata field is set.
--- @type fun (pos:Position, node, clicker:Player|ObjectRef|nil, itemstack:ItemStack, pointed_thing:pointed_thing)
--- @type fun(pos:Position, node:Node, clicker:Player|ObjectRef|nil, itemstack:ItemStack, pointed_thing:pointed_thing|nil)
on_rightclick = nil,
--- default: minetest.node_dig
--- By default checks privileges, wears out item (if tool) and removes node.
--- return true if the node was dug successfully, false otherwise.
--- Deprecated: returning nil is the same as returning true.
--- @type fun(pos, node, digger)
--- @type fun(pos:Position, node:Node, digger:Player): boolean
on_dig = nil,
--- default: nil
@@ -474,53 +474,53 @@ local NodeDefinition = {
--- elapsed is the total time passed since the timer was started.
--- return true to run the timer for another cycle with the same timeout
--- value.
--- @type fun(pos, elapsed)
--- @type fun(pos:Position, elapsed:number): boolean
on_timer = nil,
--- fields = {name1 = value1, name2 = value2, ...}
--- Called when an UI form (e.g. sign text input) returns data.
--- See minetest.register_on_player_receive_fields for more info.
--- default: nil
--- @type fun(pos, formname, fields, sender)
--- @type fun(pos:Position, formname:string, fields:table, sender:Player)
on_receive_fields = nil,
--- Called when a player wants to move items inside the inventory.
--- Return value: number of items allowed to move.
--- @type fun(pos, from_list, from_index, to_list, to_index, count, player)
--- @type fun(pos:Position, from_list:string, from_index:number, to_list:string, to_index:number, count:number, player:Player): number
allow_metadata_inventory_move = nil,
--- Called when a player wants to put something into the inventory.
--- Return value: number of items allowed to put.
--- Return value -1: Allow and don't modify item count in inventory.
--- @type fun(pos, listname, index, stack, player)
--- @type fun(pos:Position, listname:string, index:number, stack:ItemStack, player:Player): number
allow_metadata_inventory_put = nil,
--- Called when a player wants to take something out of the inventory.
--- Return value: number of items allowed to take.
--- Return value -1: Allow and don't modify item count in inventory.
--- @type fun(pos, listname, index, stack, player)
--- @type fun(pos:Position, listname:string, index:number, stack:ItemStack, player:Player): number
allow_metadata_inventory_take = nil,
--- Called after the actual action has happened, according to what was
--- allowed.
--- No return value.
--- @type fun(pos, from_list, from_index, to_list, to_index, count, player)
--- @type fun(pos:Position, from_list:string, from_index:number, to_list:string, to_index:number, count:number, player:Player): void
on_metadata_inventory_move = nil,
--- Called after the actual action has happened, according to what was
--- allowed.
--- No return value.
--- @type fun(pos, listname, index, stack, player)
--- @type fun(pos:Position, listname:string, index:number, stack:ItemStack, player:Player): void
on_metadata_inventory_put = nil,
--- Called after the actual action has happened, according to what was
--- allowed.
--- No return value.
--- @type fun(pos, listname, index, stack, player)
--- @type fun(pos:Position, listname:string, index:number, stack:ItemStack, player:Player): void
on_metadata_inventory_take = nil,
--- intensity: 1.0 = mid range of regular TNT.
--- If defined, called when an explosion touches the node, instead of
--- removing the node.
--- @type fun (pos, intensity)
--- @type fun (pos:Position, intensity:number)
on_blast = nil,
--- stores which mod actually registered a node