mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-28 20:05:22 +09:00
Converted Modules To Use Roles
This commit is contained in:
@@ -209,5 +209,5 @@ center._events = {[defines.events.on_gui_closed]=function(event)
|
||||
if event.element and event.element.valid then event.element.destroy() end
|
||||
end}
|
||||
|
||||
center.on_rank_change = center.clear
|
||||
center.on_role_change = center.clear
|
||||
return center
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
local Game = require('FactorioStdLib.Game')
|
||||
local Color = require('FactorioStdLib.Color')
|
||||
local Ranking -- this is optional and is hanndled by it being present, it is loaded on init
|
||||
local Role -- this is optional and is hanndled by it being present, it is loaded on init
|
||||
local mod_gui = require("mod-gui")
|
||||
local Gui = Gui -- this is to force gui to remain in the ENV
|
||||
|
||||
@@ -150,14 +150,14 @@ function left._left.toggle(event)
|
||||
if not success then error(err)
|
||||
elseif err == true then open = true
|
||||
elseif global.over_ride_left_can_open then
|
||||
if is_type(Ranking,'table') and Ranking.meta.rank_count > 0 then
|
||||
if Ranking.get_rank(player):allowed(_left.name) then open = true
|
||||
if is_type(Role,'table') then
|
||||
if Role.allowed(player,_left.name) then open = true
|
||||
else open = {gui.unauthorized} end
|
||||
else open = true end
|
||||
else open = err end
|
||||
else
|
||||
if is_type(Ranking,'table') and Ranking.meta.rank_count > 0 then
|
||||
if Ranking.get_rank(player):allowed(_left.name) then open = true
|
||||
if is_type(Role,'table') then
|
||||
if Role.allowed(player,_left.name) then open = true
|
||||
else open = {gui.unauthorized} end
|
||||
else open = true end
|
||||
end
|
||||
@@ -181,7 +181,7 @@ left.on_player_joined_game = function(event)
|
||||
end
|
||||
|
||||
function left:on_init()
|
||||
if loaded_modules['ExpGamingCore.Ranking'] then Ranking = require('ExpGamingCore.Ranking') end
|
||||
if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end
|
||||
end
|
||||
|
||||
return left
|
||||
@@ -8,7 +8,7 @@
|
||||
-- @function _comment
|
||||
|
||||
local Game = require('FactorioStdLib.Game')
|
||||
local Ranking -- this is optional and is hanndled by it being present, it is loaded on init
|
||||
local Role -- this is optional and is hanndled by it being present, it is loaded on init
|
||||
local mod_gui = require("mod-gui")
|
||||
local Gui = Gui -- this is to force gui to remain in the ENV
|
||||
|
||||
@@ -39,9 +39,8 @@ function toolbar.draw(player)
|
||||
toolbar_frame.clear()
|
||||
if not Gui.data.toolbar then return end
|
||||
for name,button in pairs(Gui.data.toolbar) do
|
||||
if is_type(Ranking,'table') and Ranking.meta.rank_count > 0 then
|
||||
local rank = Ranking.get_rank(player)
|
||||
if rank:allowed(name) then
|
||||
if is_type(Role,'table') then
|
||||
if Role.allowed(player,name) then
|
||||
button:draw(toolbar_frame)
|
||||
end
|
||||
else button:draw(toolbar_frame) end
|
||||
@@ -49,9 +48,9 @@ function toolbar.draw(player)
|
||||
end
|
||||
|
||||
function toolbar:on_init()
|
||||
if loaded_modules['ExpGamingCore.Ranking'] then Ranking = require('ExpGamingCore.Ranking') end
|
||||
if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end
|
||||
end
|
||||
|
||||
toolbar.on_rank_change = toolbar.draw
|
||||
toolbar.on_role_change = toolbar.draw
|
||||
toolbar.on_player_joined_game = toolbar.draw
|
||||
return toolbar
|
||||
Reference in New Issue
Block a user