Migrate to modern plugins: fix errors in util/mt-ide-helper & add changes that fixes most errors in code. LG-1978

This commit is contained in:
alek13
2025-09-16 19:05:54 +03:00
parent f8c9f7d83b
commit 0ca47db2ea
26 changed files with 301 additions and 160 deletions

View File

@@ -112,7 +112,7 @@ local NodeDefinition = {
---
--- `*_optional` drawtypes need less rendering time if deactivated(always client-side).
---
--- @type string
--- @type string?
drawtype = "normal",
--- Supported for drawtypes "plantlike", "signlike", "torchlike",
@@ -121,14 +121,14 @@ local NodeDefinition = {
--- node. For torchlike, the image will start at the surface to which the
--- node "attaches". For the other drawtypes the image will be centered
--- on the node.
--- @type number
--- @type number?
visual_scale = 1.0,
--- {tile definition 1, def2, def3, def4, def5, def6}
---
--- Textures of node; +Y, -Y, +X, -X, +Z, -Z
--- List can be shortened to needed length.
--- @type table<number,string|TileDefinition>
--- @type table<number,string|TileDefinition>?
tiles = nil,
--- {tile definition 1, def2, def3, def4, def5, def6}
@@ -138,20 +138,20 @@ 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 table<number,string|TileDefinition>
--- @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 table<number,string|TileDefinition>
--- @type table<number,string|TileDefinition>?
special_tiles = nil,
--- The node's original color will be multiplied with this color.
--- If the node has a palette, then this setting only has an effect in
--- the inventory and on the wield item.
--- @see ColorSpec
--- @type string|ColorSpec
--- @type string|ColorSpec|nil
color = '',
--- Specifies how the texture's alpha channel will be used for rendering.
@@ -165,7 +165,7 @@ local NodeDefinition = {
--- "clip" otherwise.
--- If set to a boolean value (deprecated): true either sets it to blend
--- or clip, false sets it to clip or opaque mode depending on the drawtype.
--- @type string
--- @type string?
use_texture_alpha = "opaque",
--- The node's `param2` is used to select a pixel from the image.
@@ -173,23 +173,23 @@ local NodeDefinition = {
--- The node's color will be multiplied with the selected pixel's color.
--- Tiles can override this behavior.
--- Only when `paramtype2` supports palettes.
--- @type string
--- @type string?
palette = "",
--- Screen tint if player is inside node, see "ColorSpec"
--- @type string
--- @type string?
post_effect_color = "#00000000",
--- See "Nodes"
--- @type string
--- @type string?
paramtype = "none",
--- See "Nodes"
--- @type string
--- @type string?
paramtype2 = "none",
--- Value for param2 that is set when player places node
--- @type number
--- @type number?
place_param2 = 0,
--- If false, the cave generator and dungeon generator will not carve
@@ -197,27 +197,27 @@ local NodeDefinition = {
--- Specifically, this stops mod-added nodes being removed by caves and
--- dungeons when those generate in a neighbor mapchunk and extend out
--- beyond the edge of that mapchunk.
--- @type boolean
--- @type boolean?
is_ground_content = true,
--- If true, sunlight will go infinitely through this node
--- @type boolean
--- @type boolean?
sunlight_propagates = false,
--- If true, objects collide with node
--- @type boolean
--- @type boolean?
walkable = true,
--- If true, can be pointed at
--- @type boolean
--- @type boolean?
pointable = true,
--- If false, can never be dug
--- @type boolean
--- @type boolean?
diggable = true,
--- If true, can be climbed on like a ladder
--- @type boolean
--- @type boolean?
climbable = false,
--- Slows down movement of players through this node (max. 7).
@@ -225,16 +225,16 @@ local NodeDefinition = {
--- Note: If liquid movement physics apply to the node
--- (see `liquid_move_physics`), the movement speed will also be
--- affected by the `movement_liquid_*` settings.
--- @type number
--- @type number?
move_resistance = 0,
--- If true, placed nodes can replace this node
--- @type boolean
--- @type boolean?
buildable_to = false,
--- If true, liquids flow into and replace this node.
--- Warning: making a liquid node 'floodable' will cause problems.
--- @type boolean
--- @type boolean?
floodable = false,
--- specifies liquid flowing physics
@@ -247,7 +247,7 @@ local NodeDefinition = {
--- recommended drawtype: "flowingliquid".
--- If it's "source" or "flowing", then the
--- `liquid_alternative_*` fields _must_ be specified
--- @type string
--- @type string?
liquidtype = "none",
--- These fields may contain node names that represent the
@@ -270,7 +270,7 @@ local NodeDefinition = {
--- Example:
--- liquid_alternative_flowing = "example:water_flowing",
--- liquid_alternative_source = "example:water_source",
--- @type string
--- @type string?
liquid_alternative_flowing = "",
--- These fields may contain node names that represent the
@@ -293,19 +293,19 @@ local NodeDefinition = {
--- Example:
--- liquid_alternative_flowing = "example:water_flowing",
--- liquid_alternative_source = "example:water_source",
--- @type string
--- @type string?
liquid_alternative_source = "",
--- Controls speed at which the liquid spreads/flows (max. 7).
--- 0 is fastest, 7 is slowest.
--- By default, this also slows down movement of players inside the node
--- (can be overridden using `move_resistance`)
--- @type number
--- @type number?
liquid_viscosity = 0,
--- If true, a new liquid source can be created by placing two or more
--- sources nearby
--- @type boolean
--- @type boolean?
liquid_renewable = true,
--- specifies movement physics if inside node
@@ -323,64 +323,67 @@ local NodeDefinition = {
--- Allows defining the nodebox height without using param2.
--- The nodebox height is 'leveled' / 64 nodes.
--- The maximum value of 'leveled' is `leveled_max`.
--- @type number
--- @type number?
leveled = 0,
--- Maximum value for `leveled` (0-127), enforced in
--- `minetest.set_node_level` and `minetest.add_node_level`.
--- Values above 124 might causes collision detection issues.
--- @type number
--- @type number?
leveled_max = 127,
--- Maximum distance that flowing liquid nodes can spread around
--- source on flat land;
--- maximum = 8; set to 0 to disable liquid flow
--- @type number
--- @type number?
liquid_range = 8,
--- Player will take this amount of damage if no bubbles are left
--- @type number
--- @type number?
drowning = 0,
--- If player is inside node, this damage is caused
--- @type number
--- @type number?
damage_per_second = 0,
--- See "Node boxes"
--- @type table?
node_box = {type = "regular"},
--- Used for nodebox nodes with the type == "connected".
--- Specifies to what neighboring nodes connections will be drawn.
--- e.g. `{"group:fence", "default:wood"}` or `"default:stone"`
--- @type string[]
--- @type string[]?
connects_to = {},
--- Tells connected nodebox nodes to connect only to these sides of this
--- node. possible: "top", "bottom", "front", "left", "back", "right"
--- @type string[]
--- @type string[]?
connect_sides = {},
--- File name of mesh when using "mesh" drawtype
--- @type string
--- @type string?
mesh = "",
--- Custom selection box definition. Multiple boxes can be defined.
--- If "nodebox" drawtype is used and selection_box is nil, then node_box
--- definition is used for the selection box.
--- see [Node boxes] for possibilities
--- @type table?
selection_box = {},
--- see [Node boxes] for possibilities
--- Custom collision box definition. Multiple boxes can be defined.
--- If "nodebox" drawtype is used and collision_box is nil, then node_box
--- definition is used for the collision box.
--- @type table?
collision_box = {},
--- Support maps made in and before January 2012
--- @type boolean
--- @type boolean?
legacy_facedir_simple = false,
--- Support maps made in and before January 2012
--- @type boolean
--- @type boolean?
legacy_wallmounted = false,
--- Valid for drawtypes:
@@ -392,16 +395,17 @@ local NodeDefinition = {
--- plantlike drawtype can only wave like plants.
--- allfaces_optional drawtype can only wave like leaves.
--- liquid, flowingliquid drawtypes can only wave like liquids.
--- @type number
--- @type number?
waving = 0,
--- Definition of node sounds to be played at various events.
--- All fields in this table are optional.
--- @type nil|table<string,SimpleSoundSpec|string?>
sounds = {
--- If walkable, played when object walks on it. If node is
--- climbable or a liquid, played when object moves through it
--- @type SimpleSoundSpec
--- @type SimpleSoundSpec?
footstep = nil,
--- While digging node.
@@ -411,32 +415,33 @@ local NodeDefinition = {
--- In case of a tie, one of the sounds will be played (but we
--- cannot predict which one)
--- Default value: `"__group"`
--- @type SimpleSoundSpec|string
--- @type nil|SimpleSoundSpec|string
dig = {} or "__group",
--- Node was dug
--- @type SimpleSoundSpec
--- @type SimpleSoundSpec?
dug = nil,
--- Node was placed. Also played after falling
--- @type SimpleSoundSpec
--- @type SimpleSoundSpec?
place = nil,
--- When node placement failed.
--- Note: This happens if the _built-in_ node placement failed.
--- This sound will still be played if the node is placed in the
--- `on_place` callback manually.
--- @type SimpleSoundSpec
--- @type SimpleSoundSpec?
place_failed = nil,
--- When node starts to fall or is detached
--- @type SimpleSoundSpec
--- @type SimpleSoundSpec?
fall = nil,
},
--- Name of dropped item when dug.
--- Default dropped item is the node itself.
--- Using a table allows multiple items, drop chances and item filtering:
--- @type table?
drop = {
--- Maximum number of item lists to drop.
--- The entries in 'items' are processed in order. For each:
@@ -447,7 +452,7 @@ local NodeDefinition = {
--- Therefore, entries should progress from low to high drop chance.
--- @type number
max_items = 1,
---- Examples:
--- Examples:
--- ```lua
--- {
--- -- 1 in 1000 chance of dropping a diamond.
@@ -496,19 +501,19 @@ local NodeDefinition = {
--- infinite loop if it invokes the same callback.
--- Consider using `minetest.swap_node()` instead.
--- default: nil
--- @type fun(pos:Position)
--- @type fun(pos:Position)?
on_construct = nil,
--- Node destructor; called before removing node.
--- Not called for bulk node placement.
--- default: nil
--- @type fun(pos:Position)
--- @type fun(pos:Position)?
on_destruct = nil,
--- Node destructor; called after removing node.
--- Not called for bulk node placement.
--- default: nil
--- @type fun(pos:Position, old_node)
--- @type fun(pos:Position, old_node)?
after_destruct = nil,
--- Called when a liquid (new_node) is about to flood old_node, if it has
@@ -518,7 +523,7 @@ local NodeDefinition = {
--- over and over again every liquid update interval.
--- Default: nil
--- Warning: making a liquid node 'floodable' will cause problems.
--- @type fun(pos:Position, old_node, new_node)
--- @type fun(pos:Position, old_node, new_node)?
on_flood = nil,
@@ -531,7 +536,7 @@ local NodeDefinition = {
--- be added directly to one or more of the dropped items.
--- @see ItemStackMetaRef
--- default: nil
--- @type fun(pos:Position, old_node, new_node, old_meta, drops:ItemStack[])
--- @type fun(pos:Position, old_node, new_node, old_meta, drops:ItemStack[])?
preserve_metadata = nil,
--- Called after constructing node when node was placed using
@@ -539,25 +544,25 @@ local NodeDefinition = {
--- If return true no item is taken from itemstack.
--- `placer` may be any valid ObjectRef or nil.
--- default: nil
--- @type fun(pos:Position, placer:Player|ObjectRef|nil, itemstack:ItemStack, pointed_thing:pointed_thing)
--- @type fun(pos:Position, placer:Player|ObjectRef|nil, itemstack:ItemStack, pointed_thing:pointed_thing)?
after_place_node = nil,
--- oldmetadata is in table format.
--- Called after destructing node when node was dug using
--- minetest.node_dig / minetest.dig_node.
--- default: nil
--- @type fun(pos:Player, oldnode, oldmetadata, digger:Player|ObjectRef|nil)
--- @type fun(pos:Player, oldnode, oldmetadata, digger:Player|ObjectRef|nil)?
after_dig_node = nil,
--- Returns true if node can be dug, or false if not.
--- default: nil
--- @type fun(pos:Position, player:Player|ObjectRef|nil)
--- @type fun(pos:Position, player:Player|ObjectRef|nil)?
can_dig = nil,
--- 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:NodeTable, puncher:Player|ObjectRef|nil, pointed_thing:pointed_thing)
--- @type fun(pos:Position, node:NodeTable, puncher:Player|ObjectRef|nil, pointed_thing:pointed_thing)?
on_punch = nil,
--- default: nil
@@ -569,14 +574,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:NodeTable, clicker:Player|ObjectRef|nil, itemstack:ItemStack, pointed_thing:pointed_thing|nil)
--- @type fun(pos:Position, node:NodeTable, 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:Position, node:NodeTable, digger:Player): boolean
--- @type (fun(pos:Position, node:NodeTable, digger:Player): boolean)?
on_dig = nil,
--- default: nil
@@ -584,53 +589,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:Position, elapsed:number): boolean
--- @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:Position, formname:string, fields:table, sender:Player)
--- @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:Position, from_list:string, from_index:number, to_list:string, to_index:number, count:number, player:Player): number
--- @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:Position, listname:string, index:number, stack:ItemStack, player:Player): number
--- @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:Position, listname:string, index:number, stack:ItemStack, player:Player): number
--- @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:Position, from_list:string, from_index:number, to_list:string, to_index:number, count:number, player:Player): void
--- @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:Position, listname:string, index:number, stack:ItemStack, player:Player): void
--- @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:Position, listname:string, index:number, stack:ItemStack, player:Player): void
--- @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:Position, intensity:number)
--- @type (fun(pos:Position, intensity:number): void)?
on_blast = nil,
--- stores which mod actually registered a node
@@ -638,6 +643,6 @@ local NodeDefinition = {
--- Useful for getting which mod truly registered something
--- example: if a node is registered as ":othermodname:nodename",
--- nodename will show "othermodname", but mod_origin will say "modname"
--- @type string
--- @type string?
mod_origin = "modname",
}