mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-28 12:05:21 +09:00
Converted Modules To Use Roles
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
|
||||
local Game = require('FactorioStdLib.Game')
|
||||
local Gui = require('ExpGamingCore.Gui')
|
||||
local Ranking -- hanndled on load
|
||||
local Role -- hanndled on load
|
||||
local Group -- hanndled on load
|
||||
|
||||
local function get_player_info(player,frame,add_cam)
|
||||
local player = Game.get_player(player)
|
||||
@@ -18,23 +19,26 @@ local function get_player_info(player,frame,add_cam)
|
||||
_player.color = player.color
|
||||
_player.admin = player.admin
|
||||
_player.online_time = player.online_time
|
||||
if Ranking then
|
||||
_player.rank = Ranking.get_rank(player).name
|
||||
_player.group = Ranking.get_group(player).name
|
||||
_player.group = player.permission_group.name
|
||||
if Role then
|
||||
_player.highest_role = Role.get_highest(player).name
|
||||
local roles = {}; for _,role in pairs(Role.get(player)) do table.insert(roles,role.name) end
|
||||
_player.roles = roles
|
||||
end
|
||||
if frame then
|
||||
local frame = frame.add{type='frame',direction='vertical',style='image_frame'}
|
||||
frame.style.width = 200
|
||||
if Ranking then frame.style.height = 275
|
||||
if Role then frame.style.height = 275
|
||||
else frame.style.height = 260 end
|
||||
frame.add{type='label',caption={'player-info.name',_player.index,_player.name},style='caption_label'}
|
||||
local _online = {'player-info.no'}; if _player.online then _online = {'player-info.yes'} end
|
||||
frame.add{type='label',caption={'player-info.online',_online,tick_to_display_format(_player.online_time)}}
|
||||
local _admin = {'player-info.no'}; if _player.admin then _admin = {'player-info.yes'} end
|
||||
frame.add{type='label',caption={'player-info.admin',_admin}}
|
||||
if Ranking then
|
||||
if Role then
|
||||
frame.add{type='label',caption={'player-info.group',_player.group}}
|
||||
frame.add{type='label',caption={'player-info.rank',_player.rank}}
|
||||
frame.add{type='label',caption={'player-info.role',_player.highest_role}}
|
||||
frame.add{type='label',caption={'player-info.roles',table.concat(_player.roles,', ')}}
|
||||
end
|
||||
if add_cam then
|
||||
Gui.cam_link{entity=player.character,frame=frame,width=200,height=150,zoom=0.5,respawn_open=true}
|
||||
@@ -46,7 +50,8 @@ end
|
||||
return setmetatable({
|
||||
get_player_info=get_player_info,
|
||||
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.Group'] then Group = require('ExpGamingCore.Group') end
|
||||
end
|
||||
},{
|
||||
__call=function(self,...) self.get_player_info(...) end
|
||||
|
||||
Reference in New Issue
Block a user