From d8ca2e0c9a2e6216bb74a853dda4c4d92151b59c Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 9 Nov 2018 17:33:48 +0000 Subject: [PATCH] Large Number of bug fixes --- locale/de/ExpGamingAdmin.Warnings.cfg | 2 +- locale/en/ExpGamingAdmin.Warnings.cfg | 2 +- locale/fr/ExpGamingAdmin.Warnings.cfg | 2 +- locale/nl/ExpGamingAdmin.Warnings.cfg | 2 +- locale/sv-SE/ExpGamingAdmin.Warnings.cfg | 2 +- modules/ExpGamingAdmin/Ban/control.lua | 2 +- modules/ExpGamingAdmin/Gui/control.lua | 2 +- modules/ExpGamingAdmin/Kick/control.lua | 2 +- modules/ExpGamingAdmin/Reports/control.lua | 3 ++- modules/ExpGamingAdmin/TempBan/control.lua | 3 ++- modules/ExpGamingAdmin/Warnings/control.lua | 25 ++++++++++--------- modules/ExpGamingAdmin/Warnings/locale/de.cfg | 2 +- modules/ExpGamingAdmin/Warnings/locale/en.cfg | 2 +- modules/ExpGamingAdmin/Warnings/locale/fr.cfg | 2 +- modules/ExpGamingAdmin/Warnings/locale/nl.cfg | 2 +- .../ExpGamingAdmin/Warnings/locale/sv-SE.cfg | 2 +- .../ExpGamingCommands/repair/src/tempban.lua | 2 +- modules/ExpGamingCore/Command/control.lua | 2 +- modules/ExpGamingCore/Role/config.lua | 2 +- 19 files changed, 33 insertions(+), 30 deletions(-) diff --git a/locale/de/ExpGamingAdmin.Warnings.cfg b/locale/de/ExpGamingAdmin.Warnings.cfg index 3a62ea44..c48f518a 100644 --- a/locale/de/ExpGamingAdmin.Warnings.cfg +++ b/locale/de/ExpGamingAdmin.Warnings.cfg @@ -1,4 +1,4 @@ -[ExpGamingAdmin-Warnings-4-0-0] +[ExpGamingAdmin-Warnings] warning-given-by=This Warnings Was Given By: __1__ player-warning=__1__ was given a warning by __2__ reason: __3__ temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset diff --git a/locale/en/ExpGamingAdmin.Warnings.cfg b/locale/en/ExpGamingAdmin.Warnings.cfg index 6378521b..01715fc7 100644 --- a/locale/en/ExpGamingAdmin.Warnings.cfg +++ b/locale/en/ExpGamingAdmin.Warnings.cfg @@ -1,4 +1,4 @@ -[ExpGamingAdmin-Warnings-4-0-0] +[ExpGamingAdmin-Warnings] warning-given-by=This warning was given by: __1__ player-warning=__1__ was given a warning by __2__ for: __3__ remove-warn=One of your warnings expired. You have __1__ warnings left, next warning will be removed in __2__ diff --git a/locale/fr/ExpGamingAdmin.Warnings.cfg b/locale/fr/ExpGamingAdmin.Warnings.cfg index 3a62ea44..c48f518a 100644 --- a/locale/fr/ExpGamingAdmin.Warnings.cfg +++ b/locale/fr/ExpGamingAdmin.Warnings.cfg @@ -1,4 +1,4 @@ -[ExpGamingAdmin-Warnings-4-0-0] +[ExpGamingAdmin-Warnings] warning-given-by=This Warnings Was Given By: __1__ player-warning=__1__ was given a warning by __2__ reason: __3__ temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset diff --git a/locale/nl/ExpGamingAdmin.Warnings.cfg b/locale/nl/ExpGamingAdmin.Warnings.cfg index 69b8004e..104ef981 100644 --- a/locale/nl/ExpGamingAdmin.Warnings.cfg +++ b/locale/nl/ExpGamingAdmin.Warnings.cfg @@ -1,4 +1,4 @@ -[ExpGamingAdmin-Warnings-4-0-0] +[ExpGamingAdmin-Warnings] warning-given-by=Deze waarschuwing is gegeven door: __1__ player-warning=__1__ is gewaarschuwd door __2__ met de reden: __3__ temp-ban=__1__ is verbannen door __2__ en is gejailed tot de volgende reset. diff --git a/locale/sv-SE/ExpGamingAdmin.Warnings.cfg b/locale/sv-SE/ExpGamingAdmin.Warnings.cfg index b130aac3..9358b9cf 100644 --- a/locale/sv-SE/ExpGamingAdmin.Warnings.cfg +++ b/locale/sv-SE/ExpGamingAdmin.Warnings.cfg @@ -1,4 +1,4 @@ -[ExpGamingAdmin-Warnings-4-0-0] +[ExpGamingAdmin-Warnings] warning-given-by=Den här varningen gavs av: __1__ player-warning=__1__ var tillfälligt bannlyst av __2__ och kommer att förbli i fängelset tills nästa återställning (reset) remove-warn=En av dina varningar har gått ut. Du har __1__ varning kvar, nästa varning kommer at tas bort om __2__ diff --git a/modules/ExpGamingAdmin/Ban/control.lua b/modules/ExpGamingAdmin/Ban/control.lua index 1d6fc330..0731719a 100644 --- a/modules/ExpGamingAdmin/Ban/control.lua +++ b/modules/ExpGamingAdmin/Ban/control.lua @@ -17,7 +17,7 @@ local module_verbose = false local ThisModule = { on_init=function() if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end - if loaded_modules['FactorioStdLib.Color@^0.8.0'] then Sync = require('FactorioStdLib.Color@^0.8.0') end + if loaded_modules['FactorioStdLib.Color@^0.8.0'] then Color = require('FactorioStdLib.Color@^0.8.0') end end } diff --git a/modules/ExpGamingAdmin/Gui/control.lua b/modules/ExpGamingAdmin/Gui/control.lua index ae6ea34f..2eae0ac5 100644 --- a/modules/ExpGamingAdmin/Gui/control.lua +++ b/modules/ExpGamingAdmin/Gui/control.lua @@ -217,4 +217,4 @@ Admin.center = Gui.center{ -- Module Return -- calling will draw the admin buttons to that frame -return setmetatable(AdminGui,{__call=function(self,...) self.draw(...) end}) \ No newline at end of file +return setmetatable(AdminGui,{__call=function(self,...) return self.draw(...) end}) \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Kick/control.lua b/modules/ExpGamingAdmin/Kick/control.lua index 103ecb54..719a28de 100644 --- a/modules/ExpGamingAdmin/Kick/control.lua +++ b/modules/ExpGamingAdmin/Kick/control.lua @@ -17,7 +17,7 @@ local module_verbose = false local ThisModule = { on_init=function() if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end - if loaded_modules['FactorioStdLib.Color@^0.8.0'] then Sync = require('FactorioStdLib.Color@^0.8.0') end + if loaded_modules['FactorioStdLib.Color@^0.8.0'] then Color = require('FactorioStdLib.Color@^0.8.0') end end } -- Function Define diff --git a/modules/ExpGamingAdmin/Reports/control.lua b/modules/ExpGamingAdmin/Reports/control.lua index d301ef09..b20590cb 100644 --- a/modules/ExpGamingAdmin/Reports/control.lua +++ b/modules/ExpGamingAdmin/Reports/control.lua @@ -10,7 +10,7 @@ local Server = require('ExpGamingCore.Server@^4.0.0') local Role = require('ExpGamingCore.Role@^4.0.0') local Gui = require('ExpGamingCore.Gui@^4.0.0') local Game = require('FactorioStdLib.Game@^0.8.0') -local Color = require('FactorioStdLib.Color@^0.8.0') +local Color -- FactorioStdLib.Color@^0.8.0 local Sync -- ExpGamingCore.Sync@^4.0.0 -- Module Define @@ -18,6 +18,7 @@ local module_verbose = false local ThisModule = { on_init=function() if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end + if loaded_modules['FactorioStdLib.Color@^0.8.0'] then Color = require('FactorioStdLib.Color@^0.8.0') end end } diff --git a/modules/ExpGamingAdmin/TempBan/control.lua b/modules/ExpGamingAdmin/TempBan/control.lua index bd0c087d..327f445f 100644 --- a/modules/ExpGamingAdmin/TempBan/control.lua +++ b/modules/ExpGamingAdmin/TempBan/control.lua @@ -9,7 +9,7 @@ local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') local Server = require('ExpGamingCore.Server@^4.0.0') local Role = require('ExpGamingCore.Role@^4.0.0') local Game = require('FactorioStdLib.Game@^0.8.0') -local Color = require('FactorioStdLib.Color@^0.8.0') +local Color -- FactorioStdLib.Color@^0.8.0 local Sync -- ExpGamingCore.Sync@^4.0.0 -- Module Define @@ -17,6 +17,7 @@ local module_verbose = false local ThisModule = { on_init=function() if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end + if loaded_modules['FactorioStdLib.Color@^0.8.0'] then Color = require('FactorioStdLib.Color@^0.8.0') end end } diff --git a/modules/ExpGamingAdmin/Warnings/control.lua b/modules/ExpGamingAdmin/Warnings/control.lua index d37e6fd5..ec284254 100644 --- a/modules/ExpGamingAdmin/Warnings/control.lua +++ b/modules/ExpGamingAdmin/Warnings/control.lua @@ -9,7 +9,7 @@ local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') local Server = require('ExpGamingCore.Server@^4.0.0') local Role = require('ExpGamingCore.Role@^4.0.0') local Game = require('FactorioStdLib.Game@^0.8.0') -local Color = require('FactorioStdLib.Color@^0.8.0') +local Color -- FactorioStdLib.Color@^0.8.0 local Sync -- ExpGamingCore.Sync@^4.0.0 -- Local Varibles @@ -22,14 +22,14 @@ local punishments = { {'nothing'}, {'nothing'}, {'nothing'}, - {'message',{'ExpGamingAdmin-Warnings@4-0-0.message'},defines.textcolor.info}, - {'message',{'ExpGamingAdmin-Warnings@4-0-0.message'},defines.textcolor.info}, - {'message',{'ExpGamingAdmin-Warnings@4-0-0.kick-warn'},defines.textcolor.med}, + {'message',{'ExpGamingAdmin-Warnings.message'},defines.textcolor.info}, + {'message',{'ExpGamingAdmin-Warnings.message'},defines.textcolor.info}, + {'message',{'ExpGamingAdmin-Warnings.kick-warn'},defines.textcolor.med}, {'kick'}, - {'message',{'ExpGamingAdmin-Warnings@4-0-0.temp-warn'},defines.textcolor.high}, + {'message',{'ExpGamingAdmin-Warnings.temp-warn'},defines.textcolor.high}, {'temp-ban'}, - {'message',{'ExpGamingAdmin-Warnings@4-0-0.ban-warn'},defines.textcolor.high}, - {'message',{'ExpGamingAdmin-Warnings@4-0-0.last-warn'},defines.textcolor.crit}, + {'message',{'ExpGamingAdmin-Warnings.ban-warn'},defines.textcolor.high}, + {'message',{'ExpGamingAdmin-Warnings.last-warn'},defines.textcolor.crit}, {'ban'} } @@ -38,9 +38,10 @@ local module_verbose = false local ThisModule = { on_init=function() if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end + if loaded_modules['FactorioStdLib.Color@^0.8.0'] then Color = require('FactorioStdLib.Color@^0.8.0') end if loaded_modules['ExpGamingAdmin.Reports@^4.0.0'] then take_action = take_action + 1 - table.insert(punishments,take_action,{'report',{'ExpGamingAdmin-Warnings@4-0-0.reported'},defines.textcolor.med}) + table.insert(punishments,take_action,{'report',{'ExpGamingAdmin-Warnings.reported'},defines.textcolor.med}) end end, on_post=function() @@ -97,8 +98,8 @@ function Admin.give_warning(player,by_player,reason,min) warnings = warnings+1 global[player.name] = warnings if warnings > take_action then - player_return({'ExpGamingAdmin-Warnings@4-0-0.warning-given-by',by_player.name},defines.textcolor.info,player) - game.print({'ExpGamingAdmin-Warnings@4-0-0.player-warning',player.name,by_player.name,reason}) + player_return({'ExpGamingAdmin-Warnings.warning-given-by',by_player.name},defines.textcolor.info,player) + game.print({'ExpGamingAdmin-Warnings.player-warning',player.name,by_player.name,reason}) end give_punishment(player,by_player,reason) end @@ -123,12 +124,12 @@ script.on_event(defines.events.on_tick,function(event) if (game.tick % min_time_to_remove_warning) == 0 then for name,warnings in pairs(global) do if warnings > 0 then - local role = Role.get(name) + local role = Role.get_highest(name) local time_to_remove = remove_warnings_time[role.index] if (game.tick % time_to_remove) == 0 then global[name]=warnings-1 if global.warnings[name] > 5 then - player_return({'ExpGamingAdmin-Warnings@4-0-0.remove-warn',global[name],tick_to_display_format(time_to_remove)},defines.textcolor.low,name) + player_return({'ExpGamingAdmin-Warnings.remove-warn',global[name],tick_to_display_format(time_to_remove)},defines.textcolor.low,name) end end end diff --git a/modules/ExpGamingAdmin/Warnings/locale/de.cfg b/modules/ExpGamingAdmin/Warnings/locale/de.cfg index 3a62ea44..c48f518a 100644 --- a/modules/ExpGamingAdmin/Warnings/locale/de.cfg +++ b/modules/ExpGamingAdmin/Warnings/locale/de.cfg @@ -1,4 +1,4 @@ -[ExpGamingAdmin-Warnings-4-0-0] +[ExpGamingAdmin-Warnings] warning-given-by=This Warnings Was Given By: __1__ player-warning=__1__ was given a warning by __2__ reason: __3__ temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset diff --git a/modules/ExpGamingAdmin/Warnings/locale/en.cfg b/modules/ExpGamingAdmin/Warnings/locale/en.cfg index 6378521b..01715fc7 100644 --- a/modules/ExpGamingAdmin/Warnings/locale/en.cfg +++ b/modules/ExpGamingAdmin/Warnings/locale/en.cfg @@ -1,4 +1,4 @@ -[ExpGamingAdmin-Warnings-4-0-0] +[ExpGamingAdmin-Warnings] warning-given-by=This warning was given by: __1__ player-warning=__1__ was given a warning by __2__ for: __3__ remove-warn=One of your warnings expired. You have __1__ warnings left, next warning will be removed in __2__ diff --git a/modules/ExpGamingAdmin/Warnings/locale/fr.cfg b/modules/ExpGamingAdmin/Warnings/locale/fr.cfg index 3a62ea44..c48f518a 100644 --- a/modules/ExpGamingAdmin/Warnings/locale/fr.cfg +++ b/modules/ExpGamingAdmin/Warnings/locale/fr.cfg @@ -1,4 +1,4 @@ -[ExpGamingAdmin-Warnings-4-0-0] +[ExpGamingAdmin-Warnings] warning-given-by=This Warnings Was Given By: __1__ player-warning=__1__ was given a warning by __2__ reason: __3__ temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset diff --git a/modules/ExpGamingAdmin/Warnings/locale/nl.cfg b/modules/ExpGamingAdmin/Warnings/locale/nl.cfg index 69b8004e..104ef981 100644 --- a/modules/ExpGamingAdmin/Warnings/locale/nl.cfg +++ b/modules/ExpGamingAdmin/Warnings/locale/nl.cfg @@ -1,4 +1,4 @@ -[ExpGamingAdmin-Warnings-4-0-0] +[ExpGamingAdmin-Warnings] warning-given-by=Deze waarschuwing is gegeven door: __1__ player-warning=__1__ is gewaarschuwd door __2__ met de reden: __3__ temp-ban=__1__ is verbannen door __2__ en is gejailed tot de volgende reset. diff --git a/modules/ExpGamingAdmin/Warnings/locale/sv-SE.cfg b/modules/ExpGamingAdmin/Warnings/locale/sv-SE.cfg index b130aac3..9358b9cf 100644 --- a/modules/ExpGamingAdmin/Warnings/locale/sv-SE.cfg +++ b/modules/ExpGamingAdmin/Warnings/locale/sv-SE.cfg @@ -1,4 +1,4 @@ -[ExpGamingAdmin-Warnings-4-0-0] +[ExpGamingAdmin-Warnings] warning-given-by=Den här varningen gavs av: __1__ player-warning=__1__ var tillfälligt bannlyst av __2__ och kommer att förbli i fängelset tills nästa återställning (reset) remove-warn=En av dina varningar har gått ut. Du har __1__ varning kvar, nästa varning kommer at tas bort om __2__ diff --git a/modules/ExpGamingCommands/repair/src/tempban.lua b/modules/ExpGamingCommands/repair/src/tempban.lua index 2212c26f..ddda15ec 100644 --- a/modules/ExpGamingCommands/repair/src/tempban.lua +++ b/modules/ExpGamingCommands/repair/src/tempban.lua @@ -1,5 +1,5 @@ -- not_luadoc=true -local temp_ban = require('ExpGamingAdmin.TempBan') +local temp_ban = require('ExpGamingAdmin.AdminLib@^4.0.0').temp_ban return function(player,entity) player_return('You have repaired: '..entity.name..' this item is not allowed.',defines.textcolor.crit,player) temp_ban(player,'','Attempt To Repair A Banned Item') diff --git a/modules/ExpGamingCore/Command/control.lua b/modules/ExpGamingCore/Command/control.lua index 8a5d1902..b87bd256 100644 --- a/modules/ExpGamingCore/Command/control.lua +++ b/modules/ExpGamingCore/Command/control.lua @@ -164,7 +164,7 @@ function commands.validate_args(event) local arg = words[index] if not arg and data[1] then return commands.error('invalid-inputs') end if data[2] == 'string-inf' then rtn[name] = table.concat(words,' ',index) break end - local valid = is_type(data[2],'function') and data[2] or commands.validate[data[2]] or error('Invalid type for command: "'..command.name..'/'..name..'"') + local valid = is_type(data[2],'function') and data[2] or commands.validate[data[2]] or error('Invalid validation ("'..tostring(data[2])..'") for command: "'..command.name..'/'..name..'"') local temp_tbl = table.deepcopy(data) table.remove(temp_tbl,1) table.remove(temp_tbl,1) local value, err = valid(arg,event,unpack(temp_tbl)) if value == commands.error then return value, err end diff --git a/modules/ExpGamingCore/Role/config.lua b/modules/ExpGamingCore/Role/config.lua index a63f2399..18ac85c8 100644 --- a/modules/ExpGamingCore/Role/config.lua +++ b/modules/ExpGamingCore/Role/config.lua @@ -102,7 +102,7 @@ Role{ ['admin-commands']=true, ['warn']=true, ['temp-ban']=true, - ['clear-warings']=true, + ['clear-warnings']=true, ['clear-reports']=true, ['clear-all']=true, ['clear-inv']=true,