mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
Added "Current" status to server list
This commit is contained in:
@@ -101,16 +101,18 @@ end
|
||||
|
||||
--[[-- Gets the status of the given server
|
||||
@tparam string server_id The internal server if for the server you want the status of
|
||||
@treturn string The status of the given server, one of: Online, Modded, Protected, Offline
|
||||
@tparam boolean raw When true Current will not be returned as status but rather the raw status for the server
|
||||
@treturn string The status of the given server, one of: Online, Modded, Protected, Current, Offline
|
||||
|
||||
@usage-- Get the status of the given server
|
||||
local status = External.get_server_status('eu-01')
|
||||
|
||||
]]
|
||||
function External.get_server_status(server_id)
|
||||
function External.get_server_status(server_id, raw)
|
||||
assert(var, 'No external data was found, use External.valid() to ensure external data exists.')
|
||||
local servers = assert(var.status, 'No server status was found, please ensure that the external service is running')
|
||||
return servers[server_id]
|
||||
local current = assert(ext.current, 'No current id was found, please ensure that the external service is running')
|
||||
return not raw and server_id == current and 'Current' or servers[server_id]
|
||||
end
|
||||
|
||||
--[[-- Gets the ups of the current server
|
||||
|
||||
@@ -147,6 +147,7 @@ servers-d7=This is our event server, we try to run events at least once per week
|
||||
servers-8=S8 T̷-̶s̶-̴:̷
|
||||
servers-d8=N̵o̴ ̶o̷-̶e̵ ̴k̸n̷-̶w̵s̸ ̴w̷h̷a̶-̶ ̷h̴a̴p̷p̴e̷n̷s̸ ̷o̶n̴ ̷t̶h̴-̶s̶ ̷s̷e̶r̸v̸e̴r̷,̶ ̸i̸t̴ ̷m̶-̸g̴h̶t̷ ̸n̸-̶t̵ ̷e̴v̸e̸n̶t̷ ̵-̷x̴i̵s̶t̸.̸
|
||||
servers-connect-Offline=Server is currently offline
|
||||
servers-connect-Current=This is your current server
|
||||
servers-connect-Version=Server is on a different version: __1__
|
||||
servers-connect-Password=Server requires a password
|
||||
servers-connect-Modded=Server requires mods to be downloaded
|
||||
|
||||
@@ -78,7 +78,8 @@ Gui.element{
|
||||
-- @element join_server
|
||||
local join_server =
|
||||
Gui.element(function(event_trigger, parent, server_id, wrong_version)
|
||||
local status = wrong_version and 'Version' or External.get_server_status(server_id) or 'Offline'
|
||||
local status = External.get_server_status(server_id) or 'Offline'
|
||||
if wrong_version then status = 'Version' end
|
||||
local flow = parent.add{ name = server_id, type = 'flow' }
|
||||
local button = flow.add{
|
||||
name = event_trigger,
|
||||
@@ -88,7 +89,7 @@ Gui.element(function(event_trigger, parent, server_id, wrong_version)
|
||||
tooltip = {'readme.servers-connect-'..status, wrong_version}
|
||||
}
|
||||
|
||||
if status == 'Offline' then
|
||||
if status == 'Offline' or status == 'Current' then
|
||||
button.enabled = false
|
||||
button.sprite = 'utility/circuit_network_panel_black'
|
||||
elseif status == 'Version' then
|
||||
|
||||
Reference in New Issue
Block a user