From 51418e87de28f6cffa1b2d244145b55790cf3048 Mon Sep 17 00:00:00 2001 From: LemADEC Date: Fri, 12 May 2017 20:38:50 +0200 Subject: [PATCH] Added event viewer to CC to help debugging --- .../lua.ComputerCraft/common/eventviewer | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/main/resources/assets/warpdrive/lua.ComputerCraft/common/eventviewer diff --git a/src/main/resources/assets/warpdrive/lua.ComputerCraft/common/eventviewer b/src/main/resources/assets/warpdrive/lua.ComputerCraft/common/eventviewer new file mode 100644 index 00000000..9b1ab1b4 --- /dev/null +++ b/src/main/resources/assets/warpdrive/lua.ComputerCraft/common/eventviewer @@ -0,0 +1,40 @@ +local abort = false +term.setBackgroundColor(colors.black) + +Colors = { + colors.lime, + colors.yellow, + colors.white, + colors.white, + colors.white, + colors.white, + colors.white +} +repeat + params = { os.pullEventRaw() } + eventName = params[1] + side = params[2] + if side == nil then side = "none" end + print("") + term.setTextColor(colors.red) + term.write("Event") + local index = 1 + for key, value in pairs(params) do + term.setTextColor(Colors[index]) + index = index + 1 + if (type(value) == "boolean") then + if value then + term.write(" true") + else + term.write(" false") + end + else + term.write(" " .. value) + end + end + term.write(".") + if eventName == "terminate" then + abort = true + end +until abort +print("")