mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 20:41:41 +09:00
Spell check
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user