From a9d8df83d228635594b75a563a0a8d906b3b883a Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Fri, 27 Jul 2012 13:24:28 +0300 Subject: Make the rollback system VERY FUCKING GOD DAMN POWERFUL --- builtin/chatcommands.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'builtin/chatcommands.lua') diff --git a/builtin/chatcommands.lua b/builtin/chatcommands.lua index 28b5f4b1f..8e4639955 100644 --- a/builtin/chatcommands.lua +++ b/builtin/chatcommands.lua @@ -520,6 +520,7 @@ minetest.register_chatcommand("rollback_check", { dump(range).." seconds="..dump(seconds).."s)") minetest.rollback_punch_callbacks[name] = function(pos, node, puncher) local name = puncher:get_player_name() + minetest.chat_send_player(name, "Checking...") local actor, act_p, act_seconds = minetest.rollback_get_last_node_actor(pos, range, seconds) 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 nodedesc = minetest.pos_to_string(act_p) end - minetest.chat_send_player(name, "Last actor on "..nodedesc.." was ".. - actor..", "..dump(act_seconds).."s ago") + local nodename = minetest.env:get_node(act_p).name + minetest.chat_send_player(name, "Last actor on "..nodedesc.. + " was "..actor..", "..dump(act_seconds).. + "s ago (node is now "..nodename..")") end end, }) @@ -557,8 +560,12 @@ minetest.register_chatcommand("rollback", { dump(target_name).." since "..dump(seconds).." seconds.") local success, log = minetest.rollback_revert_actions_by( target_name, seconds) - for _,line in ipairs(log) do - minetest.chat_send_player(name, line) + if #log > 10 then + 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 if success then minetest.chat_send_player(name, "Reverting actions succeeded.") -- cgit v1.2.3