diff --git a/modules/ExpGamingCore/Commands/control.lua b/modules/ExpGamingCore/Commands/control.lua index 2c68a5ab..45737aec 100644 --- a/modules/ExpGamingCore/Commands/control.lua +++ b/modules/ExpGamingCore/Commands/control.lua @@ -6,9 +6,7 @@ local Game = require('FactorioStdLib.Game') local Color = require('FactorioStdLib.Color') --- this is optional and is hanndled by it being present -local success, Ranking = pcall(require,'ExpGamingCore.Ranking') -if not success then Ranking = nil end success = nil +local Ranking -- this is optional and is hanndled by it being present, it is loaded on init --- Used as an error constant for validation -- @field commands.error @@ -226,6 +224,10 @@ commands.add_command = function(name, description, inputs, callback) end) end +function commands:on_init() + if loaded_modules['ExpGamingCore.Ranking'] then Ranking = require('ExpGamingCore.Ranking') end +end + --[[ command example diff --git a/modules/ExpGamingCore/Commands/softmod.json b/modules/ExpGamingCore/Commands/softmod.json index ae409684..ff4d1f6b 100644 --- a/modules/ExpGamingCore/Commands/softmod.json +++ b/modules/ExpGamingCore/Commands/softmod.json @@ -1,7 +1,6 @@ { "name": "Commands", "version": "4.0.0", - "module": "commands", "type": "Submodule", "description": "A better command handler than the base game.", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.Commands.zip", diff --git a/modules/ExpGamingCore/Gui/control.lua b/modules/ExpGamingCore/Gui/control.lua index f907d7f3..c531e4a8 100644 --- a/modules/ExpGamingCore/Gui/control.lua +++ b/modules/ExpGamingCore/Gui/control.lua @@ -157,6 +157,8 @@ script.on_event('on_player_respawned',function(event) end) function Gui:on_init() + self.left:on_init(); self.left.on_init = nil + self.toolbar:on_init(); self.toolbar.on_init = nil if loaded_modules['ExpGamingCore.Server'] then verbose('ExpGamingCore.Server is installed; Loading server src') require(module_path..'/src/server',{Gui=Gui}) end if loaded_modules['ExpGamingCore.Ranking'] then verbose('ExpGamingCore.Ranking is installed; Loading ranking src') diff --git a/modules/ExpGamingCore/Gui/softmod.json b/modules/ExpGamingCore/Gui/softmod.json index a2468766..070b63fb 100644 --- a/modules/ExpGamingCore/Gui/softmod.json +++ b/modules/ExpGamingCore/Gui/softmod.json @@ -1,7 +1,6 @@ { "name": "Gui", "version": "4.0.0", - "module": "Gui", "type": "Submodule", "description": "Adds a objective version to custom guis.", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.Gui.zip", diff --git a/modules/ExpGamingCore/Gui/src/left.lua b/modules/ExpGamingCore/Gui/src/left.lua index 65a44fa1..6146e3f6 100644 --- a/modules/ExpGamingCore/Gui/src/left.lua +++ b/modules/ExpGamingCore/Gui/src/left.lua @@ -9,8 +9,7 @@ local Game = require('FactorioStdLib.Game') local Color = require('FactorioStdLib.Color') -local success, Ranking = pcall(require,'ExpGamingCore.Ranking') -if not success then Ranking = nil end success = nil +local Ranking -- this is optional and is hanndled by it being present, it is loaded on init local mod_gui = require("mod-gui") local Gui = Gui -- this is to force gui to remain in the ENV @@ -181,4 +180,8 @@ left.on_player_joined_game = function(event) end end +function left:on_init() + if loaded_modules['ExpGamingCore.Ranking'] then Ranking = require('ExpGamingCore.Ranking') end +end + return left \ No newline at end of file diff --git a/modules/ExpGamingCore/Gui/src/toolbar.lua b/modules/ExpGamingCore/Gui/src/toolbar.lua index 52883df1..a79391fb 100644 --- a/modules/ExpGamingCore/Gui/src/toolbar.lua +++ b/modules/ExpGamingCore/Gui/src/toolbar.lua @@ -8,8 +8,7 @@ -- @function _comment local Game = require('FactorioStdLib.Game') -local success, Ranking = pcall(require,'ExpGamingCore.Ranking') -if not success then Ranking = nil end success = nil +local Ranking -- this is optional and is hanndled by it being present, it is loaded on init local mod_gui = require("mod-gui") local Gui = Gui -- this is to force gui to remain in the ENV @@ -49,6 +48,10 @@ function toolbar.draw(player) end end +function toolbar:on_init() + if loaded_modules['ExpGamingCore.Ranking'] then Ranking = require('ExpGamingCore.Ranking') end +end + toolbar.on_rank_change = toolbar.draw toolbar.on_player_joined_game = toolbar.draw return toolbar \ No newline at end of file diff --git a/modules/ExpGamingCore/Ranking/softmod.json b/modules/ExpGamingCore/Ranking/softmod.json index 08bcd50e..5aec2eac 100644 --- a/modules/ExpGamingCore/Ranking/softmod.json +++ b/modules/ExpGamingCore/Ranking/softmod.json @@ -1,7 +1,6 @@ { "name": "Ranking", - "version": "4.0.0", - "module": "Ranking", + "version": "4.0.0", "type": "Submodule", "description": "A full ranking system for factorio.", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.Ranking.zip", diff --git a/modules/ExpGamingCore/Server/softmod.json b/modules/ExpGamingCore/Server/softmod.json index 671b8f67..a8224590 100644 --- a/modules/ExpGamingCore/Server/softmod.json +++ b/modules/ExpGamingCore/Server/softmod.json @@ -1,7 +1,6 @@ { "name": "Server", - "version": "4.0.0", - "module": "Server", + "version": "4.0.0", "type": "Submodule", "description": "Adds a thread system and event listening and a admin bypass (recommend to disable /c and use optional /interface)", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.Server.zip", diff --git a/modules/ExpGamingCore/Server/src/commands.lua b/modules/ExpGamingCore/Server/src/commands.lua index 5f79e805..16fbc551 100644 --- a/modules/ExpGamingCore/Server/src/commands.lua +++ b/modules/ExpGamingCore/Server/src/commands.lua @@ -27,7 +27,8 @@ commands.add_command('interface',{'Server.interface-description'}, { env.position = game.player.position env.entity = game.player.selected env.tile = game.player.surface.get_tile(game.player.position) - if Ranking and Ranking.get_rank then env.rank = Ranking.get_rank(game.player) end + -- this works if loaded modules is not present as Mamager will always have the modules + if Manager['ExpGamingCore.Ranking'] then env.rank = Manager['ExpGamingCore.Ranking'].get_rank(game.player) end end -- runs the function local success, err = Server.interface(callback,false,env) diff --git a/modules/ExpGamingCore/Sync/softmod.json b/modules/ExpGamingCore/Sync/softmod.json index b935e940..819e42ef 100644 --- a/modules/ExpGamingCore/Sync/softmod.json +++ b/modules/ExpGamingCore/Sync/softmod.json @@ -1,7 +1,6 @@ { "name": "Sync", "version": "4.0.0", - "module": "Sync", "type": "Submodule", "description": "Allows syncing with an outside server and info panle.", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.Sync.zip", diff --git a/modules/ExpGamingCore/softmod.json b/modules/ExpGamingCore/softmod.json index eea91389..e65dc3a1 100644 --- a/modules/ExpGamingCore/softmod.json +++ b/modules/ExpGamingCore/softmod.json @@ -1,7 +1,6 @@ { "name": "ExpGamingCore", "version": "4.0.0", - "module": "expGamingCore", "type": "Collection", "description": "Explosive Gaming Core Files", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.zip", @@ -18,7 +17,6 @@ "Commands": { "name": "Commands", "version": "4.0.0", - "module": "commands", "type": "Submodule", "description": "A better command handler than the base game.", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.Commands.zip", @@ -40,7 +38,6 @@ "Gui": { "name": "Gui", "version": "4.0.0", - "module": "Gui", "description": "Adds a objective version to custom guis.", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.Gui.zip", "keywords": [ @@ -64,7 +61,6 @@ "Ranking": { "name": "Ranking", "version": "4.0.0", - "module": "Ranking", "description": "A full ranking system for factorio.", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.Ranking.zip", "keywords": [ @@ -89,7 +85,6 @@ "Server": { "name": "Server", "version": "4.0.0", - "module": "Server", "description": "Adds a thread system and event listening and a admin bypass (recommend to disable /c and use optional /interface)", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.Server.zip", "keywords": [ @@ -108,7 +103,6 @@ "FactorioStdLib.Color": "^0.8.0", "FactorioStdLib.String": "^0.8.0", "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Ranking": "?^4.0.0", "ExpGamingCore.Commands": "?^4.0.0" }, "type": "Submodule" @@ -116,7 +110,6 @@ "Sync": { "name": "Sync", "version": "4.0.0", - "module": "Sync", "description": "Allows syncing with an outside server and info panle.", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.Sync.zip", "keywords": [ diff --git a/modules/ExpGamingLib/softmod.json b/modules/ExpGamingLib/softmod.json index 336f3a0e..76e09242 100644 --- a/modules/ExpGamingLib/softmod.json +++ b/modules/ExpGamingLib/softmod.json @@ -1,7 +1,6 @@ { "name": "ExpGamingLib", "version": "4.0.0", - "module": "GlobalLib", "type": "Module", "description": "Adds some common functions used though out all ExpGaming modules", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingLib.zip", diff --git a/modules/FactorioStdLib/Color/softmod.json b/modules/FactorioStdLib/Color/softmod.json index 57e7935f..424e86a5 100644 --- a/modules/FactorioStdLib/Color/softmod.json +++ b/modules/FactorioStdLib/Color/softmod.json @@ -1,7 +1,6 @@ { "name": "Color", "version": "0.8.0", - "module": "Color", "type": "Submodule", "description": "A defines module for retrieving colors by name.", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/FactorioStdLib.Color.zip", diff --git a/modules/FactorioStdLib/Game/softmod.json b/modules/FactorioStdLib/Game/softmod.json index 4c1d8624..dba6d9f4 100644 --- a/modules/FactorioStdLib/Game/softmod.json +++ b/modules/FactorioStdLib/Game/softmod.json @@ -1,7 +1,6 @@ { "name": "Game", "version": "0.8.0", - "module": "Game", "type": "Submodule", "description": "The game module.", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/FactorioStdLib.Game.zip", diff --git a/modules/FactorioStdLib/String/softmod.json b/modules/FactorioStdLib/String/softmod.json index ac0f23df..f6263d0a 100644 --- a/modules/FactorioStdLib/String/softmod.json +++ b/modules/FactorioStdLib/String/softmod.json @@ -1,7 +1,6 @@ { "name": "String", "version": "0.8.0", - "module": "string", "type": "Submodule", "description": "Extends Lua 5.2 string.", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/FactorioStdLib.String.zip", diff --git a/modules/FactorioStdLib/Table/softmod.json b/modules/FactorioStdLib/Table/softmod.json index e37d4faa..3b033efb 100644 --- a/modules/FactorioStdLib/Table/softmod.json +++ b/modules/FactorioStdLib/Table/softmod.json @@ -1,7 +1,6 @@ { "name": "Table", "version": "0.8.0", - "module": "table", "type": "Submodule", "description": "Extends Lua 5.2 table.", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/FactorioStdLib.Table.zip", diff --git a/modules/FactorioStdLib/softmod.json b/modules/FactorioStdLib/softmod.json index 64d5009f..b545d9bb 100644 --- a/modules/FactorioStdLib/softmod.json +++ b/modules/FactorioStdLib/softmod.json @@ -1,7 +1,6 @@ { "name": "FactorioStdLib", "version": "0.8.0", - "module": "factorioStdLib", "type": "Collection", "description": "Factorio Standard Library Projects", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/FactorioStdLib.zip", @@ -17,7 +16,6 @@ "Color": { "name": "Color", "version": "0.8.0", - "module": "Color", "type": "Submodule", "description": "A defines module for retrieving colors by name.", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/FactorioStdLib.Color.zip", @@ -33,7 +31,6 @@ "Game": { "name": "Game", "version": "0.8.0", - "module": "Game", "type": "Submodule", "description": "The game module.", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/FactorioStdLib.Game.zip", @@ -49,7 +46,6 @@ "String": { "name": "String", "version": "0.8.0", - "module": "string", "type": "Submodule", "description": "Extends Lua 5.2 string.", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/FactorioStdLib.String.zip", @@ -65,7 +61,6 @@ "Table": { "name": "Table", "version": "0.8.0", - "module": "table", "type": "Submodule", "description": "Extends Lua 5.2 table.", "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/FactorioStdLib.Table.zip", diff --git a/softmod.json b/softmod.json index fe58dc28..79c4d3c2 100644 --- a/softmod.json +++ b/softmod.json @@ -1,7 +1,7 @@ { "name": "ExpGamingScenario", "version": "0.16.51", - "module": "expGamingScenario", + "type": "Scenario", "description": "Explosive gaming's factorio secenario ran on every public server", "modules": {