Make the rollback system VERY FUCKING GOD DAMN POWERFUL

This commit is contained in:
Perttu Ahola 2012-07-27 13:24:28 +03:00 committed by Nils Dagsson Moskopp
parent ebe1842d0b
commit 02416dc628
Signed by: erle
GPG Key ID: A3BC671C35191080
1 changed files with 11 additions and 4 deletions

View File

@ -520,6 +520,7 @@ minetest.register_chatcommand("rollback_check", {
dump(range).." seconds="..dump(seconds).."s)") dump(range).." seconds="..dump(seconds).."s)")
minetest.rollback_punch_callbacks[name] = function(pos, node, puncher) minetest.rollback_punch_callbacks[name] = function(pos, node, puncher)
local name = puncher:get_player_name() local name = puncher:get_player_name()
minetest.chat_send_player(name, "Checking...")
local actor, act_p, act_seconds = local actor, act_p, act_seconds =
minetest.rollback_get_last_node_actor(pos, range, seconds) minetest.rollback_get_last_node_actor(pos, range, seconds)
if actor == "" then if actor == "" then
@ -531,8 +532,10 @@ minetest.register_chatcommand("rollback_check", {
if act_p.x ~= pos.x or act_p.y ~= pos.y or act_p.z ~= pos.z then if act_p.x ~= pos.x or act_p.y ~= pos.y or act_p.z ~= pos.z then
nodedesc = minetest.pos_to_string(act_p) nodedesc = minetest.pos_to_string(act_p)
end end
minetest.chat_send_player(name, "Last actor on "..nodedesc.." was ".. local nodename = minetest.env:get_node(act_p).name
actor..", "..dump(act_seconds).."s ago") minetest.chat_send_player(name, "Last actor on "..nodedesc..
" was "..actor..", "..dump(act_seconds)..
"s ago (node is now "..nodename..")")
end end
end, end,
}) })
@ -557,8 +560,12 @@ minetest.register_chatcommand("rollback", {
dump(target_name).." since "..dump(seconds).." seconds.") dump(target_name).." since "..dump(seconds).." seconds.")
local success, log = minetest.rollback_revert_actions_by( local success, log = minetest.rollback_revert_actions_by(
target_name, seconds) target_name, seconds)
for _,line in ipairs(log) do if #log > 10 then
minetest.chat_send_player(name, line) minetest.chat_send_player(name, "(log is too long to show)")
else
for _,line in ipairs(log) do
minetest.chat_send_player(name, line)
end
end end
if success then if success then
minetest.chat_send_player(name, "Reverting actions succeeded.") minetest.chat_send_player(name, "Reverting actions succeeded.")