From bbd1a0acd7a5010f3623ab3871f4c52c81591856 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 4 Nov 2018 17:18:25 +0000 Subject: [PATCH] Multiple Bug Fixs --- modules/ExpGamingAdmin/AdminLib/control.lua | 4 ---- modules/ExpGamingAdmin/Gui/control.lua | 6 +++++- modules/ExpGamingAdmin/Jail/control.lua | 1 - modules/ExpGamingAdmin/Reports/control.lua | 6 +++--- modules/ExpGamingCore/Group/config.lua | 2 +- modules/ExpGamingCore/Sync/control.lua | 12 ++++++------ modules/ExpGamingPlayer/playerList/control.lua | 4 +++- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/modules/ExpGamingAdmin/AdminLib/control.lua b/modules/ExpGamingAdmin/AdminLib/control.lua index 98a95d5b..493845e4 100644 --- a/modules/ExpGamingAdmin/AdminLib/control.lua +++ b/modules/ExpGamingAdmin/AdminLib/control.lua @@ -35,10 +35,6 @@ function Admin.create_reason(reason,name) return reason end -function Admin.open(player,pre_select_player,pre_select_action) - if Admin.center then Gui.center.clear(player) Admin.center.open(player,pre_select_player,pre_select_action) end -end - function Admin.allowed(player) local player = Game.get_player(player) if Role then diff --git a/modules/ExpGamingAdmin/Gui/control.lua b/modules/ExpGamingAdmin/Gui/control.lua index aa0cf089..dd63bd0e 100644 --- a/modules/ExpGamingAdmin/Gui/control.lua +++ b/modules/ExpGamingAdmin/Gui/control.lua @@ -28,6 +28,11 @@ local AdminGui = { buttons={} } +function Admin.open(player,pre_select_player,pre_select_action) + Gui.center.clear(player) + Admin.center.open(player,pre_select_player,pre_select_action) +end + -- Function Define function AdminGui.add_button(name,caption,tooltip,callback) AdminGui.buttons[name] = Gui.inputs.add{ @@ -212,5 +217,4 @@ Admin.center = Gui.center{ -- Module Return -- calling will draw the admin buttons to that frame -Admin.button_flow = AdminGui return setmetatable(AdminGui,{__call=function(self,...) self.draw(...) end}) \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Jail/control.lua b/modules/ExpGamingAdmin/Jail/control.lua index 58eedcc3..54c2c608 100644 --- a/modules/ExpGamingAdmin/Jail/control.lua +++ b/modules/ExpGamingAdmin/Jail/control.lua @@ -39,7 +39,6 @@ function Admin.jail(player,by_player,reason) ['By:']='<>'..by_player_name, ['Reason:']=reason } end - if Admin.move_inventory then Admin.move_inventory(player) end Role.meta.last_jail = player.name Server.interface(Role.unassign,true,player,Role.get(player),by_player_name) Server.interface(Role.assign,true,player,'Jail',by_player_name) diff --git a/modules/ExpGamingAdmin/Reports/control.lua b/modules/ExpGamingAdmin/Reports/control.lua index 4d07c7f9..320ccbbf 100644 --- a/modules/ExpGamingAdmin/Reports/control.lua +++ b/modules/ExpGamingAdmin/Reports/control.lua @@ -125,7 +125,7 @@ local confirm_report = Gui.inputs{ type='button', name='admin-report-confirm', caption='utility/spawn_flag', - tooltip={'ExpGamingAdmin.name'} + tooltip={'ExpGamingAdmin.report'} }:on_event('click',function(event) local parent = event.element.parent local player = Game.get_player(parent.player.caption) @@ -138,7 +138,7 @@ Admin.report_btn = Gui.inputs{ type='button', name='admin-report', caption='utility/spawn_flag', - tooltip={'ExpGamingAdmin.name'} + tooltip={'ExpGamingAdmin.report'} }:on_event('click',function(event) local parent = event.element.parent local player = Game.get_player(parent.children[1].name) @@ -150,7 +150,7 @@ Admin.report_btn = Gui.inputs{ name='report-gui' } _player.opened=frame - frame.caption={'ExpGamingAdmin.name'} + frame.caption={'ExpGamingAdmin.report'} frame.add{ type='textfield', name='reason' diff --git a/modules/ExpGamingCore/Group/config.lua b/modules/ExpGamingCore/Group/config.lua index 438fd3c8..0496bb6a 100644 --- a/modules/ExpGamingCore/Group/config.lua +++ b/modules/ExpGamingCore/Group/config.lua @@ -35,7 +35,7 @@ Group{ } Group{ - name='Guest', + name='User', disallow={ 'edit_permission_group', 'delete_permission_group', diff --git a/modules/ExpGamingCore/Sync/control.lua b/modules/ExpGamingCore/Sync/control.lua index 686be6e5..77ef7618 100644 --- a/modules/ExpGamingCore/Sync/control.lua +++ b/modules/ExpGamingCore/Sync/control.lua @@ -185,15 +185,15 @@ function Sync.count_roles() local _rtn = {admin={online={},players={}},user={online={},players={}}} for index,player in pairs(game.players) do if player.admin then - table.insert(_roles.admin.players,player.name) - if player.connected then table.insert(_roles.admin.online,player.name) end + table.insert(_rtn.admin.players,player.name) + if player.connected then table.insert(_rtn.admin.online,player.name) end else - table.insert(_roles.user.players,player.name) - if player.connected then table.insert(_roles.user.online,player.name) end + table.insert(_rtn.user.players,player.name) + if player.connected then table.insert(_rtn.user.online,player.name) end end end - _rtn.admin.n_players,_roles.admin.n_online=#_rtn.admin.players,#_rtn.admin.online - _rtn.user.n_players,_roles.user.n_online=#_rtn.user.players,#_rtn.user.online + _rtn.admin.n_players,_rtn.admin.n_online=#_rtn.admin.players,#_rtn.admin.online + _rtn.user.n_players,_rtn.user.n_online=#_rtn.user.players,#_rtn.user.online return _rtn end diff --git a/modules/ExpGamingPlayer/playerList/control.lua b/modules/ExpGamingPlayer/playerList/control.lua index ec0c1b1d..d7153c42 100644 --- a/modules/ExpGamingPlayer/playerList/control.lua +++ b/modules/ExpGamingPlayer/playerList/control.lua @@ -6,6 +6,7 @@ local Game = require('FactorioStdLib.Game@^0.8.0') local Gui = require('ExpGamingCore.Gui@^4.0.0') local Admin -- ExpGamingAdmin.AdminLib@^4.0.0 +local AdminGui -- ExpGamingAdmin.Gui@^4.0.0 -- Local Varibles local playerInfo = function(player,frame) @@ -31,6 +32,7 @@ local ThisModule = { if loaded_modules['ExpGamingPlayer.playerInfo'] then playerInfo = require('ExpGamingPlayer.playerInfo') end if loaded_modules['ExpGamingCore.Role@^4.0.0'] then getPlayers = require(module_path..'/src/ranking',{self=self}) end if loaded_modules['ExpGamingAdmin.AdminLib@^4.0.0'] then Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') end + if loaded_modules['ExpGamingAdmin.Gui@^4.0.0'] then AdminGui = require('ExpGamingAdmin.Gui@^4.0.0') end end } @@ -129,7 +131,7 @@ script.on_event(defines.events.on_gui_click,function(event) back_btn:draw(flow) playerInfo(event.element.name,flow,true) if Game.get_player(event.element.name) and event.player_index == Game.get_player(event.element.name).index then return end - if Admin and Admin.allowed(event.player_index) then Admin.button_flow(flow).caption = event.element.name end + if Admin and AdminGui and Admin.allowed(event.player_index) then AdminGui(flow).caption = event.element.name end end) script.on_event(defines.events.on_player_joined_game,function() ThisModule.update() end)