Skip to content

Commit

Permalink
Button to navigate back to lobby server
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielv123 authored Oct 12, 2022
1 parent 4482769 commit 089cea3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 12 additions & 1 deletion module/faction/gui/faction_server_status/draw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@ local function draw_faction_server_status(player, faction_id)

local content = {
type = "flow",
direction = "vertical",
direction = "vertical",
{
type = "button",
caption = "Join lobby server",
style = "green_button",
actions = {
on_click = {
location = "faction_server_status",
action = "join_lobby_server",
},
},
},
{
type = "label",
caption = "Server name: "..clusterio_api.get_instance_name(),
Expand Down
5 changes: 4 additions & 1 deletion module/faction/gui/faction_server_status/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ local function on_gui_click(_, action, player)
if player == nil then return end
if action.location == "faction_server_status" then
if action.action == "close" then
game.player.gui.left.clear()
player.gui.left.clear()
end
if action.action == "join_lobby_server" then
player.connect_to_server({address = "localhost:10000", name = "Lobby server"}) -- TODO: Use correct lobby address here
end
if action.action == "claim_sector" then
-- Open claim dialog
Expand Down

0 comments on commit 089cea3

Please sign in to comment.