mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Multiple Bug Fixs
This commit is contained in:
@@ -35,10 +35,6 @@ function Admin.create_reason(reason,name)
|
||||
return reason
|
||||
end
|
||||
|
||||
function Admin.open(player,pre_select_player,pre_select_action)
|
||||
if Admin.center then Gui.center.clear(player) Admin.center.open(player,pre_select_player,pre_select_action) end
|
||||
end
|
||||
|
||||
function Admin.allowed(player)
|
||||
local player = Game.get_player(player)
|
||||
if Role then
|
||||
|
||||
@@ -28,6 +28,11 @@ local AdminGui = {
|
||||
buttons={}
|
||||
}
|
||||
|
||||
function Admin.open(player,pre_select_player,pre_select_action)
|
||||
Gui.center.clear(player)
|
||||
Admin.center.open(player,pre_select_player,pre_select_action)
|
||||
end
|
||||
|
||||
-- Function Define
|
||||
function AdminGui.add_button(name,caption,tooltip,callback)
|
||||
AdminGui.buttons[name] = Gui.inputs.add{
|
||||
@@ -212,5 +217,4 @@ Admin.center = Gui.center{
|
||||
|
||||
-- Module Return
|
||||
-- calling will draw the admin buttons to that frame
|
||||
Admin.button_flow = AdminGui
|
||||
return setmetatable(AdminGui,{__call=function(self,...) self.draw(...) end})
|
||||
@@ -39,7 +39,6 @@ function Admin.jail(player,by_player,reason)
|
||||
['By:']='<<inline>>'..by_player_name,
|
||||
['Reason:']=reason
|
||||
} end
|
||||
if Admin.move_inventory then Admin.move_inventory(player) end
|
||||
Role.meta.last_jail = player.name
|
||||
Server.interface(Role.unassign,true,player,Role.get(player),by_player_name)
|
||||
Server.interface(Role.assign,true,player,'Jail',by_player_name)
|
||||
|
||||
@@ -125,7 +125,7 @@ local confirm_report = Gui.inputs{
|
||||
type='button',
|
||||
name='admin-report-confirm',
|
||||
caption='utility/spawn_flag',
|
||||
tooltip={'ExpGamingAdmin.name'}
|
||||
tooltip={'ExpGamingAdmin.report'}
|
||||
}:on_event('click',function(event)
|
||||
local parent = event.element.parent
|
||||
local player = Game.get_player(parent.player.caption)
|
||||
@@ -138,7 +138,7 @@ Admin.report_btn = Gui.inputs{
|
||||
type='button',
|
||||
name='admin-report',
|
||||
caption='utility/spawn_flag',
|
||||
tooltip={'ExpGamingAdmin.name'}
|
||||
tooltip={'ExpGamingAdmin.report'}
|
||||
}:on_event('click',function(event)
|
||||
local parent = event.element.parent
|
||||
local player = Game.get_player(parent.children[1].name)
|
||||
@@ -150,7 +150,7 @@ Admin.report_btn = Gui.inputs{
|
||||
name='report-gui'
|
||||
}
|
||||
_player.opened=frame
|
||||
frame.caption={'ExpGamingAdmin.name'}
|
||||
frame.caption={'ExpGamingAdmin.report'}
|
||||
frame.add{
|
||||
type='textfield',
|
||||
name='reason'
|
||||
|
||||
@@ -35,7 +35,7 @@ Group{
|
||||
}
|
||||
|
||||
Group{
|
||||
name='Guest',
|
||||
name='User',
|
||||
disallow={
|
||||
'edit_permission_group',
|
||||
'delete_permission_group',
|
||||
|
||||
@@ -185,15 +185,15 @@ function Sync.count_roles()
|
||||
local _rtn = {admin={online={},players={}},user={online={},players={}}}
|
||||
for index,player in pairs(game.players) do
|
||||
if player.admin then
|
||||
table.insert(_roles.admin.players,player.name)
|
||||
if player.connected then table.insert(_roles.admin.online,player.name) end
|
||||
table.insert(_rtn.admin.players,player.name)
|
||||
if player.connected then table.insert(_rtn.admin.online,player.name) end
|
||||
else
|
||||
table.insert(_roles.user.players,player.name)
|
||||
if player.connected then table.insert(_roles.user.online,player.name) end
|
||||
table.insert(_rtn.user.players,player.name)
|
||||
if player.connected then table.insert(_rtn.user.online,player.name) end
|
||||
end
|
||||
end
|
||||
_rtn.admin.n_players,_roles.admin.n_online=#_rtn.admin.players,#_rtn.admin.online
|
||||
_rtn.user.n_players,_roles.user.n_online=#_rtn.user.players,#_rtn.user.online
|
||||
_rtn.admin.n_players,_rtn.admin.n_online=#_rtn.admin.players,#_rtn.admin.online
|
||||
_rtn.user.n_players,_rtn.user.n_online=#_rtn.user.players,#_rtn.user.online
|
||||
return _rtn
|
||||
end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
||||
local Gui = require('ExpGamingCore.Gui@^4.0.0')
|
||||
local Admin -- ExpGamingAdmin.AdminLib@^4.0.0
|
||||
local AdminGui -- ExpGamingAdmin.Gui@^4.0.0
|
||||
|
||||
-- Local Varibles
|
||||
local playerInfo = function(player,frame)
|
||||
@@ -31,6 +32,7 @@ local ThisModule = {
|
||||
if loaded_modules['ExpGamingPlayer.playerInfo'] then playerInfo = require('ExpGamingPlayer.playerInfo') end
|
||||
if loaded_modules['ExpGamingCore.Role@^4.0.0'] then getPlayers = require(module_path..'/src/ranking',{self=self}) end
|
||||
if loaded_modules['ExpGamingAdmin.AdminLib@^4.0.0'] then Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') end
|
||||
if loaded_modules['ExpGamingAdmin.Gui@^4.0.0'] then AdminGui = require('ExpGamingAdmin.Gui@^4.0.0') end
|
||||
end
|
||||
}
|
||||
|
||||
@@ -129,7 +131,7 @@ script.on_event(defines.events.on_gui_click,function(event)
|
||||
back_btn:draw(flow)
|
||||
playerInfo(event.element.name,flow,true)
|
||||
if Game.get_player(event.element.name) and event.player_index == Game.get_player(event.element.name).index then return end
|
||||
if Admin and Admin.allowed(event.player_index) then Admin.button_flow(flow).caption = event.element.name end
|
||||
if Admin and AdminGui and Admin.allowed(event.player_index) then AdminGui(flow).caption = event.element.name end
|
||||
end)
|
||||
|
||||
script.on_event(defines.events.on_player_joined_game,function() ThisModule.update() end)
|
||||
|
||||
Reference in New Issue
Block a user