From ad4b870b59a27b5de0641b460d32eb27a7e58aa7 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 22 Sep 2019 19:21:21 +0100 Subject: [PATCH 1/4] Added some elements to expstyle --- expcore/gui/concepts/label.lua | 2 +- expcore/gui/core.lua | 2 +- expcore/gui/prototype.lua | 9 +- expcore/gui/styles/expstyle/alignment.lua | 47 +++++++++++ expcore/gui/styles/expstyle/container.lua | 36 ++++++++ expcore/gui/styles/expstyle/header.lua | 49 +++++++++++ expcore/gui/styles/expstyle/index.lua | 13 +++ expcore/gui/styles/expstyle/scroll_table.lua | 56 +++++++++++++ expcore/gui/styles/expstyle/time_label.lua | 86 ++++++++++++++++++++ 9 files changed, 297 insertions(+), 3 deletions(-) create mode 100644 expcore/gui/styles/expstyle/alignment.lua create mode 100644 expcore/gui/styles/expstyle/container.lua create mode 100644 expcore/gui/styles/expstyle/header.lua create mode 100644 expcore/gui/styles/expstyle/index.lua create mode 100644 expcore/gui/styles/expstyle/scroll_table.lua create mode 100644 expcore/gui/styles/expstyle/time_label.lua diff --git a/expcore/gui/concepts/label.lua b/expcore/gui/concepts/label.lua index 1cf70eac..9c2df448 100644 --- a/expcore/gui/concepts/label.lua +++ b/expcore/gui/concepts/label.lua @@ -6,7 +6,7 @@ local Gui = require 'expcore.gui.core' --[[-- A piece of text. -@element frame +@element label @tparam ?string|Concepts.LocalisedString caption the caption that will show in the label @tparam ?string|Concepts.LocalisedString description the description that will show on the label diff --git a/expcore/gui/core.lua b/expcore/gui/core.lua index 1edcd0b3..5365d54a 100644 --- a/expcore/gui/core.lua +++ b/expcore/gui/core.lua @@ -30,7 +30,7 @@ end Gui.require_concept('expgaming') --- @dep Gui.style.frame ]] function Gui.require_style(style_name) - require('expcore.gui.styles.'..style_name) + require('expcore.gui.styles.'..style_name..'.index') end --[[-- Gets a gui concept from name, id, or its self diff --git a/expcore/gui/prototype.lua b/expcore/gui/prototype.lua index 902aa4dc..269b4023 100644 --- a/expcore/gui/prototype.lua +++ b/expcore/gui/prototype.lua @@ -417,6 +417,7 @@ end --[[-- Calls all the draw functions in order to create this concept in game; will also store and sync the instance if stores are used @tparam LuaGuiElement parent_element the element that the concept will use as a base +@tparam[opt] string override_name when given this will be the name of the element rather than the concept id @treturn LuaGuiElement the element that was created and then passed though and returned by the draw functions @usage-- Drawing the custom button concept local custom_button = @@ -425,10 +426,12 @@ Gui.get_concept('CustomButton') -- Note that the draw function from button was cloned, so unless we want to alter the base button we dont need a new draw define custom_button:draw(game.player.gui.left) ]] -function Prototype:draw(parent_element,...) +function Prototype:draw(parent_element,override_name,...) + local old_name = self.properties.name local parent = parent_element local element + if override_name then self.properties.name = override_name end -- Loop over all the draw defines, element is updated when a value is returned for _,draw_callback in pairs(self.draw_callbacks) do local success, _element, _parent = pcall(draw_callback,self.properties,parent,element,...) @@ -436,10 +439,14 @@ function Prototype:draw(parent_element,...) if _element then element = _element end if _parent then parent = _parent end elseif not success then + self.properties.name = old_name error('Gui draw handler error with '..self.debug_name..':\n\t'.._element) end end + -- Return the name back to its previous value + self.properties.name = old_name + -- Adds the instance if instance store is used if self.add_instance then self.add_instance(element) diff --git a/expcore/gui/styles/expstyle/alignment.lua b/expcore/gui/styles/expstyle/alignment.lua new file mode 100644 index 00000000..a00c325f --- /dev/null +++ b/expcore/gui/styles/expstyle/alignment.lua @@ -0,0 +1,47 @@ +--[[-- Core Module - ExpStyle + @module ExpStyle +]] + +local Gui = require 'expcore.gui' --- @dep expcore.gui + +Gui.require_concept 'flow' --- @dep gui.concept.flow + +--[[-- A flow which can be used to align text and other elements +@element alignment +@usage-- Concept Structure +-- Root +--> [alignment] - the alignment area +Gui.new_concept('alignment') +:set_horizontal_align('center') +]] + +Gui.new_concept('flow') +:save_as('alignment') + +:new_property('horizontal_align',nil,'right') +:new_property('vertical_align',nil,'center') +:new_property('width') +:new_property('height') + +:define_draw(function(properties,parent,element) + local style = element.style + Gui.set_padding(element,1,1,2,2) + + -- Set the alignment of the flow + style.horizontal_align = properties.horizontal_align + style.vertical_align = properties.vertical_align + + -- Set the stretchablity based on the alignment + style.horizontally_stretchable = style.horizontal_align ~= 'center' + style.vertically_stretchable = style.vertical_align ~= 'center' + + -- Set the width if given + local width = properties.width + if width then style.width = width end + + -- Set the hieght if given + local height = properties.height + if height then style.height = height end + + return element +end) \ No newline at end of file diff --git a/expcore/gui/styles/expstyle/container.lua b/expcore/gui/styles/expstyle/container.lua new file mode 100644 index 00000000..c475c95d --- /dev/null +++ b/expcore/gui/styles/expstyle/container.lua @@ -0,0 +1,36 @@ +--[[-- Core Module - ExpStyle + @module ExpStyle +]] + +local Gui = require 'expcore.gui' --- @dep expcore.gui + +Gui.require_concept 'frame' --- @dep gui.concept.frame + +--[[-- A container frame that can be used to add a boader around your content +@element container +@usage-- Concept Structure +-- Root +--> [container] - the outer frame +-->> container - the content area +Gui.new_concept('container') +]] + +Gui.new_concept('frame') +:save_as('container') +:define_draw(function(properties,parent,element) + -- Update the outter frame padding + element.style.padding = 2 + + -- Add the inner frame + element = element.add{ + name = 'container', + type = 'frame', + direction = properties.direction, + style = 'window_content_frame_packed' + } + + -- Update the inner frame padding + element.style.padding = 0 + + return element +end) \ No newline at end of file diff --git a/expcore/gui/styles/expstyle/header.lua b/expcore/gui/styles/expstyle/header.lua new file mode 100644 index 00000000..c5699fb5 --- /dev/null +++ b/expcore/gui/styles/expstyle/header.lua @@ -0,0 +1,49 @@ +--[[-- Core Module - ExpStyle + @module ExpStyle +]] + +local Gui = require 'expcore.gui' --- @dep expcore.gui + +Gui.require_concept 'frame' --- @dep gui.concept.table + +local right_align = +Gui.new_concept('alignment') + +--[[-- A frame that acts as a header to a section of content +@element header +@tparam string tooltip the tooltip to show on the title +@usage-- Concept Structure +-- Root +--> [header] - the header frame +-->> header_caption - the lable with the title in it +-->> header_content - the area to contain butons +]] + +Gui.new_concept('frame') +:save_as('header') +:new_property('tooltip') + +-- Draw +:define_draw(function(properties,parent,element) + -- Update the table style + Gui.set_padding(element,2,2,4,4) + element.style = 'subheader_frame' + element.caption = nil + + local style = element.style + style.horizontally_stretchable = true + style.use_header_filler = false + + -- Add the caption to the frame + element.add{ + type = 'label', + name = 'header_caption', + caption = properties.title, + tooltip = properties.tooltip + } + + -- Add the right align area + local align = right_align:draw(element,'header_content') + + return align +end) \ No newline at end of file diff --git a/expcore/gui/styles/expstyle/index.lua b/expcore/gui/styles/expstyle/index.lua new file mode 100644 index 00000000..aa8afa39 --- /dev/null +++ b/expcore/gui/styles/expstyle/index.lua @@ -0,0 +1,13 @@ +--[[-- Core Module - ExpStyle + @core ExpStyle +]] + +local function r(name) + require('expcore.gui.styles.expstyle.'..name) +end + +r 'container' +r 'alignment' +r 'header' +r 'scroll_table' +r 'time_label' \ No newline at end of file diff --git a/expcore/gui/styles/expstyle/scroll_table.lua b/expcore/gui/styles/expstyle/scroll_table.lua new file mode 100644 index 00000000..0c1473d5 --- /dev/null +++ b/expcore/gui/styles/expstyle/scroll_table.lua @@ -0,0 +1,56 @@ +--[[-- Core Module - ExpStyle + @module ExpStyle +]] + +local Gui = require 'expcore.gui' --- @dep expcore.gui + +Gui.require_concept 'table' --- @dep gui.concept.table +Gui.require_concept 'scroll' --- @dep gui.concept.scroll + +local scroll_area = +Gui.new_concept('scroll') +:set_vertical_scroll('auto-and-reserve-space') +:set_horizontal_scroll('never') + +--[[-- A table that is inside a vertical scroll area +@element scroll_table +@tparam number hight the max hight of the scroll area +@usage-- Concept Structure +-- Root +--> [scroll_table] - the scroll area +-->> table - the table area +]] + +Gui.new_concept('table') +:save_as('scroll_table') +:new_property('hight',nil,100) + +-- Add a scroll before the table is drawn +:define_pre_draw(function(properties,parent,element) + local scroll = scroll_area:draw(parent,properties.name) + + -- Set the scroll style + Gui.set_padding(scroll,1,1,2,2) + scroll.style.horizontally_stretchable = true + scroll.style.maximal_height = properties.hight + + -- Change the name of the element to table before it is drawn + properties.name = 'table' + + return element, scroll +end) + +-- Draw +:define_draw(function(properties,parent,element) + -- Update the table style + local style = element.style + style.padding = 0 + style.horizontally_stretchable = true + style.vertical_align = 'center' + style.cell_padding = 0 + + -- Change the stored name back to the actual name + properties.name = element.parent.name + + return element +end) \ No newline at end of file diff --git a/expcore/gui/styles/expstyle/time_label.lua b/expcore/gui/styles/expstyle/time_label.lua new file mode 100644 index 00000000..efa7fd1f --- /dev/null +++ b/expcore/gui/styles/expstyle/time_label.lua @@ -0,0 +1,86 @@ +--[[-- Core Module - ExpStyle + @module ExpStyle +]] + +local Gui = require 'expcore.gui' --- @dep expcore.gui +local format_time = ext_require('expcore.common','format_time') --- @dep expcore.common + +--- Converts a tick into string format with workds and symbols +local function get_format(properties,time) + local caption, tooltip + + -- Check if a custom format is wanted + if properties.time_format then + -- Get the caption + local format = table.deep_copy(properties.time_format) + caption = format_time(time,format) + + -- Get the tooltip, always long format + format.long = true + tooltip = format_time(time,format) + + else + -- Get the caption + caption = format_time(time,{ + hours = properties.use_hours, + minutes = true, + seconds = true + }) + + -- Get the tooltip, same as the caption but long format + tooltip = format_time(time,{ + hours = properties.use_hours, + minutes = true, + seconds = true, + long = true + }) + + end + + return caption, tooltip +end + +--[[-- A label that show time in a nice, user friendly way +@element time_label +@tparam number time the time to display in tick +@usage-- Concept Structure +-- Root +--> [time_label] - the label with the time +]] + +local time_label = +Gui.new_concept() +:save_as('time_label') + +-- Properties +:new_property('time') +:new_property('use_hours',nil,false) +:new_property('time_format') + +-- Draw +:define_draw(function(properties,parent,element,time) + -- Get the caption and tooltip + local caption, tooltip = get_format(properties,time or properties.time) + + -- Draw a label + element = parent.add{ + name = properties.name, + type = 'label', + caption = caption, + tooltip = tooltip + } + + return element +end) + +--[[-- Updates the time that is on a label +@tparam LuaGuiElement element the label that you want to update +@tparam number time the number of tick you want it to show +@usage-- Update the time to show game time +time_label:update_time(element,game.time) +]] +function time_label:update_time(element,time) + local caption, tooltip = get_format(self.properties,time) + element.caption = caption + element.tooltip = tooltip +end \ No newline at end of file From 2cd9c80804c7b3291f1aaa3bbb29af354d47ed3d Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 24 Sep 2019 18:43:19 +0100 Subject: [PATCH 2/4] Added more styles --- expcore/gui/styles/expstyle/header.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/expcore/gui/styles/expstyle/header.lua b/expcore/gui/styles/expstyle/header.lua index c5699fb5..94991865 100644 --- a/expcore/gui/styles/expstyle/header.lua +++ b/expcore/gui/styles/expstyle/header.lua @@ -10,6 +10,7 @@ local right_align = Gui.new_concept('alignment') --[[-- A frame that acts as a header to a section of content +@see frame @element header @tparam string tooltip the tooltip to show on the title @usage-- Concept Structure @@ -17,6 +18,8 @@ Gui.new_concept('alignment') --> [header] - the header frame -->> header_caption - the lable with the title in it -->> header_content - the area to contain butons +Gui.new_concept('header') +:set_title('Example Header') ]] Gui.new_concept('frame') From 3609d07504cf35175f3df7b1873f8882fdcbae02 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 24 Sep 2019 18:43:32 +0100 Subject: [PATCH 3/4] Added more styles --- expcore/gui/styles/expstyle/alignment.lua | 1 + expcore/gui/styles/expstyle/container.lua | 1 + expcore/gui/styles/expstyle/data_label.lua | 89 +++++++++++++++++ expcore/gui/styles/expstyle/footer.lua | 52 ++++++++++ expcore/gui/styles/expstyle/scroll_table.lua | 4 + expcore/gui/styles/expstyle/time_label.lua | 6 ++ expcore/gui/styles/expstyle/toggle_button.lua | 49 ++++++++++ expcore/gui/styles/expstyle/unit_label.lua | 95 +++++++++++++++++++ 8 files changed, 297 insertions(+) create mode 100644 expcore/gui/styles/expstyle/data_label.lua create mode 100644 expcore/gui/styles/expstyle/footer.lua create mode 100644 expcore/gui/styles/expstyle/toggle_button.lua create mode 100644 expcore/gui/styles/expstyle/unit_label.lua diff --git a/expcore/gui/styles/expstyle/alignment.lua b/expcore/gui/styles/expstyle/alignment.lua index a00c325f..23477684 100644 --- a/expcore/gui/styles/expstyle/alignment.lua +++ b/expcore/gui/styles/expstyle/alignment.lua @@ -7,6 +7,7 @@ local Gui = require 'expcore.gui' --- @dep expcore.gui Gui.require_concept 'flow' --- @dep gui.concept.flow --[[-- A flow which can be used to align text and other elements +@see flow @element alignment @usage-- Concept Structure -- Root diff --git a/expcore/gui/styles/expstyle/container.lua b/expcore/gui/styles/expstyle/container.lua index c475c95d..ca1a62bb 100644 --- a/expcore/gui/styles/expstyle/container.lua +++ b/expcore/gui/styles/expstyle/container.lua @@ -7,6 +7,7 @@ local Gui = require 'expcore.gui' --- @dep expcore.gui Gui.require_concept 'frame' --- @dep gui.concept.frame --[[-- A container frame that can be used to add a boader around your content +@see frame @element container @usage-- Concept Structure -- Root diff --git a/expcore/gui/styles/expstyle/data_label.lua b/expcore/gui/styles/expstyle/data_label.lua new file mode 100644 index 00000000..c6ca002c --- /dev/null +++ b/expcore/gui/styles/expstyle/data_label.lua @@ -0,0 +1,89 @@ +--[[-- Core Module - ExpStyle + @module ExpStyle +]] + +local Gui = require 'expcore.gui' --- @dep expcore.gui + +Gui.require_concept 'label' --- @dep gui.concept.frame + +local right_align = +Gui.new_concept('alignment') + +--[[-- A label pair which has a static label and a data label which can be changed +@see label +@element data_label +@usage-- Concept Structure +-- Root +--> [data_label] - the static label +--> [properties.data_name] - the data label which can be updated +Gui.new_concept('data_label') +:set_data_label_name('game_ticks') +:set_data_caption('0') +:set_data_format(function(concept,element,data,...) + -- This is used with update_data_element and update_from_parent + local caption = tostirng('data') + local tooltip = 'This game has beeing running for: '..caption..' ticks' + return caption, tooltip +end) +]] + +local data_label = +Gui.new_concept('label') +:save_as('data_label') +:new_property('data_label_name') +:new_property('data_caption') +:new_property('data_tooltip') +:new_property('data_format',nil,function(concept,element,data,...) + return tostring(data) +end) + +-- Draw +:define_draw(function(properties,parent,element) + -- Make the label right aligned + local data_name = properties.data_label_name or properties.name..'_data' + local right_align_element = right_align:draw(parent,data_name) + + -- Add a new label + local data_label_element = + right_align_element.add{ + name = 'data_label' + } + + -- Get the data caption + local caption = Gui.resolve_property(properties.data_caption,element) + if caption then + data_label_element.caption = caption + end + + -- Get the data tooltip + local tooltip = Gui.resolve_property(properties.data_tooltip,element) + if tooltip then + data_label_element.tooltip = tooltip + end + + return data_label_element +end) + +function data_label:update_data_element(element,data,...) + local caption, tooltip = self.properties.data_format(self,element,data,...) + if caption then + element.caption = caption + end + if tooltip then + element.tooltip = tooltip + end +end + +function data_label:update_from_parent(parent,data,...) + local properties = self.properties + local data_name = properties.data_label_name or properties.name..'_data' + local element = parent[data_name] and parent[data_name].data_label or error('Data label is not a child of this element element',2) + + local caption, tooltip = properties.data_format(self,element,data,...) + if caption then + element.caption = caption + end + if tooltip then + element.tooltip = tooltip + end +end \ No newline at end of file diff --git a/expcore/gui/styles/expstyle/footer.lua b/expcore/gui/styles/expstyle/footer.lua new file mode 100644 index 00000000..3497832b --- /dev/null +++ b/expcore/gui/styles/expstyle/footer.lua @@ -0,0 +1,52 @@ +--[[-- Core Module - ExpStyle + @module ExpStyle +]] + +local Gui = require 'expcore.gui' --- @dep expcore.gui + +Gui.require_concept 'frame' --- @dep gui.concept.table + +local right_align = +Gui.new_concept('alignment') + +--[[-- A frame that acts as a footer to a section of content +@see frame +@element footer +@tparam string tooltip the tooltip to show on the title +@usage-- Concept Structure +-- Root +--> [footer] - the footer frame +-->> footer_caption - the lable with the title in it +-->> footer_content - the area to contain butons +Gui.new_concept('footer') +:set_title('Example Footer') +]] + +Gui.new_concept('frame') +:save_as('footer') +:new_property('tooltip') + +-- Draw +:define_draw(function(properties,parent,element) + -- Update the table style + Gui.set_padding(element,2,2,4,4) + element.style = 'subfooter_frame' + element.caption = nil + + local style = element.style + style.horizontally_stretchable = true + style.use_header_filler = false + + -- Add the caption to the frame + element.add{ + type = 'label', + name = 'footer_caption', + caption = properties.title, + tooltip = properties.tooltip + } + + -- Add the right align area + local align = right_align:draw(element,'footer_content') + + return align +end) \ No newline at end of file diff --git a/expcore/gui/styles/expstyle/scroll_table.lua b/expcore/gui/styles/expstyle/scroll_table.lua index 0c1473d5..411851b7 100644 --- a/expcore/gui/styles/expstyle/scroll_table.lua +++ b/expcore/gui/styles/expstyle/scroll_table.lua @@ -13,12 +13,16 @@ Gui.new_concept('scroll') :set_horizontal_scroll('never') --[[-- A table that is inside a vertical scroll area +@see table @element scroll_table @tparam number hight the max hight of the scroll area @usage-- Concept Structure -- Root --> [scroll_table] - the scroll area -->> table - the table area +Gui.new_concept('scroll_table') +:set_height(200) +:set_column_count(2) ]] Gui.new_concept('table') diff --git a/expcore/gui/styles/expstyle/time_label.lua b/expcore/gui/styles/expstyle/time_label.lua index efa7fd1f..64f5f6b7 100644 --- a/expcore/gui/styles/expstyle/time_label.lua +++ b/expcore/gui/styles/expstyle/time_label.lua @@ -46,6 +46,12 @@ end @usage-- Concept Structure -- Root --> [time_label] - the label with the time +local time_label = +Gui.new_concept('time_label') +:set_use_hours(true) +:set_time(game.tick) + +time_label:update_time(element,game.tick) ]] local time_label = diff --git a/expcore/gui/styles/expstyle/toggle_button.lua b/expcore/gui/styles/expstyle/toggle_button.lua new file mode 100644 index 00000000..06adc602 --- /dev/null +++ b/expcore/gui/styles/expstyle/toggle_button.lua @@ -0,0 +1,49 @@ +--[[-- Core Module - ExpStyle + @module ExpStyle +]] + +local Gui = require 'expcore.gui' --- @dep expcore.gui + +Gui.require_concept 'button' --- @dep gui.concept.table + +--[[-- A button that will toggle its caption each time it is pressed +@see button +@element toggle_button +@tparam string alt_caption the caption to show on the button in its true state +@tparam string alt_tooltip the tooltip to show on the button in its true state +@usage-- Concept Structure +-- Root +--> [toggle_button] - the header button +Gui.new_concept('toggle_button') +:set_caption('<') +:set_tooltip('Press to close.') +:set_alt_caption('>') +:set_alt_tooltip('Press to open.') +:on_click(function(event) + local state = event.state and 'close' or 'open' + event.player.print('Toggle button is now: '..state) +end) +]] + +Gui.new_concept('button') +:save_as('toggle_button') +:new_property('alt_caption') +:new_property('alt_tooltip') + +-- Events +:on_click(function(event) + local concept = event.concept + local properties = concept.properties + local element = event.element + if element.caption == properties.caption then + element.caption = properties.alt_caption + element.tooltip = properties.alt_tooltip or properties.tooltip + event.state = true + + else + element.caption = properties.caption + element.tooltip = properties.tooltip or properties.alt_tooltip + event.state = false + + end +end) \ No newline at end of file diff --git a/expcore/gui/styles/expstyle/unit_label.lua b/expcore/gui/styles/expstyle/unit_label.lua new file mode 100644 index 00000000..3295997a --- /dev/null +++ b/expcore/gui/styles/expstyle/unit_label.lua @@ -0,0 +1,95 @@ +--[[-- Core Module - ExpStyle + @module ExpStyle +]] + +local Gui = require 'expcore.gui' --- @dep expcore.gui + +Gui.require_concept 'label' --- @dep gui.concept.frame + +local right_align = +Gui.new_concept('alignment') + +--[[-- A label triplet which has a static label, a data label which can be changed, and a unit label +@see label +@see data_label +@element unit_label +@usage-- Concept Structure +-- Root +--> [unit_label] - the static label +--> [properties.data_name] - the data label which can be updated +--> [properties.data_name..'_unit'] - the data label unit which can be updated +Gui.new_concept('unit_label') +:set_data_label_name('game_ticks') +:set_data_caption('0') +:set_data_unit('ticks') +:set_data_format(function(concept,element,data,...) + -- This is used with update_data_element and update_from_parent + local caption = tostirng(data) + local unit = data > 1 and 'ticks' or 'tick' + local tooltip = 'This game has beeing running for: '..caption..' ticks' + return caption, unit, tooltip +end) +]] + +local unit_label = +Gui.new_concept('data_label') +:save_as('unit_label') +:new_property('data_label_name') +:new_property('data_caption') +:new_property('data_tooltip') +:new_property('data_unit') +:new_property('data_format',nil,function(concept,element,data,...) + local base_unit = concept.properties.data_unit + local caption = tostring(data) + local unit = data == 1 and base_unit or base_unit..'s' + return caption, unit +end) + +-- Draw +:define_draw(function(properties,parent,element) + -- Get the unit data + local unit = Gui.resolve_property(properties.data_unit,element) + + -- Add the unit label + parent.add{ + name = element.name..'_unit', + caption = unit or '', + tooltip = element.tooltip + } + + return element +end) + +function unit_label:update_data_element(element,data,...) + local caption, unit, tooltip = self.properties.data_format(self,element,data,...) + local unit_element = element.parent.parent[element.name..'_unit'] + if caption then + element.caption = caption + end + if tooltip then + element.tooltip = tooltip + unit_element.tooltip = tooltip + end + if unit then + unit_element.caption = unit + end +end + +function unit_label:update_from_parent(parent,data,...) + local properties = self.properties + local data_name = properties.data_label_name or properties.name..'_data' + local element = parent[data_name] and parent[data_name].data_label or error('Data label is not a child of this element element',2) + local unit_element = parent[data_name..'_unit'] + + local caption, unit, tooltip = properties.data_format(self,element,data,...) + if caption then + element.caption = caption + end + if tooltip then + element.tooltip = tooltip + unit_element.tooltip = tooltip + end + if unit then + unit_element.caption = unit + end +end \ No newline at end of file From 2f1e22edd297ced59d344d680b36eee030e256ad Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 24 Sep 2019 19:28:22 +0100 Subject: [PATCH 4/4] Updated docs --- docs/addons/Advanced-Start.html | 3 +- docs/addons/Chat-Popups.html | 3 +- docs/addons/Chat-Reply.html | 3 +- docs/addons/Compilatron.html | 3 +- docs/addons/Damage-Popups.html | 3 +- docs/addons/Death-Logger.html | 3 +- docs/addons/Discord-Alerts.html | 3 +- docs/addons/Player-Colours.html | 3 +- docs/addons/Pollution-Grading.html | 3 +- docs/addons/Scorched-Earth.html | 3 +- docs/addons/Spawn-Area.html | 3 +- docs/commands/Admin-Chat.html | 3 +- docs/commands/Bonus.html | 3 +- docs/commands/Cheat-Mode.html | 3 +- docs/commands/Clear-Inventory.html | 3 +- docs/commands/Debug.html | 3 +- docs/commands/Find.html | 3 +- docs/commands/Help.html | 3 +- docs/commands/Home.html | 3 +- docs/commands/Interface.html | 3 +- docs/commands/Jail.html | 3 +- docs/commands/Kill.html | 3 +- docs/commands/Me.html | 3 +- docs/commands/Rainbow.html | 3 +- docs/commands/Repair.html | 3 +- docs/commands/Reports.html | 3 +- docs/commands/Roles.html | 3 +- docs/commands/Spawn.html | 3 +- docs/commands/Tag.html | 3 +- docs/commands/Teleport.html | 3 +- docs/commands/Warnings.html | 3 +- docs/configs/Advanced-Start.html | 3 +- docs/configs/Bonuses.html | 3 +- docs/configs/Chat-Reply.html | 3 +- docs/configs/Commands-Auth-Admin.html | 3 +- docs/configs/Commands-Auth-Roles.html | 3 +- .../Commands-Auth-Runtime-Disable.html | 3 +- docs/configs/Commands-Parse-Roles.html | 3 +- docs/configs/Commands-Parse.html | 3 +- docs/configs/Compilatron.html | 3 +- docs/configs/Death-Logger.html | 3 +- docs/configs/Discord-Alerts.html | 3 +- docs/configs/File-Loader.html | 3 +- docs/configs/Permission-Groups.html | 3 +- docs/configs/Player-List.html | 3 +- docs/configs/Pollution-Grading.html | 3 +- docs/configs/Popup-Messages.html | 3 +- docs/configs/Preset-Player-Colours.html | 3 +- docs/configs/Repair.html | 3 +- docs/configs/Rockets.html | 3 +- docs/configs/Roles.html | 3 +- docs/configs/Science.html | 3 +- docs/configs/Scorched-Earth.html | 3 +- docs/configs/Spawn-Area.html | 3 +- docs/configs/Tasks.html | 3 +- docs/configs/Warnings.html | 3 +- docs/configs/Warps.html | 3 +- docs/control/Jail.html | 3 +- docs/control/Production.html | 3 +- docs/control/Reports.html | 3 +- docs/control/Rockets.html | 3 +- docs/control/Tasks.html | 3 +- docs/control/Warnings.html | 3 +- docs/control/Warps.html | 3 +- docs/core/Commands.html | 3 +- docs/core/Common-Library.html | 3 +- docs/core/ExpStyle.html | 1366 +++++++++++++++++ docs/core/Gui.html | 201 ++- docs/core/Permissions-Groups.html | 3 +- docs/core/Roles.html | 3 +- docs/core/Store.html | 3 +- docs/core/Sudo.html | 3 +- docs/core/Toolbar.html | 3 +- docs/guis/Player-List.html | 3 +- docs/guis/Rocket-Info.html | 3 +- docs/guis/Science-Info.html | 3 +- docs/guis/Task-List.html | 3 +- docs/guis/Warps-List.html | 3 +- docs/index.html | 6 +- docs/modules/ExpStyle.html | 1343 ++++++++++++++++ docs/modules/control.html | 3 +- docs/modules/tesrt.html | 386 +++++ .../utils.alien_evolution_progress.html | 3 +- docs/modules/utils.core.html | 3 +- docs/modules/utils.debug.html | 3 +- docs/modules/utils.dump_env.html | 3 +- docs/modules/utils.event.html | 3 +- docs/modules/utils.event_core.html | 3 +- docs/modules/utils.math.html | 3 +- docs/modules/utils.recipe_locker.html | 3 +- docs/modules/utils.state_machine.html | 3 +- docs/modules/utils.table.html | 3 +- docs/modules/utils.task.html | 3 +- docs/modules/utils.timestamp.html | 3 +- docs/topics/license.html | 3 +- docs/topics/readme.md.html | 3 +- expcore/gui/core.lua | 39 + expcore/gui/styles/expstyle/alignment.lua | 9 +- expcore/gui/styles/expstyle/container.lua | 6 +- expcore/gui/styles/expstyle/data_label.lua | 18 +- expcore/gui/styles/expstyle/footer.lua | 6 +- expcore/gui/styles/expstyle/header.lua | 6 +- expcore/gui/styles/expstyle/index.lua | 19 +- expcore/gui/styles/expstyle/scroll_table.lua | 8 +- expcore/gui/styles/expstyle/time_label.lua | 2 +- expcore/gui/styles/expstyle/toggle_button.lua | 6 +- expcore/gui/styles/expstyle/unit_label.lua | 18 +- 107 files changed, 3585 insertions(+), 127 deletions(-) create mode 100644 docs/core/ExpStyle.html create mode 100644 docs/modules/ExpStyle.html create mode 100644 docs/modules/tesrt.html diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index 99ffc5b4..7eff9ff1 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -70,6 +70,7 @@ + @@ -349,7 +350,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index b06d2672..b7f62e7a 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -70,6 +70,7 @@ + @@ -350,7 +351,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index d45ea3c6..461b1085 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -70,6 +70,7 @@ + @@ -377,7 +378,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 6eb7d3fe..69e05991 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -71,6 +71,7 @@ + @@ -586,7 +587,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index 95607966..b23f36ff 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -70,6 +70,7 @@ + @@ -350,7 +351,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index 3ab0419f..970986a7 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -70,6 +70,7 @@ + @@ -405,7 +406,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 7e7065bc..ce786d86 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -70,6 +70,7 @@ + @@ -461,7 +462,7 @@ generated by LDoc diff --git a/docs/addons/Player-Colours.html b/docs/addons/Player-Colours.html index e2995d38..be4036df 100644 --- a/docs/addons/Player-Colours.html +++ b/docs/addons/Player-Colours.html @@ -70,6 +70,7 @@ + @@ -405,7 +406,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index f257ab61..9c0a334d 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -70,6 +70,7 @@ + @@ -321,7 +322,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index 6f6fc337..69be957b 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -70,6 +70,7 @@ + @@ -405,7 +406,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index b2b11a94..7be892ff 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -70,6 +70,7 @@ + @@ -377,7 +378,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index aafc0e4e..59344610 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -80,6 +80,7 @@ + @@ -389,7 +390,7 @@ generated by LDoc diff --git a/docs/commands/Bonus.html b/docs/commands/Bonus.html index 9db97cf7..fc584a2e 100644 --- a/docs/commands/Bonus.html +++ b/docs/commands/Bonus.html @@ -80,6 +80,7 @@ + @@ -501,7 +502,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 1e4cc198..7bafc60e 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -80,6 +80,7 @@ + @@ -362,7 +363,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index 03e6c886..bf601ad5 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -80,6 +80,7 @@ + @@ -389,7 +390,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index edfcdbb1..532efa99 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -80,6 +80,7 @@ + @@ -366,7 +367,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index 586d8d34..17fec9b6 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -80,6 +80,7 @@ + @@ -361,7 +362,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index 25a8f115..0122b470 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -80,6 +80,7 @@ + @@ -405,7 +406,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index e88d2da7..793b64f4 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -80,6 +80,7 @@ + @@ -459,7 +460,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index 2cf6091a..1e467b7b 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -80,6 +80,7 @@ + @@ -417,7 +418,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index 1d41e418..238e0248 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -80,6 +80,7 @@ + @@ -612,7 +613,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 6b7e21d8..2f3a42d3 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -80,6 +80,7 @@ + @@ -390,7 +391,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index a071c0c1..24b64a87 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -80,6 +80,7 @@ + @@ -361,7 +362,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index dc82cc79..d921f1ef 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -80,6 +80,7 @@ + @@ -389,7 +390,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 29437a17..b6f8113b 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -79,6 +79,7 @@ + @@ -322,7 +323,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index 65f2d825..d51b8af1 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -80,6 +80,7 @@ + @@ -586,7 +587,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index e0d338c1..acf6971f 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -80,6 +80,7 @@ + @@ -558,7 +559,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index f8ef4787..a940c112 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -80,6 +80,7 @@ + @@ -390,7 +391,7 @@ generated by LDoc diff --git a/docs/commands/Tag.html b/docs/commands/Tag.html index ac1dd9e2..bafc6f14 100644 --- a/docs/commands/Tag.html +++ b/docs/commands/Tag.html @@ -80,6 +80,7 @@ + @@ -444,7 +445,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index efe6fe04..2afdbc08 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -80,6 +80,7 @@ + @@ -485,7 +486,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index 4d8a95a6..adabade7 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -80,6 +80,7 @@ + @@ -570,7 +571,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index 981debc7..3f5c06a8 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -85,6 +85,7 @@ + @@ -507,7 +508,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index f42ddc42..e04bc9e6 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -77,6 +77,7 @@ + @@ -238,7 +239,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index 37c2a42d..17898132 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -86,6 +86,7 @@ + @@ -486,7 +487,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index 48724dfc..e9d41e16 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -85,6 +85,7 @@ + @@ -295,7 +296,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index dc9614f2..ed8de360 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -85,6 +85,7 @@ + @@ -321,7 +322,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index c68b216a..b74be123 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -86,6 +86,7 @@ + @@ -443,7 +444,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index f432ec70..3cd75126 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -85,6 +85,7 @@ + @@ -355,7 +356,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index d3c7c295..454432dc 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -85,6 +85,7 @@ + @@ -339,7 +340,7 @@ see ./expcore/commands.lua for more details

generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index daeb3b5e..7f9f5bae 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -85,6 +85,7 @@ + @@ -355,7 +356,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index 60c66414..3df18979 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -85,6 +85,7 @@ + @@ -417,7 +418,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index 6cbff49c..307fba0d 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -77,6 +77,7 @@ + @@ -238,7 +239,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index f83ad879..8dd2e4d2 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -77,6 +77,7 @@ + @@ -241,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index 8a41a0bb..c748144f 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -85,6 +85,7 @@ + @@ -296,7 +297,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index abbd67bc..f416997b 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -86,6 +86,7 @@ + @@ -813,7 +814,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 55ce2814..bd47979f 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -85,6 +85,7 @@ + @@ -385,7 +386,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index 2a98b0b2..8f84f684 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -85,6 +85,7 @@ + @@ -415,7 +416,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index 5933597f..e49269ee 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -85,6 +85,7 @@ + @@ -325,7 +326,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index 1c90a44e..ff7b2189 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -85,6 +85,7 @@ + @@ -415,7 +416,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 4478572f..15088476 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -85,6 +85,7 @@ + @@ -835,7 +836,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index f503d293..6cc0063b 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -85,6 +85,7 @@ + @@ -293,7 +294,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index fc973191..a85612a6 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -85,6 +85,7 @@ + @@ -355,7 +356,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index b8e6ad74..f9888961 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -85,6 +85,7 @@ + @@ -389,7 +390,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index 8ac57876..fec2403b 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -85,6 +85,7 @@ + @@ -745,7 +746,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index 44ef1e74..43bdb919 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -85,6 +85,7 @@ + @@ -385,7 +386,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index 1a874b76..d5b14073 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -85,6 +85,7 @@ + @@ -356,7 +357,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index a8b05959..3fb7f77f 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -85,6 +85,7 @@ + @@ -685,7 +686,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index 4e10b7c8..a6acc5ce 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -69,6 +69,7 @@ + @@ -1209,7 +1210,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 115f41c1..53874e4d 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -69,6 +69,7 @@ + @@ -1330,7 +1331,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index f8c8e04b..67fb2864 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -69,6 +69,7 @@ + @@ -1111,7 +1112,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index 9c23440e..4d560f6f 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -68,6 +68,7 @@ + @@ -985,7 +986,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index b09d725e..f37fc0d6 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -68,6 +68,7 @@ + @@ -1040,7 +1041,7 @@ generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index e2f72325..38998a09 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -68,6 +68,7 @@ + @@ -1466,7 +1467,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index 1a650f00..fca4cb74 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -69,6 +69,7 @@ + @@ -1414,7 +1415,7 @@ generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index 37d28eb4..590f6080 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -57,6 +57,7 @@ + @@ -1973,7 +1974,7 @@ generated by LDoc diff --git a/docs/core/Common-Library.html b/docs/core/Common-Library.html index e4c5c30d..6f6e5c02 100644 --- a/docs/core/Common-Library.html +++ b/docs/core/Common-Library.html @@ -53,6 +53,7 @@ + @@ -2747,7 +2748,7 @@ Common.table_insert(tbl,50,tbl2) generated by LDoc diff --git a/docs/core/ExpStyle.html b/docs/core/ExpStyle.html new file mode 100644 index 00000000..f0baf989 --- /dev/null +++ b/docs/core/ExpStyle.html @@ -0,0 +1,1366 @@ + + + + + + + + ExpStyle core + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

ExpStyle core

+

Core Module - ExpStyle

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + +
expcore.gui
gui.concept.frame
gui.concept.flow
gui.concept.table
gui.concept.scroll
expcore.common
+ + +

Elements

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
alignmentA flow which can be used to align text and other elements
containerA container frame that can be used to add a boader around your content
data_labelA label pair which has a static label and a data label which can be changed
footerA frame that acts as a footer to a section of content
headerA frame that acts as a header to a section of content
scroll_tableA table that is inside a vertical scroll area
time_labelA label that show time in a nice, user friendly way
toggle_buttonA button that will toggle its caption each time it is pressed
unit_labelA label triplet which has a static label, a data label which can be changed, and a unit label
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + +
data_label:update_data_element(element, data)Updates the caption and tooltip of the data label using the data format function
data_label:update_from_parent(parent, data)Updates the caption and tooltip of the data label using the data format function, given the parent of the data label
time_label:update_time(element, time)Updates the time that is on a label
unit_label:update_data_element(element, data)Updates the caption and tooltip and unit of the data label using the data format function
unit_label:update_from_parent(parent, data)Updates the caption and tooltip and unit of the unit label using the data format function, given the parent of the unit label
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.frame +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.flow +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.table +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.scroll +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Elements

+
+
+
+
+ # + alignment +
+
+
+
+ +

A flow which can be used to align text and other elements

+

+ + + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [alignment] - the alignment area
+Gui.new_concept('alignment')
+:set_horizontal_align('center')
+ + +
+
+
+
+ # + container +
+
+
+
+ +

A container frame that can be used to add a boader around your content

+

+ + + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [container] - the outer frame
+-->> container - the content area
+Gui.new_concept('container')
+ + +
+
+
+
+ # + data_label +
+
+
+
+ +

A label pair which has a static label and a data label which can be changed

+

+ + + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [data_label] - the static label
+--> [properties.data_name] - the data label which can be updated
+Gui.new_concept('data_label')
+:set_data_label_name('game_ticks')
+:set_data_caption('0')
+:set_data_format(function(concept,element,data,...)
+    -- This is used with update_data_element and update_from_parent
+    local caption = tostirng('data')
+    local tooltip = 'This game has beeing running for: '..caption..' ticks'
+    return caption, tooltip
+end)
+ + +
+
+
+
+ # + footer +
+
+
+
+ +

A frame that acts as a footer to a section of content

+

+ + + Properties / Events: + +
    + + + + + +
  • + + tooltip + + : + + (string) + + the tooltip to show on the title + +
  • + + +
+ + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [footer] - the footer frame
+-->> footer_caption - the lable with the title in it
+-->> footer_content - the area to contain butons
+Gui.new_concept('footer')
+:set_title('Example Footer')
+ + +
+
+
+
+ # + header +
+
+
+
+ +

A frame that acts as a header to a section of content

+

+ + + Properties / Events: + +
    + + + + + +
  • + + tooltip + + : + + (string) + + the tooltip to show on the title + +
  • + + +
+ + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [header] - the header frame
+-->> header_caption - the lable with the title in it
+-->> header_content - the area to contain butons
+Gui.new_concept('header')
+:set_title('Example Header')
+ + +
+
+
+
+ # + scroll_table +
+
+
+
+ +

A table that is inside a vertical scroll area

+

+ + + Properties / Events: + +
    + + + + + +
  • + + hight + + : + + (number) + + the max hight of the scroll area + +
  • + + +
+ + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [scroll_table] - the scroll area
+-->> table - the table area
+Gui.new_concept('scroll_table')
+:set_height(200)
+:set_column_count(2)
+ + +
+
+
+
+ # + time_label +
+
+
+
+ +

A label that show time in a nice, user friendly way

+

+ + + Properties / Events: + +
    + + + + + +
  • + + time + + : + + (number) + + the time to display in tick + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [time_label] - the label with the time
+local time_label =
+Gui.new_concept('time_label')
+:set_use_hours(true)
+:set_time(game.tick)
+
+time_label:update_time(element,game.tick)
+ + +
+
+
+
+ # + toggle_button +
+
+
+
+ +

A button that will toggle its caption each time it is pressed

+

+ + + Properties / Events: + +
    + + + + + +
  • + + alt_caption + + : + + (string) + + the caption to show on the button in its true state + +
  • + + + + + +
  • + + alt_tooltip + + : + + (string) + + the tooltip to show on the button in its true state + +
  • + + +
+ + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [toggle_button] - the header button
+Gui.new_concept('toggle_button')
+:set_caption('<')
+:set_tooltip('Press to close.')
+:set_alt_caption('>')
+:set_alt_tooltip('Press to open.')
+:on_click(function(event)
+    local state = event.state and 'close' or 'open'
+    event.player.print('Toggle button is now: '..state)
+end)
+ + +
+
+
+
+ # + unit_label +
+
+
+
+ +

A label triplet which has a static label, a data label which can be changed, and a unit label

+

+ + + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [unit_label] - the static label
+--> [properties.data_name] - the data label which can be updated
+--> [properties.data_name..'_unit'] - the data label unit which can be updated
+Gui.new_concept('unit_label')
+:set_data_label_name('game_ticks')
+:set_data_caption('0')
+:set_data_unit('ticks')
+:set_data_format(function(concept,element,data,...)
+    -- This is used with update_data_element and update_from_parent
+    local caption = tostirng(data)
+    local unit = data > 1 and 'ticks' or 'tick'
+    local tooltip = 'This game has beeing running for: '..caption..' ticks'
+    return caption, unit, tooltip
+end)
+ + +
+
+

Functions

+
+
+
+
+ # + data_label:update_data_element(element, data) +
+
+
+
+ +

Updates the caption and tooltip of the data label using the data format function

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the data label element that you want to update + +
  • + + + + + +
  • + + data + + : + + (any) + + the data that you want to pass to the format function + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Updating the data to the current game tick
+data_label:update_data_element(element,game.tick)
+ + +
+
+
+
+ # + data_label:update_from_parent(parent, data) +
+
+
+
+ +

Updates the caption and tooltip of the data label using the data format function, given the parent of the data label

+

+ + + Parameters: + +
    + + + + + +
  • + + parent + + : + + (LuaGuiElement) + + the parent element to the data label element that you want to update + +
  • + + + + + +
  • + + data + + : + + (any) + + the data that you want to pass to the format function + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Updating the data to the current game tick
+data_label:update_from_parent(parent,game.tick)
+ + +
+
+
+
+ # + time_label:update_time(element, time) +
+
+
+
+ +

Updates the time that is on a label

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the label that you want to update + +
  • + + + + + +
  • + + time + + : + + (number) + + the number of tick you want it to show + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Update the time to show game time
+time_label:update_time(element,game.time)
+ + +
+
+
+
+ # + unit_label:update_data_element(element, data) +
+
+
+
+ +

Updates the caption and tooltip and unit of the data label using the data format function

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the unit label element that you want to update + +
  • + + + + + +
  • + + data + + : + + (any) + + the data that you want to pass to the format function + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Updating the data to the current game tick
+unit_label:update_data_element(element,game.tick)
+ + +
+
+
+
+ # + unit_label:update_from_parent(parent, data) +
+
+
+
+ +

Updates the caption and tooltip and unit of the unit label using the data format function, given the parent of the unit label

+

+ + + Parameters: + +
    + + + + + +
  • + + parent + + : + + (LuaGuiElement) + + the parent element to the unit label element that you want to update + +
  • + + + + + +
  • + + data + + : + + (any) + + the data that you want to pass to the format function + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Updating the data to the current game tick
+unit_label:update_from_parent(parent,game.tick)
+ + +
+
+ + + +
+
+
+ + + + diff --git a/docs/core/Gui.html b/docs/core/Gui.html index 67827252..9524e47e 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -62,6 +62,7 @@ + @@ -353,7 +354,7 @@ Gui.new_concept('button') -- W Grey semi-transparent boxes that contain other elements. - frame + label A piece of text. @@ -485,6 +486,14 @@ Gui.new_concept('button') -- W Destroies and element if it is valid + find(element, ...) + Finds and returns a gui element if it is valid from a long chain of element names or concepts + + + exists + Checks if a gui element exists or not, returns it if found else the path where it failed + + toggle_enabled(element) Toggles the enabled state of an element @@ -565,7 +574,7 @@ Gui.new_concept('button') -- W Used to define how the concept is turned into an ingame element or "instance" as we may refer to them - Prototype:draw(parent_element) + Prototype:draw(parent_element[, override_name]) Calls all the draw functions in order to create this concept in game; will also store and sync the instance if stores are used @@ -1342,8 +1351,8 @@ Gui.new_concept('frame')
- # - frame + # + label
@@ -3488,6 +3497,169 @@ Gui.get_concept('button') Gui.destroy(element) +
+
+
+
+ # + find(element, ...) +
+
+
+
+ +

Finds and returns a gui element if it is valid from a long chain of element names or concepts

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the root element to start checking from + +
  • + + + + + +
  • + + ... + + : + + (string or table) + + element names or element concepts that point to your element + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + if the element was found, failed +
  • +
  • + (string) + the path of the element that the search stoped at +
  • +
+
Or
+
    +
  • + (boolean) + if the element was found, found +
  • +
  • + (LuaGuiElement) + the element that was found +
  • +
+ + + + + + + + Usage: +
-- Getting the center gui
+local exists, center = Gui.find(player,'gui','center')
+ + +
+
+
+
+ # + exists +
+
+
+
+ +

Checks if a gui element exists or not, returns it if found else the path where it failed

+

+ + + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the root element to start checking from + +
  • + + + + + +
  • + + ... + + : + + (string or table) + + element names or element concepts that point to your element + +
  • + + +
+ + + + + + + + + See also: + + + + + Usage: +
-- Getting the center gui
+local exists, center = Gui.exists(player,'gui','center')
+ +
@@ -4686,7 +4858,7 @@ Gui.get_concept('Button')
# - Prototype:draw(parent_element) + Prototype:draw(parent_element[, override_name])
@@ -4717,6 +4889,23 @@ Gui.get_concept('Button') + + + +
  • + + override_name + + : + + (string) + + when given this will be the name of the element rather than the concept id + + (optional) +
  • + + @@ -5611,7 +5800,7 @@ Gui.get_concept('CustomButton') generated by LDoc diff --git a/docs/core/Permissions-Groups.html b/docs/core/Permissions-Groups.html index 6095d508..14d8fd23 100644 --- a/docs/core/Permissions-Groups.html +++ b/docs/core/Permissions-Groups.html @@ -56,6 +56,7 @@ + @@ -1433,7 +1434,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index 3e6a7fa4..dbd23fa6 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -60,6 +60,7 @@ + @@ -3153,7 +3154,7 @@ generated by LDoc diff --git a/docs/core/Store.html b/docs/core/Store.html index 6fd3ab97..3b0822b1 100644 --- a/docs/core/Store.html +++ b/docs/core/Store.html @@ -53,6 +53,7 @@ + @@ -1204,7 +1205,7 @@ this is similar to Store.get but will always return a table even if it is empty< generated by LDoc diff --git a/docs/core/Sudo.html b/docs/core/Sudo.html index 9f4c83f9..1e719894 100644 --- a/docs/core/Sudo.html +++ b/docs/core/Sudo.html @@ -53,6 +53,7 @@ + @@ -545,7 +546,7 @@ generated by LDoc diff --git a/docs/core/Toolbar.html b/docs/core/Toolbar.html index 2db838da..848922b5 100644 --- a/docs/core/Toolbar.html +++ b/docs/core/Toolbar.html @@ -56,6 +56,7 @@ + @@ -1660,7 +1661,7 @@ Gui.new_concept('toolbar-frame') generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index e80e3022..5afefbbf 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -65,6 +65,7 @@ + @@ -627,7 +628,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index 65b15a82..8804e5c6 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -65,6 +65,7 @@ + @@ -630,7 +631,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index 567731c0..3a06ef3e 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -65,6 +65,7 @@ + @@ -450,7 +451,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index 28d1ef22..8178d793 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -65,6 +65,7 @@ + @@ -633,7 +634,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index 91e2640e..c267b5c2 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -65,6 +65,7 @@ + @@ -838,7 +839,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index a2c82dd5..e1859d62 100644 --- a/docs/index.html +++ b/docs/index.html @@ -59,6 +59,10 @@ Core Module - Gui + ExpStyle + Core Module - ExpStyle + + Permissions-Groups Core Module - Permission Groups - Permission group making for factorio so you never have to make one by hand again @@ -514,7 +518,7 @@ see ./expcore/commands.lua for more details generated by LDoc diff --git a/docs/modules/ExpStyle.html b/docs/modules/ExpStyle.html new file mode 100644 index 00000000..fede875a --- /dev/null +++ b/docs/modules/ExpStyle.html @@ -0,0 +1,1343 @@ + + + + + + + + ExpStyle module + + + + + + + +
    +
    + + + + + + + +
    + + + + + + + + +

    ExpStyle module

    +

    Core Module - ExpStyle

    +

    + + + + + + + + + + + + + +

    Dependencies

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    expcore.gui
    gui.concept.frame
    expcore.gui
    gui.concept.frame
    expcore.gui
    gui.concept.table
    expcore.gui
    gui.concept.table
    expcore.gui
    gui.concept.table
    gui.concept.scroll
    expcore.gui
    expcore.common
    expcore.gui
    gui.concept.table
    expcore.gui
    gui.concept.frame
    + + +

    Elements

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    containerA container frame that can be used to add a boader around your content
    data_labelA label pair which has a static label and a data label which can be changed
    footerA frame that acts as a footer to a section of content
    headerA frame that acts as a header to a section of content
    scroll_tableA table that is inside a vertical scroll area
    time_labelA label that show time in a nice, user friendly way
    toggle_buttonA button that will toggle its caption each time it is pressed
    unit_labelA label triplet which has a static label, a data label which can be changed, and a unit label
    + + +

    Functions

    + + + + + + + + +
    time_label:update_time(element, time)Updates the time that is on a label
    + + +
    + + +

    Dependencies

    +
    +
    +
    +
    + # + expcore.gui +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + gui.concept.frame +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + gui.concept.frame +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + gui.concept.table +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + gui.concept.table +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + gui.concept.table +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + gui.concept.scroll +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.common +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + gui.concept.table +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + gui.concept.frame +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +

    Elements

    +
    +
    +
    +
    + # + container +
    +
    +
    +
    + +

    A container frame that can be used to add a boader around your content

    +

    + + + + + + + + + + See also: + + + + + Usage: +
    -- Concept Structure
    +-- Root
    +--> [container] - the outer frame
    +-->> container - the content area
    +Gui.new_concept('container')
    + + +
    +
    +
    +
    + # + data_label +
    +
    +
    +
    + +

    A label pair which has a static label and a data label which can be changed

    +

    + + + + + + + + + + See also: + + + + + Usage: +
    -- Concept Structure
    +-- Root
    +--> [data_label] - the static label
    +--> [properties.data_name] - the data label which can be updated
    +Gui.new_concept('data_label')
    +:set_data_label_name('game_ticks')
    +:set_data_caption('0')
    +:set_data_format(function(concept,element,data,...)
    +    -- This is used with update_data_element and update_from_parent
    +    local caption = tostirng('data')
    +    local tooltip = 'This game has beeing running for: '..caption..' ticks'
    +    return caption, tooltip
    +end)
    + + +
    +
    +
    +
    + # + footer +
    +
    +
    +
    + +

    A frame that acts as a footer to a section of content

    +

    + + + Properties / Events: + +
      + + + + + +
    • + + tooltip + + : + + (string) + + the tooltip to show on the title + +
    • + + +
    + + + + + + + + + See also: + + + + + Usage: +
    -- Concept Structure
    +-- Root
    +--> [footer] - the footer frame
    +-->> footer_caption - the lable with the title in it
    +-->> footer_content - the area to contain butons
    +Gui.new_concept('footer')
    +:set_title('Example Footer')
    + + +
    +
    +
    +
    + # + header +
    +
    +
    +
    + +

    A frame that acts as a header to a section of content

    +

    + + + Properties / Events: + +
      + + + + + +
    • + + tooltip + + : + + (string) + + the tooltip to show on the title + +
    • + + +
    + + + + + + + + + See also: + + + + + Usage: +
    -- Concept Structure
    +-- Root
    +--> [header] - the header frame
    +-->> header_caption - the lable with the title in it
    +-->> header_content - the area to contain butons
    +Gui.new_concept('header')
    +:set_title('Example Header')
    + + +
    +
    +
    +
    + # + scroll_table +
    +
    +
    +
    + +

    A table that is inside a vertical scroll area

    +

    + + + Properties / Events: + +
      + + + + + +
    • + + hight + + : + + (number) + + the max hight of the scroll area + +
    • + + +
    + + + + + + + + + See also: + + + + + Usage: +
    -- Concept Structure
    +-- Root
    +--> [scroll_table] - the scroll area
    +-->> table - the table area
    +Gui.new_concept('scroll_table')
    +:set_height(200)
    +:set_column_count(2)
    + + +
    +
    +
    +
    + # + time_label +
    +
    +
    +
    + +

    A label that show time in a nice, user friendly way

    +

    + + + Properties / Events: + +
      + + + + + +
    • + + time + + : + + (number) + + the time to display in tick + +
    • + + +
    + + + + + + + + + + + + Usage: +
    -- Concept Structure
    +-- Root
    +--> [time_label] - the label with the time
    +local time_label =
    +Gui.new_concept('time_label')
    +:set_use_hours(true)
    +:set_time(game.tick)
    +
    +time_label:update_time(element,game.tick)
    + + +
    +
    +
    +
    + # + toggle_button +
    +
    +
    +
    + +

    A button that will toggle its caption each time it is pressed

    +

    + + + Properties / Events: + +
      + + + + + +
    • + + alt_caption + + : + + (string) + + the caption to show on the button in its true state + +
    • + + + + + +
    • + + alt_tooltip + + : + + (string) + + the tooltip to show on the button in its true state + +
    • + + +
    + + + + + + + + + See also: + + + + + Usage: +
    -- Concept Structure
    +-- Root
    +--> [toggle_button] - the header button
    +Gui.new_concept('toggle_button')
    +:set_caption('<')
    +:set_tooltip('Press to close.')
    +:set_alt_caption('>')
    +:set_alt_tooltip('Press to open.')
    +:on_click(function(event)
    +    local state = event.state and 'close' or 'open'
    +    event.player.print('Toggle button is now: '..state)
    +end)
    + + +
    +
    +
    +
    + # + unit_label +
    +
    +
    +
    + +

    A label triplet which has a static label, a data label which can be changed, and a unit label

    +

    + + + + + + + + + + See also: + + + + + Usage: +
    -- Concept Structure
    +-- Root
    +--> [unit_label] - the static label
    +--> [properties.data_name] - the data label which can be updated
    +--> [properties.data_name..'_unit'] - the data label unit which can be updated
    +Gui.new_concept('unit_label')
    +:set_data_label_name('game_ticks')
    +:set_data_caption('0')
    +:set_data_unit('ticks')
    +:set_data_format(function(concept,element,data,...)
    +    -- This is used with update_data_element and update_from_parent
    +    local caption = tostirng(data)
    +    local unit = data > 1 and 'ticks' or 'tick'
    +    local tooltip = 'This game has beeing running for: '..caption..' ticks'
    +    return caption, unit, tooltip
    +end)
    + + +
    +
    +

    Functions

    +
    +
    +
    +
    + # + time_label:update_time(element, time) +
    +
    +
    +
    + +

    Updates the time that is on a label

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the label that you want to update + +
    • + + + + + +
    • + + time + + : + + (number) + + the number of tick you want it to show + +
    • + + +
    + + + + + + + + + + + + Usage: +
    -- Update the time to show game time
    +time_label:update_time(element,game.time)
    + + +
    +
    + + + +
    +
    +
    + + + + diff --git a/docs/modules/control.html b/docs/modules/control.html index 4fb5d84e..96f093f1 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -72,6 +72,7 @@ + @@ -352,7 +353,7 @@ generated by LDoc diff --git a/docs/modules/tesrt.html b/docs/modules/tesrt.html new file mode 100644 index 00000000..52c8b244 --- /dev/null +++ b/docs/modules/tesrt.html @@ -0,0 +1,386 @@ + + + + + + + + tesrt module + + + + + + + +
    +
    + + + + + + + +
    + + + + + + + + +

    tesrt module

    +

    Core Module - ExpStyle

    +

    + + + + + + + + + + + + + +

    Dependencies

    + + + + + + + + + + +
    expcore.gui
    gui.concept.flow
    + + +

    Elements

    + + + + + + + + +
    alignmentA flow which can be used to align text and other elements
    + + +
    + + +

    Dependencies

    +
    +
    +
    +
    + # + expcore.gui +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + gui.concept.flow +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +

    Elements

    +
    +
    +
    +
    + # + alignment +
    +
    +
    +
    + +

    A flow which can be used to align text and other elements

    +

    + + + + + + + + + + See also: + + + + + Usage: +
    -- Concept Structure
    +-- Root
    +--> [alignment] - the alignment area
    +Gui.new_concept('alignment')
    +:set_horizontal_align('center')
    + + +
    +
    + + + +
    +
    +
    + + + + diff --git a/docs/modules/utils.alien_evolution_progress.html b/docs/modules/utils.alien_evolution_progress.html index de092da3..d8b98af4 100644 --- a/docs/modules/utils.alien_evolution_progress.html +++ b/docs/modules/utils.alien_evolution_progress.html @@ -73,6 +73,7 @@ + @@ -420,7 +421,7 @@ fraction will decide a chance to spawn. 1 alien for 2 spawner's will have 50% on generated by LDoc diff --git a/docs/modules/utils.core.html b/docs/modules/utils.core.html index 7087a571..8d316e12 100644 --- a/docs/modules/utils.core.html +++ b/docs/modules/utils.core.html @@ -74,6 +74,7 @@ + @@ -1165,7 +1166,7 @@ generated by LDoc diff --git a/docs/modules/utils.debug.html b/docs/modules/utils.debug.html index 1d9e7fdc..40c5610d 100644 --- a/docs/modules/utils.debug.html +++ b/docs/modules/utils.debug.html @@ -72,6 +72,7 @@ + @@ -655,7 +656,7 @@ generated by LDoc diff --git a/docs/modules/utils.dump_env.html b/docs/modules/utils.dump_env.html index c4da3636..02727b03 100644 --- a/docs/modules/utils.dump_env.html +++ b/docs/modules/utils.dump_env.html @@ -72,6 +72,7 @@ + @@ -324,7 +325,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index bc1f5698..dfa11db4 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -73,6 +73,7 @@ + @@ -1293,7 +1294,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index b53537ea..38eff51c 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -72,6 +72,7 @@ + @@ -435,7 +436,7 @@ generated by LDoc diff --git a/docs/modules/utils.math.html b/docs/modules/utils.math.html index b74b9490..da148586 100644 --- a/docs/modules/utils.math.html +++ b/docs/modules/utils.math.html @@ -72,6 +72,7 @@ + @@ -354,7 +355,7 @@ generated by LDoc diff --git a/docs/modules/utils.recipe_locker.html b/docs/modules/utils.recipe_locker.html index 59449178..e422551c 100644 --- a/docs/modules/utils.recipe_locker.html +++ b/docs/modules/utils.recipe_locker.html @@ -73,6 +73,7 @@ + @@ -442,7 +443,7 @@ generated by LDoc diff --git a/docs/modules/utils.state_machine.html b/docs/modules/utils.state_machine.html index 9a60f448..daa620a5 100644 --- a/docs/modules/utils.state_machine.html +++ b/docs/modules/utils.state_machine.html @@ -73,6 +73,7 @@ + @@ -753,7 +754,7 @@ generated by LDoc diff --git a/docs/modules/utils.table.html b/docs/modules/utils.table.html index eaec6291..b90becff 100644 --- a/docs/modules/utils.table.html +++ b/docs/modules/utils.table.html @@ -74,6 +74,7 @@ + @@ -1419,7 +1420,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index e853536f..db13570d 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -73,6 +73,7 @@ + @@ -652,7 +653,7 @@ generated by LDoc diff --git a/docs/modules/utils.timestamp.html b/docs/modules/utils.timestamp.html index 97e2409e..ef9b3b28 100644 --- a/docs/modules/utils.timestamp.html +++ b/docs/modules/utils.timestamp.html @@ -72,6 +72,7 @@ + @@ -443,7 +444,7 @@ generated by LDoc diff --git a/docs/topics/license.html b/docs/topics/license.html index 219ecba4..2268d7de 100644 --- a/docs/topics/license.html +++ b/docs/topics/license.html @@ -53,6 +53,7 @@ + @@ -790,7 +791,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/readme.md.html b/docs/topics/readme.md.html index 24b2d167..b5eed503 100644 --- a/docs/topics/readme.md.html +++ b/docs/topics/readme.md.html @@ -53,6 +53,7 @@ + @@ -334,7 +335,7 @@ generated by LDoc diff --git a/expcore/gui/core.lua b/expcore/gui/core.lua index 5365d54a..23b13a5b 100644 --- a/expcore/gui/core.lua +++ b/expcore/gui/core.lua @@ -139,6 +139,45 @@ function Gui.destroy(element) return false end +--[[-- Finds and returns a gui element if it is valid from a long chain of element names or concepts +@tparam LuaGuiElement element the root element to start checking from +@tparam ?string|table ... element names or element concepts that point to your element +@treturn[1] boolean if the element was found, failed +@treturn[1] string the path of the element that the search stoped at +@treturn[2] boolean if the element was found, found +@treturn[2] LuaGuiElement the element that was found +@usage-- Getting the center gui +local exists, center = Gui.find(player,'gui','center') +]] +function Gui.find(element,...) + local path = tostring(element.name) + for _,next_element_name in pairs{...} do + if type(next_element_name) == 'table' then + next_element_name = next_element_name.name + end + + element = element[next_element_name] + path = path..'.'..tostring(next_element_name) + if not Gui.valid(element) then + return false, path + end + end + return true, element +end + +--[[-- Checks if a gui element exists or not, returns it if found else the path where it failed +@see Gui.find +@tparam LuaGuiElement element the root element to start checking from +@tparam ?string|table ... element names or element concepts that point to your element +@treturn[1] boolean if the element was found, failed +@treturn[1] string the path of the element that the search stoped at +@treturn[2] boolean if the element was found, found +@treturn[2] LuaGuiElement the element that was found +@usage-- Getting the center gui +local exists, center = Gui.exists(player,'gui','center') +]] +Gui.exists = Gui.find + --[[-- Toggles the enabled state of an element @tparam LuaGuiElement element the element that you want to toggle the enabled state of @treturn boolean the new enabled state of the element diff --git a/expcore/gui/styles/expstyle/alignment.lua b/expcore/gui/styles/expstyle/alignment.lua index 23477684..80c44f8a 100644 --- a/expcore/gui/styles/expstyle/alignment.lua +++ b/expcore/gui/styles/expstyle/alignment.lua @@ -1,13 +1,14 @@ --[[-- Core Module - ExpStyle - @module ExpStyle + @core ExpStyle + @alias expstyle ]] -local Gui = require 'expcore.gui' --- @dep expcore.gui +local Gui = require 'expcore.gui' -- @dep expcore.gui -Gui.require_concept 'flow' --- @dep gui.concept.flow +Gui.require_concept 'flow' -- @dep gui.concept.flow --[[-- A flow which can be used to align text and other elements -@see flow +@see Gui.flow @element alignment @usage-- Concept Structure -- Root diff --git a/expcore/gui/styles/expstyle/container.lua b/expcore/gui/styles/expstyle/container.lua index ca1a62bb..00ac52ac 100644 --- a/expcore/gui/styles/expstyle/container.lua +++ b/expcore/gui/styles/expstyle/container.lua @@ -2,12 +2,12 @@ @module ExpStyle ]] -local Gui = require 'expcore.gui' --- @dep expcore.gui +local Gui = require 'expcore.gui' -- @dep expcore.gui -Gui.require_concept 'frame' --- @dep gui.concept.frame +Gui.require_concept 'frame' -- @dep gui.concept.frame --[[-- A container frame that can be used to add a boader around your content -@see frame +@see Gui.frame @element container @usage-- Concept Structure -- Root diff --git a/expcore/gui/styles/expstyle/data_label.lua b/expcore/gui/styles/expstyle/data_label.lua index c6ca002c..62c39e73 100644 --- a/expcore/gui/styles/expstyle/data_label.lua +++ b/expcore/gui/styles/expstyle/data_label.lua @@ -2,15 +2,15 @@ @module ExpStyle ]] -local Gui = require 'expcore.gui' --- @dep expcore.gui +local Gui = require 'expcore.gui' -- @dep expcore.gui -Gui.require_concept 'label' --- @dep gui.concept.frame +Gui.require_concept 'label' -- @dep gui.concept.frame local right_align = Gui.new_concept('alignment') --[[-- A label pair which has a static label and a data label which can be changed -@see label +@see Gui.label @element data_label @usage-- Concept Structure -- Root @@ -64,6 +64,12 @@ end) return data_label_element end) +--[[-- Updates the caption and tooltip of the data label using the data format function +@tparam LuaGuiElement element the data label element that you want to update +@tparam any data the data that you want to pass to the format function +@usage-- Updating the data to the current game tick +data_label:update_data_element(element,game.tick) +]] function data_label:update_data_element(element,data,...) local caption, tooltip = self.properties.data_format(self,element,data,...) if caption then @@ -74,6 +80,12 @@ function data_label:update_data_element(element,data,...) end end +--[[-- Updates the caption and tooltip of the data label using the data format function, given the parent of the data label +@tparam LuaGuiElement parent the parent element to the data label element that you want to update +@tparam any data the data that you want to pass to the format function +@usage-- Updating the data to the current game tick +data_label:update_from_parent(parent,game.tick) +]] function data_label:update_from_parent(parent,data,...) local properties = self.properties local data_name = properties.data_label_name or properties.name..'_data' diff --git a/expcore/gui/styles/expstyle/footer.lua b/expcore/gui/styles/expstyle/footer.lua index 3497832b..2ca0a762 100644 --- a/expcore/gui/styles/expstyle/footer.lua +++ b/expcore/gui/styles/expstyle/footer.lua @@ -2,15 +2,15 @@ @module ExpStyle ]] -local Gui = require 'expcore.gui' --- @dep expcore.gui +local Gui = require 'expcore.gui' -- @dep expcore.gui -Gui.require_concept 'frame' --- @dep gui.concept.table +Gui.require_concept 'frame' -- @dep gui.concept.table local right_align = Gui.new_concept('alignment') --[[-- A frame that acts as a footer to a section of content -@see frame +@see Gui.frame @element footer @tparam string tooltip the tooltip to show on the title @usage-- Concept Structure diff --git a/expcore/gui/styles/expstyle/header.lua b/expcore/gui/styles/expstyle/header.lua index 94991865..f570442e 100644 --- a/expcore/gui/styles/expstyle/header.lua +++ b/expcore/gui/styles/expstyle/header.lua @@ -2,15 +2,15 @@ @module ExpStyle ]] -local Gui = require 'expcore.gui' --- @dep expcore.gui +local Gui = require 'expcore.gui' -- @dep expcore.gui -Gui.require_concept 'frame' --- @dep gui.concept.table +Gui.require_concept 'frame' -- @dep gui.concept.table local right_align = Gui.new_concept('alignment') --[[-- A frame that acts as a header to a section of content -@see frame +@see Gui.frame @element header @tparam string tooltip the tooltip to show on the title @usage-- Concept Structure diff --git a/expcore/gui/styles/expstyle/index.lua b/expcore/gui/styles/expstyle/index.lua index aa8afa39..6d773cfb 100644 --- a/expcore/gui/styles/expstyle/index.lua +++ b/expcore/gui/styles/expstyle/index.lua @@ -1,7 +1,18 @@ --[[-- Core Module - ExpStyle - @core ExpStyle + @module ExpStyle + @alias expstyle ]] +--- @dep expcore.gui + +--- @dep gui.concept.frame + +--- @dep gui.concept.flow + +--- @dep gui.concept.table + +--- @dep gui.concept.scroll + local function r(name) require('expcore.gui.styles.expstyle.'..name) end @@ -9,5 +20,9 @@ end r 'container' r 'alignment' r 'header' +r 'footer' r 'scroll_table' -r 'time_label' \ No newline at end of file +r 'time_label' +r 'data_label' +r 'unit_label' +r 'toggle_button' \ No newline at end of file diff --git a/expcore/gui/styles/expstyle/scroll_table.lua b/expcore/gui/styles/expstyle/scroll_table.lua index 411851b7..cd48ff0a 100644 --- a/expcore/gui/styles/expstyle/scroll_table.lua +++ b/expcore/gui/styles/expstyle/scroll_table.lua @@ -2,10 +2,10 @@ @module ExpStyle ]] -local Gui = require 'expcore.gui' --- @dep expcore.gui +local Gui = require 'expcore.gui' -- @dep expcore.gui -Gui.require_concept 'table' --- @dep gui.concept.table -Gui.require_concept 'scroll' --- @dep gui.concept.scroll +Gui.require_concept 'table' -- @dep gui.concept.table +Gui.require_concept 'scroll' -- @dep gui.concept.scroll local scroll_area = Gui.new_concept('scroll') @@ -13,7 +13,7 @@ Gui.new_concept('scroll') :set_horizontal_scroll('never') --[[-- A table that is inside a vertical scroll area -@see table +@see Gui.table @element scroll_table @tparam number hight the max hight of the scroll area @usage-- Concept Structure diff --git a/expcore/gui/styles/expstyle/time_label.lua b/expcore/gui/styles/expstyle/time_label.lua index 64f5f6b7..3fc4b004 100644 --- a/expcore/gui/styles/expstyle/time_label.lua +++ b/expcore/gui/styles/expstyle/time_label.lua @@ -2,7 +2,7 @@ @module ExpStyle ]] -local Gui = require 'expcore.gui' --- @dep expcore.gui +local Gui = require 'expcore.gui' -- @dep expcore.gui local format_time = ext_require('expcore.common','format_time') --- @dep expcore.common --- Converts a tick into string format with workds and symbols diff --git a/expcore/gui/styles/expstyle/toggle_button.lua b/expcore/gui/styles/expstyle/toggle_button.lua index 06adc602..00a894c5 100644 --- a/expcore/gui/styles/expstyle/toggle_button.lua +++ b/expcore/gui/styles/expstyle/toggle_button.lua @@ -2,12 +2,12 @@ @module ExpStyle ]] -local Gui = require 'expcore.gui' --- @dep expcore.gui +local Gui = require 'expcore.gui' -- @dep expcore.gui -Gui.require_concept 'button' --- @dep gui.concept.table +Gui.require_concept 'button' -- @dep gui.concept.table --[[-- A button that will toggle its caption each time it is pressed -@see button +@see Gui.button @element toggle_button @tparam string alt_caption the caption to show on the button in its true state @tparam string alt_tooltip the tooltip to show on the button in its true state diff --git a/expcore/gui/styles/expstyle/unit_label.lua b/expcore/gui/styles/expstyle/unit_label.lua index 3295997a..50bdd4b5 100644 --- a/expcore/gui/styles/expstyle/unit_label.lua +++ b/expcore/gui/styles/expstyle/unit_label.lua @@ -2,15 +2,15 @@ @module ExpStyle ]] -local Gui = require 'expcore.gui' --- @dep expcore.gui +local Gui = require 'expcore.gui' -- @dep expcore.gui -Gui.require_concept 'label' --- @dep gui.concept.frame +Gui.require_concept 'label' -- @dep gui.concept.frame local right_align = Gui.new_concept('alignment') --[[-- A label triplet which has a static label, a data label which can be changed, and a unit label -@see label +@see Gui.label @see data_label @element unit_label @usage-- Concept Structure @@ -60,6 +60,12 @@ end) return element end) +--[[-- Updates the caption and tooltip and unit of the data label using the data format function +@tparam LuaGuiElement element the unit label element that you want to update +@tparam any data the data that you want to pass to the format function +@usage-- Updating the data to the current game tick +unit_label:update_data_element(element,game.tick) +]] function unit_label:update_data_element(element,data,...) local caption, unit, tooltip = self.properties.data_format(self,element,data,...) local unit_element = element.parent.parent[element.name..'_unit'] @@ -75,6 +81,12 @@ function unit_label:update_data_element(element,data,...) end end +--[[-- Updates the caption and tooltip and unit of the unit label using the data format function, given the parent of the unit label +@tparam LuaGuiElement parent the parent element to the unit label element that you want to update +@tparam any data the data that you want to pass to the format function +@usage-- Updating the data to the current game tick +unit_label:update_from_parent(parent,game.tick) +]] function unit_label:update_from_parent(parent,data,...) local properties = self.properties local data_name = properties.data_label_name or properties.name..'_data'