mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-28 12:05:21 +09:00
Doc Added
This commit is contained in:
@@ -38,7 +38,7 @@ end
|
||||
--- Used to open a center frame for a player
|
||||
-- @usage Gui.center.open(player,'server-info') -- return true
|
||||
-- @param player a player indifier to get the flow for
|
||||
-- @tparam center string the name of the center frame to open
|
||||
-- @tparam string center the name of the center frame to open
|
||||
-- @treturn boelon based on if it successed or not
|
||||
function center.open(player,center)
|
||||
local player = Game.get_player(player)
|
||||
@@ -54,8 +54,8 @@ end
|
||||
--- Used to open a center frame for a player
|
||||
-- @usage Gui.center.open_tab(player,'readme','rules') -- return true
|
||||
-- @param player a player indifier to get the flow for
|
||||
-- @tparam center string the name of the center frame to open
|
||||
-- @tparam tab string the name of the tab to open
|
||||
-- @tparam string center the name of the center frame to open
|
||||
-- @tparam string tab the name of the tab to open
|
||||
-- @treturn boelon based on if it successed or not
|
||||
function center.open_tab(player,center,tab)
|
||||
local player = Game.get_player(player)
|
||||
|
||||
@@ -182,9 +182,9 @@ end
|
||||
--- Used to define a choose-elem-button callback only on elem_changed
|
||||
-- @usage Gui.inputs.add_elem_button('test','Test','Just for testing',function)
|
||||
-- @tparam string name the name of this button
|
||||
-- @tparam string the display for this button, either text or sprite path
|
||||
-- @tparam string elem_type the display for this button, either text or sprite path
|
||||
-- @tparam string tooltip the tooltip to show on the button
|
||||
-- @tparam function the callback to call on change function(player,element,elem)
|
||||
-- @tparam function callback the callback to call on change function(player,element,elem)
|
||||
-- @treturn table the button object that was made, to allow a custom error event if wanted
|
||||
function inputs.add_elem_button(name,elem_type,tooltip,callback)
|
||||
local button = inputs.add{
|
||||
@@ -210,9 +210,11 @@ end
|
||||
--- Used to define a checkbox callback only on state_changed
|
||||
-- @usage Gui.inputs.add_checkbox('test',false,'Just for testing',function,function,funvtion)
|
||||
-- @tparam string name the name of this button
|
||||
-- @tparam string the display for this button, either text or sprite path
|
||||
-- @tparam string tooltip the tooltip to show on the button
|
||||
-- @tparam function the callback to call on change function(player,element,elem)
|
||||
-- @tparam boolean radio if this is a radio button
|
||||
-- @tparam string display the display for this button, either text or sprite path
|
||||
-- @tparam function default the callback which choses the default check state
|
||||
-- @tparam function callback_true the callback to call when changed to true
|
||||
-- @tparam function callback_false the callback to call when changed to false
|
||||
-- @treturn table the button object that was made, to allow a custom error event if wanted
|
||||
function inputs.add_checkbox(name,radio,display,default,callback_true,callback_false)
|
||||
local type = 'checkbox'; if radio then type='radiobutton' end
|
||||
@@ -279,7 +281,7 @@ end
|
||||
-- @tparam string name the name of this button
|
||||
-- @tparam boolean box is it a text box rather than a text field
|
||||
-- @tparam string text the starting text
|
||||
-- @tparam function the callback to call on change function(player,text,element)
|
||||
-- @tparam function callback the callback to call on change function(player,text,element)
|
||||
-- @treturn table the text object that was made, to allow a custom error event if wanted
|
||||
function inputs.add_text(name,box,text,callback)
|
||||
local type = 'textfield'; if box then type='text-box' end
|
||||
@@ -305,10 +307,10 @@ end
|
||||
--- Used to define a slider callback only on value_changed
|
||||
-- @usage Gui.inputs.add_slider('test','horizontal',1,10,5,function)
|
||||
-- @tparam string name the name of this button
|
||||
-- @tapram string text the caption to go with the slider
|
||||
-- @tparam string orientation direction of the slider
|
||||
-- @tparam number min the lowest number
|
||||
-- @tparam number max the highest number
|
||||
-- @param start_callback either a number or a function to return a number
|
||||
-- @tparam function start_callback either a number or a function to return a number
|
||||
-- @tparam function callback the function to be called on value_changed function(player,value,percent,element)
|
||||
-- @treturn table the slider object that was made, to allow a custom error event if wanted
|
||||
function inputs.add_slider(name,orientation,min,max,start_callback,callback)
|
||||
@@ -338,6 +340,7 @@ end
|
||||
|
||||
--- Used to define a drop down callback only on value_changed
|
||||
-- @usage Gui.inputs.add_drop_down('test',{1,2,3},1,function)
|
||||
-- @tparam string name name of the drop down
|
||||
-- @param items either a list or a function which returns a list
|
||||
-- @param index either a number or a function which returns a number
|
||||
-- @tparam function callback the callback which is called when a new index is selected function(player,selected,items,element)
|
||||
|
||||
@@ -13,7 +13,7 @@ local toolbar = {}
|
||||
-- @usage toolbar.add('foo','Foo','Test',function() game.print('test') end)
|
||||
-- @tparam string name the name of the button
|
||||
-- @tparam string caption can be a sprite path or text to show
|
||||
-- @tparma string tooltip the help to show for the button
|
||||
-- @tparam string tooltip the help to show for the button
|
||||
-- @tparam function callback the function which is called on_click
|
||||
-- @treturn table the button object that was made
|
||||
function toolbar.add(name,caption,tooltip,callback)
|
||||
|
||||
@@ -76,7 +76,7 @@ end
|
||||
|
||||
--- Used to call the custom commands
|
||||
-- @usage You dont its an internal command
|
||||
-- @tparam defines.events.on_console_command event the event rasied by the command=
|
||||
-- @tparam defines.events.on_console_command command the event rasied by the command
|
||||
local function run_custom_command(command)
|
||||
local command_data = command_data[command.name]
|
||||
local player_name = Game.get_player(command) and Game.get_player(command).name or 'server'
|
||||
|
||||
@@ -97,14 +97,15 @@ end)
|
||||
--- Adds a camera that updates every tick (or less depeading on how many are opening) it will move to follow an entity
|
||||
-- @usage Gui.cam_link{entity=game.player.character,frame=frame,width=50,hight=50,zoom=1}
|
||||
-- @usage Gui.cam_link{entity=game.player.character,cam=frame.camera,surface=game.surfaces['testing']}
|
||||
-- @param entity this is the entity that the camera will follow
|
||||
-- @param[opt] cam a camera that you already have in the gui
|
||||
-- @param[opt] frame the frame to add the camera to, no effect if cam param is given
|
||||
-- @param[chain=frame] zoom the zoom to give the new camera
|
||||
-- @param[chain=frame] width the width to give the new camera
|
||||
-- @param[chain=frame] height the height to give the new camera
|
||||
-- @param[opt] surface this will over ride the surface that the camera follows on, allowing for a 'ghost surface' while keeping same position
|
||||
-- @param[opt] respawn_open if set to true then the camera will auto re link to the player after a respawn
|
||||
-- @tparam table data contains all other params given below
|
||||
-- @field entity this is the entity that the camera will follow
|
||||
-- @field cam a camera that you already have in the gui
|
||||
-- @field frame the frame to add the camera to, no effect if cam param is given
|
||||
-- @field zoom the zoom to give the new camera
|
||||
-- @field width the width to give the new camera
|
||||
-- @field height the height to give the new camera
|
||||
-- @field surface this will over ride the surface that the camera follows on, allowing for a 'ghost surface' while keeping same position
|
||||
-- @field respawn_open if set to true then the camera will auto re link to the player after a respawn
|
||||
-- @return the camera that the function used be it made or given as a param
|
||||
function Gui.cam_link(data)
|
||||
if not data.entity or not data.entity.valid then return end
|
||||
|
||||
@@ -97,6 +97,7 @@ end
|
||||
-- @usage Ranking.print('admin','We got a grifer')
|
||||
-- @param rank_base the rank that acts as the cut off point (rank is always included)
|
||||
-- @param rtn what do you want to return to the players
|
||||
-- @tparam defines.color colour the colour that will be used to print
|
||||
-- @tparam bolean below if true rank below base are printed to
|
||||
function Ranking.print(rank_base,rtn,colour,below)
|
||||
local colour = colour or defines.color.white
|
||||
@@ -185,7 +186,7 @@ end
|
||||
--- Given the player has a rank in the preset table it is given
|
||||
-- @usage Ranking.find_preset(1)
|
||||
-- @param player the player to test for an auto rank
|
||||
-- @tparam[opt=nil] tick the tick it happens on
|
||||
-- @tparam[opt=nil] number tick the tick it happens on
|
||||
function Ranking.find_preset(player,tick)
|
||||
local presets = Ranking._presets().current
|
||||
local meta_data = Ranking._presets().meta
|
||||
@@ -250,6 +251,8 @@ end
|
||||
--- Print a message to all players of this rank
|
||||
-- @usage rank:print('foo')
|
||||
-- @param rtn any value you want to return
|
||||
-- @tparam define.color colour the colour that will be used to print
|
||||
-- @tparam boolean show_default weather to use the default rank name for the print
|
||||
function Ranking._rank:print(rtn,colour,show_default)
|
||||
local colour = colour or defines.color.white
|
||||
local meta_data = Ranking._presets().meta
|
||||
|
||||
@@ -63,8 +63,8 @@ end
|
||||
|
||||
--- Adds a thread into the resolve queue, can be used to lower lag
|
||||
-- @usage Server.queue_thread(thread) -- return true/false
|
||||
-- @tparam table the thread to add to the queue must have a resolve function (must be open)
|
||||
-- @treturn bolean was the thread added
|
||||
-- @tparam table thread_to_queue the thread to add to the queue must have a resolve function (must be open)
|
||||
-- @treturn boolean was the thread added
|
||||
function Server.queue_thread(thread_to_queue)
|
||||
if not thread_to_queue and not thread_to_queue.valid and not thread_to_queue:valid() then return false end
|
||||
if not thread_to_queue._resolve then return false end
|
||||
@@ -87,7 +87,7 @@ function Server.close_all_threads(with_force)
|
||||
end
|
||||
|
||||
--- Runs all the theads which have opened with an on_tick event
|
||||
-- @ussage Server.run_tick_threads()
|
||||
-- @usage Server.run_tick_threads()
|
||||
function Server.run_tick_threads()
|
||||
table.each(Server._threads().tick,function(uuid)
|
||||
local next_thread = Server.get_thread(uuid)
|
||||
@@ -99,7 +99,7 @@ function Server.run_tick_threads()
|
||||
end
|
||||
|
||||
--- Checks the timeout on all active timeout threads
|
||||
-- @ussage Server.check_timeouts()
|
||||
-- @usage Server.check_timeouts()
|
||||
function Server.check_timeouts()
|
||||
table.each(Server._threads().timeout,function(uuid)
|
||||
local next_thread = Server.get_thread(uuid)
|
||||
|
||||
@@ -29,7 +29,7 @@ end
|
||||
-- @param player_message the message to be printed in chat
|
||||
-- @param player_name the name of the player sending the message
|
||||
-- @param[opt] player_tag the tag apllied to the player's name
|
||||
-- @param[opt] plyaer_colour the colour of the message
|
||||
-- @param[opt] player_colour the colour of the message
|
||||
-- @param[opt] prefix add a prefix before the chat eg [IRC]
|
||||
function Sync.print(player_message,player_name,player_tag,player_colour,prefix)
|
||||
if not player_message then return 'No Message Found' end
|
||||
@@ -53,13 +53,13 @@ end
|
||||
|
||||
--- Logs an embed to the json.data we use a js script to add things we cant here
|
||||
-- @usage Sync.emit_embeded{title='BAN',color='0x0',description='A player was banned' ... }
|
||||
-- @tparam table arg a table which contains everything that the embeded will use
|
||||
-- @param[opt=''] title the tile of the embed
|
||||
-- @param[opt='0x0'] color the color given in hex you can use Color.to_hex{r=0,g=0,b=0}
|
||||
-- @param[opt=''] description the description of the embed
|
||||
-- @param[opt=''] server_detail sting to add onto the pre-set server detail
|
||||
-- @param[opt] fieldone the filed to add to the embed (key is name) (value is text) (start value with <<inline>> to make inline)
|
||||
-- @param[optchain] fieldtwo
|
||||
-- @tparam table args a table which contains everything that the embeded will use
|
||||
-- @field title the tile of the embed
|
||||
-- @field color the color given in hex you can use Color.to_hex{r=0,g=0,b=0}
|
||||
-- @field description the description of the embed
|
||||
-- @field server_detail sting to add onto the pre-set server detail
|
||||
-- @field fieldone the filed to add to the embed (key is name) (value is text) (start value with <<inline>> to make inline)
|
||||
-- @field fieldtwo the filed to add to the embed (key is name) (value is text) (start value with <<inline>> to make inline)
|
||||
function Sync.emit_embeded(args)
|
||||
if not is_type(args,'table') then return end
|
||||
local title = is_type(args.title,'string') and args.title or ''
|
||||
@@ -166,7 +166,7 @@ end
|
||||
|
||||
--- used to return the global list and set values in it
|
||||
-- @usage Sync.info{server_name='Factorio Server 2'}
|
||||
-- @tparam[opt=nil] table keys to be replaced in the server info
|
||||
-- @tparam[opt=nil] table set keys to be replaced in the server info
|
||||
-- @return either returns success when setting or the info when not setting
|
||||
function Sync.info(set)
|
||||
if not global.exp_core then global.exp_core = {} end
|
||||
@@ -203,7 +203,7 @@ end
|
||||
|
||||
--- used to return the global time and set its value
|
||||
-- @usage Sync.time('Sun Apr 1 18:44:30 UTC 2018')
|
||||
-- @tparam[opt=nil] string the date time to be set
|
||||
-- @tparam[opt=nil] string set the date time to be set
|
||||
-- @return either true false if setting or the date time and tick off set
|
||||
function Sync.time(set)
|
||||
local info = Sync.info()
|
||||
@@ -242,8 +242,8 @@ end
|
||||
|
||||
--- Adds a callback to be called when the info is updated
|
||||
-- @usage Sync.add_update('players',function() return #game.players end)
|
||||
-- @tparam key string the key that the value will be stored in
|
||||
-- @tparam callback function the function which will return this value
|
||||
-- @tparam string key the key that the value will be stored in
|
||||
-- @tparam function callback the function which will return this value
|
||||
function Sync.add_update(key,callback)
|
||||
if game then return end
|
||||
if not is_type(callback,'function') then return end
|
||||
|
||||
Reference in New Issue
Block a user