Updated config for rocket Gui

This commit is contained in:
Cooldude2606
2019-05-28 01:37:43 +01:00
parent 0ddf4676fe
commit 84a377f4e5
2 changed files with 28 additions and 29 deletions

View File

@@ -1,22 +1,18 @@
--- This file controls what will show in each section of the rocket info gui
-- each function will be given the player and must return the value to show and a tooltip, nil will not show the stat
local Global = require 'utils.global'
local Event = require 'utils.event'
return {
stats = {
show_stats=true,
show_first_rocket = true,
show_last_rocket = true,
show_fastest_rocket = true,
show_total_rockets = true,
show_game_avg = true,
rolling_avg = {
stats = { --- The data that will show in the stats section
show_stats=true, -- false will hide this section all together
show_first_rocket = true, -- false will not show when the first rocket was launched
show_last_rocket = true, -- false will not show when the last rocket was launched
show_fastest_rocket = true, -- false will not show the time taken for the fastest rocket
show_total_rockets = true, -- false will not show the total number of rockets launched
show_game_avg = true, -- false will hide the avg across the entire map time
rolling_avg = { -- each number will be one stat; 5 means the avg time taken for the last 5 rockets
5,10,25
}
},
milestones = {
show_milestones=true,
milestones = { -- each number will be one stat; 5 means the time that the 5th rocket was launched
show_milestones=true, -- false will hide this section all together
1,2,5,
10,20,50,
100,200,500,
@@ -24,14 +20,14 @@ return {
3000,3500,4000,4500,
5000
},
progress = {
show_progress = true,
allow_zoom_to_map = true,
allow_remote_launch = true,
remote_launch_admins_only = false,
remote_launch_role_permision = 'gui/rocket-info/remote_launch',
allow_toggle_active = true,
toggle_active_admins_only = false,
toggle_active_role_permision = 'gui/rocket-info/toggle-active'
progress = { --- The data and buttons in the build progress section
show_progress = true, -- false will hide this section altogether
allow_zoom_to_map = true, -- false will disable the zoom to map feature
allow_remote_launch = true, -- false removes the remote launch button for all players
remote_launch_admins_only = false, -- true will remove the remote launch button for all non (game) admins
remote_launch_role_permision = 'gui/rocket-info/remote_launch', -- value used by custom permission system to allow or disllow the button
allow_toggle_active = true, -- false removes the remote toggle auto launch button for all players
toggle_active_admins_only = false, -- true will remove the toggle auto launch button for all non (game) admins
toggle_active_role_permision = 'gui/rocket-info/toggle-active' -- value used by custom permission system to allow or disllow the button
}
}

View File

@@ -139,7 +139,7 @@ local function create_section(container,section_name,table_size)
name=section_name..'-header',
style='subheader_frame',
}
Gui.set_padding(header,1,1,3,3)
Gui.set_padding(header,4,1,4,4)
header.style.horizontally_stretchable = true
--- Caption for the header bar
@@ -413,6 +413,8 @@ local function generate_progress(player,frame)
generate_progress_buttons(player,element,rocket_silo_data)
--- Creats two flows and two labels for the X and Y position
local name = config.progress.allow_zoom_to_map and zoom_to_map_name or nil
local tooltip = config.progress.allow_zoom_to_map and {'rocket-info.progress-label-tooltip'} or nil
local flow_x = element.add{
type='flow',
name='label-x-'..silo_name,
@@ -421,9 +423,9 @@ local function generate_progress(player,frame)
Gui.set_padding(flow_x,0,0,1,2)
flow_x.add{
type='label',
name=zoom_to_map_name,
name=name,
caption={'rocket-info.progress-x-pos',pos.x},
tooltip={'rocket-info.progress-label-tooltip'}
tooltip=tooltip
}
local flow_y = element.add{
@@ -434,9 +436,9 @@ local function generate_progress(player,frame)
Gui.set_padding(flow_y,0,0,1,2)
flow_y.add{
type='label',
name=zoom_to_map_name,
name=name,
caption={'rocket-info.progress-y-pos',pos.y},
tooltip={'rocket-info.progress-label-tooltip'}
tooltip=tooltip
}
--- Creates the progress value which is right aligned
@@ -483,7 +485,8 @@ Gui.new_left_frame('gui/rocket-info')
return player.force.rockets_launched > 0 and Gui.classes.toolbar.allowed(player,define_name)
end)
:set_open_by_default(function(player,define_name)
return player.force.rockets_launched > 0
return true
--return player.force.rockets_launched > 0
end)
:set_direction('vertical')
:on_draw(function(player,element)