Move most of mapgen into mapgen thread

This commit is contained in:
Desour
2024-03-17 15:38:49 +01:00
committed by HybridDog
parent 9c3fc65544
commit 8be1f839c5
5 changed files with 166 additions and 48 deletions

View File

@ -1,6 +1,8 @@
dofile(nether.path .. "/settings.lua")
local in_mapgen_env = nether.env_type == "ssm_mapgen"
-- vars
nether.v = {}
local v = nether.v
@ -132,14 +134,16 @@ function nether.query_contents()
end
if nether.log_level >= 1 then
local mod_prefix = in_mapgen_env and "[nether(mg)] " or "[nether] "
function nether:inform(msg, spam, t)
if spam <= self.log_level then
local info
if t then
info = "[nether] " .. msg .. (" after ca. %.3g s"):format(
info = mod_prefix .. msg .. (" after ca. %.3g s"):format(
(minetest.get_us_time() - t) / 1000000)
else
info = "[nether] " .. msg
info = mod_prefix .. msg
end
print(info)
if self.log_to_chat then