Module util

utilities and helpers

Functions

mapblock_lib.get_mapblock_center (pos) returns the mapblock-center of the given coordinates
mapblock_lib.get_mapblock (pos) returns the mapblock position for the node-position
mapblock_lib.is_mapblock_aligned (pos1, pos2) returns true if the two positions align to a single mapblock's edges
mapblock_lib.get_mapblock_bounds_from_mapblock (block_pos) returns the max/min bounds for the mapblock-position
mapblock_lib.get_mapblock_bounds (pos) returns the max/min bounds for the node-position
mapblock_lib.sort_pos (pos1, pos2) sorts the position by ascending order
mapblock_lib.pos_iterator (pos1, pos2) returns an iterator function for the mapblock coordinate range
mapblock_lib.for_each (pos1, pos2, fn) iterate through the specified region
mapblock_lib.clear_mapblock (mapblock_pos) clears a mapblock (fills it with air)
mapblock_lib.rotate_pos (rel_pos, max, rotation_y) rotate a position around the y axis
mapblock_lib.rotate_size (size, rotation_y) rotate a size vector

Tables

mapblock_pos Mapblock position
node_pos Node position


Functions

mapblock_lib.get_mapblock_center (pos)
returns the mapblock-center of the given coordinates

Parameters:

Returns:

    node_pos the node-position of the current mapblock-center with fractions
mapblock_lib.get_mapblock (pos)
returns the mapblock position for the node-position

Parameters:

Returns:

    mapblock_pos the mapblock-position
mapblock_lib.is_mapblock_aligned (pos1, pos2)
returns true if the two positions align to a single mapblock's edges

Parameters:

mapblock_lib.get_mapblock_bounds_from_mapblock (block_pos)
returns the max/min bounds for the mapblock-position

Parameters:

Returns:

  1. node_pos the min-node-position
  2. node_pos the max-node-position
mapblock_lib.get_mapblock_bounds (pos)
returns the max/min bounds for the node-position

Parameters:

Returns:

  1. node_pos the min-node-position
  2. node_pos the max-node-position
mapblock_lib.sort_pos (pos1, pos2)
sorts the position by ascending order

Parameters:

Returns:

  1. node_pos the lower position
  2. node_pos the upper position
mapblock_lib.pos_iterator (pos1, pos2)
returns an iterator function for the mapblock coordinate range

Parameters:

Returns:

  1. a position iterator
  2. the total node/mapblock count
mapblock_lib.for_each (pos1, pos2, fn)
iterate through the specified region

Parameters:

mapblock_lib.clear_mapblock (mapblock_pos)
clears a mapblock (fills it with air)

Parameters:

  • mapblock_pos the mapblock position
mapblock_lib.rotate_pos (rel_pos, max, rotation_y)
rotate a position around the y axis

Parameters:

  • rel_pos node_pos the relative position to rotate
  • max node_pos the maximum position to rotate in
  • rotation_y the clock-wise rotation, either 0,90,180 or 270

Returns:

    node_pos the rotated position
mapblock_lib.rotate_size (size, rotation_y)
rotate a size vector

Parameters:

  • size node_pos a size vector
  • rotation_y the clock-wise rotation, either 0,90,180 or 270

Returns:

    node_pos the rotated size

Tables

mapblock_pos
Mapblock position

Fields:

  • x number mapblock x-position
  • y number mapblock y-position
  • z number mapblock z-position
node_pos
Node position

Fields:

  • x number node x-position
  • y number node y-position
  • z number node z-position
generated by LDoc 1.4.6 Last updated 2023-03-30 05:48:06