mapcleaner/chat.lua

48 lines
1.4 KiB
Lua
Raw Normal View History

2019-12-29 18:46:07 +01:00
local storage = mapcleaner.storage
2019-12-29 17:56:55 +01:00
2019-12-29 18:46:07 +01:00
minetest.register_chatcommand("mapcleaner_status", {
2019-12-29 17:56:55 +01:00
func = function(name)
2019-12-29 18:46:07 +01:00
local chunk_x = storage:get_int("chunk_x")
local chunk_y = storage:get_int("chunk_y")
local chunk_z = storage:get_int("chunk_z")
local generated_count = storage:get_int("generated_count")
local protected_count = storage:get_int("protected_count")
local delete_count = storage:get_int("delete_count")
local visited_count = storage:get_int("visited_count")
2019-12-29 17:56:55 +01:00
return true, "Generated: " .. generated_count ..
" Protected: " .. protected_count ..
" Deleted: " .. delete_count ..
2019-12-29 18:46:07 +01:00
" Count: " .. visited_count ..
" current chunk: " .. chunk_x .. "/" .. chunk_y .. "/" .. chunk_z
2019-12-29 17:56:55 +01:00
end
})
2019-12-30 20:34:50 +01:00
minetest.register_chatcommand("mapcleaner_max_time", {
description = "sets the max time usage in microseconds",
privs = { server = true },
func = function(name, params)
local value = tonumber(params)
if value then
mapcleaner.max_time_usage = value
return true, "New value: " .. value
else
return true, "Value: " .. mapcleaner.max_time_usage
end
end
})
minetest.register_chatcommand("mapcleaner_step_interval", {
description = "sets the step_interval in seconds",
privs = { server = true },
func = function(name, params)
local value = tonumber(params)
if value then
mapcleaner.step_interval = value
return true, "New value: " .. value
else
return true, "Value: " .. mapcleaner.step_interval
end
end
})