From 60ccb9d970f1ce0d99ae7518cb2ac5ba3675c469 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 23 Nov 2018 16:37:15 +0000 Subject: [PATCH] Fixed Server Role --- FactorioSoftmodManager.lua | 2 +- modules/ExpGamingCore/Role/control.lua | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/FactorioSoftmodManager.lua b/FactorioSoftmodManager.lua index a93ce44b..c977ef8b 100644 --- a/FactorioSoftmodManager.lua +++ b/FactorioSoftmodManager.lua @@ -7,7 +7,7 @@ local moduleIndex = require("/modules/index") local Manager = {} -- this is a constant that is used to represent the server -SERVER = setmetatable({index=0,name='',online_time=0,afk_time=0,print=print,admin=true},{__index=function(tbl,key) if type(game.players[1][key]) == 'function' then return function() end else return nil end end}) +SERVER = setmetatable({index=0,name='',admin=true,online_time=0,afk_time=0,print=print,__self=true,valid=true},{__index=function(tbl,key) if type(game.players[1][key]) == 'function' then return function() end else return nil end end}) --- Setup for metatable of the Manager to force read only nature -- @usage Manager() -- runs Manager.loadModdules() diff --git a/modules/ExpGamingCore/Role/control.lua b/modules/ExpGamingCore/Role/control.lua index f721c2b1..826b4340 100644 --- a/modules/ExpGamingCore/Role/control.lua +++ b/modules/ExpGamingCore/Role/control.lua @@ -41,6 +41,7 @@ local Role = { local role = self.get(role_name) if not role then error('Invalid role name in order listing: '..role_name) return end if role.is_default then self.meta.default = role end + if role.is_root then self.meta.root = role end if role.is_timed then self.meta.times[role.name] = {index,role.time*3600} end if not self.meta.groups[role.group.name] then self.meta.groups[role.group.name] = {lowest=index,highest=index} end if self.meta.groups[role.group.name].highest > index then self.meta.groups[role.group.name].highest = index end @@ -102,6 +103,7 @@ end -- @treturn table the group which was found or nil function Role.get(mixed) local player = game and Game.get_player(mixed) + if player == SERVER then return {Role.meta.root} end if player then local rtn = {} if not global.players[player.index] then return Role.meta.default and {Role.meta.default} or {} end