From 425bfd998b086b34486d3e7d5b02c0f93dbf9596 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Thu, 28 Feb 2013 19:05:53 -0300 Subject: [PATCH] Add about_modules command --- data/styles/30-minimap.otui | 2 -- modules/client_terminal/commands.lua | 28 ++++++++++++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/data/styles/30-minimap.otui b/data/styles/30-minimap.otui index c23c9485..3a2c9b9e 100644 --- a/data/styles/30-minimap.otui +++ b/data/styles/30-minimap.otui @@ -1,7 +1,5 @@ MinimapFlag < UIWidget size: 11 11 - anchors.left: parent.left - anchors.top: parent.top focusable: false MinimapCross < UIWidget diff --git a/modules/client_terminal/commands.lua b/modules/client_terminal/commands.lua index 71c5cbaa..aae09eb1 100644 --- a/modules/client_terminal/commands.lua +++ b/modules/client_terminal/commands.lua @@ -1,3 +1,8 @@ +local function pcolored(text, color) + color = color or 'white' + modules.client_terminal.addLine(text, color) +end + function draw_debug_boxes(enable) if enable == nil then enable = true end g_ui.setDebugBoxesDrawing(enable) @@ -51,21 +56,32 @@ function ls(path) local files = g_resources.listDirectoryFiles(path) for k,v in pairs(files) do if g_resources.directoryExists(path .. v) then - modules.client_terminal.addLine(path .. v, 'blue') + pcolored(path .. v, 'blue') else - pinfo(path .. v) + pcolored(path .. v) end end end function about_version() - pinfo(g_app.getName() .. ' ' .. g_app.getVersion() .. '\n' .. + pcolored(g_app.getName() .. ' ' .. g_app.getVersion() .. '\n' .. 'Rev ' .. g_app.getBuildRevision() .. ' ('.. g_app.getBuildCommit() .. ')\n' .. 'Built on ' .. g_app.getBuildDate()) end function about_graphics() - pinfo('Vendor ' .. g_graphics.getVendor() ) - pinfo('Renderer' .. g_graphics.getRenderer()) - pinfo('Version' .. g_graphics.getVersion()) + pcolored('Vendor ' .. g_graphics.getVendor() ) + pcolored('Renderer' .. g_graphics.getRenderer()) + pcolored('Version' .. g_graphics.getVersion()) +end + +function about_modules() + for k,m in pairs(g_modules.getModules()) do + local loadedtext + if m:isLoaded() then + pcolored(m:getName() .. ' => loaded', 'green') + else + pcolored(m:getName() .. ' => not loaded', 'red') + end + end end