diff --git a/modules/ExpGamingAdmin/Gui/control.lua b/modules/ExpGamingAdmin/Gui/control.lua index ffaf6286..6f6a158e 100644 --- a/modules/ExpGamingAdmin/Gui/control.lua +++ b/modules/ExpGamingAdmin/Gui/control.lua @@ -57,7 +57,7 @@ function AdminGui.draw(frame,filter_buttons) btn.style.width = 30 end for name,button in pairs(AdminGui.buttons) do - if not filter_buttons or filter_buttons[name] then format(button:draw(frame)) end + if not filter_buttons or filter_buttons[name] then format(button(frame)) end end return frame.player end @@ -113,7 +113,7 @@ local action_drop_down = Gui.inputs.add_drop_down('action-drop-down-rank-change' end end) -local take_action = Gui.inputs.add{ +local take_action = Gui.inputs{ type='button', name='admin-commands-take', caption={'ExpGamingAdmin.take-action'} @@ -131,7 +131,7 @@ local take_action = Gui.inputs.add{ Gui.center.clear(event) end) -Admin.center = Gui.center.add{ +Admin.center = Gui.center{ name='admin-commands', caption='utility/danger_icon', tooltip={'ExpGamingAdmin.tooltip'}, @@ -211,4 +211,5 @@ Admin.center = Gui.center.add{ } -- Module Return -return AdminGui \ No newline at end of file +-- calling will draw the admin buttons to that frame +return setmetatable(AdminGui,{__call=function(self,...) self.draw(...) end}) \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Reports/control.lua b/modules/ExpGamingAdmin/Reports/control.lua index 3b71a37a..4d07c7f9 100644 --- a/modules/ExpGamingAdmin/Reports/control.lua +++ b/modules/ExpGamingAdmin/Reports/control.lua @@ -121,7 +121,7 @@ function Admin.clear_reports(player,by_player,no_emit) end end -local confirm_report = Gui.inputs.add{ +local confirm_report = Gui.inputs{ type='button', name='admin-report-confirm', caption='utility/spawn_flag', @@ -134,7 +134,7 @@ local confirm_report = Gui.inputs.add{ Gui.center.clear(event.player_index) end) -Admin.report_btn = Gui.inputs.add{ +Admin.report_btn = Gui.inputs{ type='button', name='admin-report', caption='utility/spawn_flag', diff --git a/modules/ExpGamingCore/Gui/control.lua b/modules/ExpGamingCore/Gui/control.lua index 12b815a4..c902388e 100644 --- a/modules/ExpGamingCore/Gui/control.lua +++ b/modules/ExpGamingCore/Gui/control.lua @@ -8,7 +8,6 @@ local Game = require('FactorioStdLib.Game') local Color = require('FactorioStdLib.Color') local Gui = {} -local Gui_data = {} local global = global() --- Used to set and get data about different guis -- @usage Gui.data[location] -- returns the gui data for that gui location ex center @@ -143,13 +142,14 @@ script.on_event('on_tick', function(event) Gui.left.update() end if loaded_modules['ExpGamingCore.Server'] then return end + if global.cams and is_type(global.cams,'table') and #global.cams > 0 then local update = 4 if global.cam_index >= #global.cams then global.cam_index = 1 end if update > #global.cams then update = #global.cams end for cam_offset = 0,update do local _cam = global.cams[global.cam_index] - if not _cam then return end + if not _cam then break end if not _cam.cam.valid then table.remove(global.cams,global.cam_index) elseif not _cam.entity.valid then table.remove(global.cams,global.cam_index) else _cam.cam.position = _cam.entity.position if not _cam.surface then _cam.cam.surface_index = _cam.entity.surface.index end global.cam_index = global.cam_index+1 @@ -164,11 +164,11 @@ script.on_event('on_player_respawned',function(event) if global.players and is_type(global.players,'table') and #global.players > 0 and global.players[event.player_index] then local remove = {} for index,cam in pairs(global.players[event.player_index]) do - Gui.cam_link{cam=cam,entity=Game.get_player(event).character} - if not cam.valid then table.insert(remove,index) end + if cam.valid then table.insert(global.cams,{cam=cam,entity=player.character,surface=player.surface}) + else table.insert(remove,index) end end - for _,index in pairs(remove) do - table.remove(global.players[event.player_index],index) + for n,index in pairs(remove) do + table.remove(global.players[event.player_index],index-n+1) end end end) diff --git a/modules/ExpGamingCore/Gui/src/center.lua b/modules/ExpGamingCore/Gui/src/center.lua index 9b529a1b..ee423cc1 100644 --- a/modules/ExpGamingCore/Gui/src/center.lua +++ b/modules/ExpGamingCore/Gui/src/center.lua @@ -28,7 +28,7 @@ function center.add(obj) obj.tabs = {} obj._tabs = {} Gui.data('center',obj.name,obj) - Gui.toolbar.add(obj.name,obj.caption,obj.tooltip,obj.open) + Gui.toolbar(obj.name,obj.caption,obj.tooltip,obj.open) return obj end diff --git a/modules/ExpGamingCore/Gui/src/left.lua b/modules/ExpGamingCore/Gui/src/left.lua index 24d6ade6..ef574ec0 100644 --- a/modules/ExpGamingCore/Gui/src/left.lua +++ b/modules/ExpGamingCore/Gui/src/left.lua @@ -32,7 +32,7 @@ function left.add(obj) verbose('Created Left Gui: '..obj.name) setmetatable(obj,{__index=left._prototype,__call=function(self,player) if player then self:toggle{player=player,element={name=self.name}} else left.update(self.name) end end}) Gui.data('left',obj.name,obj) - Gui.toolbar.add(obj.name,obj.caption,obj.tooltip,obj.toggle) + Gui.toolbar(obj.name,obj.caption,obj.tooltip,obj.toggle) return obj end @@ -154,13 +154,13 @@ function left._prototype.toggle(event) elseif global.over_ride_left_can_open then if is_type(Role,'table') then if Role.allowed(player,_left.name) then open = true - else open = {gui.unauthorized} end + else open = {'ExpGamingCore_Gui.unauthorized'} end else open = true end else open = err end else if is_type(Role,'table') then if Role.allowed(player,_left.name) then open = true - else open = {gui.unauthorized} end + else open = {'ExpGamingCore_Gui.unauthorized'} end else open = true end end if open == true and left.style.visible ~= true then diff --git a/modules/ExpGamingCore/Gui/src/popup.lua b/modules/ExpGamingCore/Gui/src/popup.lua index 2d076b66..2f95de38 100644 --- a/modules/ExpGamingCore/Gui/src/popup.lua +++ b/modules/ExpGamingCore/Gui/src/popup.lua @@ -109,7 +109,7 @@ end function popup._prototype:add_left(obj) obj.name = obj.name or self.name - self.left = Gui.left.add(obj) + self.left = Gui.left(obj) end popup.on_player_joined_game = popup.flow diff --git a/modules/ExpGamingCore/Gui/src/server.lua b/modules/ExpGamingCore/Gui/src/server.lua index 1aa13be3..2df65c10 100644 --- a/modules/ExpGamingCore/Gui/src/server.lua +++ b/modules/ExpGamingCore/Gui/src/server.lua @@ -1,15 +1,8 @@ ---- Adds a objective version to custom guis. --- @submodule ExpGamingCore.Gui --- @alias Gui --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - ---- This file will be loaded when ExpGamingCore.Command is present +--- This file will be loaded when ExpGamingCore.Server is present -- @function _comment -local Game = require('FactorioStdLib.Game') -local Server = require('ExpGamingCore.Server') -local Gui = Gui -- this is to force gui to remain in the ENV +local Game = require('FactorioStdLib.Game@^0.8.0') +local Server = require('ExpGamingCore.Server@^4.0.0') --- Adds a server thread that allows the camera follows to be toggled off and on -- @function __comment diff --git a/modules/ExpGamingCore/Gui/src/test.lua b/modules/ExpGamingCore/Gui/src/test.lua index ab732366..54c91014 100644 --- a/modules/ExpGamingCore/Gui/src/test.lua +++ b/modules/ExpGamingCore/Gui/src/test.lua @@ -10,19 +10,19 @@ local Game = require('FactorioStdLib.Game@^0.8.0') local Gui = Gui -- this is to force gui to remain in the ENV local mod_gui = require("mod-gui") -local gui_tset_close = Gui.inputs.add{ +local gui_test_close = Gui.inputs{ name='gui-test-close', type='button', caption='Close Test Gui' }:on_event('click',function(event) event.element.parent.destroy() end) -local caption_test = Gui.inputs.add{ +local caption_test = Gui.inputs{ name='text-button', type='button', caption='Test' }:on_event('click',function(event) game.print('test') end) -local sprite_test = Gui.inputs.add{ +local sprite_test = Gui.inputs{ name='sprite-button', type='button', sprite='item/lab' @@ -109,24 +109,24 @@ local function test_gui(player) if not player then return end if mod_gui.get_frame_flow(player)['gui-test'] then mod_gui.get_frame_flow(player)['gui-test'].destroy() end local frame = mod_gui.get_frame_flow(player).add{type='frame',name='gui-test',direction='vertical'} - gui_tset_close:draw(frame) - caption_test:draw(frame) - sprite_test:draw(frame) - input_test:draw(frame) - elem_test:draw(frame) - check_test:draw(frame) - radio_test:draw(frame) - radio_test_reset:draw(frame) - text_test:draw(frame) - box_test:draw(frame) - slider_test:draw(frame) - drop_test:draw(frame) + gui_test_close(frame) + caption_test(frame) + sprite_test(frame) + input_test(frame) + elem_test(frame) + check_test(frame) + radio_test(frame) + radio_test_reset(frame) + text_test(frame) + box_test(frame) + slider_test(frame) + drop_test(frame) end Gui.toolbar.add('open-gui-test','Open Test Gui','Opens the test gui with every input',test_gui) -- testing the center gui -Gui.center.add{ +Gui.center{ name='test-center', caption='Gui Center', tooltip='Just a gui test' @@ -139,7 +139,7 @@ end):add_tab('tab-2','Tab 2','Just a tab',function(frame) end) -- testing the left gui -Gui.left.add{ +Gui.left{ name='test-left', caption='Gui Left', tooltip='just testing', @@ -154,7 +154,7 @@ Gui.left.add{ local text_popup = Gui.inputs.add_text('test-popup-text',true,'Message To Send',function(player,text,element) element.text = text end) -local send_popup = Gui.inputs.add{ +local send_popup = Gui.inputs{ type='button', name='test-popup-send', caption='Send Message' @@ -163,7 +163,7 @@ local send_popup = Gui.inputs.add{ local message = event.element.parent['test-popup-text'].text Gui.popup.open('test-popup',{player=player.name,message=message}) end) -Gui.popup.add{ +Gui.popup{ name='test-popup', caption='Gui Popup', draw=function(frame,data) diff --git a/modules/ExpGamingCore/Sync/src/gui.lua b/modules/ExpGamingCore/Sync/src/gui.lua index 995d3d90..f6758259 100644 --- a/modules/ExpGamingCore/Sync/src/gui.lua +++ b/modules/ExpGamingCore/Sync/src/gui.lua @@ -41,7 +41,7 @@ end --- Creates a center gui that will appear on join -- @gui server-info -Gui.center.add{ +Sync.info_gui = Gui.center{ name='server-info', caption='Server Info', tooltip='Basic info about the current server', @@ -101,5 +101,5 @@ end) script.on_event(defines.events.on_player_joined_game,function(event) local player = Game.get_player(event) - Gui.center.open(player,'server-info') + Sync.info_gui(player) end) \ No newline at end of file diff --git a/modules/ExpGamingInfo/Readme/control.lua b/modules/ExpGamingInfo/Readme/control.lua index fd07f15c..570c28a6 100644 --- a/modules/ExpGamingInfo/Readme/control.lua +++ b/modules/ExpGamingInfo/Readme/control.lua @@ -22,7 +22,7 @@ local function format_label(label) label.style.single_line = false end -Gui.center.add{ +ThisModule.Gui = Gui.center{ name='readme', caption='utility/questionmark', tooltip={'ExpGamingInfo-Readme.tooltip'} @@ -129,4 +129,5 @@ end):add_tab('rules',{'ExpGamingInfo-Readme.rules-name'},{'ExpGamingInfo-Readme. end) -- Module Return -return ThisModule \ No newline at end of file +-- when called will open readme for that user +return setmetatable(ThisModule,{__call=function(self,...) self.Gui(...) end}) \ No newline at end of file diff --git a/modules/ExpGamingInfo/Rockets/control.lua b/modules/ExpGamingInfo/Rockets/control.lua index d5b30197..deb2a72c 100644 --- a/modules/ExpGamingInfo/Rockets/control.lua +++ b/modules/ExpGamingInfo/Rockets/control.lua @@ -27,7 +27,7 @@ local global = global{ } -- Function Define -Gui.left.add{ +ThisModule.Gui = Gui.left{ name='rockets', caption='item/rocket-silo', tooltip={'ExpGamingInfo-Rockets.tooltip'}, @@ -100,4 +100,5 @@ Gui.left.add{ script.on_event(defines.events.on_rocket_launched,function(event) Gui.left.update('rockets') end) -- Module Return -return ThisModule \ No newline at end of file +-- when called will toggle the gui for that player, updates gui if no player given +return setmetatable(ThisModule,{__call=function(self,...) self.Gui(...) end}) \ No newline at end of file diff --git a/modules/ExpGamingInfo/Science/control.lua b/modules/ExpGamingInfo/Science/control.lua index 6ac22ad6..2cb431d1 100644 --- a/modules/ExpGamingInfo/Science/control.lua +++ b/modules/ExpGamingInfo/Science/control.lua @@ -38,7 +38,7 @@ local global = global{ } -- Function Define -Gui.left.add{ +ThisModule.Gui = Gui.left{ name='science', caption='item/lab', tooltip={'ExpGamingInfo-Science.tooltip'}, @@ -100,4 +100,5 @@ Gui.left.add{ script.on_event(defines.events.on_research_finished,function(event) Gui.left.update('science') end) -- Module Return -return ThisModule \ No newline at end of file +-- when called will toogle the gui for that player, if no player it will update the gui +return setmetatable(ThisModule,{_call=function(self,...) self.Gui(...) end}) \ No newline at end of file diff --git a/modules/ExpGamingInfo/Tasklist/control.lua b/modules/ExpGamingInfo/Tasklist/control.lua index 20972c63..de0c0e6f 100644 --- a/modules/ExpGamingInfo/Tasklist/control.lua +++ b/modules/ExpGamingInfo/Tasklist/control.lua @@ -25,7 +25,7 @@ local global = global{ } -- Function Define -local edit = Gui.inputs.add{ +local edit = Gui.inputs{ name='tasklist-edit', type='button', caption='utility/rename_icon_normal' @@ -45,7 +45,7 @@ local edit = Gui.inputs.add{ end) local function _edit(frame) - local element = edit:draw(frame) + local element = edit(frame) element.style.height = 20 element.style.width = 20 local text_flow = element.parent.parent.text_flow @@ -66,7 +66,7 @@ local function _edit(frame) end end -local remove = Gui.inputs.add{ +local remove = Gui.inputs{ name='tasklist-remove', type='button', caption='utility/remove' @@ -83,7 +83,7 @@ local remove = Gui.inputs.add{ Gui.left.update('tasklist',event.player_index) end) -local add = Gui.inputs.add{ +local add = Gui.inputs{ name='tasklist-add', type='button', caption='utility/add' @@ -126,7 +126,7 @@ local function _tasks(player) end end -Gui.left.add{ +ThisModule.Gui = Gui.left{ name='tasklist', caption='utility/not_enough_repair_packs_icon', tooltip={'ExpGamingInfo-Tasklist.tooltip'}, @@ -169,10 +169,10 @@ Gui.left.add{ if allowed then _edit(button_flow) if global._edit[player.index]._editing[i] then - local element = remove:draw(button_flow) + local element = remove(button_flow) element.style.height = 30 element.style.width = 30 - local _element = add:draw(button_flow) + local _element = add(button_flow) _element.style.height = 30 _element.style.width = 30 end @@ -188,7 +188,7 @@ Gui.left.add{ type='flow', direction='horizontal' } - local element = add:draw(button_flow) + local element = add(button_flow) element.style.height = 20 element.style.width = 20 end @@ -201,4 +201,6 @@ Gui.left.add{ open_on_join=true } -return ThisModule \ No newline at end of file +-- Module return +-- when called it will toggle the gui for that player, if no player then it will update the gui +return setmetatable(ThisModule,{__call=function(self,...) self.Gui(...) end}) \ No newline at end of file diff --git a/modules/ExpGamingPlayer/afkKick/control.lua b/modules/ExpGamingPlayer/afkKick/control.lua index dd2822b2..9920c957 100644 --- a/modules/ExpGamingPlayer/afkKick/control.lua +++ b/modules/ExpGamingPlayer/afkKick/control.lua @@ -4,7 +4,6 @@ -- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE local Game = require('FactorioStdLib.Game@^0.8.0') -local Gui = require('ExpGamingCore.Gui@^4.0.0') local Role -- ExpGamingCore.Role@^4.0.0 local Sync -- ExpGamingCore.Sync@^4.0.0 diff --git a/modules/ExpGamingPlayer/playerList/control.lua b/modules/ExpGamingPlayer/playerList/control.lua index 402d0050..e4f0ea23 100644 --- a/modules/ExpGamingPlayer/playerList/control.lua +++ b/modules/ExpGamingPlayer/playerList/control.lua @@ -48,7 +48,7 @@ function ThisModule.update(tick) end end -local back_btn = Gui.inputs.add{ +local back_btn = Gui.inputs{ type='button', caption='utility/enter', name='player-list-back' @@ -57,7 +57,7 @@ local back_btn = Gui.inputs.add{ event.element.parent.destroy() end) -Gui.left.add{ +ThisModule.Gui = Gui.left{ name='player-list', caption='entity/player', tooltip={'ExpGamingPlayer-playerList.tooltip'}, @@ -96,7 +96,7 @@ Gui.left.add{ end if Admin and Admin.report_btn then if not rank[4] and player.index ~= frame.player_index then - local btn = Admin.report_btn:draw(flow) + local btn = Admin.report_btn(flow) btn.style.height = 20 btn.style.width = 20 end @@ -110,7 +110,7 @@ Gui.left.add{ script.on_event(defines.events.on_tick,function(event) if event.tick > global.update then - Gui.left.update('player-list') + ThisModule.Gui() global.update = event.tick + global.intervial end end) @@ -136,5 +136,6 @@ script.on_event(defines.events.on_player_joined_game,ThisModule.update) script.on_event(defines.events.on_player_left_game,ThisModule.update) script.on_event(defines.events.rank_change,ThisModule.update) -ThisModule.force_update = function() return Gui.left.update('player-list') end -return ThisModule \ No newline at end of file +ThisModule.force_update = function() return ThisModule.Gui() end +-- when called it will queue an update to the player list +return setmetatable(ThisModule,{__call=function(self,...) self.update(...) end}) \ No newline at end of file diff --git a/modules/ExpGamingPlayer/polls/control.lua b/modules/ExpGamingPlayer/polls/control.lua index e1039645..d9dcf22b 100644 --- a/modules/ExpGamingPlayer/polls/control.lua +++ b/modules/ExpGamingPlayer/polls/control.lua @@ -91,7 +91,7 @@ local opption_drop_down = Gui.inputs.add_drop_down('opption-drop-down-polls',_op element.parent.answer.caption = 'Your Answer: '..selected end) -local prev = Gui.inputs.add{ +local prev = Gui.inputs{ type='button', name='prev-poll', caption='utility/hint_arrow_left' @@ -105,7 +105,7 @@ local prev = Gui.inputs.add{ draw_poll(parent.parent.poll_area) end) -local next = Gui.inputs.add{ +local next = Gui.inputs{ type='button', name='next-poll', caption='utility/hint_arrow_right' @@ -132,7 +132,7 @@ local poll_option_input = Gui.inputs.add_text('poll-option-input',true,'Enter Op else options[element.parent.name].caption = text end if options.last.caption == element.parent.name then options.last.caption = tonumber(options.last.caption)+1 - _self_referace_poll_option_input:draw(element.parent.parent.add{type='flow',name=options.last.caption}).style.minimal_width = 200 + _self_referace_poll_option_input(element.parent.parent.add{type='flow',name=options.last.caption}).style.minimal_width = 200 end end) _self_referace_poll_option_input = poll_option_input @@ -142,13 +142,13 @@ local function poll_assembler(frame) local options = frame.add{type='flow',name='options'} options.style.visible = false options.add{type='label',name='last',caption='2'} - poll_question_input:draw(frame).style.minimal_width = 200 + poll_question_input(frame).style.minimal_width = 200 local flow = frame.add{type='flow',direction='vertical'} - poll_option_input:draw(flow.add{type='flow',name='1'}).style.minimal_width = 200 - poll_option_input:draw(flow.add{type='flow',name='2'}).style.minimal_width = 200 + poll_option_input(flow.add{type='flow',name='1'}).style.minimal_width = 200 + poll_option_input(flow.add{type='flow',name='2'}).style.minimal_width = 200 end -local create_poll = Gui.inputs.add{ +local create_poll = Gui.inputs{ type='button', name='create-poll', caption='utility/add' @@ -182,7 +182,7 @@ local create_poll = Gui.inputs.add{ end end) -Gui.popup.add{ +ThisModule.Gui = Gui.popup{ name='polls', caption={'polls.name'}, draw=function(frame,data) @@ -248,4 +248,5 @@ Gui.popup.add{ -- Event Handlers Define -- Module Return -return ThisModule \ No newline at end of file +-- when called it will toogle the left gui for this player +return setmetatable(ThisModule,{__call=function(self,...) self.Gui(...) end}) \ No newline at end of file diff --git a/modules/GameSettingsGui/game-settings.lua b/modules/GameSettingsGui/control.lua similarity index 84% rename from modules/GameSettingsGui/game-settings.lua rename to modules/GameSettingsGui/control.lua index 949a494f..ae6a0b71 100644 --- a/modules/GameSettingsGui/game-settings.lua +++ b/modules/GameSettingsGui/control.lua @@ -1,13 +1,13 @@ ---[[ -Explosive Gaming +--- A gui for controlling game settings with sliders as well as some global commands. +-- @module GameSettingsGui@4.0.0 +-- @author Cooldude2606 +-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE -This file can be used with permission but this and the credit below must remain in the file. -Contact a member of management on our discord to seek permission to use our code. -Any changes that you may make to the code are yours but that does not make the script yours. -Discord: https://discord.gg/r6dC2uK -]] ---Please Only Edit Below This Line----------------------------------------------------------- +-- Module Require +local Server = require('ExpGamingCore.Server@^4.0.0') +local Gui = require('ExpGamingCore.Gui@^4.0.0') +-- Local Varibles --{type='slider',object='',key='',name='',min=x,max=y} --{type='function',object='',key='',name='',param={}} local basic_settings = { @@ -46,6 +46,11 @@ local personal_settings = { local _root_list = {basic_settings=basic_settings,advanced_settings=advanced_settings,personal_settings=personal_settings} +-- Module Define +local module_verbose = false +local ThisModule = {} + +-- Function Define local function _get_data(root_frame) local object = root_frame.name local key = root_frame.setting_name.caption @@ -121,7 +126,7 @@ local function _draw_setting(frame,setting) } frame.add{ type='label', - caption={'game-settings.effect-'..setting.name}, + caption={'GameSettingsGui.effect-'..setting.name}, style='caption_label' } frame.add{ @@ -130,7 +135,7 @@ local function _draw_setting(frame,setting) name='setting_name' }.style.visible = false if setting.type == 'slider' then - local slider = setting._loaded:draw(frame) + local slider = setting._loaded(frame) slider.style.width = 300 local _caption = string.format('%.2f',slider.slider_value); if slider.slider_value > 2 then _caption = tostring(math.floor(slider.slider_value)) end frame.add{ @@ -139,44 +144,48 @@ local function _draw_setting(frame,setting) caption=_caption } elseif setting.type == 'function' then - are_you_sure:draw(frame) + are_you_sure(frame) local flow = frame.add{type='flow',name='sure'} flow.style.visible = false flow.add{ type='label', - caption={'game-settings.sure'}, + caption={'GameSettingsGui.sure'}, style='bold_red_label' } - setting._loaded:draw(flow) + setting._loaded(flow) end end -Gui.center.add{ +ThisModule.Gui = Gui.center{ name='game-settings', caption='utility/no_building_material_icon', - tooltip={'game-settings.tooltip'} -}:add_tab('basic',{'game-settings.basic-name'},{'game-settings.basic-name'},function(frame) + tooltip={'GameSettingsGui.tooltip'} +}:add_tab('basic',{'GameSettingsGui.basic-name'},{'GameSettingsGui.basic-name'},function(frame) frame.add{ type='label', - caption={'game-settings.basic-message'} + caption={'GameSettingsGui.basic-message'} }.style.single_line = false for _,setting in pairs(basic_settings) do _draw_setting(frame,setting) end -end):add_tab('advanced',{'game-settings.advanced-name'},{'game-settings.advanced-tooltip'},function(frame) +end):add_tab('advanced',{'GameSettingsGui.advanced-name'},{'GameSettingsGui.advanced-tooltip'},function(frame) frame.add{ type='label', - caption={'game-settings.advanced-message'} + caption={'GameSettingsGui.advanced-message'} }.style.single_line = false for _,setting in pairs(advanced_settings) do _draw_setting(frame,setting) end -end):add_tab('personal',{'game-settings.personal-name'},{'game-settings.personal-tooltip'},function(frame) +end):add_tab('personal',{'GameSettingsGui.personal-name'},{'GameSettingsGui.personal-tooltip'},function(frame) frame.add{ type='label', - caption={'game-settings.personal-message'} + caption={'GameSettingsGui.personal-message'} }.style.single_line = false for _,setting in pairs(personal_settings) do _draw_setting(frame,setting) end -end) \ No newline at end of file +end) + +-- Module return +-- when called it will open the center gui for the player +return setmetatable(ThisModule,{__call=function(self,...) self.Gui(...) end}) \ No newline at end of file diff --git a/modules/GameSettingsGui/softmod.json b/modules/GameSettingsGui/softmod.json new file mode 100644 index 00000000..ac3a5deb --- /dev/null +++ b/modules/GameSettingsGui/softmod.json @@ -0,0 +1,21 @@ +{ + "name": "GameSettingsGui", + "version": "4.0.0", + "type": "Module", + "description": "A gui for controlling game settings with sliders as well as some global commands.", + "location": "", + "keywords": [ + "Gui", + "Game", + "Game Settings", + "Settings", + "Admin" + ], + "author": "Cooldude2606", + "contact": "Discord: Cooldude2606#5241", + "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", + "dependencies": { + "ExpGamingCore.Server": "^4.0.0", + "ExpGamingCore.Gui": "^4.0.0" + } +} \ No newline at end of file diff --git a/modules/GuiAnnouncements/announcements.lua b/modules/GuiAnnouncements/control.lua similarity index 80% rename from modules/GuiAnnouncements/announcements.lua rename to modules/GuiAnnouncements/control.lua index d46bf704..7eea48d7 100644 --- a/modules/GuiAnnouncements/announcements.lua +++ b/modules/GuiAnnouncements/control.lua @@ -1,13 +1,20 @@ ---[[ -Explosive Gaming +--- Creates a gui for making and reciving announcements +-- @module GuiAnnouncements@4.0.0 +-- @author Cooldude2606 +-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE -This file can be used with permission but this and the credit below must remain in the file. -Contact a member of management on our discord to seek permission to use our code. -Any changes that you may make to the code are yours but that does not make the script yours. -Discord: https://discord.gg/r6dC2uK -]] ---Please Only Edit Below This Line----------------------------------------------------------- +-- maybe make this not require Role and have it optinal +-- Module Require +local Game = require('FactorioStdLib.Game@^0.8.0') +local Gui = require('ExpGamingCore.Gui@^4.0.0') +local Role = require('ExpGamingCore.Role@^4.0.0') + +-- Module Define +local module_verbose = false +local ThisModule = {} + +-- Function Define local function _roles(player) local roles = {'Select Rank'} local _role = Role.get_highest(player) @@ -25,7 +32,7 @@ local role_drop_down = Gui.inputs.add_drop_down('rank-drop-down-annoncements',_r else element.parent['send-annoncement'].style.visible = true end end) -local send_popup = Gui.inputs.add{ +local send_popup = Gui.inputs{ type='button', name='send-annoncement', caption='utility/export_slot' @@ -45,7 +52,7 @@ local send_popup = Gui.inputs.add{ end end) -Gui.popup.add{ +ThisModule.Gui = Gui.popup{ name='announcements', caption={'announcements.name'}, draw=function(frame,data) @@ -94,4 +101,8 @@ Gui.popup.add{ caption='' }.style.visible = false end -} \ No newline at end of file +} + +-- Module return +-- when called it will open the center gui for the player +return setmetatable(ThisModule,{__call=function(self,...) self.Gui(...) end}) \ No newline at end of file diff --git a/modules/GuiAnnouncements/softmod.json b/modules/GuiAnnouncements/softmod.json new file mode 100644 index 00000000..bd79684b --- /dev/null +++ b/modules/GuiAnnouncements/softmod.json @@ -0,0 +1,20 @@ +{ + "name": "GuiAnnouncements", + "version": "4.0.0", + "type": "Module", + "description": "Creates a gui for making and reciving announcements", + "location": "", + "keywords": [ + "Announcements", + "Gui", + "Admin" + ], + "author": "Cooldude2606", + "contact": "Discord: Cooldude2606#5241", + "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", + "dependencies": { + "FactorioStdLib.Game": "^0.8.0", + "ExpGamingCore.Role": "^4.0.0", + "ExpGamingCore.Gui": "^4.0.0" + } +} \ No newline at end of file diff --git a/modules/RankChanger/rank-changer.lua b/modules/RankChanger/rank-changer.lua index 84b38e52..8aab48c7 100644 --- a/modules/RankChanger/rank-changer.lua +++ b/modules/RankChanger/rank-changer.lua @@ -8,6 +8,8 @@ Discord: https://discord.gg/r6dC2uK ]] --Please Only Edit Below This Line----------------------------------------------------------- +-- to be removed as Ranking is not a thing now + local get_player_info = get_player_info or function(player,frame) frame.add{ type='label', @@ -63,7 +65,7 @@ local role_drop_down = Gui.inputs.add_drop_down('rank-drop-down-rank-change',_ro element.parent.parent.role.caption = selected end) -local set_role = Gui.inputs.add{ +local set_role = Gui.inputs{ type='button', name='rank-change-set', caption={'rank-changer.set-rank'} @@ -79,7 +81,7 @@ local set_role = Gui.inputs.add{ Gui.center.clear(event) end) -Gui.center.add{ +Gui.center{ name='rank-changer', caption='utility/circuit_network_panel', tooltip={'rank-changer.tooltip'}, @@ -106,9 +108,9 @@ Gui.center.add{ } label.style.single_line = false label.style.width = 200 - online_check:draw(dropdowns) - player_drop_down:draw(dropdowns) - rank_drop_down:draw(dropdowns) + online_check(dropdowns) + player_drop_down(dropdowns) + rank_drop_down(dropdowns) local label = dropdowns.add{ name='warning', type='label', @@ -117,7 +119,7 @@ Gui.center.add{ } label.style.single_line = false label.style.width = 200 - set_role:draw(dropdowns) + set_role(dropdowns) frame.add{ name='player', type='label', diff --git a/modules/WarpPoints/warp-system.lua b/modules/WarpPoints/warp-system.lua index e56707b9..18f50687 100644 --- a/modules/WarpPoints/warp-system.lua +++ b/modules/WarpPoints/warp-system.lua @@ -8,6 +8,8 @@ Discord: https://discord.gg/r6dC2uK ]] --Please Only Edit Below This Line----------------------------------------------------------- +-- Needs updating to new gui core + local warp_tiles = { {-3,-2},{-3,-1},{-3,0},{-3,1},{-3,2},{3,-2},{3,-1},{3,0},{3,1},{3,2}, {-2,-3},{-1,-3},{0,-3},{1,-3},{2,-3},{-2,3},{-1,3},{0,3},{1,3},{2,3}