nodecore-cd2025/mods/nc_api/mapgen_limits.lua

19 lines
818 B
Lua
Raw Normal View History

2020-03-22 10:59:06 -04:00
-- LUALOCALS < ---------------------------------------------------------
2020-03-22 11:07:20 -04:00
local math, minetest, nodecore, string, tonumber
= math, minetest, nodecore, string, tonumber
local math_floor, string_format
= math.floor, string.format
2020-03-22 10:59:06 -04:00
-- LUALOCALS > ---------------------------------------------------------
local limit = tonumber(minetest.get_mapgen_setting("mapgen_limit")) or 31000
local chunksize = tonumber(minetest.get_mapgen_setting("chunksize")) or 5
chunksize = chunksize * 16
2020-03-22 11:07:20 -04:00
local limitchunks = math_floor(limit / chunksize)
2020-03-22 10:59:06 -04:00
2020-03-22 11:07:20 -04:00
nodecore.map_limit_min = (-limitchunks + 0.5) * chunksize + 7.5
nodecore.map_limit_max = (limitchunks - 0.5) * chunksize + 7.5
minetest.log(string_format("mapgen limit: %d, chunk: %d, bounds: %0.1f to %0.1f",
limit, chunksize, nodecore.map_limit_min, nodecore.map_limit_max))