Added welcome tab

This commit is contained in:
Cooldude2606
2020-03-24 18:41:57 +00:00
parent 162d586b34
commit 53ec32c832
5 changed files with 119 additions and 13 deletions

View File

@@ -2,5 +2,7 @@ return {
Cooldude2606 = 'Lua lets you set metatables on numbers, did you know that? Cooldude2606 knows this.',
samy115 = 'Tremble in fear as the banhammer is now here, its owner: samy115',
XenoCyber = '"Fire Fire Fire" oops wrong game, have no fear XenoCyber is here',
HunterOfGames = 'Unable to support HunterOfGames. You must construct additional miners.'
HunterOfGames = 'Unable to support HunterOfGames. You must construct additional miners.',
ookl = 'ookl says: "Pineapples are amazing, hello everyone!"',
arty714 = 'Arty\'s Potato made it!'
}

View File

@@ -216,3 +216,27 @@ end)
frame_style.padding = 2
frame_style.minimal_width = width
end)
--[[-- Used to make a solid white bar in a gui
@element Gui.bar
@tparam LuaGuiElement parent the parent element to which the container will be added
@tparam number width the width of the bar that will be made, if not given bar will strech to fill the parent
@usage-- Adding a bar to a gui
local bar = Gui.bar(parent, 100)
]]
Gui.bar =
Gui.element(function(_,parent)
return parent.add{
type = 'progressbar',
size = 1,
value = 1
}
end)
:style(function(style,_,width)
style.height = 3
style.color = {r=255,g=255,b=255}
if width then style.width = width
else style.horizontally_stretchable = true end
end)

View File

@@ -97,3 +97,19 @@ timer-tooltip=Warp cooldown takes __1__ seconds
goto-tooltip=Go to x __1__ y __2__
goto-disabled=You must be on a warp point and have a full charge to warp
goto-edit=Edit warp icon
[readme]
main-tooltip=Infomation
welcome-tab=Welcome
welcome-tooltip=Welcome to Explosive Gaming
welcome-general=Welcome to Explosive Gaming, we host many factorio servers. While you are here we require you to follow our rules, you can find these in the tab above. You can also find our custom commands and links to our other servers.\nPlease note that our servers reset periodically, the next reset is: __1__
welcome-roles=We run a custom role system to help protect the work of others. As a result you may not be able to use your deconstruction planner yet or drop item on the groud. Roles also give you access to some custom features such as adding tasks to our task list or making new warp points.\nYou have been assigned the roles: __1__
welcome-chat=Chatting can be difficult for new players because its different than other games! Its very simple, the button you need to press is the “GRAVE/TILDE” key (which is located under the “ESC key”) - If you would like to change the key, go to your Controls tab in options.\nThe setting you need to change is “Toggle chat (and Lua console)” you currently have it set to "__CONTROL__toggle-console__"
rules-tab=Rules
rules-tooltip=Rules for our server
commands-tab=Commands
commands-tooltip=Commands which you are able to use
servers-tab=Servers
servers-tooltip=Links to our other servers and sites
backers-tab=Backers
backers-tooltip=People who have helped make our server

BIN
modules/gui/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -14,17 +14,82 @@ local function Tab(caption,tooltip,element_define)
tabs[#tabs+1] = {caption,tooltip,element_define}
end
local function description_label(parent,width,caption)
local label = parent.add{
type = 'label',
caption = caption,
style = 'description_label'
}
local style = label.style
style.horizontal_align = 'center'
style.single_line = false
style.width = width
end
--- Sub content area used within the content areas
-- @element sub_content
local sub_content =
Gui.element(function(_,parent)
return parent.add{
type = 'frame',
direction = 'vertical',
style = 'image_frame'
}
end)
:style{
horizontally_stretchable = true,
horizontal_align = 'center'
}
--- Content area for the welcome tab
-- @element welcome_content
Tab('Welcome',nil,
Gui.element{
Tab({'readme.welcome-tab'},{'readme.welcome-tooltip'},
Gui.element(function(_,parent)
local server_details = global.server_details or { name='ExpGaming S0 - Local', description='Failed to load description: disconnected from sync api.', reset_time='Non Set', branch='Unknown'}
local container = parent.add{ type='flow', direction='vertical' }
local player = Gui.get_player_from_element(parent)
-- Set up the top flow with logos
local top_flow = container.add{ type='flow' }
top_flow.add{ type='sprite', sprite='file/modules/gui/logo.png'}
local top_vertical_flow = top_flow.add{ type='flow', direction='vertical' }
top_flow.add{ type='sprite', sprite='file/modules/gui/logo.png'}
top_vertical_flow.style.horizontal_align = 'center'
-- Add the title to the top flow
local title_flow = top_vertical_flow.add{ type='flow' }
title_flow.style.vertical_align = 'center'
Gui.bar(title_flow,85)
title_flow.add{
type = 'label',
caption = 'Welcome'
})
caption = 'Welcome to '..server_details.name,
style = 'caption_label'
}
Gui.bar(title_flow,85)
-- Add the description to the top flow
description_label(top_vertical_flow,380,server_details.description)
Gui.bar(container)
-- Get the names of the roles the player has
local player_roles = Roles.get_player_roles(player)
local role_names = {}
for i,role in ipairs(player_roles) do
role_names[i] = role.name
end
-- Add the other information to the gui
description_label(sub_content(container),575,{'readme.welcome-general',server_details.reset_time})
description_label(sub_content(container),575,{'readme.welcome-roles',table.concat(role_names,', ')})
description_label(sub_content(container),575,{'readme.welcome-chat'})
return container
end))
--- Content area for the rules tab
-- @element rules_content
Tab('Rules',nil,
Tab({'readme.rules-tab'},{'readme.rules-tooltip'},
Gui.element{
type = 'label',
caption = 'Rules'
@@ -32,7 +97,7 @@ Gui.element{
--- Content area for the commands tab
-- @element commands_content
Tab('Commands',nil,
Tab({'readme.commands-tab'},{'readme.commands-tooltip'},
Gui.element{
type = 'label',
caption = 'Commands'
@@ -40,15 +105,15 @@ Gui.element{
--- Content area for the servers tab
-- @element servers_content
Tab('Servers',nil,
Tab({'readme.servers-tab'},{'readme.servers-tooltip'},
Gui.element{
type = 'label',
caption = 'Servers'
})
--- Content area for the servers tab
-- @element servers_content
Tab('Backers',nil,
-- @element backers_content
Tab({'readme.backers-tab'},{'readme.backers-tooltip'},
Gui.element{
type = 'label',
caption = 'Backers'
@@ -91,7 +156,6 @@ Gui.element(function(event_trigger,parent)
tab_pane.add_tab(tab, tab_details[3](tab_pane))
end
tab_pane.style.width = 500
return container
end)
:on_open(function(player)
@@ -107,7 +171,7 @@ end)
--- Toggle button for the readme gui
-- @element readme_toggle
readme_toggle =
Gui.toolbar_button('virtual-signal/signal-info','Information',function(player)
Gui.toolbar_button('virtual-signal/signal-info',{'readme.main-tooltip'},function(player)
return Roles.player_allowed(player,'gui/readme')
end)
:on_click(function(player,_)