diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index 3d4c3734..bd36c9e1 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -348,7 +348,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index 9cd4a94f..479610b9 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -349,7 +349,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index ebbfd73f..76c57702 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -376,7 +376,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 67b29137..a2c3181a 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -585,7 +585,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index 81e0c2e7..e0f4ca89 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -349,7 +349,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index c6cd6ad5..f20331ff 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 3faee111..bde7543f 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -460,7 +460,7 @@ generated by LDoc diff --git a/docs/addons/Player-Colours.html b/docs/addons/Player-Colours.html index b9e1c3ab..a30f16fb 100644 --- a/docs/addons/Player-Colours.html +++ b/docs/addons/Player-Colours.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index 47bcd776..a97f5329 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -320,7 +320,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index 76b4b241..043de6a1 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index b1e70e46..9bdb2207 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -376,7 +376,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index 5b548d8e..290d196a 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -388,7 +388,7 @@ generated by LDoc diff --git a/docs/commands/Bonus.html b/docs/commands/Bonus.html index 989cd718..64f67823 100644 --- a/docs/commands/Bonus.html +++ b/docs/commands/Bonus.html @@ -500,7 +500,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index d5b4d67d..2e5d4d77 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -361,7 +361,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index c5bbd056..aa7e882e 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -388,7 +388,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index fa9b156c..8957b0bc 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index b2f3c1b6..47e49267 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -360,7 +360,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index 6e926e3a..ed4208d0 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 94912d71..e08e5ea5 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -458,7 +458,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index 664677d5..f5c672f5 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -416,7 +416,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index 2d9bf3d2..2b88c16f 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -611,7 +611,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 0593ed7b..5ade1288 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index 4cb2155b..a396bdd9 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -360,7 +360,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index 1c98f116..78b3a6ab 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -388,7 +388,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 3c64fe5c..ae84d625 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -321,7 +321,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index c99884e7..b161ceac 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -585,7 +585,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index 6fcce0c6..255aa570 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -557,7 +557,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index 57ccc41a..a368c0b5 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/commands/Tag.html b/docs/commands/Tag.html index b84c0861..165ffd2a 100644 --- a/docs/commands/Tag.html +++ b/docs/commands/Tag.html @@ -443,7 +443,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index 3a5a47eb..61c9bce6 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -484,7 +484,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index 7ca3110c..db4a29aa 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -569,7 +569,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index 37bffff8..b9c394c4 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -506,7 +506,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index ee42480a..66a28a9f 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -237,7 +237,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index 9028f366..25085c59 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -485,7 +485,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index 963ddbe0..84bb6c48 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -294,7 +294,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index e38df53c..e50c4466 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -320,7 +320,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 0ed24222..147b5499 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -442,7 +442,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index e39ebf73..379dd604 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 1011011c..12051041 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -338,7 +338,7 @@ see ./expcore/commands.lua for more details

generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index 9f8ce2fa..17533a11 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index a449f6d1..a77eddd3 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -416,7 +416,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index 91e5d9e8..1b262704 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -237,7 +237,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index de492fac..56af4b90 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -240,7 +240,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index 1218f72a..7a1cde25 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -295,7 +295,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index b26e51d7..62676d41 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -812,7 +812,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index eb69b09a..857acf8e 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -384,7 +384,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index 3f2d93b2..806575da 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -414,7 +414,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index 3ea83a45..81761726 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -324,7 +324,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index f0def66d..918196b3 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -414,7 +414,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 16cca0e3..360875bd 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -834,7 +834,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index 34a42438..16206a78 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -292,7 +292,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index 8cadcfc0..140a3c6c 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 703ee5b6..e07eac6f 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -388,7 +388,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index 30ec85a5..ba44a6bf 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -744,7 +744,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index d318130f..8eb4fc0a 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -384,7 +384,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index 68d59a5a..9e4a11b2 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -355,7 +355,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index e86fbb96..ca467866 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -684,7 +684,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index 9bcebaa0..067ebc0d 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1208,7 +1208,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 3cbacd64..9545db59 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -1329,7 +1329,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index ecd87fb0..0b8e6efc 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -1110,7 +1110,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index 89000802..4b3c9f31 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -984,7 +984,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index 75165013..d484ec72 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -1039,7 +1039,7 @@ generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index e7e3d72d..bb21eb87 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -1465,7 +1465,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index 4505c21e..3d7f786d 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1413,7 +1413,7 @@ generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index fc6c5e2d..7bfe081a 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -1972,7 +1972,7 @@ generated by LDoc diff --git a/docs/core/Common-Library.html b/docs/core/Common-Library.html index 448be51d..bff67067 100644 --- a/docs/core/Common-Library.html +++ b/docs/core/Common-Library.html @@ -2680,7 +2680,7 @@ Common.table_insert(tbl,50,tbl2) generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index 9d24b6c7..66b0e63d 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -331,6 +331,10 @@ button:clone('CustomButton') The basic dropdown element + elem_button + The basic dropdown element + + frame The basic frame element @@ -864,9 +868,9 @@ Gui.clone_concept('checkbox','b : - (string or Conepts.LocalisedString) + (string, LocalisedString or function) - the option which is selected by default + the option which is selected by default, or a function which returns the default @@ -945,11 +949,9 @@ Gui.clone_concept('dropdown','s Gui.clone_concept('dropdown','dynamic_dropdown') :set_dynamic_items(function(element) local items = {} - for _,player in pairs(game.connected_players) do items[#items+1] = player.name end - return items end) :on_selection_change(function(event) @@ -958,6 +960,94 @@ Gui.clone_concept('dropdown','d end) + +
+
+
+ # + elem_button +
+
+
+
+ +

The basic dropdown element

+

+ + + Properties / Events: + +
    + + + + + +
  • + + on_selection_change + + : + + + fired when the selected value is changed + +
  • + + + + + +
  • + + default_selection + + : + + (string, SignalID or function) + + the option which is selected by default, or a function which returns the default + +
  • + + + + + +
  • + + elem_type + + : + + (string) + + the type of elem selection that this is, default is item selection + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Making a basic elem button
+local basic_elem_button =
+Gui.clone_concept('elem_button',TEST 'basic_elembutton')
+:on_selection_change(function(event)
+    event.player.print('Basic elem button is now: '..event.element.elem_value)
+end)
+ +
@@ -1067,7 +1157,7 @@ Gui.clone_concept('dropdown','b : - (string or Conepts.LocalisedString) + (string or LocalisedString) the value that you want selected @@ -1142,7 +1232,7 @@ Gui.clone_concept('dropdown','b Returns: @@ -3796,7 +3886,7 @@ Gui.get_concept('CustomButton') generated by LDoc diff --git a/docs/core/Permissions-Groups.html b/docs/core/Permissions-Groups.html index 352e04a9..effd0630 100644 --- a/docs/core/Permissions-Groups.html +++ b/docs/core/Permissions-Groups.html @@ -1432,7 +1432,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index 24b1abfe..5827dcf1 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -3152,7 +3152,7 @@ generated by LDoc diff --git a/docs/core/Store.html b/docs/core/Store.html index 54d14e4c..42eb1aed 100644 --- a/docs/core/Store.html +++ b/docs/core/Store.html @@ -1145,7 +1145,7 @@ Store.register(team_scores,function(value,key) generated by LDoc diff --git a/docs/core/Sudo.html b/docs/core/Sudo.html index 0db70797..53ff468c 100644 --- a/docs/core/Sudo.html +++ b/docs/core/Sudo.html @@ -544,7 +544,7 @@ generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 11b66c26..54e5156c 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -626,7 +626,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index 04d9371f..4d20398c 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -629,7 +629,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index e91df5cc..f2e103f9 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -449,7 +449,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index 92239b49..172a8c6d 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -632,7 +632,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index 93c944d7..b97332f0 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -837,7 +837,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index d100c277..acabe123 100644 --- a/docs/index.html +++ b/docs/index.html @@ -510,7 +510,7 @@ see ./expcore/commands.lua for more details generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index e8471167..5aff8205 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -351,7 +351,7 @@ generated by LDoc diff --git a/docs/modules/utils.alien_evolution_progress.html b/docs/modules/utils.alien_evolution_progress.html index 7d715e83..4dd24a85 100644 --- a/docs/modules/utils.alien_evolution_progress.html +++ b/docs/modules/utils.alien_evolution_progress.html @@ -419,7 +419,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 b2ee81b5..de6f9d77 100644 --- a/docs/modules/utils.core.html +++ b/docs/modules/utils.core.html @@ -1164,7 +1164,7 @@ generated by LDoc diff --git a/docs/modules/utils.debug.html b/docs/modules/utils.debug.html index 27a4a673..6ff655be 100644 --- a/docs/modules/utils.debug.html +++ b/docs/modules/utils.debug.html @@ -654,7 +654,7 @@ generated by LDoc diff --git a/docs/modules/utils.dump_env.html b/docs/modules/utils.dump_env.html index 9e53d53d..ad4d89c4 100644 --- a/docs/modules/utils.dump_env.html +++ b/docs/modules/utils.dump_env.html @@ -323,7 +323,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index 75e4d32d..97b00a74 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -1292,7 +1292,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index 58d5a991..ab5335ee 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -434,7 +434,7 @@ generated by LDoc diff --git a/docs/modules/utils.math.html b/docs/modules/utils.math.html index 5a3a0ade..ed30683c 100644 --- a/docs/modules/utils.math.html +++ b/docs/modules/utils.math.html @@ -338,7 +338,7 @@ generated by LDoc diff --git a/docs/modules/utils.recipe_locker.html b/docs/modules/utils.recipe_locker.html index ff689105..a94f5916 100644 --- a/docs/modules/utils.recipe_locker.html +++ b/docs/modules/utils.recipe_locker.html @@ -441,7 +441,7 @@ generated by LDoc diff --git a/docs/modules/utils.state_machine.html b/docs/modules/utils.state_machine.html index eaa58bd4..2d3c8396 100644 --- a/docs/modules/utils.state_machine.html +++ b/docs/modules/utils.state_machine.html @@ -752,7 +752,7 @@ generated by LDoc diff --git a/docs/modules/utils.table.html b/docs/modules/utils.table.html index 7fe9c053..d548fc6f 100644 --- a/docs/modules/utils.table.html +++ b/docs/modules/utils.table.html @@ -1382,7 +1382,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index 56d53890..b467f3f1 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -651,7 +651,7 @@ generated by LDoc diff --git a/docs/modules/utils.timestamp.html b/docs/modules/utils.timestamp.html index 04820ce8..77d371b1 100644 --- a/docs/modules/utils.timestamp.html +++ b/docs/modules/utils.timestamp.html @@ -442,7 +442,7 @@ generated by LDoc diff --git a/docs/topics/license.html b/docs/topics/license.html index de3e1c46..e260d7f0 100644 --- a/docs/topics/license.html +++ b/docs/topics/license.html @@ -789,7 +789,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 62cf868e..4e38c52a 100644 --- a/docs/topics/readme.md.html +++ b/docs/topics/readme.md.html @@ -332,7 +332,7 @@ generated by LDoc diff --git a/expcore/gui.lua b/expcore/gui.lua index 4777854e..d066a2dc 100644 --- a/expcore/gui.lua +++ b/expcore/gui.lua @@ -71,5 +71,6 @@ Gui.require_concept('frame') Gui.require_concept('button') Gui.require_concept('checkbox') Gui.require_concept('dropdown') +Gui.require_concept('elem_button') return Gui \ No newline at end of file diff --git a/expcore/gui/concepts/dropdown.lua b/expcore/gui/concepts/dropdown.lua index 9fe0f59d..ee3f8346 100644 --- a/expcore/gui/concepts/dropdown.lua +++ b/expcore/gui/concepts/dropdown.lua @@ -9,7 +9,7 @@ local array_insert = ext_require('expcore.common','array_insert') --[[-- The basic dropdown element @element dropdown @param on_selection_change fired when the selected value is changed -@tparam ?string|Conepts.LocalisedString default_selection the option which is selected by default +@tparam ?string|Concepts.LocalisedString|function default_selection the option which is selected by default, or a function which returns the default @tparam boolean use_list_box when true a list box will be used rather than a dropdown menu @tparam ?nil|table static_items when called with a table the values will be added as items for the dropdown, if called with nil then all items are cleared @tparam function dynamic_items the given function will be called to return a list of items and optional start index to add items to the dropdown when it is first drawn @@ -26,11 +26,9 @@ local dynamic_dropdown = Gui.clone_concept('dropdown','dynamic_dropdown') :set_dynamic_items(function(element) local items = {} - for _,player in pairs(game.connected_players) do items[#items+1] = player.name end - return items end) :on_selection_change(function(event) @@ -107,7 +105,7 @@ end) --[[-- Selects the index of a dropdown with this value @tparam LuaGuiElement element the dropdown that you want to set the selection for -@tparam ?string|Conepts.LocalisedString value the value that you want selected +@tparam ?string|Concepts.LocalisedString value the value that you want selected @treturn boolean if an item with this value was found @usage-- Selecting the item with the value 'foo' Gui.set_dropdown_value(element,'foo') @@ -124,7 +122,7 @@ end --[[-- Gets the selected item value of a dropdown @tparam LuaGuiElement element the dropdown that you want the selected value of -@treturn ?string|Conepts.LocalisedString the value that is currently selected +@treturn ?string|Concepts.LocalisedString the value that is currently selected @usage-- Getting the selected value local selected_value = Gui.get_dropdown_value(element) ]] diff --git a/expcore/gui/concepts/elem_button.lua b/expcore/gui/concepts/elem_button.lua new file mode 100644 index 00000000..ec8b09ef --- /dev/null +++ b/expcore/gui/concepts/elem_button.lua @@ -0,0 +1,49 @@ +--[[-- Core Module - Gui + @module Gui + @alias Gui +]] + +local Gui = require 'expcore.gui.core' + +--[[-- The basic dropdown element +@element elem_button +@param on_selection_change fired when the selected value is changed +@tparam ?string|Concepts.SignalID|function default_selection the option which is selected by default, or a function which returns the default +@tparam string elem_type the type of elem selection that this is, default is item selection +@usage-- Making a basic elem button +local basic_elem_button = +Gui.clone_concept('elem_button',TEST 'basic_elembutton') +:on_selection_change(function(event) + event.player.print('Basic elem button is now: '..event.element.elem_value) +end) +]] +Gui.new_concept('elem_button') +:new_event('on_selection_change',defines.events.on_gui_elem_changed) +:new_property('default_selection') +:new_property('elem_type','item') +:define_draw(function(properties,parent,element,selection) + element = parent.add{ + name = properties.name, + type = 'choose-elem-button', + elem_type = properties.elem_type + } + + if properties.default_selection and not selection then + local default = properties.default_selection + if type(default) == 'function' then + default = default(element) + end + + element.elem_value = default + + elseif selection then + if type(selection) == 'function' then + selection = selection(element) + end + + element.elem_value = selection + + end + + return element +end) \ No newline at end of file diff --git a/expcore/gui/test.lua b/expcore/gui/test.lua index b1f0aa25..c853f709 100644 --- a/expcore/gui/test.lua +++ b/expcore/gui/test.lua @@ -278,4 +278,79 @@ tests.Dropdowns = { ['Dynamic Dropdown'] = dynamic_dropdown, ['Static Player Stored Dropdown'] = static_player_dropdown, ['Dynamic Player Stored Dropdown'] = dynamic_player_dropdown +} + +--[[ +Listboxs +> Static Listbox -- Simple Listbox with all options being static +> Static Player Stored Listbox -- Listbox where the values is synced for each player +]] + +local static_listbox = +Gui.clone_concept('dropdown',TEST 'static_listbox') +:set_use_list_box(true) +:set_static_items{'Option 1','Option 2','Option 3'} +:on_selection_change(function(event) + local value = Gui.get_dropdown_value(event.element) + event.player.print('Static listbox is now: '..value) +end) + +local static_player_listbox = +Gui.clone_concept('dropdown',TEST 'static_player_listbox') +:set_use_list_box(true) +:set_static_items{'Option 1','Option 2','Option 3'} +:on_selection_change(function(event) + local element = event.element + local value = Gui.get_dropdown_value(element) + event.concept.set_data(element,value) + event.player.print('Static player stored listbox is now: '..value) +end) +:define_combined_store(Gui.categorize_by_player,function(element,value) + Gui.set_dropdown_value(element,value) +end) + +tests.Listboxs = { + ['Static Listbox'] = static_listbox, + ['Static Player Stored Listbox'] = static_player_listbox +} + +--[[ +Elem Buttons +> Basic Elem Button -- Basic elem button +> Defaut Selection Elem Button -- Same as above but has a default selection +> Player Stored Elem Button -- Same as above but is stored per player +]] + +local basic_elem_button = +Gui.clone_concept('elem_button',TEST 'basic_elembutton') +:on_selection_change(function(event) + event.player.print('Basic elem button is now: '..event.element.elem_value) +end) + +local default_selection_elem_button = +Gui.clone_concept('elem_button',TEST 'default_selection_elem_button') +:set_elem_type('signal') +:set_default_selection{type='virtual',name='signal-info'} +:on_selection_change(function(event) + local value = event.element.elem_value + event.player.print('Default selection elem button is now: '..value.type..'/'..value.name) +end) + +local player_elem_button = +Gui.clone_concept('elem_button',TEST 'player_elem_button') +:set_elem_type('technology') +:on_selection_change(function(event) + local element = event.element + local value = element.elem_value + event.concept.set_data(element,value) + event.player.print('Player stored elem button is now: '..value) +end) +:define_combined_store(Gui.categorize_by_player,function(element,value) + element.elem_value = value +end) + +tests['Elem Buttons'] = { + ['Basic Elem Button'] = basic_elem_button, + ['Defaut Selection Elem Button'] = default_selection_elem_button, + ['Player Stored Elem Button'] = player_elem_button } \ No newline at end of file