Add /nodeuse command to limit report to building actions
This commit is contained in:
parent
d31bc2e71b
commit
0a142a2a79
@ -248,15 +248,33 @@ local function fmtrpt(t, id)
|
||||
return table_concat(r, " ")
|
||||
end
|
||||
|
||||
local function blockuseload(name)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not player then return end
|
||||
local id = blockid(player:get_pos())
|
||||
return deepadd(deepadd({}, getsub(db, id)), dbload(id)), id
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("blockuse", {
|
||||
privs = {server = true},
|
||||
description = "Statistics about usage within the current mapblock.",
|
||||
func = function(name)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not player then return end
|
||||
local id = blockid(player:get_pos())
|
||||
local t, id = blockuseload(name)
|
||||
minetest.chat_send_player(name, fmtrpt(t, id))
|
||||
end
|
||||
})
|
||||
|
||||
local t = deepadd(deepadd({}, getsub(db, id)), dbload(id))
|
||||
minetest.register_chatcommand("nodeuse", {
|
||||
privs = {server = true},
|
||||
description = "Statistics about node changes within the current mapblock.",
|
||||
func = function(name)
|
||||
local t, id = blockuseload(name)
|
||||
for k, v in pairs(t) do
|
||||
t[k] = (v.dig or v.place) and {
|
||||
dig = v.dig,
|
||||
place = v.place
|
||||
} or nil
|
||||
end
|
||||
minetest.chat_send_player(name, fmtrpt(t, id))
|
||||
end
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user