diff --git a/control.lua b/control.lua index 5399c0f1..1ef8841e 100644 --- a/control.lua +++ b/control.lua @@ -22,7 +22,7 @@ require("mod-gui") credit_loop(require("locale/StdLib/event")) Event.gui_update = script.generate_event_name() credit_loop(require("locale/file-header")) ---below 'game.tick/(3600*game.speed)) % 15 == 0' rasise the gui_update event every 15 minutes fell very to change the update time on that +--below 'game.tick/(3600*game.speed)) % 15 == 0' raises the gui_update event every 15 minutes fell free to change the update time on that Event.register(defines.events.on_tick, function(event) if (game.tick/(3600*game.speed)) % 15 == 0 then for _,player in pairs(game.connected_players) do find_new_rank(player) end diff --git a/locale/ExpGaming-Core/Core Help File.md b/locale/ExpGaming-Core/Core Help File.md index 8a23db31..6cb9da5b 100644 --- a/locale/ExpGaming-Core/Core Help File.md +++ b/locale/ExpGaming-Core/Core Help File.md @@ -1,5 +1,5 @@ # Functions added in core -See code for more detail. +See code for more details. ## GUI ### Defining * ExpGui.add_frame.center(name,default_display,default_tooltip,restriction,tabs,event) @@ -26,13 +26,13 @@ See code for more detail. * ExpGui.add_input.text(name,default_display,event) * event = on text change -> function(player,element) ### Drawing -* ExpGui.toggleVisable(frame) - * Toggles the visability of a frame +* ExpGui.toggle_visible(frame) + * Toggles the visibility of a frame * ExpGui.player_table.draw_filters(player,frame,filters) * filters = {filter-name,...} * ExpGui.player_table.draw(player,frame,filters,input_location) * filters = {{'filter name',value},{'filter name'},{...},...} - * input_location = gui element -> draw_filters frame + * input_location = GUI element -> draw_filters frame * ExpGui.draw_frame.left(player,element,update) * element = 'frame name' * update = true @@ -46,9 +46,9 @@ See code for more detail. * display (opt) ## Ranks * get_rank(player) - * Gets the players rank + * Get the players rank * string_to_rank(string) - * Converts a rank name to the rank object + * Convert a rank name to the rank object * rank_print(msg, rank, inv) * rank = 'rank name' * inv = lower ranks rather than higher -> true/false/nil @@ -59,32 +59,32 @@ See code for more detail. * by_player = player or nil * find_new_rank(player) * Looks in presets if play time under 5 minutes - * Other wise looks at play time + * Otherwise looks at play time * Event.rank_change - * event is rasised upon rank change -> event = {player,by_player,new_rank,old_rank} + * event is raised upon rank change -> event = {player,by_player,new_rank,old_rank} ## Lib * Factorio StdLib game, event and core * tick_to_display_format(tick) * output -> 0H 0M or 0.00M when less than 10 * tick_to_hour (tick) - * converts ticks to hours based on game speed + * Convert ticks to hours based on game speed * tick_to_min (tick) - * converts ticks to minutes based on game speed + * Convert ticks to minutes based on game speed * table.to_string(tbl) - * We stole this but we dont know where from, just google it + * We stole this but we don't know from where, just google it * output -> table as a string ## Other * define_command(name,help,inputs,restriction,event) - * This adds game commands in a way not to cause crashes + * Add game commands in a way it does not cause crashes * name = 'test' -> /test * help = 'help message' - * inputs = {'input name',...,true/nil} last value being true means no cap on the leanth + * inputs = {'input name',...,true/nil} last value being true means no cap on the length * restriction = 'rank name' * event = on command -> function(player,event,args) * sudo(command,args) - * Asks server to run a script function for a user ie give_rank + * Ask server to run a script function for a user i.e. give_rank * command = function(...) * args = {...} * command: /server-interface - * runs loadstring on lua code given like /c but does not break achevements + * Run loadstring on lua code given like /c but does not break achievements * restriction = 'Admin' \ No newline at end of file diff --git a/locale/ExpGaming-Core/ExpGaming - Command Maker.lua b/locale/ExpGaming-Core/ExpGaming - Command Maker.lua index fb572cb5..5e69283e 100644 --- a/locale/ExpGaming-Core/ExpGaming - Command Maker.lua +++ b/locale/ExpGaming-Core/ExpGaming - Command Maker.lua @@ -19,7 +19,7 @@ local credits = {{ local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits,cred) end end --Please Only Edit Below This Line----------------------------------------------------------- local Exp_commands = {} ---used mainly by the code to convert the inputs into a string +--Used mainly by the code to convert the inputs into a string function command_inputs_to_string(command) local str_inputs = '' for _,input in pairs(command[3]) do @@ -28,22 +28,22 @@ function command_inputs_to_string(command) end return str_inputs end ---can be used to ensure the right number of inputs are given +--Can be used to ensure the right number of inputs are given function get_command_args(event,command) local player = game.players[event.player_index] - if not event.parameter then player.print('Invaild Input, /'..command[1]..' '..command_inputs_to_string(command)) if #command[3] > 0 then return 'Invaild' else return end end + if not event.parameter then player.print('Invalid Input, /'..command[1]..' '..command_inputs_to_string(command)) if #command[3] > 0 then return 'Invalid' else return end end local args = {} for word in event.parameter:gmatch('%S+') do table.insert(args,word) end if command[3][#command[3]] == true then - if #args < #command[3]-1 then player.print('Invaild Input, /'..command[1]..' '..command_inputs_to_string(command)) return 'Invaild' end + if #args < #command[3]-1 then player.print('Invalid Input, /'..command[1]..' '..command_inputs_to_string(command)) return 'Invalid' end else - if #args ~= #command[3] then player.print('Invaild Input, /'..command[1]..' '..command_inputs_to_string(command)) return 'Invaild' end + if #args ~= #command[3] then player.print('Invalid Input, /'..command[1]..' '..command_inputs_to_string(command)) return 'Invalid' end end return args end ---name is what is used in /command ---help is the help infor given ---inputs is a list ie {'name','message',true} the last value being true apossed to a string allows a varible number of words for the last input ie message can be mutilple words long ---restriction is the minium rank that can use the caommand +--name is what is used in /command +--help is the help info given +--inputs is a list i.e. {'name','message',true} the last value being true opposed to a string allows a variable number of words for the last input i.e. message can be multiple words long +--restriction is the lowest rank that can use the command --event(player,event,args) if the function that will be ran on the command use function define_command(name,help,inputs,restriction,event) if not name then error('Command requires a name') end @@ -53,7 +53,7 @@ function define_command(name,help,inputs,restriction,event) if not event or type(event) ~= 'function' then error('Command requires a function') end table.insert(Exp_commands,{name,help,inputs,restriction,event}) end ---the magic for the commnads it is a hard bit of code so GL; but it will call the command event have some satatisaion of the input +--The magic for the commands. It is a hard bit of code so GL; but it will call the command event have some sanitisaion of the input function load_command(command) if commands.commands[command[1]] then return end commands.add_command(command[1],command_inputs_to_string(command)..command[2],function(event) @@ -66,11 +66,11 @@ function load_command(command) local restriction = temp_restriction or string_to_rank(command[4]).power or 0 if get_rank(player).power > restriction then player.print('401 - Unauthorized: Access is denied due to invalid credentials') return end local args = get_command_args(event,command) - if args == 'Invaild' then return end + if args == 'Invalid' then return end command[5](player,event,args) else local args = get_command_args(event,command) - if args == 'Invaild' then return end + if args == 'Invalid' then return end command[5]('',event) end end) diff --git a/locale/ExpGaming-Core/ExpGaming - Lib.lua b/locale/ExpGaming-Core/ExpGaming - Lib.lua index 8573c28b..ef689962 100644 --- a/locale/ExpGaming-Core/ExpGaming - Lib.lua +++ b/locale/ExpGaming-Core/ExpGaming - Lib.lua @@ -18,7 +18,7 @@ local credits = {{ }} local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits,cred) end end --Please Only Edit Below This Line----------------------------------------------------------- ---this converts ticks to 12H 34M format or 8.97M when less than 10 +--Convert ticks to 12H 34M format or 8.97M when less than 10 function tick_to_display_format(tick) if tick_to_min(tick) < 10 then return string.format('%.2f M',tick/(3600*game.speed)) @@ -26,15 +26,15 @@ function tick_to_display_format(tick) return string.format('%d H %d M',tick_to_hour(tick),tick_to_min(tick)-60*tick_to_hour(tick)) end end ---this will convert ticks into hours based on game speed +--Convert ticks into hours based on game speed function tick_to_hour (tick) return math.floor(tick/(216000*game.speed)) end ---this will convert ticks into minutes based on game speed +--Convert ticks into minutes based on game speed function tick_to_min (tick) return math.floor(tick/(3600*game.speed)) end ---i stole this from somewhere a long time ago but this and the other two functions convert a table into a string +--I stole this from somewhere a long time ago but this and the other two functions convert a table into a string function table.val_to_str ( v ) if "string" == type( v ) then v = string.gsub( v, "\n", "\\n" ) diff --git a/locale/ExpGaming-Core/ExpGaming - Rank Control.lua b/locale/ExpGaming-Core/ExpGaming - Rank Control.lua index 8ac5e976..92bbfaca 100644 --- a/locale/ExpGaming-Core/ExpGaming - Rank Control.lua +++ b/locale/ExpGaming-Core/ExpGaming - Rank Control.lua @@ -12,13 +12,13 @@ local credits = {{ name='Explosive Gaming Rank System', owner='Explosive Gaming', dev='Cooldude2606', - description='The very core that all of the others are based on', + description='The very core upon which all of the others are based on', factorio_version='0.15.23', show=true }} local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits,cred) end end --Please Only Edit Below This Line----------------------------------------------------------- ---this will return the rank of the player given +--Return the rank of a given player function get_rank(player) if player then for _,rank in pairs(global.ranks) do @@ -27,7 +27,7 @@ function get_rank(player) return string_to_rank('Guest') end end ---this will convert the name of a rank into the rank object +--Convert the name of a rank into the rank object function string_to_rank(string) if type(string) == 'string' then local Foundranks={} @@ -38,7 +38,7 @@ function string_to_rank(string) if #Foundranks == 1 then return Foundranks[1] end end end ---this will send a message to all members if this rank and above default is mod rank +--Send a message to all members of this rank and above, if no rank given default is mod function rank_print(msg, rank, inv) local rank = string_to_rank(rank) or string_to_rank('Mod') -- default mod or higher local inv = inv or false @@ -55,7 +55,7 @@ function rank_print(msg, rank, inv) end end end ---this will give the user their new rank and raise the Event.rank_change event +--Give the user their new rank and raise the Event.rank_change event function give_rank(player,rank,by_player) local by_player = by_player or 'system' local rank = string_to_rank(rank) or rank or string_to_rank('Guest') @@ -68,20 +68,20 @@ function give_rank(player,rank,by_player) else rank_print(player.name..' was '..message..' to '..rank.name..' by ','Guest') end - if rank.name ~= 'Guest' then player.print('You Have Been Given The '..rank.name..' Rank!') end - if player.tag ~= old_rank.tag and player.tag ~= '' then player.print('Your Tag Was Reset Due To A Rank Change') end + if rank.name ~= 'Guest' then player.print('You have been given the '..rank.name..' Rank!') end + if player.tag ~= old_rank.tag and player.tag ~= '' then player.print('Your Tag was reset due to a Rank change') end --rank change player.permission_group = game.permissions.get_group(rank.name) player.tag = get_rank(player).tag if old_rank.name ~= 'Jail' then global.old_ranks[player.index]=old_rank.name end script.raise_event(Event.rank_change, {player=player, by_player=by_player, new_rank=rank, old_rank=old_rank}) end ---the user's rank is reverted to what it was before the lastest change +--Revert the user's rank to what it was before the lastest change function revert_rank(player,by_player) local rank = string_to_rank(global.old_ranks[player.index]) give_rank(player,rank,by_player) end ---the player is given a new rank based on playtime and/or preset ranks +--Give the player a new rank based on playtime and/or preset ranks function find_new_rank(player) local function loop_preset_rank(players,rank) for _,p in pairs(players) do @@ -91,24 +91,24 @@ function find_new_rank(player) local current_rank = get_rank(player) local old_rank = get_rank(player) local possible_ranks = {current_rank} - --loops though preset ranks only if playtime is less than 5 minutes + --Loop through preset ranks only if playtime is less than 5 minutes if tick_to_min(player.online_time) < 5 then for rank,players in pairs(global.preset_ranks) do local found_rank = loop_preset_rank(players, rank) if found_rank then table.insert(possible_ranks,string_to_rank(found_rank)) break end end end - --loops though rank times + --Loop through rank times for _,rank in pairs(global.ranks) do if rank.time and tick_to_min(player.online_time) >= rank.time then table.insert(possible_ranks,string_to_rank(rank)) end end - --loops though possible ranks + --Loop through possible ranks if current_rank.name ~='Jail' then local highest_rank = possible_ranks[1] for _,rank in pairs(possible_ranks) do if rank.power < highest_rank.power then highest_rank = rank end end - --gives player new rank if availble + --Give player new rank if availble if highest_rank.name == 'Guest' then player.permission_group=game.permissions.get_group('Guest') script.raise_event(Event.rank_change, {player=player, by_player='system', new_rank=string_to_rank('Guest'), old_rank=string_to_rank('Guest')}) @@ -116,11 +116,11 @@ function find_new_rank(player) if highest_rank ~= current_rank then give_rank(player,highest_rank) end end end - --lose ends + --Lose ends if get_rank(player).power <= string_to_rank('mod').power and not player.admin then rank_print(player.name..' needs to be promoted.') end if old_rank.name ~= get_rank(player).name then global.old_ranks[player.index]=old_rank.name end end ---event handlers +--Event handlers Event.rank_change = script.generate_event_name() Event.register(-1,function() global.old_ranks = {} diff --git a/locale/ExpGaming-Core/ExpGaming - Rank Presets.lua b/locale/ExpGaming-Core/ExpGaming - Rank Presets.lua index 9ae1d269..2e908090 100644 --- a/locale/ExpGaming-Core/ExpGaming - Rank Presets.lua +++ b/locale/ExpGaming-Core/ExpGaming - Rank Presets.lua @@ -12,7 +12,7 @@ local credits = {{ name='ExpGaming - Rank Preset Table', owner='Explosive Gaming', dev='Cooldude2606', - description='The Ranks that players are given apon joining', + description='The ranks that players are given upon joining', factorio_version='0.15.23', show=false }} @@ -50,6 +50,7 @@ local preset_ranks = { 'Mr_Happy_212', 'NextIdea', 'Phoenix27833', + 'rezz', 'samy115', 'Sand3r205', 'scarbvis', diff --git a/locale/ExpGaming-Core/ExpGaming - Rank Table.lua b/locale/ExpGaming-Core/ExpGaming - Rank Table.lua index 006673e9..ecb9bb0f 100644 --- a/locale/ExpGaming-Core/ExpGaming - Rank Table.lua +++ b/locale/ExpGaming-Core/ExpGaming - Rank Table.lua @@ -20,14 +20,14 @@ local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits --Please Only Edit Below This Line----------------------------------------------------------- --[[ How to add ranks: -Name is what will be used in the scripts and is offten the best chose for display in text. -short_hand is what can be used when short on space but the rank still need to be displayed. -tag is the tag the player will gain when moved to the rank, it can be nil. -time is used for auto rank feature where you are moved to the rank after a certain play time in minutes. -colour is the rgb value that can be used to emphaise gui elelemts based on rank. -power is not in the list below as it is auto defined by index but allows compairison between ranks. -disallow is a list containing input acttion that the user can not preform. -For disallow add to the list the end part of the input action +Name is what will be used in the scripts and is often the best choice for display in text. +short_hand is what can be used when short on space but the rank still need to be displayed. +tag is the tag the player will gain when moved to the rank, it can be nil. +time is used for auto-rank feature where you are moved to the rank after a certain play time in minutes. +colour is the RGB value that can be used to emphasise GUI elements based on rank. +power is not in the list below as it is auto-defined by index but allows comparison between ranks. +disallow is a list containing input actions that the user can not perform. +For disallow, add to the list the end part of the input action Example: defines.input_action.drop_item -> 'drop_item' http://lua-api.factorio.com/latest/defines.html#defines.input_action --]] @@ -131,7 +131,7 @@ local ranks = { 'player_leave_game'} } } --- This For Loop cauess the disallows of each rank to be feed into the one below its self +-- Feed the disallows of each rank into the one below itself for n,rank in pairs(ranks) do rank.power = n if ranks[n-1] then @@ -140,7 +140,7 @@ for n,rank in pairs(ranks) do end end end --- Moves The Ranks to the global array +-- Move the ranks to the global array Event.register(-1,function() global.ranks = ranks end) --Please Only Edit Above This Line----------------------------------------------------------- return credits \ No newline at end of file diff --git a/locale/ExpGaming-Core/ExpGaming - Server Interface.lua b/locale/ExpGaming-Core/ExpGaming - Server Interface.lua index 927a08c2..6e9f69ba 100644 --- a/locale/ExpGaming-Core/ExpGaming - Server Interface.lua +++ b/locale/ExpGaming-Core/ExpGaming - Server Interface.lua @@ -12,13 +12,13 @@ local credits = {{ name='Explosive Gaming Server Interface', owner='Explosive Gaming', dev='Cooldude2606', - description='A way of talking with the server with out breaking achevements', + description='A way of talking with the server with out breaking achievements', factorio_version='0.15.23', show=true }} local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits,cred) end end --Please Only Edit Below This Line----------------------------------------------------------- ---this command is just a way or using loadstring from in game while keeping achevements +--this command is just a way or using loadstring from in game while keeping achievements define_command('server-interface','For use of the highest staff only',{'command',true},'admin',function(player,event,args) if player == '' then local returned,value = pcall(loadstring(event.parameter)) @@ -30,16 +30,16 @@ define_command('server-interface','For use of the highest staff only',{'command' else game.write_file('log.txt', '\n Ran by: '..player.name..'\n Code: '..event.parameter..'\n $£$ '..tostring(value), true, 0) player.print(value) end end end) ---this is used when changing permsion groups when the person does not have permsion to, can also be used to split a large event accross mutilple ticks -local commands_per_itteration = 50 --number of sudo commands ran every sudo itteration -local ticks_per_itteration = 1 --the number of ticks break before the next sudo itteration +--this is used when changing permission groups when the person does not have permsion to, can also be used to split a large event accross multiple ticks +local commands_per_iteration = 50 --number of sudo commands ran every sudo iteration +local ticks_per_iteration = 1 --the number of ticks break before the next sudo iteration function sudo(command,args) table.insert(global.sudo,{fun=command,var=args}) end ---runs at most five sudo commandd every five ticks if one is present -Event.register(defines.events.on_tick, function(event) - if game.tick % ticks_per_itteration == 0 and global.sudo and #global.sudo > 0 then - local lenth = nil - if #global.sudo > commands_per_itteration then lenth = commands_per_itteration else lenth = #global.sudo end - for i = 1,lenth do +--runs at most five sudo commands every five ticks if one is present +Event.register(defines.events.on_tick, function(event) + if game.tick % ticks_per_iteration == 0 and global.sudo and #global.sudo > 0 then + local length = nil + if #global.sudo > commands_per_iteration then length = commands_per_iteration else length = #global.sudo end + for i = 1,length do command=table.remove(global.sudo) if command and command.fun and type(command.fun) == 'function' then local args = command.var or {} diff --git a/locale/ExpGaming-Core/GUI/ExpGaming - Center Gui.lua b/locale/ExpGaming-Core/GUI/ExpGaming - Center Gui.lua index b68005ec..30e25abf 100644 --- a/locale/ExpGaming-Core/GUI/ExpGaming - Center Gui.lua +++ b/locale/ExpGaming-Core/GUI/ExpGaming - Center Gui.lua @@ -12,7 +12,7 @@ local credits = {{ name='ExpGaming - Center Gui', owner='Explosive Gaming', dev='Cooldude2606', - description='The main gui in the center', + description='The main GUI in the center', factorio_version='0.15.23', show=false }} @@ -21,14 +21,16 @@ local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits local add_frame = ExpGui.add_frame local frames = ExpGui.frames local draw_frame = ExpGui.draw_frame ---adds a frame in the center; tabs {{name,restriction},{...}} is a list that can contain already defined tabs; event(player,element) is a option to have a custom gui in the center +--Add a frame in the center +--tabs {{name,restriction},{...}} is a list that can contain already defined tabs +--event(player,element) is an option to have a custom GUI in the center function add_frame.center(name,default_display,default_tooltip,restriction,tabs,event) if not name then error('Frame requires a name') end local tabs = tabs or {} table.insert(frames.center,{name,default_display,tabs,event}) ExpGui.toolbar.add_button(name,default_display,default_tooltip,restriction,draw_frame.center) end ---defines a tab; frame is need as every tab must be used once; event(player,tab) is the draw function +--Define a tab; frame is needed as every tab must be used once; event(player,tab) is the draw function function add_frame.tab(name,default_display,default_tooltip,restriction,frame,event) if not name then error('Tab requires a name') end if not frame then error('Tab requires a frame') end @@ -36,8 +38,8 @@ function add_frame.tab(name,default_display,default_tooltip,restriction,frame,ev for _,f in pairs(frames.center) do if f[1] == frame then table.insert(f[3],{name,restriction}) end end ExpGui.add_input.button(name,default_display,default_tooltip,draw_frame.tab) end ---draw the center gui for the player; do not call manuley must use other functions to call -ExpGui.add_input.button('close_center','Close','Close This Gui',function(player,element) element.parent.parent.parent.destroy() end) +--Draw the center GUI for the player; do not call manually, must use other functions to call +ExpGui.add_input.button('close_center','Close','Close this GUI',function(player,element) element.parent.parent.parent.destroy() end) function draw_frame.center(player,element) local frame_data = nil for _,frame in pairs(frames.center) do if element.name == frame[1] then frame_data = frame break end end @@ -64,9 +66,9 @@ function draw_frame.center(player,element) tab_bar_scroll.style.maximal_height = 60 tab_bar_scroll.style.minimal_width = 500 tab_bar_scroll.style.maximal_width = 500 - player.gui.center.add{type='frame',name='temp'}.destroy()--recenter the gui + player.gui.center.add{type='frame',name='temp'}.destroy()--recenter the GUI end ---draw the tab into the center gui for the player; do not call manuley must use other functions to call +--Draw the tab into the center GUI for the player; do not call manually, must use other functions to call function draw_frame.tab(player,element) for _,btn in pairs(element.parent.children) do if btn.name == 'close_center' or btn.name == element.name then btn.style.font_color = {r = 255, g = 255, b = 255,a=255} diff --git a/locale/ExpGaming-Core/GUI/ExpGaming - Inputs.lua b/locale/ExpGaming-Core/GUI/ExpGaming - Inputs.lua index 9530db7b..4c6bc845 100644 --- a/locale/ExpGaming-Core/GUI/ExpGaming - Inputs.lua +++ b/locale/ExpGaming-Core/GUI/ExpGaming - Inputs.lua @@ -12,7 +12,7 @@ local credits = {{ name='Gui Input Handler', owner='Explosive Gaming', dev='Cooldude2606', - description='Handles all gui inputs', + description='Handles all GUI inputs', factorio_version='0.15.23', show=false }} @@ -20,17 +20,17 @@ local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits --Please Only Edit Below This Line----------------------------------------------------------- local add_input = ExpGui.add_input local inputs = ExpGui.inputs ---allows defining of new buttons;;name how to call button;;default_display what is showen on the button;;default_tooltip the tooltip display;;event function(player,element) that runs on click +--allows defining of new buttons;;name how to call button;;default_display what is shown on the button;;default_tooltip the tooltip display;;event function(player,element) that runs on click function add_input.button(name,default_display,default_tooltip,event) if not name then error('Button requires a name') end table.insert(inputs.buttons,{name,default_display,default_tooltip,event}) end ---allows defining of text box inputs;;name how to call button;;default_display what is showen on the button;;event function(player,element) that runs on text change +--allows defining of text box inputs;;name how to call button;;default_display what is shown on the button;;event function(player,element) that runs on text change function add_input.text(name,default_display,event) if not name then error('Text Filed requires a name') end table.insert(inputs.text,{name,default_display,event}) end ---draws the button into a gui;;frame the frame to draw to;;name name of button to draw;;display(opptinal) overides the default;;tooltip(opptinal) overides the default +--draws the button into a gui;;frame the frame to draw to;;name name of button to draw;;display(opptinal) overrides the default;;tooltip(opptinal) overrides the default function add_input.draw_button(frame,name,display,tooltip) if not frame or not frame.valid then error('No frame to draw to') end if not name then error('No button to draw') end @@ -45,9 +45,9 @@ function add_input.draw_button(frame,name,display,tooltip) end return end end - error('No Button By The Name Of '..name) + error('No Button by the name of '..name) end ---draws the text into a gui;;frame the frame to draw to;;name name of button to draw;;display(opptinal) overides the default;;tooltip(opptinal) overides the default +--draws the text into a gui;;frame the frame to draw to;;name name of button to draw;;display(opptinal) overrides the default;;tooltip(opptinal) overrides the default function add_input.draw_text(frame,name,display) if not frame or not frame.valid then error('No frame to draw to') end if not name then error('No text filed to draw') end @@ -66,7 +66,7 @@ Event.register(defines.events.on_gui_click, function(event) if event.element.type == 'button' or event.element.type == 'sprite-button' then for _,btn in pairs(inputs.buttons) do if btn[1] == event.element.name then - if btn[4] then btn[4](player,event.element) else rank_print('Button Without Function '..btn[1],'Mod') end break + if btn[4] then btn[4](player,event.element) else rank_print('Button without Function '..btn[1],'Mod') end break end end end diff --git a/locale/ExpGaming-Core/GUI/ExpGaming - Left Gui.lua b/locale/ExpGaming-Core/GUI/ExpGaming - Left Gui.lua index 4079799f..2ec8d617 100644 --- a/locale/ExpGaming-Core/GUI/ExpGaming - Left Gui.lua +++ b/locale/ExpGaming-Core/GUI/ExpGaming - Left Gui.lua @@ -21,9 +21,9 @@ local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits local add_frame = ExpGui.add_frame local frames = ExpGui.frames local draw_frame = ExpGui.draw_frame ---left guis are always present and only have their visabilty toggled ---adds a frame to the left bar; event(player,frame) must be present for left guis as there is no default ---vis must be true must be true or false based on the default stae of the gui +--left GUIs are always present and only have their visibility toggled +--Add a frame to the left bar; event(player,frame) must be present for left GUIs as there is no default +--vis should be true or false based on the player join game state of the GUI function add_frame.left(name,default_display,default_tooltip,restriction,vis,event) if not name then error('Frame requires a name') end if not event or type(event) ~= 'function' then error('Frame requires a draw function') end @@ -31,29 +31,29 @@ function add_frame.left(name,default_display,default_tooltip,restriction,vis,eve table.insert(frames.left,{name,default_display,event,vis}) ExpGui.toolbar.add_button(name,default_display,default_tooltip,restriction,draw_frame.left) end ---draw the left gui for the player; called via script, only call manuley when update is true and element is the name of the gui +--draw the left GUI for the player; called via script, only call manually when update is true and element is the name of the GUI function draw_frame.left(player,element,update) local frame = nil local frame_data = nil local left = mod_gui.get_frame_flow(player) if not update then for _,frame in pairs(frames.left) do if element.name == frame[1] then frame_data = frame break end end - if left[frame_data[1]] then ExpGui.toggleVisable(left[frame_data[1]]) return end - frame = left.add{name=frame_data[1],type='frame',capption=frame_data[2],direction='vertical',style=mod_gui.frame_style} + if left[frame_data[1]] then ExpGui.toggle_visible(left[frame_data[1]]) return end + frame = left.add{name=frame_data[1],type='frame',caption=frame_data[2],direction='vertical',style=mod_gui.frame_style} else for _,frame in pairs(frames.left) do if element == frame[1] then frame_data = frame break end end frame = left[frame_data[1]] end if frame then frame.clear() frame_data[3](player,frame) end end ---used to load all left guis +--used to load all left GUIs Event.register(defines.events.on_player_joined_game,function(event) local player = game.players[event.player_index] for _,frame_data in pairs(frames.left) do local left = mod_gui.get_frame_flow(player) if left[frame_data[1]] then left[frame_data[1]].style.visible = frame_data[4] else - local frame = left.add{name=frame_data[1],type='frame',capption=frame_data[2],direction='vertical',style=mod_gui.frame_style} + local frame = left.add{name=frame_data[1],type='frame',caption=frame_data[2],direction='vertical',style=mod_gui.frame_style} frame_data[3](player,frame) frame.style.visible = frame_data[4] end diff --git a/locale/ExpGaming-Core/GUI/ExpGaming - Modlue Setup.lua b/locale/ExpGaming-Core/GUI/ExpGaming - Module Setup.lua similarity index 90% rename from locale/ExpGaming-Core/GUI/ExpGaming - Modlue Setup.lua rename to locale/ExpGaming-Core/GUI/ExpGaming - Module Setup.lua index 0117bbbb..f77df262 100644 --- a/locale/ExpGaming-Core/GUI/ExpGaming - Modlue Setup.lua +++ b/locale/ExpGaming-Core/GUI/ExpGaming - Module Setup.lua @@ -12,7 +12,7 @@ local credits = {{ name='Explosive Gaming Gui System', owner='Explosive Gaming', dev='Cooldude2606', - description='Without this it would not be the same', + description='Without this, it would not be the same', factorio_version='0.15.23', show=true }} @@ -60,8 +60,8 @@ ExpGui = { popup={} } } ---simple function to toggle the visiblly of a frame -function ExpGui.toggleVisable(frame) +--simple function to toggle the visibility of a frame +function ExpGui.toggle_visible(frame) if frame then if frame.style.visible == nil then frame.style.visible = false diff --git a/locale/ExpGaming-Core/GUI/ExpGaming - Player Table.lua b/locale/ExpGaming-Core/GUI/ExpGaming - Player Table.lua index 95337d5c..b7f590d7 100644 --- a/locale/ExpGaming-Core/GUI/ExpGaming - Player Table.lua +++ b/locale/ExpGaming-Core/GUI/ExpGaming - Player Table.lua @@ -21,7 +21,7 @@ local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits local player_table_functions = ExpGui.player_table local yes = {'yes','y','true','ye'} local no = {'no','false','nay'} ---filters that are used fell free to add more +--filters that are used. Feel free to add more player_table_functions.filters = { --{name,is_text,function(player,input) return true end} {'is_admin',false,function(player) return player.admin end}, @@ -60,7 +60,7 @@ function player_table_functions.get_filters(frame) end return filters end ---used to test if a player matches filter critria +--used to test if a player matches filter criteria function player_table_functions.player_match(player,filter,input) for _,f in pairs(player_table_functions.filters) do if filter == f or filter == f[1] then if filter == f[1] then filter = f break end end @@ -74,7 +74,7 @@ function player_table_functions.redraw(player,element) player_table_functions.draw(player,frame,filters,element.parent.parent) end --used to draw the player table with filter that you want ---filter = {{'is_admin',true},{'offline',true},{'player_name'}} ; if the leanth is 2 then it will not atemp to get a user input +--filter = {{'is_admin',true},{'offline',true},{'player_name'}} ; if the length is 2 then it will not attempt to get a user input function player_table_functions.draw(player,frame,filters,input_location) global.current_filters[player.index] = {filters,frame} --setup the table diff --git a/locale/ExpGaming-Core/GUI/ExpGaming - Popup.lua b/locale/ExpGaming-Core/GUI/ExpGaming - Popup.lua index 9fe10e6d..85e8424c 100644 --- a/locale/ExpGaming-Core/GUI/ExpGaming - Popup.lua +++ b/locale/ExpGaming-Core/GUI/ExpGaming - Popup.lua @@ -22,7 +22,7 @@ local add_frame = ExpGui.add_frame local frames = ExpGui.frames local draw_frame = ExpGui.draw_frame --used to draw the next popup frame -ExpGui.add_input.button('close_popup','X','Close This Popup',function(player,element) element.parent.destroy() end) +ExpGui.add_input.button('close_popup','X','Close this Popup',function(player,element) element.parent.destroy() end) local function get_next_popup(popups,name) if name then local flow = popups.add{type='frame',name=name..'_on_click',direction='horizontal',style=mod_gui.frame_style} @@ -36,9 +36,11 @@ local function get_next_popup(popups,name) ExpGui.add_input.draw_button(flow,'close_popup') return frame end ---adds a frame to the popup flow;restriction is the power need to use the on_click function ---on_click(player,element) is what is called when button is clicked if nil no button is made ---event(player,frame,args) frame is where it will be drawen to; args is any infor you want to pass in +--adds a frame to the popup flow +--restriction is the power needed to use the on_click function +--on_click(player,element) is what is called when button is clicked if nil no button is made +--event(player,frame,args) +--frame is where it will be drawn to; args is any info you want to pass in function add_frame.popup(style,default_display,default_tooltip,restriction,on_click,event) if not style then error('Popup style requires a name') end if not event or type(event) ~= 'function' then error('Popup style requires a draw function') end @@ -48,7 +50,7 @@ function add_frame.popup(style,default_display,default_tooltip,restriction,on_cl ExpGui.toolbar.add_button(style,default_display,default_tooltip,restriction,draw_frame.popup_button) end end ---draw the popup on_click gui for the player; do not call manuley must use other functions to call +--draw the popup on_click GUI for the player; do not call manually must use other functions to call function draw_frame.popup_button(player,element) local frame_data = nil for _,frame in pairs(frames.popup) do if element.name == frame[1] then frame_data = frame break end end diff --git a/locale/ExpGaming-Core/GUI/ExpGaming - Toolbar.lua b/locale/ExpGaming-Core/GUI/ExpGaming - Toolbar.lua index e52ae2f3..e56f7942 100644 --- a/locale/ExpGaming-Core/GUI/ExpGaming - Toolbar.lua +++ b/locale/ExpGaming-Core/GUI/ExpGaming - Toolbar.lua @@ -41,7 +41,7 @@ function toolbar.draw(player) end end end ---auto redraw toolbar after new rank is given +--auto-redraw toolbar after new rank is given Event.register(Event.rank_change,function(event) toolbar.draw(event.player) end) --Please Only Edit Above This Line----------------------------------------------------------- return credits \ No newline at end of file diff --git a/locale/ExpGaming-Core/GUI/file-header.lua b/locale/ExpGaming-Core/GUI/file-header.lua index 268d6da4..33d297ac 100644 --- a/locale/ExpGaming-Core/GUI/file-header.lua +++ b/locale/ExpGaming-Core/GUI/file-header.lua @@ -18,7 +18,7 @@ local credits = {{ }} local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits,cred) end end --Please Only Edit Below This Line----------------------------------------------------------- -credit_loop(require("ExpGaming - Modlue Setup")) +credit_loop(require("ExpGaming - Module Setup")) credit_loop(require("ExpGaming - Inputs")) credit_loop(require("ExpGaming - Toolbar")) credit_loop(require("ExpGaming - Center Gui")) diff --git a/locale/ExpGaming-Core/file-header.lua b/locale/ExpGaming-Core/file-header.lua index 275144b0..1fb889cd 100644 --- a/locale/ExpGaming-Core/file-header.lua +++ b/locale/ExpGaming-Core/file-header.lua @@ -18,7 +18,7 @@ local credits = {{ }} local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits,cred) end end --Please Only Edit Below This Line----------------------------------------------------------- ---as this is the core file the order in which the files are loaded does matter do not change +--As this is the core file, the order in which the files are loaded does matter. Do not change! credit_loop(require("ExpGaming - Lib")) credit_loop(require("ExpGaming - Rank Table")) credit_loop(require("ExpGaming - Rank Presets"))