Eddit To ExpGamingCore.Gui and Added ExpGamingPlayer.Polls

This commit is contained in:
Cooldude2606
2018-10-09 18:49:40 +01:00
parent 8dffc99642
commit 6df973eb5c
42 changed files with 205 additions and 163 deletions

View File

@@ -1,12 +1,12 @@
--- A full ranking system for factorio.
-- @module ExpGamingPlayer.playerInfo
--- Used to give so common info on a player as a lua table or a frame.
-- @module ExpGamingPlayer.playerInfo@4.0.0
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
local Game = require('FactorioStdLib.Game')
local Gui = require('ExpGamingCore.Gui')
local Role -- hanndled on load
local Group -- hanndled on load
local Game = require('FactorioStdLib.Game@^0.8.0')
local Gui = require('ExpGamingCore.Gui@^4.0.0')
local Role -- ExpGamingCore.Role@^4.0.0
local Group -- ExpGamingCore.Group@^4.0.0
local function get_player_info(player,frame,add_cam)
local player = Game.get_player(player)
@@ -30,15 +30,15 @@ local function get_player_info(player,frame,add_cam)
frame.style.width = 200
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}}
frame.add{type='label',caption={'ExpGamingPlayer_playerInfo.name',_player.index,_player.name},style='caption_label'}
local _online = {'ExpGamingPlayer_playerInfo.no'}; if _player.online then _online = {'ExpGamingPlayer_playerInfo.yes'} end
frame.add{type='label',caption={'ExpGamingPlayer_playerInfo.online',_online,tick_to_display_format(_player.online_time)}}
local _admin = {'ExpGamingPlayer_playerInfo.no'}; if _player.admin then _admin = {'ExpGamingPlayer_playerInfo.yes'} end
frame.add{type='label',caption={'ExpGamingPlayer_playerInfo.admin',_admin}}
if Role then
frame.add{type='label',caption={'player-info.group',_player.group}}
frame.add{type='label',caption={'player-info.role',_player.highest_role}}
frame.add{type='label',caption={'player-info.roles',table.concat(_player.roles,', ')}}
frame.add{type='label',caption={'ExpGamingPlayer_playerInfo.group',_player.group}}
frame.add{type='label',caption={'ExpGamingPlayer_playerInfo.role',_player.highest_role}}
frame.add{type='label',caption={'ExpGamingPlayer_playerInfo.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}
@@ -50,8 +50,8 @@ end
return setmetatable({
get_player_info=get_player_info,
on_init=function(self)
if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end
if loaded_modules['ExpGamingCore.Group'] then Group = require('ExpGamingCore.Group') end
if loaded_modules['ExpGamingCore.Role@^4.0.0'] then Role = require('ExpGamingCore.Role@^4.0.0') end
if loaded_modules['ExpGamingCore.Group@^4.0.0'] then Group = require('ExpGamingCore.Group@^4.0.0') end
end
},{
__call=function(self,...) self.get_player_info(...) end