From 279e99ba2bfbc1bb620a654f6c10203d9169503c Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 25 Mar 2020 23:30:34 +0000 Subject: [PATCH] Remade server tab --- locale/en/gui.cfg | 20 ++++++++- modules/gui/readme.lua | 96 ++++++++++++++++++++++++------------------ 2 files changed, 72 insertions(+), 44 deletions(-) diff --git a/locale/en/gui.cfg b/locale/en/gui.cfg index 75e7a4e2..200fe0db 100644 --- a/locale/en/gui.cfg +++ b/locale/en/gui.cfg @@ -129,8 +129,24 @@ commands-general=We have lots of custom commands which you are able to use. Belo servers-tab=Servers servers-tooltip=Links to our other servers and sites servers-general=This is only one of our servers for factorio, we host alot of others as well. Below you can find details about all the servers that we host as well as links to our external services such as discord or github. -servers-factorio=ExpGaming - S1 Public: This is our 48 hour reset experimental server.\nExpGaming - S2 Public: This is our 48 hour reset stable server.\nExpGaming - S3 Weekly: This is our weekly reset experimental server.\nExpGaming - S4 Weekly: This is our weekly reset stable server.\nExpGaming - S5 Modded: This is our modded server, see discord for details.\nExpGaming - S6 Donator: This is our donator only server, online when requested.\nExpGaming - S7 Event: This is our event server, we try to run an event every weekend\nExpGaming - S8 T̷-̶s̶-̴:̷ ̵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-external=__1__\n__2__ +servers-factorio=Factorio Servers +servers-1=S1 Public +servers-d1=This is our 48 hour reset experimental server. +servers-2=S2 Public +servers-d2=This is our 48 hour reset stable server. +servers-3=S3 Weekly +servers-d3=This is our weekly reset experimental server. +servers-4=S4 Weekly +servers-d4=This is our weekly reset stable server. +servers-5=S5 Modded +servers-d5=This is our modded server, see discord for details. +servers-6=S6 Donator +servers-d6=This is our donator only server, online when requested. +servers-7=S7 Event +servers-d7=This is our event server, we try to run an event every weekend +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-external=External Links backers-tab=Backers backers-tooltip=People who have helped make our server backers-general=We would like to thank all our staff and backers who have helped our comunity grow. Our staff have helped to keep our servers safe from trolls and fun places to play. Our backers have helped us to cover our running costs and provide a great comunity for us all to enjoy together. diff --git a/modules/gui/readme.lua b/modules/gui/readme.lua index 8bdbb159..6d609d9c 100644 --- a/modules/gui/readme.lua +++ b/modules/gui/readme.lua @@ -63,6 +63,41 @@ Gui.element(function(_,parent,bar_size,caption) return title_label end) +--- Table which has a title above it +-- @element title_table +local title_table = +Gui.element(function(_,parent,bar_size,caption,column_count) + title(parent, bar_size, caption) + + return parent.add{ + type = 'table', + column_count = column_count, + style = 'bordered_table' + } +end) +:style{ + padding = 0, + cell_padding = 0, + vertical_align = 'center', + horizontally_stretchable = true +} + +--- Scroll to be used with title tables +-- @element title_table_scroll +local title_table_scroll = +Gui.element{ + type = 'scroll-pane', + direction = 'vertical', + horizontal_scroll_policy = 'never', + vertical_scroll_policy = 'auto', + style = 'scroll_pane_under_subheader' +} +:style{ + padding = {1,3}, + maximal_height = 275, + horizontally_stretchable = true, +} + --- Content area for the welcome tab -- @element welcome_content Tab({'readme.welcome-tab'},{'readme.welcome-tooltip'}, @@ -84,6 +119,7 @@ Gui.element(function(_,parent) -- Add the description to the top flow description_label(top_vertical_flow,380,server_details.description) Gui.bar(container) + container.add{ type='flow' }.style.height = 4 -- Get the names of the roles the player has local player_roles = Roles.get_player_roles(player) @@ -167,38 +203,28 @@ Gui.element(function(_,parent) description_label(container,frame_width,{'readme.servers-general'}) Gui.bar(container) - -- Create the external links string - local result - local keys = {'discord','website','patreon','status','github'} - for i,key in ipairs(keys) do - if i == 1 then result = {'info.'..key} - else result = {'readme.servers-external',result,{'info.'..key}} end + -- Draw the scroll + container.add{ type='flow' } + local scroll_pane = title_table_scroll(container) + scroll_pane.style.maximal_height = 295 + + -- Add the dactorio servers + local factoiro_servers = title_table(scroll_pane, 225, {'readme.servers-factorio'}, 2) + for i = 1,8 do + description_label(factoiro_servers,106,{'readme.servers-'..i}) + description_label(factoiro_servers,462,{'readme.servers-d'..i}) end - -- Add the other information to the gui - description_label(sub_content(container),frame_width,{'readme.servers-factorio'}) - description_label(sub_content(container),frame_width,result) + -- Add the external links + local external_links = title_table(scroll_pane, 235, {'readme.servers-external'}, 2) + for _,key in ipairs{'discord','website','patreon','status','github'} do + description_label(external_links,106,key:gsub("^%l", string.upper)) + description_label(external_links,462,{'links.'..key}) + end return container end)) ---- Contains the names for backer players --- @element backer_table -local backer_table = -Gui.element(function(_,parent) - return parent.add{ - type = 'table', - column_count = 4, - style = 'bordered_table' - } -end) -:style{ - padding = 0, - cell_padding = 0, - vertical_align = 'center', - horizontally_stretchable = true -} - --- Content area for the servers tab -- @element backers_content Tab({'readme.backers-tab'},{'readme.backers-tooltip'}, @@ -245,25 +271,11 @@ Gui.element(function(_,parent) -- Draw the scroll container.add{ type='flow' } - local scroll_pane = - container.add{ - type = 'scroll-pane', - direction = 'vertical', - horizontal_scroll_policy = 'never', - vertical_scroll_policy = 'auto', - style = 'scroll_pane_under_subheader' - } - - -- Set the style of the scroll pane - local scroll_style = scroll_pane.style - scroll_style.padding = {1,3} - scroll_style.maximal_height = 275 - scroll_style.horizontally_stretchable = true + local scroll_pane = title_table_scroll(container) -- Add the different tables for _, players in pairs(groups) do - title(scroll_pane, players._width, players._title) - local table = backer_table(scroll_pane) + local table = title_table(scroll_pane, players._width, players._title, 4) for _,player_name in ipairs(players) do description_label(table,140,player_name) end