1
0
mirror of https://github.com/HybridDog/nether-pack.git synced 2024-12-26 02:30:24 +01:00

Update debug messages

This commit is contained in:
Hybrid Dog 2017-12-26 09:58:32 +01:00
parent 2ce9440fdf
commit 8a3d0b0634

View File

@ -11,7 +11,7 @@
-- godkiller447 (ideas) -- godkiller447 (ideas)
-- If I didn't list you, please let me know! -- If I didn't list you, please let me know!
local load_time_start = os.clock() local load_time_start = minetest.get_us_time()
if not rawget(_G, "nether") then if not rawget(_G, "nether") then
nether = {} nether = {}
@ -99,8 +99,8 @@ if nether.info then
if spam <= self.max_spam then if spam <= self.max_spam then
local info local info
if t then if t then
info = "[nether] " .. msg .. info = "[nether] " .. msg .. (" after ca. %.3g s"):format(
(" after ca. %.2fs"):format(os.clock() - t) (minetest.get_us_time() - t) / 1000000)
else else
info = "[nether] " .. msg info = "[nether] " .. msg
end end
@ -343,7 +343,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
return return
end end
local t1 = os.clock() local t1 = minetest.get_us_time()
nether:inform("generates at: x=["..minp.x.."; "..maxp.x.."]; y=[" .. nether:inform("generates at: x=["..minp.x.."; "..maxp.x.."]; y=[" ..
minp.y.."; "..maxp.y.."]; z=["..minp.z.."; "..maxp.z.."]", 2) minp.y.."; "..maxp.y.."]; z=["..minp.z.."; "..maxp.z.."]", 2)
@ -596,23 +596,28 @@ minetest.register_on_generated(function(minp, maxp, seed)
nether:inform("nodes set", 2, t1) nether:inform("nodes set", 2, t1)
local t2 = os.clock() local t2 = minetest.get_us_time()
local tr_bl_cnt = 0
if structures_enabled then if structures_enabled then -- Blood netherstructures
for _,v in ipairs(tab) do tr_bl_cnt = #tab
nether.grow_netherstructure(v, true) for i = 1,tr_bl_cnt do
nether.grow_netherstructure(tab[i], true)
end end
end end
if forest_possible then --Trees: if forest_possible then -- Forest trees
for _,v in ipairs(trees) do tr_bl_cnt = tr_bl_cnt + #trees
nether.grow_tree(v, true) for i = 1,#trees do
nether.grow_tree(trees[i], true)
end end
end end
nether:inform("trees set", 2, t2) if tr_bl_cnt > 0 then
nether:inform(tr_bl_cnt .. " trees and blood structures set", 2, t2)
end
t2 = os.clock() t2 = minetest.get_us_time()
minetest.fix_light(minp, maxp) minetest.fix_light(minp, maxp)
nether:inform("light fixed", 2, t2) nether:inform("light fixed", 2, t2)
@ -622,7 +627,7 @@ end)
function nether.grow_netherstructure(pos, generated) function nether.grow_netherstructure(pos, generated)
local t1 = os.clock() local t1 = minetest.get_us_time()
if not contents_defined then if not contents_defined then
define_contents() define_contents()
@ -720,7 +725,7 @@ local leaf_thickness = 3 --a bigger number results in more blank trees
local h_trunk_max = h_max-h_arm_max local h_trunk_max = h_max-h_arm_max
function nether.grow_tree(pos, generated) function nether.grow_tree(pos, generated)
local t1 = os.clock() local t1 = minetest.get_us_time()
if not contents_defined then if not contents_defined then
define_contents() define_contents()
@ -1019,9 +1024,9 @@ dofile(path.."/portal.lua")
dofile(path.."/guide.lua") dofile(path.."/guide.lua")
local time = math.floor(tonumber(os.clock()-load_time_start)*100+0.5)/100 local time = (minetest.get_us_time() - load_time_start) / 1000000
local msg = "[nether] loaded after ca. "..time local msg = ("[nether] loaded after ca. %g seconds."):format(time)
if time > 0.05 then if time > 0.01 then
print(msg) print(msg)
else else
minetest.log("info", msg) minetest.log("info", msg)