Module ExpGamingCore.Commands
+Module ExpGamingCore.Command
A full ranking system for factorio.
Info:
diff --git a/doc/modules/ExpGamingCore.Gui.Center.html b/doc/modules/ExpGamingCore.Gui.Center.html index bc7e4012..7e737fd7 100644 --- a/doc/modules/ExpGamingCore.Gui.Center.html +++ b/doc/modules/ExpGamingCore.Gui.Center.html @@ -39,7 +39,7 @@Modules
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs diff --git a/doc/modules/ExpGamingCore.Gui.Inputs.html b/doc/modules/ExpGamingCore.Gui.Inputs.html index 110bc0cb..6b664f81 100644 --- a/doc/modules/ExpGamingCore.Gui.Inputs.html +++ b/doc/modules/ExpGamingCore.Gui.Inputs.html @@ -39,7 +39,7 @@
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs diff --git a/doc/modules/ExpGamingCore.Gui.Left.html b/doc/modules/ExpGamingCore.Gui.Left.html index a5f05fb2..72cfc953 100644 --- a/doc/modules/ExpGamingCore.Gui.Left.html +++ b/doc/modules/ExpGamingCore.Gui.Left.html @@ -39,7 +39,7 @@
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs diff --git a/doc/modules/ExpGamingCore.Gui.Popup.html b/doc/modules/ExpGamingCore.Gui.Popup.html index c8f3e8bd..e4f299ea 100644 --- a/doc/modules/ExpGamingCore.Gui.Popup.html +++ b/doc/modules/ExpGamingCore.Gui.Popup.html @@ -39,7 +39,7 @@
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs diff --git a/doc/modules/ExpGamingCore.Gui.Test.html b/doc/modules/ExpGamingCore.Gui.Test.html index 14cdbfe4..0e513ba3 100644 --- a/doc/modules/ExpGamingCore.Gui.Test.html +++ b/doc/modules/ExpGamingCore.Gui.Test.html @@ -39,7 +39,7 @@
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs diff --git a/doc/modules/ExpGamingCore.Gui.Toolbar.html b/doc/modules/ExpGamingCore.Gui.Toolbar.html index b918589a..474f6f7b 100644 --- a/doc/modules/ExpGamingCore.Gui.Toolbar.html +++ b/doc/modules/ExpGamingCore.Gui.Toolbar.html @@ -39,7 +39,7 @@
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs diff --git a/doc/modules/ExpGamingCore.Gui.html b/doc/modules/ExpGamingCore.Gui.html index c75c227f..c660b097 100644 --- a/doc/modules/ExpGamingCore.Gui.html +++ b/doc/modules/ExpGamingCore.Gui.html @@ -42,7 +42,7 @@
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs @@ -112,7 +112,7 @@
-
- This file will be loaded when ExpGamingCore.Commands is present
+ This file will be loaded when ExpGamingCore.Command is present
diff --git a/doc/modules/ExpGamingCore.Ranking.html b/doc/modules/ExpGamingCore.Ranking.html
index 4c716bbe..fefd9826 100644
--- a/doc/modules/ExpGamingCore.Ranking.html
+++ b/doc/modules/ExpGamingCore.Ranking.html
@@ -44,7 +44,7 @@
Modules
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs diff --git a/doc/modules/ExpGamingCore.Server.html b/doc/modules/ExpGamingCore.Server.html index 60ba1b1f..36079e8c 100644 --- a/doc/modules/ExpGamingCore.Server.html +++ b/doc/modules/ExpGamingCore.Server.html @@ -43,7 +43,7 @@
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs @@ -172,7 +172,7 @@
-
- This file will be loaded when ExpGamingCore.Commands is present
+ This file will be loaded when ExpGamingCore.Command is present
diff --git a/doc/modules/ExpGamingCore.Sync.html b/doc/modules/ExpGamingCore.Sync.html
index 26adcf1b..229a7e31 100644
--- a/doc/modules/ExpGamingCore.Sync.html
+++ b/doc/modules/ExpGamingCore.Sync.html
@@ -43,7 +43,7 @@
Modules
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs diff --git a/doc/modules/ExpGamingLib.html b/doc/modules/ExpGamingLib.html index dcbaf498..9477c9b7 100644 --- a/doc/modules/ExpGamingLib.html +++ b/doc/modules/ExpGamingLib.html @@ -40,7 +40,7 @@
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs diff --git a/doc/modules/FSM.html b/doc/modules/FSM.html index 8b5181d7..6dbda4a9 100644 --- a/doc/modules/FSM.html +++ b/doc/modules/FSM.html @@ -41,7 +41,7 @@
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs diff --git a/doc/modules/StdLib.Color.html b/doc/modules/StdLib.Color.html index 8e670912..7d33d421 100644 --- a/doc/modules/StdLib.Color.html +++ b/doc/modules/StdLib.Color.html @@ -40,7 +40,7 @@
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs diff --git a/doc/modules/StdLib.Game.html b/doc/modules/StdLib.Game.html index 42280e6d..98b84788 100644 --- a/doc/modules/StdLib.Game.html +++ b/doc/modules/StdLib.Game.html @@ -39,7 +39,7 @@
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs diff --git a/doc/modules/StdLib.String.html b/doc/modules/StdLib.String.html index f413b85e..af0f6083 100644 --- a/doc/modules/StdLib.String.html +++ b/doc/modules/StdLib.String.html @@ -39,7 +39,7 @@
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs diff --git a/doc/modules/StdLib.Table.html b/doc/modules/StdLib.Table.html index 5e561c4f..78cbb142 100644 --- a/doc/modules/StdLib.Table.html +++ b/doc/modules/StdLib.Table.html @@ -39,7 +39,7 @@
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs diff --git a/doc/modules/StdLib.Time.html b/doc/modules/StdLib.Time.html index aeb59111..08d304c6 100644 --- a/doc/modules/StdLib.Time.html +++ b/doc/modules/StdLib.Time.html @@ -39,7 +39,7 @@
- FSM -
- ExpGamingCore.Commands +
- ExpGamingCore.Command
- ExpGamingCore.Gui
- ExpGamingCore.Gui.Center
- ExpGamingCore.Gui.Inputs diff --git a/modules/ExpGamingAdmin/Commands/softmod.json b/modules/ExpGamingAdmin/Commands/softmod.json index e694e727..434d27db 100644 --- a/modules/ExpGamingAdmin/Commands/softmod.json +++ b/modules/ExpGamingAdmin/Commands/softmod.json @@ -17,7 +17,7 @@ ], "dependencies": { "ExpGamingLib": "^4.0.0", - "ExpGamingCore.Commands": "^4.0.0", + "ExpGamingCore.Command": "^4.0.0", "ExpGamingAdmin.TempBan": "?^4.0.0", "ExpGamingAdmin.Jail": "?^4.0.0", "ExpGamingAdmin.Warnings": "?^4.0.0", diff --git a/modules/ExpGamingAdmin/softmod.json b/modules/ExpGamingAdmin/softmod.json index 64267287..19247a7a 100644 --- a/modules/ExpGamingAdmin/softmod.json +++ b/modules/ExpGamingAdmin/softmod.json @@ -261,7 +261,7 @@ ], "dependencies": { "ExpGamingLib": "^4.0.0", - "ExpGamingCore.Commands": "^4.0.0", + "ExpGamingCore.Command": "^4.0.0", "ExpGamingAdmin.TempBan": "?^4.0.0", "ExpGamingAdmin.Jail": "?^4.0.0", "ExpGamingAdmin.Warnings": "?^4.0.0", diff --git a/modules/ExpGamingCommands/bonus/softmod.json b/modules/ExpGamingCommands/bonus/softmod.json index 89214d92..35f82ac9 100644 --- a/modules/ExpGamingCommands/bonus/softmod.json +++ b/modules/ExpGamingCommands/bonus/softmod.json @@ -15,7 +15,7 @@ "dependencies": { "FactorioStdLib.Game": "^0.8.0", "ExpGamingLib": "^4.0.0", - "ExpGamingCore.Commands": "^4.0.0", + "ExpGamingCore.Command": "^4.0.0", "ExpGamingCore.Ranking": "?^4.0.0" }, "collection": "ExpGamingCommands_4.0.0" diff --git a/modules/ExpGamingCommands/cheatMode/softmod.json b/modules/ExpGamingCommands/cheatMode/softmod.json index 68d16ef5..fb94b029 100644 --- a/modules/ExpGamingCommands/cheatMode/softmod.json +++ b/modules/ExpGamingCommands/cheatMode/softmod.json @@ -13,7 +13,7 @@ "Hacks" ], "dependencies": { - "ExpGamingCore.Commands": "^4.0.0" + "ExpGamingCore.Command": "^4.0.0" }, "collection": "ExpGamingCommands_4.0.0" } \ No newline at end of file diff --git a/modules/ExpGamingCommands/home/softmod.json b/modules/ExpGamingCommands/home/softmod.json index 62675d38..9db381c2 100644 --- a/modules/ExpGamingCommands/home/softmod.json +++ b/modules/ExpGamingCommands/home/softmod.json @@ -14,7 +14,7 @@ ], "dependencies": { "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Commands": "^4.0.0" + "ExpGamingCore.Command": "^4.0.0" }, "collection": "ExpGamingCommands_4.0.0" } \ No newline at end of file diff --git a/modules/ExpGamingCommands/kill/softmod.json b/modules/ExpGamingCommands/kill/softmod.json index 2a60b24c..7fac05a5 100644 --- a/modules/ExpGamingCommands/kill/softmod.json +++ b/modules/ExpGamingCommands/kill/softmod.json @@ -13,7 +13,7 @@ "Tool" ], "dependencies": { - "ExpGamingCore.Commands": "^4.0.0", + "ExpGamingCore.Command": "^4.0.0", "ExpGamingCore.Ranking": "^4.0.0", "FactorioStdLib.Game": "^0.8.0" }, diff --git a/modules/ExpGamingCommands/softmod.json b/modules/ExpGamingCommands/softmod.json index e8b15b82..110029e5 100644 --- a/modules/ExpGamingCommands/softmod.json +++ b/modules/ExpGamingCommands/softmod.json @@ -31,7 +31,7 @@ "dependencies": { "FactorioStdLib.Game": "^0.8.0", "ExpGamingLib": "^4.0.0", - "ExpGamingCore.Commands": "^4.0.0", + "ExpGamingCore.Command": "^4.0.0", "ExpGamingCore.Ranking": "?^4.0.0" }, "collection": "ExpGamingCommands_4.0.0" @@ -51,7 +51,7 @@ "Hacks" ], "dependencies": { - "ExpGamingCore.Commands": "^4.0.0" + "ExpGamingCore.Command": "^4.0.0" }, "collection": "ExpGamingCommands_4.0.0" }, @@ -71,7 +71,7 @@ ], "dependencies": { "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Commands": "^4.0.0" + "ExpGamingCore.Command": "^4.0.0" }, "collection": "ExpGamingCommands_4.0.0" }, @@ -90,7 +90,7 @@ "Tool" ], "dependencies": { - "ExpGamingCore.Commands": "^4.0.0", + "ExpGamingCore.Command": "^4.0.0", "ExpGamingCore.Ranking": "^4.0.0", "FactorioStdLib.Game": "^0.8.0" }, @@ -133,7 +133,7 @@ "dependencies": { "ExpGamingLib": "^4.0.0", "ExpGamingCore.Ranking": "?^4.0.0", - "ExpGamingCore.Commands": "^4.0.0", + "ExpGamingCore.Command": "^4.0.0", "FactorioStdLib.Game": "^0.8.0" }, "collection": "ExpGamingCommands_4.0.0" @@ -155,7 +155,7 @@ "Tools" ], "dependencies": { - "ExpGamingCore.Commands": "^4.0.0", + "ExpGamingCore.Command": "^4.0.0", "ExpGamingAdmin.Teleport": "^4.0.0" }, "collection": "ExpGamingCommands_4.0.0" diff --git a/modules/ExpGamingCommands/tags/softmod.json b/modules/ExpGamingCommands/tags/softmod.json index 4504fbc8..0c69d9bf 100644 --- a/modules/ExpGamingCommands/tags/softmod.json +++ b/modules/ExpGamingCommands/tags/softmod.json @@ -13,7 +13,7 @@ "dependencies": { "ExpGamingLib": "^4.0.0", "ExpGamingCore.Ranking": "?^4.0.0", - "ExpGamingCore.Commands": "^4.0.0", + "ExpGamingCore.Command": "^4.0.0", "FactorioStdLib.Game": "^0.8.0" }, "collection": "ExpGamingCommands_4.0.0" diff --git a/modules/ExpGamingCommands/teleport/softmod.json b/modules/ExpGamingCommands/teleport/softmod.json index a0839206..65aeb936 100644 --- a/modules/ExpGamingCommands/teleport/softmod.json +++ b/modules/ExpGamingCommands/teleport/softmod.json @@ -15,7 +15,7 @@ "Tools" ], "dependencies": { - "ExpGamingCore.Commands": "^4.0.0", + "ExpGamingCore.Command": "^4.0.0", "ExpGamingAdmin.Teleport": "^4.0.0" }, "collection": "ExpGamingCommands_4.0.0" diff --git a/modules/ExpGamingCore/Commands/control.lua b/modules/ExpGamingCore/Command/control.lua similarity index 99% rename from modules/ExpGamingCore/Commands/control.lua rename to modules/ExpGamingCore/Command/control.lua index 6c5363d3..5e530192 100644 --- a/modules/ExpGamingCore/Commands/control.lua +++ b/modules/ExpGamingCore/Command/control.lua @@ -1,5 +1,5 @@ --- Command system that allows middle ware and auto validation of command arguments. --- @module ExpGamingCore.Commands@4.0.0 +-- @module ExpGamingCore.Command@4.0.0 -- @author Cooldude2606 -- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE -- @alias commands diff --git a/modules/ExpGamingCore/Commands/locale/de.cfg b/modules/ExpGamingCore/Command/locale/de.cfg similarity index 100% rename from modules/ExpGamingCore/Commands/locale/de.cfg rename to modules/ExpGamingCore/Command/locale/de.cfg diff --git a/modules/ExpGamingCore/Commands/locale/en.cfg b/modules/ExpGamingCore/Command/locale/en.cfg similarity index 100% rename from modules/ExpGamingCore/Commands/locale/en.cfg rename to modules/ExpGamingCore/Command/locale/en.cfg diff --git a/modules/ExpGamingCore/Commands/locale/fr.cfg b/modules/ExpGamingCore/Command/locale/fr.cfg similarity index 100% rename from modules/ExpGamingCore/Commands/locale/fr.cfg rename to modules/ExpGamingCore/Command/locale/fr.cfg diff --git a/modules/ExpGamingCore/Commands/locale/nl.cfg b/modules/ExpGamingCore/Command/locale/nl.cfg similarity index 100% rename from modules/ExpGamingCore/Commands/locale/nl.cfg rename to modules/ExpGamingCore/Command/locale/nl.cfg diff --git a/modules/ExpGamingCore/Commands/locale/sv-SE.cfg b/modules/ExpGamingCore/Command/locale/sv-SE.cfg similarity index 100% rename from modules/ExpGamingCore/Commands/locale/sv-SE.cfg rename to modules/ExpGamingCore/Command/locale/sv-SE.cfg diff --git a/modules/ExpGamingCore/Commands/softmod.json b/modules/ExpGamingCore/Command/softmod.json similarity index 86% rename from modules/ExpGamingCore/Commands/softmod.json rename to modules/ExpGamingCore/Command/softmod.json index 7f73fc06..c2fb87e6 100644 --- a/modules/ExpGamingCore/Commands/softmod.json +++ b/modules/ExpGamingCore/Command/softmod.json @@ -1,9 +1,9 @@ { - "name": "Commands", + "name": "Command", "version": "4.0.0", "type": "Submodule", "description": "A better command handler than the base game.", - "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.Commands_4.0.0.zip", + "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.Command_4.0.0.zip", "keywords": [ "Library", "Lib", diff --git a/modules/ExpGamingCore/Group/control.lua b/modules/ExpGamingCore/Group/control.lua new file mode 100644 index 00000000..2aea7d22 --- /dev/null +++ b/modules/ExpGamingCore/Group/control.lua @@ -0,0 +1,129 @@ +--- Desction
Modules
Modules
Modules
Modules
Modules
Modules
Modules
+-- @module ExpGamingCore@Group +-- @author Cooldude2606 +-- @license Discord: Cooldude2606@5241 +-- @alais Group + +-- Module Require +local Game = require('FactorioStdLib.Game') + +-- Local Varibles + +-- Module Define +local module_verbose = false + +--- Used as an interface for factorio permissions groups +-- @type Group +-- @field _prototype the prototype of this class +-- @field groups a table of all groups, includes auto complete on the indexing +local Group = { + _prototype = {}, + groups = setmetatable({},{ + __index=table.autokey, + __newindex=function(tbl,key,value) + rawset(tbl,key,Group.define(obj)) + end + }) +} + +-- Function Define + +--- Defines a new instance of a group +-- @usage Group.define{name='foo',disallow={'edit_permission_group','delete_permission_group','add_permission_group'}} -- returns new group +-- @usage Group{name='foo',disallow={'edit_permission_group','delete_permission_group','add_permission_group'}} -- returns new group +-- @tparam table obj contains string name and table disallow of defines.input_action +-- @treturn Group the group which has been made +function Group.define(obj) + if not type_error(game,nil,'Cant define Group during runtime.') then return end + if not type_error(obj.name,'string','Group creation is invalid: group.name is not a string') then return end + if not type_error(obj.disallow,'table','Group creation is invalid: group.disallow is not a table') then return end + verbose('Created Group: '..obj.name) + setmetatable(obj,{__index=Group._prototype}) + rawset(Group.groups,obj.name,obj) + return obj +end + +--- Used to get the group of a player or the group by name +-- @usage Group.get('foo') -- returns group foo +-- @usage Group.get(player) -- returns group of player +-- @tparam ?LuaPlayer|pointerToPlayer|string mixed can either be the name or raw group of a group or a player indenifier +-- @treturn table the group which was found or nil +function Group.get(mixed) + local player = Game.get_player(mixed) + if player then mixed = player.permission_group.name end + if is_type(mixed,'table') and mixed.__self and mixed.name then mixed = mixed.name end + return Group.groups[mixed] +end + +--- Used to get the factorio permission group linked to this group +-- @usage group:get_raw() -- returns LuaPermissionGroup of this group +-- @treturn LuaPermissionGroup the factorio group linked to this group +function Group._prototype:get_raw() + if not self_test(self,'group','get_raw') then return end + if not group._raw_group then error('No permissions group found, please to not remove groups with /permissions',2) return end + return setmetatable({},{__index=group._raw_group}) +end + +--- Used to add a player to this group +-- @usage group:add_player(player) -- returns true if added +-- @tparam ?LuaPlayer|pointerToPlayer player the player to add to the group +-- @treturn boolean if the player was added +function Group._prototype:add_player(player) + if not self_test(self,'group','add_player') then return end + local player = Game.get_player(player) + if not player then error('Invalid player given to group.add_player.',2) end + local raw_group = self:get_raw() + return raw_group.add_player(player) +end + +--- Used to remove a player from this group +-- @usage group:remove_player(player) -- returns true if removed +-- @tparam ?LuaPlayer|pointerToPlayer player the player to remove from the group +-- @treturn boolean if the player was removed +function Group._prototype:remove_player(player) + if not self_test(self,'group','remove_player') then return end + local player = Game.get_player(player) + if not player then error('Invalid player given to group.remove_player.',2) end + local raw_group = self:get_raw() + return raw_group.remove_player(player) +end + +--- Gets all players in this group +-- @usage group:get_players(true) -- returns all online players +-- @tparam[opt=false] boolean online if true returns only online players +-- @treturn table table of players +function Group._prototype:get_players(online) + if not self_test(self,'group','get_players') then return end + local raw_group = self:get_raw() + local rtn = {} + if online then for _,player in pairs(raw_group.players) do if player.connected then table.insert(rtn,player) end end end + return online and rtn or raw_group.players +end + +--- Prints a message or value to all online players in this group +-- @usage group.print('Hello, World!') +-- @param rtn any value you wish to print, string not required +-- @param colour the colour to print the message in +-- @treturn number the number of players who recived the message +function Group._prototype:print(rtn,colour) + if not self_test(self,'group','print') then return end + local players = self:get_players() + local ctn = 0 + for _,player in pairs(players) do if player.connected then player_return(rtn,colour,player) ctn=ctn+1 end end + return ctn +end + +-- Event Handlers Define + +-- creates all permission groups and links them +script.on_event('on_init',function(event) + for name,group in pairs(Group.groups) do + group._raw_group = game.permissions.create_group(name) + for _,to_remove in pairs(group.disallow) do + group._raw_group.set_allows_action(defines.input_action[to_remove],false) + end + end +end) + +-- Module Return +return setmetatable(Group,{__call=function(tbl,...) tbl.define(...) end}) \ No newline at end of file diff --git a/modules/ExpGamingCore/Group/softmod.json b/modules/ExpGamingCore/Group/softmod.json new file mode 100644 index 00000000..48a8c649 --- /dev/null +++ b/modules/ExpGamingCore/Group/softmod.json @@ -0,0 +1,20 @@ +{ + "name": "Group", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a system to manage and auto-create permission groups.", + "location": " ", + "keywords": [ + "Groups", + "ExpGaming", + "System", + "Management", + "Manage", + "Permissions" + ], + "dependencies": { + "FactorioStdLib": "^0.8.0", + "ExpGamingLib": "^4.0.0" + }, + "collection": "ExpGamingCore_4.0.0" +} \ No newline at end of file diff --git a/modules/ExpGamingCore/Gui/src/server.lua b/modules/ExpGamingCore/Gui/src/server.lua index b41f65f5..1aa13be3 100644 --- a/modules/ExpGamingCore/Gui/src/server.lua +++ b/modules/ExpGamingCore/Gui/src/server.lua @@ -4,7 +4,7 @@ -- @author Cooldude2606 -- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE ---- This file will be loaded when ExpGamingCore.Commands is present +--- This file will be loaded when ExpGamingCore.Command is present -- @function _comment local Game = require('FactorioStdLib.Game') diff --git a/modules/ExpGamingCore/Ranking/control.lua b/modules/ExpGamingCore/Ranking/control.lua index ca2b98f7..82067209 100644 --- a/modules/ExpGamingCore/Ranking/control.lua +++ b/modules/ExpGamingCore/Ranking/control.lua @@ -438,7 +438,7 @@ require(module_path..'/src/config',{Ranking=Ranking}) function Ranking:on_init() if loaded_modules['ExpGamingCore.Server'] then verbose('ExpGamingCore.Server is installed; Loading server src') require(module_path..'/src/server',{Ranking=Ranking}) end - if loaded_modules['ExpGamingCore.Commands'] then verbose('ExpGamingCore.Server is installed; Loading commands src') require(module_path..'/src/commands',{Ranking=Ranking}) end + if loaded_modules['ExpGamingCore.Command'] then verbose('ExpGamingCore.Server is installed; Loading commands src') require(module_path..'/src/commands',{Ranking=Ranking}) end end function Ranking:on_post() diff --git a/modules/ExpGamingCore/Server/control.lua b/modules/ExpGamingCore/Server/control.lua index 6a9d888f..66dbf1bd 100644 --- a/modules/ExpGamingCore/Server/control.lua +++ b/modules/ExpGamingCore/Server/control.lua @@ -468,7 +468,7 @@ end) function Server:on_init() for name,id in pairs(defines.events) do if not script.get_event_handler(id) then script.on_event(id,Server._thread_handler) end end - if loaded_modules['ExpGamingCore.Commands'] then verbose('ExpGamingCore.Commands is installed; Loading commands src') require(module_path..'/src/commands',{Server=Server}) end + if loaded_modules['ExpGamingCore.Command'] then verbose('ExpGamingCore.Command is installed; Loading commands src') require(module_path..'/src/commands',{Server=Server}) end end return Server diff --git a/modules/ExpGamingCore/Server/softmod.json b/modules/ExpGamingCore/Server/softmod.json index a5d1e29e..1e9e4c34 100644 --- a/modules/ExpGamingCore/Server/softmod.json +++ b/modules/ExpGamingCore/Server/softmod.json @@ -20,7 +20,7 @@ "FactorioStdLib.Color": "^0.8.0", "FactorioStdLib.String": "^0.8.0", "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Commands": "?^4.0.0" + "ExpGamingCore.Command": "?^4.0.0" }, "collection": "ExpGamingCore_4.0.0" } \ No newline at end of file diff --git a/modules/ExpGamingCore/Server/src/commands.lua b/modules/ExpGamingCore/Server/src/commands.lua index b626c1aa..c0cdee67 100644 --- a/modules/ExpGamingCore/Server/src/commands.lua +++ b/modules/ExpGamingCore/Server/src/commands.lua @@ -4,7 +4,7 @@ -- @author Cooldude2606 -- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE ---- This file will be loaded when ExpGamingCore.Commands is present +--- This file will be loaded when ExpGamingCore.Command is present -- @function _comment local Game = require('FactorioStdLib.Game') diff --git a/modules/ExpGamingCore/softmod.json b/modules/ExpGamingCore/softmod.json index b6a644f6..8aada8ae 100644 --- a/modules/ExpGamingCore/softmod.json +++ b/modules/ExpGamingCore/softmod.json @@ -19,7 +19,7 @@ "version": "4.0.0", "type": "Submodule", "description": "A better command handler than the base game.", - "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.Commands_4.0.0.zip", + "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.Command_4.0.0.zip", "keywords": [ "Library", "Lib", @@ -107,7 +107,7 @@ "FactorioStdLib.Color": "^0.8.0", "FactorioStdLib.String": "^0.8.0", "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Commands": "?^4.0.0" + "ExpGamingCore.Command": "?^4.0.0" }, "collection": "ExpGamingCore_4.0.0" }, @@ -136,6 +136,47 @@ "ExpGamingCore.Gui": "?^4.0.0" }, "collection": "ExpGamingCore_4.0.0" + }, + "Command": { + "name": "Command", + "version": "4.0.0", + "type": "Submodule", + "description": "A better command handler than the base game.", + "location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.Command_4.0.0.zip", + "keywords": [ + "Library", + "Lib", + "ExpGaming", + "Core", + "Commands" + ], + "dependencies": { + "ExpGamingLib": "^4.0.0", + "FactorioStdLib.Table": "^0.8.0", + "FactorioStdLib.Color": "^0.8.0", + "FactorioStdLib.Game": "^0.8.0" + }, + "collection": "ExpGamingCore_4.0.0" + }, + "Group": { + "name": "Group", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a system to manage and auto-create permission groups.", + "location": " ", + "keywords": [ + "Groups", + "ExpGaming", + "System", + "Management", + "Manage", + "Permissions" + ], + "dependencies": { + "FactorioStdLib": "^0.8.0", + "ExpGamingLib": "^4.0.0" + }, + "collection": "ExpGamingCore_4.0.0" } }, "dependencies": {} diff --git a/modules/ExpGamingLib/control.lua b/modules/ExpGamingLib/control.lua index 3e17dae7..ed43577b 100644 --- a/modules/ExpGamingLib/control.lua +++ b/modules/ExpGamingLib/control.lua @@ -68,6 +68,26 @@ function ExpLib.is_type(v,test_type) return test_type and v and type(v) == test_type or not test_type and not v or false end +--- Compear types faster for faster valadation of prams, including giving an error if incorrect +-- @usage type_error('foo','string','Value is not a string') -- return true +-- @usage type_error('foo','table','Value is not a string') -- return error +-- @param value the value to be tested +-- @tparam[opt=nil] string type the type that the value should be +-- @tparam string error_message the message given when type is not matched +-- @treturn boolean if it matched or and error +function ExpLib.type_error(value,type,error_message) + return ExpLib.is_type(value,type) or error(error_message,3) +end + +--- A speailsied verion of type_error to test for self +-- @usage self_test(self,'Object','get_name') +-- @tparam table self the table that is the object +-- @tparam string prototype_name the name of the class +-- @tparam string function_name the name of the function +function ExpLib.self_test(self,prototype_name,function_name) + return ExpLib.is_type(value,'table') or error('Call to prototype without context, either supply a '..prototype_name..' or use '..prototype_name..':'..function_name,3) +end + --- Will return a value of any type to the player/server console, allows colour for in-game players -- @usage player_return('Hello, World!') -- returns 'Hello, World!' to game.player or server console -- @usage player_return('Hello, World!','green') -- returns 'Hello, World!' to game.player with colour green or server console diff --git a/modules/index.lua b/modules/index.lua index 266d5686..1963314b 100644 --- a/modules/index.lua +++ b/modules/index.lua @@ -11,14 +11,14 @@ return { ['FactorioStdLib.Color@0.8.0']='./modules/FactorioStdLib/Color', ['ExpGamingLib@^4.0.0']='./modules/ExpGamingLib', ['ExpGamingLib@4.0.0']='./modules/ExpGamingLib', - ['ExpGamingCore.Commands@4.0.0']='./modules/ExpGamingCore/Commands', + ['ExpGamingCore.Command@4.0.0']='./modules/ExpGamingCore/Commands', ['ExpGamingCore.Server@4.0.0']='./modules/ExpGamingCore/Server', ['ExpGamingCore.Ranking@^4.0.0']='./modules/ExpGamingCore/Ranking', ['ExpGamingCore.Ranking@4.0.0']='./modules/ExpGamingCore/Ranking', ['ExpGamingBot.autoChat@4.0.0']='./modules/ExpGamingBot/autoChat', ['ExpGamingCore.Server@^4.0.0']='./modules/ExpGamingCore/Server', ['ExpGamingCommands.tags@4.0.0']='./modules/ExpGamingCommands/tags', - ['ExpGamingCore.Commands@^4.0.0']='./modules/ExpGamingCore/Commands', + ['ExpGamingCore.Command@^4.0.0']='./modules/ExpGamingCore/Commands', ['ExpGamingCommands.home@4.0.0']='./modules/ExpGamingCommands/home', ['ExpGamingCommands.cheatMode@4.0.0']='./modules/ExpGamingCommands/cheatMode', ['ExpGamingCommands.bonus@4.0.0']='./modules/ExpGamingCommands/bonus',
Modules
_comment () -This file will be loaded when ExpGamingCore.Commands is present +This file will be loaded when ExpGamingCore.Command is present interface @@ -805,7 +805,7 @@ _comment ()
Modules
Modules
Modules
Modules
Modules
Modules
| _comment () | -This file will be loaded when ExpGamingCore.Commands is present | +This file will be loaded when ExpGamingCore.Command is present |
| __comment () | @@ -329,7 +329,7 @@ _comment ()