mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Document core.MAP_BLOCKSIZE constant in lua_api.md (#15911)
This commit is contained in:
parent
efded8f0bb
commit
d085f0fb52
1 changed files with 6 additions and 4 deletions
|
@ -1681,7 +1681,9 @@ roughly 1x1x1 meters in size.
|
|||
|
||||
A 'mapblock' (often abbreviated to 'block') is 16x16x16 nodes and is the
|
||||
fundamental region of a world that is stored in the world database, sent to
|
||||
clients and handled by many parts of the engine.
|
||||
clients and handled by many parts of the engine. This size is defined by the constant
|
||||
`core.MAP_BLOCKSIZE` (=16).
|
||||
|
||||
'mapblock' is preferred terminology to 'block' to help avoid confusion with
|
||||
'node', however 'block' often appears in the API.
|
||||
|
||||
|
@ -1713,7 +1715,7 @@ node position (0,0,0) to node position (15,15,15).
|
|||
To calculate the blockpos of the mapblock that contains the node at 'nodepos',
|
||||
for each axis:
|
||||
|
||||
* blockpos = math.floor(nodepos / 16)
|
||||
* blockpos = math.floor(nodepos / core.MAP_BLOCKSIZE)
|
||||
|
||||
#### Converting blockpos to min/max node positions
|
||||
|
||||
|
@ -1721,9 +1723,9 @@ To calculate the min/max node positions contained in the mapblock at 'blockpos',
|
|||
for each axis:
|
||||
|
||||
* Minimum:
|
||||
nodepos = blockpos * 16
|
||||
nodepos = blockpos * core.MAP_BLOCKSIZE
|
||||
* Maximum:
|
||||
nodepos = blockpos * 16 + 15
|
||||
nodepos = (blockpos + 1) * core.MAP_BLOCKSIZE - 1
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue