vector: add @return for :sign()/abs(); Position: integer fields; fix register_on_generated.

This commit is contained in:
Alexander Chibrikin
2026-01-13 00:48:08 +03:00
parent 36cfa27d6c
commit 138ceae165
2 changed files with 16 additions and 11 deletions

View File

@@ -9,6 +9,7 @@
--- @operator div(number) : vector --- @operator div(number) : vector
vector = {} vector = {}
--- Creates a new vector `(a, b, c)`. --- Creates a new vector `(a, b, c)`.
--- * Deprecated: `vector.new()` does the same as `vector.zero()` and --- * Deprecated: `vector.new()` does the same as `vector.zero()` and
--- `vector.new(v)` does the same as `vector.copy(v)` --- `vector.new(v)` does the same as `vector.copy(v)`
@@ -90,9 +91,11 @@ function vector:round() end
--- Returns a vector where `math.sign` was called for each component. --- Returns a vector where `math.sign` was called for each component.
--- See [Helper functions](https://api.luanti.org/helper-functions/) for details. --- See [Helper functions](https://api.luanti.org/helper-functions/) for details.
--- @return vector
function vector:sign() end function vector:sign() end
--- Returns a vector with absolute values for each component. --- Returns a vector with absolute values for each component.
--- @return vector
function vector:abs() end function vector:abs() end
--- Applies a function to each component of the vector and returns a new vector. --- Applies a function to each component of the vector and returns a new vector.

View File

@@ -37,9 +37,9 @@ PseudoRandom = {}
--- See ./classes/InvRef.lua --- See ./classes/InvRef.lua
--- @class Position --- @class Position
--- @field x number|integer --- @field x integer
--- @field y number|integer --- @field y integer
--- @field z number|integer --- @field z integer
@@ -521,15 +521,17 @@ function minetest.register_on_dignode(callback) end
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4584-L4585) --- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4584-L4585)
--- @param callback fun(pos, node, puncher, pointed_thing) --- @param callback fun(pos, node, puncher, pointed_thing)
function minetest.register_on_punchnode(callback) end function minetest.register_on_punchnode(callback) end
--- * Called after generating a piece of world. Modifying nodes inside the area
--- is a bit faster than usually. --- * Called after the engine mapgen finishes a chunk but before it is written to the map.
--- * **Avoid using this** whenever possible. As with other callbacks this blocks --- * Chunk data resides in `vmanip`. Other parts of the map are not accessible.
--- the main thread and introduces noticeable latency. --- The area of the chunk if comprised of `minp` and `maxp`,
--- Consider "Mapgen environment" for an alternative. --- note that is smaller than the emerged area of the VoxelManip.
--- Note: calling `read_from_map()` or `write_to_map()`
--- on the VoxelManipulator object is not necessary and is disallowed.
--- * `blockseed`: 64-bit seed number used for this chunk.
--- ---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4586-L4588) --- @overload fun(callback:fun(min_pos:Position, max_pos:Position, blockseed:number))
--- @param callback fun(min_pos:Position, max_pos:Position, seed:number) --- @param callback fun(vmanip:VoxelManip, min_pos:Position, max_pos:Position, blockseed:number)
--- @overload fun(callback:fun(vmanip:VoxelManip, min_pos:Position, max_pos:Position, seed:number))
function minetest.register_on_generated(callback) end function minetest.register_on_generated(callback) end
--- * Called when a new player enters the world for the first time --- * Called when a new player enters the world for the first time
--- ---