|
|
@ -40,7 +40,7 @@
|
|
|
|
---@field get_item_group fun(name: string, group): any returns a rating. Get rating of a group of an item. (`0` means: not in group)
|
|
|
|
---@field get_item_group fun(name: string, group): any returns a rating. Get rating of a group of an item. (`0` means: not in group)
|
|
|
|
---@field get_biome_data fun(pos: Vector): BiomeData|nil
|
|
|
|
---@field get_biome_data fun(pos: Vector): BiomeData|nil
|
|
|
|
---@field get_biome_name fun(biome_id: string|number|integer): string|nil Returns the biome name string for the provided biome id, or `nil` on failure. If no biomes have been registered, such as in mgv6, returns `default`.
|
|
|
|
---@field get_biome_name fun(biome_id: string|number|integer): string|nil Returns the biome name string for the provided biome id, or `nil` on failure. If no biomes have been registered, such as in mgv6, returns `default`.
|
|
|
|
---@field find_nodes_in_area fun(pos1: Vector, pos2: Vector, nodenames: string|string[], grouped?: boolean): table `pos1` and `pos2` are the min and max positions of the area to search. `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"` If `grouped` is true the return value is a table indexed by node name which contains lists of positions. If `grouped` is false or absent the return values are as follows: first value: Table with all node positions, second value: Table with the count of each node with the node name as index, Area volume is limited to 4,096,000 nodes
|
|
|
|
---@field find_nodes_in_area fun(pos1: Vector, pos2: Vector, nodenames: string|string[], grouped?: boolean): Vector[] `pos1` and `pos2` are the min and max positions of the area to search. `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"` If `grouped` is true the return value is a table indexed by node name which contains lists of positions. If `grouped` is false or absent the return values are as follows: first value: Table with all node positions, second value: Table with the count of each node with the node name as index, Area volume is limited to 4,096,000 nodes
|
|
|
|
---@field find_nodes_in_area_under_air fun(pos1: Vector, pos2: Vector, nodenames: string|string[]): table returns a list of positions. `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"`. Return value: Table with all node positions with a node air above. Area volume is limited to 4,096,000 nodes.
|
|
|
|
---@field find_nodes_in_area_under_air fun(pos1: Vector, pos2: Vector, nodenames: string|string[]): table returns a list of positions. `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"`. Return value: Table with all node positions with a node air above. Area volume is limited to 4,096,000 nodes.
|
|
|
|
---@field registered_decorations table<any, DecorationDef> Map of registered decoration definitions, indexed by the `name` field. If `name` is nil, the key is the object handle returned by `minetest.register_schematic`.
|
|
|
|
---@field registered_decorations table<any, DecorationDef> Map of registered decoration definitions, indexed by the `name` field. If `name` is nil, the key is the object handle returned by `minetest.register_schematic`.
|
|
|
|
---@field swap_node fun(pos: Vector, node: NodeDef): nil Set node at position, but don't remove metadata
|
|
|
|
---@field swap_node fun(pos: Vector, node: NodeDef): nil Set node at position, but don't remove metadata
|
|
|
@ -76,6 +76,16 @@
|
|
|
|
---@field formspec_escape fun(str: string): string returns a string, escapes the characters "[", "]", "\", "," and ";", which can not be used in formspecs.
|
|
|
|
---@field formspec_escape fun(str: string): string returns a string, escapes the characters "[", "]", "\", "," and ";", which can not be used in formspecs.
|
|
|
|
---@field get_translator fun(textdomain: string): any
|
|
|
|
---@field get_translator fun(textdomain: string): any
|
|
|
|
---@field get_current_modname fun(): string returns the currently loading mod's name, when loading a mod.
|
|
|
|
---@field get_current_modname fun(): string returns the currently loading mod's name, when loading a mod.
|
|
|
|
|
|
|
|
---@field get_pointed_thing_position fun(pointed_thing: PointedThingDef, above?: boolean): Vector | nil Returns the position of a `pointed_thing` or `nil` if the `pointed_thing` does not refer to a node or entity. If the optional `above` parameter is true and the `pointed_thing` refers to a node, then it will return the `above` position of the `pointed_thing`.
|
|
|
|
|
|
|
|
---@field item_place fun(itemstack: ItemStack, placer: ObjectRef, pointed_thing: PointedThingDef, param2?: string|number): ItemStack Wrapper that calls `minetest.item_place_node` if appropriate. Calls `on_rightclick` of `pointed_thing.under` if defined instead **Note**: is not called when wielded item overrides `on_place`, `param2` overrides facedir and wallmounted `param2`, returns `itemstack, position`, `position`: the location the node was placed to. `nil` if nothing was placed.
|
|
|
|
|
|
|
|
---@field node_dig fun(pos: Vector, node: NodeDef, digger: ObjectRef): nil Checks if node can be dug, puts item into inventory, removes node. Calls functions registered by `minetest.registered_on_dignodes()`
|
|
|
|
|
|
|
|
---@field delete_particlespawner fun(id: number, player?: ObjectRef): nil Delete `ParticleSpawner` with `id` (return value from `minetest.add_particlespawner`). If playername is specified, only deletes on the player's client, otherwise on all clients.
|
|
|
|
|
|
|
|
---@field is_area_protected fun(pos1: Vector, pos2: Vector, player_name: ObjectRef, interval: number): Vector | boolean Returns the position of the first node that `player_name` may not modify in the specified cuboid between `pos1` and `pos2`. Returns `false` if no protections were found. Applies `is_protected()` to a 3D lattice of points in the defined volume. The points are spaced evenly throughout the volume and have a spacing similar to, but no larger than, `interval`. All corners and edges of the defined volume are checked. `interval` defaults to 4. `interval` should be carefully chosen and maximised to avoid an excessive number of points being checked. Like `minetest.is_protected`, this function may be extended or overwritten by mods to provide a faster implementation to check the cuboid for intersections.
|
|
|
|
|
|
|
|
---@field is_protected fun(pos: Vector, name: string): boolean Returning `true` restricts the player `name` from modifying (i.e. digging, placing) the node at position `pos`. `name` will be `""` for non-players or unknown players. This function should be overridden by protection mods. It is highly recommended to grant access to players with the `protection_bypass` privilege. Cache and call the old version of this function if the position is not protected by the mod. This will allow using multiple protection mods.
|
|
|
|
|
|
|
|
---@field register_on_mods_loaded fun(func: fun(): nil): nil Called after mods have finished loading and before the media is cached or the aliases handled.
|
|
|
|
|
|
|
|
---@field register_on_leaveplayer fun(func: fun(player: ObjectRef, timed_out: number): nil): nil Called when a player leaves the game `timed_out`: True for timeout, false for other reasons.
|
|
|
|
|
|
|
|
---@field place_node fun(pos: Vector, node: SetNodeTable): nil Place node with the same effects that a player would cause
|
|
|
|
|
|
|
|
---@field add_particle fun(def: ParticleDef): nil
|
|
|
|
|
|
|
|
|
|
|
|
---Minetest settings
|
|
|
|
---Minetest settings
|
|
|
|
---@class MinetestSettings
|
|
|
|
---@class MinetestSettings
|
|
|
@ -136,3 +146,23 @@
|
|
|
|
---@field max_hear_distance number|integer
|
|
|
|
---@field max_hear_distance number|integer
|
|
|
|
---@field object ObjectRef
|
|
|
|
---@field object ObjectRef
|
|
|
|
---@field exclude_player string Name
|
|
|
|
---@field exclude_player string Name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---Partcile definition
|
|
|
|
|
|
|
|
---@class ParticleDef
|
|
|
|
|
|
|
|
---@field pos Vector
|
|
|
|
|
|
|
|
---@field velocity Vector
|
|
|
|
|
|
|
|
---@field acceleration Vector Spawn particle at pos with velocity and acceleration
|
|
|
|
|
|
|
|
---@field expirationtime number Disappears after expirationtime seconds
|
|
|
|
|
|
|
|
---@field size number Scales the visual size of the particle texture. If `node` is set, size can be set to 0 to spawn a randomly-sized particle (just like actual node dig particles).
|
|
|
|
|
|
|
|
---@field collisiondetection boolean If true collides with `walkable` nodes and, depending on the `object_collision` field, objects too.
|
|
|
|
|
|
|
|
---@field collision_removal boolean If true particle is removed when it collides. Requires collisiondetection = true to have any effect.
|
|
|
|
|
|
|
|
---@field object_collision boolean If true particle collides with objects that are defined as `physical = true,` and `collide_with_objects = true,`. Requires collisiondetection = true to have any effect.
|
|
|
|
|
|
|
|
---@field vertical boolean If true faces player using y axis only
|
|
|
|
|
|
|
|
---@field texture string The texture of the particle v5.6.0 and later: also supports the table format described in the following section
|
|
|
|
|
|
|
|
---@field playername string | nil Optional, if specified spawns particle only on the player's client
|
|
|
|
|
|
|
|
---@field animation TileAnimationDef | nil Optional, specifies how to animate the particle texture
|
|
|
|
|
|
|
|
---@field glow number | nil Optional, specify particle self-luminescence in darkness. Values 0-14.
|
|
|
|
|
|
|
|
---@field node {["name"]: string, ["param2"]: number} | nil Optional, if specified the particle will have the same appearance as node dig particles for the given node. `texture` and `animation` will be ignored if this is set.
|
|
|
|
|
|
|
|
---@field node_tile number | nil Optional, only valid in combination with `node` If set to a valid number 1-6, specifies the tile from which the particle texture is picked. Otherwise, the default behavior is used. (currently: any random tile)
|
|
|
|
|
|
|
|
---@field drag Vector | nil v5.6.0 and later: Optional drag value, consult the following section
|
|
|
|
|
|
|
|
---@field bounce {["min"]: number, ["max"]: number, ["bias"]: number} | nil v5.6.0 and later: Optional bounce range, consult the following section
|
|
|
|