From 5a40fe6649a9a0394b937101bd9d54657dc7d5d1 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 7 Jun 2018 14:17:16 +0100 Subject: [PATCH] Added Module: ExpGamingCore.Gui --- FactorioSoftmodManager.lua | 30 +- control.lua | 1 + doc/index.html | 43 +- doc/modules/ExpGamingCore.Commands.html | 15 +- ...ter.html => ExpGamingCore.Gui.Center.html} | 76 +++- ...uts.html => ExpGamingCore.Gui.Inputs.html} | 81 +++- ....left.html => ExpGamingCore.Gui.Left.html} | 76 +++- ...opup.html => ExpGamingCore.Gui.Popup.html} | 76 +++- ...olbar.html => ExpGamingCore.Gui.Test.html} | 58 ++- doc/modules/ExpGamingCore.Gui.Toolbar.html | 190 +++++++++ doc/modules/ExpGamingCore.Gui.html | 366 ++++++++++++++++++ doc/modules/ExpGamingCore.Ranking.html | 15 +- doc/modules/ExpGamingCore.Server.html | 15 +- doc/modules/ExpGamingCore.Sync.html | 15 +- doc/modules/ExpGamingLib.html | 277 ++++++++++++- doc/modules/FSM.html | 15 +- doc/modules/StdLib.Color.html | 15 +- doc/modules/StdLib.Game.html | 15 +- doc/modules/StdLib.String.html | 15 +- doc/modules/StdLib.Table.html | 224 +---------- doc/modules/StdLib.Time.html | 15 +- .../modules.expgamingcore.gui.control.html | 167 -------- modules/ExpGamingCore/Gui/control.lua | 162 ++++---- .../Gui/{GuiParts => src}/center.lua | 37 +- .../Gui/{GuiParts => src}/inputs.lua | 55 +-- .../Gui/{GuiParts => src}/left.lua | 43 +- .../Gui/{GuiParts => src}/popup.lua | 23 +- modules/ExpGamingCore/Gui/src/server.lua | 39 ++ .../Gui/{GuiParts => src}/test.lua | 18 +- .../Gui/{GuiParts => src}/toolbar.lua | 28 +- modules/ExpGamingCore/Ranking/control.lua | 17 +- modules/ExpGamingCore/Server/control.lua | 4 +- modules/ExpGamingCore/Server/src/commands.lua | 2 +- modules/ExpGamingCore/Sync/control.lua | 9 +- modules/ExpGamingCore/Sync/src/ranking.lua | 2 +- modules/ExpGamingLib/control.lua | 124 ++++++ modules/FactorioStdLib/Table/control.lua | 124 ------ modules/index.lua | 2 +- 38 files changed, 1621 insertions(+), 868 deletions(-) rename doc/modules/{modules.expgamingcore.gui.guiparts.center.html => ExpGamingCore.Gui.Center.html} (77%) rename doc/modules/{modules.expgamingcore.gui.guiparts.inputs.html => ExpGamingCore.Gui.Inputs.html} (85%) rename doc/modules/{modules.expgamingcore.gui.guiparts.left.html => ExpGamingCore.Gui.Left.html} (65%) rename doc/modules/{modules.expgamingcore.gui.guiparts.popup.html => ExpGamingCore.Gui.Popup.html} (61%) rename doc/modules/{modules.expgamingcore.gui.guiparts.toolbar.html => ExpGamingCore.Gui.Test.html} (54%) create mode 100644 doc/modules/ExpGamingCore.Gui.Toolbar.html create mode 100644 doc/modules/ExpGamingCore.Gui.html delete mode 100644 doc/modules/modules.expgamingcore.gui.control.html rename modules/ExpGamingCore/Gui/{GuiParts => src}/center.lua (88%) rename modules/ExpGamingCore/Gui/{GuiParts => src}/inputs.lua (89%) rename modules/ExpGamingCore/Gui/{GuiParts => src}/left.lua (87%) rename modules/ExpGamingCore/Gui/{GuiParts => src}/popup.lua (87%) create mode 100644 modules/ExpGamingCore/Gui/src/server.lua rename modules/ExpGamingCore/Gui/{GuiParts => src}/test.lua (90%) rename modules/ExpGamingCore/Gui/{GuiParts => src}/toolbar.lua (67%) diff --git a/FactorioSoftmodManager.lua b/FactorioSoftmodManager.lua index e501e76a..276043ab 100644 --- a/FactorioSoftmodManager.lua +++ b/FactorioSoftmodManager.lua @@ -26,7 +26,8 @@ local ReadOnlyManager = setmetatable({},{ -- provents the changing of any key that is not currentState if key == 'currentState' then -- provides a verbose that is always emited describing the change in state - Manager.verbose('Current state is now: "'..value.. '"; The verbose state is now: '..tostring(Manager.setVerbose[value]),true) + Manager.verbose(string.rep('__',10)..'| Start: '..value..' |'..string.rep('__',10),true) + Manager.verbose('The verbose state is now: '..tostring(Manager.setVerbose[value]),true) rawset(Manager,key,value) else error('Manager is read only please use included methods',2) end end, @@ -48,7 +49,7 @@ local function setupModuleName(name) end Manager.currentState = 'selfInit' --- selfInit > moduleLoad > moduleInit > moduleEnv +-- selfInit > moduleLoad > moduleInit > modulePost > moduleEnv --- Default output for the verbose -- @usage Manager.verbose('Hello, World!') @@ -98,6 +99,7 @@ Manager.setVerbose = setmetatable( -- @tfield boolean selfInit called while the manager is being set up -- @tfield boolean moduleLoad when a module is required by the manager -- @tfield boolean moduleInit when and within the initation of a module + -- @tfield boolean modulePost when and within the post of a module -- @tfield boolean moduleEnv during module runtime, this is a global option set within each module(module_verbose=true ln:1) for fine control -- @tfield boolean eventRegistered when a module registers its event handlers -- @tfield boolean errorCaught when an error is caught during runtime @@ -107,6 +109,7 @@ Manager.setVerbose = setmetatable( selfInit=true, moduleLoad=false, moduleInit=false, + modulePost=false, moduleEnv=false, eventRegistered=false, errorCaught=true, @@ -145,7 +148,8 @@ Manager.setVerbose = setmetatable( } ) -- call to verbose to show start up, will always be present -Manager.verbose('Current state is now: "selfInit"; The verbose state is: '..tostring(Manager.setVerbose.selfInit),true) +Manager.verbose(string.rep('__',10)..'| Start: selfInit |'..string.rep('__',10),true) +Manager.verbose('The verbose state is: '..tostring(Manager.setVerbose.selfInit),true) --- Used to avoid conflicts in the global table -- @usage global[key] -- used like the normal global table @@ -292,7 +296,7 @@ Manager.loadModules = setmetatable({}, end -- new state for the manager to allow control of verbose ReadOnlyManager.currentState = 'moduleInit' - -- runs though all loaded modules looking for on_init function; all other modules have been loaded + -- runs though all loaded modules looking for on_init function; all other modules have been loaded use this to load extra code based on opttial dependies for module_name,data in pairs(tbl) do -- looks for init so that init or on_init can be used if type(data) == 'table' and data.init and data.on_init == nil then data.on_init = data.init data.init = nil end @@ -308,6 +312,24 @@ Manager.loadModules = setmetatable({}, data.on_init = nil end end + -- new state for the manager to allow control of verbose + ReadOnlyManager.currentState = 'modulePost' + -- runs though all loaded modules looking for on_post function; all other modules have been loaded and inited, do not load extra code in this time only altar your own data + for module_name,data in pairs(tbl) do + -- looks for post so that post or on_post can be used + if type(data) == 'table' and data.post and data.on_post == nil then data.on_post = data.post data.post = nil end + if type(data) == 'table' and data.on_post and type(data.on_post) == 'function' then + Manager.verbose('Post for module: "'..module_name..'"') + local sandbox, success, err = Manager.sandbox(data.on_post,{module_name=setupModuleName(module_name),module_path=moduleIndex[tostring(module_name)]},data) + if success then + Manager.verbose('Successful post: "'..module_name..'"') + else + Manager.verbose('Failed post: "'..module_name..'" ('..err..')','errorCaught') + end + -- clears the post function so it cant be used in runtime + data.on_post = nil + end + end -- this could also be called runtime ReadOnlyManager.currentState = 'moduleEnv' end, diff --git a/control.lua b/control.lua index ba0f4c33..542acec0 100644 --- a/control.lua +++ b/control.lua @@ -16,6 +16,7 @@ Manager.setVerbose{ selfInit=true, -- called while the manager is being set up moduleLoad=true, -- when a module is required by the manager moduleInit=true, -- when and within the initation of a module + modulePost=true, -- when and within the post of a module moduleEnv=true, -- during module runtime, this is a global option set within each module for fine control eventRegistered=false, -- when a module registers its event handlers errorCaught=true, -- when an error is caught during runtime diff --git a/doc/index.html b/doc/index.html index 221fde79..af9affa7 100644 --- a/doc/index.html +++ b/doc/index.html @@ -33,12 +33,13 @@