Add biometp

This commit is contained in:
cora 2022-06-25 03:19:23 +02:00
parent febb31161b
commit 57aeecc76e
2 changed files with 48 additions and 0 deletions

45
biometp/init.lua Normal file
View File

@ -0,0 +1,45 @@
local current = 0
local biomekeys = {}
local wait = 15
active = false
minetest.register_on_mods_loaded(function()
for k,_ in pairs(minetest.registered_biomes) do
table.insert(biomekeys,k)
end
end)
local function next_biome()
current = current + 1
if biomekeys[current] then
return minetest.registered_biomes[biomekeys[current]].name
else
current = 0
end
end
local function tp_step(n)
minetest.registered_chatcommands["findbiome"].func(n,next_biome())
minetest.chat_send_player(n,"Teleporting to "..minetest.registered_biomes[biomekeys[current]].name.." ("..current.."/"..#biomekeys..")")
if active then minetest.after(5,tp_step,n) end
end
minetest.register_chatcommand("biometp",{
privs = {debug = true},
description = "Teleports to all biomes successively.",
params = "|<tp interval>",
func = function(n,p)
local pn = tonumber(p)
if pn and pn > 0 then
wait = pn
return true,"Biometp interval set to "..pn
end
if not active then
active = true
tp_step(n)
return true,"Biometp started ETA: "..#biomekeys * wait / 60 .."mins"
else
active = false
return true,"Biometp stopped"
end
end
})

3
biometp/mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = biometp
author = cora
description = Adds the /biometp debug command that teleports to all biomes successively waiting a set interval