Converted Modules To Use Roles

This commit is contained in:
Cooldude2606
2018-09-29 17:28:07 +01:00
parent 96784009b6
commit e50bd509f8
48 changed files with 277 additions and 1146 deletions

View File

@@ -5,17 +5,17 @@
local Game = require('FactorioStdLib.Game')
local Gui = require('ExpGamingCore.Gui')
local Ranking -- hanndled on load
local Role -- hanndled on load
local Sync -- hanndled on load
function get_allowed_afk_time(player)
local rank
if Ranking then rank = Ranking.get_rank(player)
else if player.admin then return else rank = {base_afk_time=15} end end
local role
if Role then role = Role.get_highest(player)
else if player.admin then return else rank = Role.meta.default end end
local count = #game.connected_players
local base = rank.base_afk_time or false
local base = role.index or false
if not base then return false end
return (base/5)*count
return (10/base)*count
end
script.on_event(defines.events.on_tick,function(event)
@@ -31,7 +31,7 @@ end)
return {
get_allowed_afk_time=get_allowed_afk_time,
on_init=function(self)
if loaded_modules['ExpGamingCore.Ranking'] then Ranking = require('ExpGamingCore.Ranking') end
if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
if loaded_modules['ExpGamingCore.Server'] then require(module_path..'/src/server',Sync) end
end