mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Merge Conflicts
This commit is contained in:
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "Factorio-luacheckrc"]
|
||||
path = Factorio-luacheckrc
|
||||
url = https://github.com/Nexela/Factorio-luacheckrc
|
||||
31
.vscode/settings.json
vendored
Normal file
31
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"cSpell.enabledLanguageIds": [
|
||||
"asciidoc",
|
||||
"c",
|
||||
"cpp",
|
||||
"csharp",
|
||||
"css",
|
||||
"go",
|
||||
"handlebars",
|
||||
"html",
|
||||
"jade",
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"json",
|
||||
"latex",
|
||||
"less",
|
||||
"lua",
|
||||
"markdown",
|
||||
"php",
|
||||
"plaintext",
|
||||
"pub",
|
||||
"python",
|
||||
"restructuredtext",
|
||||
"rust",
|
||||
"scss",
|
||||
"text",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"yml"
|
||||
]
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
-- This file just contains all the diffrent requires
|
||||
|
||||
-- Admin dir
|
||||
verbose('Begain Admin Loading')
|
||||
require('Admin/player-info')
|
||||
require('Admin/admin') -- Used with Guis/admin-gui, but can work without
|
||||
require('Admin/reports') -- This adds onto Admin/admin, adds report command and warnings, and temp ban
|
||||
require('Admin/discord')
|
||||
require('Admin/auto-message')
|
||||
require('Admin/tree-decon')
|
||||
require('Admin/inventory-search')
|
||||
require('Admin/base-damage')
|
||||
require('Admin/afk-kick')
|
||||
require('Admin/auto-chat')
|
||||
|
||||
-- Commands dir
|
||||
verbose('Begain Command Loading')
|
||||
require('Commands/cheat-mode')
|
||||
require('Commands/kill')
|
||||
require('Commands/repair')
|
||||
require('Commands/bonus')
|
||||
require('Commands/tags')
|
||||
require('Commands/home')
|
||||
require('Commands/tp') -- Requires Admin/admin
|
||||
require('Commands/admin') -- Requires Admin/reports
|
||||
|
||||
-- GUIs dir
|
||||
verbose('Begain Gui Loading')
|
||||
require('Guis/readme')
|
||||
require('Guis/science')
|
||||
require('Guis/rockets')
|
||||
require('Guis/player-list')
|
||||
require('Guis/tasklist')
|
||||
require('Guis/warp-system')
|
||||
require('Guis/polls') -- Too many desyncs
|
||||
require('Guis/announcements')
|
||||
require('Guis/rank-changer')
|
||||
require('Guis/admin-gui') -- Used with Admin/admin, requires Admin/admin
|
||||
require('Guis/reports') -- Requires Admin/reports
|
||||
require('Guis/game-settings')
|
||||
@@ -1,307 +0,0 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
|
||||
--[[
|
||||
How to use groups:
|
||||
name The name that you can use to reference it.
|
||||
disallow If present then all ranks in this group will have this added to their disallow.
|
||||
allow If present then all ranks in this group will have this added to their allow.
|
||||
highest Assigned by the script to show the highest rank in this group.
|
||||
lowest Assigned by the script to show the lowest rank in this group.
|
||||
How to add ranks:
|
||||
Name What will be used in the scripts and is often the best choice for display in text.
|
||||
short_hand What can be used when short on space but the rank still need to be displayed.
|
||||
tag The tag the player will gain when moved to the rank, it can be nil.
|
||||
time Used for auto-rank feature where you are moved to the rank after a certain play time in minutes.
|
||||
colour The RGB value that can be used to emphasise GUI elements based on rank.
|
||||
power Assigned by the script based on their index in ranks, you can insert new ranks between current ones.
|
||||
group Assigned by the script to show the group this rank is in.
|
||||
disallow A list containing input actions that the user can not perform.
|
||||
allow A list of custom commands and effects that that rank can use, all defined in the scripts.
|
||||
|
||||
For allow, add the allow as the key and the value as true
|
||||
Example: test for 'server-interface' => allow['server-interface'] = true
|
||||
|
||||
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
|
||||
--]]
|
||||
|
||||
-- See ExpCore/ranks.lua for examples - you add your own and edit pre-made ones here.
|
||||
|
||||
Ranking._group:create{
|
||||
name='Donator',
|
||||
allow={},
|
||||
disallow={
|
||||
'set_allow_commands',
|
||||
'edit_permission_group',
|
||||
'delete_permission_group',
|
||||
'add_permission_group'
|
||||
}
|
||||
}
|
||||
|
||||
local groups = Ranking._groups(true)
|
||||
|
||||
groups['Root']:edit('allow',false,{
|
||||
['player-list']=true,
|
||||
['readme']=true,
|
||||
['rockets']=true,
|
||||
['science']=true,
|
||||
['tasklist']=true,
|
||||
['rank-changer']=true,
|
||||
['admin-commands']=true,
|
||||
['warn']=true,
|
||||
['temp-ban']=true,
|
||||
['clear-warings']=true,
|
||||
['clear-reports']=true,
|
||||
['clear-all']=true,
|
||||
['clear-inv']=true,
|
||||
['announcements']=true,
|
||||
['warp-list']=true,
|
||||
['polls']=true,
|
||||
['admin-items']=true,
|
||||
['all-items']=true,
|
||||
['repair']=true,
|
||||
['global-chat']=true,
|
||||
['set-home']=true,
|
||||
['home']=true,
|
||||
['return']=true,
|
||||
})
|
||||
groups['Admin']:edit('allow',false,{
|
||||
['player-list']=true,
|
||||
['readme']=true,
|
||||
['rockets']=true,
|
||||
['science']=true,
|
||||
['tasklist']=true,
|
||||
['rank-changer']=true,
|
||||
['admin-commands']=true,
|
||||
['warn']=true,
|
||||
['temp-ban']=true,
|
||||
['clear-warings']=true,
|
||||
['clear-reports']=true,
|
||||
['clear-all']=true,
|
||||
['clear-inv']=true,
|
||||
['announcements']=true,
|
||||
['warp-list']=true,
|
||||
['polls']=true,
|
||||
['global-chat']=true,
|
||||
['set-home']=true,
|
||||
['home']=true,
|
||||
['return']=true,
|
||||
})
|
||||
groups['Donator']:edit('allow',false,{
|
||||
['player-list']=true,
|
||||
['readme']=true,
|
||||
['rockets']=true,
|
||||
['science']=true,
|
||||
['tasklist']=true,
|
||||
['report']=true,
|
||||
['warp-list']=true,
|
||||
['polls']=true,
|
||||
['global-chat']=true,
|
||||
['set-home']=true,
|
||||
['home']=true,
|
||||
['return']=true,
|
||||
})
|
||||
groups['User']:edit('allow',false,{
|
||||
['player-list']=true,
|
||||
['readme']=true,
|
||||
['rockets']=true,
|
||||
['science']=true,
|
||||
['tasklist']=true,
|
||||
['report']=true,
|
||||
['warp-list']=true,
|
||||
['polls']=true
|
||||
})
|
||||
groups['Jail']:edit('allow',false,{
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
groups['Root']:add_rank{
|
||||
name='Owner',
|
||||
short_hand='Owner',
|
||||
tag='[Owner]',
|
||||
time=nil,
|
||||
colour={r=170,g=0,b=0},
|
||||
is_admin = true,
|
||||
is_spectator=true,
|
||||
base_afk_time=false
|
||||
}
|
||||
groups['Root']:add_rank{
|
||||
name='Community Manager',
|
||||
short_hand='Com Mngr',
|
||||
tag='[Com Mngr]',
|
||||
colour={r=150,g=68,b=161},
|
||||
is_admin = true,
|
||||
is_spectator=true,
|
||||
base_afk_time=false
|
||||
}
|
||||
groups['Root']:add_rank{
|
||||
name='Developer',
|
||||
short_hand='Dev',
|
||||
tag='[Dev]',
|
||||
colour={r=179,g=125,b=46},
|
||||
is_admin = true,
|
||||
is_spectator=true,
|
||||
base_afk_time=false
|
||||
}
|
||||
|
||||
groups['Admin']:add_rank{
|
||||
name='Mod',
|
||||
short_hand='Mod',
|
||||
tag='[Mod]',
|
||||
colour={r=0,g=170,b=0},
|
||||
disallow={
|
||||
'server_command'
|
||||
},
|
||||
is_admin = true,
|
||||
is_spectator=true,
|
||||
base_afk_time=false
|
||||
}
|
||||
groups['Admin']:add_rank{
|
||||
name='Trainee',
|
||||
short_hand='TrMod',
|
||||
tag='[Trainee]',
|
||||
colour={r=0,g=196,b=137},
|
||||
disallow={
|
||||
'server_command'
|
||||
},
|
||||
is_spectator=true,
|
||||
base_afk_time=false
|
||||
}
|
||||
|
||||
groups['Donator']:add_rank{
|
||||
name='Sponsor',
|
||||
short_hand='Spon',
|
||||
tag='[Sponsor]',
|
||||
colour={r=247,g=246,b=54},
|
||||
power=8,
|
||||
is_spectator=true,
|
||||
base_afk_time=false
|
||||
}
|
||||
groups['Donator']:add_rank{
|
||||
name='Pay to Win',
|
||||
short_hand='P2W',
|
||||
tag='[P2W]',
|
||||
colour={r=238,g=172,b=44},
|
||||
is_spectator=true,
|
||||
base_afk_time=160
|
||||
}
|
||||
groups['Donator']:add_rank{
|
||||
name='Donator',
|
||||
short_hand='Don',
|
||||
tag='[Donator]',
|
||||
colour={r=230,g=99,b=34},
|
||||
is_spectator=true,
|
||||
base_afk_time=120
|
||||
}
|
||||
|
||||
groups['User']:add_rank{
|
||||
name='Partner',
|
||||
short_hand='Part',
|
||||
tag='[Partner]',
|
||||
power=0,
|
||||
colour={r=140,g=120,b=200},
|
||||
base_afk_time=120
|
||||
}
|
||||
groups['User']:add_rank{
|
||||
name='Veteran',
|
||||
short_hand='Vet',
|
||||
tag='[Veteran]',
|
||||
time=600,
|
||||
power=1,
|
||||
colour={r=26,g=118,b=156},
|
||||
base_afk_time=60
|
||||
}
|
||||
groups['User']:add_rank{
|
||||
name='Regular',
|
||||
short_hand='Reg',
|
||||
tag='[Regular]',
|
||||
time=180,
|
||||
colour={r=79,g=155,b=163},
|
||||
power=3,
|
||||
base_afk_time=30
|
||||
}
|
||||
|
||||
local ranks = Ranking._ranks(true)
|
||||
|
||||
ranks['Developer']:edit('allow',false,{
|
||||
['cheat-mode']=true
|
||||
})
|
||||
|
||||
ranks['Admin']:edit('allow',false,{
|
||||
['game-settings']=true,
|
||||
['always-warp']=true,
|
||||
['admin-items']=true
|
||||
})
|
||||
ranks['Mod']:edit('allow',false,{
|
||||
['go-to']=true,
|
||||
['bring']=true,
|
||||
['no-report']=true
|
||||
})
|
||||
ranks['Trainee']:edit('allow',false,{
|
||||
['go-to']=true,
|
||||
['bring']=true,
|
||||
['no-report']=true
|
||||
})
|
||||
|
||||
ranks['Sponsor']:edit('allow',false,{
|
||||
['jail']=true,
|
||||
['unjail']=true,
|
||||
['bonus']=true,
|
||||
['bonus-respawn']=true
|
||||
})
|
||||
ranks['Pay to Win']:edit('allow',false,{
|
||||
['jail']=true,
|
||||
['unjail']=true,
|
||||
['bonus']=true,
|
||||
['bonus-respawn']=true
|
||||
})
|
||||
ranks['Donator']:edit('allow',false,{
|
||||
|
||||
})
|
||||
|
||||
ranks['Partner']:edit('allow',false,{
|
||||
['global-chat']=true
|
||||
})
|
||||
ranks['Veteran']:edit('allow',false,{
|
||||
['tree-decon']=true,
|
||||
['create-poll']=true,
|
||||
['repair']=true
|
||||
})
|
||||
ranks['Member']:edit('allow',false,{
|
||||
['edit-tasklist']=true,
|
||||
['make-warp']=true,
|
||||
['nuke']=true,
|
||||
['base-damage']=true,
|
||||
['varified']=true
|
||||
})
|
||||
ranks['Regular']:edit('allow',false,{
|
||||
['kill']=true,
|
||||
['decon']=true,
|
||||
['capsules']=true
|
||||
})
|
||||
ranks['Guest']:edit('allow',false,{
|
||||
['tag']=true,
|
||||
['tag-clear']=true,
|
||||
['report']=true
|
||||
})
|
||||
|
||||
Ranking._base_preset{
|
||||
['badgamernl']='Owner',
|
||||
['arty714']='Community Manager',
|
||||
['cooldude2606']='Developer',
|
||||
['mark9064']='Admin',
|
||||
['Drahc_pro']='Admin',
|
||||
['propangaseddy']='Admin',
|
||||
['aldldl']='Admin'
|
||||
}
|
||||
37
Boiler Print Module
Normal file
37
Boiler Print Module
Normal file
@@ -0,0 +1,37 @@
|
||||
--- Desction <get from json>
|
||||
-- @module ThisModule@X.Y.Z
|
||||
-- @author <get from json>
|
||||
-- @license <get from json>
|
||||
-- @alias ThisModule
|
||||
|
||||
-- Module Require
|
||||
local Module = require('Module')
|
||||
local SubModule = require('Collection.Submodule')
|
||||
local OptModule -- OptModule@^X.Y.Z
|
||||
|
||||
-- Local Variables
|
||||
|
||||
-- Module Define
|
||||
local module_verbose = false
|
||||
local ThisModule = {
|
||||
on_init=function(self)
|
||||
if loaded_modules['OptModule'] then OptModule = require('OptModule') end
|
||||
if loaded_modules['OptModule2'] then require(module_path..'/src/module2',{self=self}) end
|
||||
--code
|
||||
end,
|
||||
on_post=function()
|
||||
--code
|
||||
end
|
||||
}
|
||||
|
||||
-- Global Define
|
||||
local global = global{
|
||||
key='value'
|
||||
}
|
||||
|
||||
-- Function Define
|
||||
|
||||
-- Event Handlers Define
|
||||
|
||||
-- Module Return
|
||||
return ThisModule
|
||||
@@ -1,209 +0,0 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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
|
||||
]]
|
||||
|
||||
local center = {}
|
||||
center._center = {}
|
||||
|
||||
--- Adds a new obj to the center gui
|
||||
-- @usage Gui.center.add{name='foo',caption='Foo',tooltip='Testing',draw=function}
|
||||
-- @param obj contains the new object, needs name, fraw is opt and is function(root_frame)
|
||||
-- @return the object made, used to add tabs
|
||||
function center.add(obj)
|
||||
if not is_type(obj,'table') then return end
|
||||
if not is_type(obj.name,'string') then return end
|
||||
verbose('Created Center Gui: '..obj.name)
|
||||
setmetatable(obj,{__index=center._center})
|
||||
obj.tabs = {}
|
||||
obj._tabs = {}
|
||||
Gui._add_data('center',obj.name,obj)
|
||||
Gui.toolbar.add(obj.name,obj.caption,obj.tooltip,obj.open)
|
||||
return obj
|
||||
end
|
||||
|
||||
--- Used to get the center frame of the player, used mainly in script
|
||||
-- @usage Gui.center.get_flow(player) -- returns gui emelemt
|
||||
-- @param player a player indifier to get the flow for
|
||||
-- @treturn table the gui element flow
|
||||
function center.get_flow(player)
|
||||
local player = Game.get_player(player)
|
||||
return player.gui.center.exp_center or player.gui.center.add{name='exp_center',type='flow'}
|
||||
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
|
||||
-- @treturn boelon based on if it successed or not
|
||||
function center.open(player,center)
|
||||
local player = Game.get_player(player)
|
||||
Gui.center.clear(player)
|
||||
if not Gui._get_data('center')[center] then return false end
|
||||
Gui._get_data('center')[center].open{
|
||||
element={name=center},
|
||||
player_index=player.index
|
||||
}
|
||||
return true
|
||||
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
|
||||
-- @treturn boelon based on if it successed or not
|
||||
function center.open_tab(player,center,tab)
|
||||
local player = Game.get_player(player)
|
||||
if not Gui.center.open(player,center) then return false end
|
||||
local name = center..'_'..tab
|
||||
if not Gui._get_data('inputs_button')[name] then return false end
|
||||
Gui._get_data('inputs_button')[name].events[defines.events.on_gui_click]{
|
||||
element=Gui.center.get_flow(player)[center].tab_bar.tab_bar_scroll.tab_bar_scroll_flow[name],
|
||||
}
|
||||
return true
|
||||
end
|
||||
|
||||
--- Used to clear the center frame of the player, used mainly in script
|
||||
-- @usage Gui.center.clear(player)
|
||||
-- @param player a player indifier to get the flow for
|
||||
function center.clear(player)
|
||||
local player = Game.get_player(player)
|
||||
center.get_flow(player).clear()
|
||||
end
|
||||
|
||||
-- used on the button press when the toolbar button is press, can be overriden
|
||||
-- not recomented for direct use see Gui.center.open
|
||||
function center._center.open(event)
|
||||
local player = Game.get_player(event)
|
||||
local _center = Gui._get_data('center')[event.element.name]
|
||||
local center_flow = center.get_flow(player)
|
||||
if center_flow[_center.name] then Gui.center.clear(player) return end
|
||||
local center_frame = center_flow.add{
|
||||
name=_center.name,
|
||||
type='frame',
|
||||
caption=_center.caption,
|
||||
direction='vertical',
|
||||
style=mod_gui.frame_style
|
||||
}
|
||||
if is_type(center_frame.caption,'string') and player.gui.is_valid_sprite_path(center_frame.caption) then center_frame.caption = '' end
|
||||
if is_type(_center.draw,'function') then
|
||||
local success, err = pcall(_center.draw,_center,center_frame)
|
||||
if not success then error(err) end
|
||||
else error('No Callback on center frame '.._center.name)
|
||||
end
|
||||
player.opened=center_frame
|
||||
end
|
||||
|
||||
-- this is the default draw function if one is not provided, can be overriden
|
||||
-- not recomented for direct use see Gui.center.open
|
||||
function center._center:draw(frame)
|
||||
Gui.bar(frame,510)
|
||||
local tab_bar = frame.add{
|
||||
type='frame',
|
||||
name='tab_bar',
|
||||
style='image_frame',
|
||||
direction='vertical'
|
||||
}
|
||||
tab_bar.style.width = 510
|
||||
tab_bar.style.height = 65
|
||||
local tab_bar_scroll = tab_bar.add{
|
||||
type='scroll-pane',
|
||||
name='tab_bar_scroll',
|
||||
horizontal_scroll_policy='auto-and-reserve-space',
|
||||
vertical_scroll_policy='never'
|
||||
}
|
||||
tab_bar_scroll.style.vertically_squashable = false
|
||||
tab_bar_scroll.style.vertically_stretchable = true
|
||||
tab_bar_scroll.style.width = 500
|
||||
local tab_bar_scroll_flow = tab_bar_scroll.add{
|
||||
type='flow',
|
||||
name='tab_bar_scroll_flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
Gui.bar(frame,510)
|
||||
local tab = frame.add{
|
||||
type ='frame',
|
||||
name='tab',
|
||||
direction='vertical',
|
||||
style='image_frame'
|
||||
}
|
||||
tab.style.width = 510
|
||||
tab.style.height = 305
|
||||
local tab_scroll = tab.add{
|
||||
type ='scroll-pane',
|
||||
name='tab_scroll',
|
||||
horizontal_scroll_policy='never',
|
||||
vertical_scroll_policy='auto'
|
||||
}
|
||||
tab_scroll.style.vertically_squashable = false
|
||||
tab_scroll.style.vertically_stretchable = true
|
||||
tab_scroll.style.width = 500
|
||||
local tab_scroll_flow = tab_scroll.add{
|
||||
type='flow',
|
||||
name='tab_scroll_flow',
|
||||
direction='vertical'
|
||||
}
|
||||
tab_scroll_flow.style.width = 480
|
||||
Gui.bar(frame,510)
|
||||
local first_tab = nil
|
||||
for name,button in pairs(self.tabs) do
|
||||
first_tab = first_tab or name
|
||||
button:draw(tab_bar_scroll_flow).style.font_color = defines.color.white
|
||||
end
|
||||
self._tabs[self.name..'_'..first_tab](tab_scroll_flow)
|
||||
tab_bar_scroll_flow.children[1].style.font_color = defines.color.orange
|
||||
frame.parent.add{type='frame',name='temp'}.destroy()--recenter the GUI
|
||||
end
|
||||
|
||||
--- If deafult draw is used then you can add tabs to the gui with this function
|
||||
-- @usage _center:add_tab('foo','Foo','Just a tab',function)
|
||||
-- @tparam string name this is the name of the tab
|
||||
-- @tparam string caption this is the words that appear on the tab button
|
||||
-- @tparam[opt] string tooltip the tooltip that is on the button
|
||||
-- @tparam function callback this is called when button is pressed with function(root_frame)
|
||||
-- @return self to allow chaining of _center:add_tab
|
||||
function center._center:add_tab(name,caption,tooltip,callback)
|
||||
verbose('Created Tab: '..self.name..'/'..name)
|
||||
self._tabs[self.name..'_'..name] = callback
|
||||
self.tabs[name] = Gui.inputs.add{
|
||||
type='button',
|
||||
name=self.name..'_'..name,
|
||||
caption=caption,
|
||||
tooltip=tooltip
|
||||
}:on_event('click',function(event)
|
||||
local tab = event.element.parent.parent.parent.parent.tab.tab_scroll.tab_scroll_flow
|
||||
tab.clear()
|
||||
local frame_name = tab.parent.parent.parent.name
|
||||
local _center = Gui._get_data('center')[frame_name]
|
||||
local _tab = _center._tabs[event.element.name]
|
||||
if is_type(_tab,'function') then
|
||||
for _,button in pairs(event.element.parent.children) do
|
||||
if button.name == event.element.name then
|
||||
button.style.font_color = defines.color.orange
|
||||
else
|
||||
button.style.font_color = defines.color.white
|
||||
end
|
||||
end
|
||||
local success, err = pcall(_tab,tab)
|
||||
if not success then error(err) end
|
||||
end
|
||||
end)
|
||||
return self
|
||||
end
|
||||
|
||||
-- used so that when gui close key is pressed this will close the gui
|
||||
Event.register(defines.events.on_gui_closed,function(event)
|
||||
if event.element and event.element.valid then event.element.destroy() end
|
||||
end)
|
||||
|
||||
-- when the player rank is changed it closses the center guis
|
||||
if defines.events.rank_change then
|
||||
Event.register(defines.events.rank_change,center.clear)
|
||||
end
|
||||
|
||||
return center
|
||||
@@ -1,177 +0,0 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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
|
||||
]]
|
||||
|
||||
local left = {}
|
||||
left._left = {}
|
||||
|
||||
-- used for debugging
|
||||
function left.override_open(state)
|
||||
Gui._global().over_ride_left_can_open = state
|
||||
end
|
||||
--- Used to add a left gui frame
|
||||
-- @usage Gui.left.add{name='foo',caption='Foo',tooltip='just testing',open_on_join=true,can_open=function,draw=function}
|
||||
-- @param obj this is what will be made, needs a name and a draw function(root_frame), open_on_join can be used to set the deaful state true/false, can_open is a test to block it from opening but is not needed
|
||||
-- @return the object that is made to... well idk but for the future
|
||||
function left.add(obj)
|
||||
if not is_type(obj,'table') then return end
|
||||
if not is_type(obj.name,'string') then return end
|
||||
verbose('Created Left Gui: '..obj.name)
|
||||
setmetatable(obj,{__index=left._left})
|
||||
Gui._add_data('left',obj.name,obj)
|
||||
Gui.toolbar.add(obj.name,obj.caption,obj.tooltip,obj.toggle)
|
||||
return obj
|
||||
end
|
||||
|
||||
--- This is used to update all the guis of conected players, good idea to use our thread system as it as nested for loops
|
||||
-- @usage Gui.left.update()
|
||||
-- @tparam[opt] string frame this is the name of a frame if you only want to update one
|
||||
-- @param[opt] players the player to update for, if not given all players are updated, can be one player
|
||||
function left.update(frame,players)
|
||||
if not Server or not Server._thread then
|
||||
local players = is_type(players,'table') and #players > 0 and {unpack(players)} or is_type(players,'table') and {players} or Game.get_player(players) and {Game.get_player(players)} or game.connected_players
|
||||
for _,player in pairs(players) do
|
||||
local frames = Gui._get_data('left') or {}
|
||||
if frame then frames = {[frame]=frames[frame]} or {} end
|
||||
for name,left in pairs(frames) do
|
||||
if _left then
|
||||
local fake_event = {player_index=player.index,element={name=name}}
|
||||
left.open(fake_event)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
local frames = Gui._get_data('left') or {}
|
||||
if frame then frames = {[frame]=frames[frame]} or {} end
|
||||
local players = is_type(players,'table') and #players > 0 and {unpack(players)} or is_type(players,'table') and {players} or Game.get_player(players) and {Game.get_player(players)} or game.connected_players
|
||||
Server.new_thread{
|
||||
data={players=players,frames=frames}
|
||||
}:on_event('tick',function(thread)
|
||||
if #thread.data.players == 0 then thread:close() return end
|
||||
local player = table.remove(thread.data.players,1)
|
||||
Server.new_thread{
|
||||
data={player=player,frames=thread.data.frames}
|
||||
}:on_event('resolve',function(thread)
|
||||
for name,left in pairs(thread.data.frames) do
|
||||
if left then
|
||||
local fake_event = {player_index=thread.data.player.index,element={name=name}}
|
||||
left.open(fake_event)
|
||||
end
|
||||
end
|
||||
end):queue()
|
||||
end):open()
|
||||
end
|
||||
end
|
||||
|
||||
--- Used to open the left gui of every player
|
||||
-- @usage Gui.left.open('foo')
|
||||
-- @tparam string left_name this is the gui that you want to open
|
||||
function left.open(left_name)
|
||||
local _left = Gui._get_data('left')[left_name]
|
||||
if not _left then return end
|
||||
if not Server or not Server._thread then
|
||||
for _,player in pairs(game.connected_players) do
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
if left_flow[_left.name] then left_flow[_left.name].style.visible = true end
|
||||
end
|
||||
else
|
||||
Server.new_thread{
|
||||
data={players=game.connected_players}
|
||||
}:on_event('tick',function(thread)
|
||||
if #thread.data.players == 0 then thread:close() return end
|
||||
local player = table.remove(thread.data.players,1)
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
if left_flow[_left.name] then left_flow[_left.name].style.visible = true end
|
||||
end):open()
|
||||
end
|
||||
end
|
||||
|
||||
--- Used to close the left gui of every player
|
||||
-- @usage Gui.left.close('foo')
|
||||
-- @tparam string left_name this is the gui that you want to close
|
||||
function left.close(left_name)
|
||||
local _left = Gui._get_data('left')[left_name]
|
||||
if not _left then return end
|
||||
if not Server or not Server._thread then
|
||||
for _,player in pairs(game.connected_players) do
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
if left_flow[_left.name] then left_flow[_left.name].style.visible = false end
|
||||
end
|
||||
else
|
||||
Server.new_thread{
|
||||
data={players=game.connected_players}
|
||||
}:on_event('tick',function(thread)
|
||||
if #thread.data.players == 0 then thread:close() return end
|
||||
local player = table.remove(thread.data.players,1)
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
if left_flow[_left.name] then left_flow[_left.name].style.visible = false end
|
||||
end):open()
|
||||
end
|
||||
end
|
||||
|
||||
-- this is used to draw the gui for the first time (these guis are never destoryed), used by the script
|
||||
function left._left.open(event)
|
||||
local player = Game.get_player(event)
|
||||
local _left = Gui._get_data('left')[event.element.name]
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
local frame = nil
|
||||
if left_flow[_left.name] then
|
||||
frame = left_flow[_left.name]
|
||||
frame.clear()
|
||||
else
|
||||
frame = left_flow.add{type='frame',name=_left.name,style=mod_gui.frame_style,caption=_left.caption,direction='vertical'}
|
||||
frame.style.visible = false
|
||||
if is_type(_left.open_on_join,'boolean') then frame.style.visible = _left.open_on_join end
|
||||
end
|
||||
if is_type(_left.draw,'function') then _left.draw(frame) else frame.style.visible = false error('No Callback On '.._left.name) end
|
||||
end
|
||||
|
||||
-- this is called when the toolbar button is pressed
|
||||
function left._left.toggle(event)
|
||||
local player = Game.get_player(event)
|
||||
local _left = Gui._get_data('left')[event.element.name]
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
if not left_flow[_left.name] then _left.open(event) end
|
||||
local left = left_flow[_left.name]
|
||||
local open = false
|
||||
if is_type(_left.can_open,'function') then
|
||||
local success, err = pcall(_left.can_open,player)
|
||||
if not success then error(err)
|
||||
elseif err == true then open = true
|
||||
elseif Gui._global().over_ride_left_can_open then
|
||||
if is_type(Ranking,'table') and Ranking._presets and Ranking._presets().meta.rank_count > 0 then
|
||||
if Ranking.get_rank(player):allowed(_left.name) then open = true
|
||||
else open = {gui.unauthorized} end
|
||||
end
|
||||
else open = err end
|
||||
else
|
||||
if is_type(Ranking,'table') and Ranking._presets and Ranking._presets().meta.rank_count > 0 then
|
||||
if Ranking.get_rank(player):allowed(_left.name) then open = true
|
||||
else open = {gui.unauthorized} end
|
||||
end
|
||||
end
|
||||
if open == true and left.style.visible ~= true then
|
||||
left.style.visible = true
|
||||
else
|
||||
left.style.visible = false
|
||||
end
|
||||
if open == false then player_return({'gui.cant-open-no-reason'},defines.text_color.crit,player) player.play_sound{path='utility/cannot_build'}
|
||||
elseif open ~= true then player_return({'gui.cant-open',open},defines.text_color.crit,player) player.play_sound{path='utility/cannot_build'} end
|
||||
end
|
||||
|
||||
-- draws the left guis when a player first joins, fake_event is just because i am lazy
|
||||
Event.register(defines.events.on_player_joined_game,function(event)
|
||||
local player = Game.get_player(event)
|
||||
local frames = Gui._get_data('left') or {}
|
||||
for name,left in pairs(frames) do
|
||||
local fake_event = {player_index=player.index,element={name=name}}
|
||||
left.open(fake_event)
|
||||
end
|
||||
end)
|
||||
|
||||
return left
|
||||
@@ -1,112 +0,0 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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
|
||||
]]
|
||||
|
||||
local popup = {}
|
||||
popup._popup = {}
|
||||
|
||||
function popup._load()
|
||||
popup._popup.close = Gui.inputs.add{
|
||||
type='button',
|
||||
name='popup-close',
|
||||
caption='utility/set_bar_slot',
|
||||
tooltip='Close This Popup'
|
||||
}:on_event('click',function(event)
|
||||
local frame = event.element.parent
|
||||
if frame and frame.valid then frame.destroy() end
|
||||
end)
|
||||
end
|
||||
|
||||
--- Used to add a popup gui style
|
||||
-- @usage Gui.left.add{name='foo',caption='Foo',draw=function}
|
||||
-- @param obj this is what will be made, needs a name and a draw function(root_frame,data)
|
||||
-- @return the object that is made to... well idk but for the future
|
||||
function popup.add(obj)
|
||||
if not is_type(obj,'table') then return end
|
||||
if not is_type(obj.name,'string') then return end
|
||||
verbose('Created Popup Gui: '..obj.name)
|
||||
setmetatable(obj,{__index=popup._popup})
|
||||
local name = obj.name; obj.name = nil
|
||||
Gui._add_data('popup',name,obj)
|
||||
obj.name = name
|
||||
return obj
|
||||
end
|
||||
|
||||
-- this is used by the script to find the popup flow
|
||||
function popup.flow(player)
|
||||
local player = Game.get_player(player)
|
||||
local flow = mod_gui.get_frame_flow(player).popups or mod_gui.get_frame_flow(player).add{name='popups',type='flow',direction='vertical'}
|
||||
return flow
|
||||
end
|
||||
|
||||
--- Use to open a popup for these players
|
||||
-- @usage Gui.popup.open('ban',nil,{player=1,reason='foo'})
|
||||
-- @tparam string style this is the name you gave to the popup when added
|
||||
-- @param data this is the data that is sent to the draw function
|
||||
-- @tparam[opt=game.connected_players] table players the players to open the popup for
|
||||
function popup.open(style,data,players)
|
||||
local _popup = Gui._get_data('popup')[style]
|
||||
local players = players or game.connected_players
|
||||
local data = data or {}
|
||||
if not _popup then return end
|
||||
if _popup.left then Gui.left.close(_popup.left.name) end
|
||||
if not Server or not Server._thread then
|
||||
for _,player in pairs(players) do
|
||||
local flow = popup.flow(player)
|
||||
local _frame = flow.add{
|
||||
type='frame',
|
||||
direction='horizontal',
|
||||
style=mod_gui.frame_style
|
||||
}
|
||||
local frame = _frame.add{
|
||||
type='frame',
|
||||
name='inner_frame',
|
||||
direction='vertical',
|
||||
style='image_frame'
|
||||
}
|
||||
_popup.close:draw(_frame)
|
||||
if is_type(_popup.draw,'function') then
|
||||
local success, err = pcall(_popup.draw,frame,data)
|
||||
if not success then error(err) end
|
||||
else error('No Draw On Popup '.._popup.name) end
|
||||
end
|
||||
else
|
||||
Server.new_thread{
|
||||
data={players=players,popup=_popup,data=data}
|
||||
}:on_event('tick',function(thread)
|
||||
if #thread.data.players == 0 then thread:close() return end
|
||||
local player = table.remove(thread.data.players,1)
|
||||
local flow = popup.flow(player)
|
||||
local _frame = flow.add{
|
||||
type='frame',
|
||||
direction='horizontal',
|
||||
style=mod_gui.frame_style
|
||||
}
|
||||
local frame = _frame.add{
|
||||
type='frame',
|
||||
name='inner_frame',
|
||||
direction='vertical',
|
||||
style='image_frame'
|
||||
}
|
||||
thread.data.popup.close:draw(_frame)
|
||||
if is_type(thread.data.popup.draw,'function') then
|
||||
local success, err = pcall(thread.data.popup.draw,frame,thread.data.data)
|
||||
if not success then error(err) end
|
||||
else error('No Draw On Popup '..thread.data.popup.name) end
|
||||
end):open()
|
||||
end
|
||||
end
|
||||
|
||||
function popup._popup:add_left(obj)
|
||||
obj.name = obj.name or self.name
|
||||
self.left = Gui.left.add(obj)
|
||||
end
|
||||
|
||||
Event.register(defines.events.on_player_joined_game,popup.flow)
|
||||
|
||||
return popup
|
||||
@@ -1,51 +0,0 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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
|
||||
]]
|
||||
|
||||
local toolbar = {}
|
||||
|
||||
--- Add a button to the toolbar, ranks need to be allowed to use these buttons if ranks is preset
|
||||
-- @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 function callback the function which is called on_click
|
||||
-- @treturn table the button object that was made
|
||||
function toolbar.add(name,caption,tooltip,callback)
|
||||
verbose('Created Toolbar Button: '..name)
|
||||
local button = Gui.inputs.add{type='button',name=name,caption=caption,tooltip=tooltip}
|
||||
button:on_event(Gui.inputs.events.click,callback)
|
||||
Gui._add_data('toolbar',name,button)
|
||||
return button
|
||||
end
|
||||
|
||||
--- Draws the toolbar for a certain player
|
||||
-- @usage toolbar.draw(1)
|
||||
-- @param player the player to draw the tool bar of
|
||||
function toolbar.draw(player)
|
||||
local player = Game.get_player(player)
|
||||
if not player then return end
|
||||
local toolbar_frame = mod_gui.get_button_flow(player)
|
||||
toolbar_frame.clear()
|
||||
if not Gui._get_data('toolbar') then return end
|
||||
for name,button in pairs(Gui._get_data('toolbar')) do
|
||||
if is_type(Ranking,'table') and Ranking._presets and Ranking._presets().meta.rank_count > 0 then
|
||||
local rank = Ranking.get_rank(player)
|
||||
if rank:allowed(name) then
|
||||
button:draw(toolbar_frame)
|
||||
end
|
||||
else button:draw(toolbar_frame) end
|
||||
end
|
||||
end
|
||||
|
||||
if defines.events.rank_change then
|
||||
Event.register(defines.events.rank_change,toolbar.draw)
|
||||
end
|
||||
Event.register(defines.events.on_player_joined_game,toolbar.draw)
|
||||
|
||||
return toolbar
|
||||
@@ -1,151 +0,0 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
local command_calls = {}
|
||||
local command_data = {}
|
||||
|
||||
--- Uses a commands data to return the inputs as a string
|
||||
-- @usage command = command_data[command_name]
|
||||
-- command_inputs(command) -- returns "<input1> <input2> "
|
||||
-- @tparam table the data for the command being run
|
||||
-- @treturn string the inputs in string format
|
||||
local function command_inputs(command)
|
||||
if not is_type(command,'table') then return end
|
||||
local inputs = ''
|
||||
for _,input in pairs(command.inputs) do
|
||||
if input == true then break end
|
||||
inputs = inputs..'<'..input..'> '
|
||||
end
|
||||
return inputs
|
||||
end
|
||||
|
||||
--- Uses the command data and the event to return a table of the args
|
||||
-- @usage command = command_data[command_name]
|
||||
-- command_args(event,command) -- return {input1='one',input2='two'}
|
||||
-- @tparam defines.events.on_console_command event the event rasied by the command
|
||||
-- @tparam table command the data for the command being run
|
||||
-- @treturn table a table version of the event.parameter based on expected inputs
|
||||
local function command_args(event,command)
|
||||
if not event or not is_type(command,'table') then return end
|
||||
local args = {}
|
||||
-- haddles no parameters given
|
||||
if not event.parameter then
|
||||
if #command.inputs > 0 then return args, false
|
||||
else return args, true
|
||||
end
|
||||
end
|
||||
-- finds all the words and cheaks if the right number were given
|
||||
local words = string.split(event.parameter,' ')
|
||||
if table.last(command.inputs) == true then
|
||||
if #words < #command.inputs-1 then return args, false end
|
||||
else
|
||||
if #words < #command.inputs then return args, false end
|
||||
end
|
||||
-- if it is the right number then process and return the args
|
||||
for index,input in pairs(command.inputs) do
|
||||
if command.inputs[index+1] == true then
|
||||
args[input] = table.concat(words,' ',index)
|
||||
break
|
||||
else
|
||||
args[input] = words[index]
|
||||
end
|
||||
end
|
||||
return args, true
|
||||
end
|
||||
|
||||
--- Used to return all the commands a player can use
|
||||
-- @usage get_commands(1) -- return {{command data},{command data}}
|
||||
-- @param player the player refreced by string|number|LuaPlayer|event
|
||||
-- @treturn table a table containg all the commands the player can use
|
||||
function commands.get_commands(player)
|
||||
local commands = {}
|
||||
local player = Game.get_player(player)
|
||||
if not player then return commands end
|
||||
local rank = Ranking.get_rank(player)
|
||||
for name,data in pairs(command_data) do
|
||||
if rank:allowed(name) then table.insert(commands,data) end
|
||||
end
|
||||
return commands
|
||||
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=
|
||||
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'
|
||||
-- is the player allowed to use this command
|
||||
if is_type(Ranking,'table') and Ranking._presets and Ranking._presets().meta.rank_count > 0 and not Ranking.get_rank(player_name):allowed(command.name) then
|
||||
player_return({'commands.unauthorized'},defines.text_color.crit)
|
||||
if game.player then game.player.play_sound{path='utility/cannot_build'} end
|
||||
game.write_file('commands.log',
|
||||
game.tick
|
||||
..' Player: "'..player_name..'"'
|
||||
..' Failed to use command (Unauthorized): "'..command.name..'"'
|
||||
..' With args of: '..table.to_string(command_args(command,command_data))
|
||||
..'\n'
|
||||
, true, 0)
|
||||
return
|
||||
end
|
||||
-- gets the args for the command
|
||||
local args, valid = command_args(command,command_data)
|
||||
if not valid then
|
||||
player_return({'commands.invalid-inputs',command.name,command_inputs(command_data)},defines.text_color.high)
|
||||
if game.player then game.player.play_sound{path='utility/deconstruct_big'} end
|
||||
game.write_file('commands.log',
|
||||
game.tick
|
||||
..' Player: "'..player_name..'"'
|
||||
..' Failed to use command (Invalid Args): "'..command.name..'"'
|
||||
..' With args of: '..table.to_string(args)
|
||||
..'\n'
|
||||
, true, 0)
|
||||
return
|
||||
end
|
||||
-- runs the command
|
||||
local success, err = pcall(command_calls[command.name],command,args)
|
||||
if not success then error(err) end
|
||||
if err ~= commands.error and player_name ~= 'server' then player_return({'commands.command-ran'},defines.text_color.info) end
|
||||
game.write_file('commands.log',
|
||||
game.tick
|
||||
..' Player: "'..player_name..'"'
|
||||
..' Used command: "'..command.name..'"'
|
||||
..' With args of: '..table.to_string(args)
|
||||
..'\n'
|
||||
, true, 0)
|
||||
end
|
||||
|
||||
-- this is a set of constants you can use
|
||||
commands._add_command = commands.add_command --if you dont want to use the custom commands interface
|
||||
commands._expgaming = true --if you want to test if the custom commands are present
|
||||
commands.error = 'COMMAND_ERROR' --if returned during a custom command, Command Complete message not printed
|
||||
--- Used to define commands
|
||||
-- @usage inputs = {'player','reason',true}
|
||||
-- commands.add_command('ban','bans a player',inputs,function() return end)
|
||||
-- @tparam string name the name of the command
|
||||
-- @tparam[opt='No Description'] string description the description of the command
|
||||
-- @tparam[opt={'parameter',true}] table inputs a table of the inputs to be used, last index being true makes the last parameter open ended (longer than one word)
|
||||
-- @tparam function event the function to call on the event
|
||||
commands.add_command = function(name, description, inputs, event)
|
||||
if command_calls[name] then return end
|
||||
if not is_type(name,'string') then return end
|
||||
if not is_type(event,'function') then return end
|
||||
verbose('Created Command: '..name)
|
||||
local description = is_type(description,'string') and description or 'No Description'
|
||||
local inputs = is_type(inputs,'table') and inputs or {'parameter',true}
|
||||
command_data[name] = {
|
||||
name=name,
|
||||
description=description,
|
||||
inputs=inputs
|
||||
}
|
||||
command_calls[name] = event
|
||||
commands._add_command(name,command_inputs(command_data[name])..'- '..description,function(...)
|
||||
local success, err = pcall(run_custom_command,...)
|
||||
if not success then error(err) end
|
||||
end)
|
||||
end
|
||||
200
ExpCore/gui.lua
200
ExpCore/gui.lua
@@ -1,200 +0,0 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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
|
||||
]]
|
||||
|
||||
local Gui = {}
|
||||
local Gui_data = {}
|
||||
|
||||
-- only really used when parts of expcore are missing, or script debuging (ie to store the location of frames)
|
||||
function Gui._global(reset)
|
||||
global.exp_core = not reset and global.exp_core or {}
|
||||
global.exp_core.gui = not reset and global.exp_core.gui or {}
|
||||
return global.exp_core.gui
|
||||
end
|
||||
|
||||
-- this is to enforce the read only propetry of the gui
|
||||
function Gui._add_data(key,value_key,value)
|
||||
if game then return end
|
||||
if not Gui_data[key] then Gui_data[key] = {} end
|
||||
Gui_data[key][value_key] = value
|
||||
end
|
||||
|
||||
function Gui._get_data(key) return Gui_data[key] end
|
||||
|
||||
function Gui:_load_parts(parts)
|
||||
for _,part in pairs(parts) do
|
||||
verbose('Gui Extraction: '..part)
|
||||
self[part] = require('GuiParts/'..part)
|
||||
end
|
||||
end
|
||||
|
||||
--- Add a white bar to any gui frame
|
||||
-- @usage Gui.bar(frame,100)
|
||||
-- @param frame the frame to draw the line to
|
||||
-- @param[opt=10] width the width of the bar
|
||||
-- @return the line that was made type is progressbar
|
||||
function Gui.bar(frame,width)
|
||||
local line = frame.add{
|
||||
type='progressbar',
|
||||
size=1,
|
||||
value=1
|
||||
}
|
||||
line.style.height = 3
|
||||
line.style.width = width or 10
|
||||
line.style.color = defines.color.white
|
||||
return line
|
||||
end
|
||||
|
||||
--- Used to set the index of a drop down to a certian item
|
||||
-- @usage Gui.set_dropdown_index(dropdown,player.name)
|
||||
-- @param dropdown the dropdown that is to be effected
|
||||
-- @param _item this is the item to look for
|
||||
-- @return returns the dropdown if it was successful
|
||||
function Gui.set_dropdown_index(dropdown,_item)
|
||||
if dropdown and dropdown.valid and dropdown.items and _item then else return end
|
||||
local _index = 1
|
||||
for index, item in pairs(dropdown.items) do
|
||||
if item == _item then _index = index break end
|
||||
end
|
||||
dropdown.selected_index = _index
|
||||
return dropdown
|
||||
end
|
||||
|
||||
Event.register(-1,function(event)
|
||||
if Server and Server._thread then
|
||||
Server.new_thread{
|
||||
name='camera-follow',
|
||||
data={cams={},cam_index=1,players={}}
|
||||
}:on_event('tick',function(self)
|
||||
local update = 4
|
||||
if self.data.cam_index >= #self.data.cams then self.data.cam_index = 1 end
|
||||
if update > #self.data.cams then update = #self.data.cams end
|
||||
for cam_offset = 0,update do
|
||||
local _cam = self.data.cams[self.data.cam_index+cam_offset]
|
||||
if not _cam then break end
|
||||
if not _cam.cam.valid then table.remove(self.data.cams,self.data.cam_index)
|
||||
elseif not _cam.entity.valid then table.remove(self.data.cams,self.data.cam_index)
|
||||
else _cam.cam.position = _cam.entity.position if not _cam.surface then _cam.cam.surface_index = _cam.entity.surface.index end
|
||||
end
|
||||
end
|
||||
self.data.cam_index = self.data.cam_index+update
|
||||
end):on_event('error',function(self,err)
|
||||
-- posible error handling if needed
|
||||
error(err)
|
||||
end):on_event(defines.events.on_player_respawned,function(self,event)
|
||||
if self.data.players[event.player_index] then
|
||||
local remove = {}
|
||||
local player = Game.get_player(event)
|
||||
for index,cam in pairs(self.data.players[event.player_index]) do
|
||||
if cam.valid then table.insert(self.data.cams,{cam=cam,entity=player.character,surface=player.surface})
|
||||
else table.insert(remove,index) end
|
||||
end
|
||||
for n,index in pairs(remove) do
|
||||
table.remove(self.data.players[event.player_index],index-n+1)
|
||||
end
|
||||
end
|
||||
end):open()
|
||||
end
|
||||
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
|
||||
-- @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
|
||||
if is_type(data.cam,'table') and data.cam.__self and data.cam.valid then
|
||||
data.cam = data.cam
|
||||
elseif data.frame then
|
||||
data.cam={}
|
||||
data.cam.type='camera'
|
||||
data.cam.name='camera'
|
||||
data.cam.position= data.entity.position
|
||||
data.cam.surface_index= data.surface and data.surface.index or data.entity.surface.index
|
||||
data.cam.zomm = data.zoom
|
||||
data.cam = data.frame.add(data.cam)
|
||||
data.cam.style.width = data.width or 100
|
||||
data.cam.style.height = data.height or 100
|
||||
else return end
|
||||
if not Server or not Server._thread or not Server.get_thread('camera-follow') then
|
||||
if not Gui._global().cams then
|
||||
Gui._global().cams = {}
|
||||
Gui._global().cam_index = 1
|
||||
end
|
||||
if data.cam then
|
||||
local surface = data.surface and data.surface.index or nil
|
||||
table.insert(Gui._global().cams,{cam=data.cam,entity=data.entity,surface=surface})
|
||||
end
|
||||
if not Gui._global().players then
|
||||
Gui._global().players = {}
|
||||
end
|
||||
if data.respawn_open then
|
||||
if data.entity.player then
|
||||
if not Gui._global().players[data.entity.player.index] then Gui._global().players[data.entity.player.index] = {} end
|
||||
table.insert(Gui._global().players[data.entity.player.index],data.cam)
|
||||
end
|
||||
end
|
||||
else
|
||||
local thread = Server.get_thread('camera-follow')
|
||||
local surface = data.surface and data.surface.index or nil
|
||||
table.insert(thread.data.cams,{cam=data.cam,entity=data.entity,surface=surface})
|
||||
if data.respawn_open then
|
||||
if data.entity.player then
|
||||
if not thread.data.players[data.entity.player.index] then thread.data.players[data.entity.player.index] = {} end
|
||||
table.insert(thread.data.players[data.entity.player.index],data.cam)
|
||||
end
|
||||
end
|
||||
end
|
||||
return data.cam
|
||||
end
|
||||
|
||||
Event.register(defines.events.on_tick, function(event)
|
||||
if Gui.left and ((event.tick+10)/(3600*game.speed)) % 15 == 0 then
|
||||
Gui.left.update()
|
||||
end
|
||||
if Server and Server._thread then return end
|
||||
if Gui._global().cams and is_type(Gui._global().cams,'table') and #Gui._global().cams > 0 then
|
||||
local update = 4
|
||||
if Gui._global().cam_index >= #Gui._global().cams then Gui._global().cam_index = 1 end
|
||||
if update > #Gui._global().cams then update = #Gui._global().cams end
|
||||
for cam_offset = 0,update do
|
||||
local _cam = Gui._global().cams[Gui._global().cam_index]
|
||||
if not _cam then break end
|
||||
if not _cam.cam.valid then table.remove(Gui._global().cams,Gui._global().cam_index)
|
||||
elseif not _cam.entity.valid then table.remove(Gui._global().cams,Gui._global().cam_index)
|
||||
else _cam.cam.position = _cam.entity.position if not _cam.surface then _cam.cam.surface_index = _cam.entity.surface.index end Gui._global().cam_index = Gui._global().cam_index+1
|
||||
end
|
||||
end
|
||||
Gui._global().cam_index = Gui._global().cam_index+update
|
||||
end
|
||||
end)
|
||||
|
||||
Event.register(defines.events.on_player_respawned,function(event)
|
||||
if Server and Server._thread then return end
|
||||
if Gui._global().players and is_type(Gui._global().players,'table') and #Gui._global().players > 0 and Gui._global().players[event.player_index] then
|
||||
local remove = {}
|
||||
local player = Game.get_player(event)
|
||||
for index,cam in pairs(Gui._global().players[event.player_index]) do
|
||||
if cam.valid then table.insert(Gui._global().cams,{cam=cam,entity=player.character,surface=player.surface})
|
||||
else table.insert(remove,index) end
|
||||
end
|
||||
for n,index in pairs(remove) do
|
||||
table.remove(Gui._global().players[event.player_index],index-n+1)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
return Gui
|
||||
@@ -1,43 +0,0 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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
|
||||
]]
|
||||
|
||||
--[[
|
||||
ExpCore
|
||||
|
||||
This file allow you to only require this one file to return the diffent libarys.
|
||||
This file will return a function which can be used to access only the part you want.
|
||||
Pass a table with the names of the objects you want and it will be return in that order
|
||||
]]
|
||||
|
||||
local StdExpCoreLib = {}
|
||||
|
||||
require('commands')
|
||||
StdExpCoreLib.Ranking = require('ranking')
|
||||
StdExpCoreLib.Server = require('server')
|
||||
StdExpCoreLib.Sync = require('sync')
|
||||
StdExpCoreLib.Gui = require('gui')
|
||||
verbose('Begain Gui Part Loading')
|
||||
StdExpCoreLib.Gui:_load_parts{
|
||||
'inputs',
|
||||
'toolbar',
|
||||
'center',
|
||||
'left',
|
||||
'popup'
|
||||
}
|
||||
|
||||
return function(rtn)
|
||||
local _return = {}
|
||||
for _,name in pairs(rtn) do
|
||||
if StdExpCoreLib[name] then
|
||||
verbose('Core File Extraction: '..name)
|
||||
table.insert(_return,StdExpCoreLib[name])
|
||||
end
|
||||
end
|
||||
return unpack(_return)
|
||||
end
|
||||
@@ -1,384 +0,0 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
local Ranking = {}
|
||||
defines.events.rank_change = script.generate_event_name()
|
||||
Ranking._rank = {}
|
||||
Ranking._group = {}
|
||||
-- this is just for debuging when setting you rank powers
|
||||
function Ranking.output_ranks(player)
|
||||
local player = Game.get_player(player) or game.player or nil
|
||||
if not player then return end
|
||||
for power,rank in pairs(Ranking._ranks()) do
|
||||
local output = power..') '..rank.name
|
||||
output=output..' '..rank.tag
|
||||
local admin = 'No'; if rank.is_root then admin = 'Root' elseif rank.is_admin then admin = 'Yes' end
|
||||
output=output..' Admin: '..admin
|
||||
output=output..' Group: '..rank.group.name
|
||||
output=output..' AFK: '..tostring(rank.base_afk_time)
|
||||
player_return(output,rank.colour,player)
|
||||
end
|
||||
end
|
||||
|
||||
-- this function is to avoid errors - see /ranks.lua
|
||||
function Ranking._ranks(names)
|
||||
return {}
|
||||
end
|
||||
|
||||
-- this function is to avoid errors - see /ranks.lua
|
||||
function Ranking._groups(names)
|
||||
return {}
|
||||
end
|
||||
|
||||
-- this function is to avoid errors - see /ranks.lua
|
||||
function Ranking._meta()
|
||||
return {}
|
||||
end
|
||||
|
||||
-- this function is to avoid errors - see addons/playerRanks.lua
|
||||
function Ranking._base_preset(table)
|
||||
Ranking._presets().current = table
|
||||
end
|
||||
|
||||
-- this returns a global list
|
||||
function Ranking._presets()
|
||||
if not global.exp_core then global.exp_core = {} end
|
||||
if not global.exp_core.ranking then global.exp_core.ranking = {meta=Ranking._meta(),old={},current={},last_jail=nil} end
|
||||
return global.exp_core.ranking
|
||||
end
|
||||
|
||||
--- Returns a rank object given a player or rank name
|
||||
-- @usage Ranking.get_rank(game.player)
|
||||
-- Ranking.get_rank('admin')
|
||||
-- @param mixed player|player index|player name|rank name|rank|'server'|'root' what rank to get
|
||||
-- @treturn table the rank that is linked to mixed
|
||||
function Ranking.get_rank(mixed)
|
||||
if not mixed then return false end
|
||||
local ranks = Ranking._ranks(true)
|
||||
local _return = false
|
||||
if is_type(mixed,'table') then
|
||||
if mixed.index then
|
||||
_return = game.players[mixed.index] and ranks[mixed.permission_group.name] or nil
|
||||
else
|
||||
_return = mixed.group and mixed or nil
|
||||
end
|
||||
else
|
||||
_return = game.players[mixed] and ranks[game.players[mixed].permission_group.name]
|
||||
or table.autokey(ranks,mixed) and table.autokey(ranks,mixed)
|
||||
or string.contains(mixed,'server') and Ranking.get_rank(Ranking._presets().meta.root)
|
||||
or string.contains(mixed,'root') and Ranking.get_rank(Ranking._presets().meta.root)
|
||||
or nil
|
||||
end
|
||||
return _return
|
||||
end
|
||||
|
||||
--- Returns the group object used to sort ranks given group name or see Ranking.get_rank
|
||||
-- @usage Ranking.get_group(game.player)
|
||||
-- Ranking.get_group('root')
|
||||
-- @param mixed player|player index|player name|rank name|rank|'server'|'root'|group name|group what group to get
|
||||
-- @treturn table the group that is linked to mixed
|
||||
function Ranking.get_group(mixed)
|
||||
if not mixed then return false end
|
||||
local groups = Ranking._groups(true)
|
||||
local rank = Ranking.get_rank(mixed)
|
||||
return rank and rank.group
|
||||
or is_type(mixed,'table') and mixed.ranks and mixed
|
||||
or is_type(mixed,'string') and table.autokey(groups,mixed) and table.autokey(groups,mixed)
|
||||
or false
|
||||
end
|
||||
|
||||
--- Prints to all rank of greater/lower power of the rank given
|
||||
-- @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 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
|
||||
local rank_base = Ranking.get_rank(rank_base)
|
||||
local ranks = Ranking._ranks()
|
||||
if below then
|
||||
for power,rank in pairs(ranks) do
|
||||
if rank_base.power <= power then rank:print(rtn,colour,true) end
|
||||
end
|
||||
else
|
||||
for power,rank in pairs(ranks) do
|
||||
if rank_base.power >= power then rank:print(rtn,colour) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Gives a user a rank
|
||||
-- @usage Ranking.give_rank(1,'admin')
|
||||
-- @param player the player to give the rank to
|
||||
-- @param rank the rank to give to the player
|
||||
-- @param[opt='server'] by_player the player who is giving the rank
|
||||
-- @param[opt=game.tick] tick the tick that the rank is being given on
|
||||
function Ranking.give_rank(player,rank,by_player,tick)
|
||||
local print_colour = defines.text_color.info
|
||||
local tick = tick or game.tick
|
||||
local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or game.player and game.player.name or is_type(by_player,'string') and by_player or 'server'
|
||||
local rank = Ranking.get_rank(rank) or Ranking.get_rank(Ranking._presets().meta.default)
|
||||
local player = Game.get_player(player) or error('No Player To Give Rank')
|
||||
local old_rank = Ranking.get_rank(player) or Ranking.get_rank(Ranking._presets().meta.default)
|
||||
local message = 'ranking.rank-down'
|
||||
-- messaging
|
||||
if old_rank.name == rank.name then return end
|
||||
if rank.power < old_rank.power then message = 'ranking.rank-up' player.play_sound{path='utility/achievement_unlocked'}
|
||||
else player.play_sound{path='utility/game_lost'} end
|
||||
if player.online_time > 60 or by_player_name ~= 'server' then game.print({message,player.name,rank.name,by_player_name},print_colour) end
|
||||
if rank.group.name ~= 'User' then player_return({'ranking.rank-given',rank.name},print_colour,player) end
|
||||
if player.tag ~= old_rank.tag then player_return({'ranking.tag-reset'},print_colour,player) end
|
||||
-- rank change
|
||||
player.permission_group = game.permissions.get_group(rank.name)
|
||||
player.tag = rank.tag
|
||||
if old_rank.group.name ~= 'Jail' then Ranking._presets().old[player.index] = old_rank.name end
|
||||
player.admin = rank.is_admin or false
|
||||
player.spectator = rank.is_spectator or false
|
||||
if defines.events.rank_change then
|
||||
script.raise_event(defines.events.rank_change,{
|
||||
name=defines.events.rank_change,
|
||||
tick=tick,
|
||||
player_index=player.index,
|
||||
by_player_name=by_player_name,
|
||||
new_rank=rank,
|
||||
old_rank=old_rank
|
||||
})
|
||||
end
|
||||
if rank.group.name == 'Jail' and Ranking._presets().last_jail ~= player.name then
|
||||
Sync.emit_embeded{
|
||||
title='Player Jail',
|
||||
color=Color.to_hex(defines.text_color.med),
|
||||
description='There was a player jailed.',
|
||||
['Player:']=player.name,
|
||||
['By:']='<<inline>>'..by_player_name,
|
||||
['Reason:']='No Reason'
|
||||
}
|
||||
end
|
||||
game.write_file('ranking-change.json',
|
||||
table.json({
|
||||
tick=tick,
|
||||
play_time=player.online_time,
|
||||
player_name=player.name,
|
||||
by_player_name=by_player_name,
|
||||
new_rank=rank.name,
|
||||
old_rank=old_rank.name,
|
||||
power_increase=(old_rank.power-rank.power)
|
||||
})..'\n'
|
||||
, true, 0)
|
||||
end
|
||||
|
||||
--- Revert the last change to a players rank
|
||||
-- @usage Ranking.revert(1)
|
||||
-- @param player the player to revert the rank of
|
||||
-- @param[opt=nil] by_player the player who is doing the revert
|
||||
function Ranking.revert(player,by_player)
|
||||
local player = Game.get_player(player)
|
||||
Ranking.give_rank(player,Ranking._presets().old[player.index],by_player)
|
||||
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
|
||||
function Ranking.find_preset(player,tick)
|
||||
local presets = Ranking._presets().current
|
||||
local meta_data = Ranking._presets().meta
|
||||
local default = Ranking.get_rank(meta_data.default)
|
||||
local player = Game.get_player(player)
|
||||
local current_rank = Ranking.get_rank(player) or {power=-1,group={name='not jail'}}
|
||||
local ranks = {default}
|
||||
if current_rank.group.name == 'Jail' then return end
|
||||
if presets[string.lower(player.name)] then
|
||||
local rank = Ranking.get_rank(presets[string.lower(player.name)])
|
||||
table.insert(ranks,rank)
|
||||
end
|
||||
if current_rank.power > meta_data.time_highest and tick_to_min(player.online_time) > meta_data.time_lowest then
|
||||
for _,rank_name in pairs(meta_data.time_ranks) do
|
||||
local rank = Ranking.get_rank(rank_name)
|
||||
if tick_to_min(player.online_time) > rank.time then
|
||||
table.insert(ranks,rank)
|
||||
end
|
||||
end
|
||||
end
|
||||
local _rank = current_rank
|
||||
for _,rank in pairs(ranks) do
|
||||
if rank.power < _rank.power or _rank.power == -1 then _rank = rank end
|
||||
end
|
||||
if _rank then
|
||||
if _rank.name == default.name then
|
||||
player.tag = _rank.tag
|
||||
player.permission_group = game.permissions.get_group(_rank.name)
|
||||
else
|
||||
Ranking.give_rank(player,_rank,nil,tick)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- this is the base rank object, do not store in global
|
||||
|
||||
--- Is this rank allowed to open this gui or use this command etc.
|
||||
-- @usage rank:allowed('server-interface')
|
||||
-- @tparam teh action to test for
|
||||
-- @treturn bolean is it allowed
|
||||
function Ranking._rank:allowed(action)
|
||||
return self.allow[action] or self.is_root or false
|
||||
end
|
||||
|
||||
--- Get all the players in this rank
|
||||
-- @usage rank:get_players()
|
||||
-- @tparam bolean online get only online players
|
||||
-- @treturn table a table of all players in this rank
|
||||
function Ranking._rank:get_players(online)
|
||||
local players = game.permissions.get_group(self.name).players
|
||||
local _return = {}
|
||||
if online then
|
||||
for _,player in pairs(players) do
|
||||
if player.connected then table.insert(_return,player) end
|
||||
end
|
||||
else
|
||||
_return = players
|
||||
end
|
||||
return _return
|
||||
end
|
||||
|
||||
--- Print a message to all players of this rank
|
||||
-- @usage rank:print('foo')
|
||||
-- @param rtn any value you want to return
|
||||
function Ranking._rank:print(rtn,colour,show_default)
|
||||
local colour = colour or defines.color.white
|
||||
local meta_data = Ranking._presets().meta
|
||||
local default = Ranking.get_rank(meta_data.default)
|
||||
if not Server or not Server._thread then
|
||||
for _,player in pairs(self:get_players(true)) do
|
||||
if self.name == default.name or show_default then
|
||||
player_return({'ranking.all-rank-print',rtn},colour,player)
|
||||
else
|
||||
player_return({'ranking.rank-print',self.name,rtn},colour,player)
|
||||
end
|
||||
end
|
||||
else
|
||||
-- using threads to make less lag
|
||||
Server.new_thread{
|
||||
data={rank=self,rtn=rtn,default=default.name,all=show_default}
|
||||
}:on_event('resolve',function(thread)
|
||||
return thread.data.rank:get_players(true)
|
||||
end):on_event('success',function(thread,players)
|
||||
for _,player in pairs(players) do
|
||||
if thread.data.rank.name == thread.data.default or thread.data.all then
|
||||
player_return({'ranking.all-rank-print',thread.data.rtn},colour,player)
|
||||
else
|
||||
player_return({'ranking.rank-print',thread.data.rank.name,thread.data.rtn},colour,player)
|
||||
end
|
||||
end
|
||||
end):queue()
|
||||
end
|
||||
end
|
||||
|
||||
-- this is used to edit a group once made key is what is being edited and set_value makes it over ride the current value
|
||||
-- see Addons/playerRanks for examples
|
||||
function Ranking._rank:edit(key,set_value,value)
|
||||
if game then return end
|
||||
verbose('Edited Rank: '..self.name..'/'..key)
|
||||
if set_value then self[key] = value return end
|
||||
if key == 'disallow' then
|
||||
self.disallow = table.merge(self.disallow,value,true)
|
||||
elseif key == 'allow' then
|
||||
self.allow = table.merge(self.allow,value)
|
||||
end
|
||||
Ranking._update_rank(self)
|
||||
end
|
||||
|
||||
-- this is the base group object, do not store in global, these cant be used in game
|
||||
|
||||
-- this makes a new group
|
||||
-- {name='root',allow={},disallow={}}
|
||||
function Ranking._group:create(obj)
|
||||
if game then return end
|
||||
if not is_type(obj.name,'string') then return end
|
||||
verbose('Created Group: '..obj.name)
|
||||
setmetatable(obj,{__index=Ranking._group})
|
||||
self.index = #Ranking._groups(names)+1
|
||||
obj.ranks = {}
|
||||
obj.allow = obj.allow or {}
|
||||
obj.disallow = obj.disallow or {}
|
||||
Ranking._add_group(obj)
|
||||
return obj
|
||||
end
|
||||
|
||||
-- this makes a new rank in side this group
|
||||
-- {name='Root',short_hand='Root',tag='[Root]',time=nil,colour=defines.colors.white,allow={},disallow={}}
|
||||
-- if the rank is given power then it is given that place realative to the highest rank in that group,if no power then it is added to the end
|
||||
function Ranking._group:add_rank(obj)
|
||||
if game then return end
|
||||
if not is_type(obj.name,'string') or
|
||||
not is_type(obj.short_hand,'string') or
|
||||
not is_type(obj.tag,'string') or
|
||||
not is_type(obj.colour,'table') then return end
|
||||
verbose('Created Rank: '..obj.name)
|
||||
setmetatable(obj,{__index=Ranking._rank})
|
||||
obj.group = self
|
||||
obj.allow = obj.allow or {}
|
||||
obj.disallow = obj.disallow or {}
|
||||
obj.power = obj.power and self.highest and self.highest.power+obj.power or obj.power or self.lowest and self.lowest.power+1 or nil
|
||||
setmetatable(obj.allow,{__index=self.allow})
|
||||
setmetatable(obj.disallow,{__index=self.disallow})
|
||||
Ranking._add_rank(obj,obj.power)
|
||||
Ranking._set_rank_power()
|
||||
table.insert(self.ranks,obj)
|
||||
if not self.highest or obj.power < self.highest.power then self.highest = obj end
|
||||
if not self.lowest or obj.power > self.lowest.power then self.lowest = obj end
|
||||
end
|
||||
|
||||
-- this is used to edit a group once made key is what is being edited and set_value makes it over ride the current value
|
||||
-- see Addons/playerRanks for examples
|
||||
function Ranking._group:edit(key,set_value,value)
|
||||
if game then return end
|
||||
verbose('Edited Group: '..self.name..'/'..key)
|
||||
if set_value then self[key] = value return end
|
||||
if key == 'disallow' then
|
||||
self.disallow = table.merge(self.disallow,value,true)
|
||||
elseif key == 'allow' then
|
||||
self.allow = table.merge(self.allow,value)
|
||||
end
|
||||
Ranking._update_group(self)
|
||||
end
|
||||
|
||||
Event.register(defines.events.on_player_joined_game,function(event)
|
||||
Ranking.find_preset(event.player_index)
|
||||
end)
|
||||
|
||||
Event.register(-1,function(event)
|
||||
for power,rank in pairs(Ranking._ranks()) do
|
||||
local perm = game.permissions.create_group(rank.name)
|
||||
for _,toRemove in pairs(rank.disallow) do
|
||||
perm.set_allows_action(defines.input_action[toRemove],false)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Event.register(defines.events.on_tick,function(event)
|
||||
if (((event.tick+10)/(3600*game.speed))+(15/2))% 15 == 0 then
|
||||
-- this is the system to auto rank players
|
||||
if not Server or not Server._thread then
|
||||
for _,player in pairs(game.connected_players) do
|
||||
Ranking.find_preset(player,tick)
|
||||
end
|
||||
else
|
||||
Server.new_thread{
|
||||
data={players=game.connected_players}
|
||||
}:on_event('tick',function(thread)
|
||||
if #thread.data.players == 0 then thread:close() return end
|
||||
local player = table.remove(thread.data.players,1)
|
||||
Ranking.find_preset(player,tick)
|
||||
end):open()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
return Ranking
|
||||
@@ -1,230 +0,0 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
local groups = {}
|
||||
local ranks = {}
|
||||
|
||||
function Ranking._add_group(group) if game then return end table.insert(groups,group) end
|
||||
function Ranking._add_rank(rank,pos) if game then return end if pos then table.insert(ranks,pos,rank) else table.insert(ranks,rank) end end
|
||||
function Ranking._set_rank_power() if game then return end for power,rank in pairs(ranks) do rank.power = power end end
|
||||
function Ranking._update_rank(rank) if game then return end ranks[rank.power] = rank end
|
||||
function Ranking._update_group(group) if game then return end groups[group.index] = group end
|
||||
|
||||
--[[
|
||||
How to use groups:
|
||||
name the name that you can use to refence it.
|
||||
disallow if present then all ranks in this group will have this added to their disallow.
|
||||
allow if present then all ranks in this group will have this added to their allow.
|
||||
highest is asigned by the script to show the highest rank in this group.
|
||||
lowest is asigned by the script to show the lowest rank in this group.
|
||||
How to add ranks:
|
||||
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 asigned by the script based on their index in ranks, you can insert new ranks between current ones, lower is better
|
||||
group is asigned by the script to show the group this rank is in
|
||||
disallow is a list containing input actions that the user can not perform.
|
||||
allow is a list of custom commands and effects that that rank can use, all defined in the sctips.
|
||||
|
||||
For allow, add the allow as the key and the value as true
|
||||
Example: test for 'server-interface' => allow['server-interface'] = true
|
||||
|
||||
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
|
||||
--]]
|
||||
|
||||
-- If you wish to add more groups please use addons/playerRanks.lua
|
||||
-- If you wish to add to these rank groups use addons/playerRanks.lua
|
||||
-- Ranks will inherite from each other ie higher ranks can do everything lower ranks can
|
||||
-- But groups do not inherite from each other
|
||||
-- DO NOT REMOVE ANY OF THESE GROUPS
|
||||
|
||||
local root = Ranking._group:create{
|
||||
name='Root',
|
||||
allow={
|
||||
['interface'] = true
|
||||
},
|
||||
disallow={}
|
||||
}
|
||||
local admin = Ranking._group:create{
|
||||
name='Admin',
|
||||
allow={},
|
||||
disallow={
|
||||
'set_allow_commands',
|
||||
'edit_permission_group',
|
||||
'delete_permission_group',
|
||||
'add_permission_group'
|
||||
}
|
||||
}
|
||||
local user = Ranking._group:create{
|
||||
name='User',
|
||||
allow={},
|
||||
disallow={
|
||||
'set_allow_commands',
|
||||
'edit_permission_group',
|
||||
'delete_permission_group',
|
||||
'add_permission_group'
|
||||
}
|
||||
}
|
||||
local jail = Ranking._group:create{
|
||||
name='Jail',
|
||||
allow={},
|
||||
disallow={
|
||||
'set_allow_commands',
|
||||
'edit_permission_group',
|
||||
'delete_permission_group',
|
||||
'add_permission_group',
|
||||
'open_character_gui',
|
||||
'begin_mining',
|
||||
'start_walking',
|
||||
'player_leave_game',
|
||||
'open_blueprint_library_gui',
|
||||
'build_item',
|
||||
'use_item',
|
||||
'select_item',
|
||||
'rotate_entity',
|
||||
'open_train_gui',
|
||||
'open_train_station_gui',
|
||||
'open_gui',
|
||||
'open_item',
|
||||
'deconstruct',
|
||||
'build_rail',
|
||||
'cancel_research',
|
||||
'start_research',
|
||||
'set_train_stopped',
|
||||
'select_gun',
|
||||
'open_technology_gui',
|
||||
'open_trains_gui',
|
||||
'edit_custom_tag',
|
||||
'craft',
|
||||
'setup_assembling_machine',
|
||||
}
|
||||
}
|
||||
|
||||
-- If you wish to add more ranks please use addons/playerRanks.lua
|
||||
-- If you wish to add to these rank use addons/playerRanks.lua
|
||||
root:add_rank{
|
||||
name='Root',
|
||||
short_hand='Root',
|
||||
tag='[Root]',
|
||||
colour=defines.color.white,
|
||||
is_root=true,
|
||||
is_admin=true,
|
||||
is_spectator=true,
|
||||
base_afk_time=false
|
||||
}
|
||||
|
||||
admin:add_rank{
|
||||
name='Admin',
|
||||
short_hand='Admin',
|
||||
tag='[Admin]',
|
||||
colour={r=233,g=63,b=233},
|
||||
is_admin=true,
|
||||
is_spectator=true,
|
||||
base_afk_time=false
|
||||
}
|
||||
|
||||
user:add_rank{
|
||||
name='Member',
|
||||
short_hand='Mem',
|
||||
tag='[Member]',
|
||||
colour={r=24,g=172,b=188},
|
||||
disallow={
|
||||
'set_auto_launch_rocket',
|
||||
'change_programmable_speaker_alert_parameters',
|
||||
'drop_item'
|
||||
},
|
||||
base_afk_time=60
|
||||
}
|
||||
user:add_rank{
|
||||
name='Guest',
|
||||
short_hand='',
|
||||
tag='',
|
||||
colour={r=185,g=187,b=160},
|
||||
is_default=true,
|
||||
disallow={
|
||||
'build_terrain',
|
||||
'remove_cables',
|
||||
'launch_rocket',
|
||||
'reset_assembling_machine',
|
||||
'cancel_research'
|
||||
},
|
||||
base_afk_time=10
|
||||
}
|
||||
|
||||
jail:add_rank{
|
||||
name='Jail',
|
||||
short_hand='Jail',
|
||||
tag='[Jail]',
|
||||
colour={r=50,g=50,b=50},
|
||||
disallow={},
|
||||
base_afk_time=false
|
||||
}
|
||||
|
||||
function Ranking._auto_edit_ranks()
|
||||
for power,rank in pairs(ranks) do
|
||||
if ranks[power-1] then
|
||||
rank:edit('disallow',false,ranks[power-1].disallow)
|
||||
end
|
||||
end
|
||||
for power = #ranks, 1, -1 do
|
||||
local rank = ranks[power]
|
||||
rank:edit('disallow',false,rank.group.disallow)
|
||||
if ranks[power+1] then
|
||||
rank:edit('allow',false,ranks[power+1].allow)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- used to force rank to be read-only
|
||||
function Ranking._groups(name)
|
||||
if name then
|
||||
if name then
|
||||
local _return = {}
|
||||
for power,group in pairs(groups) do
|
||||
_return[group.name] = group
|
||||
end
|
||||
return _return
|
||||
end
|
||||
end
|
||||
return groups
|
||||
end
|
||||
|
||||
function Ranking._ranks(name)
|
||||
if name then
|
||||
local _return = {}
|
||||
for power,rank in pairs(ranks) do
|
||||
_return[rank.name] = rank
|
||||
end
|
||||
return _return
|
||||
end
|
||||
return ranks
|
||||
end
|
||||
|
||||
-- used to save lag by doing some calculation at the start
|
||||
function Ranking._meta()
|
||||
local meta = {time_ranks={}}
|
||||
for power,rank in pairs(ranks) do
|
||||
meta.rank_count = power
|
||||
if rank.is_default then
|
||||
meta.default = rank.name
|
||||
end
|
||||
if rank.is_root then
|
||||
meta.root = rank.name
|
||||
end
|
||||
if rank.time then
|
||||
table.insert(meta.time_ranks,rank.name)
|
||||
if not meta.time_highest or power < meta.time_highest then meta.time_highest = power end
|
||||
if not meta.time_lowest or rank.time < meta.time_lowest then meta.time_lowest = rank.time end
|
||||
end
|
||||
end
|
||||
return meta
|
||||
end
|
||||
@@ -1,427 +0,0 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
-- server allows control over threads and other features the devs missed out
|
||||
local Server = {}
|
||||
Server._thread = {}
|
||||
|
||||
--- Returns a un-used uuid (better system needed)
|
||||
-- @usage obj.uuid = Server.new_uuid()
|
||||
-- @treturn string the new uuid
|
||||
function Server.new_uuid()
|
||||
local uuid = tostring(Server._uuid()())
|
||||
uuid = string.to_hex('uuid'..uuid)
|
||||
return uuid
|
||||
end
|
||||
|
||||
-- use this to change the location of the server uuids
|
||||
function Server._uuid(reset)
|
||||
global.exp_core = not reset and global.exp_core or {}
|
||||
global.exp_core.uuids = not reset and global.exp_core.uuids or game.create_random_generator()
|
||||
return global.exp_core.uuids
|
||||
end
|
||||
|
||||
--- Returns either the number of threads or a able of threads
|
||||
-- @usage Server.threads() -- return {...}
|
||||
-- Server.threads(true) -- return int
|
||||
-- @tparam[opt=nil] bolean count true to return the number of threads
|
||||
-- @return either a list of threads or a number
|
||||
function Server.threads(count)
|
||||
return count and Server._threads().all._n or Server._threads().all
|
||||
end
|
||||
|
||||
-- use this to change the location of the server threads
|
||||
-- all stores the threads indexed uuid, the other three only store the uuid's to index in the all table
|
||||
function Server._threads(reset)
|
||||
global.exp_core = not reset and global.exp_core or {}
|
||||
global.exp_core.threads = not reset and global.exp_core.threads or {print_to={},queue={},tick={},timeout={},events={},all={_n=0},paused={},named={}}
|
||||
return global.exp_core.threads
|
||||
end
|
||||
|
||||
-- see thread:create (this was done so thread can remain local)
|
||||
function Server.new_thread(obj)
|
||||
return Server._thread:create(obj)
|
||||
end
|
||||
|
||||
--- Used to get a thread via it's uuid or by name if one is given
|
||||
-- @usage Server.get_thread('decon') -- return thread
|
||||
-- @param mixed either a uuid or the name given to a thread
|
||||
-- @treturn table the thread by that name or uuid
|
||||
function Server.get_thread(mixed)
|
||||
local threads = Server._threads()
|
||||
if threads.named[mixed] then return threads.all[threads.named[mixed]]
|
||||
elseif threads.paused[mixed] then return threads.all[threads.paused[mixed]]
|
||||
elseif threads.all[mixed] then return threads.all[mixed]
|
||||
else return false end
|
||||
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
|
||||
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
|
||||
table.insert(Server._threads().queue,thread_to_queue.uuid)
|
||||
return true
|
||||
end
|
||||
|
||||
--- Closes all active threads, can use force if it causes errors
|
||||
-- @usage Server.close_all_threads()
|
||||
-- Server.close_all_threads(true) -- use if no force makes errors
|
||||
-- @tparam bolean with_force use force when closing
|
||||
function Server.close_all_threads(with_force)
|
||||
if not with_force then
|
||||
for uuid,next_thread in pairs(Server.threads()) do
|
||||
if uuid ~= '_n' then next_thread:close() end
|
||||
end
|
||||
else
|
||||
Server._threads(true)
|
||||
end
|
||||
end
|
||||
|
||||
--- Runs all the theads which have opened with an on_tick event
|
||||
-- @ussage Server.run_tick_threads()
|
||||
function Server.run_tick_threads()
|
||||
table.each(Server._threads().tick,function(uuid)
|
||||
local next_thread = Server.get_thread(uuid)
|
||||
if next_thread and next_thread:valid() and next_thread._tick then
|
||||
local success, err = pcall(next_thread._tick,next_thread)
|
||||
if not success then next_thread:error(err) end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
--- Checks the timeout on all active timeout threads
|
||||
-- @ussage Server.check_timeouts()
|
||||
function Server.check_timeouts()
|
||||
table.each(Server._threads().timeout,function(uuid)
|
||||
local next_thread = Server.get_thread(uuid)
|
||||
if next_thread and next_thread:valid() then
|
||||
next_thread:check_timeout()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- for use in debuging
|
||||
function Server._thread_handler_debuger(player,event,state)
|
||||
local player = Game.get_player(player)
|
||||
local print_to = Server._threads().print_to
|
||||
print_to[player.index] = print_to[player.index] or {}
|
||||
print_to[player.index][event] = state
|
||||
end
|
||||
--- Calles all threads on a certain game event (used with script.on_event)
|
||||
-- @tparam table event the event that is called
|
||||
function Server._thread_handler(event)
|
||||
table.each(Server._threads().print_to,function(print_to,player_index,event)
|
||||
if event.name == defines.events.on_tick then return true end
|
||||
if print_to[event.name] then
|
||||
player_return(event,defines.text_color.bg,player_index)
|
||||
end
|
||||
end,event)
|
||||
local event_id = event.name
|
||||
local threads = Server._threads().events[event_id]
|
||||
if not threads then return end
|
||||
table.each(threads,function(uuid)
|
||||
local next_thread = Server.get_thread(uuid)
|
||||
if next_thread and next_thread:valid() then
|
||||
if is_type(next_thread._events[event_id],'function') then
|
||||
local success, err = pcall(next_thread._events[event_id],next_thread,event)
|
||||
if not success then next_thread:error(err) end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
for _,event in pairs(defines.events) do Event.register(event,Server._thread_handler) end
|
||||
|
||||
--[[ cant be used V
|
||||
--- Adds a event handler to tell threads about events
|
||||
-- @usage Server.add_thread_handler(defines.event)
|
||||
-- @tparam number event the event to run the thread handler on
|
||||
-- @treturn bolean if the handler was added
|
||||
function Server.add_thread_handler(event)
|
||||
if not is_type(event,'number') then return false end
|
||||
local threads = Server._threads()
|
||||
if not threads.events[event] then
|
||||
threads.events[event] = {}
|
||||
Event.register(event,Server._thread_handler)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
]]
|
||||
|
||||
--- Given a string or function it will run that function and return any values
|
||||
-- @usage Server.interface('local x = 1+1 print(x) return x') -- return 2
|
||||
-- Server.interface('local x = 1+1 print(x)',thread) -- no return
|
||||
-- @param callback either a function or string which will be ran via pcall
|
||||
-- @param[opt] use_thread give a thread for the interface to run on (does not need to be open, but cant use on_resolve)
|
||||
-- @param[opt] ... any args you want to pass to the function
|
||||
function Server.interface(callback,use_thread,...)
|
||||
if use_thread then
|
||||
if use_thread == true then use_thread = Server.new_thread{data={callback,...}} end
|
||||
use_thread:on_event('resolve',function(thread)
|
||||
if is_type(thread.data[1],'function') then
|
||||
local success, err = pcall(unpack(thread.data))
|
||||
if not success then error(err) end
|
||||
return err
|
||||
else
|
||||
local callback = table.remove(thread.data,1)
|
||||
local success, err = pcall(loadstring(callback),unpack(thread.data))
|
||||
if not success then error(err) end
|
||||
return err
|
||||
end
|
||||
end)
|
||||
use_thread:open()
|
||||
Server.queue_thread(use_thread)
|
||||
else
|
||||
if is_type(callback,'function') then
|
||||
local success, err = pcall(callback,...)
|
||||
return success, err
|
||||
else
|
||||
local success, err = pcall(loadstring(callback),...)
|
||||
return success, err
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
if commands._expgaming then
|
||||
commands.add_command('interface', 'Runs the given input from the script', {'code',true}, function(event,args)
|
||||
local callback = args.code
|
||||
if not string.find(callback,'%s') and not string.find(callback,'return') then callback = 'return '..callback end
|
||||
if game.player then callback = 'local player, surface, force, position, entity, tile = game.player, game.player.surface, game.player.force, game.player.position, game.player.selected, game.player.surface.get_tile(game.player.position);'..callback end
|
||||
if Ranking and Ranking.get_rank and game.player then callback = 'local rank = Ranking.get_rank(game.player);'..callback end
|
||||
local success, err = Server.interface(callback)
|
||||
if not success and is_type(err,'string') then local _end = string.find(err,'stack traceback') if _end then err = string.sub(err,0,_end-2) end end
|
||||
if err or err == false then player_return(err) end
|
||||
end)
|
||||
end
|
||||
|
||||
-- thread allows you to run fuinction async to the main game
|
||||
--- Returns a new thread object
|
||||
-- @usage new_thread = thread:create()
|
||||
-- @tparam[opt={}] table obj all are opt {timeout=int,name=str,data=any} advanced users can prefix with _function to avoid the on_function functions
|
||||
-- @treturn table the new thread object
|
||||
function Server._thread:create(obj)
|
||||
local obj = obj or {}
|
||||
setmetatable(obj,{__index=Server._thread})
|
||||
obj.uuid = Server.new_uuid()
|
||||
return obj
|
||||
end
|
||||
|
||||
-- see Server.queue_thread - this just opens it first
|
||||
function Server._thread:queue()
|
||||
self:open()
|
||||
return Server.queue_thread(self)
|
||||
end
|
||||
|
||||
--- Test if the thread has all requied parts
|
||||
-- @usage if thread:valid() then end
|
||||
-- @tparam bolean skip_location_check true to skip the location check
|
||||
-- @treturn bolean is the thread valid
|
||||
function Server._thread:valid(skip_location_check)
|
||||
local skip_location_check = skip_location_check or false
|
||||
if is_type(self.uuid,'string') and
|
||||
skip_location_check or is_type(self.opened,'number') and
|
||||
skip_location_check or is_type(Server._threads().all[self.uuid],'table') and
|
||||
is_type(self.timeout) or is_type(self.timeout,'number') and
|
||||
is_type(self.name) or is_type(self.name,'string') and
|
||||
is_type(self._close) or is_type(self._close,'function') and
|
||||
is_type(self._timeout) or is_type(self._timeout,'function') and
|
||||
is_type(self._tick) or is_type(self._tick,'function') and
|
||||
is_type(self._resolve) or is_type(self._resolve,'function') and
|
||||
is_type(self._success) or is_type(self._success,'function') and
|
||||
is_type(self._error) or is_type(self._error,'function') then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--- Opens the thread by storing it in a place the server object can find it
|
||||
-- @usage thread:open() -- return true
|
||||
-- @treturn bolean if the thread was opened
|
||||
function Server._thread:open()
|
||||
if not self:valid(true) or self.opened then return false end
|
||||
local threads = Server._threads()
|
||||
local uuid = self.uuid
|
||||
self.opened = game.tick
|
||||
threads.all[uuid] = threads.all[uuid] or self
|
||||
threads.all._n = threads.all._n+1
|
||||
if threads.paused[self.name] then threads.paused[self.name] = nil end
|
||||
if is_type(self.timeout,'number') then table.insert(threads.timeout,uuid) end
|
||||
if is_type(self._tick,'function') then table.insert(threads.tick,uuid) end
|
||||
if is_type(self.name,'string') then threads.named[self.name] = threads.named[self.name] or self.uuid end
|
||||
if is_type(self._events,'table') then
|
||||
table.each(self._events,function(callback,event,threads,uuid)
|
||||
-- cant be used V
|
||||
--Server.add_thread_handler(event)
|
||||
if not threads.events[event] then threads.events[event] = {} end
|
||||
table.insert(threads.events[event],uuid)
|
||||
end,threads,self.uuid)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--- Inverse of thread:open() - it removes the thread and calles on_close
|
||||
-- @usage thread:close() -- return true
|
||||
-- @treturn bolean if the thread had a on_close function
|
||||
function Server._thread:close()
|
||||
local threads = Server._threads()
|
||||
local uuid = self.uuid
|
||||
local _return = false
|
||||
if is_type(self._close,'function') then pcall(self._close,self) _return = true end
|
||||
local value,key = table.find(threads.queue,function(v,k,uuid) return v == uuid end,uuid)
|
||||
if key then table.remove(threads.queue,key) end
|
||||
local value,key = table.find(threads.timeout,function(v,k,uuid) return v == uuid end,uuid)
|
||||
if key then table.remove(threads.timeout,key) end
|
||||
local value,key = table.find(threads.tick,function(v,k,uuid) return v == uuid end,uuid)
|
||||
if key then table.remove(threads.tick,key) end
|
||||
if is_type(self._events,'table') then
|
||||
table.each(self._events,function(callback,event)
|
||||
if threads.events[event] then
|
||||
local value,key = table.find(threads.events[event],function(v,k,uuid) return v == uuid end,uuid)
|
||||
if key then table.remove(threads.events[event],key) end
|
||||
-- cant be used V
|
||||
--if #threads.events[event] == 0 then Event.remove(event,Server.game_event) threads.events[event] = nil end
|
||||
end
|
||||
end)
|
||||
end
|
||||
self.opened=nil
|
||||
if self.reopen == true then self:open() else
|
||||
if is_type(self.name,'string') then threads.paused[self.name]=self.uuid
|
||||
else threads.all[uuid] = nil threads.all._n = threads.all._n-1 end
|
||||
end
|
||||
return _return
|
||||
end
|
||||
|
||||
--- Trigger the on_resolve function and closes the thread - error and success called based on result of pcall (useful for async)
|
||||
-- @usage thread:resolve(x,y,z) -- return true
|
||||
-- @param[opt] ... any arguments you want to pass to the resolve function
|
||||
-- @treturn bolean true if the thread called on_success or on_error
|
||||
function Server._thread:resolve(...)
|
||||
local _return = false
|
||||
if is_type(self._resolve,'function') then
|
||||
local success, err = pcall(self._resolve,self,...)
|
||||
if success then
|
||||
if is_type(self._success,'function') then
|
||||
Server.interface(function(thread,err)
|
||||
local success,err = pcall(thread._success,thread,err)
|
||||
if not success then thread:error(err) end
|
||||
end,true,self,err)
|
||||
_return = true
|
||||
end
|
||||
else
|
||||
_return = self:error(err)
|
||||
end
|
||||
end
|
||||
self:close()
|
||||
return _return
|
||||
end
|
||||
|
||||
--- Checks the timeout on a thread - if timedout then it calles on_timeout and closes
|
||||
-- @usage thread:check_timeout() -- return true
|
||||
-- @treturn bolean if the thread timedout
|
||||
function Server._thread:check_timeout()
|
||||
local _return = false
|
||||
if not self:valid() then return false end
|
||||
if is_type(self.timeout,'number') and game.tick >= (self.opened+self.timeout) then
|
||||
if is_type(self._timeout,'function') then
|
||||
pcall(self._timeout,self)
|
||||
end
|
||||
_return = true
|
||||
self:close()
|
||||
end
|
||||
return _return
|
||||
end
|
||||
|
||||
--- Rasies an error on this thread
|
||||
-- @usage thread:error(err) -- return true
|
||||
-- @param err the err to be rasied
|
||||
-- @treturn bolean did the thread handdle the error
|
||||
function Server._thread:error(err)
|
||||
local _return = false
|
||||
if is_type(self._error,'function') then
|
||||
pcall(self._error,self,err)
|
||||
_return = true
|
||||
else
|
||||
error(err)
|
||||
end
|
||||
return _return
|
||||
end
|
||||
--- Set function to run then an event is called on a thread, none of them are 'needed' but you are advised to have atleast one
|
||||
-- @usage thread:on_event('close',function) -- return true
|
||||
-- events = ['close','timeout','tick','resolve','success','error']
|
||||
-- if event is a number then it is asumed to be a game event
|
||||
-- @tparam string event the name of the event that it is called on
|
||||
-- @tparam function callback the function which is called on the event
|
||||
-- @treturn table returns self so that there can be chained
|
||||
function Server._thread:on_event(event,callback)
|
||||
local events = {'close','timeout','tick','resolve','success','error'}
|
||||
local value = table.find(events,function(v,k,find) return v == string.lower(find) end,event)
|
||||
if value and is_type(callback,'function') then
|
||||
self['_'..value] = callback
|
||||
elseif is_type(event,'number') and is_type(callback,'function') then
|
||||
if not self._events then self._events = {} end
|
||||
self._events[event] = callback
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
Event.register(defines.events.on_tick,function(event)
|
||||
if event.tick < 10 then return end
|
||||
local threads = Server._threads()
|
||||
if #threads.tick > 0 then Server.run_tick_threads() end
|
||||
if #threads.timeout > 0 then Server.check_timeouts() end
|
||||
if #threads.queue > 0 then
|
||||
local current_thread = threads.all[threads.queue[1]]
|
||||
if current_thread and current_thread:valid() then current_thread:resolve() end
|
||||
end
|
||||
end)
|
||||
|
||||
Event.register(-2,function(event)
|
||||
local threads = Server.threads()
|
||||
for uuid,thread in pairs(threads) do
|
||||
if uuid ~= '_n' then setmetatable(thread,{__index=Server._thread}) end
|
||||
end
|
||||
end)
|
||||
|
||||
return Server
|
||||
--[[
|
||||
Thread Example:
|
||||
|
||||
local thread = Server.new_thread{name='tree-decon',data={}}
|
||||
-- user thread:on_event('tick') rather than thread:on_event(defines.events.on_tick) as it makes less lag
|
||||
thread:on_event('tick',function(self)
|
||||
local trees = self.data
|
||||
if #trees == 0 then return end
|
||||
local tree = table.remove(trees,1)
|
||||
if tree.valid then tree.destroy() end
|
||||
end)
|
||||
thread:on_event('error',function(self,err)
|
||||
-- cant see how this can cause an error
|
||||
-- but this is where error handling goes
|
||||
-- any event including on_resolve and on_tick can raise this
|
||||
end)
|
||||
thread:on_event(defines.events.on_marked_for_deconstruction,function(self,event)
|
||||
if event.entity.type == 'tree' then
|
||||
table.insert(self.data,event.entity)
|
||||
end
|
||||
end)
|
||||
thread:open()
|
||||
|
||||
local thread = Server.new_thread{name='print-place',data={}}
|
||||
thread:on_event(defines.events.on_built_entity,function(self,event)
|
||||
game.print('Events')
|
||||
end)
|
||||
thread:open()
|
||||
|
||||
all on_event functions can be chained from the thread creation rather than use varibles
|
||||
]]
|
||||
361
ExpCore/sync.lua
361
ExpCore/sync.lua
@@ -1,361 +0,0 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
-- this file is used to allow easy syncing with out side programes
|
||||
local Sync = {}
|
||||
local Sync_gui_functions = {}
|
||||
local Sync_updates = {}
|
||||
|
||||
--- Used as a faster way to get to the ranking function, overrides previous
|
||||
-- @usage Sync.set_ranks{name=rank_name}
|
||||
function Sync.set_ranks(...)
|
||||
Ranking._base_preset(...)
|
||||
end
|
||||
|
||||
--- Used to standidise the tick format for any sync info
|
||||
-- @usage Sync.tick_format(60) -- return {60,'1.00M'}
|
||||
function Sync.tick_format(tick)
|
||||
return {tick,tick_to_display_format(tick)}
|
||||
end
|
||||
|
||||
--- Prints to chat as if it were a player
|
||||
-- @usage Sync.print('Test','Cooldude2606')
|
||||
-- @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] 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
|
||||
local player = game.player or game.players[player_name]
|
||||
local tag = player_tag and player_tag ~= '' and ' '..player_tag or ''
|
||||
local colour = player_colour and player_colour ~= '' and player_colour or '#FFFFFF'
|
||||
local prefix = prefix and prefix..' ' or ''
|
||||
if player then
|
||||
tag = ' '..player.tag
|
||||
colour = player.chat_color
|
||||
player_name = player.name
|
||||
else
|
||||
if colour:find('#') then
|
||||
colour = Color.from_hex(colour)
|
||||
else
|
||||
colour = defines.color[player_colour]
|
||||
end
|
||||
end
|
||||
game.print(prefix..player_name..tag..': '..player_message,colour)
|
||||
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
|
||||
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 ''
|
||||
local color = is_type(args.color,'string') and args.color:find("0x") and args.color or '0x0'
|
||||
local description = is_type(args.description,'string') and args.description or ''
|
||||
local server_detail = is_type(args.server_detail,'string') and args.server_detail or ''
|
||||
local mods_online = 'Mods Online: '..Sync.info().players.admins_online
|
||||
local done, fields = {title=true,color=true,description=true,server_detail=true}, {{
|
||||
name='Server Details',
|
||||
value='Server Name: {{ serverName }} Online Players: '..#game.connected_players..' '..mods_online..' Server Time: '..tick_to_display_format(game.tick)..' '..server_detail
|
||||
}}
|
||||
for key, value in pairs(args) do
|
||||
if not done[key] then
|
||||
done[key] = true
|
||||
local f = {name=key,value='',inline=false}
|
||||
local value, inline = value:gsub("<<inline>>",'',1)
|
||||
f.value = value
|
||||
if inline > 0 then f.inline = true end
|
||||
table.insert(fields,f)
|
||||
end
|
||||
end
|
||||
local log_data = {
|
||||
title=title,
|
||||
description=description,
|
||||
color=color,
|
||||
fields=fields
|
||||
}
|
||||
game.write_file('embeded.json',table.json(log_data)..'\n',true,0)
|
||||
end
|
||||
|
||||
-- set up error handle
|
||||
verbose('Set New Error Handle')
|
||||
_G.error_handle = function(err)
|
||||
local color = _G.Color and Color.to_hex(defines.text_color.bg) or '0x0'
|
||||
Sync.emit_embeded{title='SCRIPT ERROR',color=color,description='There was an error in the script @Developers ',Error=err}
|
||||
end
|
||||
|
||||
--- used to get the number of admins currently online
|
||||
-- @usage Sync.count_admins()
|
||||
-- @treturn int the number of admins online
|
||||
function Sync.count_admins()
|
||||
if not game then return 0 end
|
||||
local _count = 0
|
||||
for _,player in pairs(game.connected_players) do
|
||||
if player.admin then _count=_count+1 end
|
||||
end
|
||||
return _count
|
||||
end
|
||||
|
||||
--- used to get the number of afk players defined by 2 min by default
|
||||
-- @usage Sync.count_afk()
|
||||
-- @tparam[opt=7200] int time in ticks that a player is called afk
|
||||
-- @treturn int the number of afk players
|
||||
function Sync.count_afk_times(time)
|
||||
if not game then return 0 end
|
||||
local time = time or 7200
|
||||
local rtn = {}
|
||||
for _,player in pairs(game.connected_players) do
|
||||
if player.afk_time > time then rtn[player.name] = Sync.tick_format(player.afk_time) end
|
||||
end
|
||||
return rtn
|
||||
end
|
||||
|
||||
--- used to get the number of players in each rank and currently online
|
||||
-- @usage Sync.count_ranks()
|
||||
-- @treturn table contains the ranks and the players in that rank
|
||||
function Sync.count_ranks()
|
||||
if not game then return {'Offline'} end
|
||||
local _ranks = {}
|
||||
for power,rank in pairs(Ranking._ranks()) do
|
||||
local players = rank:get_players()
|
||||
for k,player in pairs(players) do players[k] = player.name end
|
||||
local online = rank:get_players(true)
|
||||
for k,player in pairs(online) do online[k] = player.name end
|
||||
_ranks[rank.name] = {players=players,online=online,n_players=#players,n_online=#online}
|
||||
end
|
||||
return _ranks
|
||||
end
|
||||
|
||||
--- used to get the number of players either online or all
|
||||
-- @usage Sync.count_players()
|
||||
-- @tparam bolean online if true only get online players
|
||||
-- @treturn table contains player names
|
||||
function Sync.count_players(online)
|
||||
if not game then return {'Offline'} end
|
||||
local _players = {}
|
||||
local players = {}
|
||||
if online then _players = game.connected_players else _players = game.players end
|
||||
for k,player in pairs(_players) do table.insert(players,player.name) end
|
||||
return players
|
||||
end
|
||||
|
||||
--- used to get the number of players resulting in there play times
|
||||
-- @usage Sync.count_player_times()
|
||||
-- @treturn table contains players and each player is given a tick amount and a formated string
|
||||
function Sync.count_player_times()
|
||||
if not game then return {'Offline'} end
|
||||
local _players = {}
|
||||
for index,player in pairs(game.players) do
|
||||
_players[player.name] = Sync.tick_format(player.online_time)
|
||||
end
|
||||
return _players
|
||||
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
|
||||
-- @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
|
||||
if not global.exp_core.sync then global.exp_core.sync = {
|
||||
server_name='Factorio Server',
|
||||
server_description='A factorio server for everyone',
|
||||
reset_time='On Demand',
|
||||
time='Day Mth 00 00:00:00 UTC Year',
|
||||
game_speed=game.speed,
|
||||
time_set=Sync.tick_format(0),
|
||||
last_update=Sync.tick_format(0),
|
||||
time_period=Sync.tick_format(18000),
|
||||
players={
|
||||
online=Sync.count_players(true),
|
||||
n_online=#game.connected_players,
|
||||
all=Sync.count_players(),
|
||||
n_all=#game.players,
|
||||
admins_online=Sync.count_admins(),
|
||||
afk_players=Sync.count_afk_times(),
|
||||
times=Sync.count_player_times()
|
||||
},
|
||||
ranks=Sync.count_ranks(),
|
||||
rockets=game.forces['player'].get_item_launched('satellite'),
|
||||
mods={'base'}
|
||||
} end
|
||||
if not set then return global.exp_core.sync
|
||||
else
|
||||
if not is_type(set,'table') then return false end
|
||||
for key,value in pairs(set) do
|
||||
global.exp_core.sync[key] = value
|
||||
end
|
||||
return true
|
||||
end
|
||||
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
|
||||
-- @return either true false if setting or the date time and tick off set
|
||||
function Sync.time(set)
|
||||
local info = Sync.info()
|
||||
if not set then return info.time..' (+'..(game.tick-info.time_set[1])..' Ticks)'
|
||||
else
|
||||
if not is_type(set,'string') then return false end
|
||||
info.time = set
|
||||
info.time_set[1] = game.tick
|
||||
info.time_set[2] = tick_to_display_format(game.tick)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
--- called to update values inside of the info
|
||||
-- @usage Sync.update()
|
||||
-- @return all of the new info
|
||||
function Sync.update()
|
||||
local info = Sync.info()
|
||||
info.time_period[2] = tick_to_display_format(info.time_period[1])
|
||||
info.last_update[1] = game.tick
|
||||
info.last_update[2] = tick_to_display_format(game.tick)
|
||||
info.game_speed=game.speed
|
||||
info.players={
|
||||
online=Sync.count_players(true),
|
||||
n_online=#game.connected_players,
|
||||
all=Sync.count_players(),
|
||||
n_all=#game.players,
|
||||
admins_online=Sync.count_admins(),
|
||||
afk_players=Sync.count_afk_times(),
|
||||
times=Sync.count_player_times()
|
||||
}
|
||||
info.ranks = Sync.count_ranks()
|
||||
info.rockets = game.forces['player'].get_item_launched('satellite')
|
||||
for key,callback in pairs(Sync_updates) do info[key] = callback() end
|
||||
return info
|
||||
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
|
||||
function Sync.add_update(key,callback)
|
||||
if game then return end
|
||||
if not is_type(callback,'function') then return end
|
||||
Sync_updates[key] = callback
|
||||
end
|
||||
|
||||
--- outputs the curent server info into a file
|
||||
-- @usage Sync.emit_data()
|
||||
function Sync.emit_data()
|
||||
local info = Sync.info()
|
||||
game.write_file('server-info.json',table.json(info),false,0)
|
||||
end
|
||||
|
||||
-- will auto replace the file every 5 min by default
|
||||
Event.register(defines.events.on_tick,function(event)
|
||||
local time = Sync.info().time_period[1]
|
||||
if (event.tick%time)==0 then Sync.update() Sync.emit_data() end
|
||||
end)
|
||||
|
||||
--- Adds a emeltent to the sever info gui
|
||||
-- @usage Sync.add_to_gui('string') -- return trues
|
||||
-- @param element see examples before for what can be used, it can also be a return from Gui.inputs.add
|
||||
-- @treturn bolean based on weather it was successful or not
|
||||
function Sync.add_to_gui(element,...)
|
||||
if game then return false end
|
||||
if is_type(element,'function') then
|
||||
table.insert(Sync_gui_functions,{'function',element,...})
|
||||
elseif is_type(element,'table') then
|
||||
if element.draw then table.insert(Sync_gui_functions,{'gui',element})
|
||||
else table.insert(Sync_gui_functions,{'table',element}) end
|
||||
else table.insert(Sync_gui_functions,{'string',element}) end
|
||||
return true
|
||||
end
|
||||
|
||||
-- Examples for Sync.add_to_gui
|
||||
-- adds a basic string to the table
|
||||
Sync.add_to_gui('Welcome to the Explosive Gaming comunity! This is one of many servers which we host.')
|
||||
-- adds a string that can have depentant values
|
||||
Sync.add_to_gui(function(player,frame)
|
||||
return 'You have been assigned the rank \''..Ranking.get_rank(player).name..'\''
|
||||
end)
|
||||
Sync.add_to_gui(function(player,frame)
|
||||
return 'This server\'s next reset: '..Sync.info().reset_time
|
||||
end)
|
||||
-- if readme is included then see addons/guis/readme.lua for more examples
|
||||
|
||||
-- used to load the gui infomation when _G.Gui is not yet loaded
|
||||
-- internal use not recomend to be used
|
||||
function Sync._load()
|
||||
local function label_format(label,width)
|
||||
label.style.width = width
|
||||
label.style.align = 'center'
|
||||
label.style.single_line = false
|
||||
end
|
||||
Gui.center.add{
|
||||
name='server-info',
|
||||
caption='Server Info',
|
||||
tooltip='Basic info about the current server',
|
||||
draw=function(self,frame)
|
||||
frame.caption = ''
|
||||
local info = Sync.info()
|
||||
local frame = frame.add{type='flow',direction='vertical'}
|
||||
local _flow = frame.add{type='flow'}
|
||||
Gui.bar(_flow,200)
|
||||
label_format(_flow.add{
|
||||
type='label',
|
||||
caption='Welcome To '..info.server_name,
|
||||
style='caption_label'
|
||||
},180)
|
||||
Gui.bar(_flow,200)
|
||||
label_format(frame.add{
|
||||
type='label',
|
||||
caption=info.server_description,style='description_label'
|
||||
},600)
|
||||
Gui.bar(frame,600)
|
||||
local _frame = frame
|
||||
local frame = frame.add{
|
||||
type='frame',
|
||||
direction='vertical',
|
||||
style='image_frame'
|
||||
}
|
||||
frame.style.width = 600
|
||||
local text_flow = frame.add{type='flow',direction='vertical'}
|
||||
local button_flow = frame.add{type='table',column_count=3}
|
||||
for _,element in pairs(table.deepcopy(Sync_gui_functions)) do
|
||||
local _type = table.remove(element,1)
|
||||
if _type == 'function' then
|
||||
local success, err = pcall(table.remove(element,1),frame.player_index,frame,unpack(element))
|
||||
if not success then error(err) else
|
||||
if is_type(err,'table') then
|
||||
if element.draw then element:draw(button_flow).style.width = 195
|
||||
else label_format(text_flow.add{type='label',caption=err},585) end
|
||||
else label_format(text_flow.add{type='label',caption=tostring(err)},585) end
|
||||
end
|
||||
elseif _type == 'gui' then element[1]:draw(button_flow).style.width = 195
|
||||
elseif _type == 'string' then label_format(text_flow.add{type='label',caption=tostring(element[1])},585)
|
||||
elseif _type == 'table' then label_format(text_flow.add{type='label',caption=element[1]},585) end
|
||||
end
|
||||
_frame.add{
|
||||
type='label',
|
||||
caption='Press Esc or E to close; this is only visible once!',
|
||||
style='fake_disabled_label'
|
||||
}.style.font='default-small'
|
||||
end}
|
||||
end
|
||||
|
||||
-- opens the server info gui for all new joins except admins
|
||||
Event.register(defines.events.on_player_joined_game,function(event)
|
||||
local player = Game.get_player(event)
|
||||
Gui.center.open(player,'server-info')
|
||||
end)
|
||||
|
||||
return Sync
|
||||
126
ExpLib.lua
126
ExpLib.lua
@@ -1,126 +0,0 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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 ExpLib
|
||||
-- @usage require('/ExpLib')
|
||||
|
||||
local ExpLib = {}
|
||||
--- Loads a table into the global lua table
|
||||
-- @usage a = {k1='foo',k2='bar'}
|
||||
-- _load_to_G(a)
|
||||
-- @tparam table tbl table to add to the global lua table
|
||||
function ExpLib._unpack_to_G(tbl)
|
||||
if not type(tbl) == 'table' or game then return end
|
||||
for name,value in pairs(tbl) do
|
||||
if not _G[name] then _G[name] = value end
|
||||
end
|
||||
end
|
||||
|
||||
--- Returns a bolean based on the type of v matching the test type
|
||||
-- @usage a = 'foo'
|
||||
-- is_type(a,'string') -- return true
|
||||
-- @param v the value to be tested
|
||||
-- @tparam[opt=nil] string test_type the type to test for if nil then it tests for nil
|
||||
-- @treturn bolean is v a matching type
|
||||
function ExpLib.is_type(v,test_type)
|
||||
return test_type and v and type(v) == test_type or not test_type and not v or false
|
||||
end
|
||||
|
||||
--- Returns a value to the player or if no player then log the return
|
||||
-- @usage a = 'to return'
|
||||
-- player_return(a)
|
||||
-- @param rtn the value to return
|
||||
-- @param player the player to print to
|
||||
function ExpLib.player_return(rtn,colour,player)
|
||||
local colour = colour or defines.color.white
|
||||
local player = player or game.player
|
||||
if player then
|
||||
local player = Game.get_player(player)
|
||||
if not player then return end
|
||||
player.play_sound{path='utility/scenario_message'}
|
||||
if is_type(rtn,'table') then
|
||||
-- test if its a localised string
|
||||
if is_type(rtn.__self,'userdata') then player.print('Cant Display Userdata',colour)
|
||||
elseif is_type(rtn[1],'string') and string.find(rtn[1],'.+[.].+') and not string.find(rtn[1],'%s') then pcall(player.print,rtn,colour)
|
||||
else player.print(table.to_string(rtn),colour)
|
||||
end
|
||||
elseif is_type(rtn,'function') then player.print('Cant Display Functions',colour)
|
||||
else player.print(tostring(rtn),colour)
|
||||
end
|
||||
else
|
||||
local _return = 'Invalid'
|
||||
if is_type(rtn,'table') then _return = table.to_string(rtn)
|
||||
elseif is_type(rtn,'function') then _return = 'Cant Display Functions'
|
||||
elseif is_type(rtn,'userdata') then _return = 'Cant Display Userdata'
|
||||
else _return = tostring(rtn)
|
||||
end log(_return) rcon.print(_return)
|
||||
end
|
||||
end
|
||||
|
||||
--- Convert ticks to hours
|
||||
-- @usage a = 216001
|
||||
-- tick_to_hour(a) -- return 1
|
||||
-- @tparam number tick to convert to hours
|
||||
-- @treturn number the number of whole hours from this tick
|
||||
function ExpLib.tick_to_hour(tick)
|
||||
if not is_type(tick,'number') then return 0 end
|
||||
return math.floor(tick/(216000*game.speed))
|
||||
end
|
||||
|
||||
--- Convert ticks to minutes
|
||||
-- @usage a = 3601
|
||||
-- tick_to_hour(a) -- return 1
|
||||
-- @tparam number tick to convert to minutes
|
||||
-- @treturn number the number of whole minutes from this tick
|
||||
function ExpLib.tick_to_min (tick)
|
||||
if not is_type(tick,'number') then return 0 end
|
||||
return math.floor(tick/(3600*game.speed))
|
||||
end
|
||||
|
||||
--- Returns a tick in a displayable format
|
||||
-- @usage a = 3600
|
||||
-- tick_to_display_format(a) -- return '1.00 M'
|
||||
-- @usage a = 234000
|
||||
-- tick_to_display_format(a) -- return '1 H 5 M'
|
||||
-- @tparam number tick to convert
|
||||
-- @treturn string the formated string
|
||||
function ExpLib.tick_to_display_format(tick)
|
||||
if not is_type(tick,'number') then return '0H 0M' end
|
||||
if tick_to_min(tick) < 10 then
|
||||
return string.format('%.2f M',tick/(3600*game.speed))
|
||||
else
|
||||
return string.format('%d H %d M',
|
||||
tick_to_hour(tick),
|
||||
tick_to_min(tick)-60*tick_to_hour(tick)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
function ExpLib.Gui_tree(root)
|
||||
local tree = {}
|
||||
for _,child in pairs(root.children) do
|
||||
if #child.children > 0 then
|
||||
if child.name then
|
||||
tree[child.name] = ExpLib.Gui_tree(child)
|
||||
else
|
||||
table.insert(tree,ExpLib.Gui_tree(child))
|
||||
end
|
||||
else
|
||||
if child.name then
|
||||
tree[child.name] = child.type
|
||||
else
|
||||
table.insert(tree,child.type)
|
||||
end
|
||||
end
|
||||
end
|
||||
return tree
|
||||
end
|
||||
|
||||
return ExpLib
|
||||
1
Factorio-luacheckrc
Submodule
1
Factorio-luacheckrc
Submodule
Submodule Factorio-luacheckrc added at 0c0518d165
754
FactorioSoftmodManager.lua
Normal file
754
FactorioSoftmodManager.lua
Normal file
@@ -0,0 +1,754 @@
|
||||
--- Factorio Softmod Manager
|
||||
-- @module FSM
|
||||
-- @alias Manager
|
||||
-- @author Cooldude2606
|
||||
-- @usage Manager = require("FactorioSoftmodManager")
|
||||
local moduleIndex = require("/modules/index")
|
||||
local Manager = {}
|
||||
|
||||
-- this is a constant that is used to represent the server
|
||||
SERVER = setmetatable({index=0,name='<server>',online_time=0,afk_time=0,print=print,admin=true,valid=true,__self={}},{__index=function(tbl,key) if type(game.players[1][key]) == 'function' then return function() end else return nil end end})
|
||||
|
||||
--- Setup for metatable of the Manager to force read only nature
|
||||
-- @usage Manager() -- runs Manager.loadModdules()
|
||||
-- @usage Manager[name] -- returns module by that name
|
||||
-- @usage tostring(Manager) -- returns formated list of loaded modules
|
||||
local ReadOnlyManager = setmetatable({},{
|
||||
__metatable=false,
|
||||
__index=function(tbl,key)
|
||||
-- first looks in manager and then looks in mander.loadModules
|
||||
return rawget(Manager,key) ~= nil and rawget(Manager,key) or rawget(Manager.loadModules,key)
|
||||
end,
|
||||
__call=function(tbl)
|
||||
-- if there are no modules loaded then it loads them
|
||||
if #tbl.loadModules == 0 then
|
||||
tbl.loadModules()
|
||||
end
|
||||
end,
|
||||
__newindex=function(tbl,key,value)
|
||||
-- provents the changing of any key that is not currentState
|
||||
if key == 'currentState' then
|
||||
-- provides a verbose that is always emited describing the change in state
|
||||
Manager.verbose(string.rep('__',10)..'| Start: '..value..' |'..string.rep('__',10),true)
|
||||
Manager.verbose('The verbose state is now: '..tostring(Manager.setVerbose[value]),true)
|
||||
rawset(Manager,key,value)
|
||||
else error('Manager is read only please use included methods',2) end
|
||||
end,
|
||||
__tostring=function(tbl)
|
||||
-- acts as a redirect
|
||||
return tostring(Manager.loadModules)
|
||||
end
|
||||
})
|
||||
|
||||
local function setupModuleName(name)
|
||||
-- creates a table that acts like a string but is read only
|
||||
return setmetatable({},{
|
||||
__index=function(tbl,key) return name end,
|
||||
__newindex=function(tbl,key,value) error('Module Name Is Read Only') end,
|
||||
__tostring=function(tbl) return name end,
|
||||
__concat=function(val1,val2) return type(val1) == 'string' and val1..name or name..val2 end,
|
||||
__metatable=false,
|
||||
})
|
||||
end
|
||||
|
||||
Manager.currentState = 'selfInit'
|
||||
-- selfInit > moduleLoad > moduleInit > modulePost > moduleEnv
|
||||
|
||||
--- Default output for the verbose
|
||||
-- @usage Manager.verbose('Hello, World!')
|
||||
-- @tparam string rtn the value that will be returned though verbose output
|
||||
Manager._verbose = function(rtn)
|
||||
-- creates one file per game, ie clears file on reset
|
||||
if game and Manager.setVerbose._output ~= true then Manager.setVerbose._output=true game.write_file('verbose.log',rtn)
|
||||
elseif game then game.write_file('verbose.log','\n'..rtn,true) end
|
||||
-- standard print and log, _log is a version of log which is ln1 of control.lua for shorter log lines
|
||||
if print then print(rtn) end
|
||||
if _log then _log(rtn) end
|
||||
end
|
||||
|
||||
--- Used to call the output of the verbose when the current state allows it
|
||||
-- @usage Manager.verbose('Hello, World!')
|
||||
-- @tparam string rtn the value that will be returned though verbose output
|
||||
-- @tparam string action is used to decide which verbose this is error || event etc
|
||||
Manager.verbose = function(rtn,action)
|
||||
local settings = Manager.setVerbose
|
||||
local state = Manager.currentState
|
||||
if Manager.error and state == Manager.error.__crash then return end
|
||||
-- if ran in a module the the global moduleName is present
|
||||
local rtn = type(rtn) == table and serpent.line(rtn) or tostring(rtn)
|
||||
if moduleName then rtn='['..moduleName..'] '..rtn
|
||||
else rtn='[FSM] '..rtn end
|
||||
-- module_verbose is a local override for a file, action is used in the manager to describe an extra type, state is the current state
|
||||
-- if action is true then it will always trigger verbose
|
||||
if module_verbose or (action and (action == true or settings[action])) or (not action and settings[state]) then
|
||||
if type(settings.output) == 'function' then
|
||||
-- calls the output function, not pcalled as if this fails some thing is very wrong
|
||||
settings.output(rtn)
|
||||
else
|
||||
error('Verbose set for: '..state..' but output can not be called',2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Main logic for allowing verbose at different stages though out the script
|
||||
-- @function Manager.setVerbose
|
||||
-- @usage Manager.setVerbose{output=log}
|
||||
-- @tparam newTbl settings the table that will be searched for settings to be updated
|
||||
-- @usage Manager.setVerbose[setting] -- returns the value of that setting
|
||||
-- @usage tostring(Manager.setVerbose) -- returns a formated list of the current settings
|
||||
Manager.setVerbose = setmetatable(
|
||||
--- Different verbose settings used for setVerbose
|
||||
-- @table Manager.verboseSettings
|
||||
-- @tfield boolean selfInit called while the manager is being set up
|
||||
-- @tfield boolean moduleLoad when a module is required by the manager
|
||||
-- @tfield boolean moduleInit when and within the initation of a module
|
||||
-- @tfield boolean modulePost when and within the post of a module
|
||||
-- @tfield boolean moduleEnv during module runtime, this is a global option set within each module(module_verbose=true ln:1) for fine control
|
||||
-- @tfield boolean eventRegistered when a module registers its event handlers
|
||||
-- @tfield boolean errorCaught when an error is caught during runtime
|
||||
-- @tfield function output can be: print || log || or other function
|
||||
-- @field _output a constant value that can used to store output data
|
||||
{
|
||||
selfInit=true,
|
||||
moduleLoad=false,
|
||||
moduleInit=false,
|
||||
modulePost=false,
|
||||
moduleEnv=false,
|
||||
eventRegistered=false,
|
||||
errorCaught=true,
|
||||
output=Manager._verbose,
|
||||
_output={}
|
||||
},
|
||||
{
|
||||
__metatable=false,
|
||||
__call=function(tbl,settings)
|
||||
-- does not allow any new keys, but will override any existing ones
|
||||
for key,value in pairs(settings) do
|
||||
if rawget(tbl,key) ~= nil then
|
||||
Manager.verbose('Verbose for: "'..key..'" has been set to: '..tostring(value))
|
||||
rawset(tbl,key,value)
|
||||
end
|
||||
end
|
||||
end,
|
||||
__newindex=function(tbl,key,value)
|
||||
-- stops creationg of new keys
|
||||
error('New settings cannot be added during runtime',2)
|
||||
end,
|
||||
__index=function(tbl,key)
|
||||
-- will always return a value, never nil
|
||||
return rawget(tbl,key) or false
|
||||
end,
|
||||
__tostring=function(tbl)
|
||||
-- a simple concat function for the settings
|
||||
local rtn = ''
|
||||
for key,value in pairs(tbl) do
|
||||
if type(value) == 'boolean' then
|
||||
rtn=rtn..key..': '..tostring(value)..', '
|
||||
end
|
||||
end
|
||||
return rtn:sub(1,-3)
|
||||
end
|
||||
}
|
||||
)
|
||||
-- call to verbose to show start up, will always be present
|
||||
Manager.verbose(string.rep('__',10)..'| Start: selfInit |'..string.rep('__',10),true)
|
||||
Manager.verbose('The verbose state is: '..tostring(Manager.setVerbose.selfInit),true)
|
||||
|
||||
--- Used to avoid conflicts in the global table
|
||||
-- @usage global[key] -- used like the normal global table
|
||||
-- @usage global{'foo','bar'} -- sets the default value
|
||||
-- @usage global(true) -- restores global to default
|
||||
-- @usage global(mopdule_name) -- returns that module's global
|
||||
-- @tparam[opt={}] ?table|string|true if table then the default for the global, if a string then the module to get the global of, if true then reset the global to default
|
||||
-- @treturn table the new global table for that module
|
||||
Manager.global=setmetatable({__defaults={},__global={
|
||||
__call=function(tbl,default) return Manager.global(default) end,
|
||||
__index=function(tbl,key) return rawget(Manager.global(),key) or tbl(key) end,
|
||||
__newindex=function(tbl,key,value) rawset(Manager.global(),key,value) end,
|
||||
__pairs=function(tbl)
|
||||
local tbl = Manager.global()
|
||||
local function next_pair(tbl,k)
|
||||
k, v = next(tbl, k)
|
||||
if type(v) ~= nil then return k,v end
|
||||
end
|
||||
return next_pair, tbl, nil
|
||||
end
|
||||
}},{
|
||||
__call=function(tbl,default,metatable_src)
|
||||
-- creates varible link to global and module information, use of a metatable is for already formed globals
|
||||
local Global = _G.global
|
||||
local metatable = getmetatable(metatable_src)
|
||||
local moduleName = type(default) == 'string' and default or metatable and metatable._moduleName or moduleName
|
||||
local module_path = type(default) == 'string' and Manager.loadModules.__load[default] or metatable and metatable._module_path or module_path
|
||||
-- if there is no name or path then it will return and unedited version of global
|
||||
if not module_path or not moduleName then return _G.global end
|
||||
-- edits the link to global to be the corrected dir, path varible is also created
|
||||
local path = 'global'
|
||||
for dir in module_path:gmatch('%a+') do
|
||||
path = path..'.'..dir
|
||||
if not rawget(Global,dir) then Manager.verbose('Added Global Dir: '..path) rawset(Global,dir,{}) end
|
||||
Global = rawget(Global,dir)
|
||||
end
|
||||
-- the default value is set if there was a default given
|
||||
if type(default) == 'table' then Manager.verbose('Default global has been set for: global'..string.sub(module_path:gsub('/','.')),2) rawset(rawget(tbl,'__defaults'),tostring(moduleName),default) end
|
||||
-- if the default value is true then it will reset the global to its default
|
||||
if default == true and rawget(rawget(tbl,'__defaults'),tostring(moduleName)) then
|
||||
Manager.verbose('Reset Global Dir to default: '..path)
|
||||
-- cant set it to be equle otherwise it will lose its global propeity
|
||||
local function deepcopy(tbl) if type(tbl) ~= 'table' then return tbl end local rtn = {} for key,value in pairs(tbl) do rtn[key] = deepcopy(value) end return rtn end
|
||||
for key,value in pairs(Global) do rawset(Global,key,nil) end
|
||||
for key,value in pairs(rawget(rawget(tbl,'__defaults'),tostring(moduleName))) do rawset(Global,key,deepcopy(value)) end
|
||||
end
|
||||
-- the metatable is remade if not already present
|
||||
metatable = metatable or {
|
||||
__call=function(tbl,default) return Manager.global(default,tbl) end,
|
||||
__index=function(tbl,key) return rawget(Manager.global(nil,tbl),key) or moduleIndex[key] and Manager.global(key) end,
|
||||
__newindex=function(tbl,key,value) rawset(Manager.global(nil,tbl),key,value) end,
|
||||
__pairs=function(tbl)
|
||||
local tbl = Manager.global(nil,tbl)
|
||||
local function next_pair(tbl,k)
|
||||
k, v = next(tbl, k)
|
||||
if type(v) ~= nil then return k,v end
|
||||
end
|
||||
return next_pair, tbl, nil
|
||||
end,
|
||||
_module_path=module_path,_moduleName=moduleName
|
||||
}
|
||||
return setmetatable(Global,metatable)
|
||||
end,
|
||||
__index=function(tbl,key) return rawget(tbl(),key) or rawget(_G.global,key) or moduleIndex[key] and Manager.global(key) end,
|
||||
__newindex=function(tbl,key,value) rawset(tbl(),key,value) end,
|
||||
__pairs=function(tbl)
|
||||
local tbl = Manager.global()
|
||||
local function next_pair(tbl,k)
|
||||
k, v = next(tbl, k)
|
||||
if type(v) ~= nil then return k,v end
|
||||
end
|
||||
return next_pair, tbl, nil
|
||||
end
|
||||
})
|
||||
setmetatable(global,Manager.global.__global)
|
||||
|
||||
--- Creates a sand box envorment and runs a callback in that sand box; provents global pollution
|
||||
-- @function Manager.sandbox
|
||||
-- @usage Manager.sandbox(callback) -- return sandbox, success, other returns from callback
|
||||
-- @tparam function callback the function that will be ran in the sandbox
|
||||
-- @param[opt] env any other params that the function will use
|
||||
-- @usage Manager.sandbox() -- returns and empty sandbox
|
||||
-- @usage Manager.sandbox[key] -- returns the sand box value in that key
|
||||
Manager.sandbox = setmetatable({
|
||||
-- can not use existing keys of _G
|
||||
verbose=Manager.verbose,
|
||||
loaded_modules={}, -- this is over riden later
|
||||
module_verbose=false,
|
||||
module_exports=false,
|
||||
_no_error_verbose=true
|
||||
},{
|
||||
__metatable=false,
|
||||
__index=ReadOnlyManager,
|
||||
__call=function(tbl,callback,env,...)
|
||||
if type(callback) == 'function' then
|
||||
-- creates a new sandbox env
|
||||
local sandbox = tbl()
|
||||
local env = type(env) == 'table' and env or {}
|
||||
local _G_mt = getmetatable(_G)
|
||||
-- creates a new ENV where it will look in the provided env then the sand box and then _G, new indexes saved to sandbox
|
||||
local tmp_env = setmetatable({},{__index=function(tbl,key) return env[key] or sandbox[key] or rawget(_G,key) end,newindex=sandbox})
|
||||
tmp_env._ENV = tmp_env
|
||||
tmp_env._G_mt = _G_mt
|
||||
-- sets the upvalues for the function
|
||||
local i = 1
|
||||
while true do
|
||||
local name, value = debug.getupvalue(callback,i)
|
||||
if not name then break else if not value and tmp_env[name] then debug.setupvalue(callback,i,tmp_env[name]) end end
|
||||
i=i+1
|
||||
end
|
||||
-- runs the callback
|
||||
setmetatable(_G,{__index=tmp_env,newindex=sandbox})
|
||||
local rtn = {pcall(callback,...)}
|
||||
local success = table.remove(rtn,1)
|
||||
setmetatable(_G,_G_mt)
|
||||
-- this is to allow modules to be access with out the need of using Mangaer[name] also keeps global clean
|
||||
if success then return success, rtn, sandbox
|
||||
else return success, rtn[1], sandbox end
|
||||
else return setmetatable({},{__index=tbl}) end
|
||||
end
|
||||
})
|
||||
|
||||
--- Allows access to modules via require and collections are returned as one object
|
||||
-- @function Manager.require
|
||||
-- @usage local Module = Manager.require(ModuleName)
|
||||
-- @usage local Module = Manager.require[ModuleName]
|
||||
-- @usage local SrcData = Manager.require(path)
|
||||
-- @treturn table the module that was required, one object containg submodules for a
|
||||
Manager.require = setmetatable({
|
||||
__require=require
|
||||
},{
|
||||
__metatable=false,
|
||||
__index=function(tbl,key) return tbl(key,nil,true) end,
|
||||
__call=function(tbl,path,env,mute,noLoad)
|
||||
local raw_require = rawget(tbl,'__require')
|
||||
local env = env or {}
|
||||
-- runs in a sand box becuase sandbox everything
|
||||
local success, data = Manager.sandbox(raw_require,env,path)
|
||||
-- if there was no error then it assumed the path existed and returns the data
|
||||
if success then return unpack(data)
|
||||
else
|
||||
if type(path) ~= 'string' then error('Path supplied must be a string; got: '..type(path),2) return end
|
||||
local override = {}
|
||||
local softmod = override
|
||||
local path = path:find('@') and path:sub(1,path:find('@')-1) or path
|
||||
-- tries to load the module from the modeul index
|
||||
if moduleIndex[path] and not noLoad or Manager.loadModules.__load[path] then softmod = Manager.loadModules[path] end
|
||||
-- will then look for any submodules if there are any; only once every module is loaded
|
||||
for moduleName,subpath in pairs(moduleIndex) do
|
||||
if moduleName:find(path) == 1 and moduleName ~= path then
|
||||
local start, _end = moduleName:find(path)
|
||||
local subname = moduleName:sub(_end+2)
|
||||
-- does not add the module if it is a subsubmodule; or the key already exitsts
|
||||
if not softmod then softmod = {} end
|
||||
if not subname:find('.',nil,true) and not softmod[subname] then softmod[subname] = Manager.require(moduleName,nil,true,true) end
|
||||
end
|
||||
end
|
||||
-- if there is any keys in the softmod it is returned else the errors with the require error
|
||||
if override ~= softmod then return softmod end
|
||||
if mute then return false else error(data,2) end
|
||||
end
|
||||
end
|
||||
})
|
||||
require = Manager.require
|
||||
|
||||
--- Loads the modules that are present in the index list
|
||||
-- @function Manager.loadModules
|
||||
-- @usage Manager.loadModules() -- loads all moddules in the index list
|
||||
-- @usage #Manager.loadModules -- returns the number of modules loaded
|
||||
-- @usage tostring(Manager.loadModules) -- returns a formatted list of all modules loaded
|
||||
-- @usage pairs(Manager.loadModules) -- loops over the loaded modules moduleName, module
|
||||
Manager.loadModules = setmetatable({
|
||||
__load=setmetatable({},{__call=function(self,moduleName)
|
||||
-- check to provent multiple calls
|
||||
if self[moduleName] then return end
|
||||
self[moduleName] = true
|
||||
self = Manager.loadModules
|
||||
-- loads the module and its dependices if there are not loaded
|
||||
local load = moduleIndex[moduleName]
|
||||
if not load then return end
|
||||
local path = table.remove(load,1)
|
||||
Manager.verbose('Loading module: "'..moduleName..'"; path: '..path)
|
||||
-- loads the parent module
|
||||
if moduleName:find('.',nil,true) then
|
||||
local revModuleName = moduleName:reverse()
|
||||
local start, _end = revModuleName:find('.',nil,true)
|
||||
local parentName = revModuleName:sub(_end+1):reverse()
|
||||
Manager.verbose('Loading module parent: "'..parentName..'" for: "'..moduleName..'"; path: '..path)
|
||||
self.__load(parentName)
|
||||
end
|
||||
-- loads the dependices
|
||||
Manager.verbose('Loading module dependices for: "'..moduleName..'"; path: '..path)
|
||||
for _,depName in pairs(load) do self.__load(depName) end
|
||||
self.__load[moduleName] = path
|
||||
-- runs the module in a sandbox env
|
||||
local success, module, sandbox = Manager.sandbox(Manager.require.__require,{moduleName=setupModuleName(moduleName),module_path=path},path..'/control')
|
||||
-- extracts the module into a global index table for later use
|
||||
if success then
|
||||
-- verbose to notifie of any globals that were attempted to be created
|
||||
local globals = ''
|
||||
for key,value in pairs(sandbox) do globals = globals..key..', ' end
|
||||
if globals ~= '' then Manager.verbose('Globals caught in "'..moduleName..'": '..globals:sub(1,-3),'errorCaught') end
|
||||
Manager.verbose('Successfully loaded: "'..moduleName..'"; path: '..path)
|
||||
-- if it is not a table or nil then it will set up a metatable on it
|
||||
local currentType = type(rawget(self,moduleName))
|
||||
if currentType ~= 'nil' and currentType ~= 'table' then
|
||||
-- if it is a function then it is still able to be called even if more keys are going to be added
|
||||
-- if it is a string then it will act like one; if it is a number well thats too many metatable indexs
|
||||
self[moduleName] = setmetatable({__old=self[moduleName]},{
|
||||
__call=function(self,...) if type(self.__old) == 'function' then self.__old(...) else return self.__old end end,
|
||||
__tostring=function(self) return self.__old end,
|
||||
__concat=function(self,val) return self.__old..val end
|
||||
})
|
||||
end
|
||||
-- if you prefere module_exports can be used rather than returning the module
|
||||
local appendAs = sandbox.module_exports or table.remove(module,1)
|
||||
if not self[moduleName] then self[moduleName] = appendAs -- if nil it just sets the value
|
||||
else for key,value in pairs(appendAs) do self[moduleName][key] = value end end -- else it appends the new values
|
||||
-- if there is a module by this name in _G ex table then it will be indexed to the new module
|
||||
if rawget(_G,moduleName) and type(rawget(self,moduleName)) == 'table' then setmetatable(rawget(_G,moduleName),{__index=self[moduleName]}) end
|
||||
if type(rawget(self,moduleName)) == 'table' then self[moduleName]._module_path = path self[moduleName]._moduleName = moduleName end
|
||||
-- loads the submodule for this softmod
|
||||
Manager.verbose('Loading submodules for: "'..moduleName..'"; path: '..path)
|
||||
for subModName,_ in pairs(moduleIndex) do
|
||||
if subModName:find(moduleName) == 1 and subModName ~= moduleName then self.__load(subModName) end
|
||||
end
|
||||
else
|
||||
Manager.verbose('Failed load: "'..moduleName..'"; path: '..path..' ('..module..')','errorCaught')
|
||||
for event_name,callbacks in pairs(Manager.event) do Manager.verbose('Removed Event Handler: "'..moduleName..'/'..Manager.event.names[event_name],'eventRegistered') callbacks[moduleName] = nil end
|
||||
end
|
||||
end}),
|
||||
__init=setmetatable({},{__call=function(self,moduleName)
|
||||
-- check to provent multiple calls
|
||||
if self[moduleName] or not Manager.loadModules.__load[moduleName] then return end
|
||||
self[moduleName] = true
|
||||
self = Manager.loadModules
|
||||
-- calls on_init for each module
|
||||
-- looks for init so that init or on_init can be used
|
||||
local data = self[moduleName]
|
||||
if type(data) == 'table' and data.init and data.on_init == nil then data.on_init = data.init data.init = nil end
|
||||
if type(data) == 'table' and data.on_init and type(data.on_init) == 'function' then
|
||||
Manager.verbose('Initiating module: "'..moduleName..'"')
|
||||
local success, err = Manager.sandbox(data.on_init,{moduleName=setupModuleName(moduleName),module_path=Manager.loadModules.__load[tostring(moduleName)]},data)
|
||||
if success then
|
||||
Manager.verbose('Successfully Initiated: "'..moduleName..'"')
|
||||
else
|
||||
Manager.verbose('Failed Initiation: "'..moduleName..'" ('..err..')','errorCaught')
|
||||
end
|
||||
-- clears the init function so it cant be used in runtime
|
||||
data.on_init = nil
|
||||
end
|
||||
end}),
|
||||
__post=setmetatable({},{__call=function(self,moduleName)
|
||||
-- check to provent multiple calls
|
||||
if self[moduleName] or not Manager.loadModules.__init[moduleName] then return end
|
||||
self[moduleName] = true
|
||||
self = Manager.loadModules
|
||||
-- calls on_post for each module
|
||||
-- looks for post so that post or on_post can be used
|
||||
local data = self[moduleName]
|
||||
if type(data) == 'table' and data.post and data.on_post == nil then data.on_post = data.post data.post = nil end
|
||||
if type(data) == 'table' and data.on_post and type(data.on_post) == 'function' then
|
||||
Manager.verbose('Post for module: "'..moduleName..'"')
|
||||
local success, err = Manager.sandbox(data.on_post,{moduleName=setupModuleName(moduleName),module_path=Manager.loadModules.__load[tostring(moduleName)]},data)
|
||||
if success then
|
||||
Manager.verbose('Successful post: "'..moduleName..'"')
|
||||
else
|
||||
Manager.verbose('Failed post: "'..moduleName..'" ('..err..')','errorCaught')
|
||||
end
|
||||
-- clears the post function so it cant be used in runtime
|
||||
data.on_post = nil
|
||||
end
|
||||
end})
|
||||
},
|
||||
{
|
||||
__metatable=false,
|
||||
__index=function(self,moduleName)
|
||||
-- will load one module if it is not already loaded, will not init during load state or post
|
||||
self.__load(moduleName)
|
||||
if (ReadOnlyManager.currentState == 'moduleLoad') then return end
|
||||
self.__init(moduleName)
|
||||
if (ReadOnlyManager.currentState == 'moduleInit') then return end
|
||||
self.__post(moduleName)
|
||||
return rawget(self,moduleName)
|
||||
end,
|
||||
__call=function(self)
|
||||
-- goes though the index looking for modules to load
|
||||
ReadOnlyManager.currentState = 'moduleLoad'
|
||||
for moduleName,path in pairs(moduleIndex) do self.__load(moduleName) end
|
||||
-- runs though all loaded modules looking for on_init function; all other modules have been loaded use this to load extra code based on opttial dependies
|
||||
ReadOnlyManager.currentState = 'moduleInit'
|
||||
for moduleName,path in pairs(self) do
|
||||
if moduleName ~= '__load' and moduleName ~= '__init' and moduleName ~= '__post' then self.__init(moduleName) end
|
||||
end
|
||||
-- runs though all loaded modules looking for on_post function; all other modules have been loaded and inited, do not load extra code in this time only altar your own data
|
||||
ReadOnlyManager.currentState = 'modulePost'
|
||||
for moduleName,path in pairs(self) do
|
||||
if moduleName ~= '__load' and moduleName ~= '__init' and moduleName ~= '__post' then self.__post(moduleName) end
|
||||
end
|
||||
ReadOnlyManager.currentState = 'moduleEnv'
|
||||
end,
|
||||
__len=function(tbl)
|
||||
-- counts the number of loaded modules
|
||||
local rtn = 0
|
||||
for key,value in pairs(tbl) do
|
||||
rtn = rtn + 1
|
||||
end
|
||||
return rtn-3
|
||||
end,
|
||||
__tostring=function(tbl)
|
||||
-- a concat of all the loaded modules
|
||||
local rtn = 'Load Modules: '
|
||||
for key,value in pairs(tbl) do
|
||||
if key ~= '__load' and key ~= '__init' and key ~= '__post' then rtn=rtn..key..', ' end
|
||||
end
|
||||
return rtn:sub(1,-3)
|
||||
end
|
||||
}
|
||||
)
|
||||
Manager.sandbox.loaded_modules = Manager.loadModules
|
||||
|
||||
--- A more detailed replacement for the lua error function to allow for handlers to be added; repleaces default error so error can be used instead of Manager.error
|
||||
-- @function Manager.error
|
||||
-- @usage Manager.error(err) -- calls all error handlers that are set or if none then prints to game and if that fails crashs game
|
||||
-- @usage Manager.error() -- returns an error constant that can be used to crash game
|
||||
-- @usage Manager.error(Manager.error()) -- crashs the game
|
||||
-- @usage Manager.error.addHandler(name,callback) -- adds a new handler if handler returns Manager.error() then game will crash
|
||||
-- @tparam[2] ?string|fucntion err the string to be passed to handlers; if a function it will register a handler
|
||||
-- @tparam[2] function callback if given the err param will be used to given the handler a name
|
||||
-- @usage Manager.error[name] -- returns the handler of that name if present
|
||||
-- @usage #Manager.error -- returns the number of error handlers that are present
|
||||
-- @usage pairs(Manager.error) -- loops over only the error handlers handler_name,hander
|
||||
Manager.error = setmetatable({
|
||||
__crash=false,
|
||||
__error_call=error,
|
||||
__error_const={},
|
||||
__error_handler=function(handler_name,callback)
|
||||
-- when handler_name is a string it is expeced that callback is a function; other wise handler_name must be a function
|
||||
if type(handler_name) == 'string' and type(callback) == 'function' then Manager.error[handler_name]=callback
|
||||
elseif type(handler_name) == 'function' then table.insert(Manager.error,handler_name)
|
||||
else Manager.error('Handler is not a function',2) end
|
||||
end,
|
||||
in_pcall=function(level)
|
||||
local level = level and level+1 or 2
|
||||
while true do
|
||||
if not debug.getinfo(level) then return false end
|
||||
if debug.getinfo(level).name == 'pcall' then return level end
|
||||
level=level+1
|
||||
end
|
||||
end
|
||||
},{
|
||||
__metatalbe=false,
|
||||
__call=function(tbl,err,...)
|
||||
-- if no params then return the error constant
|
||||
if err == nil then return rawget(tbl,'__error_const') end
|
||||
-- if the error constant is given crash game
|
||||
if err == rawget(tbl,'__error_const') then Manager.verbose('Force Crash','errorCaught') rawset(tbl,'__crash',true) rawget(tbl,'__error_call')('Force Crash',2) end
|
||||
-- other wise treat the call as if its been passed an err string
|
||||
if not _no_error_verbose or Manager.currentState ~= 'moduleEnv' then Manager.verbose('An error has occurred: '..err,'errorCaught') end
|
||||
if #tbl > 0 then
|
||||
-- there is at least one error handler loaded; loops over the error handlers
|
||||
for handler_name,callback in pairs(tbl) do
|
||||
local success, err = pcall(callback,err,...)
|
||||
if not success then Manager.verbose('Error handler: "'..handler_name..'" failed to run ('..err..')','errorCaught') end
|
||||
-- if the error constant is returned from the handler then crash the game
|
||||
if err == rawget(tbl,'__error_const') then Manager.verbose('Force Stop by: '..handler_name,'errorCaught') rawset(tbl,'__crash',true) rawget(tbl,'__error_call')('Force Stop by: '..handler_name) end
|
||||
end
|
||||
elseif game then
|
||||
-- there are no handlers loaded so it will print to the game if loaded
|
||||
Manager.verbose('No error handlers loaded; Default game print used','errorCaught')
|
||||
game.print(err)
|
||||
else
|
||||
-- all else fails it will crash the game with the error code
|
||||
Manager.verbose('No error handlers loaded; Game not loaded; Forced crash: '..err,'errorCaught')
|
||||
rawset(tbl,'__crash',true)
|
||||
rawget(tbl,'__error_call')(err,2)
|
||||
end
|
||||
local args = {...}
|
||||
local trace = args[1] and type(args[1]) == 'number' and args[1]+1 or 2
|
||||
if tbl.in_pcall(2) then rawget(tbl,'__error_call')(err,trace) end
|
||||
end,
|
||||
__index=function(tbl,key)
|
||||
-- this allows the __error_handler to be called from many different names
|
||||
if type(key) ~= 'string' then return end
|
||||
if key:lower() == 'addhandler' or key:lower() == 'sethandler' or key:lower() == 'handler' or key:lower() == 'register' then return rawget(tbl,'__error_handler')
|
||||
else rawget(tbl,'__error_call')('Invalid index for error handler; please use build in methods.') end
|
||||
end,
|
||||
__newindex=function(tbl,key,value)
|
||||
-- making a new index adds it as a handler
|
||||
if type(value) == 'function' then
|
||||
Manager.verbose('Added Error Handler: "'..key..'"','eventRegistered')
|
||||
rawset(tbl,key,value)
|
||||
end
|
||||
end,
|
||||
__len=function(tbl)
|
||||
-- counts the number of handlers there are
|
||||
local rtn=0
|
||||
for handler_name,callback in pairs(tbl) do
|
||||
rtn=rtn+1
|
||||
end
|
||||
return rtn
|
||||
end,
|
||||
__pairs=function(tbl)
|
||||
-- will not return any of the three core values as part of pairs
|
||||
local function next_pair(tbl,k)
|
||||
local v
|
||||
k, v = next(tbl, k)
|
||||
if k == '__error_call' or k == '__error_const' or k == '__error_handler' or k == '__crash' or k == 'in_pcall' then return next_pair(tbl,k) end
|
||||
if type(v) == 'function' then return k,v end
|
||||
end
|
||||
return next_pair, tbl, nil
|
||||
end
|
||||
})
|
||||
-- overrides the default error function
|
||||
error=Manager.error
|
||||
|
||||
-- event does work a bit differnt from error, and if event breaks error is the fallback
|
||||
|
||||
--- Event handler that modules can use, each module can register one function per event
|
||||
-- @function Manager.event
|
||||
-- @usage Manager.event[event_name] = callback -- sets the callback for that event
|
||||
-- @usage Manager.event[event_name] = nil -- clears the callback for that event
|
||||
-- @usage Manager.event(event_name,callback) -- sets the callback for that event
|
||||
-- @usage Manager.event[event_name] -- returns the callback for that event or the event id if not registered
|
||||
-- @usage Manager.event(event_name) -- runs all the call backs for that event
|
||||
-- @tparam ?int|string event_name that referes to an event
|
||||
-- @tparam function callback the function that will be set for that event
|
||||
-- @usage Manager.event() -- returns the stop value for the event proccessor, if returned during an event will stop all other callbacks
|
||||
-- @usage #Manager.event -- returns the number of callbacks that are registered
|
||||
-- @usage pairs(Manager.events) -- returns event_id,table of callbacks
|
||||
Manager.event = setmetatable({
|
||||
__stop={},
|
||||
__events={},
|
||||
__event=script.on_event,
|
||||
__generate=script.generate_event_name,
|
||||
__get_handler=script.get_event_handler,
|
||||
__raise=script.raise_event,
|
||||
__init=script.on_init,
|
||||
__load=script.on_load,
|
||||
__config=script.on_configuration_changed,
|
||||
events=defines.events,
|
||||
error_cache={}
|
||||
},{
|
||||
__metatable=false,
|
||||
__call=function(tbl,event_name,new_callback,...)
|
||||
if Manager.error.__crash then Manager.error.__error_call('No error handlers loaded; Game not loaded; Forced crash: '..tostring(Manager.error.__crash)) end
|
||||
-- if no params then return the stop constant
|
||||
if event_name == nil then return rawget(tbl,'__stop') end
|
||||
-- if the event name is a table then loop over each value in that table
|
||||
if type(event_name) == 'table' then
|
||||
for key,_event_name in pairs(event_name) do tbl(_event_name,new_callback,...) end return
|
||||
end
|
||||
-- convert the event name to a number index
|
||||
event_name = tonumber(event_name) or tbl.names[event_name]
|
||||
-- if there is a callback present then set new callback rather than raise the event
|
||||
if type(new_callback) == 'function' then
|
||||
Manager.event[event_name] = new_callback return
|
||||
end
|
||||
-- other wise raise the event and call every callback; no use of script.raise_event due to override
|
||||
local event_functions = tbl.__events[event_name]
|
||||
if type(event_functions) == 'table' then
|
||||
for moduleName,callback in pairs(event_functions) do
|
||||
-- loops over the call backs and which module it is from
|
||||
if type(callback) ~= 'function' then error('Invalid Event Callback: "'..event_name..'/'..moduleName..'"') end
|
||||
local success, err = Manager.sandbox(callback,{moduleName=setupModuleName(moduleName),module_path=Manager.loadModules.__load[tostring(moduleName)]},new_callback,...)
|
||||
if not success then
|
||||
local cache = tbl.error_cache
|
||||
local error_message = 'Event Failed: "'..moduleName..'/'..tbl.names[event_name]..'" ('..err..')'
|
||||
if not cache[error_message] then Manager.verbose(error_message,'errorCaught') error(error_message) end
|
||||
if tbl.names[event_name] == 'on_tick' then
|
||||
if not cache[error_message] then cache[error_message] = {game.tick,1} end
|
||||
if cache[error_message][1] >= game.tick-10 then cache[error_message] = {game.tick,cache[error_message][2]+1}
|
||||
else cache[error_message] = nil end
|
||||
if cache[error_message] and cache[error_message][2] > 100 then
|
||||
Manager.verbose('There was an error happening every tick for 100 ticks, the event handler has been removed!','errorCaught')
|
||||
event_functions[moduleName] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
-- if stop constant is returned then stop further processing
|
||||
if err == rawget(tbl,'__stop') then Manager.verbose('Event Haulted By: "'..moduleName..'"','errorCaught') break end
|
||||
end
|
||||
end
|
||||
end,
|
||||
__newindex=function(tbl,key,value)
|
||||
-- handles the creation of new event handlers
|
||||
if type(value) ~= 'function' and type(value) ~= nil then error('Attempted to set a non function value to an event',2) end
|
||||
-- checks for a global module name that is present
|
||||
local moduleName = moduleName or 'FSM'
|
||||
-- converts the key to a number index for the event
|
||||
Manager.verbose('Added Handler: "'..tbl.names[key]..'"','eventRegistered')
|
||||
-- checks that the event has a valid table to store callbacks; if its not valid it will creat it and register a real event handler
|
||||
if not rawget(rawget(tbl,'__events'),key) then
|
||||
if key == -1 or key == -2 then -- this already has a handler
|
||||
elseif key < 0 then rawget(tbl,tbl.names[key])(function(...) tbl(key,...) end)
|
||||
else rawget(tbl,'__event')(key,function(...) tbl(key,...) end) end
|
||||
rawset(rawget(tbl,'__events'),key,{}) end
|
||||
-- adds callback to Manager.event.__events[event_id][moduleName]
|
||||
rawset(rawget(rawget(tbl,'__events'),key),tostring(moduleName),value)
|
||||
end,
|
||||
__index=function(tbl,key)
|
||||
-- few redirect key
|
||||
local redirect={register=tbl,dispatch=tbl,remove=function(event_id) tbl[event_name]=nil end}
|
||||
if rawget(redirect,key) then return rawget(redirect,key) end
|
||||
-- proforms different look ups depentding weather the current module has an event handler registered
|
||||
if moduleName then
|
||||
-- first looks for the event callback table and then under the module name; does same but converts the key to a number; no handler regisered so returns the converted event id
|
||||
return rawget(rawget(tbl,'__events'),key) and rawget(rawget(rawget(tbl,'__events'),key),tostring(moduleName))
|
||||
or rawget(rawget(tbl,'__events'),rawget(tbl,'names')[key]) and rawget(rawget(rawget(tbl,'__events'),rawget(tbl,'names')[key]),tostring(moduleName))
|
||||
or rawget(tbl,'names')[key]
|
||||
else
|
||||
-- if there is no module present then it will return the full list of regisered handlers; or other wise the converted event id
|
||||
return rawget(rawget(tbl,'__events'),key) or rawget(rawget(tbl,'__events'),rawget(tbl,'names')[key]) or rawget(tbl,'names')[key]
|
||||
end
|
||||
end,
|
||||
__len=function(tbl)
|
||||
-- counts every handler that is regised not just the the number of events with handlers
|
||||
local rtn=0
|
||||
for event,callbacks in pairs(tbl) do
|
||||
for module,callback in pairs(callbacks) do
|
||||
rtn=rtn+1
|
||||
end
|
||||
end
|
||||
return rtn
|
||||
end,
|
||||
__pairs=function(tbl)
|
||||
-- will loops over the event handlers and not Manager.event
|
||||
local function next_pair(tbl,k)
|
||||
k, v = next(rawget(tbl,'__events'), k)
|
||||
if type(v) == 'table' then return k,v end
|
||||
end
|
||||
return next_pair, tbl, nil
|
||||
end
|
||||
})
|
||||
|
||||
--- Sub set to Manger.event and acts as a coverter between event_name and event_id
|
||||
-- @table Manager.event.names
|
||||
-- @usage Manager.event[event_name]
|
||||
rawset(Manager.event,'names',setmetatable({},{
|
||||
__index=function(tbl,key)
|
||||
if type(key) == 'number' or tonumber(key) then
|
||||
-- if it is a number then it will first look in the cache
|
||||
if rawget(tbl,key) then return rawget(tbl,key) end
|
||||
-- if it is a core event then it will simply return
|
||||
if key == -1 then rawset(tbl,key,'__init')
|
||||
elseif key == -2 then rawset(tbl,key,'__load')
|
||||
elseif key == -3 then rawset(tbl,key,'__config')
|
||||
else
|
||||
-- if it is not a core event then it does a value look up on Manager.events aka defines.events
|
||||
for event,id in pairs(rawget(Manager.event,'events')) do
|
||||
if id == key then rawset(tbl,key,event) end
|
||||
end
|
||||
end
|
||||
-- returns the value from the cache after being loaded in
|
||||
return rawget(tbl,key)
|
||||
-- if it is a string then no reverse look up is required
|
||||
else
|
||||
if key == 'on_init' or key == 'init' or key == '__init' then return -1
|
||||
elseif key == 'on_load' or key == 'load' or key == '__load' then return -2
|
||||
elseif key == 'on_configuration_changed' or key == 'configuration_changed' or key == '__config' then return -3
|
||||
else return rawget(rawget(Manager.event,'events'),key) end
|
||||
end
|
||||
end
|
||||
}))
|
||||
|
||||
script.on_init(function(...)
|
||||
Manager.verbose('____________________| SubStart: script.on_init |____________________')
|
||||
setmetatable(global,Manager.global.__global)
|
||||
local names = {}
|
||||
for name,default in pairs(Manager.global.__defaults) do table.insert(names,name) end
|
||||
Manager.verbose('Global Tables: '..table.concat(names,', '))
|
||||
for name,default in pairs(Manager.global.__defaults) do global(name)(true) end
|
||||
Manager.event(-1,...)
|
||||
Manager.verbose('____________________| SubStop: script.on_init |____________________')
|
||||
end)
|
||||
|
||||
script.on_load(function(...)
|
||||
Manager.verbose('____________________| SubStart: script.on_load |____________________')
|
||||
setmetatable(global,Manager.global.__global)
|
||||
local names = {}
|
||||
for name,default in pairs(Manager.global.__defaults) do table.insert(names,name) end
|
||||
Manager.verbose('Global Tables: '..table.concat(names,', '))
|
||||
for name,default in pairs(Manager.global.__defaults) do Manager.verbose('Global '..name..' = '..serpent.line(Manager.global(name))) end
|
||||
Manager.event(-2,...)
|
||||
Manager.verbose('____________________| SubStop: script.on_load |____________________')
|
||||
end)
|
||||
--over rides for the base values; can be called though Event
|
||||
Event=setmetatable({},{__call=Manager.event,__index=function(tbl,key) return Manager.event[key] or script[key] or error('Invalid Index To Table Event') end})
|
||||
script.mod_name = setmetatable({},{__index=_G.moduleName})
|
||||
script.on_event=Manager.event
|
||||
script.raise_event=Manager.event
|
||||
script.on_init=function(callback) Manager.event(-1,callback) end
|
||||
script.on_load=function(callback) Manager.event(-2,callback) end
|
||||
script.on_configuration_changed=function(callback) Manager.event(-3,callback) end
|
||||
script.get_event_handler=function(event_name) return type(Manager.event[event_name]) == 'function' and Manager.event[event_name] or nil end
|
||||
script.generate_event_name=function(event_name) local event_id = Manager.event.__generate() local event_name = event_name or event_id Manager.event.events[event_name]=event_id return event_id end
|
||||
-- to do set up nth tick
|
||||
|
||||
return ReadOnlyManager
|
||||
24
README.md
24
README.md
@@ -1,4 +1,26 @@
|
||||
## ExpGaming Repository [](https://www.codefactor.io/repository/github/badgamernl/explosivegaming-main) [](https://discord.explosivegaming.nl)
|
||||
<p align="center">
|
||||
<img alt="logo" src="https://avatars2.githubusercontent.com/u/39745392?s=200&v=4" width="120">
|
||||
<br>
|
||||
<a href="https://github.com/explosivegaming/scenario/tags">
|
||||
<img src="https://img.shields.io/github/tag/explosivegaming/scenario.svg?label=Release" alt="Release">
|
||||
</a>
|
||||
<a href="https://github.com/explosivegaming/scenario/archive/master.zip">
|
||||
<img src="https://img.shields.io/github/downloads/explosivegaming/scenario/total.svg?label=Downloads" alt="Downloads">
|
||||
</a>
|
||||
<a href="https://github.com/explosivegaming/scenario/stargazers">
|
||||
<img src="https://img.shields.io/github/stars/explosivegaming/scenario.svg?label=Stars" alt="Star">
|
||||
</a>
|
||||
<a href="http://github.com/explosivegaming/scenario/fork">
|
||||
<img src="https://img.shields.io/github/forks/explosivegaming/scenario.svg?label=Forks" alt="Fork">
|
||||
</a>
|
||||
<a href="https://www.codefactor.io/repository/github/explosivegaming/scenario">
|
||||
<img src="https://www.codefactor.io/repository/github/explosivegaming/scenario/badge" alt="CodeFactor">
|
||||
</a>
|
||||
<a href="https://discord.me/explosivegaming">
|
||||
<img src="https://discordapp.com/api/guilds/260843215836545025/widget.png?style=shield" alt="Discord">
|
||||
</a>
|
||||
</p>
|
||||
<h2 align="center">ExpGaming Scenario Repository</h2>
|
||||
|
||||
#### Using The Core Files
|
||||
1. Copy the core folder and the StdLib File
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
-- this file will just contain all the diffrent requires
|
||||
require('colours')
|
||||
require('health')
|
||||
require('spawn')
|
||||
require('starting-items')
|
||||
require('paths')
|
||||
require('body-marker')
|
||||
require('chat-popup')
|
||||
@@ -1,15 +0,0 @@
|
||||
This is the license of Factorio-Stdlib: https://github.com/Afforess/Factorio-Stdlib/blob/master/LICENSE
|
||||
|
||||
Copyright (c) 2016, Afforess
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
312
StdLib/color.lua
312
StdLib/color.lua
@@ -1,312 +0,0 @@
|
||||
--- A defines module for retrieving colors by name.
|
||||
-- Extends the Factorio defines table.
|
||||
-- @usage require('stdlib/defines/color')
|
||||
-- @module defines.color
|
||||
-- @see Concepts.Color
|
||||
|
||||
-- defines table is automatically required in all mod loading stages.
|
||||
-- luacheck: ignore 122/defines
|
||||
-- Ignore assigning to read only defines table. defines table is not ready only, however
|
||||
-- marking it this way allows warnings to be generated when trying to assign values
|
||||
|
||||
defines = defines or {} --luacheck: ignore defines (This is used for testing locally)
|
||||
|
||||
--- A table of colors allowing retrieval by color name.
|
||||
-- @usage color = defines.color.red
|
||||
-- @tfield Concepts.Color white
|
||||
-- @tfield Concepts.Color black
|
||||
-- @tfield Concepts.Color darkgrey
|
||||
-- @tfield Concepts.Color grey
|
||||
-- @tfield Concepts.Color lightgrey
|
||||
-- @tfield Concepts.Color red
|
||||
-- @tfield Concepts.Color darkred
|
||||
-- @tfield Concepts.Color lightred
|
||||
-- @tfield Concepts.Color green
|
||||
-- @tfield Concepts.Color darkgreen
|
||||
-- @tfield Concepts.Color lightgreen
|
||||
-- @tfield Concepts.Color blue
|
||||
-- @tfield Concepts.Color darkblue
|
||||
-- @tfield Concepts.Color lightblue
|
||||
-- @tfield Concepts.Color orange
|
||||
-- @tfield Concepts.Color yellow
|
||||
-- @tfield Concepts.Color pink
|
||||
-- @tfield Concepts.Color purple
|
||||
-- @tfield Concepts.Color brown
|
||||
defines.color = {}
|
||||
|
||||
local colors = {
|
||||
white = {r = 1.00, g = 1.00, b = 1.00},
|
||||
black = {r = 0.00, g = 0.00, b = 0.00},
|
||||
darkgrey = {r = 0.25, g = 0.25, b = 0.25},
|
||||
grey = {r = 0.50, g = 0.50, b = 0.50},
|
||||
lightgrey = {r = 0.75, g = 0.75, b = 0.75},
|
||||
red = {r = 1.00, g = 0.00, b = 0.00},
|
||||
darkred = {r = 0.50, g = 0.00, b = 0.00},
|
||||
lightred = {r = 1.00, g = 0.50, b = 0.50},
|
||||
green = {r = 0.00, g = 1.00, b = 0.00},
|
||||
darkgreen = {r = 0.00, g = 0.50, b = 0.00},
|
||||
lightgreen = {r = 0.50, g = 1.00, b = 0.50},
|
||||
blue = {r = 0.00, g = 0.00, b = 1.00},
|
||||
darkblue = {r = 0.00, g = 0.00, b = 0.50},
|
||||
lightblue = {r = 0.50, g = 0.50, b = 1.00},
|
||||
orange = {r = 1.00, g = 0.55, b = 0.10},
|
||||
yellow = {r = 1.00, g = 1.00, b = 0.00},
|
||||
pink = {r = 1.00, g = 0.00, b = 1.00},
|
||||
purple = {r = 0.60, g = 0.10, b = 0.60},
|
||||
brown = {r = 0.60, g = 0.40, b = 0.10}
|
||||
}
|
||||
|
||||
--- Returns white for dark colors or black for lighter colors.
|
||||
-- @tfield Concepts.Color green defines.color.black
|
||||
-- @tfield Concepts.Color grey defines.color.black
|
||||
-- @tfield Concepts.Color lightblue defines.color.black
|
||||
-- @tfield Concepts.Color lightgreen defines.color.black
|
||||
-- @tfield Concepts.Color lightgrey defines.color.black
|
||||
-- @tfield Concepts.Color lightred defines.color.black
|
||||
-- @tfield Concepts.Color orange defines.color.black
|
||||
-- @tfield Concepts.Color white defines.color.black
|
||||
-- @tfield Concepts.Color yellow defines.color.black
|
||||
-- @tfield Concepts.Color black defines.color.white
|
||||
-- @tfield Concepts.Color blue defines.color.white
|
||||
-- @tfield Concepts.Color brown defines.color.white
|
||||
-- @tfield Concepts.Color darkblue defines.color.white
|
||||
-- @tfield Concepts.Color darkgreen defines.color.white
|
||||
-- @tfield Concepts.Color darkgrey defines.color.white
|
||||
-- @tfield Concepts.Color darkred defines.color.white
|
||||
-- @tfield Concepts.Color pink defines.color.white
|
||||
-- @tfield Concepts.Color purple defines.color.white
|
||||
-- @tfield Concepts.Color red defines.color.white
|
||||
defines.anticolor = {}
|
||||
|
||||
local anticolors = {
|
||||
green = colors.black,
|
||||
grey = colors.black,
|
||||
lightblue = colors.black,
|
||||
lightgreen = colors.black,
|
||||
lightgrey = colors.black,
|
||||
lightred = colors.black,
|
||||
orange = colors.black,
|
||||
white = colors.black,
|
||||
yellow = colors.black,
|
||||
black = colors.white,
|
||||
blue = colors.white,
|
||||
brown = colors.white,
|
||||
darkblue = colors.white,
|
||||
darkgreen = colors.white,
|
||||
darkgrey = colors.white,
|
||||
darkred = colors.white,
|
||||
pink = colors.white,
|
||||
purple = colors.white,
|
||||
red = colors.white
|
||||
}
|
||||
|
||||
--- Returns a lighter color of a named color.
|
||||
-- @tfield Concepts.Color white defines.color.lightgrey
|
||||
-- @tfield Concepts.Color grey defines.color.darkgrey
|
||||
-- @tfield Concepts.Color lightgrey defines.color.grey
|
||||
-- @tfield Concepts.Color red defines.color.lightred
|
||||
-- @tfield Concepts.Color green defines.color.lightgreen
|
||||
-- @tfield Concepts.Color blue defines.color.lightblue
|
||||
-- @tfield Concepts.Color yellow defines.color.orange
|
||||
-- @tfield Concepts.Color pink defines.color.purple
|
||||
defines.lightcolor = {}
|
||||
local lightcolors = {
|
||||
white = colors.lightgrey,
|
||||
grey = colors.darkgrey,
|
||||
lightgrey = colors.grey,
|
||||
red = colors.lightred,
|
||||
green = colors.lightgreen,
|
||||
blue = colors.lightblue,
|
||||
yellow = colors.orange,
|
||||
pink = colors.purple
|
||||
}
|
||||
|
||||
-- added by cooldude2606
|
||||
--- Returns a lighter color of a named color.
|
||||
-- @tfield Concepts.Color info
|
||||
-- @tfield Concepts.Color bg
|
||||
-- @tfield Concepts.Color low
|
||||
-- @tfield Concepts.Color med
|
||||
-- @tfield Concepts.Color high
|
||||
-- @tfield Concepts.Color crit
|
||||
defines.text_color = {}
|
||||
local text_color = {
|
||||
info = {r = 0.21, g = 0.95, b = 1.00},
|
||||
bg = {r = 0.00, g = 0.00, b = 0.00},
|
||||
low = {r = 0.18, g = 0.77, b = 0.18},
|
||||
med = {r = 1.00, g = 0.89, b = 0.26},
|
||||
high = {r = 1.00, g = 0.33, b = 0.00},
|
||||
crit = {r = 1.00, g = 0.00, b = 0.00}
|
||||
}
|
||||
|
||||
local _mt = {
|
||||
color = {
|
||||
__index = function(_, c)
|
||||
return colors[c]
|
||||
and { r = colors[c]['r'], g=colors[c]['g'], b=colors[c]['b'], a = colors[c]['a'] }
|
||||
or { r = 1, g = 1, b = 1, a = 1 }
|
||||
end,
|
||||
__pairs = function()
|
||||
local k = nil
|
||||
local c = colors
|
||||
return function()
|
||||
local v
|
||||
k, v = next(c, k)
|
||||
return k, (v and {r = v['r'], g = v['g'], b = v['b'], a = v['a']}) or nil
|
||||
end
|
||||
end
|
||||
},
|
||||
anticolor = {
|
||||
__index = function(_, c)
|
||||
return anticolors[c]
|
||||
and { r = anticolors[c]['r'], g=anticolors[c]['g'], b=anticolors[c]['b'], a = anticolors[c]['a'] }
|
||||
or { r = 1, g = 1, b = 1, a = 1 }
|
||||
end,
|
||||
__pairs = function()
|
||||
local k = nil
|
||||
local c = anticolors
|
||||
return function()
|
||||
local v
|
||||
k, v = next(c, k)
|
||||
return k, (v and {r = v['r'], g = v['g'], b = v['b'], a = v['a']}) or nil
|
||||
end
|
||||
end
|
||||
},
|
||||
lightcolor = {
|
||||
__index = function(_, c)
|
||||
return lightcolors[c]
|
||||
and { r = lightcolors[c]['r'], g=lightcolors[c]['g'], b=lightcolors[c]['b'], a = lightcolors[c]['a'] }
|
||||
or { r = 1, g = 1, b = 1, a = 1 }
|
||||
end,
|
||||
__pairs = function()
|
||||
local k = nil
|
||||
local c = lightcolors
|
||||
return function()
|
||||
local v
|
||||
k, v = next(c, k)
|
||||
return k, (v and {r = v['r'], g = v['g'], b = v['b'], a = v['a']}) or nil
|
||||
end
|
||||
end
|
||||
},
|
||||
text_color = { -- added by cooldude2606
|
||||
__index = function(_, c)
|
||||
return text_color[c]
|
||||
and { r = text_color[c]['r'], g=text_color[c]['g'], b=text_color[c]['b'], a = text_color[c]['a'] }
|
||||
or { r = 1, g = 1, b = 1, a = 1 }
|
||||
end,
|
||||
__pairs = function()
|
||||
local k = nil
|
||||
local c = text_color
|
||||
return function()
|
||||
local v
|
||||
k, v = next(c, k)
|
||||
return k, (v and {r = v['r'], g = v['g'], b = v['b'], a = v['a']}) or nil
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
setmetatable(defines.color, _mt.color)
|
||||
setmetatable(defines.anticolor, _mt.anticolor)
|
||||
setmetatable(defines.text_color, _mt.text_color)
|
||||
setmetatable(defines.lightcolor, _mt.lightcolor)
|
||||
|
||||
--- For playing with colors.
|
||||
-- @module Color
|
||||
-- @usage local Color = require('stdlib/color/color')
|
||||
|
||||
local Color = {} --luacheck: allow defined top
|
||||
|
||||
--- Set a value for the alpha channel in the given color table.
|
||||
-- `color.a` represents the alpha channel in the given color table.
|
||||
-- <ul>
|
||||
-- <li>If ***alpha*** is given, set `color.a` to it.
|
||||
-- <li>If ***alpha*** is not given, and if the given color table does not have a value for `color.a`, set `color.a` to 1.
|
||||
-- <li>If ***alpha*** is not given, and if the given color table already has a value for `color.a`, then leave `color.a` alone.
|
||||
-- </ul>
|
||||
-- @tparam[opt=white] defines.color|Concepts.Color color the color to configure
|
||||
-- @tparam[opt=1] float alpha the alpha value (*[0 - 1]*) to set for the given color
|
||||
-- @treturn Concepts.Color a color table that has the specified value for the alpha channel
|
||||
function Color.set(color, alpha)
|
||||
color = color or defines.color.white
|
||||
Color.to_table(color)
|
||||
color.a = alpha or color.a or 1
|
||||
return color
|
||||
end
|
||||
|
||||
--- Converts a color in the array format to a color in the table format.
|
||||
-- @tparam array c_arr the color to convert — { [1] = @{float}, [2] = @{float}, [3] = @{float}, [4] = @{float} }
|
||||
-- @treturn Concepts.Color a converted color — { r = c\_arr[1], g = c\_arr[2], b = c\_arr[3], a = c\_arr[4] }
|
||||
function Color.to_table(c_arr)
|
||||
if #c_arr > 0 then
|
||||
return {r = c_arr[1], g = c_arr[2], b = c_arr[3], a = c_arr[4]}
|
||||
end
|
||||
return c_arr
|
||||
end
|
||||
|
||||
--- Converts a color in the rgb format to a color table
|
||||
-- @tparam[opt=0] int r 0-255 red
|
||||
-- @tparam[opt=0] int g 0-255 green
|
||||
-- @tparam[opt=0] int b 0-255 blue
|
||||
-- @tparam[opt=255] int a 0-255 alpha
|
||||
-- @treturn Concepts.Color
|
||||
function Color.from_rgb(r, g, b, a)
|
||||
r = r or 0
|
||||
g = g or 0
|
||||
b = b or 0
|
||||
a = a or 255
|
||||
return {r = r/255, g = g/255, b = b/255, a = a/255}
|
||||
end
|
||||
|
||||
--- Get a color table with a hexadecimal string.
|
||||
-- Optionally provide the value for the alpha channel.
|
||||
-- @tparam string hex hexadecimal color string (#ffffff, not #fff)
|
||||
-- @tparam[opt=1] float alpha the alpha value to set; such that ***[ 0 ⋜ value ⋜ 1 ]***
|
||||
-- @treturn Concepts.Color a color table with RGB converted from Hex and with alpha
|
||||
function Color.from_hex(hex, alpha)
|
||||
if not _G.Game then error('StdLib/Game not loaded') end
|
||||
_G.Game.fail_if_missing(hex, "missing color hex value")
|
||||
if hex:find("#") then hex = hex:sub(2) end
|
||||
if not(#hex == 6) then error("invalid color hex value: "..hex) end
|
||||
local number = tonumber(hex, 16)
|
||||
return {
|
||||
r = bit32.extract(number, 16, 8) / 255,
|
||||
g = bit32.extract(number, 8, 8) / 255,
|
||||
b = bit32.extract(number, 0, 8) / 255,
|
||||
a = alpha or 1
|
||||
}
|
||||
end
|
||||
|
||||
--added by cooldude2606
|
||||
--- Converts a color in the color table format to rgb
|
||||
-- @tparam table color the color to convert
|
||||
-- @treturn table the color as rgb
|
||||
function Color.to_rgb(color)
|
||||
local r = color.r or 0
|
||||
local g = color.g or 0
|
||||
local b = color.b or 0
|
||||
local a = color.a or 0.5
|
||||
return {r = r*255, g = g*255, b = b*255, a = a*255}
|
||||
end
|
||||
|
||||
--added by cooldude2606
|
||||
--- Converts a color in the color table format to hex
|
||||
-- @tparam table color the color to convert
|
||||
-- @treturn string the color as hex
|
||||
function Color.to_hex(color)
|
||||
local hexadecimal = '0x'
|
||||
for key, value in pairs{math.floor(color.r*255),math.floor(color.g*255),math.floor(color.b*255)} do
|
||||
local hex = ''
|
||||
while(value > 0)do
|
||||
local index = math.fmod(value, 16) + 1
|
||||
value = math.floor(value / 16)
|
||||
hex = string.sub('0123456789ABCDEF', index, index) .. hex
|
||||
end
|
||||
if string.len(hex) == 0 then hex = '00'
|
||||
elseif string.len(hex) == 1 then hex = '0' .. hex
|
||||
end
|
||||
hexadecimal = hexadecimal .. hex
|
||||
end
|
||||
return hexadecimal
|
||||
end
|
||||
|
||||
return Color
|
||||
172
StdLib/event.lua
172
StdLib/event.lua
@@ -1,172 +0,0 @@
|
||||
--- Makes working with events in factorio a lot more simple.
|
||||
-- <p>Factorio can only have one handler registered per event. This module
|
||||
-- allows you to easily register multiple handlers for each event.
|
||||
-- Using this module is as simple as replacing script.on_event(...) with Event.register(...)</p>
|
||||
-- @module Event
|
||||
-- @usage require('stdlib/event/event')
|
||||
|
||||
local Event = { --luacheck: allow defined top
|
||||
_registry = {},
|
||||
core_events = {
|
||||
init = -1,
|
||||
load = -2,
|
||||
configuration_changed = -3,
|
||||
_register = function(id)
|
||||
if id == Event.core_events.init then
|
||||
script.on_init(
|
||||
function()
|
||||
Event.dispatch({name = Event.core_events.init, tick = game.tick})
|
||||
end
|
||||
)
|
||||
elseif id == Event.core_events.load then
|
||||
script.on_load(
|
||||
function()
|
||||
Event.dispatch({name = Event.core_events.load, tick = -1})
|
||||
end
|
||||
)
|
||||
elseif id == Event.core_events.configuration_changed then
|
||||
script.on_configuration_changed(
|
||||
function(event)
|
||||
event.name = Event.core_events.configuration_changed
|
||||
event.data = event -- for backwards compatibilty
|
||||
Event.dispatch(event)
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
--[[ edit by cooldude2606 to allow change during run-time without desyncs -- still going to use this but FACTORIO NO LIKE
|
||||
Event.__registry = Event._registry
|
||||
Event._registry = function()
|
||||
if game and global then
|
||||
if not global.event_registry then global.event_registry = Event.__registry end
|
||||
return global.event_registry
|
||||
end
|
||||
return Event.__registry
|
||||
end]]
|
||||
|
||||
--- Registers a function for a given event. If a nil handler is passed remove all events and stop listening for that event.
|
||||
-- Events are dispatched in the order they are registered.
|
||||
-- @usage Event.register(defines.events.on_tick, function(event) print event.tick end)
|
||||
-- -- creates an event that prints the current tick every tick.
|
||||
-- @tparam defines.events|{defines.events,...} event events to register
|
||||
-- @tparam function handler Function to call when event is triggered
|
||||
-- @treturn Event
|
||||
function Event.register(event, handler)
|
||||
if not _G.Game then error('StdLib/Game not loaded') end
|
||||
_G.Game.fail_if_missing(event, "missing event argument")
|
||||
|
||||
event = (type(event) == "table" and event) or {event}
|
||||
|
||||
for _, event_id in pairs(event) do
|
||||
if not (type(event_id) == "number" or type(event_id) == "string") then
|
||||
error("Invalid Event Id, Must be string or int, or array of strings and/or ints", 2)
|
||||
end
|
||||
if handler == nil then
|
||||
Event._registry[event_id] = nil
|
||||
script.on_event(event_id, nil)
|
||||
else
|
||||
if not Event._registry[event_id] then
|
||||
Event._registry[event_id] = {}
|
||||
|
||||
if type(event_id) == "string" or event_id >= 0 then
|
||||
script.on_event(event_id, Event.dispatch)
|
||||
elseif event_id < 0 then
|
||||
Event.core_events._register(event_id)
|
||||
end
|
||||
end
|
||||
table.insert(Event._registry[event_id], handler)
|
||||
end
|
||||
end
|
||||
return Event
|
||||
end
|
||||
|
||||
--- Calls the registerd handlers
|
||||
-- Will stop dispatching remaning handlers if any handler passes invalid event userdata.
|
||||
-- Handlers are dispatched in the order they were created
|
||||
-- @tparam table event LuaEvent as created by script.raise_event
|
||||
-- @see https://forums.factorio.com/viewtopic.php?t=32039#p202158 Invalid Event Objects
|
||||
function Event.dispatch(event)
|
||||
if event then
|
||||
local _registry = event.name and Event._registry[event.name] or event.input_name and Event._registry[event.input_name]
|
||||
if _registry then
|
||||
local force_crc = Event.force_crc
|
||||
for idx, handler in ipairs(_registry) do
|
||||
|
||||
-- Check for userdata and stop processing further handlers if not valid
|
||||
for _, val in pairs(event) do
|
||||
if type(val) == "table" and val.__self == "userdata" and not val.valid then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
setmetatable(event, { __index = { _handler = handler } })
|
||||
|
||||
-- Call the handler
|
||||
local success, err = pcall(handler, event)
|
||||
|
||||
-- If the handler errors lets make sure someone notices
|
||||
if not success then
|
||||
if _G.game then -- may be nil in on_load
|
||||
-- edit by cooldude2606 custom error haddle
|
||||
--if Game.print_all(err) == 0 then
|
||||
--error(err) -- no players received the message, force a real error so someone notices
|
||||
--end
|
||||
error(err)
|
||||
else
|
||||
error(err) -- no way to handle errors cleanly when the game is not up
|
||||
end
|
||||
-- continue processing the remaning handlers. In most cases they won't be related to the failed code.
|
||||
end
|
||||
|
||||
-- force a crc check if option is enabled. This is a debug option and will hamper perfomance if enabled
|
||||
if (force_crc or event.force_crc) and _G.game then
|
||||
local msg = 'CRC check called for event '..event.name..' handler #'..idx
|
||||
log(msg) -- log the message to factorio-current.log
|
||||
game.force_crc()
|
||||
end
|
||||
|
||||
-- if present stop further handlers for this event
|
||||
if event.stop_processing then
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
error('missing event argument')
|
||||
end
|
||||
end
|
||||
|
||||
--- Removes the handler from the event. If it removes the last handler for an event stop listening for that event.
|
||||
-- @tparam defines.events|{defines.events,...} event events to remove the handler for
|
||||
-- @tparam function handler to remove
|
||||
-- @return Event
|
||||
function Event.remove(event, handler)
|
||||
if not _G.Game then error('StdLib/Game not loaded') end
|
||||
_G.Game.fail_if_missing(event, "missing event argument")
|
||||
_G.Game.fail_if_missing(handler, "missing handler argument")
|
||||
|
||||
event = (type(event) == "table" and event) or {event}
|
||||
|
||||
for _, event_id in pairs(event) do
|
||||
if not (type(event_id) == "number" or type(event_id) == "string") then
|
||||
error("Invalid Event Id, Must be string or int, or array of strings and/or ints", 2)
|
||||
end
|
||||
if Event._registry[event_id] then
|
||||
for i=#Event._registry[event_id], 1, -1 do
|
||||
if Event._registry[event_id][i] == handler then
|
||||
table.remove(Event._registry[event_id], i)
|
||||
end
|
||||
end
|
||||
if #Event._registry[event_id] == 0 then
|
||||
Event._registry[event_id] = nil
|
||||
script.on_event(event_id, nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
return Event
|
||||
end
|
||||
|
||||
return Event
|
||||
@@ -1,36 +0,0 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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
|
||||
]]
|
||||
|
||||
--[[
|
||||
StdLib
|
||||
|
||||
This file allow you to only require this one file to return the diffent libarys.
|
||||
This file will return a function which can be used to access only the part you want.
|
||||
Pass a table with the names of the objects you want and it will be return in that order
|
||||
]]
|
||||
|
||||
local StdLib = {}
|
||||
|
||||
require('table')
|
||||
require('string')
|
||||
require('time')
|
||||
StdLib.Color = require('color')
|
||||
StdLib.Game = require('game')
|
||||
StdLib.Event = require('event')
|
||||
|
||||
return function(rtn)
|
||||
local _return = {}
|
||||
for _,name in pairs(rtn) do
|
||||
if StdLib[name] then
|
||||
verbose('StdLib Extraction: '..name)
|
||||
table.insert(_return,StdLib[name])
|
||||
end
|
||||
end
|
||||
return unpack(_return)
|
||||
end
|
||||
@@ -1,31 +0,0 @@
|
||||
--- A defines module for retrieving the number of ticks in 1 unit of time.
|
||||
-- Extends the Factorio defines table.
|
||||
-- @module defines.time
|
||||
-- @usage require('stdlib/defines/time')
|
||||
|
||||
-- defines table is automatically required in all mod loading stages.
|
||||
-- luacheck: ignore 122/defines
|
||||
-- Ignore assigning to read only defines table. defines table is not read only, however
|
||||
-- marking it this way allows warnings to be generated when trying to assign values.
|
||||
|
||||
defines = defines or {} --luacheck: ignore defines (This is used for testing locally)
|
||||
|
||||
local SECOND = 60
|
||||
local MINUTE = SECOND * 60
|
||||
local HOUR = MINUTE * 60
|
||||
local DAY = HOUR * 24
|
||||
local WEEK = DAY * 7
|
||||
local MONTH = DAY * 30
|
||||
local YEAR = DAY * 365
|
||||
|
||||
--- Returns the number of ticks in a second, minute, hour, day, week, month, or year.
|
||||
-- @usage local ten_seconds = defines.time.second * 10
|
||||
defines.time = {
|
||||
second = SECOND, -- the number of Factorio ticks in a second
|
||||
minute = MINUTE, -- the number of Factorio ticks in a second
|
||||
hour = HOUR, -- the number of Factorio ticks in an hour
|
||||
day = DAY, -- the number of Factorio ticks in an day
|
||||
week = WEEK, -- the number of Factorio ticks in a week
|
||||
month = MONTH, -- the number of Factorio ticks in a month (30 days)
|
||||
year = YEAR, -- the number of Factorio ticks in a year (365 days)
|
||||
}
|
||||
3
config.ld
Normal file
3
config.ld
Normal file
@@ -0,0 +1,3 @@
|
||||
new_type('command','Commands',false,'param')
|
||||
new_type('event','Events',false,'field')
|
||||
new_type('gui','Guis')
|
||||
99
control.lua
99
control.lua
@@ -1,85 +1,14 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
|
||||
-- Replaces the base error function
|
||||
_error = error
|
||||
error = function(err)
|
||||
verbose('Error Called: '..err)
|
||||
if _G.error_handle and type(error_handle) == 'function' then
|
||||
verbose('Exception Caught By Error Handle')
|
||||
local success, _err = pcall(error_handle,err)
|
||||
if not success then _error({handle=_err,err=err}) end
|
||||
elseif _G.Game and game then
|
||||
verbose('Exception Caught By Game Print')
|
||||
if Game.print_all(err) == 0 then
|
||||
_error(err)
|
||||
end
|
||||
else
|
||||
verbose('Failed to catch error')
|
||||
_error(err)
|
||||
end
|
||||
end
|
||||
-- Replaces the base require function and verbose function
|
||||
_verbose = false -- Set to true for more on the loading of the files
|
||||
function verbose(str) if _verbose then log(str) print(str) end end
|
||||
verbose('============================= START =============================')
|
||||
require_return_err = false -- Set to false when removing files; set to true for debuging
|
||||
_require = require
|
||||
require = function(path)
|
||||
local _path = path
|
||||
if string.sub(path,1) ~= '/' then path = '/'..path end
|
||||
local _return = {pcall(_require,path)}
|
||||
if not table.remove(_return, 1) then
|
||||
local __return = {pcall(_require,'/Addons'..path)}
|
||||
if not table.remove(__return, 1) then
|
||||
verbose('Failed to load: '.._path..' ('.._return[1]..')')
|
||||
verbose('Also Attemped: /Addons'..path..' ('..__return[1]..')')
|
||||
if require_return_err then error(unpack(_return)) end
|
||||
else verbose('Loaded: '.._path) return unpack(__return) end
|
||||
else verbose('Loaded: '.._path) end
|
||||
return unpack(_return)
|
||||
end
|
||||
|
||||
verbose('Begain Base Lib Loading')
|
||||
require('mod-gui')
|
||||
-- Loads the stdlib and allows Core Game and Event
|
||||
Color, Game, Event = require('StdLib/load'){'Color','Game','Event'}
|
||||
|
||||
-- loads the ExpLib, functions are placed into the lua global
|
||||
local ExpLib = require 'ExpLib'
|
||||
verbose('ExpLib Extraction')
|
||||
ExpLib._unpack_to_G(ExpLib)
|
||||
|
||||
verbose('Begain Core File Loading')
|
||||
-- Loads the ExpCore files. These are need in order to run the other addons
|
||||
Ranking, Sync, Server, Gui = require('ExpCore/load'){'Ranking','Sync','Server','Gui'}
|
||||
verbose('Gui Test Initiation')
|
||||
local success,err = require('ExpCore/GuiParts/test')
|
||||
if success then Gui.test = err else verbose('No Test Present') end
|
||||
if Gui.popup then verbose('Gui Popup Initiation') Gui.popup._load() end
|
||||
if Sync._load then verbose('Sync Initiation') Sync._load() end
|
||||
-- Loads the ranks that Ranking uses
|
||||
verbose('Base Ranks Initiation')
|
||||
require('ExpCore/ranks')
|
||||
-- Loads any edits that are not need in core pcall as file may not be present
|
||||
verbose('Extented Ranks Initiation')
|
||||
require('Addons/playerRanks')
|
||||
-- Makes sure that all the little details are cleaned up
|
||||
verbose('Ranking Initiation')
|
||||
Ranking._auto_edit_ranks()
|
||||
-- Loads all the addons
|
||||
verbose('Begain Addons Loading')
|
||||
local success,err = pcall(require,'Addons/load')
|
||||
if not success then error(err) end
|
||||
-- Loads anything that does not use ExpCore (source given in the file)
|
||||
verbose('Begain Stand Alone Loading')
|
||||
local success,err = pcall(require,'StandAlone/load')
|
||||
if not success then error(err) end
|
||||
verbose('============================== END ==============================')
|
||||
-- not_luadoc=true
|
||||
function _log(...) log(...) end -- do not remove this is used for smaller verbose lines
|
||||
Manager = require("FactorioSoftmodManager")
|
||||
Manager.setVerbose{
|
||||
selfInit=true, -- called while the manager is being set up
|
||||
moduleLoad=false, -- when a module is required by the manager
|
||||
moduleInit=false, -- when and within the initation of a module
|
||||
modulePost=false, -- when and within the post of a module
|
||||
moduleEnv=false, -- during module runtime, this is a global option set within each module for fine control
|
||||
eventRegistered=false, -- when a module registers its event handlers
|
||||
errorCaught=true, -- when an error is caught during runtime
|
||||
output=Manager._verbose -- can be: can be: print || log || other function
|
||||
}
|
||||
Manager() -- can be Manager.loadModules() if called else where
|
||||
144
doc/index.html
Normal file
144
doc/index.html
Normal file
@@ -0,0 +1,144 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="modules/FSM.html">FSM</a></li>
|
||||
<li><a href="modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<table class="module_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/FSM.html">FSM</a></td>
|
||||
<td class="summary">Factorio Softmod Manager</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></td>
|
||||
<td class="summary">A full ranking system for factorio.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></td>
|
||||
<td class="summary">Adds a objective version to custom guis.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></td>
|
||||
<td class="summary">Adds a uniform preset for guis in the center of the screen which allow for different tabs to be opened</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></td>
|
||||
<td class="summary">Adds a clean way of making new inputs for a gui allowing for sliders and text inputs to be hanndleded with custom events</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></td>
|
||||
<td class="summary">Adds a organiser for left gui ellements which will automaticaly update there information and have open requirements</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></td>
|
||||
<td class="summary">Adds a location for popups which can be dismissed by a player and created from other scripts</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></td>
|
||||
<td class="summary">Used to test all gui elements and parts can be used in game via Gui.test()</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></td>
|
||||
<td class="summary">Adds a toolbar to the top left of the screen</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></td>
|
||||
<td class="summary">A full ranking system for factorio.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></td>
|
||||
<td class="summary">Adds a thread system and event listening and a admin bypass (recommend to disable /c and use optional /interface)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></td>
|
||||
<td class="summary">Allows syncing with an outside server and info panle.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/ExpGamingLib.html">ExpGamingLib</a></td>
|
||||
<td class="summary">Adds some common functions used though out all ExpGaming modules</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/StdLib.Color.html">StdLib.Color</a></td>
|
||||
<td class="summary">A defines module for retrieving colors by name.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/StdLib.Game.html">StdLib.Game</a></td>
|
||||
<td class="summary">The game module.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/StdLib.String.html">StdLib.String</a></td>
|
||||
<td class="summary">Extends Lua 5.2 string.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/StdLib.Table.html">StdLib.Table</a></td>
|
||||
<td class="summary">Extends Lua 5.2 table.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="modules/StdLib.Time.html">StdLib.Time</a></td>
|
||||
<td class="summary">A defines module for retrieving the number of ticks in 1 unit of time.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
303
doc/ldoc.css
Normal file
303
doc/ldoc.css
Normal file
@@ -0,0 +1,303 @@
|
||||
/* BEGIN RESET
|
||||
|
||||
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.com/yui/license.html
|
||||
version: 2.8.2r1
|
||||
*/
|
||||
html {
|
||||
color: #000;
|
||||
background: #FFF;
|
||||
}
|
||||
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
fieldset,img {
|
||||
border: 0;
|
||||
}
|
||||
address,caption,cite,code,dfn,em,strong,th,var,optgroup {
|
||||
font-style: inherit;
|
||||
font-weight: inherit;
|
||||
}
|
||||
del,ins {
|
||||
text-decoration: none;
|
||||
}
|
||||
li {
|
||||
margin-left: 20px;
|
||||
}
|
||||
caption,th {
|
||||
text-align: left;
|
||||
}
|
||||
h1,h2,h3,h4,h5,h6 {
|
||||
font-size: 100%;
|
||||
font-weight: bold;
|
||||
}
|
||||
q:before,q:after {
|
||||
content: '';
|
||||
}
|
||||
abbr,acronym {
|
||||
border: 0;
|
||||
font-variant: normal;
|
||||
}
|
||||
sup {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
sub {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
legend {
|
||||
color: #000;
|
||||
}
|
||||
input,button,textarea,select,optgroup,option {
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
font-style: inherit;
|
||||
font-weight: inherit;
|
||||
}
|
||||
input,button,textarea,select {*font-size:100%;
|
||||
}
|
||||
/* END RESET */
|
||||
|
||||
body {
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
font-family: arial, helvetica, geneva, sans-serif;
|
||||
background-color: #ffffff; margin: 0px;
|
||||
}
|
||||
|
||||
code, tt { font-family: monospace; font-size: 1.1em; }
|
||||
span.parameter { font-family:monospace; }
|
||||
span.parameter:after { content:":"; }
|
||||
span.types:before { content:"("; }
|
||||
span.types:after { content:")"; }
|
||||
.type { font-weight: bold; font-style:italic }
|
||||
|
||||
body, p, td, th { font-size: .95em; line-height: 1.2em;}
|
||||
|
||||
p, ul { margin: 10px 0 0 0px;}
|
||||
|
||||
strong { font-weight: bold;}
|
||||
|
||||
em { font-style: italic;}
|
||||
|
||||
h1 {
|
||||
font-size: 1.5em;
|
||||
margin: 20px 0 20px 0;
|
||||
}
|
||||
h2, h3, h4 { margin: 15px 0 10px 0; }
|
||||
h2 { font-size: 1.25em; }
|
||||
h3 { font-size: 1.15em; }
|
||||
h4 { font-size: 1.06em; }
|
||||
|
||||
a:link { font-weight: bold; color: #004080; text-decoration: none; }
|
||||
a:visited { font-weight: bold; color: #006699; text-decoration: none; }
|
||||
a:link:hover { text-decoration: underline; }
|
||||
|
||||
hr {
|
||||
color:#cccccc;
|
||||
background: #00007f;
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
blockquote { margin-left: 3em; }
|
||||
|
||||
ul { list-style-type: disc; }
|
||||
|
||||
p.name {
|
||||
font-family: "Andale Mono", monospace;
|
||||
padding-top: 1em;
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: rgb(245, 245, 245);
|
||||
border: 1px solid #C0C0C0; /* silver */
|
||||
padding: 10px;
|
||||
margin: 10px 0 10px 0;
|
||||
overflow: auto;
|
||||
font-family: "Andale Mono", monospace;
|
||||
}
|
||||
|
||||
pre.example {
|
||||
font-size: .85em;
|
||||
}
|
||||
|
||||
table.index { border: 1px #00007f; }
|
||||
table.index td { text-align: left; vertical-align: top; }
|
||||
|
||||
#container {
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
#product {
|
||||
text-align: center;
|
||||
border-bottom: 1px solid #cccccc;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#product big {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
#main {
|
||||
background-color: #f0f0f0;
|
||||
border-left: 2px solid #cccccc;
|
||||
}
|
||||
|
||||
#navigation {
|
||||
float: left;
|
||||
width: 14em;
|
||||
vertical-align: top;
|
||||
background-color: #f0f0f0;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
#navigation h2 {
|
||||
background-color:#e7e7e7;
|
||||
font-size:1.1em;
|
||||
color:#000000;
|
||||
text-align: left;
|
||||
padding:0.2em;
|
||||
border-top:1px solid #dddddd;
|
||||
border-bottom:1px solid #dddddd;
|
||||
}
|
||||
|
||||
#navigation ul
|
||||
{
|
||||
font-size:1em;
|
||||
list-style-type: none;
|
||||
margin: 1px 1px 10px 1px;
|
||||
}
|
||||
|
||||
#navigation li {
|
||||
text-indent: -1em;
|
||||
display: block;
|
||||
margin: 3px 0px 0px 22px;
|
||||
}
|
||||
|
||||
#navigation li li a {
|
||||
margin: 0px 3px 0px -1em;
|
||||
}
|
||||
|
||||
#content {
|
||||
margin-left: 14em;
|
||||
padding: 1em;
|
||||
width: 700px;
|
||||
border-left: 2px solid #cccccc;
|
||||
border-right: 2px solid #cccccc;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#about {
|
||||
clear: both;
|
||||
padding: 5px;
|
||||
border-top: 2px solid #cccccc;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
@media print {
|
||||
body {
|
||||
font: 12pt "Times New Roman", "TimeNR", Times, serif;
|
||||
}
|
||||
a { font-weight: bold; color: #004080; text-decoration: underline; }
|
||||
|
||||
#main {
|
||||
background-color: #ffffff;
|
||||
border-left: 0px;
|
||||
}
|
||||
|
||||
#container {
|
||||
margin-left: 2%;
|
||||
margin-right: 2%;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#content {
|
||||
padding: 1em;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#navigation {
|
||||
display: none;
|
||||
}
|
||||
pre.example {
|
||||
font-family: "Andale Mono", monospace;
|
||||
font-size: 10pt;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
}
|
||||
|
||||
table.module_list {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.module_list td {
|
||||
border-width: 1px;
|
||||
padding: 3px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
}
|
||||
table.module_list td.name { background-color: #f0f0f0; min-width: 200px; }
|
||||
table.module_list td.summary { width: 100%; }
|
||||
|
||||
|
||||
table.function_list {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.function_list td {
|
||||
border-width: 1px;
|
||||
padding: 3px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
}
|
||||
table.function_list td.name { background-color: #f0f0f0; min-width: 200px; }
|
||||
table.function_list td.summary { width: 100%; }
|
||||
|
||||
ul.nowrap {
|
||||
overflow:auto;
|
||||
white-space:nowrap;
|
||||
}
|
||||
|
||||
dl.table dt, dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;}
|
||||
dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;}
|
||||
dl.table h3, dl.function h3 {font-size: .95em;}
|
||||
|
||||
/* stop sublists from having initial vertical space */
|
||||
ul ul { margin-top: 0px; }
|
||||
ol ul { margin-top: 0px; }
|
||||
ol ol { margin-top: 0px; }
|
||||
ul ol { margin-top: 0px; }
|
||||
|
||||
/* make the target distinct; helps when we're navigating to a function */
|
||||
a:target + * {
|
||||
background-color: #FF9;
|
||||
}
|
||||
|
||||
|
||||
/* styles for prettification of source */
|
||||
pre .comment { color: #558817; }
|
||||
pre .constant { color: #a8660d; }
|
||||
pre .escape { color: #844631; }
|
||||
pre .keyword { color: #aa5050; font-weight: bold; }
|
||||
pre .library { color: #0e7c6b; }
|
||||
pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; }
|
||||
pre .string { color: #8080ff; }
|
||||
pre .number { color: #f8660d; }
|
||||
pre .operator { color: #2239a8; font-weight: bold; }
|
||||
pre .preprocessor, pre .prepro { color: #a33243; }
|
||||
pre .global { color: #800080; }
|
||||
pre .user-keyword { color: #800080; }
|
||||
pre .prompt { color: #558817; }
|
||||
pre .url { color: #272fc2; text-decoration: underline; }
|
||||
|
||||
401
doc/modules/ExpGamingCore.Commands.html
Normal file
401
doc/modules/ExpGamingCore.Commands.html
Normal file
@@ -0,0 +1,401 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
<li><a href="#Tables">Tables</a></li>
|
||||
<li><a href="#Fields">Fields</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><strong>ExpGamingCore.Command</strong></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>ExpGamingCore.Command</code></h1>
|
||||
<p>A full ranking system for factorio.</p>
|
||||
<p></p>
|
||||
<h3>Info:</h3>
|
||||
<ul>
|
||||
<li><strong>License</strong>: https://github.com/explosivegaming/scenario/blob/master/LICENSE</li>
|
||||
<li><strong>Author</strong>: Cooldude2606</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#format_inputs">format_inputs (command)</a></td>
|
||||
<td class="summary">Returns the inputs of this command as a formated string</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#validate_args">validate_args (event)</a></td>
|
||||
<td class="summary">Used to validate the arguments of a command, will understand strings with "" as a single param else spaces divede the params</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_commands">get_commands (player)</a></td>
|
||||
<td class="summary">Used to return all the commands a player can use</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add_command">add_command (name[, description='No Description'][, inputs=an infite string], callback)</a></td>
|
||||
<td class="summary">Used to define commands</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Tables">Tables</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#validate">validate</a></td>
|
||||
<td class="summary">Collection of funcations that can be used to validate inputs</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Fields">Fields</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#error">error</a></td>
|
||||
<td class="summary">Used as an error constant for validation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#data">data</a></td>
|
||||
<td class="summary">Index of all command data</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "format_inputs"></a>
|
||||
<strong>format_inputs (command)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns the inputs of this command as a formated string
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">command</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a>, <a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a> or <span class="type">event</span></span>
|
||||
the command to get the inputs of
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the formated string for the inputs
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">commands.format_inputs(<span class="string">'interface'</span>) <span class="comment">-- returns <code> (if you have ExpGamingCore.Server)</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "validate_args"></a>
|
||||
<strong>validate_args (event)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to validate the arguments of a command, will understand strings with "" as a single param else spaces divede the params
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">event</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
this is the event created by add_command not on_console_command
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the error that happend while parsing the args
|
||||
</ol>
|
||||
<h3>Or</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the args for this command
|
||||
</ol>
|
||||
<h3>Or</h3>
|
||||
<ol>
|
||||
|
||||
command.error
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">commands.validate_args(event) <span class="comment">-- returns args table</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_commands"></a>
|
||||
<strong>get_commands (player)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to return all the commands a player can use
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">player</span>
|
||||
<span class="types"><span class="type">index</span>, <span class="type">name</span> or <span class="type">player</span></span>
|
||||
the player to test as
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
a table containg all the commands the player can use
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">get_commands(<span class="number">1</span>) <span class="comment">-- return table of command data for each command that the player can use</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "add_command"></a>
|
||||
<strong>add_command (name[, description='No Description'][, inputs=an infite string], callback)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to define commands
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the name of the command
|
||||
</li>
|
||||
<li><span class="parameter">description</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the description of the command
|
||||
(<em>default</em> 'No Description')
|
||||
</li>
|
||||
<li><span class="parameter">inputs</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
a table of the inputs to be used, last index being true makes the last parameter open ended (longer than one word)
|
||||
(<em>default</em> an infite string)
|
||||
</li>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the function to call on the event
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example"><span class="comment">--see examples in file</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "validate"></a>
|
||||
<strong>validate</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Collection of funcations that can be used to validate inputs
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">__comment</span>
|
||||
replace _ with - the ldoc did not like me using - in the names
|
||||
</li>
|
||||
<li><span class="parameter">string</span>
|
||||
basicly does nothing but a type filed is required
|
||||
</li>
|
||||
<li><span class="parameter">string_inf</span>
|
||||
same as string but is infite in length, must be last arg
|
||||
</li>
|
||||
<li><span class="parameter">string_len</span>
|
||||
same as string but can define a max lengh
|
||||
</li>
|
||||
<li><span class="parameter">number</span>
|
||||
converts the input into a number
|
||||
</li>
|
||||
<li><span class="parameter">number_int</span>
|
||||
conerts the input to a number and floors it
|
||||
</li>
|
||||
<li><span class="parameter">number_range</span>
|
||||
allows a number in a range after it has been floored min < math.floor(X) <= max
|
||||
</li>
|
||||
<li><span class="parameter">number_range</span>
|
||||
allows a number in a range after it has been floored min < math.floor(X) <= max
|
||||
</li>
|
||||
<li><span class="parameter">player</span>
|
||||
converts the input into a valid player
|
||||
</li>
|
||||
<li><span class="parameter">player_online</span>
|
||||
converts the input to a player if the player is online
|
||||
</li>
|
||||
<li><span class="parameter">player_alive</span>
|
||||
converts the input to a player if the player is online and alive
|
||||
</li>
|
||||
<li><span class="parameter">player_rank</span>
|
||||
-online converts the input to a player if the player is a lower rank than the user and online
|
||||
</li>
|
||||
<li><span class="parameter">player_rank</span>
|
||||
-online converts the input to a player if the player is a lower rank than the user and online
|
||||
</li>
|
||||
<li><span class="parameter">player_rank_alive</span>
|
||||
converts the input to a player if the player is a lower rank than the user and online and alive
|
||||
</li>
|
||||
<li><span class="parameter">type</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the type that the value should be
|
||||
</li>
|
||||
<li><span class="parameter">value</span>
|
||||
the value that will be tested
|
||||
</li>
|
||||
<li><span class="parameter">...</span>
|
||||
any other data that can be passed to the function
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">commands.validate[<span class="global">type</span>](value,event,...)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "error"></a>
|
||||
<strong>error</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used as an error constant for validation
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example"><span class="keyword">return</span> commands.<span class="global">error</span>, <span class="string">'err message'</span></pre></li>
|
||||
<li><pre class="example"><span class="keyword">return</span> commands.<span class="global">error</span>(<span class="string">'err message'</span>)</pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "data"></a>
|
||||
<strong>data</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Index of all command data
|
||||
|
||||
|
||||
<ul>
|
||||
<li><span class="parameter">key</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a>, <a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a> or <span class="type">event</span></span>
|
||||
the command that will be returned: string is the name, table is the command data, event is event from add_command
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">commands.command_name <span class="comment">-- returns command data</span></pre></li>
|
||||
<li><pre class="example">commands.data <span class="comment">-- returns all data</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
337
doc/modules/ExpGamingCore.Gui.Center.html
Normal file
337
doc/modules/ExpGamingCore.Gui.Center.html
Normal file
@@ -0,0 +1,337 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><strong>ExpGamingCore.Gui.Center</strong></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>ExpGamingCore.Gui.Center</code></h1>
|
||||
<p>Adds a uniform preset for guis in the center of the screen which allow for different tabs to be opened</p>
|
||||
<p></p>
|
||||
<h3>Info:</h3>
|
||||
<ul>
|
||||
<li><strong>License</strong>: https://github.com/explosivegaming/scenario/blob/master/LICENSE</li>
|
||||
<li><strong>Author</strong>: Cooldude2606</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#_comment">_comment ()</a></td>
|
||||
<td class="summary">This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add">add (obj)</a></td>
|
||||
<td class="summary">Adds a new obj to the center gui</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_flow">get_flow (player)</a></td>
|
||||
<td class="summary">Used to get the center frame of the player, used mainly in script</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#open">open (player, center)</a></td>
|
||||
<td class="summary">Used to open a center frame for a player</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#open_tab">open_tab (player, center, tab)</a></td>
|
||||
<td class="summary">Used to open a center frame for a player</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#clear">clear (player)</a></td>
|
||||
<td class="summary">Used to clear the center frame of the player, used mainly in script</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#center._center:add_tab">center._center:add_tab (name, caption[, tooltip], callback)</a></td>
|
||||
<td class="summary">If deafult draw is used then you can add tabs to the gui with this function</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "_comment"></a>
|
||||
<strong>_comment ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "add"></a>
|
||||
<strong>add (obj)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Adds a new obj to the center gui
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">obj</span>
|
||||
contains the new object, needs name, fraw is opt and is function(root_frame)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
the object made, used to add tabs
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.center.add{name=<span class="string">'foo'</span>,caption=<span class="string">'Foo'</span>,tooltip=<span class="string">'Testing'</span>,draw=<span class="keyword">function</span>}</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_flow"></a>
|
||||
<strong>get_flow (player)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to get the center frame of the player, used mainly in script
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">player</span>
|
||||
a player indifier to get the flow for
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the gui element flow
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.center.get_flow(player) <span class="comment">-- returns gui emelemt</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "open"></a>
|
||||
<strong>open (player, center)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to open a center frame for a player
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">player</span>
|
||||
a player indifier to get the flow for
|
||||
</li>
|
||||
<li><span class="parameter">center</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the name of the center frame to open
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
based on if it successed or not
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.center.open(player,<span class="string">'server-info'</span>) <span class="comment">-- return true</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "open_tab"></a>
|
||||
<strong>open_tab (player, center, tab)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to open a center frame for a player
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">player</span>
|
||||
a player indifier to get the flow for
|
||||
</li>
|
||||
<li><span class="parameter">center</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the name of the center frame to open
|
||||
</li>
|
||||
<li><span class="parameter">tab</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the name of the tab to open
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
based on if it successed or not
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.center.open_tab(player,<span class="string">'readme'</span>,<span class="string">'rules'</span>) <span class="comment">-- return true</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "clear"></a>
|
||||
<strong>clear (player)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to clear the center frame of the player, used mainly in script
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">player</span>
|
||||
a player indifier to get the flow for
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.center.clear(player)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "center._center:add_tab"></a>
|
||||
<strong>center._center:add_tab (name, caption[, tooltip], callback)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
If deafult draw is used then you can add tabs to the gui with this function
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
this is the name of the tab
|
||||
</li>
|
||||
<li><span class="parameter">caption</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
this is the words that appear on the tab button
|
||||
</li>
|
||||
<li><span class="parameter">tooltip</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the tooltip that is on the button
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
this is called when button is pressed with function(root_frame)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
self to allow chaining of _center:add_tab
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">_center:add_tab(<span class="string">'foo'</span>,<span class="string">'Foo'</span>,<span class="string">'Just a tab'</span>,<span class="keyword">function</span>)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
498
doc/modules/ExpGamingCore.Gui.Inputs.html
Normal file
498
doc/modules/ExpGamingCore.Gui.Inputs.html
Normal file
@@ -0,0 +1,498 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><strong>ExpGamingCore.Gui.Inputs</strong></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>ExpGamingCore.Gui.Inputs</code></h1>
|
||||
<p>Adds a clean way of making new inputs for a gui allowing for sliders and text inputs to be hanndleded with custom events</p>
|
||||
<p></p>
|
||||
<h3>Info:</h3>
|
||||
<ul>
|
||||
<li><strong>License</strong>: https://github.com/explosivegaming/scenario/blob/master/LICENSE</li>
|
||||
<li><strong>Author</strong>: Cooldude2606</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#_comment">_comment ()</a></td>
|
||||
<td class="summary">This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#inputs._input:on_event">inputs._input:on_event (event, callback)</a></td>
|
||||
<td class="summary">Sets the input to trigger on an certain event</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#inputs._input:draw">inputs._input:draw (root)</a></td>
|
||||
<td class="summary">Draw the input into the root element</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add">add (obj)</a></td>
|
||||
<td class="summary">Add a new input, this is the same as doing frame.add{} but returns a diffrent object</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add_elem_button">add_elem_button (name, elem_type, tooltip, callback)</a></td>
|
||||
<td class="summary">Used to define a choose-elem-button callback only on elem_changed</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add_checkbox">add_checkbox (name, radio, display, default, callback_true, callback_false)</a></td>
|
||||
<td class="summary">Used to define a checkbox callback only on state_changed</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#reset_radio">reset_radio (elements)</a></td>
|
||||
<td class="summary">Used to reset the state of radio buttons, recomened to be called on_state_change to reset any radio buttons it is ment to work with.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add_text">add_text (name, box, text, callback)</a></td>
|
||||
<td class="summary">Used to define a text callback only on text_changed</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add_slider">add_slider (name, orientation, min, max, start_callback, callback)</a></td>
|
||||
<td class="summary">Used to define a slider callback only on value_changed</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add_drop_down">add_drop_down (name, items, index, callback)</a></td>
|
||||
<td class="summary">Used to define a drop down callback only on value_changed</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "_comment"></a>
|
||||
<strong>_comment ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "inputs._input:on_event"></a>
|
||||
<strong>inputs._input:on_event (event, callback)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Sets the input to trigger on an certain event
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">event</span>
|
||||
the event to raise callback on | can be number of the event | can be a key of inputs.events
|
||||
</li>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the function you want to run on the event
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
returns self so you can chain together
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">button:on_event(defines.events.on_gui_click,player_return)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "inputs._input:draw"></a>
|
||||
<strong>inputs._input:draw (root)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Draw the input into the root element
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">root</span>
|
||||
the element you want to add the input to
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
returns the element that was added
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">button:draw(frame)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "add"></a>
|
||||
<strong>add (obj)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Add a new input, this is the same as doing frame.add{} but returns a diffrent object
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">obj</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the new element to add if caption is a sprite path then sprite is used
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the custom input object
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.inputs.add{<span class="global">type</span>=<span class="string">'button'</span>,name=<span class="string">'test'</span>,caption=<span class="string">'Test'</span>}</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "add_elem_button"></a>
|
||||
<strong>add_elem_button (name, elem_type, tooltip, callback)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to define a choose-elem-button callback only on elem_changed
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the name of this button
|
||||
</li>
|
||||
<li><span class="parameter">elem_type</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the display for this button, either text or sprite path
|
||||
</li>
|
||||
<li><span class="parameter">tooltip</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the tooltip to show on the button
|
||||
</li>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the callback to call on change function(player,element,elem)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the button object that was made, to allow a custom error event if wanted
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.inputs.add_elem_button(<span class="string">'test'</span>,<span class="string">'Test'</span>,<span class="string">'Just for testing'</span>,<span class="keyword">function</span>)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "add_checkbox"></a>
|
||||
<strong>add_checkbox (name, radio, display, default, callback_true, callback_false)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to define a checkbox callback only on state_changed
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the name of this button
|
||||
</li>
|
||||
<li><span class="parameter">radio</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
if this is a radio button
|
||||
</li>
|
||||
<li><span class="parameter">display</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the display for this button, either text or sprite path
|
||||
</li>
|
||||
<li><span class="parameter">default</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the callback which choses the default check state
|
||||
</li>
|
||||
<li><span class="parameter">callback_true</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the callback to call when changed to true
|
||||
</li>
|
||||
<li><span class="parameter">callback_false</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the callback to call when changed to false
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the button object that was made, to allow a custom error event if wanted
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.inputs.add_checkbox(<span class="string">'test'</span>,<span class="keyword">false</span>,<span class="string">'Just for testing'</span>,<span class="keyword">function</span>,<span class="keyword">function</span>,funvtion)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "reset_radio"></a>
|
||||
<strong>reset_radio (elements)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to reset the state of radio buttons, recomened to be called on_state_change to reset any radio buttons it is ment to work with.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">elements</span>
|
||||
can be a list of elements or a single element
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.inputs.reset_radio{radio1,radio2,...}</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "add_text"></a>
|
||||
<strong>add_text (name, box, text, callback)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to define a text callback only on text_changed
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the name of this button
|
||||
</li>
|
||||
<li><span class="parameter">box</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
is it a text box rather than a text field
|
||||
</li>
|
||||
<li><span class="parameter">text</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the starting text
|
||||
</li>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the callback to call on change function(player,text,element)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the text object that was made, to allow a custom error event if wanted
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.inputs.add_text(<span class="string">'test'</span>,<span class="keyword">false</span>,<span class="string">'Just for testing'</span>,<span class="keyword">function</span>)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "add_slider"></a>
|
||||
<strong>add_slider (name, orientation, min, max, start_callback, callback)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to define a slider callback only on value_changed
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the name of this button
|
||||
</li>
|
||||
<li><span class="parameter">orientation</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
direction of the slider
|
||||
</li>
|
||||
<li><span class="parameter">min</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
the lowest number
|
||||
</li>
|
||||
<li><span class="parameter">max</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
the highest number
|
||||
</li>
|
||||
<li><span class="parameter">start_callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
either a number or a function to return a number
|
||||
</li>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the function to be called on value_changed function(player,value,percent,element)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the slider object that was made, to allow a custom error event if wanted
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.inputs.add_slider(<span class="string">'test'</span>,<span class="string">'horizontal'</span>,<span class="number">1</span>,<span class="number">10</span>,<span class="number">5</span>,<span class="keyword">function</span>)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "add_drop_down"></a>
|
||||
<strong>add_drop_down (name, items, index, callback)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to define a drop down callback only on value_changed
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
name of the drop down
|
||||
</li>
|
||||
<li><span class="parameter">items</span>
|
||||
either a list or a function which returns a list
|
||||
</li>
|
||||
<li><span class="parameter">index</span>
|
||||
either a number or a function which returns a number
|
||||
</li>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the callback which is called when a new index is selected function(player,selected,items,element)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the drop-down object that was made, to allow a custom error event if wanted
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.inputs.add_drop_down(<span class="string">'test'</span>,{<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>},<span class="number">1</span>,<span class="keyword">function</span>)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
240
doc/modules/ExpGamingCore.Gui.Left.html
Normal file
240
doc/modules/ExpGamingCore.Gui.Left.html
Normal file
@@ -0,0 +1,240 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><strong>ExpGamingCore.Gui.Left</strong></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>ExpGamingCore.Gui.Left</code></h1>
|
||||
<p>Adds a organiser for left gui ellements which will automaticaly update there information and have open requirements</p>
|
||||
<p></p>
|
||||
<h3>Info:</h3>
|
||||
<ul>
|
||||
<li><strong>License</strong>: https://github.com/explosivegaming/scenario/blob/master/LICENSE</li>
|
||||
<li><strong>Author</strong>: Cooldude2606</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#_comment">_comment ()</a></td>
|
||||
<td class="summary">This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add">add (obj)</a></td>
|
||||
<td class="summary">Used to add a left gui frame</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#update">update ([frame[, players]])</a></td>
|
||||
<td class="summary">This is used to update all the guis of connected players, good idea to use our thread system as it as nested for loops</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#open">open (left_name)</a></td>
|
||||
<td class="summary">Used to open the left gui of every player</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#close">close (left_name)</a></td>
|
||||
<td class="summary">Used to close the left gui of every player</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "_comment"></a>
|
||||
<strong>_comment ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "add"></a>
|
||||
<strong>add (obj)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to add a left gui frame
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">obj</span>
|
||||
this is what will be made, needs a name and a draw function(root_frame), open_on_join can be used to set the deaful state true/false, can_open is a test to block it from opening but is not needed
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
the object that is made to... well idk but for the future
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.left.add{name=<span class="string">'foo'</span>,caption=<span class="string">'Foo'</span>,tooltip=<span class="string">'just testing'</span>,open_on_join=<span class="keyword">true</span>,can_open=<span class="keyword">function</span>,draw=<span class="keyword">function</span>}</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "update"></a>
|
||||
<strong>update ([frame[, players]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
This is used to update all the guis of connected players, good idea to use our thread system as it as nested for loops
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">frame</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
this is the name of a frame if you only want to update one
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
<li><span class="parameter">players</span>
|
||||
the player to update for, if not given all players are updated, can be one player
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.left.update()</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "open"></a>
|
||||
<strong>open (left_name)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to open the left gui of every player
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">left_name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
this is the gui that you want to open
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.left.open(<span class="string">'foo'</span>)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "close"></a>
|
||||
<strong>close (left_name)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to close the left gui of every player
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">left_name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
this is the gui that you want to close
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.left.close(<span class="string">'foo'</span>)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
185
doc/modules/ExpGamingCore.Gui.Popup.html
Normal file
185
doc/modules/ExpGamingCore.Gui.Popup.html
Normal file
@@ -0,0 +1,185 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><strong>ExpGamingCore.Gui.Popup</strong></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>ExpGamingCore.Gui.Popup</code></h1>
|
||||
<p>Adds a location for popups which can be dismissed by a player and created from other scripts</p>
|
||||
<p></p>
|
||||
<h3>Info:</h3>
|
||||
<ul>
|
||||
<li><strong>License</strong>: https://github.com/explosivegaming/scenario/blob/master/LICENSE</li>
|
||||
<li><strong>Author</strong>: Cooldude2606</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#_comment">_comment ()</a></td>
|
||||
<td class="summary">This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add">add (obj)</a></td>
|
||||
<td class="summary">Used to add a popup gui style</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#open">open (style, data[, players=game.connected_players])</a></td>
|
||||
<td class="summary">Use to open a popup for these players</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "_comment"></a>
|
||||
<strong>_comment ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "add"></a>
|
||||
<strong>add (obj)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to add a popup gui style
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">obj</span>
|
||||
this is what will be made, needs a name and a draw function(root_frame,data)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
the object that is made to... well idk but for the future
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.left.add{name=<span class="string">'foo'</span>,caption=<span class="string">'Foo'</span>,draw=<span class="keyword">function</span>}</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "open"></a>
|
||||
<strong>open (style, data[, players=game.connected_players])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Use to open a popup for these players
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">style</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
this is the name you gave to the popup when added
|
||||
</li>
|
||||
<li><span class="parameter">data</span>
|
||||
this is the data that is sent to the draw function
|
||||
</li>
|
||||
<li><span class="parameter">players</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the players to open the popup for
|
||||
(<em>default</em> game.connected_players)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.popup.open(<span class="string">'ban'</span>,<span class="keyword">nil</span>,{player=<span class="number">1</span>,reason=<span class="string">'foo'</span>})</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
144
doc/modules/ExpGamingCore.Gui.Test.html
Normal file
144
doc/modules/ExpGamingCore.Gui.Test.html
Normal file
@@ -0,0 +1,144 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><strong>ExpGamingCore.Gui.Test</strong></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>ExpGamingCore.Gui.Test</code></h1>
|
||||
<p>Used to test all gui elements and parts can be used in game via Gui.test()</p>
|
||||
<p></p>
|
||||
<h3>Info:</h3>
|
||||
<ul>
|
||||
<li><strong>License</strong>: https://github.com/explosivegaming/scenario/blob/master/LICENSE</li>
|
||||
<li><strong>Author</strong>: Cooldude2606</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#_comment">_comment ()</a></td>
|
||||
<td class="summary">This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Gui.test">Gui.test ([player=game.player])</a></td>
|
||||
<td class="summary">The funcation that is called when calling Gui.test</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "_comment"></a>
|
||||
<strong>_comment ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Gui.test"></a>
|
||||
<strong>Gui.test ([player=game.player])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
The funcation that is called when calling Gui.test
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">player</span>
|
||||
a pointer to a player to draw the test gui for
|
||||
(<em>default</em> game.player)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.test() <span class="comment">-- draws test gui</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
190
doc/modules/ExpGamingCore.Gui.Toolbar.html
Normal file
190
doc/modules/ExpGamingCore.Gui.Toolbar.html
Normal file
@@ -0,0 +1,190 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><strong>ExpGamingCore.Gui.Toolbar</strong></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>ExpGamingCore.Gui.Toolbar</code></h1>
|
||||
<p>Adds a toolbar to the top left of the screen</p>
|
||||
<p></p>
|
||||
<h3>Info:</h3>
|
||||
<ul>
|
||||
<li><strong>License</strong>: https://github.com/explosivegaming/scenario/blob/master/LICENSE</li>
|
||||
<li><strong>Author</strong>: Cooldude2606</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#_comment">_comment ()</a></td>
|
||||
<td class="summary">This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add">add (name, caption, tooltip, callback)</a></td>
|
||||
<td class="summary">Add a button to the toolbar, ranks need to be allowed to use these buttons if ranks is preset</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#draw">draw (player)</a></td>
|
||||
<td class="summary">Draws the toolbar for a certain player</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "_comment"></a>
|
||||
<strong>_comment ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "add"></a>
|
||||
<strong>add (name, caption, tooltip, callback)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Add a button to the toolbar, ranks need to be allowed to use these buttons if ranks is preset
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the name of the button
|
||||
</li>
|
||||
<li><span class="parameter">caption</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
can be a sprite path or text to show
|
||||
</li>
|
||||
<li><span class="parameter">tooltip</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the help to show for the button
|
||||
</li>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the function which is called on_click
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the button object that was made
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">toolbar.add(<span class="string">'foo'</span>,<span class="string">'Foo'</span>,<span class="string">'Test'</span>,<span class="keyword">function</span>() game.<span class="global">print</span>(<span class="string">'test'</span>) <span class="keyword">end</span>)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "draw"></a>
|
||||
<strong>draw (player)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Draws the toolbar for a certain player
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">player</span>
|
||||
the player to draw the tool bar of
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">toolbar.draw(<span class="number">1</span>)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
366
doc/modules/ExpGamingCore.Gui.html
Normal file
366
doc/modules/ExpGamingCore.Gui.html
Normal file
@@ -0,0 +1,366 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
<li><a href="#Tables">Tables</a></li>
|
||||
<li><a href="#Fields">Fields</a></li>
|
||||
<li><a href="#modules_expgamingcore_gui_src_server_Functions">modules.expgamingcore.gui.src.server Functions</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><strong>ExpGamingCore.Gui</strong></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>ExpGamingCore.Gui</code></h1>
|
||||
<p>Adds a objective version to custom guis.</p>
|
||||
<p></p>
|
||||
<h3>Info:</h3>
|
||||
<ul>
|
||||
<li><strong>License</strong>: https://github.com/explosivegaming/scenario/blob/master/LICENSE</li>
|
||||
<li><strong>Author</strong>: Cooldude2606</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#bar">bar (frame[, width=10])</a></td>
|
||||
<td class="summary">Add a white bar to any gui frame</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set_dropdown_index">set_dropdown_index (dropdown, _item)</a></td>
|
||||
<td class="summary">Used to set the index of a drop down to a certian item</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#cam_link">cam_link (data)</a></td>
|
||||
<td class="summary">Adds a camera that updates every tick (or less depeading on how many are opening) it will move to follow an entity</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Tables">Tables</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#events">events</a></td>
|
||||
<td class="summary">Stores all the on_player_joined_game event handlers for the guis</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#ParametersForCamLink">ParametersForCamLink</a></td>
|
||||
<td class="summary">Prams for Gui.cam_link</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Fields">Fields</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#data">data</a></td>
|
||||
<td class="summary">Used to set and get data about different guis</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#modules_expgamingcore_gui_src_server_Functions">modules.expgamingcore.gui.src.server Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#_comment">_comment ()</a></td>
|
||||
<td class="summary">This file will be loaded when ExpGamingCore.Command is present</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#__comment">__comment ()</a></td>
|
||||
<td class="summary">Adds a server thread that allows the camera follows to be toggled off and on</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "bar"></a>
|
||||
<strong>bar (frame[, width=10])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Add a white bar to any gui frame
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">frame</span>
|
||||
the frame to draw the line to
|
||||
</li>
|
||||
<li><span class="parameter">width</span>
|
||||
the width of the bar
|
||||
(<em>default</em> 10)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
the line that was made type is progressbar
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.bar(frame,<span class="number">100</span>)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "set_dropdown_index"></a>
|
||||
<strong>set_dropdown_index (dropdown, _item)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to set the index of a drop down to a certian item
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">dropdown</span>
|
||||
the dropdown that is to be effected
|
||||
</li>
|
||||
<li><span class="parameter">_item</span>
|
||||
this is the item to look for
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
returns the dropdown if it was successful
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui.set_dropdown_index(dropdown,player.name) <span class="comment">-- will select the index with the players name as the value</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "cam_link"></a>
|
||||
<strong>cam_link (data)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Adds a camera that updates every tick (or less depeading on how many are opening) it will move to follow an entity
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">data</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
contains all other params given below
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
the camera that the function used be it made or given as a param
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">Gui.cam_link{entity=game.player.character,frame=frame,width=<span class="number">50</span>,hight=<span class="number">50</span>,zoom=<span class="number">1</span>}</pre></li>
|
||||
<li><pre class="example">Gui.cam_link{entity=game.player.character,cam=frame.camera,surface=game.surfaces[<span class="string">'testing'</span>]}</pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "events"></a>
|
||||
<strong>events</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Stores all the on_player_joined_game event handlers for the guis
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "ParametersForCamLink"></a>
|
||||
<strong>ParametersForCamLink</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Prams for Gui.cam_link
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">entity</span>
|
||||
this is the entity that the camera will follow
|
||||
</li>
|
||||
<li><span class="parameter">cam</span>
|
||||
a camera that you already have in the gui
|
||||
</li>
|
||||
<li><span class="parameter">frame</span>
|
||||
the frame to add the camera to, no effect if cam param is given
|
||||
</li>
|
||||
<li><span class="parameter">zoom</span>
|
||||
the zoom to give the new camera
|
||||
</li>
|
||||
<li><span class="parameter">width</span>
|
||||
the width to give the new camera
|
||||
</li>
|
||||
<li><span class="parameter">height</span>
|
||||
the height to give the new camera
|
||||
</li>
|
||||
<li><span class="parameter">surface</span>
|
||||
this will over ride the surface that the camera follows on, allowing for a 'ghost surface' while keeping same position
|
||||
</li>
|
||||
<li><span class="parameter">respawn_open</span>
|
||||
if set to true then the camera will auto re link to the player after a respawn
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "data"></a>
|
||||
<strong>data</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to set and get data about different guis
|
||||
|
||||
|
||||
<ul>
|
||||
<li><span class="parameter">location</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the location to get/set the data, center left etc...
|
||||
</li>
|
||||
<li><span class="parameter">key</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the name of the gui to set the value of
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
<li><span class="parameter">value</span>
|
||||
the data that will be set can be any value but table advised
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">Gui.data[location] <span class="comment">-- returns the gui data for that gui location ex center</span></pre></li>
|
||||
<li><pre class="example">Gui.data(location,gui_name,gui_data) <span class="comment">-- adds gui data for a gui at a location</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="modules_expgamingcore_gui_src_server_Functions"></a>modules.expgamingcore.gui.src.server Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "_comment"></a>
|
||||
<strong>_comment ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
This file will be loaded when ExpGamingCore.Command is present
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "__comment"></a>
|
||||
<strong>__comment ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Adds a server thread that allows the camera follows to be toggled off and on
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
883
doc/modules/ExpGamingCore.Ranking.html
Normal file
883
doc/modules/ExpGamingCore.Ranking.html
Normal file
@@ -0,0 +1,883 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
<li><a href="#Tables">Tables</a></li>
|
||||
<li><a href="#Events">Events</a></li>
|
||||
<li><a href="#Class_Rank">Class Rank </a></li>
|
||||
<li><a href="#Class_Group">Class Group </a></li>
|
||||
<li><a href="#modules_expgamingcore_ranking_src_server_Functions">modules.expgamingcore.ranking.src.server Functions</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><strong>ExpGamingCore.Role</strong></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>ExpGamingCore.Role</code></h1>
|
||||
<p>A full ranking system for factorio.</p>
|
||||
<p></p>
|
||||
<h3>Info:</h3>
|
||||
<ul>
|
||||
<li><strong>License</strong>: https://github.com/explosivegaming/scenario/blob/master/LICENSE</li>
|
||||
<li><strong>Author</strong>: Cooldude2606</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#output_ranks">output_ranks ([player=server])</a></td>
|
||||
<td class="summary">Outputs as a string all the ranks and the loaded order</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#_base_preset">_base_preset (ranks)</a></td>
|
||||
<td class="summary">Used to set the prset ranks that will be given to players</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_rank">get_rank (mixed)</a></td>
|
||||
<td class="summary">Returns a rank object given a player or rank name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_group">get_group (mixed)</a></td>
|
||||
<td class="summary">Returns the group object used to sort ranks given group name or rank</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#print">print (rank_base, rtn[, colour=defines.color.white[, below=false]])</a></td>
|
||||
<td class="summary">Prints to all rank of greater/lower power of the rank given</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#give_rank">give_rank (player[, rank=default[, by_player='server'[, tick=game.tick]]])</a></td>
|
||||
<td class="summary">Gives a user a rank</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#revert">revert (player[, by_player=nil])</a></td>
|
||||
<td class="summary">Revert the last change to a players rank</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#find_preset">find_preset (player[, tick=nil])</a></td>
|
||||
<td class="summary">Given that the player has a rank in the preset table it is given; also will attempt to promote players if a time requirement is met</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Tables">Tables</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#global">global</a></td>
|
||||
<td class="summary">Global Table</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#ranks">ranks</a></td>
|
||||
<td class="summary">Contains the location of all the ranks, readonly during runtime</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#ranks">ranks</a></td>
|
||||
<td class="summary">Contains the location of all the rank groups, readonly during runtime</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#meta">meta</a></td>
|
||||
<td class="summary">Contains some meta data about the ranks</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Events">Events</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#on_rank_change">on_rank_change</a></td>
|
||||
<td class="summary">Called when there is a rank change for a user</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Class_Rank">Class Rank </a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Ranking._rank:allowed">Ranking._rank:allowed (action)</a></td>
|
||||
<td class="summary">Is this rank allowed to open this gui or use this command etc.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Ranking._rank:get_players">Ranking._rank:get_players ([online=false])</a></td>
|
||||
<td class="summary">Get all the players in this rank</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Ranking._rank:print">Ranking._rank:print (rtn[, colour=defines.color.white[, show_default=false]])</a></td>
|
||||
<td class="summary">Print a message to all players of this rank</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Ranking._rank:edit">Ranking._rank:edit (key, value)</a></td>
|
||||
<td class="summary">Allows for a clean way to edit rank objects</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Class_Group">Class Group </a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Ranking._group:create">Ranking._group:create (obj)</a></td>
|
||||
<td class="summary">Creates a new group</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Ranking._group:add_rank">Ranking._group:add_rank (obj)</a></td>
|
||||
<td class="summary">Creats a new rank with this group as its group</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Ranking._group:edit">Ranking._group:edit (key, value)</a></td>
|
||||
<td class="summary">Allows for a clean way to edit rank group objects</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#modules_expgamingcore_ranking_src_server_Functions">modules.expgamingcore.ranking.src.server Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#_comment">_comment ()</a></td>
|
||||
<td class="summary">This file will be loaded when ExpGamingCore.Server is present</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Ranking._rank:print">Ranking._rank:print (rtn[, colour=defines.color.white[, show_default=false]])</a></td>
|
||||
<td class="summary">Print a message to all players of this rank</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "output_ranks"></a>
|
||||
<strong>output_ranks ([player=server])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Outputs as a string all the ranks and the loaded order
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">player</span>
|
||||
<span class="types"><span class="type">player_name</span>, <span class="type">player_index</span> or <span class="type">LuaPlayer</span></span>
|
||||
the player that the info will be printed to, nil will print to server
|
||||
(<em>default</em> server)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Ranking.output_ranks(player) <span class="comment">-- prints to player</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "_base_preset"></a>
|
||||
<strong>_base_preset (ranks)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to set the prset ranks that will be given to players
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">ranks</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
table of player names with the player name as the key and rank name as the value
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Ranking._base_preset{name=rank_name,nameTwo=rank_name_two} <span class="comment">-- sets player name to have rank rank_name on join</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_rank"></a>
|
||||
<strong>get_rank (mixed)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns a rank object given a player or rank name
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">mixed</span>
|
||||
<span class="types"><span class="type">player</span>, <span class="type">player_index</span>, <span class="type">player_name</span>, <span class="type">rank_name</span>, <span class="type">Ranking._rank</span>, <span class="type">'server'</span> or <span class="type">'root'</span></span>
|
||||
what rank to get
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the rank that is linked to mixed
|
||||
</ol>
|
||||
<h3>Or</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">nil</span></span>
|
||||
there was no rank found
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">Ranking.get_rank(game.player) <span class="comment">-- returns player's rank</span></pre></li>
|
||||
<li><pre class="example">Ranking.get_rank(<span class="string">'admin'</span>) <span class="comment">-- returns rank by the name of admin</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_group"></a>
|
||||
<strong>get_group (mixed)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns the group object used to sort ranks given group name or rank
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">mixed</span>
|
||||
<span class="types"><span class="type">player</span>, <span class="type">player_index</span>, <span class="type">player_name</span>, <span class="type">rank_name</span>, <span class="type">rank</span>, <span class="type">'server'</span>, <span class="type">'root'</span>, <span class="type">group_name</span> or <span class="type">group</span></span>
|
||||
what group to get
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the group that is linked to mixed
|
||||
</ol>
|
||||
<h3>Or</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">nil</span></span>
|
||||
there was no rank group found
|
||||
</ol>
|
||||
|
||||
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
<a href="../modules/ExpGamingCore.Role.html#get_rank">Ranking.get_rank</a>
|
||||
</ul>
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">Ranking.get_group(game.player) <span class="comment">-- returns player's rank group</span></pre></li>
|
||||
<li><pre class="example">Ranking.get_group(<span class="string">'root'</span>) <span class="comment">-- returns group by name of root</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "print"></a>
|
||||
<strong>print (rank_base, rtn[, colour=defines.color.white[, below=false]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Prints to all rank of greater/lower power of the rank given
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">rank_base</span>
|
||||
<span class="types"><span class="type">Ranking._rank</span> or <span class="type">pointerToRank</span></span>
|
||||
the rank that acts as the cut off point (rank is always included)
|
||||
</li>
|
||||
<li><span class="parameter">rtn</span>
|
||||
what do you want to return to the players
|
||||
</li>
|
||||
<li><span class="parameter">colour</span>
|
||||
<span class="types"><span class="type">defines.color</span></span>
|
||||
the colour that will be used to print
|
||||
(<em>default</em> defines.color.white)
|
||||
</li>
|
||||
<li><span class="parameter">below</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
if true print to children rather than parents
|
||||
(<em>default</em> false)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Ranking.<span class="global">print</span>(<span class="string">'admin'</span>,<span class="string">'We got a grifer'</span>)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "give_rank"></a>
|
||||
<strong>give_rank (player[, rank=default[, by_player='server'[, tick=game.tick]]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Gives a user a rank
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">player</span>
|
||||
<span class="types"><span class="type">LuaPlayer</span> or <span class="type">pointerToPlayer</span></span>
|
||||
the player to give the rank to
|
||||
</li>
|
||||
<li><span class="parameter">rank</span>
|
||||
<span class="types"><span class="type">Ranking._rank</span> or <span class="type">pointerToRank</span></span>
|
||||
the rank to give to the player
|
||||
(<em>default</em> default)
|
||||
</li>
|
||||
<li><span class="parameter">by_player</span>
|
||||
<span class="types"><span class="type">LuaPlayer</span> or <span class="type">pointerToPlayer</span></span>
|
||||
the player who is giving the rank
|
||||
(<em>default</em> 'server')
|
||||
</li>
|
||||
<li><span class="parameter">tick</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
the tick that the rank is being given on, used as pass though
|
||||
(<em>default</em> game.tick)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Ranking.give_rank(<span class="number">1</span>,<span class="string">'admin'</span>)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "revert"></a>
|
||||
<strong>revert (player[, by_player=nil])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Revert the last change to a players rank
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">player</span>
|
||||
<span class="types"><span class="type">LuaPlayer</span> or <span class="type">pointerToPlayer</span></span>
|
||||
the player to revert the rank of
|
||||
</li>
|
||||
<li><span class="parameter">by_player</span>
|
||||
the player who is doing the revert
|
||||
(<em>default</em> nil)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Ranking.revert(<span class="number">1</span>) <span class="comment">-- reverts the rank of player with index 1</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "find_preset"></a>
|
||||
<strong>find_preset (player[, tick=nil])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Given that the player has a rank in the preset table it is given; also will attempt to promote players if a time requirement is met
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">player</span>
|
||||
<span class="types"><span class="type">LuaPlayer</span> or <span class="type">pointerToPlayer</span></span>
|
||||
the player to test for an auto rank
|
||||
</li>
|
||||
<li><span class="parameter">tick</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
the tick it happens on
|
||||
(<em>default</em> nil)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Ranking.find_preset(<span class="number">1</span>) <span class="comment">-- attemps to find the preset for player with index 1</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "global"></a>
|
||||
<strong>global</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Global Table
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">old</span>
|
||||
contains the previous rank a use had before a rank change
|
||||
</li>
|
||||
<li><span class="parameter">preset</span>
|
||||
contains the preset ranks that users will recive apon joining
|
||||
</li>
|
||||
<li><span class="parameter">last_change</span>
|
||||
contains the name of the player who last had there rank chagned
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "ranks"></a>
|
||||
<strong>ranks</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Contains the location of all the ranks, readonly during runtime
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "ranks"></a>
|
||||
<strong>ranks</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Contains the location of all the rank groups, readonly during runtime
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "meta"></a>
|
||||
<strong>meta</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Contains some meta data about the ranks
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">default</span>
|
||||
this is the name of the default rank
|
||||
</li>
|
||||
<li><span class="parameter">root</span>
|
||||
this is the name of the root rank
|
||||
</li>
|
||||
<li><span class="parameter">time_ranks</span>
|
||||
a list of all ranks which have a time requirement
|
||||
</li>
|
||||
<li><span class="parameter">time_highest</span>
|
||||
the power of the highest rank that has a time requirement
|
||||
</li>
|
||||
<li><span class="parameter">time_lowest</span>
|
||||
the lowest amount of time required for a time rank
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Events"></a>Events</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "on_rank_change"></a>
|
||||
<strong>on_rank_change</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Called when there is a rank change for a user
|
||||
|
||||
|
||||
<h3>field:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">name</span>
|
||||
the rank id
|
||||
</li>
|
||||
<li><span class="parameter">tick</span>
|
||||
the tick which the event was raised on
|
||||
</li>
|
||||
<li><span class="parameter">player_index</span>
|
||||
the player whos rank was changed
|
||||
</li>
|
||||
<li><span class="parameter">by_player_index</span>
|
||||
the player who changed the rank, 0 means server
|
||||
</li>
|
||||
<li><span class="parameter">new_rank</span>
|
||||
the name of the rank that was given
|
||||
</li>
|
||||
<li><span class="parameter">old_rank</span>
|
||||
the name of the rank the player had
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header has-description"><a name="Class_Rank"></a>Class Rank </h2>
|
||||
|
||||
<div class="section-description">
|
||||
The class for the ranks
|
||||
</div>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "Ranking._rank:allowed"></a>
|
||||
<strong>Ranking._rank:allowed (action)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Is this rank allowed to open this gui or use this command etc.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">action</span>
|
||||
<span class="types"><span class="type">teh</span></span>
|
||||
to test for
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
is it allowed
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">rank:allowed(<span class="string">'interface'</span>) <span class="comment">-- does the rank have permision for 'interface'</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Ranking._rank:get_players"></a>
|
||||
<strong>Ranking._rank:get_players ([online=false])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get all the players in this rank
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">online</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
get only online players
|
||||
(<em>default</em> false)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
a table of all players in this rank
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">rank:get_players()</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Ranking._rank:print"></a>
|
||||
<strong>Ranking._rank:print (rtn[, colour=defines.color.white[, show_default=false]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Print a message to all players of this rank
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">rtn</span>
|
||||
any value you want to return
|
||||
</li>
|
||||
<li><span class="parameter">colour</span>
|
||||
<span class="types"><span class="type">define.color</span></span>
|
||||
the colour that will be used to print
|
||||
(<em>default</em> defines.color.white)
|
||||
</li>
|
||||
<li><span class="parameter">show_default</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
weather to use the default rank name for the print, used as a pass though
|
||||
(<em>default</em> false)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">rank:<span class="global">print</span>(<span class="string">'foo'</span>) <span class="comment">-- prints to all members of this rank</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Ranking._rank:edit"></a>
|
||||
<strong>Ranking._rank:edit (key, value)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Allows for a clean way to edit rank objects
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">key</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the key to edit, often allow or disallow
|
||||
</li>
|
||||
<li><span class="parameter">value</span>
|
||||
the new value to be set
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">rank:edit(<span class="string">'allow'</span>,{<span class="string">'interface'</span>}) <span class="comment">-- allows this rank to use 'interface'</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header has-description"><a name="Class_Group"></a>Class Group </h2>
|
||||
|
||||
<div class="section-description">
|
||||
The class for the rank groups, the way to allow modules to idex a group that is always present, ranks will always look to there group as a parent
|
||||
</div>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "Ranking._group:create"></a>
|
||||
<strong>Ranking._group:create (obj)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Creates a new group
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">obj</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the fields for this object
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Ranking._group</span></span>
|
||||
returns the object to allow chaining
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Ranking._group:create{name=<span class="string">'root'</span>} <span class="comment">-- returns group with name root</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Ranking._group:add_rank"></a>
|
||||
<strong>Ranking._group:add_rank (obj)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Creats a new rank with this group as its group
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">obj</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the fields for this object
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Ranking._group</span></span>
|
||||
returns the object to allow chaining
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">group:add_rank{name=<span class="string">'root'</span>} <span class="comment">-- returns self</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Ranking._group:edit"></a>
|
||||
<strong>Ranking._group:edit (key, value)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Allows for a clean way to edit rank group objects
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">key</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the key to edit, often allow or disallow
|
||||
</li>
|
||||
<li><span class="parameter">value</span>
|
||||
the new value to be set
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">group:edit(<span class="string">'allow'</span>,{<span class="string">'interface'</span>}) <span class="comment">-- allows this rank to use 'interface'</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="modules_expgamingcore_ranking_src_server_Functions"></a>modules.expgamingcore.ranking.src.server Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "_comment"></a>
|
||||
<strong>_comment ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
This file will be loaded when ExpGamingCore.Server is present
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Ranking._rank:print"></a>
|
||||
<strong>Ranking._rank:print (rtn[, colour=defines.color.white[, show_default=false]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Print a message to all players of this rank
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">rtn</span>
|
||||
any value you want to return
|
||||
</li>
|
||||
<li><span class="parameter">colour</span>
|
||||
<span class="types"><span class="type">define.color</span></span>
|
||||
the colour that will be used to print
|
||||
(<em>default</em> defines.color.white)
|
||||
</li>
|
||||
<li><span class="parameter">show_default</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
weather to use the default rank name for the print, used as a pass though
|
||||
(<em>default</em> false)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">rank:<span class="global">print</span>(<span class="string">'foo'</span>) <span class="comment">-- prints to all members of this rank</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
848
doc/modules/ExpGamingCore.Server.html
Normal file
848
doc/modules/ExpGamingCore.Server.html
Normal file
@@ -0,0 +1,848 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
<li><a href="#Tables">Tables</a></li>
|
||||
<li><a href="#Fields">Fields</a></li>
|
||||
<li><a href="#Class_Thread">Class Thread </a></li>
|
||||
<li><a href="#modules_expgamingcore_server_src_commands_Functions">modules.expgamingcore.server.src.commands Functions</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><strong>ExpGamingCore.Server</strong></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>ExpGamingCore.Server</code></h1>
|
||||
<p>Adds a thread system and event listening and a admin bypass (recommend to disable /c and use optional /interface)</p>
|
||||
<p></p>
|
||||
<h3>Info:</h3>
|
||||
<ul>
|
||||
<li><strong>License</strong>: https://github.com/explosivegaming/scenario/blob/master/LICENSE</li>
|
||||
<li><strong>Author</strong>: Cooldude2606</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#new_thread">new_thread (obj)</a></td>
|
||||
<td class="summary">Generates a new thread object</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_thread">get_thread (mixed)</a></td>
|
||||
<td class="summary">Used to get a thread via uuid or name (if one is assied)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#queue_thread">queue_thread (thread_to_queue)</a></td>
|
||||
<td class="summary">Adds a thread into the resolve queue, can be used to lower lag</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#close_all_threads">close_all_threads (with_force)</a></td>
|
||||
<td class="summary">Closes all active threads, can use force if it causes errors</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#run_tick_threads">run_tick_threads ()</a></td>
|
||||
<td class="summary">Runs all the theads which have opened with an on_tick event</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#check_timeouts">check_timeouts ()</a></td>
|
||||
<td class="summary">Checks the timeout on all active timeout threads</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#_thread_debuger">_thread_debuger (player, event[, state=toggle])</a></td>
|
||||
<td class="summary">Used to print event info to a player</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#interface">interface (callback[, use_thread[, env[, ...]]])</a></td>
|
||||
<td class="summary">Acts as a bypass for running functions, can accept a string</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Tables">Tables</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#global">global</a></td>
|
||||
<td class="summary">Global Table</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Fields">Fields</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#uuid">uuid</a></td>
|
||||
<td class="summary">Used to generate a new uuid for the thread system</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#threads">threads</a></td>
|
||||
<td class="summary">Redirect to the thread index</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Class_Thread">Class Thread </a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Server._thread:create">Server._thread:create ([obj={}])</a></td>
|
||||
<td class="summary">Returns a new thread object</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Server._thread:queue">Server._thread:queue ()</a></td>
|
||||
<td class="summary">Opens and queses a thread</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Server._thread:valid">Server._thread:valid ([skip_location_check=false])</a></td>
|
||||
<td class="summary">Test if the thread has all requied parts</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Server._thread:open">Server._thread:open ()</a></td>
|
||||
<td class="summary">Opens the thread; indexs this thread in the global index</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Server._thread:close">Server._thread:close ()</a></td>
|
||||
<td class="summary">Inverse of thread:open() - Removes all indexs to this thread, most cases this will cause it to become inassible</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Server._thread:resolve">Server._thread:resolve ([...])</a></td>
|
||||
<td class="summary">Trigger the on_resolve function and closes the thread - error and success called based on result of pcall (useful for async)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Server._thread:check_timeout">Server._thread:check_timeout ()</a></td>
|
||||
<td class="summary">Checks the timeout on a thread - if timed out then it calles on_timeout and closes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Server._thread:error">Server._thread:error (err)</a></td>
|
||||
<td class="summary">Used to check and raise the error handler of the thread, if not present it raises an error</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Server._thread:on_event">Server._thread:on_event (event, callback)</a></td>
|
||||
<td class="summary">Set function to run then an event is triggered, none of them are 'needed' but you are advised to have atleast one</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#modules_expgamingcore_server_src_commands_Functions">modules.expgamingcore.server.src.commands Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#_comment">_comment ()</a></td>
|
||||
<td class="summary">This file will be loaded when ExpGamingCore.Command is present</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#interface">interface</a></td>
|
||||
<td class="summary">Runs the given input from the script</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "new_thread"></a>
|
||||
<strong>new_thread (obj)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Generates a new thread object
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">obj</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the atributes to give to the thread
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Server._thread</span></span>
|
||||
the new thread created
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Server.new_thread{name=<span class="string">'foo'</span>,data={}}</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_thread"></a>
|
||||
<strong>get_thread (mixed)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to get a thread via uuid or name (if one is assied)
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">mixed</span>
|
||||
either a uuid or the name given to a thread
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Server._thread</span></span>
|
||||
the thread by that name or uuid
|
||||
</ol>
|
||||
<h3>Or</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
if false is returned then no thread existes
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Server.get_thread(<span class="string">'decon'</span>) <span class="comment">-- return thread</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "queue_thread"></a>
|
||||
<strong>queue_thread (thread_to_queue)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Adds a thread into the resolve queue, can be used to lower lag
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">thread_to_queue</span>
|
||||
<span class="types"><span class="type">Server._thread</span></span>
|
||||
the thread to be added to the queue, must be open and have a on_resolve function
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
was it added successfuly
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Server.queue_thread(thread) <span class="comment">-- return true/false</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "close_all_threads"></a>
|
||||
<strong>close_all_threads (with_force)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Closes all active threads, can use force if it causes errors
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">with_force</span>
|
||||
<span class="types"><span class="type">bolean</span></span>
|
||||
use force when closing
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">Server.close_all_threads() <span class="comment">-- asks all threads to close</span></pre></li>
|
||||
<li><pre class="example">Server.close_all_threads(<span class="keyword">true</span>) <span class="comment">-- forcefuly close all threads</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "run_tick_threads"></a>
|
||||
<strong>run_tick_threads ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Runs all the theads which have opened with an on_tick event
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Server.run_tick_threads()</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "check_timeouts"></a>
|
||||
<strong>check_timeouts ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Checks the timeout on all active timeout threads
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Server.check_timeouts()</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "_thread_debuger"></a>
|
||||
<strong>_thread_debuger (player, event[, state=toggle])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to print event info to a player
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">player</span>
|
||||
<span class="types"><span class="type">name</span>, <span class="type">index</span> or <span class="type">LuaPlayer</span></span>
|
||||
the player that the info will be returned to
|
||||
</li>
|
||||
<li><span class="parameter">event</span>
|
||||
<span class="types"><span class="type">name</span> or <span class="type">index</span></span>
|
||||
the event that info will be returned fo
|
||||
</li>
|
||||
<li><span class="parameter">state</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
will info be returned, nil to toggle current state
|
||||
(<em>default</em> toggle)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Server._thread_debuger(<span class="string">'Cooldude2606'</span>,<span class="string">'on_player_died'</span>,<span class="keyword">true</span>) <span class="comment">-- will output event info to 'Cooldude2606' for 'on_player_died'</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "interface"></a>
|
||||
<strong>interface (callback[, use_thread[, env[, ...]]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Acts as a bypass for running functions, can accept a string
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a> or <span class="type">function</span></span>
|
||||
function to be ran
|
||||
</li>
|
||||
<li><span class="parameter">use_thread</span>
|
||||
<span class="types"><span class="type">Server._thread</span> or <span class="type">true</span></span>
|
||||
run the command on a premade thread or let it make its own
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
<li><span class="parameter">env</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
run the env to run the command in must have _env key as true to be
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
<li><span class="parameter">...</span>
|
||||
any args you want to pass to the function
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
if no thread then it will return a true for the success</li>
|
||||
<li>
|
||||
if no thread then it will return the value(s) returned by the callback</li>
|
||||
</ol>
|
||||
<h3>Or</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
if no thread then it will return a false for the success</li>
|
||||
<li>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
if no thread then it will return a an err value</li>
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">Server.interface(<span class="string">'local x = 1+1 print(x) return x'</span>) <span class="comment">-- return 2</span></pre></li>
|
||||
<li><pre class="example">Server.interface(<span class="string">'local x = 1+1 print(x)'</span>,<span class="keyword">true</span>) <span class="comment">-- will creat a thread to run as root (this is the bypass)</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "global"></a>
|
||||
<strong>global</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Global Table
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">all</span>
|
||||
a list of every thread (indexed by uuid)
|
||||
</li>
|
||||
<li><span class="parameter">queue</span>
|
||||
an index for threads which will be resolved (contains uuids)
|
||||
</li>
|
||||
<li><span class="parameter">tick</span>
|
||||
an index for threads which will run every tick (contains uuids)
|
||||
</li>
|
||||
<li><span class="parameter">timeout</span>
|
||||
an index for threads which will timeout (contains uuids)
|
||||
</li>
|
||||
<li><span class="parameter">events</span>
|
||||
an index of threads based on event ids (contains uuids)
|
||||
</li>
|
||||
<li><span class="parameter">paused</span>
|
||||
an index of pasued threads (contains uuids)
|
||||
</li>
|
||||
<li><span class="parameter">named</span>
|
||||
a name index for thread uuids
|
||||
</li>
|
||||
<li><span class="parameter">print_to</span>
|
||||
contains players that event details will be printed to
|
||||
</li>
|
||||
<li><span class="parameter">uuid</span>
|
||||
contains the random number generator for the uuid system
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "uuid"></a>
|
||||
<strong>uuid</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to generate a new uuid for the thread system
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example"><span class="keyword">local</span> uuid = <span class="global">tostring</span>(Server.uuid) <span class="comment">-- calling tostring locks the value</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "threads"></a>
|
||||
<strong>threads</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Redirect to the thread index
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">Server.threads <span class="comment">-- return #global.all</span></pre></li>
|
||||
<li><pre class="example">Server.threads <span class="comment">-- return global.all</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header has-description"><a name="Class_Thread"></a>Class Thread </h2>
|
||||
|
||||
<div class="section-description">
|
||||
The class for the server threads, allows abbilty to run async function
|
||||
</div>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "Server._thread:create"></a>
|
||||
<strong>Server._thread:create ([obj={}])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns a new thread object
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">obj</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
all values are opt {timeout=int,name=str,data=any}
|
||||
(<em>default</em> {})
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Server._thread</span></span>
|
||||
the new thread object
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">new_thread = thread:create()</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Server._thread:queue"></a>
|
||||
<strong>Server._thread:queue ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Opens and queses a thread
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
was the thread queued successfuly
|
||||
</ol>
|
||||
|
||||
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
<a href="../modules/ExpGamingCore.Server.html#queue_thread">Server.queue_thread</a>
|
||||
</ul>
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Server._thread:queue() <span class="comment">-- returns true/false</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Server._thread:valid"></a>
|
||||
<strong>Server._thread:valid ([skip_location_check=false])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Test if the thread has all requied parts
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">skip_location_check</span>
|
||||
<span class="types"><span class="type">bolean</span></span>
|
||||
true to skip the location checking
|
||||
(<em>default</em> false)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
is the thread valid
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example"><span class="keyword">if</span> thread:valid() <span class="keyword">then</span> <span class="keyword">end</span> <span class="comment">-- basic test for valid</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Server._thread:open"></a>
|
||||
<strong>Server._thread:open ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Opens the thread; indexs this thread in the global index
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">bolean</span></span>
|
||||
if the thread was opened successfuly
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">thread:open() <span class="comment">-- return true</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Server._thread:close"></a>
|
||||
<strong>Server._thread:close ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Inverse of thread:open() - Removes all indexs to this thread, most cases this will cause it to become inassible
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
if the thread had a on_close function
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">thread:close() <span class="comment">-- return true</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Server._thread:resolve"></a>
|
||||
<strong>Server._thread:resolve ([...])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Trigger the on_resolve function and closes the thread - error and success called based on result of pcall (useful for async)
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
any arguments you want to pass to the resolve function
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">bolean</span></span>
|
||||
true if the thread called on_success or on_error
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">thread:resolve(x,y,z) <span class="comment">-- return true</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Server._thread:check_timeout"></a>
|
||||
<strong>Server._thread:check_timeout ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Checks the timeout on a thread - if timed out then it calles on_timeout and closes
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">bolean</span></span>
|
||||
if the thread timed out
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">thread:check_timeout() <span class="comment">-- return true</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Server._thread:error"></a>
|
||||
<strong>Server._thread:error (err)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to check and raise the error handler of the thread, if not present it raises an error
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">err</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the err to be rasied
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
did the thread have an error handler
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">thread:<span class="global">error</span>(err) <span class="comment">-- return true</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Server._thread:on_event"></a>
|
||||
<strong>Server._thread:on_event (event, callback)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Set function to run then an event is triggered, none of them are 'needed' but you are advised to have atleast one
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">event</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a> or <span class="type">index</span></span>
|
||||
the name of the event that the function should be called on
|
||||
</li>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the function which is called by the event trigger
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
returns self so that they can be chained together
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">thread:on_event(<span class="string">'close'</span>,<span class="keyword">function</span>) <span class="comment">-- if event is not one below then a game event is used</span></pre></li>
|
||||
<li><pre class="example">thread_only_events = [<span class="string">'close'</span>,<span class="string">'timeout'</span>,<span class="string">'tick'</span>,<span class="string">'resolve'</span>,<span class="string">'success'</span>,<span class="string">'error'</span>]</pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="modules_expgamingcore_server_src_commands_Functions"></a>modules.expgamingcore.server.src.commands Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "_comment"></a>
|
||||
<strong>_comment ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
This file will be loaded when ExpGamingCore.Command is present
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "interface"></a>
|
||||
<strong>interface</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Runs the given input from the script
|
||||
|
||||
|
||||
<h3>param:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">code</span>
|
||||
The code that will be ran
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
820
doc/modules/ExpGamingCore.Sync.html
Normal file
820
doc/modules/ExpGamingCore.Sync.html
Normal file
@@ -0,0 +1,820 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
<li><a href="#Tables">Tables</a></li>
|
||||
<li><a href="#Fields">Fields</a></li>
|
||||
<li><a href="#modules_expgamingcore_sync_src_gui_Functions">modules.expgamingcore.sync.src.gui Functions</a></li>
|
||||
<li><a href="#modules_expgamingcore_sync_src_ranking_Functions">modules.expgamingcore.sync.src.ranking Functions</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><strong>ExpGamingCore.Sync</strong></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>ExpGamingCore.Sync</code></h1>
|
||||
<p>Allows syncing with an outside server and info panle.</p>
|
||||
<p></p>
|
||||
<h3>Info:</h3>
|
||||
<ul>
|
||||
<li><strong>License</strong>: https://github.com/explosivegaming/scenario/blob/master/LICENSE</li>
|
||||
<li><strong>Author</strong>: Cooldude2606</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#tick_format">tick_format (tick)</a></td>
|
||||
<td class="summary">Used to standidise the tick format for any sync info</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#print">print (player_message, player_name[, player_tag[, player_colour[, prefix]]])</a></td>
|
||||
<td class="summary">Prints to chat as if it were a player</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#emit_embedded">emit_embedded (args)</a></td>
|
||||
<td class="summary">Logs an embed to the json.data we use a js script to add things we cant here</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#count_admins">count_admins ()</a></td>
|
||||
<td class="summary">Used to get the number of admins currently online</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#count_afk">count_afk ([time=7200])</a></td>
|
||||
<td class="summary">Used to get the number of afk players defined by 2 min by default</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#count_ranks">count_ranks ()</a></td>
|
||||
<td class="summary">Used to get the number of players in each rank and currently online; if ExpGamingCore/Ranking is present then it will give more than admin and user</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#count_players">count_players (online)</a></td>
|
||||
<td class="summary">Used to get a list of every player name with the option to limit to only online players</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#count_player_times">count_player_times ()</a></td>
|
||||
<td class="summary">Used to get a list of every player name with the amount of time they have played for</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#update">update ()</a></td>
|
||||
<td class="summary">Called to update values inside of the info</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add_update">add_update (key, callback)</a></td>
|
||||
<td class="summary">Adds a callback to be called when the info is updated</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#emit_data">emit_data ()</a></td>
|
||||
<td class="summary">Outputs the curent server info into a file</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Tables">Tables</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#global">global</a></td>
|
||||
<td class="summary">Global Table</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#global.players">global.players</a></td>
|
||||
<td class="summary">Player sub-table</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#EmitEmbededParamaters">EmitEmbededParamaters</a></td>
|
||||
<td class="summary">Outline of the paramaters accepted by Sync.emit_embedded</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Fields">Fields</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#info">info</a></td>
|
||||
<td class="summary">used to get the global list that has been defined, also used to set that list</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#time">time</a></td>
|
||||
<td class="summary">Used to return and set the current IRL time; not very good need a better way to do this</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#modules_expgamingcore_sync_src_gui_Functions">modules.expgamingcore.sync.src.gui Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#_comment">_comment ()</a></td>
|
||||
<td class="summary">This file will be loaded when ExpGamingCore.Gui is present</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add_to_gui">add_to_gui (element)</a></td>
|
||||
<td class="summary">Adds a emeltent to the sever info gui</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#server-info">server-info</a></td>
|
||||
<td class="summary">Creates a center gui that will appear on join</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#modules_expgamingcore_sync_src_ranking_Functions">modules.expgamingcore.sync.src.ranking Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#_comment">_comment ()</a></td>
|
||||
<td class="summary">This file will be loaded when ExpGamingCore.Role is present</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set_ranks">set_ranks (...)</a></td>
|
||||
<td class="summary">Used as a redirect to Ranking._base_preset that will set the rank given to a player apon joining</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#count_ranks">count_ranks ()</a></td>
|
||||
<td class="summary">Used to get the number of players in each rank and currently online</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "tick_format"></a>
|
||||
<strong>tick_format (tick)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to standidise the tick format for any sync info
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tick</span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">{number,string}</span></span>
|
||||
table containg both the raw number and clean version of a time
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Sync.tick_format(<span class="number">60</span>) <span class="comment">-- return {60,'1.00M'}</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "print"></a>
|
||||
<strong>print (player_message, player_name[, player_tag[, player_colour[, prefix]]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Prints to chat as if it were a player
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">player_message</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the message to be printed in chat
|
||||
</li>
|
||||
<li><span class="parameter">player_name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the name of the player sending the message
|
||||
</li>
|
||||
<li><span class="parameter">player_tag</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the tag apllied to the player's name
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
<li><span class="parameter">player_colour</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the colour of the message, either hex or named colour
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
<li><span class="parameter">prefix</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
add a prefix before the chat eg [IRC]
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Sync.<span class="global">print</span>(<span class="string">'Test'</span>,<span class="string">'Cooldude2606'</span>)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "emit_embedded"></a>
|
||||
<strong>emit_embedded (args)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Logs an embed to the json.data we use a js script to add things we cant here
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">args</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
a table which contains everything that the embedded will use
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
<a href="../modules/ExpGamingCore.Sync.html#EmitEmbededParamaters">EmitEmbededParamaters</a>
|
||||
</ul>
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Sync.emit_embedded{title=<span class="string">'BAN'</span>,color=<span class="string">'0x0'</span>,description=<span class="string">'A player was banned'</span> ... }</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "count_admins"></a>
|
||||
<strong>count_admins ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to get the number of admins currently online
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
the number of admins online
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Sync.count_admins() <span class="comment">-- returns number</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "count_afk"></a>
|
||||
<strong>count_afk ([time=7200])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to get the number of afk players defined by 2 min by default
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">time</span>
|
||||
<span class="types"><span class="type">int</span></span>
|
||||
in ticks that a player is called afk
|
||||
(<em>default</em> 7200)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
the number of afk players
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Sync.count_afk()</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "count_ranks"></a>
|
||||
<strong>count_ranks ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to get the number of players in each rank and currently online; if ExpGamingCore/Ranking is present then it will give more than admin and user
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
contains the ranks and the players in that rank
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Sync.count_ranks()</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "count_players"></a>
|
||||
<strong>count_players (online)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to get a list of every player name with the option to limit to only online players
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">online</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true will get only the online players
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
table of player names
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Sync.count_players()</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "count_player_times"></a>
|
||||
<strong>count_player_times ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to get a list of every player name with the amount of time they have played for
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
table indexed by player name, each value contains the raw tick and then the clean string
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Sync.count_player_times()</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "update"></a>
|
||||
<strong>update ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Called to update values inside of the info
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
all of the new info
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Sync.update()</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "add_update"></a>
|
||||
<strong>add_update (key, callback)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Adds a callback to be called when the info is updated
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">key</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the key that the value will be stored in
|
||||
</li>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the function which will return this value
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Sync.add_update(<span class="string">'players'</span>,<span class="keyword">function</span>() <span class="keyword">return</span> #game.players <span class="keyword">end</span>)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "emit_data"></a>
|
||||
<strong>emit_data ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Outputs the curent server info into a file
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Sync.emit_data()</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "global"></a>
|
||||
<strong>global</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Global Table
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">server_name</span>
|
||||
the server name
|
||||
</li>
|
||||
<li><span class="parameter">server_description</span>
|
||||
a short description of the server
|
||||
</li>
|
||||
<li><span class="parameter">reset_time</span>
|
||||
the reset time of the server
|
||||
</li>
|
||||
<li><span class="parameter">time</span>
|
||||
the last knowen irl time
|
||||
</li>
|
||||
<li><span class="parameter">time_set</span>
|
||||
the last in game time that the time was set
|
||||
</li>
|
||||
<li><span class="parameter">last_update</span>
|
||||
the last time that this info was updated
|
||||
</li>
|
||||
<li><span class="parameter">time_period</span>
|
||||
how often this infomation is updated
|
||||
</li>
|
||||
<li><span class="parameter">players</span>
|
||||
a list of different player related states
|
||||
</li>
|
||||
<li><span class="parameter">ranks</span>
|
||||
a list of player ranks
|
||||
</li>
|
||||
<li><span class="parameter">rockets</span>
|
||||
the number of rockets launched
|
||||
</li>
|
||||
<li><span class="parameter">mods</span>
|
||||
the mods which are loaded
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "global.players"></a>
|
||||
<strong>global.players</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Player sub-table
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">online</span>
|
||||
list of all players online
|
||||
</li>
|
||||
<li><span class="parameter">n_online</span>
|
||||
the number of players online
|
||||
</li>
|
||||
<li><span class="parameter">all</span>
|
||||
list of all player on or offline
|
||||
</li>
|
||||
<li><span class="parameter">n_all</span>
|
||||
the number of players who have joined the server
|
||||
</li>
|
||||
<li><span class="parameter">admins_online</span>
|
||||
the number of admins online
|
||||
</li>
|
||||
<li><span class="parameter">afk_players</span>
|
||||
the number of afk players
|
||||
</li>
|
||||
<li><span class="parameter">times</span>
|
||||
the play times of every player
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "EmitEmbededParamaters"></a>
|
||||
<strong>EmitEmbededParamaters</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Outline of the paramaters accepted by Sync.emit_embedded
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">title</span>
|
||||
the tile of the embed
|
||||
</li>
|
||||
<li><span class="parameter">color</span>
|
||||
the color given in hex you can use Color.to_hex{r=0,g=0,b=0}
|
||||
</li>
|
||||
<li><span class="parameter">description</span>
|
||||
the description of the embed
|
||||
</li>
|
||||
<li><span class="parameter">server_detail</span>
|
||||
sting to add onto the pre-set server detail
|
||||
</li>
|
||||
<li><span class="parameter">fieldone</span>
|
||||
the filed to add to the embed (key is name) (value is text) (start value with <<inline>> to make inline)
|
||||
</li>
|
||||
<li><span class="parameter">fieldtwo</span>
|
||||
the filed to add to the embed (key is name) (value is text) (start value with <<inline>> to make inline)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "info"></a>
|
||||
<strong>info</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
used to get the global list that has been defined, also used to set that list
|
||||
|
||||
|
||||
<ul>
|
||||
<li><span class="parameter">set</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
keys to be replaced in the server info
|
||||
(<em>default</em> nil)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">Sync.info{server_name=<span class="string">'Factorio Server 2'</span>} <span class="comment">-- returns true</span></pre></li>
|
||||
<li><pre class="example">Sync.info <span class="comment">-- table of info</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "time"></a>
|
||||
<strong>time</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to return and set the current IRL time; not very good need a better way to do this
|
||||
|
||||
|
||||
<ul>
|
||||
<li><span class="parameter">set</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the date time to be set
|
||||
(<em>default</em> nil)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">Sync.time(<span class="string">'Sun Apr 1 18:44:30 UTC 2018'</span>)</pre></li>
|
||||
<li><pre class="example">Sync.time <span class="comment">-- string</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="modules_expgamingcore_sync_src_gui_Functions"></a>modules.expgamingcore.sync.src.gui Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "_comment"></a>
|
||||
<strong>_comment ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
This file will be loaded when ExpGamingCore.Gui is present
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "add_to_gui"></a>
|
||||
<strong>add_to_gui (element)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Adds a emeltent to the sever info gui
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">element</span>
|
||||
see examples before for what can be used, it can also be a return from Gui.inputs.add
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">bolean</span></span>
|
||||
based on weather it was successful or not
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Sync.add_to_gui(<span class="string">'string'</span>) <span class="comment">-- return true</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "server-info"></a>
|
||||
<strong>server-info</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Creates a center gui that will appear on join
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="modules_expgamingcore_sync_src_ranking_Functions"></a>modules.expgamingcore.sync.src.ranking Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "_comment"></a>
|
||||
<strong>_comment ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
This file will be loaded when ExpGamingCore.Role is present
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "set_ranks"></a>
|
||||
<strong>set_ranks (...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used as a redirect to Ranking._base_preset that will set the rank given to a player apon joining
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">...</span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Sync.set_ranks{player_name=rank_name,...}</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "count_ranks"></a>
|
||||
<strong>count_ranks ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to get the number of players in each rank and currently online
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
contains the ranks and the players in that rank
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Sync.count_ranks()</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
672
doc/modules/ExpGamingLib.html
Normal file
672
doc/modules/ExpGamingLib.html
Normal file
@@ -0,0 +1,672 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
<li><a href="#Class_table">Class table </a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><strong>ExpGamingLib</strong></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>ExpGamingLib</code></h1>
|
||||
<p>Adds some common functions used though out all ExpGaming modules</p>
|
||||
<p></p>
|
||||
<h3>Info:</h3>
|
||||
<ul>
|
||||
<li><strong>License</strong>: https://github.com/explosivegaming/scenario/blob/master/LICENSE</li>
|
||||
<li><strong>Author</strong>: Cooldude2606</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#unpack_to_G">unpack_to_G (tbl)</a></td>
|
||||
<td class="summary">Loads a table into _G even when sandboxed; will not overwrite values or append to tables; will not work during runtime to avoid desyncs</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_env">get_env ()</a></td>
|
||||
<td class="summary">Used to get the current ENV with all _G keys removed; useful when saving function to global</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#add_metatable">add_metatable (tbl[, callback=tostring[, string=table.tostring]])</a></td>
|
||||
<td class="summary">Creats a table that will act like a string and a function</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#is_type">is_type (v[, test_type=nil])</a></td>
|
||||
<td class="summary">Compear types faster for faster valadation of prams</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#player_return">player_return (rtn[, colour=defines.colour.white[, player=game.player]])</a></td>
|
||||
<td class="summary">Will return a value of any type to the player/server console, allows colour for in-game players</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#tick_to_hour">tick_to_hour (tick)</a></td>
|
||||
<td class="summary">Convert ticks to hours</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#tick_to_min">tick_to_min (tick)</a></td>
|
||||
<td class="summary">Convert ticks to minutes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#tick_to_display_format">tick_to_display_format (tick)</a></td>
|
||||
<td class="summary">Converts a tick into a clean format for end user</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#gui_tree">gui_tree (root)</a></td>
|
||||
<td class="summary">Used as a way to view the structure of a gui, used for debuging</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Class_table">Class table </a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#table.val_to_str">table.val_to_str (v)</a></td>
|
||||
<td class="summary">Returns a value in a form able to be read as a value, any value to string</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#table.key_to_str">table.key_to_str (k)</a></td>
|
||||
<td class="summary">Returns a value in a form able to be read as a key, any key to string</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#table.tostring">table.tostring (tbl)</a></td>
|
||||
<td class="summary">Returns a table in a form able to be read as a table</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#table.json">table.json (lua_table)</a></td>
|
||||
<td class="summary">Simmilar to table.tostring but converts a lua table to a json one</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#table.autokey">table.autokey (tbl, str)</a></td>
|
||||
<td class="summary">Returns the closest match to a key</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#table.alphanumsort">table.alphanumsort (tbl)</a></td>
|
||||
<td class="summary">Returns the list is a sorted way that would be expected by people (this is by key)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#table.keysort">table.keysort (tbl)</a></td>
|
||||
<td class="summary">Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above)</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "unpack_to_G"></a>
|
||||
<strong>unpack_to_G (tbl)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Loads a table into _G even when sandboxed; will not overwrite values or append to tables; will not work during runtime to avoid desyncs
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="../modules/ExpGamingLib.html#table">table</a></span>
|
||||
table to be unpacked
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">unpack_to_G{key1=<span class="string">'foo'</span>,key2=<span class="string">'bar'</span>}</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_env"></a>
|
||||
<strong>get_env ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to get the current ENV with all _G keys removed; useful when saving function to global
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/ExpGamingLib.html#table">table</a></span>
|
||||
the env table with _G keys removed
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">get_env() returns current ENV with _G keys removed</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "add_metatable"></a>
|
||||
<strong>add_metatable (tbl[, callback=tostring[, string=table.tostring]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Creats a table that will act like a string and a function
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="../modules/ExpGamingLib.html#table">table</a></span>
|
||||
the table that will have its metatable set
|
||||
</li>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the function that will be used for the call
|
||||
(<em>default</em> tostring)
|
||||
</li>
|
||||
<li><span class="parameter">string</span>
|
||||
<span class="types"><span class="type">function</span> or <a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
a function that resolves to a string or a string
|
||||
(<em>default</em> table.tostring)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/ExpGamingLib.html#table">table</a></span>
|
||||
the new table with its metatable set
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">add_metatable({},<span class="keyword">function</span>) <span class="comment">-- returns table</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "is_type"></a>
|
||||
<strong>is_type (v[, test_type=nil])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Compear types faster for faster valadation of prams
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">v</span>
|
||||
the value to be tested
|
||||
</li>
|
||||
<li><span class="parameter">test_type</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the type to test for if not given then it tests for nil
|
||||
(<em>default</em> nil)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">bolean</span></span>
|
||||
is v of type test_type
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">is_type(<span class="string">'foo'</span>,<span class="string">'string'</span>) <span class="comment">-- return true</span></pre></li>
|
||||
<li><pre class="example">is_type(<span class="string">'foo'</span>) <span class="comment">-- return false</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "player_return"></a>
|
||||
<strong>player_return (rtn[, colour=defines.colour.white[, player=game.player]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Will return a value of any type to the player/server console, allows colour for in-game players
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">rtn</span>
|
||||
any value of any type that will be returned to the player or console
|
||||
</li>
|
||||
<li><span class="parameter">colour</span>
|
||||
<span class="types"><span class="type">defines.color</span> or <a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the colour of the text for the player, ingroned when printing to console
|
||||
(<em>default</em> defines.colour.white)
|
||||
</li>
|
||||
<li><span class="parameter">player</span>
|
||||
<span class="types"><span class="type">LuaPlayer</span></span>
|
||||
the player that return will go to, if no game.player then returns to server
|
||||
(<em>default</em> game.player)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">player_return(<span class="string">'Hello, World!'</span>) <span class="comment">-- returns 'Hello, World!' to game.player or server console</span></pre></li>
|
||||
<li><pre class="example">player_return(<span class="string">'Hello, World!'</span>,<span class="string">'green'</span>) <span class="comment">-- returns 'Hello, World!' to game.player with colour green or server console</span></pre></li>
|
||||
<li><pre class="example">player_return(<span class="string">'Hello, World!'</span>,<span class="keyword">nil</span>,player) <span class="comment">-- returns 'Hello, World!' to the given player</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "tick_to_hour"></a>
|
||||
<strong>tick_to_hour (tick)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Convert ticks to hours
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tick</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
tick to convert to hours
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
the number of whole hours from this tick
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">tick_to_hour(<span class="number">216001</span>) <span class="comment">-- return 1</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "tick_to_min"></a>
|
||||
<strong>tick_to_min (tick)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Convert ticks to minutes
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tick</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
tick to convert to minutes
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
the number of whole minutes from this tick
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">tick_to_hour(<span class="number">3601</span>) <span class="comment">-- return 1</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "tick_to_display_format"></a>
|
||||
<strong>tick_to_display_format (tick)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Converts a tick into a clean format for end user
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tick</span>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
the tick to convert
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the formated string
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">tick_to_display_format(<span class="number">3600</span>) <span class="comment">-- return '1.00 M'</span></pre></li>
|
||||
<li><pre class="example">tick_to_display_format(<span class="number">234000</span>) <span class="comment">-- return '1 H 5 M'</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "gui_tree"></a>
|
||||
<strong>gui_tree (root)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used as a way to view the structure of a gui, used for debuging
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">root</span>
|
||||
<span class="types"><span class="type">LuaGuiElement</span></span>
|
||||
the root to start the tree from
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/ExpGamingLib.html#table">table</a></span>
|
||||
the table that describes the gui
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Gui_tree(root) returns all children of gui recusivly</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header has-description"><a name="Class_table"></a>Class table </h2>
|
||||
|
||||
<div class="section-description">
|
||||
Extents the table class
|
||||
</div>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "table.val_to_str"></a>
|
||||
<strong>table.val_to_str (v)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns a value in a form able to be read as a value, any value to string
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">v</span>
|
||||
value to convert
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the converted value
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example"><span class="global">table</span>.val_to_str{a=<span class="string">'foo'</span>} <span class="comment">-- return '"foo"'</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "table.key_to_str"></a>
|
||||
<strong>table.key_to_str (k)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns a value in a form able to be read as a key, any key to string
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">k</span>
|
||||
key to convert
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the converted key
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example"><span class="global">table</span>.val_to_str{a=<span class="string">'foo'</span>} <span class="comment">-- return '["a"]'</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "table.tostring"></a>
|
||||
<strong>table.tostring (tbl)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns a table in a form able to be read as a table
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="../modules/ExpGamingLib.html#table">table</a></span>
|
||||
table to convert
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the converted table
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example"><span class="global">table</span>.<span class="global">tostring</span>{k1=<span class="string">'foo'</span>,k2=<span class="string">'bar'</span>} <span class="comment">-- return '{["k1"]="foo",["k2"]="bar"}'</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "table.json"></a>
|
||||
<strong>table.json (lua_table)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Simmilar to table.tostring but converts a lua table to a json one
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">lua_table</span>
|
||||
<span class="types"><a class="type" href="../modules/ExpGamingLib.html#table">table</a></span>
|
||||
the table to convert
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the table in a json format
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">talbe.json{k1=<span class="string">'foo'</span>,k2=<span class="string">'bar'</span>} <span class="comment">-- return '{"k1":"foo","k2":"bar"}'</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "table.autokey"></a>
|
||||
<strong>table.autokey (tbl, str)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns the closest match to a key
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="../modules/ExpGamingLib.html#table">table</a></span>
|
||||
the table that will be searched
|
||||
</li>
|
||||
<li><span class="parameter">str</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the string that will be looked for in the keys
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example"><span class="global">table</span>.autokey({foo=<span class="number">1</span>,bar=<span class="number">2</span>},<span class="string">'f'</span>) <span class="comment">-- return 1</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "table.alphanumsort"></a>
|
||||
<strong>table.alphanumsort (tbl)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns the list is a sorted way that would be expected by people (this is by key)
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="../modules/ExpGamingLib.html#table">table</a></span>
|
||||
the table to be sorted
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/ExpGamingLib.html#table">table</a></span>
|
||||
the sorted table
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">tbl = <span class="global">table</span>.alphanumsort(tbl)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "table.keysort"></a>
|
||||
<strong>table.keysort (tbl)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above)
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="../modules/ExpGamingLib.html#table">table</a></span>
|
||||
the table to be sorted
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../modules/ExpGamingLib.html#table">table</a></span>
|
||||
the sorted table
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">tbl = <span class="global">table</span>.alphanumsort(tbl)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
455
doc/modules/FSM.html
Normal file
455
doc/modules/FSM.html
Normal file
@@ -0,0 +1,455 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
<li><a href="#Tables">Tables</a></li>
|
||||
<li><a href="#Fields">Fields</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><strong>FSM</strong></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>FSM</code></h1>
|
||||
<p>Factorio Softmod Manager</p>
|
||||
<p></p>
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Manager = require("FactorioSoftmodManager")
|
||||
</pre>
|
||||
</ul>
|
||||
<h3>Info:</h3>
|
||||
<ul>
|
||||
<li><strong>Author</strong>: Cooldude2606</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#_verbose">_verbose (rtn)</a></td>
|
||||
<td class="summary">Default output for the verbose</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#verbose">verbose (rtn, action)</a></td>
|
||||
<td class="summary">Used to call the output of the verbose when the current state allows it</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#setVerbose">setVerbose (settings)</a></td>
|
||||
<td class="summary">Main logic for allowing verbose at different stages though out the script</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#sandbox">sandbox (callback[, env])</a></td>
|
||||
<td class="summary">Creates a sand box envorment and runs a callback in that sand box; provents global pollution</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#loadModules">loadModules ()</a></td>
|
||||
<td class="summary">Loads the modules that are present in the index list</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#error">error (err, callback)</a></td>
|
||||
<td class="summary">A more detailed replacement for the lua error function to allow for handlers to be added; repleaces default error so error can be used instead of Manager.error</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#event">event (event_name, callback)</a></td>
|
||||
<td class="summary">Event handler that modules can use, each module can register one function per event</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Tables">Tables</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#verboseSettings">verboseSettings</a></td>
|
||||
<td class="summary">Different verbose settings used for setVerbose</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Manager.event.names">Manager.event.names</a></td>
|
||||
<td class="summary">Sub set to Manger.event and acts as a coverter between event_name and event_id</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Fields">Fields</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#global">global</a></td>
|
||||
<td class="summary">Used to avoid conflicts in the global table</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "_verbose"></a>
|
||||
<strong>_verbose (rtn)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Default output for the verbose
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">rtn</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the value that will be returned though verbose output
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Manager.verbose(<span class="string">'Hello, World!'</span>)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "verbose"></a>
|
||||
<strong>verbose (rtn, action)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to call the output of the verbose when the current state allows it
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">rtn</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the value that will be returned though verbose output
|
||||
</li>
|
||||
<li><span class="parameter">action</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
is used to decide which verbose this is error || event etc
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Manager.verbose(<span class="string">'Hello, World!'</span>)</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "setVerbose"></a>
|
||||
<strong>setVerbose (settings)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Main logic for allowing verbose at different stages though out the script
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">settings</span>
|
||||
<span class="types"><span class="type">newTbl</span></span>
|
||||
the table that will be searched for settings to be updated
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">Manager.setVerbose{output=log}</pre></li>
|
||||
<li><pre class="example">Manager.setVerbose[setting] <span class="comment">-- returns the value of that setting</span></pre></li>
|
||||
<li><pre class="example"><span class="global">tostring</span>(Manager.setVerbose) <span class="comment">-- returns a formated list of the current settings</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "sandbox"></a>
|
||||
<strong>sandbox (callback[, env])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Creates a sand box envorment and runs a callback in that sand box; provents global pollution
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the function that will be ran in the sandbox
|
||||
</li>
|
||||
<li><span class="parameter">env</span>
|
||||
any other params that the function will use
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">Manager.sandbox(callback) <span class="comment">-- return sandbox, success, other returns from callback</span></pre></li>
|
||||
<li><pre class="example">Manager.sandbox() <span class="comment">-- returns and empty sandbox</span></pre></li>
|
||||
<li><pre class="example">Manager.sandbox[key] <span class="comment">-- returns the sand box value in that key</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "loadModules"></a>
|
||||
<strong>loadModules ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Loads the modules that are present in the index list
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">Manager.loadModules() <span class="comment">-- loads all moddules in the index list</span></pre></li>
|
||||
<li><pre class="example">#Manager.loadModules <span class="comment">-- returns the number of modules loaded</span></pre></li>
|
||||
<li><pre class="example"><span class="global">tostring</span>(Manager.loadModules) <span class="comment">-- returns a formatted list of all modules loaded</span></pre></li>
|
||||
<li><pre class="example"><span class="global">pairs</span>(Manager.loadModules) <span class="comment">-- loops over the loaded modules moduleName, module</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "error"></a>
|
||||
<strong>error (err, callback)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
A more detailed replacement for the lua error function to allow for handlers to be added; repleaces default error so error can be used instead of Manager.error
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">err</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a> or <span class="type">fucntion</span></span>
|
||||
the string to be passed to handlers; if a function it will register a handler
|
||||
</li>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
if given the err param will be used to given the handler a name
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">Manager.<span class="global">error</span>(err) <span class="comment">-- calls all error handlers that are set or if none then prints to game and if that fails crashs game</span></pre></li>
|
||||
<li><pre class="example">Manager.<span class="global">error</span>() <span class="comment">-- returns an error constant that can be used to crash game</span></pre></li>
|
||||
<li><pre class="example">Manager.<span class="global">error</span>(Manager.<span class="global">error</span>()) <span class="comment">-- crashs the game</span></pre></li>
|
||||
<li><pre class="example">Manager.<span class="global">error</span>.addHandler(name,callback) <span class="comment">-- adds a new handler if handler returns Manager.error() then game will crash</span></pre></li>
|
||||
<li><pre class="example">Manager.<span class="global">error</span>[name] <span class="comment">-- returns the handler of that name if present</span></pre></li>
|
||||
<li><pre class="example">#Manager.<span class="global">error</span> <span class="comment">-- returns the number of error handlers that are present</span></pre></li>
|
||||
<li><pre class="example"><span class="global">pairs</span>(Manager.<span class="global">error</span>) <span class="comment">-- loops over only the error handlers handler_name,hander</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "event"></a>
|
||||
<strong>event (event_name, callback)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Event handler that modules can use, each module can register one function per event
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">event_name</span>
|
||||
<span class="types"><span class="type">int</span> or <a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
that referes to an event
|
||||
</li>
|
||||
<li><span class="parameter">callback</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the function that will be set for that event
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">Manager.event[event_name] = callback <span class="comment">-- sets the callback for that event</span></pre></li>
|
||||
<li><pre class="example">Manager.event[event_name] = <span class="keyword">nil</span> <span class="comment">-- clears the callback for that event</span></pre></li>
|
||||
<li><pre class="example">Manager.event(event_name,callback) <span class="comment">-- sets the callback for that event</span></pre></li>
|
||||
<li><pre class="example">Manager.event[event_name] <span class="comment">-- returns the callback for that event or the event id if not registered</span></pre></li>
|
||||
<li><pre class="example">Manager.event(event_name) <span class="comment">-- runs all the call backs for that event</span></pre></li>
|
||||
<li><pre class="example">Manager.event() <span class="comment">-- returns the stop value for the event proccessor, if returned during an event will stop all other callbacks</span></pre></li>
|
||||
<li><pre class="example">#Manager.event <span class="comment">-- returns the number of callbacks that are registered</span></pre></li>
|
||||
<li><pre class="example"><span class="global">pairs</span>(Manager.events) <span class="comment">-- returns event_id,table of callbacks</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "verboseSettings"></a>
|
||||
<strong>verboseSettings</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Different verbose settings used for setVerbose
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">selfInit</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
called while the manager is being set up
|
||||
</li>
|
||||
<li><span class="parameter">moduleLoad</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
when a module is required by the manager
|
||||
</li>
|
||||
<li><span class="parameter">moduleInit</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
when and within the initation of a module
|
||||
</li>
|
||||
<li><span class="parameter">moduleEnv</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
during module runtime, this is a global option set within each module(module_verbose=true ln:1) for fine control
|
||||
</li>
|
||||
<li><span class="parameter">eventRegistered</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
when a module registers its event handlers
|
||||
</li>
|
||||
<li><span class="parameter">errorCaught</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
when an error is caught during runtime
|
||||
</li>
|
||||
<li><span class="parameter">output</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
can be: print || log || or other function
|
||||
</li>
|
||||
<li><span class="parameter">_output</span>
|
||||
a constant value that can used to store output data
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Manager.event.names"></a>
|
||||
<strong>Manager.event.names</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Sub set to Manger.event and acts as a coverter between event_name and event_id
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Manager.event[event_name]</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "global"></a>
|
||||
<strong>global</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Used to avoid conflicts in the global table
|
||||
|
||||
|
||||
<ul>
|
||||
<li><span class="parameter">if</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a>, <a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a> or <span class="type">true</span></span>
|
||||
table then the default for the global, if a string then the module to get the global of, if true then reset the global to default
|
||||
(<em>default</em> {})
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">global[key] <span class="comment">-- used like the normal global table</span></pre></li>
|
||||
<li><pre class="example">global{<span class="string">'foo'</span>,<span class="string">'bar'</span>} <span class="comment">-- sets the default value</span></pre></li>
|
||||
<li><pre class="example">global(<span class="keyword">true</span>) <span class="comment">-- restores global to default</span></pre></li>
|
||||
<li><pre class="example">global(mopdule_name) <span class="comment">-- returns that module's global</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
561
doc/modules/StdLib.Color.html
Normal file
561
doc/modules/StdLib.Color.html
Normal file
@@ -0,0 +1,561 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
<li><a href="#Tables">Tables</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><strong>StdLib.Color</strong></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>StdLib.Color</code></h1>
|
||||
<p>A defines module for retrieving colors by name.</p>
|
||||
<p>
|
||||
Extends the Factorio defines table.</p>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#set">set ([color=white[, alpha=1]])</a></td>
|
||||
<td class="summary">Set a value for the alpha channel in the given color table.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#to_table">to_table (c_arr)</a></td>
|
||||
<td class="summary">Converts a color in the array format to a color in the table format.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#from_rgb">from_rgb ([r=0[, g=0[, b=0[, a=255]]]])</a></td>
|
||||
<td class="summary">Converts a color in the rgb format to a color table</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#from_hex">from_hex (hex[, alpha=1])</a></td>
|
||||
<td class="summary">Get a color table with a hexadecimal string.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#to_rgb">to_rgb (color)</a></td>
|
||||
<td class="summary">Converts a color in the color table format to rgb</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#to_hex">to_hex (color)</a></td>
|
||||
<td class="summary">Converts a color in the color table format to hex</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Tables">Tables</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#defines.color">defines.color</a></td>
|
||||
<td class="summary">A table of colors allowing retrieval by color name.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#defines.anticolor">defines.anticolor</a></td>
|
||||
<td class="summary">Returns white for dark colors or black for lighter colors.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#defines.lightcolor">defines.lightcolor</a></td>
|
||||
<td class="summary">Returns a lighter color of a named color</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#defines.textcolor">defines.textcolor</a></td>
|
||||
<td class="summary">Returns a lighter color of a named color.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "set"></a>
|
||||
<strong>set ([color=white[, alpha=1]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Set a value for the alpha channel in the given color table.
|
||||
`color.a` represents the alpha channel in the given color table.
|
||||
<ul>
|
||||
<li>If ***alpha*** is given, set `color.a` to it.
|
||||
<li>If ***alpha*** is not given, and if the given color table does not have a value for `color.a`, set `color.a` to 1.
|
||||
<li>If ***alpha*** is not given, and if the given color table already has a value for `color.a`, then leave `color.a` alone.
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">color</span>
|
||||
<span class="types"><a class="type" href="../modules/StdLib.Color.html#defines.color">defines.color</a> or <span class="type">Concepts.Color</span></span>
|
||||
the color to configure
|
||||
(<em>default</em> white)
|
||||
</li>
|
||||
<li><span class="parameter">alpha</span>
|
||||
<span class="types"><span class="type">float</span></span>
|
||||
the alpha value (*[0 - 1]*) to set for the given color
|
||||
(<em>default</em> 1)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">a</span></span>
|
||||
color table that has the specified value for the alpha channel
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "to_table"></a>
|
||||
<strong>to_table (c_arr)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Converts a color in the array format to a color in the table format.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">c_arr</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the color to convert
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">a</span></span>
|
||||
converted color — { r = c\_arr[1], g = c\_arr[2], b = c\_arr[3], a = c\_arr[4] }
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "from_rgb"></a>
|
||||
<strong>from_rgb ([r=0[, g=0[, b=0[, a=255]]]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Converts a color in the rgb format to a color table
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">r</span>
|
||||
<span class="types"><span class="type">int</span></span>
|
||||
0-255 red
|
||||
(<em>default</em> 0)
|
||||
</li>
|
||||
<li><span class="parameter">g</span>
|
||||
<span class="types"><span class="type">int</span></span>
|
||||
0-255 green
|
||||
(<em>default</em> 0)
|
||||
</li>
|
||||
<li><span class="parameter">b</span>
|
||||
<span class="types"><span class="type">int</span></span>
|
||||
0-255 blue
|
||||
(<em>default</em> 0)
|
||||
</li>
|
||||
<li><span class="parameter">a</span>
|
||||
<span class="types"><span class="type">int</span></span>
|
||||
0-255 alpha
|
||||
(<em>default</em> 255)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Concepts.Color</span></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "from_hex"></a>
|
||||
<strong>from_hex (hex[, alpha=1])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get a color table with a hexadecimal string.
|
||||
Optionally provide the value for the alpha channel.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">hex</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
hexadecimal color string (#ffffff, not #fff)
|
||||
</li>
|
||||
<li><span class="parameter">alpha</span>
|
||||
<span class="types"><span class="type">float</span></span>
|
||||
the alpha value to set; such that ***[ 0 ⋜ value ⋜ 1 ]***
|
||||
(<em>default</em> 1)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">a</span></span>
|
||||
color table with RGB converted from Hex and with alpha
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "to_rgb"></a>
|
||||
<strong>to_rgb (color)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Converts a color in the color table format to rgb
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">color</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the color to convert
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the color as rgb
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "to_hex"></a>
|
||||
<strong>to_hex (color)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Converts a color in the color table format to hex
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">color</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the color to convert
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the color as hex
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "defines.color"></a>
|
||||
<strong>defines.color</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
A table of colors allowing retrieval by color name.
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">white</span>
|
||||
{r=1.00,g=1.00,b=1.00}
|
||||
</li>
|
||||
<li><span class="parameter">black</span>
|
||||
{r=0.00,g=0.00,b=0.00}
|
||||
</li>
|
||||
<li><span class="parameter">darkgrey</span>
|
||||
{r=0.25,g=0.25,b=0.25}
|
||||
</li>
|
||||
<li><span class="parameter">grey</span>
|
||||
{r=0.50,g=0.50,b=0.50}
|
||||
</li>
|
||||
<li><span class="parameter">lightgrey</span>
|
||||
{r=0.75,g=0.75,b=0.75}
|
||||
</li>
|
||||
<li><span class="parameter">red</span>
|
||||
{r=1.00,g=0.00,b=0.00}
|
||||
</li>
|
||||
<li><span class="parameter">darkred</span>
|
||||
{r=0.50,g=0.00,b=0.00}
|
||||
</li>
|
||||
<li><span class="parameter">lightred</span>
|
||||
{r=1.00,g=0.50,b=0.50}
|
||||
</li>
|
||||
<li><span class="parameter">green</span>
|
||||
{r=0.00,g=1.00,b=0.00}
|
||||
</li>
|
||||
<li><span class="parameter">darkgreen</span>
|
||||
{r=0.00,g=0.50,b=0.00}
|
||||
</li>
|
||||
<li><span class="parameter">lightgreen</span>
|
||||
{r=0.50,g=1.00,b=0.50}
|
||||
</li>
|
||||
<li><span class="parameter">blue</span>
|
||||
{r=0.00,g=0.00,b=1.00}
|
||||
</li>
|
||||
<li><span class="parameter">darkblue</span>
|
||||
{r=0.00,g=0.00,b=0.50}
|
||||
</li>
|
||||
<li><span class="parameter">lightblue</span>
|
||||
{r=0.50,g=0.50,b=1.00}
|
||||
</li>
|
||||
<li><span class="parameter">orange</span>
|
||||
{r=1.00,g=0.55,b=0.10}
|
||||
</li>
|
||||
<li><span class="parameter">yellow</span>
|
||||
{r=1.00,g=1.00,b=0.00}
|
||||
</li>
|
||||
<li><span class="parameter">pink</span>
|
||||
{r=1.00,g=0.00,b=1.00}
|
||||
</li>
|
||||
<li><span class="parameter">purple</span>
|
||||
{r=0.60,g=0.10,b=0.60}
|
||||
</li>
|
||||
<li><span class="parameter">brown</span>
|
||||
{r=0.60,g=0.40,b=0.10}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "defines.anticolor"></a>
|
||||
<strong>defines.anticolor</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns white for dark colors or black for lighter colors.
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">green</span>
|
||||
defines.color.black
|
||||
</li>
|
||||
<li><span class="parameter">grey</span>
|
||||
defines.color.black
|
||||
</li>
|
||||
<li><span class="parameter">lightblue</span>
|
||||
defines.color.black
|
||||
</li>
|
||||
<li><span class="parameter">lightgreen</span>
|
||||
defines.color.black
|
||||
</li>
|
||||
<li><span class="parameter">lightgrey</span>
|
||||
defines.color.black
|
||||
</li>
|
||||
<li><span class="parameter">lightred</span>
|
||||
defines.color.black
|
||||
</li>
|
||||
<li><span class="parameter">orange</span>
|
||||
defines.color.black
|
||||
</li>
|
||||
<li><span class="parameter">white</span>
|
||||
defines.color.black
|
||||
</li>
|
||||
<li><span class="parameter">yellow</span>
|
||||
defines.color.black
|
||||
</li>
|
||||
<li><span class="parameter">black</span>
|
||||
defines.color.white
|
||||
</li>
|
||||
<li><span class="parameter">blue</span>
|
||||
defines.color.white
|
||||
</li>
|
||||
<li><span class="parameter">brown</span>
|
||||
defines.color.white
|
||||
</li>
|
||||
<li><span class="parameter">darkblue</span>
|
||||
defines.color.white
|
||||
</li>
|
||||
<li><span class="parameter">darkgreen</span>
|
||||
defines.color.white
|
||||
</li>
|
||||
<li><span class="parameter">darkgrey</span>
|
||||
defines.color.white
|
||||
</li>
|
||||
<li><span class="parameter">darkred</span>
|
||||
defines.color.white
|
||||
</li>
|
||||
<li><span class="parameter">pink</span>
|
||||
defines.color.white
|
||||
</li>
|
||||
<li><span class="parameter">purple</span>
|
||||
defines.color.white
|
||||
</li>
|
||||
<li><span class="parameter">red</span>
|
||||
defines.color.white
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "defines.lightcolor"></a>
|
||||
<strong>defines.lightcolor</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns a lighter color of a named color
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">white</span>
|
||||
defines.color.lightgrey
|
||||
</li>
|
||||
<li><span class="parameter">grey</span>
|
||||
defines.color.darkgrey
|
||||
</li>
|
||||
<li><span class="parameter">lightgrey</span>
|
||||
defines.color.grey
|
||||
</li>
|
||||
<li><span class="parameter">red</span>
|
||||
defines.color.lightred
|
||||
</li>
|
||||
<li><span class="parameter">green</span>
|
||||
defines.color.lightgreen
|
||||
</li>
|
||||
<li><span class="parameter">blue</span>
|
||||
defines.color.lightblue
|
||||
</li>
|
||||
<li><span class="parameter">yellow</span>
|
||||
defines.color.orange
|
||||
</li>
|
||||
<li><span class="parameter">pink</span>
|
||||
defines.color.purple
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "defines.textcolor"></a>
|
||||
<strong>defines.textcolor</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns a lighter color of a named color.
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">info</span>
|
||||
{r=0.21,g=0.95,b=1.00}
|
||||
</li>
|
||||
<li><span class="parameter">bg</span>
|
||||
{r=0.00,g=0.00,b=0.00}
|
||||
</li>
|
||||
<li><span class="parameter">low</span>
|
||||
{r=0.18,g=0.77,b=0.18}
|
||||
</li>
|
||||
<li><span class="parameter">med</span>
|
||||
{r=1.00,g=0.89,b=0.26}
|
||||
</li>
|
||||
<li><span class="parameter">high</span>
|
||||
{r=1.00,g=0.33,b=0.00}
|
||||
</li>
|
||||
<li><span class="parameter">crit</span>
|
||||
{r=1.00,g=0.00,b=0.00}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
222
doc/modules/StdLib.Game.html
Normal file
222
doc/modules/StdLib.Game.html
Normal file
@@ -0,0 +1,222 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><strong>StdLib.Game</strong></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>StdLib.Game</code></h1>
|
||||
<p>The game module.</p>
|
||||
<p></p>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#fail_if_missing">fail_if_missing (var[, msg="missing value"])</a></td>
|
||||
<td class="summary">Print msg if specified var evaluates to false.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_player">get_player (mixed)</a></td>
|
||||
<td class="summary">Return a valid player object from event, index, string, or userdata</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#get_force">get_force (mixed)</a></td>
|
||||
<td class="summary">Return a valid force object from event, string, or userdata</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#print_all">print_all (msg[, condition])</a></td>
|
||||
<td class="summary">Messages all players currently connected to the game.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "fail_if_missing"></a>
|
||||
<strong>fail_if_missing (var[, msg="missing value"])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Print msg if specified var evaluates to false.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">var</span>
|
||||
<span class="types"><span class="type">Mixed</span></span>
|
||||
variable to evaluate
|
||||
</li>
|
||||
<li><span class="parameter">msg</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
message
|
||||
(<em>default</em> "missing value")
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_player"></a>
|
||||
<strong>get_player (mixed)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Return a valid player object from event, index, string, or userdata
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">mixed</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a>, <span class="type">number</span>, <span class="type">LuaPlayer</span> or <span class="type">event</span></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">LuaPlayer</span></span>
|
||||
a valid player or nil
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "get_force"></a>
|
||||
<strong>get_force (mixed)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Return a valid force object from event, string, or userdata
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">mixed</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a>, <span class="type">LuaForce</span> or <span class="type">event</span></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">LuaForce</span></span>
|
||||
a valid force or nil
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "print_all"></a>
|
||||
<strong>print_all (msg[, condition])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Messages all players currently connected to the game.
|
||||
> Offline players are not counted as having received the message.
|
||||
If no players exist msg is stored in the `global._print_queue` table.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">msg</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the message to send to players
|
||||
</li>
|
||||
<li><span class="parameter">condition</span>
|
||||
<span class="types"><span class="type">nil</span> or <span class="type">boolean</span></span>
|
||||
the condition to be true for a player to be messaged
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">uint</span></span>
|
||||
the number of players who received the message.
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
302
doc/modules/StdLib.String.html
Normal file
302
doc/modules/StdLib.String.html
Normal file
@@ -0,0 +1,302 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><strong>StdLib.String</strong></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>StdLib.String</code></h1>
|
||||
<p>Extends Lua 5.2 string.</p>
|
||||
<p></p>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#trim">trim (s)</a></td>
|
||||
<td class="summary">Returns a copy of the string with any leading or trailing whitespace from the string removed.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#starts_with">starts_with (s, start)</a></td>
|
||||
<td class="summary">Tests if a string starts with a given substring.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#ends_with">ends_with (s, ends)</a></td>
|
||||
<td class="summary">Tests if a string ends with a given substring.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#contains">contains (s, contains)</a></td>
|
||||
<td class="summary">Tests if a string contains a given substring.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#is_empty">is_empty (s)</a></td>
|
||||
<td class="summary">Tests whether a string is empty.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#split">split (s[, sep="."[, pattern=false]])</a></td>
|
||||
<td class="summary">Splits a string into an array.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "trim"></a>
|
||||
<strong>trim (s)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns a copy of the string with any leading or trailing whitespace from the string removed.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">s</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the string to remove leading or trailing whitespace from
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
a copy of the string without leading or trailing whitespace
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "starts_with"></a>
|
||||
<strong>starts_with (s, start)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Tests if a string starts with a given substring.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">s</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the string to check for the start substring
|
||||
</li>
|
||||
<li><span class="parameter">start</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the substring to test for
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if the start substring was found in the string
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "ends_with"></a>
|
||||
<strong>ends_with (s, ends)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Tests if a string ends with a given substring.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">s</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the string to check for the end substring
|
||||
</li>
|
||||
<li><span class="parameter">ends</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the substring to test for
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if the end substring was found in the string
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "contains"></a>
|
||||
<strong>contains (s, contains)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Tests if a string contains a given substring.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">s</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the string to check for the substring
|
||||
</li>
|
||||
<li><span class="parameter">contains</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the substring to test for
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if the substring was found in the string
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "is_empty"></a>
|
||||
<strong>is_empty (s)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Tests whether a string is empty.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">s</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the string to test
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if the string is empty
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "split"></a>
|
||||
<strong>split (s[, sep="."[, pattern=false]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Splits a string into an array.
|
||||
*Note:* Empty split substrings are not included in the resulting table.
|
||||
<p>For example, `string.split("foo.bar...", ".", false)` results in the table `{"foo", "bar"}`.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">s</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the string to split
|
||||
</li>
|
||||
<li><span class="parameter">sep</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
|
||||
the separator to use.
|
||||
(<em>default</em> ".")
|
||||
</li>
|
||||
<li><span class="parameter">pattern</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
whether to interpret the separator as a lua pattern or plaintext for the string split
|
||||
(<em>default</em> false)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">{string,...}</a></span>
|
||||
an array of strings
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
922
doc/modules/StdLib.Table.html
Normal file
922
doc/modules/StdLib.Table.html
Normal file
@@ -0,0 +1,922 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><strong>StdLib.Table</strong></li>
|
||||
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>StdLib.Table</code></h1>
|
||||
<p>Extends Lua 5.2 table.</p>
|
||||
<p></p>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#map">map (tbl, func[, ...])</a></td>
|
||||
<td class="summary">Given a mapping function, creates a transformed copy of the table
|
||||
by calling the function for each element in the table, and using
|
||||
the result as the new value for the key.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#filter">filter (tbl, func[, ...])</a></td>
|
||||
<td class="summary">Given a filter function, creates a filtered copy of the table
|
||||
by calling the function for each element in the table, and
|
||||
filtering out any key-value pairs for non-true results.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#find">find (tbl, func[, ...])</a></td>
|
||||
<td class="summary">Given a candidate search function, iterates over the table, calling the function
|
||||
for each element in the table, and returns the first element the search function returned true.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#any">any (tbl, func[, ...])</a></td>
|
||||
<td class="summary">Given a candidate search function, iterates over the table, calling the function
|
||||
for each element in the table, and returns true if search function returned true.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#each">each (tbl, func[, ...])</a></td>
|
||||
<td class="summary">Given a function, apply it to each element in the table.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#flatten">flatten (tbl[, level])</a></td>
|
||||
<td class="summary">Returns a new array that is a one-dimensional recursive flattening of the given array.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#first">first (tbl)</a></td>
|
||||
<td class="summary">Given an array, returns the first element or nil if no element exists.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#last">last (tbl)</a></td>
|
||||
<td class="summary">Given an array, returns the last element or nil if no elements exist.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#min">min (tbl)</a></td>
|
||||
<td class="summary">Given an array of only numeric values, returns the minimum or nil if no element exists.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#max">max (tbl)</a></td>
|
||||
<td class="summary">Given an array of only numeric values, returns the maximum or nil if no element exists.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#sum">sum (tbl)</a></td>
|
||||
<td class="summary">Given an array of only numeric values, return the sum of all values, or 0 for empty arrays.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#avg">avg (tbl)</a></td>
|
||||
<td class="summary">Given an array of only numeric values, returns the average or nil if no element exists.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#merge">merge (tblA, tblB[, array_merge=false])</a></td>
|
||||
<td class="summary">Merges two tables — values from first get overwritten by the second.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#deepcopy">deepcopy (object)</a></td>
|
||||
<td class="summary">Creates a deep copy of table without copying Factorio objects.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#values">values (tbl[, sorted[, as_string]])</a></td>
|
||||
<td class="summary">Returns a copy of all of the values in the table.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#keys">keys (tbl[, sorted[, as_string]])</a></td>
|
||||
<td class="summary">Returns a copy of all of the keys in the table.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#remove_keys">remove_keys (tbl, keys)</a></td>
|
||||
<td class="summary">Removes keys from a table by setting the values associated with the keys to nil.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#count_keys">count_keys (tbl[, func[, ...]])</a></td>
|
||||
<td class="summary">Returns the number of keys in a table, if func is passed only count keys when the function is true.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#invert">invert (tbl)</a></td>
|
||||
<td class="summary">Returns an inverted (***{[value] = key,...}***) copy of the given table.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#size">size (table)</a></td>
|
||||
<td class="summary">Return the size of a table using built in table_size function</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#arr_to_bool">arr_to_bool (tbl)</a></td>
|
||||
<td class="summary">For all string or number values in an array map them to a key = true table</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "map"></a>
|
||||
<strong>map (tbl, func[, ...])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Given a mapping function, creates a transformed copy of the table
|
||||
by calling the function for each element in the table, and using
|
||||
the result as the new value for the key. Passes the index as second argument to the function.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the table to be mapped to the transform
|
||||
</li>
|
||||
<li><span class="parameter">func</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the function to transform values
|
||||
</li>
|
||||
<li><span class="parameter">...</span>
|
||||
additional arguments passed to the function
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
a new table containing the keys and mapped values
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">a= { <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>}
|
||||
<span class="global">table</span>.map(a, <span class="keyword">function</span>(v) <span class="keyword">return</span> v * <span class="number">10</span> <span class="keyword">end</span>) <span class="comment">--produces: { 10, 20, 30, 40, 50 }</span></pre></li>
|
||||
<li><pre class="example">a = {<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>}
|
||||
<span class="global">table</span>.map(a, <span class="keyword">function</span>(v, k, x) <span class="keyword">return</span> v * k + x <span class="keyword">end</span>, <span class="number">100</span>) <span class="comment">--produces { 101, 104, 109, 116, 125}</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "filter"></a>
|
||||
<strong>filter (tbl, func[, ...])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Given a filter function, creates a filtered copy of the table
|
||||
by calling the function for each element in the table, and
|
||||
filtering out any key-value pairs for non-true results. Passes the index as second argument to the function.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the table to be filtered
|
||||
</li>
|
||||
<li><span class="parameter">func</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the function to filter values
|
||||
</li>
|
||||
<li><span class="parameter">...</span>
|
||||
additional arguments passed to the function
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
a new table containing the filtered key-value pairs
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">a= { <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>}
|
||||
<span class="global">table</span>.filter(a, <span class="keyword">function</span>(v) <span class="keyword">return</span> v % <span class="number">2</span> == <span class="number">0</span> <span class="keyword">end</span>) <span class="comment">--produces: { 2, 4 }</span></pre></li>
|
||||
<li><pre class="example">a = {<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>}
|
||||
<span class="global">table</span>.filter(a, <span class="keyword">function</span>(v, k, x) <span class="keyword">return</span> k % <span class="number">2</span> == <span class="number">1</span> <span class="keyword">end</span>) <span class="comment">--produces: { 1, 3, 5 }</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "find"></a>
|
||||
<strong>find (tbl, func[, ...])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Given a candidate search function, iterates over the table, calling the function
|
||||
for each element in the table, and returns the first element the search function returned true.
|
||||
Passes the index as second argument to the function.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the table to be searched
|
||||
</li>
|
||||
<li><span class="parameter">func</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the function to use to search for any matching element
|
||||
</li>
|
||||
<li><span class="parameter">...</span>
|
||||
additional arguments passed to the function
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">nil</span> or <span class="type">Mixed</span></span>
|
||||
the first found value, or nil if none was found
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">a= { <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>}
|
||||
<span class="global">table</span>.find(a, <span class="keyword">function</span>(v) <span class="keyword">return</span> v % <span class="number">2</span> == <span class="number">0</span> <span class="keyword">end</span>) <span class="comment">--produces: 2</span></pre></li>
|
||||
<li><pre class="example">a = {<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>}
|
||||
<span class="global">table</span>.find(a, <span class="keyword">function</span>(v, k, x) <span class="keyword">return</span> k % <span class="number">2</span> == <span class="number">1</span> <span class="keyword">end</span>) <span class="comment">--produces: 1</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "any"></a>
|
||||
<strong>any (tbl, func[, ...])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Given a candidate search function, iterates over the table, calling the function
|
||||
for each element in the table, and returns true if search function returned true.
|
||||
Passes the index as second argument to the function.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the table to be searched
|
||||
</li>
|
||||
<li><span class="parameter">func</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the function to use to search for any matching element
|
||||
</li>
|
||||
<li><span class="parameter">...</span>
|
||||
additional arguments passed to the function
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if an element was found, false if none was found
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example">a= { <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>} <span class="global">table</span>.any(a, <span class="keyword">function</span>(v) <span class="keyword">return</span> v % <span class="number">2</span> == <span class="number">0</span> <span class="keyword">end</span>) <span class="comment">--produces: true</span></pre></li>
|
||||
<li><pre class="example">a = {<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>} <span class="global">table</span>.any(a, <span class="keyword">function</span>(v, k, x) <span class="keyword">return</span> k % <span class="number">2</span> == <span class="number">1</span> <span class="keyword">end</span>) <span class="comment">--produces: true</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "each"></a>
|
||||
<strong>each (tbl, func[, ...])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Given a function, apply it to each element in the table.
|
||||
Passes the index as the second argument to the function.
|
||||
<p>Iteration is aborted if the applied function returns true for any element during iteration.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the table to be iterated
|
||||
</li>
|
||||
<li><span class="parameter">func</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
the function to apply to elements
|
||||
</li>
|
||||
<li><span class="parameter">...</span>
|
||||
additional arguments passed to the function
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the table where the given function has been applied to its elements
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">a = {<span class="number">10</span>, <span class="number">20</span>, <span class="number">30</span>, <span class="number">40</span>}
|
||||
<span class="global">table</span>.each(a, <span class="keyword">function</span>(v) game.<span class="global">print</span>(v) <span class="keyword">end</span>) <span class="comment">--prints 10, 20, 30, 40, 50</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "flatten"></a>
|
||||
<strong>flatten (tbl[, level])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns a new array that is a one-dimensional recursive flattening of the given array.
|
||||
For every element that is an array, extract its elements into the new array.
|
||||
<p>The optional level argument determines the level of recursion to flatten.
|
||||
> This function flattens an integer-indexed array, but not an associative array.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><span class="type">array</span></span>
|
||||
the array to be flattened
|
||||
</li>
|
||||
<li><span class="parameter">level</span>
|
||||
<span class="types"><span class="type">uint</span></span>
|
||||
recursive levels, or no limit to recursion if not supplied
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">array</span></span>
|
||||
a new array that represents the flattened contents of the given array
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "first"></a>
|
||||
<strong>first (tbl)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Given an array, returns the first element or nil if no element exists.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><span class="type">array</span></span>
|
||||
the array
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">nil</span> or <span class="type">Mixed</span></span>
|
||||
the first element
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "last"></a>
|
||||
<strong>last (tbl)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Given an array, returns the last element or nil if no elements exist.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><span class="type">array</span></span>
|
||||
the array
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">nil</span> or <span class="type">Mixed</span></span>
|
||||
the last element or nil
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "min"></a>
|
||||
<strong>min (tbl)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Given an array of only numeric values, returns the minimum or nil if no element exists.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><span class="type">{number,...}</span></span>
|
||||
the array with only numeric values
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">nil</span> or <span class="type">number</span></span>
|
||||
the minimum value
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "max"></a>
|
||||
<strong>max (tbl)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Given an array of only numeric values, returns the maximum or nil if no element exists.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><span class="type">{number,...}</span></span>
|
||||
the array with only numeric values
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">nil</span> or <span class="type">number</span></span>
|
||||
the maximum value
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "sum"></a>
|
||||
<strong>sum (tbl)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Given an array of only numeric values, return the sum of all values, or 0 for empty arrays.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><span class="type">{number,...}</span></span>
|
||||
the array with only numeric values
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
the sum of the numbers or zero if the given array was empty
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "avg"></a>
|
||||
<strong>avg (tbl)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Given an array of only numeric values, returns the average or nil if no element exists.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><span class="type">{number,...}</span></span>
|
||||
the array with only numeric values
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">nil</span> or <span class="type">number</span></span>
|
||||
the average value
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "merge"></a>
|
||||
<strong>merge (tblA, tblB[, array_merge=false])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Merges two tables — values from first get overwritten by the second.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tblA</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
first table
|
||||
</li>
|
||||
<li><span class="parameter">tblB</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
second table
|
||||
</li>
|
||||
<li><span class="parameter">array_merge</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
set to true to merge the tables as an array or false for an associative array
|
||||
(<em>default</em> false)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">array</span> or <a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
an array or an associated array where tblA and tblB have been merged
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example"><span class="keyword">function</span> some_func(x, y, args)
|
||||
args = <span class="global">table</span>.merge({option1=<span class="keyword">false</span>}, args)
|
||||
<span class="keyword">if</span> opts.option1 == <span class="keyword">true</span> <span class="keyword">then</span> <span class="keyword">return</span> x <span class="keyword">else</span> <span class="keyword">return</span> y <span class="keyword">end</span>
|
||||
<span class="keyword">end</span>
|
||||
some_func(<span class="number">1</span>,<span class="number">2</span>) <span class="comment">-- returns 2
|
||||
</span>some_func(<span class="number">1</span>,<span class="number">2</span>,{option1=<span class="keyword">true</span>}) <span class="comment">-- returns 1</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "deepcopy"></a>
|
||||
<strong>deepcopy (object)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Creates a deep copy of table without copying Factorio objects.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">object</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the table to copy
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
a copy of the table
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example"><span class="keyword">local</span> copy = <span class="global">table</span>.deepcopy[data.raw.[<span class="string">"stone-furnace"</span>][<span class="string">"stone-furnace"</span>]] <span class="comment">-- returns a copy of the stone furnace entity</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "values"></a>
|
||||
<strong>values (tbl[, sorted[, as_string]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns a copy of all of the values in the table.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the table to copy the keys from, or an empty table if tbl is nil
|
||||
</li>
|
||||
<li><span class="parameter">sorted</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
whether to sort the keys (slower) or keep the random order from pairs()
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
<li><span class="parameter">as_string</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
whether to try and parse the values as strings, or leave them as their existing type
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">array</span></span>
|
||||
an array with a copy of all the values in the table
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "keys"></a>
|
||||
<strong>keys (tbl[, sorted[, as_string]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns a copy of all of the keys in the table.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the table to copy the keys from, or an empty table if tbl is nil
|
||||
</li>
|
||||
<li><span class="parameter">sorted</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
whether to sort the keys (slower) or keep the random order from pairs()
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
<li><span class="parameter">as_string</span>
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
whether to try and parse the keys as strings, or leave them as their existing type
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">array</span></span>
|
||||
an array with a copy of all the keys in the table
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "remove_keys"></a>
|
||||
<strong>remove_keys (tbl, keys)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Removes keys from a table by setting the values associated with the keys to nil.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the table to remove the keys from
|
||||
</li>
|
||||
<li><span class="parameter">keys</span>
|
||||
<span class="types"><span class="type">{Mixed,...}</span></span>
|
||||
an array of keys that exist in the given table
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
tbl without the specified keys
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example"><span class="keyword">local</span> a = {<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>}
|
||||
<span class="global">table</span>.remove_keys(a, {<span class="number">1</span>,<span class="number">3</span>}) <span class="comment">--returns {nil, 2, nil, 4}</span></pre></li>
|
||||
<li><pre class="example"><span class="keyword">local</span> b = {k1 = <span class="number">1</span>, k2 = <span class="string">'foo'</span>, old_key = <span class="string">'bar'</span>}
|
||||
<span class="global">table</span>.remove_keys(b, {<span class="string">'old_key'</span>}) <span class="comment">--returns {k1 = 1, k2 = 'foo'}</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "count_keys"></a>
|
||||
<strong>count_keys (tbl[, func[, ...]])</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns the number of keys in a table, if func is passed only count keys when the function is true.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
to count keys
|
||||
</li>
|
||||
<li><span class="parameter">func</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
to incremement counter
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
<li><span class="parameter">...</span>
|
||||
additional arguments passed to the function
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The number of keys matching the function or the number of all keys if func isn't passed</li>
|
||||
<li>
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The total number of keys</li>
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example"><span class="keyword">local</span> a = { <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>}
|
||||
<span class="global">table</span>.count_keys(a) <span class="comment">-- produces: 5, 5</span></pre></li>
|
||||
<li><pre class="example"><span class="keyword">local</span> a = {<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>}
|
||||
<span class="global">table</span>.count_keys(a, <span class="keyword">function</span>(v, k) <span class="keyword">return</span> k % <span class="number">2</span> == <span class="number">1</span> <span class="keyword">end</span>) <span class="comment">-- produces: 3, 5</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "invert"></a>
|
||||
<strong>invert (tbl)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns an inverted (***{[value] = key,...}***) copy of the given table. If the values are not unique, the assigned key depends on the order of pairs().
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the table to invert
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
a new table with inverted mapping
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<li><pre class="example"><span class="keyword">local</span> a = {k1 = <span class="string">'foo'</span>, k2 = <span class="string">'bar'</span>}
|
||||
<span class="global">table</span>.invert(a) <span class="comment">--returns {'foo' = k1, 'bar' = k2}</span></pre></li>
|
||||
<li><pre class="example"><span class="keyword">local</span> b = {k1 = <span class="string">'foo'</span>, k2 = <span class="string">'bar'</span>, k3 = <span class="string">'bar'</span>}
|
||||
<span class="global">table</span>.invert(b) <span class="comment">--returns {'foo' = k1, 'bar' = ?}</span></pre></li>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "size"></a>
|
||||
<strong>size (table)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Return the size of a table using built in table_size function
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">table</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
to use
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">int</span></span>
|
||||
size of the table
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "arr_to_bool"></a>
|
||||
<strong>arr_to_bool (tbl)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
For all string or number values in an array map them to a key = true table
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">tbl</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the table to convert
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
the converted table
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example"><span class="keyword">local</span> a = {<span class="string">"v1"</span>, <span class="string">"v2"</span>}
|
||||
<span class="global">table</span>.array_to_dict_bool(a) <span class="comment">-- return {["v1"] = true, ["v2"]= true}</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
139
doc/modules/StdLib.Time.html
Normal file
139
doc/modules/StdLib.Time.html
Normal file
@@ -0,0 +1,139 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Tables">Tables</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Command.html">ExpGamingCore.Command</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.html">ExpGamingCore.Gui</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Center.html">ExpGamingCore.Gui.Center</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Inputs.html">ExpGamingCore.Gui.Inputs</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Left.html">ExpGamingCore.Gui.Left</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Popup.html">ExpGamingCore.Gui.Popup</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Test.html">ExpGamingCore.Gui.Test</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Gui.Toolbar.html">ExpGamingCore.Gui.Toolbar</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Role.html">ExpGamingCore.Role</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
|
||||
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
|
||||
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
|
||||
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
|
||||
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
|
||||
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
|
||||
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
|
||||
<li><strong>StdLib.Time</strong></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>StdLib.Time</code></h1>
|
||||
<p>A defines module for retrieving the number of ticks in 1 unit of time.</p>
|
||||
<p>
|
||||
Extends the Factorio defines table.</p>
|
||||
|
||||
|
||||
<h2><a href="#Tables">Tables</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#defines.time">defines.time</a></td>
|
||||
<td class="summary">Returns the number of ticks in a second, minute, hour, day, week, month, or year.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "defines.time"></a>
|
||||
<strong>defines.time</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Returns the number of ticks in a second, minute, hour, day, week, month, or year.
|
||||
|
||||
|
||||
<h3>Fields:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">second</span>
|
||||
the number of Factorio ticks in a second
|
||||
</li>
|
||||
<li><span class="parameter">minute</span>
|
||||
the number of Factorio ticks in a second
|
||||
</li>
|
||||
<li><span class="parameter">hour</span>
|
||||
the number of Factorio ticks in an hour
|
||||
</li>
|
||||
<li><span class="parameter">day</span>
|
||||
the number of Factorio ticks in an day
|
||||
</li>
|
||||
<li><span class="parameter">week</span>
|
||||
the number of Factorio ticks in a week
|
||||
</li>
|
||||
<li><span class="parameter">month</span>
|
||||
the number of Factorio ticks in a month (30 days)
|
||||
</li>
|
||||
<li><span class="parameter">year</span>
|
||||
the number of Factorio ticks in a year (365 days)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example"><span class="keyword">local</span> ten_seconds = defines.time.second * <span class="number">10</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-06-07 12:58:23 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
3
locale/de/DeconControl.cfg
Normal file
3
locale/de/DeconControl.cfg
Normal file
@@ -0,0 +1,3 @@
|
||||
[DeconControl]
|
||||
player-print=Du darfst dies noch nicht entfernen. Du benötigst dazu den Rang Regular, den du nach 3 Stunden auf dem Server automatisch erhältst.
|
||||
rank-print=__1__ versuchte etwas zu entfernen.
|
||||
15
locale/de/ExpGamingAdmin.AdminLib.cfg
Normal file
15
locale/de/ExpGamingAdmin.AdminLib.cfg
Normal file
@@ -0,0 +1,15 @@
|
||||
[ExpGamingAdmin]
|
||||
name=Admin-Befehle
|
||||
tooltip=Die mächtigsten Befehle sind hier zuhause.
|
||||
no-info-file=Die Informationsdatei wurde nicht gefunden.
|
||||
message=Wähle einen Spieler und eine Aktion. Stell vor dem Ausführen sicher, dass der Richtige ist!
|
||||
warning=Achtung, dieser Spieler hat einen höheren Rang als du selbst, weshalb du seinen Rang nicht ändern kannst.
|
||||
short-reason=Achtung, dies ist ein sehr kurzer Grund. Bitte versuche, mehr Informationen anzugeben. (Warning: The reason is too short. UPDATE)
|
||||
rank-high=Dieser Spieler hat einen hohen Rang. Bitte benutze nur Ingame-Befehle gegen diese Person, wenn du dir sicher bist!
|
||||
invalid=Der Spieler oder die Aktion war ungültig. Bitte versuche es noch einmal!
|
||||
take-action= Ergreife Maßnahme
|
||||
tooltip-ban=Banne Spieler
|
||||
tooltip-kick=Kicke Spieler
|
||||
tooltip-jail=Sperre Spieler ins Gefängnis
|
||||
tooltip-go-to=Gehe zum Spieler
|
||||
tooltip-bring=Bringe den Spieler zu dir
|
||||
11
locale/de/ExpGamingAdmin.Warnings.cfg
Normal file
11
locale/de/ExpGamingAdmin.Warnings.cfg
Normal file
@@ -0,0 +1,11 @@
|
||||
[ExpGamingAdmin-Warnings]
|
||||
warning-given-by=This Warnings Was Given By: __1__
|
||||
player-warning=__1__ was given a warning by __2__ reason: __3__
|
||||
temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset
|
||||
remove-warn=You are had a warning Removed, you have __1__ warnings, next removed in __2__
|
||||
message=You Are Currently Reciving Warnings From The Script, This Will Continue Unless You Cease And Desist
|
||||
reported=You Have Been Reported To The Admins By The Script, Further Acction May Be Taken If You Do Not Cease And Desist.
|
||||
kick-warn=You Are On A Warning To Be KICKED, The Script Will Auto Kick If You Do Not Cease And Desist.
|
||||
temp-warn=You Are On A Warning To Be TEMP BANNED, The Script Will Auto Ban If You Do Not Cease And Desist.
|
||||
ban-warn=You Are On A Warning To Be BANNED, The Script Will Auto Ban If You Do Not Cease And Desist.
|
||||
last-warn=YOU ARE ON A LAST WARNING TO BE BANNED, THE SCRIPT WILL AUTO BAN IF YOU DO NOT CEASE AND DESIST.
|
||||
15
locale/de/ExpGamingAdmin.cfg
Normal file
15
locale/de/ExpGamingAdmin.cfg
Normal file
@@ -0,0 +1,15 @@
|
||||
[ExpGamingAdmin]
|
||||
name=Admin-Befehle
|
||||
tooltip=Die mächtigsten Befehle sind hier zuhause.
|
||||
no-info-file=Die Informationsdatei wurde nicht gefunden.
|
||||
message=Wähle einen Spieler und eine Aktion. Stell vor dem Ausführen sicher, dass der Richtige ist!
|
||||
warning=Achtung, dieser Spieler hat einen höheren Rang als du selbst, weshalb du seinen Rang nicht ändern kannst.
|
||||
short-reason=Achtung, dies ist ein sehr kurzer Grund. Bitte versuche, mehr Informationen anzugeben. (Warning: The reason is too short. UPDATE)
|
||||
rank-high=Dieser Spieler hat einen hohen Rang. Bitte benutze nur Ingame-Befehle gegen diese Person, wenn du dir sicher bist!
|
||||
invalid=Der Spieler oder die Aktion war ungültig. Bitte versuche es noch einmal!
|
||||
take-action= Ergreife Maßnahme
|
||||
tooltip-ban=Banne Spieler
|
||||
tooltip-kick=Kicke Spieler
|
||||
tooltip-jail=Sperre Spieler ins Gefängnis
|
||||
tooltip-go-to=Gehe zum Spieler
|
||||
tooltip-bring=Bringe den Spieler zu dir
|
||||
20
locale/de/ExpGamingBot.autoChat.cfg
Normal file
20
locale/de/ExpGamingBot.autoChat.cfg
Normal file
@@ -0,0 +1,20 @@
|
||||
[ExpGamingBot-autoChat]
|
||||
message=[Chat Bot]: __1__
|
||||
rank-error=You cant use global chat commands
|
||||
players-online=There are __1__ players online
|
||||
players=There have been __1__ players on this map
|
||||
map-time=This map has been on for __1__
|
||||
line-8=Type /help <command> for more info
|
||||
join-us=Please join us on:
|
||||
discord=Discord: https://discord.explosivegaming.nl
|
||||
website=Website: explosivegaming.nl
|
||||
custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info.
|
||||
read-readme=Make sure you have read the Readme (can be found through the question mark on the top left)
|
||||
not-real-dev=Cooldude2606 is a dev for this server and makes the softmod (look top left) and is not a factorio dev.
|
||||
softmod=A softmod is a custom scenario that runs on this server, example is the player list.
|
||||
blame=Blame __1__ for what just happend!
|
||||
afk=Your afk? Look at __1__ they have been afk for: __2__
|
||||
links=To see links open the readme and click links.
|
||||
magic=Fear the admin magic (ノ゚∀゚)ノ⌒・*:.。. .。.:*・゜゚・*☆
|
||||
aids=≖ ‿ ≖ Fear the aids of a public server ≖ ‿ ≖
|
||||
riot=(admins) ┬┴┬┴┤ᵒ_ᵒ)├┬┴┬┴ ‹ ‹\(´ω` )/››‹‹\ ( ´)/››‹‹\ ( ´ω`)/›› (rest of server)
|
||||
9
locale/de/ExpGamingBot.autoMessage.cfg
Normal file
9
locale/de/ExpGamingBot.autoMessage.cfg
Normal file
@@ -0,0 +1,9 @@
|
||||
[ExpGamingBot-autoMessage]
|
||||
message=[Chat Bot]: __1__
|
||||
players-online=There are __1__ players online
|
||||
map-time=This map has been on for __1__
|
||||
join-us=Please join us on:
|
||||
discord=Discord: https://discord.explosivegaming.nl
|
||||
website=Website: explosivegaming.nl
|
||||
custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info.
|
||||
read-readme=Make sure you have read the Readme (can be found through the question mark on the top left)
|
||||
9
locale/de/ExpGamingCore.Command.cfg
Normal file
9
locale/de/ExpGamingCore.Command.cfg
Normal file
@@ -0,0 +1,9 @@
|
||||
[ExpGamingCore_Command]
|
||||
unauthorized=401 - Unbefugt: Zugang verweigert. Du hast keinen Zugriff auf diese Befehle!
|
||||
invalid-inputs=ungültige Eingabe, /__1__ __2__
|
||||
invalid-range=ungültige Reichweite, Min: __1__, Max: __2__
|
||||
invalid-length=ungültige Länge, Max: __1__
|
||||
invalid-player=ungültiger Spieler Name, __1__ , Versuche "Tab" zu benutzen, damit sich der Name automatisch vervollständigt.
|
||||
offline-player=Der betroffene Spieler ist offline, Befehl konnte nicht ausgeführt werden.
|
||||
dead-player=Der betroffene Spieler ist Tod, Befehl konnte nicht ausgeführt werden.
|
||||
command-ran=Befehl ausgeführt.
|
||||
9
locale/de/ExpGamingCore.Commands.cfg
Normal file
9
locale/de/ExpGamingCore.Commands.cfg
Normal file
@@ -0,0 +1,9 @@
|
||||
[ExpGamingCore_Command]
|
||||
unauthorized=401 - Unbefugt: Zugang verweigert. Du hast keinen Zugriff auf diese Befehle!
|
||||
invalid-inputs=ungültige Eingabe, /__1__ __2__
|
||||
invalid-range=ungültige Reichweite, Min: __1__, Max: __2__
|
||||
invalid-length=ungültige Länge, Max: __1__
|
||||
invalid-player=ungültiger Spieler Name, __1__ , Versuche "Tab" zu benutzen, damit sich der Name automatisch vervollständigt.
|
||||
offline-player=Der betroffene Spieler ist offline, Befehl konnte nicht ausgeführt werden.
|
||||
dead-player=Der betroffene Spieler ist Tod, Befehl konnte nicht ausgeführt werden.
|
||||
command-ran=Befehl ausgeführt.
|
||||
4
locale/de/ExpGamingCore.Gui.cfg
Normal file
4
locale/de/ExpGamingCore.Gui.cfg
Normal file
@@ -0,0 +1,4 @@
|
||||
[ExpGamingCore_Gui]
|
||||
unauthorized=401 - Unbefugt: Du hast keinen Zugriff auf diese Befehle!
|
||||
cant-open=Du kannst dieses Menü nicht öffnen, Grund: __1__
|
||||
cant-open-no-reason=Du kannst dieses Menü gerade nicht öffnen.
|
||||
7
locale/de/ExpGamingCore.Ranking.cfg
Normal file
7
locale/de/ExpGamingCore.Ranking.cfg
Normal file
@@ -0,0 +1,7 @@
|
||||
[ranking]
|
||||
all-rank-print=[Alle]: __1__
|
||||
rank-print=[__1__]: __2__
|
||||
rank-up=__1__ wurde befördert zu __2__ von __3__
|
||||
rank-down=__1__ wurde degradiert zu __2__ von __3__
|
||||
rank-given=Dir wurde der Rang __1__ zugeteilt!
|
||||
tag-reset=Dein Spitzname wurde aufgrund eines Rangwechsels zurückgesetzt.
|
||||
68
locale/de/ExpGamingInfo.Readme.cfg
Normal file
68
locale/de/ExpGamingInfo.Readme.cfg
Normal file
@@ -0,0 +1,68 @@
|
||||
[ExpGamingInfo-Readme]
|
||||
tooltip=Open the readme gui that opens when you first join.
|
||||
guildlines-name=Guild Lines
|
||||
guildlines-tooltip=These are the guildlines you should follow
|
||||
guildlines-line1=Welcome to the Explosive Gaming Community!
|
||||
guildlines-line2=
|
||||
guildlines-line3=Here are some guidelines to keep this Server fun for everyone:
|
||||
guildlines-line4=- Hacking / cheating / abusing bugs will not be tolerated.
|
||||
guildlines-line5=- Be polite and use common sense.
|
||||
guildlines-line6=- Nobody likes spam. That includes: Chat, Bots, unlimited Chests and Concrete.
|
||||
guildlines-line7=- Do not remove stuff without even trying to talk / ask about it.
|
||||
guildlines-line8=- Trains: LHD (Left hand drive), no Loops and use them for long distances. (- Trains are only allowed in LHD (Left Hand Drive). Train loops. UPDATE)
|
||||
guildlines-line9=
|
||||
guildlines-line10=If you have any questions about the rules, the server or the game in general, feel free to ask. Have Fun!
|
||||
chat-name=How To Chat
|
||||
chat-tooltip=How to chat in factorio with default key config
|
||||
chat-singleline=Chatting can be difficult for new players because it’s different than other games! It’s very simple, the button you need to press is the “GRAVE/TILDE” key it’s located under the “ESC key”. If you would like to change the key go to your controls tab in options. The key you need to change is “Toggle Lua console” it’s located in the second column 2nd from bottom.
|
||||
commands-name=Commands
|
||||
commands-tooltip=These are the commands you can use
|
||||
commands-singleline=These are the many diffrent custom commands you are able to use, the base game commands are not shown
|
||||
commands-col1=Command Name
|
||||
commands-col2=Command Help
|
||||
links-name=Links
|
||||
links-tooltip=Helpful links for ways to get in touch
|
||||
links-cap1=Discord voice and chat server:
|
||||
links-cap2=Our website:
|
||||
links-cap3=Steam:
|
||||
links-cap4=Patreon:
|
||||
servers-name=Servers
|
||||
servers-tooltip=Info on our other servers
|
||||
servers-singleline=Welcome to the Explosive Gaming Community! S1-S3 are staggered resets.
|
||||
servers-format=S__1__: __2__
|
||||
servers-cap1=Public
|
||||
servers-des1=A place for all players, this map reset every 144H At 16:00 UTC.
|
||||
servers-cap2=Public
|
||||
servers-des2=A place for all players, this map reset every 144H At 16:00 UTC.
|
||||
servers-cap3=Public
|
||||
servers-des3=A place for all players, this map reset every 144H At 16:00 UTC.
|
||||
servers-cap4=Modded
|
||||
servers-des4=A modded server not much to say, just download the mods to play. Link on Discord for members.
|
||||
servers-cap5=Events
|
||||
servers-des5=Sometimes we hold events, may require a password, join discord for more info.
|
||||
servers-cap6=Donator
|
||||
servers-des6=For those people who have two much money and give us some. Anything goes per request.
|
||||
rules-name=All Rules
|
||||
rules-tooltip=A full list of rules for the server
|
||||
rules-singleline=This is a full list of rules what must be followed, the guildlines will cover most points in here but for those who like to follow the rules word to word then here is the full list.
|
||||
rules-format=__1__) __2__
|
||||
rules-rule1=Hacking/cheating, exploiting and abusing bugs is not allowed.
|
||||
rules-rule2=Any bugs or exploits found should be reported. (no creative items)
|
||||
rules-rule3=Do not disrespect any player in the server.
|
||||
rules-rule4=Do not take every item frmo a belt or via logics request, share resources.
|
||||
rules-rule5=Do not spam, this includes stuff such as chat spam, item spam, chest spam etc.
|
||||
rules-rule6=Do not laydown or remove concrete or stone with bots without permission.
|
||||
rules-rule7=Do not use active provider chests without permission.
|
||||
rules-rule8=Do not use speakers on global or with alearts without permission.
|
||||
rules-rule9=Do not remove/move major parts of the factory without permission.
|
||||
rules-rule10=Do not walk in player random direction for no reason(to save map size).
|
||||
rules-rule11=Do not remove stuff just because you dont like it, tell people first.
|
||||
rules-rule12=Do not rotate belts, deactive belts with wires, or cause production to stop.
|
||||
rules-rule13=Do not make train roundabouts. Or any loops of any kind.
|
||||
rules-rule14=When using trains use the same size that others have used.
|
||||
rules-rule15=Trains are Left Hand Drive (LHD) only.
|
||||
rules-rule16=Do not complain about lag, low fps and low ups or other things like that.
|
||||
rules-rule17=Do not ask for rank, our ranks are synced with discord, admins cant give ranks.
|
||||
rules-rule18=Do not advertise other servers unless you are a trusted server owner.
|
||||
rules-rule19=Report any one who breaks the rules.
|
||||
rules-rule20=Use common sense and what an admin says goes.
|
||||
12
locale/de/ExpGamingInfo.Rockets.cfg
Normal file
12
locale/de/ExpGamingInfo.Rockets.cfg
Normal file
@@ -0,0 +1,12 @@
|
||||
[ExpGamingInfo-Rockets]
|
||||
name=Raketeninfo
|
||||
tooltip=Detailliste über gestartete Raketen.
|
||||
none=Es wurden noch keine Rakten gestartet.
|
||||
nan=NaN
|
||||
sent=Gestartete Raketen: __1__
|
||||
first=Erster Start: __1__
|
||||
last=Dauer bis zum letzten Start: __1__
|
||||
time=Durchschnittliche Starzeit: __1__
|
||||
fastest=Schnellster Start: __1__
|
||||
milestones=Meilensteine:
|
||||
format=__1__: __2__
|
||||
14
locale/de/ExpGamingInfo.Science.cfg
Normal file
14
locale/de/ExpGamingInfo.Science.cfg
Normal file
@@ -0,0 +1,14 @@
|
||||
[ExpGamingInfo-Science]
|
||||
name=Wissenschaftsinfo
|
||||
tooltip=Detailliste über Wissenschaftspakete
|
||||
total=Gemachte Pakete:
|
||||
time=Pakete pro Minute:
|
||||
format=__1__: __2__
|
||||
science-pack-1=Rot
|
||||
science-pack-2=Grün
|
||||
science-pack-3=Blau
|
||||
military-science-pack=Militär
|
||||
production-science-pack=Produktion
|
||||
high-tech-science-pack=Hochtechnologie
|
||||
space-science-pack=Weltraum
|
||||
none=Es wurden noch keine Wissenschaftspakete gemacht.
|
||||
4
locale/de/ExpGamingInfo.Tasklist.cfg
Normal file
4
locale/de/ExpGamingInfo.Tasklist.cfg
Normal file
@@ -0,0 +1,4 @@
|
||||
[ExpGamingInfo-Tasklist]
|
||||
name=Taskliste
|
||||
tooltip=Welche Aufgaben müssen rund um die Fabrik erledigt werden?
|
||||
none=Es sind aktuell keine Tasks erfasst, frage einen Member um einen hinzuzufügen.
|
||||
4
locale/de/ExpGamingPlayer.inventorySearch.cfg
Normal file
4
locale/de/ExpGamingPlayer.inventorySearch.cfg
Normal file
@@ -0,0 +1,4 @@
|
||||
[ExpGamingPlayer-inventorySearch]
|
||||
low=Dein Inventar wurde durchsucht und __1__ wurde entfernt.
|
||||
med=Dein Inventar wurde durchsucht und __1__ wurde entfernt. Dir wird hiermit eine Warnung erteilt! Versuche es nicht erneut!
|
||||
high=Dein inventar wurde durchsucht und __1__ wurde gefunden, dies ist auf GAR KEINEN Fall erlaubt, dein Inventar wurde zum Spawnpunkt transferiert.
|
||||
8
locale/de/ExpGamingPlayer.playerInfo.cfg
Normal file
8
locale/de/ExpGamingPlayer.playerInfo.cfg
Normal file
@@ -0,0 +1,8 @@
|
||||
[ExpGamingPlayer-playerInfo]
|
||||
yes=Ja
|
||||
no=Nein
|
||||
name=[__1__] __2__
|
||||
online=Ist online: __1__ (__2__)
|
||||
admin=Hat Admin Rang: __1__
|
||||
group=In Benutzer Gruppe: __1__
|
||||
role=Hat Rang: __1__
|
||||
5
locale/de/ExpGamingPlayer.playerList.cfg
Normal file
5
locale/de/ExpGamingPlayer.playerList.cfg
Normal file
@@ -0,0 +1,5 @@
|
||||
[ExpGamingPlayer-playerList]
|
||||
tooltip=Verkleinere die Spielerliste. Rechtsklicke einen Spieler für Informationen über ihn.
|
||||
format-nil=__1__ - __2__
|
||||
format=__1__ - __2__ - __3__
|
||||
no-info-file=Es wurden keine Informationen gefunden.
|
||||
7
locale/de/ExpGamingPlayer.polls.cfg
Normal file
7
locale/de/ExpGamingPlayer.polls.cfg
Normal file
@@ -0,0 +1,7 @@
|
||||
[ExpGamingPlayer-polls]
|
||||
name=Umfragen
|
||||
tooltip=Alte Umfragen ansehen
|
||||
no-poll=Keine alten Umfragen
|
||||
end=Die Umfrage hat gerade geendet: __1__
|
||||
winner=__1__ hatte die meisten Stimmen.
|
||||
time-left=Du hast noch __1__s um deine Wahl zu erfassen.
|
||||
31
locale/de/GameSettingsGui.cfg
Normal file
31
locale/de/GameSettingsGui.cfg
Normal file
@@ -0,0 +1,31 @@
|
||||
[GameSettingsGui]
|
||||
name=Spieleinstellungen
|
||||
tooltip=Erlaubt das Modifizieren von Spieleinstellungen. Bitte mit Bedacht benutzen.
|
||||
basic-name=Einfache Einstellungen
|
||||
basic-tooltip=Diese Einstellungen sind ohne Probleme veränderbar, sie verursachen keine großen Probleme im nachhinein.
|
||||
basic-message=Dies sind fraktionsweite Einstellungen, welche genutzt werden können um das Spiel zu vereinfachen und es für Alle angenehmer zu machen.
|
||||
advanced-name=Erweiterte Einstellungen
|
||||
advanced-tooltip=Diese Einstellungen sollten nicht von Leuten benutzt werden, die nicht wissen was sie tun.
|
||||
advanced-message=Bitte ändere keine dieser Einstellungen ausser du bist dir 100% sicher was sie tun,lass game.speed allein, da es einen viel größeren Effekt hat als du denkst.
|
||||
personal-name=Persönliche Einstellungen
|
||||
personal-tooltip=Diese Einstellungen betreffen nur deinen Spieler. Wenn man dich beim cheaten erwischt bist du auf dich allein gestellt.
|
||||
personal-message=Diese Einstellungen betreffen nur deinen Spieler, übertreib es nicht ansonsten besteht die Gefahr, dass dich normale Spieler (gierige Kleinkinder) dabei erwischen (und rumheulen).
|
||||
sure=Bist du dir Sicher?!
|
||||
effect-mining-speed=Abbaugeschwindigkeit
|
||||
effect-craft-speed=Herstellgeschwindigkeit
|
||||
effect-running-speed=Laufgeschwindigkeit
|
||||
effect-build-distance=Baudistanz
|
||||
effect-reach-distance=Armreichweite
|
||||
effect-bot-speed=Robotergeschwindigkeit
|
||||
effect-lab-speed=Laborgeschwindigkeit
|
||||
effect-stack-bonus=Stapelnonuss
|
||||
effect-quickbar-count=Anzahl Schnellleistenelemente
|
||||
effect-inventory-size=Inventargröße
|
||||
effect-mining-prod=Abbauproduktivität
|
||||
effect-game-speed=Spielgeschwindigkeit
|
||||
effect-save=Spiel speichern
|
||||
effect-reload-effects=Effekte neu laden
|
||||
effect-reload-map=Minimap neu laden
|
||||
effect-kill-biters=Töte alle Beisser
|
||||
effect-crc=Forciere CRC check
|
||||
effect-reset-force=Fraktion zurücksetzen
|
||||
6
locale/de/GuiAnnouncements.cfg
Normal file
6
locale/de/GuiAnnouncements.cfg
Normal file
@@ -0,0 +1,6 @@
|
||||
[GuiAnnouncements]
|
||||
name=Ankündigung
|
||||
tooltip=Eine Ankündigung an Spieler senden
|
||||
sent-to=Dies wurde zu __1__ gesendet
|
||||
sent-by=Dies wurde von __1__ mit Rang __2__ gesendet
|
||||
select-rank=Diese Nachricht wird gesendet an:
|
||||
9
locale/de/WarpPoints.cfg
Normal file
9
locale/de/WarpPoints.cfg
Normal file
@@ -0,0 +1,9 @@
|
||||
[WarpPoints]
|
||||
name=Warp List
|
||||
tooltip=Die Liste mit den Warp-Punkten
|
||||
remove-tooltip=Entferne Warp-Punkt
|
||||
go-to-tooltip=Gehe zu Warp-Punkt
|
||||
cooldown=Warte, bis der Cooldown abgelaufen ist. Verbleibende Zeit: __1__
|
||||
cooldown-zero=Dein Cooldown ist abgelaufen, du kannst jetzt wieder Warp-Punkte verwenden.
|
||||
name-used=Dieser Name ist schon vergeben.
|
||||
not-on-warp=Du bist nicht auf einem Warp-Punkt. Gehe auf einen Warp-Punkt, um zu einem anderen zu springen.
|
||||
3
locale/en/DeconControl.cfg
Normal file
3
locale/en/DeconControl.cfg
Normal file
@@ -0,0 +1,3 @@
|
||||
[DeconControl]
|
||||
player-print=You do not have permission to do this right now. You require the Regular rank which can be obtained through 3 hours of in-game playtime on a server.
|
||||
rank-print=__1__ tried to deconstruct something.
|
||||
21
locale/en/ExpGamingAdmin.AdminLib.cfg
Normal file
21
locale/en/ExpGamingAdmin.AdminLib.cfg
Normal file
@@ -0,0 +1,21 @@
|
||||
[ExpGamingAdmin]
|
||||
name=Admin Commands
|
||||
tooltip=Admin commands make their home here
|
||||
no-info-file=No info file was found
|
||||
message=Please select a player and an action to take. Make sure to choose the correct one!
|
||||
warning=Warning: This player outranks you. Therefore, you cannot edit their rank.
|
||||
short-reason=Warning: The reason is too short.
|
||||
rank-high=Warning: This player outranks you. Therefore, you cannot edit their rank.
|
||||
invalid=The player or the action is invalid. Please try again!
|
||||
take-action=Take Action
|
||||
tooltip-ban=Ban Player
|
||||
tooltip-kick=Kick Player
|
||||
tooltip-jail=Jail Player
|
||||
tooltip-go-to=Go To Player
|
||||
tooltip-bring=Bring Player
|
||||
temp-ban=__1__ was temporary banned by __2__ and will remain in jail until next reset
|
||||
report=Report Player
|
||||
cant-report-ban=Invalid player as player is banned; Either unban or use /clear-all <player_name>
|
||||
low-print=__1__ has been reported by a user for: __2__
|
||||
high-print=__1__ has been reported by __2__ for: __3__
|
||||
cant-report=This player can't be reported.
|
||||
10
locale/en/ExpGamingAdmin.Warnings.cfg
Normal file
10
locale/en/ExpGamingAdmin.Warnings.cfg
Normal file
@@ -0,0 +1,10 @@
|
||||
[ExpGamingAdmin-Warnings]
|
||||
warning-given-by=This warning was given by: __1__
|
||||
player-warning=__1__ was given a warning by __2__ for: __3__
|
||||
remove-warn=One of your warnings expired. You have __1__ warnings left, next warning will be removed in __2__
|
||||
message=You are currently being warned by the system. These will continue until you cease and desist.
|
||||
reported=You have been reported to the admins by the system. Further action may be taken if you do not cease and desist.
|
||||
kick-warn=This is your last warning before you get kicked. The system will automatically kick you if you do not cease and desist.
|
||||
temp-warn=This is your last warning before you get temporary banned. The system will automatically ban you if you do not cease and desist.
|
||||
ban-warn=WARNING: This is your last warning before you get BANNED. The system will automatically BAN you if you do not cease and desist.
|
||||
last-warn=WARNING: This is your last warning before you get PERMANENTLY BANNED. The system will automatically PERMANENTLY BAN you if you do not cease and desist.
|
||||
21
locale/en/ExpGamingAdmin.cfg
Normal file
21
locale/en/ExpGamingAdmin.cfg
Normal file
@@ -0,0 +1,21 @@
|
||||
[ExpGamingAdmin]
|
||||
name=Admin Commands
|
||||
tooltip=Admin commands make their home here
|
||||
no-info-file=No info file was found
|
||||
message=Please select a player and an action to take. Make sure to choose the correct one!
|
||||
warning=Warning: This player outranks you. Therefore, you cannot edit their rank.
|
||||
short-reason=Warning: The reason is too short.
|
||||
rank-high=Warning: This player outranks you. Therefore, you cannot edit their rank.
|
||||
invalid=The player or the action is invalid. Please try again!
|
||||
take-action=Take Action
|
||||
tooltip-ban=Ban Player
|
||||
tooltip-kick=Kick Player
|
||||
tooltip-jail=Jail Player
|
||||
tooltip-go-to=Go To Player
|
||||
tooltip-bring=Bring Player
|
||||
temp-ban=__1__ was temporary banned by __2__ and will remain in jail until next reset
|
||||
report=Report Player
|
||||
cant-report-ban=Invalid player as player is banned; Either unban or use /clear-all <player_name>
|
||||
low-print=__1__ has been reported by a user for: __2__
|
||||
high-print=__1__ has been reported by __2__ for: __3__
|
||||
cant-report=This player can't be reported.
|
||||
48
locale/en/ExpGamingBot.autoChat.cfg
Normal file
48
locale/en/ExpGamingBot.autoChat.cfg
Normal file
@@ -0,0 +1,48 @@
|
||||
[ExpGamingBot-autoChat]
|
||||
message=[Chat Bot]: __1__
|
||||
rank-error=You can't use global chat commands
|
||||
players-online=There are __1__ players online
|
||||
players=There have been __1__ players on this map
|
||||
map-time=This map has been on for __1__
|
||||
line-8=Type /help <command> for more info
|
||||
join-us=Please join us on:
|
||||
discord=Discord: https://discord.explosivegaming.nl
|
||||
website=Website: https://www.explosivegaming.nl
|
||||
custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info.
|
||||
read-readme=Make sure you have read the Readme (It can be found through the question mark on the top left)
|
||||
not-real-dev=Cooldude2606 is a dev for this server and makes the softmod (look top left) and is not a factorio dev.
|
||||
softmod=A softmod is a custom scenario that runs on this server, example is the player list.
|
||||
redmew=We dont talk about redmew here; they beat us to 1000 members; F
|
||||
blame=Blame __1__ for what just happend!
|
||||
afk=Your afk? Look at __1__, that player has been afk for: __2__
|
||||
links=To see links open the readme and click links.
|
||||
current-evolution=Current evolution factor is __1__
|
||||
magic=Fear the admin magic (ノ゚∀゚)ノ⌒・*:.。. .。.:*・゜゚・*☆
|
||||
aids=≖ ‿ ≖ Fear the aids of a public server ≖ ‿ ≖
|
||||
riot=(admins) ┬┴┬┴┤ᵒ_ᵒ)├┬┴┬┴ ‹ ‹\(´ω` )/››‹‹\ ( ´)/››‹‹\ ( ´ω`)/›› (rest of server)
|
||||
loops=NO LOOPS; LOOPS ARE BAD; JUST NO LOOPS!!!!!; IF YOU MAKE A LOOP.... IT WILL NOT END WELL!!!!!!!
|
||||
lenny=( ͡° ͜ʖ ͡°)
|
||||
make-tea-1= ☕ Boiling the water... ☕
|
||||
make-tea-2= ☕ __1__ your tea is done! ☕
|
||||
order-pizza-1= 🍕 Finding nearest pizza supplier... 🍕
|
||||
order-pizza-2= 🍕 Figuring out the favourite pizza of __1__ 🍕
|
||||
order-pizza-3= 🍕 __1__ your pizza is here! 🍕
|
||||
make-coffee-1= ☕ Boiling the water and grinding the coffee beans... ☕
|
||||
make-coffee-2= ☕ __1__ we ran out of coffe beans! Have some tea instead. ☕
|
||||
get-beer-1= 🍺 Pouring A Glass 🍺
|
||||
get-beer-2= 🍻 Chears Mate 🍻
|
||||
get-mead-1= Filling the drinking horn
|
||||
get-mead-2= Skål!
|
||||
get-snaps-1=Pouring the glasses and finding the correct song book...
|
||||
get-snaps-2=Singing a song...🎤🎶
|
||||
get-snaps-3=skål, my friends!
|
||||
get-cocktail-1= 🍸 Inintiating mind reading unit... 🍸
|
||||
get-cocktail-2= 🍸 Mixing favourite ingredients of __1__ 🍸
|
||||
get-cocktail-3=🍸 __1__ your cocktail is done.🍸
|
||||
lhd=All trains must be LHD!
|
||||
food=Don't know what to make for dinner? Use a random recipe from the random dinner suggestion generator at http://www.whatthefuckshouldimakefordinner.com/
|
||||
get-popcorn-1=Heating the oil and waiting for the popping sound...
|
||||
get-popcorn-2=__1__ your popcorn is finished. Lean backwards and watch the drama unfold.
|
||||
wiki=You can get more information about us and the custom scenario from our wiki: https://wiki.explosivegaming.nl/
|
||||
feedback=Do you have feedback? leave it at https://exp.fider.io/
|
||||
hodor=Hodor
|
||||
9
locale/en/ExpGamingBot.autoMessage.cfg
Normal file
9
locale/en/ExpGamingBot.autoMessage.cfg
Normal file
@@ -0,0 +1,9 @@
|
||||
[ExpGamingBot-autoMessage]
|
||||
message=[Chat Bot]: __1__
|
||||
players-online=There are __1__ players online
|
||||
map-time=This map has been on for __1__
|
||||
join-us=Please join us on:
|
||||
discord=Discord: https://discord.explosivegaming.nl
|
||||
website=Website: https://www.explosivegaming.nl
|
||||
custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info.
|
||||
read-readme=Make sure you have read the Readme (It can be found through the question mark on the top left)
|
||||
9
locale/en/ExpGamingCommands.home.cfg
Normal file
9
locale/en/ExpGamingCommands.home.cfg
Normal file
@@ -0,0 +1,9 @@
|
||||
[ExpGamingCommands-home]
|
||||
too-many-homes=You have too many homes, to add more you must remove one. Your max is __1__.
|
||||
homes=Your Homes: (__1__/__2__)
|
||||
home=__1__) __2__: __3__ , __4__
|
||||
set=Your home "__1__" as been set to __2__ , __3__
|
||||
remove=Your home "__1__" as been removed
|
||||
goto=You are now at "__1__"
|
||||
return=You are now at your previous location: __1__ , __2__
|
||||
invalid=Invalid name, __1__
|
||||
14
locale/en/ExpGamingCore.Command.cfg
Normal file
14
locale/en/ExpGamingCore.Command.cfg
Normal file
@@ -0,0 +1,14 @@
|
||||
[ExpGamingCore_Command]
|
||||
unauthorized=Unauthorized, Access is denied due to invalid credentials
|
||||
error-string-list=Invalid Option, Must be one of: __1__
|
||||
error-string-len=Invalid Length, Max: __1__
|
||||
error-number=Invalid Number
|
||||
error-number-range=Invalid Range, Min (exclusive): __1__, Max (inclusive): __2__
|
||||
error-player=Invaild Player Name, __1__ ,try using tab key to auto-complete the name
|
||||
error-player-online=Player is offline.
|
||||
error-player-alive=Player is dead.
|
||||
error-player-rank=Player is of Higher Rank.
|
||||
invalid-inputs=Invalid Input, /__1__ __2__
|
||||
invalid-parse=Invalid Input, There was a problem prasing the paramaters
|
||||
command-ran=Command Complete
|
||||
command-fail=Command failed to run: __1__
|
||||
4
locale/en/ExpGamingCore.Gui.cfg
Normal file
4
locale/en/ExpGamingCore.Gui.cfg
Normal file
@@ -0,0 +1,4 @@
|
||||
[ExpGamingCore_Gui]
|
||||
unauthorized=401 - Unauthorized: Access is denied due to invalid credentials
|
||||
cant-open=You can't open this panel right now, reason: __1__
|
||||
cant-open-no-reason=You can't open this panel right now
|
||||
7
locale/en/ExpGamingCore.Ranking.cfg
Normal file
7
locale/en/ExpGamingCore.Ranking.cfg
Normal file
@@ -0,0 +1,7 @@
|
||||
[ranking]
|
||||
all-rank-print=[Everyone]: __1__
|
||||
rank-print=[__1__]: __2__
|
||||
rank-up=__1__ was promoted to __2__ by __3__
|
||||
rank-down=__1__ was demoted to __2__ by __3__
|
||||
rank-given=You have been given the __1__ Rank!
|
||||
tag-reset=Your Tag was reset due to a Rank change
|
||||
6
locale/en/ExpGamingCore.Role.cfg
Normal file
6
locale/en/ExpGamingCore.Role.cfg
Normal file
@@ -0,0 +1,6 @@
|
||||
[ExpGamingCore-Role]
|
||||
default-print=[Everyone]: __1__
|
||||
print=[__1__]: __2__
|
||||
assign=__1__ was assigned to __2__ by __3__
|
||||
unassign=__1__ was unassigned from __2__ by __3__
|
||||
tag-reset=Your Tag was reset due to a role change
|
||||
2
locale/en/ExpGamingCore.Server.cfg
Normal file
2
locale/en/ExpGamingCore.Server.cfg
Normal file
@@ -0,0 +1,2 @@
|
||||
[ExpGamingCore_Server]
|
||||
interface-description=Runs the given input from the script
|
||||
69
locale/en/ExpGamingInfo.Readme.cfg
Normal file
69
locale/en/ExpGamingInfo.Readme.cfg
Normal file
@@ -0,0 +1,69 @@
|
||||
[ExpGamingInfo-Readme]
|
||||
tooltip=Open the ReadMe if this is your first time joining.
|
||||
guildlines-name=Guidelines
|
||||
guildlines-tooltip=These are the guidelines everyone should follow
|
||||
guildlines-line1=Welcome to the Explosive Gaming Community!
|
||||
guildlines-line2=Here are some guidelines that everyone is obligated to follow.
|
||||
guildlines-line3=!!!No rights can be derived from these guidelines as the full list of rules (another tab in this window) is valid / operative!!!
|
||||
guildlines-line4=- Hacking / cheating / abusing bugs will not be tolerated.
|
||||
guildlines-line5=- Be polite and use common sense.
|
||||
guildlines-line6=- Spamming (in the form of chat, bots, unlimited chests and concrete) is not allowed.
|
||||
guildlines-line7=- Do not remove stuff without asking your fellow players.
|
||||
guildlines-line8=- Trains are only allowed in LHD (Left Hand Drive). No train loops!
|
||||
guildlines-line9=
|
||||
guildlines-line10=If you have any questions about our rules, the server or Factorio in general, feel free to ask your fellow players or our helpful team. Have fun!
|
||||
chat-name=How To Chat
|
||||
chat-tooltip=How to chat in Factorio with default key config
|
||||
chat-singleline=Chatting can be difficult for new players because it’s different than other games! It’s very simple, the button you need to press is the “GRAVE/TILDE” key (which is located under the “ESC key”) - If you would like to change the key, go to your Controls tab in options. The key you need to change is “Toggle LUA console”
|
||||
commands-name=Commands
|
||||
commands-tooltip=Commands that you can use in ExplosiveGaming
|
||||
commands-singleline=Custom commands that you can use. Base commands are not shown here.
|
||||
commands-col1=Command Name
|
||||
commands-col2=Command Help
|
||||
links-name=Links
|
||||
links-tooltip=Helpful links for ways to get in touch with us
|
||||
links-cap1=Discord voice and chat server:
|
||||
links-cap2=Our website:
|
||||
links-cap3=Steam:
|
||||
links-cap4=Patreon:
|
||||
links-cap5=Our wiki:
|
||||
servers-name=Servers
|
||||
servers-tooltip=Info on our other servers
|
||||
servers-singleline=Welcome to the Explosive Gaming Community! S1-S3 are staggered resets.
|
||||
servers-format=S__1__: __2__
|
||||
servers-cap1=Public
|
||||
servers-des1=A place for all players, this map resets every 144H At 16:00 UTC.
|
||||
servers-cap2=Public
|
||||
servers-des2=A place for all players, this map resets every 144H At 16:00 UTC.
|
||||
servers-cap3=Public
|
||||
servers-des3=A place for all players, this map resets every 144H At 16:00 UTC.
|
||||
servers-cap4=Modded
|
||||
servers-des4=A Modded server for all players. Link on Discord for members.
|
||||
servers-cap5=Events
|
||||
servers-des5=Server for events (everyone can join) - May require a password. Join Discord for more info
|
||||
servers-cap6=Donator
|
||||
servers-des6=For players who support us financially. Changes can be made per request.
|
||||
rules-name=Rules
|
||||
rules-tooltip=The full list of ExplosiveGaming rules.
|
||||
rules-singleline=Although the guidelines cover most of our rules, the full list always have more priority and override any guideline. It is advised to be familiar with all rules to prevent warnings or bans.
|
||||
rules-format=__1__) __2__
|
||||
rules-rule1=Hacking / cheating / abusing bugs will not be tolerated.
|
||||
rules-rule2=Any bugs or exploits found should be reported to our team members. (excluding creative items)
|
||||
rules-rule3=Do not disrespect any player in the server.
|
||||
rules-rule4=Taking all items from a belt or logistics request is forbidden: sharing resources is mandatory.
|
||||
rules-rule5=Spamming (in the form of chat, bots, unlimited chests and concrete) is not allowed.
|
||||
rules-rule6=Do not lay down/remove concrete or stone with bots without permission.
|
||||
rules-rule7=Do not use active provider chests without permission.
|
||||
rules-rule8=Do not use speakers on global or with alerts without permission.
|
||||
rules-rule9=Do not remove/move major parts of the factory without permission.
|
||||
rules-rule10=Do not walk in random directions for no reason (to save map size and server resources).
|
||||
rules-rule11=Do not remove stuff without asking your fellow players.
|
||||
rules-rule12=Do not rotate belts, deactivate belts with wires, or cause production to stop.
|
||||
rules-rule13=Do not make train roundabouts. Or any loops of any kind.
|
||||
rules-rule14=When using trains, use the same size other players have used.
|
||||
rules-rule15=Trains are Left Hand Drive (LHD) only.
|
||||
rules-rule16=Do not complain about lag, low fps and low ups etc.
|
||||
rules-rule17=Do not ask for ranks. Our ranks are synchronized with Discord, make sure to join us there.
|
||||
rules-rule18=Do not advertise other servers unless you are a trusted server owner.
|
||||
rules-rule19=Report players who break the rules.
|
||||
rules-rule20=Use common sense and what an Admin says goes.
|
||||
12
locale/en/ExpGamingInfo.Rockets.cfg
Normal file
12
locale/en/ExpGamingInfo.Rockets.cfg
Normal file
@@ -0,0 +1,12 @@
|
||||
[ExpGamingInfo-Rockets]
|
||||
name=Rocket Info
|
||||
tooltip=List of details about the rockets sent.
|
||||
none=No rockets have been sent yet.
|
||||
nan=Not available
|
||||
sent=Rockets Sent: __1__
|
||||
first=First Lanuched At: __1__
|
||||
last=Last Launch Took: __1__
|
||||
time=Average Launch Time: __1__
|
||||
fastest=Fastest Launch: __1__
|
||||
milestones=Milestones:
|
||||
format=__1__: __2__
|
||||
14
locale/en/ExpGamingInfo.Science.cfg
Normal file
14
locale/en/ExpGamingInfo.Science.cfg
Normal file
@@ -0,0 +1,14 @@
|
||||
[ExpGamingInfo-Science]
|
||||
name=Science Info
|
||||
tooltip=List of details about science packs.
|
||||
total=Packs Made:
|
||||
time=Packs Per Minute:
|
||||
format=__1__: __2__
|
||||
science-pack-1=Red
|
||||
science-pack-2=Green
|
||||
science-pack-3=Blue
|
||||
military-science-pack=Military
|
||||
production-science-pack=Production
|
||||
high-tech-science-pack=High Tech
|
||||
space-science-pack=Space
|
||||
none=No science packs have been made yet.
|
||||
4
locale/en/ExpGamingInfo.Tasklist.cfg
Normal file
4
locale/en/ExpGamingInfo.Tasklist.cfg
Normal file
@@ -0,0 +1,4 @@
|
||||
[ExpGamingInfo-Tasklist]
|
||||
name=Task List
|
||||
tooltip=Jobs that needs to be completed all around the factory.
|
||||
none=There are currently no tasks. Ask a Member in-game or through Discord to add tasks.
|
||||
4
locale/en/ExpGamingPlayer.inventorySearch.cfg
Normal file
4
locale/en/ExpGamingPlayer.inventorySearch.cfg
Normal file
@@ -0,0 +1,4 @@
|
||||
[ExpGamingPlayer-inventorySearch]
|
||||
low=Your inventory was searched and __1__ was removed.
|
||||
med=Your inventory was searched and __1__ was removed, you have been given a warning as a result.
|
||||
high=Your inventory was searched and __1__ was removed: this is NOT allowed. You have been temp-banned as a result.
|
||||
9
locale/en/ExpGamingPlayer.playerInfo.cfg
Normal file
9
locale/en/ExpGamingPlayer.playerInfo.cfg
Normal file
@@ -0,0 +1,9 @@
|
||||
[ExpGamingPlayer-playerInfo]
|
||||
yes=Yes
|
||||
no=No
|
||||
name=[__1__] __2__
|
||||
online=Is Online: __1__ (__2__)
|
||||
admin=Has Admin: __1__
|
||||
group=In User Group: __1__
|
||||
role=Highest Role: __1__
|
||||
roles=Other Roles: __1__
|
||||
5
locale/en/ExpGamingPlayer.playerList.cfg
Normal file
5
locale/en/ExpGamingPlayer.playerList.cfg
Normal file
@@ -0,0 +1,5 @@
|
||||
[ExpGamingPlayer-playerList]
|
||||
tooltip=Toggle player list, right click player for more info
|
||||
format-nil=__1__ - __2__
|
||||
format=__1__ - __2__ - __3__
|
||||
no-info-file=No info file was found
|
||||
7
locale/en/ExpGamingPlayer.polls.cfg
Normal file
7
locale/en/ExpGamingPlayer.polls.cfg
Normal file
@@ -0,0 +1,7 @@
|
||||
[ExpGamingPlayer-polls]
|
||||
name=Polls
|
||||
tooltip=View Old Polls
|
||||
no-poll=No Old Polls
|
||||
end=Poll Just Ended: __1__
|
||||
winner=__1__ had the most votes.
|
||||
time-left=You will have __1__s to pick.
|
||||
32
locale/en/GameSettingsGui.cfg
Normal file
32
locale/en/GameSettingsGui.cfg
Normal file
@@ -0,0 +1,32 @@
|
||||
[GameSettingsGui]
|
||||
name=Game Settings
|
||||
tooltip=Edits Game Settings. Please use responsibly.
|
||||
basic-name=Basic Settings
|
||||
basic-tooltip=These settings are safe to edit and have no big impact.
|
||||
basic-message=Basic Settings can be used to improve game play for players.
|
||||
advanced-name=Advanced Settings
|
||||
advanced-tooltip=These settings should be left alone unless you know what you are doing.
|
||||
advanced-message=Please do not touch the Advanced Settings unless you are 100% sure what you are doing: changes made to these settings might have a bigger impact than you realise.
|
||||
personal-name=Personal Settings
|
||||
personal-tooltip=Personal Settings only affect you.
|
||||
personal-message=Personal Settings only affect your character. If you are spotted as a result of these settings, you are on your own!
|
||||
sure=Are you sure?
|
||||
effect-mining-speed=Mining Speed
|
||||
effect-craft-speed=Crafting Speed
|
||||
effect-running-speed=Running Speed
|
||||
effect-build-distance=Build Distance
|
||||
effect-reach-distance=Reach Distance
|
||||
effect-bot-speed=Bot Speed
|
||||
effect-lab-speed=Lab Speed
|
||||
effect-stack-bonus=Stack Bonus
|
||||
effect-quickbar-count=Quickbar Count
|
||||
effect-inventory-size=Inventory Size
|
||||
effect-mining-prod=Mining Productivity
|
||||
effect-game-speed=Game Speed
|
||||
effect-save=Save Game
|
||||
effect-reload-effects=Reload Effects
|
||||
effect-reload-map=Reload Minimap
|
||||
effect-kill-biters=Kill Biters
|
||||
effect-crc=Force CRC Check
|
||||
effect-reset-force=Reset Force
|
||||
effect-clear-pollution=Clear Pollution
|
||||
6
locale/en/GuiAnnouncements.cfg
Normal file
6
locale/en/GuiAnnouncements.cfg
Normal file
@@ -0,0 +1,6 @@
|
||||
[GuiAnnouncements]
|
||||
name=Announcements
|
||||
tooltip=Sends an announcement to all players
|
||||
sent-to=This announcement is sent to __1__
|
||||
sent-by=This announcement was sent by __1__ ( __2__ )
|
||||
select-rank=This announcement will be sent to:
|
||||
10
locale/en/WarpPoints.cfg
Normal file
10
locale/en/WarpPoints.cfg
Normal file
@@ -0,0 +1,10 @@
|
||||
[WarpPoints]
|
||||
name=Warp List
|
||||
tooltip=A list of warp points.
|
||||
remove-tooltip=Remove Warp point
|
||||
go-to-tooltip=Go To
|
||||
cooldown=You must wait for the cooldown. Time left: __1__
|
||||
cooldown-zero=Your cooldown has expired, You can use warp points again.
|
||||
name-used=That name is already taken.
|
||||
too-close=You are too close to an existing warp point to make a new one.
|
||||
not-on-warp=You are not on a warp point right now, you must be on a warp point to go to one.
|
||||
@@ -1,22 +0,0 @@
|
||||
[commands]
|
||||
unauthorized=401 - Unauthorized: Access is denied due to invalid credentials
|
||||
invalid-inputs=Invalid Input, /__1__ __2__
|
||||
invalid-range=Invalid Range, Min: __1__, Max: __2__
|
||||
invalid-length=Invalid Length, Max: __1__
|
||||
invalid-player=Invaild Player Name, __1__ ,try using tab key to auto-complete the name
|
||||
offline-player=Player is offline: Command failed to run
|
||||
dead-player=Player is dead: Command failed to run
|
||||
command-ran=Command Complete
|
||||
|
||||
[ranking]
|
||||
all-rank-print=[Everyone]: __1__
|
||||
rank-print=[__1__]: __2__
|
||||
rank-up=__1__ was promoted to __2__ by __3__
|
||||
rank-down=__1__ was demoted to __2__ by __3__
|
||||
rank-given=You have been given the __1__ Rank!
|
||||
tag-reset=Your Tag was reset due to a Rank change
|
||||
|
||||
[gui]
|
||||
unauthorized=401 - Unauthorized: Access is denied due to invalid credentials
|
||||
cant-open=You can't open this panel right now, reason: __1__
|
||||
cant-open-no-reason=You can't open this panel right now
|
||||
3
locale/fr/DeconControl.cfg
Normal file
3
locale/fr/DeconControl.cfg
Normal file
@@ -0,0 +1,3 @@
|
||||
[DeconControl]
|
||||
player-print=You are not allowed to do this yet, You require the Regular rank, you must play for at least 3 hours
|
||||
rank-print=__1__ tried to deconstruct something.
|
||||
15
locale/fr/ExpGamingAdmin.AdminLib.cfg
Normal file
15
locale/fr/ExpGamingAdmin.AdminLib.cfg
Normal file
@@ -0,0 +1,15 @@
|
||||
[ExpGamingAdmin]
|
||||
name=Commandes Admin
|
||||
tooltip=Des commandes très puissantes résident ici.
|
||||
no-info-file=Aucun fichier info trouvé
|
||||
message=Veuillez sélectionner un joueur et une action, faites en sorte que ce soit la bonne !
|
||||
warning=Attention, ce joueur est de rang supérieur au vôtre, vous ne pouvez le modifier.
|
||||
short-reason=Attention, la raison indiquée est trop courte. Soyez concis mais aussi précis. (Warning: The reason is too short. UPDATE)
|
||||
rank-high=Ce joueur est de rang supérieur, veuillez utiliser une commande dont vous maîtriser l'utilisation !
|
||||
invalid=Le Joueur ou l'action est invalide, ré-essayez !
|
||||
take-action=Agir
|
||||
tooltip-ban=Bannir un Joueur
|
||||
tooltip-kick=Exclure un Joueur
|
||||
tooltip-jail=Emprisonner un Joueur
|
||||
tooltip-go-to=Aller à la position d'un Joueur
|
||||
tooltip-bring=Amener le Joueur à soi
|
||||
11
locale/fr/ExpGamingAdmin.Warnings.cfg
Normal file
11
locale/fr/ExpGamingAdmin.Warnings.cfg
Normal file
@@ -0,0 +1,11 @@
|
||||
[ExpGamingAdmin-Warnings]
|
||||
warning-given-by=This Warnings Was Given By: __1__
|
||||
player-warning=__1__ was given a warning by __2__ reason: __3__
|
||||
temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset
|
||||
remove-warn=You are had a warning Removed, you have __1__ warnings, next removed in __2__
|
||||
message=You Are Currently Reciving Warnings From The Script, This Will Continue Unless You Cease And Desist
|
||||
reported=You Have Been Reported To The Admins By The Script, Further Acction May Be Taken If You Do Not Cease And Desist.
|
||||
kick-warn=You Are On A Warning To Be KICKED, The Script Will Auto Kick If You Do Not Cease And Desist.
|
||||
temp-warn=You Are On A Warning To Be TEMP BANNED, The Script Will Auto Ban If You Do Not Cease And Desist.
|
||||
ban-warn=You Are On A Warning To Be BANNED, The Script Will Auto Ban If You Do Not Cease And Desist.
|
||||
last-warn=YOU ARE ON A LAST WARNING TO BE BANNED, THE SCRIPT WILL AUTO BAN IF YOU DO NOT CEASE AND DESIST.
|
||||
15
locale/fr/ExpGamingAdmin.cfg
Normal file
15
locale/fr/ExpGamingAdmin.cfg
Normal file
@@ -0,0 +1,15 @@
|
||||
[ExpGamingAdmin]
|
||||
name=Commandes Admin
|
||||
tooltip=Des commandes très puissantes résident ici.
|
||||
no-info-file=Aucun fichier info trouvé
|
||||
message=Veuillez sélectionner un joueur et une action, faites en sorte que ce soit la bonne !
|
||||
warning=Attention, ce joueur est de rang supérieur au vôtre, vous ne pouvez le modifier.
|
||||
short-reason=Attention, la raison indiquée est trop courte. Soyez concis mais aussi précis. (Warning: The reason is too short. UPDATE)
|
||||
rank-high=Ce joueur est de rang supérieur, veuillez utiliser une commande dont vous maîtriser l'utilisation !
|
||||
invalid=Le Joueur ou l'action est invalide, ré-essayez !
|
||||
take-action=Agir
|
||||
tooltip-ban=Bannir un Joueur
|
||||
tooltip-kick=Exclure un Joueur
|
||||
tooltip-jail=Emprisonner un Joueur
|
||||
tooltip-go-to=Aller à la position d'un Joueur
|
||||
tooltip-bring=Amener le Joueur à soi
|
||||
20
locale/fr/ExpGamingBot.autoChat.cfg
Normal file
20
locale/fr/ExpGamingBot.autoChat.cfg
Normal file
@@ -0,0 +1,20 @@
|
||||
[ExpGamingBot-autoChat]
|
||||
message=[Chat Bot]: __1__
|
||||
rank-error=You cant use global chat commands
|
||||
players-online=There are __1__ players online
|
||||
players=There have been __1__ players on this map
|
||||
map-time=This map has been on for __1__
|
||||
line-8=Type /help <command> for more info
|
||||
join-us=Please join us on:
|
||||
discord=Discord: https://discord.explosivegaming.nl
|
||||
website=Website: explosivegaming.nl
|
||||
custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info.
|
||||
read-readme=Make sure you have read the Readme (can be found through the question mark on the top left)
|
||||
not-real-dev=Cooldude2606 is a dev for this server and makes the softmod (look top left) and is not a factorio dev.
|
||||
softmod=A softmod is a custom scenario that runs on this server, example is the player list.
|
||||
blame=Blame __1__ for what just happend!
|
||||
afk=Your afk? Look at __1__ they have been afk for: __2__
|
||||
links=To see links open the readme and click links.
|
||||
magic=Fear the admin magic (ノ゚∀゚)ノ⌒・*:.。. .。.:*・゜゚・*☆
|
||||
aids=≖ ‿ ≖ Fear the aids of a public server ≖ ‿ ≖
|
||||
riot=(admins) ┬┴┬┴┤ᵒ_ᵒ)├┬┴┬┴ ‹ ‹\(´ω` )/››‹‹\ ( ´)/››‹‹\ ( ´ω`)/›› (rest of server)
|
||||
9
locale/fr/ExpGamingBot.autoMessage.cfg
Normal file
9
locale/fr/ExpGamingBot.autoMessage.cfg
Normal file
@@ -0,0 +1,9 @@
|
||||
[ExpGamingBot-autoMessage]
|
||||
message=[Chat Bot]: __1__
|
||||
players-online=There are __1__ players online
|
||||
map-time=This map has been on for __1__
|
||||
join-us=Please join us on:
|
||||
discord=Discord: https://discord.explosivegaming.nl
|
||||
website=Website: explosivegaming.nl
|
||||
custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info.
|
||||
read-readme=Make sure you have read the Readme (can be found through the question mark on the top left)
|
||||
9
locale/fr/ExpGamingCore.Command.cfg
Normal file
9
locale/fr/ExpGamingCore.Command.cfg
Normal file
@@ -0,0 +1,9 @@
|
||||
[ExpGamingCore_Command]
|
||||
unauthorized=401 - Unauthorized: Access is denied due to invalid credentials
|
||||
invalid-inputs=Invalid Input, /__1__ __2__
|
||||
invalid-range=Invalid Range, Min: __1__, Max: __2__
|
||||
invalid-length=Invalid Length, Max: __1__
|
||||
invalid-player=Invaild Player Name, __1__ ,try using tab key to auto-complete the name
|
||||
offline-player=Player is offline, Command Failed To Run
|
||||
dead-player=Player is dead, Command Failed To Run
|
||||
command-ran=Command Complete
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user