fix biometp output

This commit is contained in:
cora 2022-07-31 06:17:09 +02:00
parent d8f052b19f
commit 4f342a1237
1 changed files with 6 additions and 5 deletions

View File

@ -8,6 +8,7 @@ minetest.register_on_mods_loaded(function()
for k,_ in pairs(minetest.registered_biomes) do
table.insert(biomekeys,k)
end
table.shuffle(biomekeys)
end)
local function next_biome()
@ -19,7 +20,7 @@ local function next_biome()
active = false
end
local function tp_step(n)
local function tp_biome(n)
local b = next_biome()
if not b then
minetest.chat_send_player(n,"Done! "..tostring(#biomekeys).." biomes visited.")
@ -31,8 +32,8 @@ local function tp_step(n)
minetest.registered_chatcommands["findbiome"].func(n,b)
local name = minetest.registered_biomes[biomekeys[current]].name
minetest.chat_send_player(n,"("..current.."/"..#biomekeys.."): "..name)
minetest.log("action","[mcl_structures] BIOME: "..name)
if active then minetest.after(wait,tp_step,n) end
--minetest.log("action","[mcl_structures] BIOME: "..name)
if active then minetest.after(wait,tp_biome,n) end
end
minetest.register_chatcommand("biometp",{
@ -57,9 +58,9 @@ minetest.register_chatcommand("biometp",{
active = true
old_damage = minetest.settings:get_bool("enable_damage")
minetest.settings:set_bool("enable_damage",false)
minetest.after(wait,tp_step,n)
minetest.after(wait,tp_biome,n)
if stay_near then minetest.get_player_by_name(n):set_pos(stay_near) end
return true,"Biometp started ETA: "..#biomekeys * wait / 60 .."mins"
return true,"Biometp started ETA: "..tostring(math.ceil(#biomekeys * wait / 60)) .."mins"
end
active = false
minetest.settings:set_bool("enable_damage",old_damage)