From 4f342a123756235d794fed0f57546a8109d5c8a6 Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 31 Jul 2022 06:17:09 +0200 Subject: [PATCH] fix biometp output --- biometp/init.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/biometp/init.lua b/biometp/init.lua index ebe7b8a..7c56ade 100644 --- a/biometp/init.lua +++ b/biometp/init.lua @@ -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)