mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Merge branch 'release/4.0.0' into dev
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"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -2,21 +2,21 @@
|
|||||||
-- @module ThisModule@X.Y.Z
|
-- @module ThisModule@X.Y.Z
|
||||||
-- @author <get from json>
|
-- @author <get from json>
|
||||||
-- @license <get from json>
|
-- @license <get from json>
|
||||||
-- @alais ThisModule
|
-- @alias ThisModule
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Module = require('Module@>X.Y.Z')
|
local Module = require('Module')
|
||||||
local SubModule = require('Collection.Submodule@^X.Y.Z')
|
local SubModule = require('Collection.Submodule')
|
||||||
local OptModule -- OptModule@^X.Y.Z
|
local OptModule -- OptModule@^X.Y.Z
|
||||||
|
|
||||||
-- Local Varibles
|
-- Local Variables
|
||||||
|
|
||||||
-- Module Define
|
-- Module Define
|
||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local ThisModule = {
|
local ThisModule = {
|
||||||
on_init=function(self)
|
on_init=function(self)
|
||||||
if loaded_modules['OptModule@^X.Y.Z'] then OptModule = require('OptModule@^X.Y.Z') end
|
if loaded_modules['OptModule'] then OptModule = require('OptModule') end
|
||||||
if loaded_modules['OptModule2@^X.Y.Z'] then require(module_path..'/src/module2',{self=self}) end
|
if loaded_modules['OptModule2'] then require(module_path..'/src/module2',{self=self}) end
|
||||||
--code
|
--code
|
||||||
end,
|
end,
|
||||||
on_post=function()
|
on_post=function()
|
||||||
@@ -34,4 +34,4 @@ local global = global{
|
|||||||
-- Event Handlers Define
|
-- Event Handlers Define
|
||||||
|
|
||||||
-- Module Return
|
-- Module Return
|
||||||
return ThisModule
|
return ThisModule
|
||||||
1
Factorio-luacheckrc
Submodule
1
Factorio-luacheckrc
Submodule
Submodule Factorio-luacheckrc added at 0c0518d165
@@ -7,7 +7,7 @@ local moduleIndex = require("/modules/index")
|
|||||||
local Manager = {}
|
local Manager = {}
|
||||||
|
|
||||||
-- this is a constant that is used to represent the server
|
-- 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},{__index=function(tbl,key) if type(game.players[1][key]) == 'function' then return function() end else return nil end end})
|
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
|
--- Setup for metatable of the Manager to force read only nature
|
||||||
-- @usage Manager() -- runs Manager.loadModdules()
|
-- @usage Manager() -- runs Manager.loadModdules()
|
||||||
@@ -74,9 +74,9 @@ Manager.verbose = function(rtn,action)
|
|||||||
local settings = Manager.setVerbose
|
local settings = Manager.setVerbose
|
||||||
local state = Manager.currentState
|
local state = Manager.currentState
|
||||||
if Manager.error and state == Manager.error.__crash then return end
|
if Manager.error and state == Manager.error.__crash then return end
|
||||||
-- if ran in a module the the global module_name is present
|
-- if ran in a module the the global moduleName is present
|
||||||
local rtn = type(rtn) == table and serpent.line(rtn) or tostring(rtn)
|
local rtn = type(rtn) == table and serpent.line(rtn) or tostring(rtn)
|
||||||
if module_name then rtn='['..module_name..'] '..rtn
|
if moduleName then rtn='['..moduleName..'] '..rtn
|
||||||
else rtn='[FSM] '..rtn end
|
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
|
-- 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 action is true then it will always trigger verbose
|
||||||
@@ -178,10 +178,10 @@ Manager.global=setmetatable({__defaults={},__global={
|
|||||||
-- creates varible link to global and module information, use of a metatable is for already formed globals
|
-- creates varible link to global and module information, use of a metatable is for already formed globals
|
||||||
local Global = _G.global
|
local Global = _G.global
|
||||||
local metatable = getmetatable(metatable_src)
|
local metatable = getmetatable(metatable_src)
|
||||||
local module_name = type(default) == 'string' and default or metatable and metatable._module_name or module_name
|
local moduleName = type(default) == 'string' and default or metatable and metatable._moduleName or moduleName
|
||||||
local module_path = type(default) == 'string' and moduleIndex[default] or metatable and metatable._module_path or module_path
|
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 there is no name or path then it will return and unedited version of global
|
||||||
if not module_path or not module_name then return _G.global end
|
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
|
-- edits the link to global to be the corrected dir, path varible is also created
|
||||||
local path = 'global'
|
local path = 'global'
|
||||||
for dir in module_path:gmatch('%a+') do
|
for dir in module_path:gmatch('%a+') do
|
||||||
@@ -190,14 +190,14 @@ Manager.global=setmetatable({__defaults={},__global={
|
|||||||
Global = rawget(Global,dir)
|
Global = rawget(Global,dir)
|
||||||
end
|
end
|
||||||
-- the default value is set if there was a default given
|
-- 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(module_name),default) end
|
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 the default value is true then it will reset the global to its default
|
||||||
if default == true and rawget(rawget(tbl,'__defaults'),tostring(module_name)) then
|
if default == true and rawget(rawget(tbl,'__defaults'),tostring(moduleName)) then
|
||||||
Manager.verbose('Reset Global Dir to default: '..path)
|
Manager.verbose('Reset Global Dir to default: '..path)
|
||||||
-- cant set it to be equle otherwise it will lose its global propeity
|
-- 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
|
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(Global) do rawset(Global,key,nil) end
|
||||||
for key,value in pairs(rawget(rawget(tbl,'__defaults'),tostring(module_name))) do rawset(Global,key,deepcopy(value)) end
|
for key,value in pairs(rawget(rawget(tbl,'__defaults'),tostring(moduleName))) do rawset(Global,key,deepcopy(value)) end
|
||||||
end
|
end
|
||||||
-- the metatable is remade if not already present
|
-- the metatable is remade if not already present
|
||||||
metatable = metatable or {
|
metatable = metatable or {
|
||||||
@@ -212,7 +212,7 @@ Manager.global=setmetatable({__defaults={},__global={
|
|||||||
end
|
end
|
||||||
return next_pair, tbl, nil
|
return next_pair, tbl, nil
|
||||||
end,
|
end,
|
||||||
_module_path=module_path,_module_name=module_name
|
_module_path=module_path,_moduleName=moduleName
|
||||||
}
|
}
|
||||||
return setmetatable(Global,metatable)
|
return setmetatable(Global,metatable)
|
||||||
end,
|
end,
|
||||||
@@ -286,7 +286,7 @@ Manager.require = setmetatable({
|
|||||||
},{
|
},{
|
||||||
__metatable=false,
|
__metatable=false,
|
||||||
__index=function(tbl,key) return tbl(key,nil,true) end,
|
__index=function(tbl,key) return tbl(key,nil,true) end,
|
||||||
__call=function(tbl,path,env,mute)
|
__call=function(tbl,path,env,mute,noLoad)
|
||||||
local raw_require = rawget(tbl,'__require')
|
local raw_require = rawget(tbl,'__require')
|
||||||
local env = env or {}
|
local env = env or {}
|
||||||
-- runs in a sand box becuase sandbox everything
|
-- runs in a sand box becuase sandbox everything
|
||||||
@@ -295,23 +295,23 @@ Manager.require = setmetatable({
|
|||||||
if success then return unpack(data)
|
if success then return unpack(data)
|
||||||
else
|
else
|
||||||
if type(path) ~= 'string' then error('Path supplied must be a string; got: '..type(path),2) return end
|
if type(path) ~= 'string' then error('Path supplied must be a string; got: '..type(path),2) return end
|
||||||
-- else it assums the path was a module name and checks index for the module
|
local override = {}
|
||||||
if moduleIndex[path] then return rawget(Manager.loadModules,path) end
|
local softmod = override
|
||||||
if moduleIndex[path:gsub('?','')] then return rawget(Manager.loadModules,path) end
|
local path = path:find('@') and path:sub(1,path:find('@')-1) or path
|
||||||
-- if its not listed then it tries to remove a version tag and tries again
|
-- tries to load the module from the modeul index
|
||||||
local path_no_version = path:find('@') and path:sub(1,path:find('@')-1) or path
|
if moduleIndex[path] and not noLoad or Manager.loadModules.__load[path] then softmod = Manager.loadModules[path] end
|
||||||
if moduleIndex[path_no_version] then return rawget(Manager.loadModules,path_no_version) end
|
-- will then look for any submodules if there are any; only once every module is loaded
|
||||||
-- still no then it will look for all modules that include this one in the name (like a collection)
|
for moduleName,subpath in pairs(moduleIndex) do
|
||||||
local collection = {}
|
if moduleName:find(path) == 1 and moduleName ~= path then
|
||||||
for module_name,path in pairs(moduleIndex) do
|
local start, _end = moduleName:find(path)
|
||||||
if module_name:find('@') and module_name:sub(1,module_name:find('@')-1) == path_no_version then return rawget(Manager.loadModules,module_name) end
|
local subname = moduleName:sub(_end+2)
|
||||||
if module_name:find(path_no_version) then
|
-- does not add the module if it is a subsubmodule; or the key already exitsts
|
||||||
local start, _end = module_name:find(path_no_version)
|
if not softmod then softmod = {} end
|
||||||
collection[module_name:sub(_end+2)] = rawget(Manager.loadModules,module_name)
|
if not subname:find('.',nil,true) and not softmod[subname] then softmod[subname] = Manager.require(moduleName,nil,true,true) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- if there is any keys in the collection the collection is returned else the errors with the require error
|
-- if there is any keys in the softmod it is returned else the errors with the require error
|
||||||
for _ in pairs(collection) do return collection end
|
if override ~= softmod then return softmod end
|
||||||
if mute then return false else error(data,2) end
|
if mute then return false else error(data,2) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -324,95 +324,134 @@ require = Manager.require
|
|||||||
-- @usage #Manager.loadModules -- returns the number of modules loaded
|
-- @usage #Manager.loadModules -- returns the number of modules loaded
|
||||||
-- @usage tostring(Manager.loadModules) -- returns a formatted list of all 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
|
-- @usage pairs(Manager.loadModules) -- loops over the loaded modules moduleName, module
|
||||||
Manager.loadModules = setmetatable({},
|
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,
|
__metatable=false,
|
||||||
__index=Manager.require,
|
__index=function(self,moduleName)
|
||||||
__call=function(tbl)
|
-- will load one module if it is not already loaded, will not init during load state or post
|
||||||
-- ReadOnlyManager used to trigger verbose change
|
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'
|
ReadOnlyManager.currentState = 'moduleLoad'
|
||||||
-- goes though the index looking for modules
|
for moduleName,path in pairs(moduleIndex) do self.__load(moduleName) end
|
||||||
for module_name,path in pairs(moduleIndex) do
|
|
||||||
Manager.verbose('Loading module: "'..module_name..'"; path: '..path)
|
|
||||||
-- runs the module in a sandbox env
|
|
||||||
local success, module, sandbox = Manager.sandbox(Manager.require.__require,{module_name=setupModuleName(module_name),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 "'..module_name..'": '..globals:sub(1,-3),'errorCaught') end
|
|
||||||
Manager.verbose('Successfully loaded: "'..module_name..'"; path: '..path)
|
|
||||||
-- sets that it has been loaded and adds to the loaded index
|
|
||||||
-- if you prefere module_exports can be used rather than returning the module
|
|
||||||
if type(tbl[module_name]) == 'nil' then
|
|
||||||
-- if it is a new module then creat the new index
|
|
||||||
if sandbox.module_exports and type(sandbox.module_exports) == 'table'
|
|
||||||
then tbl[module_name] = sandbox.module_exports
|
|
||||||
else tbl[module_name] = table.remove(module,1) end
|
|
||||||
elseif type(tbl[module_name]) == 'table' then
|
|
||||||
-- if this module adds onto an existing one then append the keys
|
|
||||||
if sandbox.module_exports and type(sandbox.module_exports) == 'table'
|
|
||||||
then for key,value in pairs(sandbox.module_exports) do tbl[module_name][key] = value end
|
|
||||||
else for key,value in pairs(table.remove(module,1)) do tbl[module_name][key] = value end end
|
|
||||||
else
|
|
||||||
-- 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
|
|
||||||
tbl[module_name] = setmetatable({__old=tbl[module_name]},{
|
|
||||||
__call=function(tbl,...) if type(tbl.__old) == 'function' then tbl.__old(...) else return tbl.__old end end,
|
|
||||||
__tostring=function(tbl) return tbl.__old end,
|
|
||||||
__concat=function(tbl,val) return tbl.__old..val end
|
|
||||||
})
|
|
||||||
-- same as above for adding the keys to the table
|
|
||||||
if sandbox.module_exports and type(sandbox.module_exports) == 'table'
|
|
||||||
then for key,value in pairs(sandbox.module_exports) do tbl[module_name][key] = value end
|
|
||||||
else for key,value in pairs(table.remove(module,1)) do tbl[module_name][key] = value end end
|
|
||||||
end
|
|
||||||
-- if there is a module by this name in _G ex table then it will be indexed to the new module
|
|
||||||
if rawget(_G,module_name) and type(tbl[module_name]) == 'table' then setmetatable(rawget(_G,module_name),{__index=tbl[module_name]}) end
|
|
||||||
if type(tbl[module_name]) == 'table' then tbl[module_name]._module_path = path tbl[module_name]._module_name = module_name end
|
|
||||||
else
|
|
||||||
Manager.verbose('Failed load: "'..module_name..'"; path: '..path..' ('..module..')','errorCaught')
|
|
||||||
for event_name,callbacks in pairs(Manager.event) do Manager.verbose('Removed Event Handler: "'..module_name..'/'..Manager.event.names[event_name],'eventRegistered') callbacks[module_name] = nil end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- new state for the manager to allow control of verbose
|
|
||||||
ReadOnlyManager.currentState = 'moduleInit'
|
|
||||||
-- 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
|
-- 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
|
||||||
for module_name,data in pairs(tbl) do
|
ReadOnlyManager.currentState = 'moduleInit'
|
||||||
-- looks for init so that init or on_init can be used
|
for moduleName,path in pairs(self) do
|
||||||
if type(data) == 'table' and data.init and data.on_init == nil then data.on_init = data.init data.init = nil end
|
if moduleName ~= '__load' and moduleName ~= '__init' and moduleName ~= '__post' then self.__init(moduleName) end
|
||||||
if type(data) == 'table' and data.on_init and type(data.on_init) == 'function' then
|
|
||||||
Manager.verbose('Initiating module: "'..module_name..'"')
|
|
||||||
local success, err = Manager.sandbox(data.on_init,{module_name=setupModuleName(module_name),module_path=moduleIndex[tostring(module_name)]},data)
|
|
||||||
if success then
|
|
||||||
Manager.verbose('Successfully Initiated: "'..module_name..'"')
|
|
||||||
else
|
|
||||||
Manager.verbose('Failed Initiation: "'..module_name..'" ('..err..')','errorCaught')
|
|
||||||
end
|
|
||||||
-- clears the init function so it cant be used in runtime
|
|
||||||
data.on_init = nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
-- new state for the manager to allow control of verbose
|
|
||||||
ReadOnlyManager.currentState = 'modulePost'
|
|
||||||
-- 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
|
-- 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
|
||||||
for module_name,data in pairs(tbl) do
|
ReadOnlyManager.currentState = 'modulePost'
|
||||||
-- looks for post so that post or on_post can be used
|
for moduleName,path in pairs(self) do
|
||||||
if type(data) == 'table' and data.post and data.on_post == nil then data.on_post = data.post data.post = nil end
|
if moduleName ~= '__load' and moduleName ~= '__init' and moduleName ~= '__post' then self.__post(moduleName) end
|
||||||
if type(data) == 'table' and data.on_post and type(data.on_post) == 'function' then
|
|
||||||
Manager.verbose('Post for module: "'..module_name..'"')
|
|
||||||
local success, err = Manager.sandbox(data.on_post,{module_name=setupModuleName(module_name),module_path=moduleIndex[tostring(module_name)]},data)
|
|
||||||
if success then
|
|
||||||
Manager.verbose('Successful post: "'..module_name..'"')
|
|
||||||
else
|
|
||||||
Manager.verbose('Failed post: "'..module_name..'" ('..err..')','errorCaught')
|
|
||||||
end
|
|
||||||
-- clears the post function so it cant be used in runtime
|
|
||||||
data.on_post = nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
-- this could also be called runtime
|
|
||||||
ReadOnlyManager.currentState = 'moduleEnv'
|
ReadOnlyManager.currentState = 'moduleEnv'
|
||||||
end,
|
end,
|
||||||
__len=function(tbl)
|
__len=function(tbl)
|
||||||
@@ -421,13 +460,13 @@ Manager.loadModules = setmetatable({},
|
|||||||
for key,value in pairs(tbl) do
|
for key,value in pairs(tbl) do
|
||||||
rtn = rtn + 1
|
rtn = rtn + 1
|
||||||
end
|
end
|
||||||
return rtn
|
return rtn-3
|
||||||
end,
|
end,
|
||||||
__tostring=function(tbl)
|
__tostring=function(tbl)
|
||||||
-- a concat of all the loaded modules
|
-- a concat of all the loaded modules
|
||||||
local rtn = 'Load Modules: '
|
local rtn = 'Load Modules: '
|
||||||
for key,value in pairs(tbl) do
|
for key,value in pairs(tbl) do
|
||||||
rtn=rtn..key..', '
|
if key ~= '__load' and key ~= '__init' and key ~= '__post' then rtn=rtn..key..', ' end
|
||||||
end
|
end
|
||||||
return rtn:sub(1,-3)
|
return rtn:sub(1,-3)
|
||||||
end
|
end
|
||||||
@@ -555,7 +594,7 @@ Manager.event = setmetatable({
|
|||||||
__load=script.on_load,
|
__load=script.on_load,
|
||||||
__config=script.on_configuration_changed,
|
__config=script.on_configuration_changed,
|
||||||
events=defines.events,
|
events=defines.events,
|
||||||
error_chache={}
|
error_cache={}
|
||||||
},{
|
},{
|
||||||
__metatable=false,
|
__metatable=false,
|
||||||
__call=function(tbl,event_name,new_callback,...)
|
__call=function(tbl,event_name,new_callback,...)
|
||||||
@@ -575,26 +614,26 @@ Manager.event = setmetatable({
|
|||||||
-- other wise raise the event and call every callback; no use of script.raise_event due to override
|
-- 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]
|
local event_functions = tbl.__events[event_name]
|
||||||
if type(event_functions) == 'table' then
|
if type(event_functions) == 'table' then
|
||||||
for module_name,callback in pairs(event_functions) do
|
for moduleName,callback in pairs(event_functions) do
|
||||||
-- loops over the call backs and which module it is from
|
-- loops over the call backs and which module it is from
|
||||||
if type(callback) ~= 'function' then error('Invalid Event Callback: "'..event_name..'/'..module_name..'"') end
|
if type(callback) ~= 'function' then error('Invalid Event Callback: "'..event_name..'/'..moduleName..'"') end
|
||||||
local success, err = Manager.sandbox(callback,{module_name=setupModuleName(module_name),module_path=moduleIndex[tostring(module_name)]},new_callback,...)
|
local success, err = Manager.sandbox(callback,{moduleName=setupModuleName(moduleName),module_path=Manager.loadModules.__load[tostring(moduleName)]},new_callback,...)
|
||||||
if not success then
|
if not success then
|
||||||
local chache = tbl.error_chache
|
local cache = tbl.error_cache
|
||||||
local error_message = 'Event Failed: "'..module_name..'/'..tbl.names[event_name]..'" ('..err..')'
|
local error_message = 'Event Failed: "'..moduleName..'/'..tbl.names[event_name]..'" ('..err..')'
|
||||||
if not chache[error_message] then Manager.verbose(error_message,'errorCaught') error(error_message) end
|
if not cache[error_message] then Manager.verbose(error_message,'errorCaught') error(error_message) end
|
||||||
if tbl.names[event_name] == 'on_tick' then
|
if tbl.names[event_name] == 'on_tick' then
|
||||||
if not chache[error_message] then chache[error_message] = {game.tick,1} end
|
if not cache[error_message] then cache[error_message] = {game.tick,1} end
|
||||||
if chache[error_message][1] >= game.tick-10 then chache[error_message] = {game.tick,chache[error_message][2]+1}
|
if cache[error_message][1] >= game.tick-10 then cache[error_message] = {game.tick,cache[error_message][2]+1}
|
||||||
else chache[error_message] = nil end
|
else cache[error_message] = nil end
|
||||||
if chache[error_message] and chache[error_message][2] > 100 then
|
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')
|
Manager.verbose('There was an error happening every tick for 100 ticks, the event handler has been removed!','errorCaught')
|
||||||
event_functions[module_name] = nil
|
event_functions[moduleName] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- if stop constant is returned then stop further processing
|
-- if stop constant is returned then stop further processing
|
||||||
if err == rawget(tbl,'__stop') then Manager.verbose('Event Haulted By: "'..module_name..'"','errorCaught') break end
|
if err == rawget(tbl,'__stop') then Manager.verbose('Event Haulted By: "'..moduleName..'"','errorCaught') break end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@@ -602,7 +641,7 @@ Manager.event = setmetatable({
|
|||||||
-- handles the creation of new event handlers
|
-- 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
|
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
|
-- checks for a global module name that is present
|
||||||
local module_name = module_name or 'FSM'
|
local moduleName = moduleName or 'FSM'
|
||||||
-- converts the key to a number index for the event
|
-- converts the key to a number index for the event
|
||||||
Manager.verbose('Added Handler: "'..tbl.names[key]..'"','eventRegistered')
|
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
|
-- 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
|
||||||
@@ -611,18 +650,18 @@ Manager.event = setmetatable({
|
|||||||
elseif key < 0 then rawget(tbl,tbl.names[key])(function(...) tbl(key,...) end)
|
elseif key < 0 then rawget(tbl,tbl.names[key])(function(...) tbl(key,...) end)
|
||||||
else rawget(tbl,'__event')(key,function(...) tbl(key,...) end) end
|
else rawget(tbl,'__event')(key,function(...) tbl(key,...) end) end
|
||||||
rawset(rawget(tbl,'__events'),key,{}) end
|
rawset(rawget(tbl,'__events'),key,{}) end
|
||||||
-- adds callback to Manager.event.__events[event_id][module_name]
|
-- adds callback to Manager.event.__events[event_id][moduleName]
|
||||||
rawset(rawget(rawget(tbl,'__events'),key),tostring(module_name),value)
|
rawset(rawget(rawget(tbl,'__events'),key),tostring(moduleName),value)
|
||||||
end,
|
end,
|
||||||
__index=function(tbl,key)
|
__index=function(tbl,key)
|
||||||
-- few redirect key
|
-- few redirect key
|
||||||
local redirect={register=tbl,dispatch=tbl,remove=function(event_id) tbl[event_name]=nil end}
|
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
|
if rawget(redirect,key) then return rawget(redirect,key) end
|
||||||
-- proforms different look ups depentding weather the current module has an event handler registered
|
-- proforms different look ups depentding weather the current module has an event handler registered
|
||||||
if module_name then
|
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
|
-- 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(module_name))
|
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(module_name))
|
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]
|
or rawget(tbl,'names')[key]
|
||||||
else
|
else
|
||||||
-- if there is no module present then it will return the full list of regisered handlers; or other wise the converted event id
|
-- if there is no module present then it will return the full list of regisered handlers; or other wise the converted event id
|
||||||
@@ -655,7 +694,7 @@ Manager.event = setmetatable({
|
|||||||
rawset(Manager.event,'names',setmetatable({},{
|
rawset(Manager.event,'names',setmetatable({},{
|
||||||
__index=function(tbl,key)
|
__index=function(tbl,key)
|
||||||
if type(key) == 'number' or tonumber(key) then
|
if type(key) == 'number' or tonumber(key) then
|
||||||
-- if it is a number then it will first look in the chache
|
-- if it is a number then it will first look in the cache
|
||||||
if rawget(tbl,key) then return rawget(tbl,key) end
|
if rawget(tbl,key) then return rawget(tbl,key) end
|
||||||
-- if it is a core event then it will simply return
|
-- if it is a core event then it will simply return
|
||||||
if key == -1 then rawset(tbl,key,'__init')
|
if key == -1 then rawset(tbl,key,'__init')
|
||||||
@@ -667,7 +706,7 @@ rawset(Manager.event,'names',setmetatable({},{
|
|||||||
if id == key then rawset(tbl,key,event) end
|
if id == key then rawset(tbl,key,event) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- returns the value from the chache after being loaded in
|
-- returns the value from the cache after being loaded in
|
||||||
return rawget(tbl,key)
|
return rawget(tbl,key)
|
||||||
-- if it is a string then no reverse look up is required
|
-- if it is a string then no reverse look up is required
|
||||||
else
|
else
|
||||||
@@ -702,7 +741,7 @@ script.on_load(function(...)
|
|||||||
end)
|
end)
|
||||||
--over rides for the base values; can be called though Event
|
--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})
|
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.module_name})
|
script.mod_name = setmetatable({},{__index=_G.moduleName})
|
||||||
script.on_event=Manager.event
|
script.on_event=Manager.event
|
||||||
script.raise_event=Manager.event
|
script.raise_event=Manager.event
|
||||||
script.on_init=function(callback) Manager.event(-1,callback) end
|
script.on_init=function(callback) Manager.event(-1,callback) end
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
<a href="http://github.com/explosivegaming/scenario/fork">
|
<a href="http://github.com/explosivegaming/scenario/fork">
|
||||||
<img src="https://img.shields.io/github/forks/explosivegaming/scenario.svg?label=Forks" alt="Fork">
|
<img src="https://img.shields.io/github/forks/explosivegaming/scenario.svg?label=Forks" alt="Fork">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.codefactor.io/repository/github/badgamernl/explosivegaming-main">
|
<a href="https://www.codefactor.io/repository/github/explosivegaming/scenario">
|
||||||
<img src="https://www.codefactor.io/repository/github/badgamernl/explosivegaming-main/badge" alt="CodeFactor">
|
<img src="https://www.codefactor.io/repository/github/explosivegaming/scenario/badge" alt="CodeFactor">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://discord.me/explosivegaming">
|
<a href="https://discord.me/explosivegaming">
|
||||||
<img src="https://discordapp.com/api/guilds/260843215836545025/widget.png?style=shield" alt="Discord">
|
<img src="https://discordapp.com/api/guilds/260843215836545025/widget.png?style=shield" alt="Discord">
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Manager.setVerbose{
|
|||||||
moduleLoad=false, -- when a module is required by the manager
|
moduleLoad=false, -- when a module is required by the manager
|
||||||
moduleInit=false, -- when and within the initation of a module
|
moduleInit=false, -- when and within the initation of a module
|
||||||
modulePost=false, -- when and within the post of a module
|
modulePost=false, -- when and within the post of a module
|
||||||
moduleEnv=true, -- during module runtime, this is a global option set within each module for fine control
|
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
|
eventRegistered=false, -- when a module registers its event handlers
|
||||||
errorCaught=true, -- when an error is caught during runtime
|
errorCaught=true, -- when an error is caught during runtime
|
||||||
output=Manager._verbose -- can be: can be: print || log || other function
|
output=Manager._verbose -- can be: can be: print || log || other function
|
||||||
|
|||||||
@@ -206,7 +206,7 @@
|
|||||||
<h3>Returns:</h3>
|
<h3>Returns:</h3>
|
||||||
<ol>
|
<ol>
|
||||||
|
|
||||||
<span class="types"><span class="type">boelon</span></span>
|
<span class="types"><span class="type">boolean</span></span>
|
||||||
based on if it successed or not
|
based on if it successed or not
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@
|
|||||||
<h3>Returns:</h3>
|
<h3>Returns:</h3>
|
||||||
<ol>
|
<ol>
|
||||||
|
|
||||||
<span class="types"><span class="type">boelon</span></span>
|
<span class="types"><span class="type">boolean</span></span>
|
||||||
based on if it successed or not
|
based on if it successed or not
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
<td class="summary">Prints to chat as if it were a player</td>
|
<td class="summary">Prints to chat as if it were a player</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name" nowrap><a href="#emit_embeded">emit_embeded (args)</a></td>
|
<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>
|
<td class="summary">Logs an embed to the json.data we use a js script to add things we cant here</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name" nowrap><a href="#EmitEmbededParamaters">EmitEmbededParamaters</a></td>
|
<td class="name" nowrap><a href="#EmitEmbededParamaters">EmitEmbededParamaters</a></td>
|
||||||
<td class="summary">Outline of the paramaters accepted by Sync.emit_embeded</td>
|
<td class="summary">Outline of the paramaters accepted by Sync.emit_embedded</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<h2><a href="#Fields">Fields</a></h2>
|
<h2><a href="#Fields">Fields</a></h2>
|
||||||
@@ -262,8 +262,8 @@
|
|||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<a name = "emit_embeded"></a>
|
<a name = "emit_embedded"></a>
|
||||||
<strong>emit_embeded (args)</strong>
|
<strong>emit_embedded (args)</strong>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
Logs an embed to the json.data we use a js script to add things we cant here
|
Logs an embed to the json.data we use a js script to add things we cant here
|
||||||
@@ -273,7 +273,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li><span class="parameter">args</span>
|
<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>
|
<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 embeded will use
|
a table which contains everything that the embedded will use
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@@ -286,7 +286,7 @@
|
|||||||
|
|
||||||
<h3>Usage:</h3>
|
<h3>Usage:</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<pre class="example">Sync.emit_embeded{title=<span class="string">'BAN'</span>,color=<span class="string">'0x0'</span>,description=<span class="string">'A player was banned'</span> ... }</pre>
|
<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>
|
</ul>
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
@@ -592,7 +592,7 @@
|
|||||||
<strong>EmitEmbededParamaters</strong>
|
<strong>EmitEmbededParamaters</strong>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
Outline of the paramaters accepted by Sync.emit_embeded
|
Outline of the paramaters accepted by Sync.emit_embedded
|
||||||
|
|
||||||
|
|
||||||
<h3>Fields:</h3>
|
<h3>Fields:</h3>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[ExpGamingAdmin-Warnings-4-0-0]
|
[ExpGamingAdmin-Warnings]
|
||||||
warning-given-by=This Warnings Was Given By: __1__
|
warning-given-by=This Warnings Was Given By: __1__
|
||||||
player-warning=__1__ was given a warning by __2__ reason: __3__
|
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
|
temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[ExpGamingAdmin-Warnings-4-0-0]
|
[ExpGamingAdmin-Warnings]
|
||||||
warning-given-by=This warning was given by: __1__
|
warning-given-by=This warning was given by: __1__
|
||||||
player-warning=__1__ was given a warning by __2__ for: __3__
|
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__
|
remove-warn=One of your warnings expired. You have __1__ warnings left, next warning will be removed in __2__
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[ExpGamingAdmin-Warnings-4-0-0]
|
[ExpGamingAdmin-Warnings]
|
||||||
warning-given-by=This Warnings Was Given By: __1__
|
warning-given-by=This Warnings Was Given By: __1__
|
||||||
player-warning=__1__ was given a warning by __2__ reason: __3__
|
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
|
temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[ExpGamingAdmin-Warnings-4-0-0]
|
[ExpGamingAdmin-Warnings]
|
||||||
warning-given-by=Deze waarschuwing is gegeven door: __1__
|
warning-given-by=Deze waarschuwing is gegeven door: __1__
|
||||||
player-warning=__1__ is gewaarschuwd door __2__ met de reden: __3__
|
player-warning=__1__ is gewaarschuwd door __2__ met de reden: __3__
|
||||||
temp-ban=__1__ is verbannen door __2__ en is gejailed tot de volgende reset.
|
temp-ban=__1__ is verbannen door __2__ en is gejailed tot de volgende reset.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[ExpGamingAdmin-Warnings-4-0-0]
|
[ExpGamingAdmin-Warnings]
|
||||||
warning-given-by=Den här varningen gavs av: __1__
|
warning-given-by=Den här varningen gavs av: __1__
|
||||||
player-warning=__1__ var tillfälligt bannlyst av __2__ och kommer att förbli i fängelset tills nästa återställning (reset)
|
player-warning=__1__ var tillfälligt bannlyst av __2__ och kommer att förbli i fängelset tills nästa återställning (reset)
|
||||||
remove-warn=En av dina varningar har gått ut. Du har __1__ varning kvar, nästa varning kommer at tas bort om __2__
|
remove-warn=En av dina varningar har gått ut. Du har __1__ varning kvar, nästa varning kommer at tas bort om __2__
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
-- @module AdvancedStartingItems@4.0.0
|
-- @module AdvancedStartingItems@4.0.0
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais ThisModule
|
-- @alias ThisModule
|
||||||
|
|
||||||
-- Local Varibles
|
-- Local Variables
|
||||||
local items = {
|
local items = {
|
||||||
['iron-plate']=function(player,made) if tick_to_min(game.tick) < 5 then return 8 else return (made*10)/math.pow(tick_to_min(game.tick),2) end end,
|
['iron-plate']=function(player,made) if tick_to_min(game.tick) < 5 then return 8 else return (made*10)/math.pow(tick_to_min(game.tick),2) end end,
|
||||||
['copper-plate']=function(player,made) if tick_to_min(game.tick) < 5 then return 0 else return (made*8)/math.pow(tick_to_min(game.tick),2) end end,
|
['copper-plate']=function(player,made) if tick_to_min(game.tick) < 5 then return 0 else return (made*8)/math.pow(tick_to_min(game.tick),2) end end,
|
||||||
@@ -12,9 +12,9 @@ local items = {
|
|||||||
['iron-gear-wheel']=function(player,made) if tick_to_min(game.tick) < 5 then return 0 else return (made*6)/math.pow(tick_to_min(game.tick),2) end end,
|
['iron-gear-wheel']=function(player,made) if tick_to_min(game.tick) < 5 then return 0 else return (made*6)/math.pow(tick_to_min(game.tick),2) end end,
|
||||||
['steel-plate']=function(player,made) if tick_to_min(game.tick) < 5 then return 0 else return(made*4)/math.pow(tick_to_min(game.tick),2) end end,
|
['steel-plate']=function(player,made) if tick_to_min(game.tick) < 5 then return 0 else return(made*4)/math.pow(tick_to_min(game.tick),2) end end,
|
||||||
['pistol']=function(player,made) if player.force.item_production_statistics.get_input_count('submachine-gun') > 5 then return 0 else return 1 end end,
|
['pistol']=function(player,made) if player.force.item_production_statistics.get_input_count('submachine-gun') > 5 then return 0 else return 1 end end,
|
||||||
['submachine-gun']=function(player,made) if made > 5 then return 1 else return 0 end end,
|
['submachine-gun']=function(player,made) if made > 5 then return 1 else return 0 end end,
|
||||||
['firearm-magazine']=function(player,made) if player.force.item_production_statistics.get_input_count('piercing-rounds-magazine') > 100 then return 0 else return 10 end end,
|
['firearm-magazine']=function(player,made) if player.force.item_production_statistics.get_input_count('piercing-rounds-magazine') > 100 then return 0 else return 10 end end,
|
||||||
['piercing-rounds-magazine']=function(player,made) if made > 100 then return 10 else return 0 end end,
|
['piercing-rounds-magazine']=function(player,made) if made > 100 then return 10 else return 0 end end,
|
||||||
['light-armor']=function(player,made) if made > 5 and player.force.item_production_statistics.get_input_count('heavy-armor') <= 5 then return 1 else return 0 end end,
|
['light-armor']=function(player,made) if made > 5 and player.force.item_production_statistics.get_input_count('heavy-armor') <= 5 then return 1 else return 0 end end,
|
||||||
['heavy-armor']=function(player,made) if made > 5 then return 1 else return 0 end end,
|
['heavy-armor']=function(player,made) if made > 5 then return 1 else return 0 end end,
|
||||||
['burner-mining-drill']=function(player,made) if tick_to_min(game.tick) < 5 then return 4 else return 0 end end,
|
['burner-mining-drill']=function(player,made) if tick_to_min(game.tick) < 5 then return 4 else return 0 end end,
|
||||||
@@ -28,7 +28,7 @@ local module_verbose = false
|
|||||||
local ThisModule = {}
|
local ThisModule = {}
|
||||||
|
|
||||||
-- Event Handlers Define
|
-- Event Handlers Define
|
||||||
Event.register(defines.events.on_player_created, function(event)
|
script.on_event(defines.events.on_player_created, function(event)
|
||||||
local player = game.players[event.player_index]
|
local player = game.players[event.player_index]
|
||||||
if event.player_index == 1 then
|
if event.player_index == 1 then
|
||||||
player.force.friendly_fire = false
|
player.force.friendly_fire = false
|
||||||
@@ -42,4 +42,4 @@ Event.register(defines.events.on_player_created, function(event)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- Module Return
|
-- Module Return
|
||||||
return ThisModule
|
return ThisModule
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
{
|
{
|
||||||
"name": "AdvancedStartingItems",
|
"name": "AdvancedStartingItems",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Module",
|
"description": "Adds a better method of player starting items based on production levels.",
|
||||||
"description": "Adds a better method of player starting items based on production levels.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Inventory",
|
||||||
"Inventory",
|
"Start",
|
||||||
"Start",
|
"Items",
|
||||||
"Items",
|
"Player",
|
||||||
"Player",
|
"Advanced",
|
||||||
"Advanced",
|
"Useful",
|
||||||
"Useful",
|
"Balaced"
|
||||||
"Balaced"
|
],
|
||||||
],
|
"author": "Cooldude2606",
|
||||||
"author": "Cooldude2606",
|
"contact": "Discord: Cooldude2606#5241",
|
||||||
"contact": "Discord: Cooldude2606#5241",
|
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
||||||
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
"dependencies": {},
|
||||||
"dependencies": {}
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
-- @module ChatPopup@4.0.0
|
-- @module ChatPopup@4.0.0
|
||||||
-- @author badgamernl
|
-- @author badgamernl
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais ChatPopup
|
-- @alias ChatPopup
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
local Color = require('FactorioStdLib.Color@^0.8.0')
|
local Color = require('FactorioStdLib.Color')
|
||||||
|
|
||||||
local ChatPopup = {}
|
local ChatPopup = {}
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ function ChatPopup.sendFlyingText(player, text)
|
|||||||
for i=1, #text, chunkSize do
|
for i=1, #text, chunkSize do
|
||||||
chunks[#chunks+1] = text:sub(i,i+chunkSize - 1)
|
chunks[#chunks+1] = text:sub(i,i+chunkSize - 1)
|
||||||
end
|
end
|
||||||
-- Itterate over text chunks and create them as floating text centered above the player
|
-- Iterate over text chunks and create them as floating text centered above the player
|
||||||
-- Disabled false centering because of not being able to disable scaling: (1 / 7.9 * #value)
|
-- Disabled false centering because of not being able to disable scaling: (1 / 7.9 * #value)
|
||||||
for i,value in ipairs(chunks) do
|
for i,value in ipairs(chunks) do
|
||||||
_player.surface.create_entity{
|
_player.surface.create_entity{
|
||||||
@@ -31,11 +31,11 @@ function ChatPopup.sendFlyingText(player, text)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Event.register(defines.events.on_console_chat, function(event)
|
script.on_event(defines.events.on_console_chat, function(event)
|
||||||
local player = game.players[event.player_index]
|
local player = game.players[event.player_index]
|
||||||
if not player then return end
|
if not player then return end
|
||||||
if not event.message then return end
|
if not event.message then return end
|
||||||
|
|
||||||
-- Send message player send to player itself
|
-- Send message player send to player itself
|
||||||
local message = player.name .. ': ' .. event.message
|
local message = player.name .. ': ' .. event.message
|
||||||
ChatPopup.sendFlyingText(player, message)
|
ChatPopup.sendFlyingText(player, message)
|
||||||
@@ -50,7 +50,7 @@ Event.register(defines.events.on_console_chat, function(event)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return ChatPopup
|
return ChatPopup
|
||||||
@@ -1,15 +1,21 @@
|
|||||||
{
|
{
|
||||||
"name": "ChatPopup",
|
"name": "ChatPopup",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Module",
|
|
||||||
"description": "Creates flying text above player when they send a message.",
|
"description": "Creates flying text above player when they send a message.",
|
||||||
"location": "<blank>",
|
"location": "FSM_ARCHIVE",
|
||||||
"keywords": ["Chat", "Popup", "Mention", "Floating", "Text"],
|
"keywords": [
|
||||||
|
"Chat",
|
||||||
|
"Popup",
|
||||||
|
"Mention",
|
||||||
|
"Floating",
|
||||||
|
"Text"
|
||||||
|
],
|
||||||
"author": "badgamernl",
|
"author": "badgamernl",
|
||||||
"contact": "badgamernl@gmail.com",
|
"contact": "badgamernl@gmail.com",
|
||||||
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"FactorioStdLib.Game": "0.8.0",
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
"FactorioStdLib.Color": "^0.8.0"
|
"FactorioStdLib.Color": "^0.8.0"
|
||||||
}
|
},
|
||||||
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
--- When a entibty is damaged y a player it will show how much damage you've dealth, When a player gets attacked by a entity it will popup the player's health in color.
|
--- When a entity is damaged y a player it will show how much damage you've death, When a player gets attacked by a entity it will popup the player's health in color.
|
||||||
-- @module DamagePopup@4.0.0
|
-- @module DamagePopup@4.0.0
|
||||||
-- @author badgamernl
|
-- @author badgamernl
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais DamagePopup
|
-- @alias DamagePopup
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Color = require('FactorioStdLib.Color@^0.8.0')
|
local Color = require('FactorioStdLib.Color')
|
||||||
|
|
||||||
local DamagePopup = {}
|
local DamagePopup = {}
|
||||||
|
|
||||||
Event.register(defines.events.on_entity_damaged, function(event)
|
script.on_event(defines.events.on_entity_damaged, function(event)
|
||||||
local entity = event.entity
|
local entity = event.entity
|
||||||
local cause = event.cause
|
local cause = event.cause
|
||||||
local damage = event.original_damage_amount
|
local damage = event.original_damage_amount
|
||||||
local health = entity.health
|
local health = entity.health
|
||||||
-- local pre_attack_health = health + damage -- Didn't use it after all, maybe usefull later
|
-- local pre_attack_health = health + damage -- Didn't use it after all, maybe useful later
|
||||||
|
|
||||||
local color = defines.textcolor.crit
|
local color = defines.textcolor.crit
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ Event.register(defines.events.on_entity_damaged, function(event)
|
|||||||
entity.surface.create_entity{
|
entity.surface.create_entity{
|
||||||
name="flying-text",
|
name="flying-text",
|
||||||
color=defines.textcolor.med,
|
color=defines.textcolor.med,
|
||||||
text='-'..damage,
|
text='-'..math.floor(damage), -- cooldude2606 added floor for damage amount
|
||||||
position=entity.position
|
position=entity.position
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
{
|
{
|
||||||
"name": "DamagePopup",
|
"name": "DamagePopup",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Module",
|
|
||||||
"description": "When a entibty is damaged y a player it will show how much damage you've dealth, When a player gets attacked by a entity it will popup the player's health in color.",
|
"description": "When a entibty is damaged y a player it will show how much damage you've dealth, When a player gets attacked by a entity it will popup the player's health in color.",
|
||||||
"location": "<blank>",
|
"location": "FSM_ARCHIVE",
|
||||||
"keywords": ["Damage", "Popup", "Floating", "Text"],
|
"keywords": [
|
||||||
|
"Damage",
|
||||||
|
"Popup",
|
||||||
|
"Floating",
|
||||||
|
"Text"
|
||||||
|
],
|
||||||
"author": "badgamernl",
|
"author": "badgamernl",
|
||||||
"contact": "badgamernl@gmail.com",
|
"contact": "badgamernl@gmail.com",
|
||||||
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"FactorioStdLib.Color": "^0.8.0"
|
"FactorioStdLib.Color": "^0.8.0"
|
||||||
}
|
},
|
||||||
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
-- @module DeathMarkers@4.0.0
|
-- @module DeathMarkers@4.0.0
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais ThisModule
|
-- @alias ThisModule
|
||||||
|
|
||||||
-- Module Define
|
-- Module Define
|
||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
@@ -14,7 +14,7 @@ local global = global{
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- Event Handlers Define
|
-- Event Handlers Define
|
||||||
Event.register(defines.events.on_player_died, function(event)
|
script.on_event(defines.events.on_player_died, function(event)
|
||||||
local player = game.players[event.player_index]
|
local player = game.players[event.player_index]
|
||||||
local tag = player.force.add_chart_tag(player.surface,{
|
local tag = player.force.add_chart_tag(player.surface,{
|
||||||
position=player.position,
|
position=player.position,
|
||||||
@@ -24,7 +24,7 @@ Event.register(defines.events.on_player_died, function(event)
|
|||||||
table.insert(global.corpses,tag)
|
table.insert(global.corpses,tag)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Event.register(defines.events.on_tick, function(event)
|
script.on_event(defines.events.on_tick, function(event)
|
||||||
if (game.tick%3600) ~= 0 then return end
|
if (game.tick%3600) ~= 0 then return end
|
||||||
if not global.corpses then global.corpses = {} end
|
if not global.corpses then global.corpses = {} end
|
||||||
local key = 1
|
local key = 1
|
||||||
@@ -42,4 +42,4 @@ Event.register(defines.events.on_tick, function(event)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- Module Return
|
-- Module Return
|
||||||
return ThisModule
|
return ThisModule
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "DeathMarkers",
|
"name": "DeathMarkers",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Module",
|
"description": "Adds markers to the map when a player dies and removes it when the body is removed.",
|
||||||
"description": "Adds markers to the map when a player dies and removes it when the body is removed.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Death",
|
||||||
"Death",
|
"Marker",
|
||||||
"Marker",
|
"Body",
|
||||||
"Body",
|
"Map"
|
||||||
"Map"
|
],
|
||||||
],
|
"author": "Cooldude2606",
|
||||||
"author": "Cooldude2606",
|
"contact": "Discord: Cooldude2606#5241",
|
||||||
"contact": "Discord: Cooldude2606#5241",
|
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
||||||
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
"dependencies": {},
|
||||||
"dependencies": {}
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,20 +2,20 @@
|
|||||||
-- @module DeconControl@4.0.0
|
-- @module DeconControl@4.0.0
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais ThisModule
|
-- @alias ThisModule
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
local Server = require('ExpGamingCore.Server@^4.0.0')
|
local Server = require('ExpGamingCore.Server')
|
||||||
local Role -- ExpGamingCore.Role@^4.0.0
|
local Role -- ExpGamingCore.Role@^4.0.0
|
||||||
local Admin -- ExpGamingAdmin.AdminLib@^4.0.0
|
local Admin -- ExpGamingAdmin@^4.0.0
|
||||||
|
|
||||||
-- Module Define
|
-- Module Define
|
||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local ThisModule = {
|
local ThisModule = {
|
||||||
on_init=function()
|
on_init=function()
|
||||||
if loaded_modules['ExpGamingCore.Role@^4.0.0'] then Role = require('ExpGamingCore.Role@^4.0.0') end
|
if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end
|
||||||
if loaded_modules['ExpGamingAdmin.AdminLib@^4.0.0'] then Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') end
|
if loaded_modules['ExpGamingAdmin'] then Admin = require('ExpGamingAdmin') end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,40 +23,40 @@ local ThisModule = {
|
|||||||
Event.register(-1,function(event)
|
Event.register(-1,function(event)
|
||||||
Server.new_thread{
|
Server.new_thread{
|
||||||
name='tree-decon',
|
name='tree-decon',
|
||||||
data={trees={},chache={},clear=0}
|
data={trees={},cache={},clear=0}
|
||||||
}:on_event('tick',function(self)
|
}:on_event('tick',function(self)
|
||||||
local trees = self.data.trees
|
local trees = self.data.trees
|
||||||
if self.data.clear ~= 0 and self.data.clear < game.tick then self.data.chache = {} self.data.clear = 0 end
|
if self.data.clear ~= 0 and self.data.clear < game.tick then self.data.cache = {} self.data.clear = 0 end
|
||||||
if #trees == 0 then return end
|
if #trees == 0 then return end
|
||||||
for i = 0,math.ceil(#trees/10) do
|
for i = 0,math.ceil(#trees/10) do
|
||||||
local tree = table.remove(trees,1)
|
local tree = table.remove(trees,1)
|
||||||
if tree and tree.valid then tree.destroy() end
|
if tree and tree.valid then tree.destroy() end
|
||||||
end
|
end
|
||||||
end):on_event(defines.events.on_marked_for_deconstruction,function(self,event)
|
end):on_event(defines.events.on_marked_for_deconstruction,function(self,event)
|
||||||
local chache = self.data.chache[event.player_index]
|
local cache = self.data.cache[event.player_index]
|
||||||
if not chache then
|
if not cache then
|
||||||
local player = Game.get_player(event)
|
local player = Game.get_player(event)
|
||||||
if not player then return end
|
if not player then return end
|
||||||
if not Role then
|
if not Role then
|
||||||
if player.admin then self.data.chache[event.player_index] = {'tree-decon',false}
|
if player.admin then self.data.cache[event.player_index] = {'tree-decon',false}
|
||||||
else self.data.chache[event.player_index] = {'decon',false} end
|
else self.data.cache[event.player_index] = {'decon',false} end
|
||||||
else
|
else
|
||||||
if Role.allowed(player,'tree-decon') then self.data.chache[event.player_index] = {'tree-decon',false}
|
if Role.allowed(player,'tree-decon') then self.data.cache[event.player_index] = {'tree-decon',false}
|
||||||
elseif not Role.allowed(player,'decon') then self.data.chache[event.player_index] = {'no-decon',false}
|
elseif not Role.allowed(player,'decon') then self.data.cache[event.player_index] = {'no-decon',false}
|
||||||
else self.data.chache[event.player_index] = {'decon',false} end
|
else self.data.cache[event.player_index] = {'decon',false} end
|
||||||
end
|
end
|
||||||
chache = self.data.chache[event.player_index]
|
cache = self.data.cache[event.player_index]
|
||||||
end
|
end
|
||||||
if not event.entity.last_user or event.entity.name == 'entity-ghost' then
|
if not event.entity.last_user or event.entity.name == 'entity-ghost' then
|
||||||
if chache[1] == 'tree-decon' then
|
if cache[1] == 'tree-decon' then
|
||||||
table.insert(self.data.trees,event.entity)
|
table.insert(self.data.trees,event.entity)
|
||||||
self.data.clear = game.tick + 10
|
self.data.clear = game.tick + 10
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if chache[1] == 'no-decon' then
|
if cache[1] == 'no-decon' then
|
||||||
event.entity.cancel_deconstruction('player')
|
event.entity.cancel_deconstruction('player')
|
||||||
if not chache[2] then
|
if not cache[2] then
|
||||||
chache[2] = true
|
cache[2] = true
|
||||||
local player = Game.get_player(event)
|
local player = Game.get_player(event)
|
||||||
player_return({'DeconControl.player-print'},defines.textcolor.crit,player)
|
player_return({'DeconControl.player-print'},defines.textcolor.crit,player)
|
||||||
Role.print(Role.meta.groups.Admin.lowest,{'DeconControl.rank-print',player.name},defines.textcolor.info)
|
Role.print(Role.meta.groups.Admin.lowest,{'DeconControl.rank-print',player.name},defines.textcolor.info)
|
||||||
@@ -69,4 +69,4 @@ Event.register(-1,function(event)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- Module Return
|
-- Module Return
|
||||||
return ThisModule
|
return ThisModule
|
||||||
@@ -1,25 +1,26 @@
|
|||||||
{
|
{
|
||||||
"name": "DeconControl",
|
"name": "DeconControl",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Module",
|
"description": "Allows control over decon rights, if ExpGamingCore.Role is not installed it will allow admins to instant remove trees and thats it.",
|
||||||
"description": "Allows control over decon rights, if ExpGamingCore.Role is not installed it will allow admins to instant remove trees and thats it.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Trees",
|
||||||
"Trees",
|
"Decon",
|
||||||
"Decon",
|
"Protection",
|
||||||
"Protection",
|
"Admin",
|
||||||
"Admin",
|
"Tool",
|
||||||
"Tool",
|
"Report"
|
||||||
"Report"
|
],
|
||||||
],
|
"author": "Cooldude2606",
|
||||||
"author": "Cooldude2606",
|
"contact": "Discord: Cooldude2606#5241",
|
||||||
"contact": "Discord: Cooldude2606#5241",
|
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
||||||
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingCore.Server": "^4.0.0",
|
||||||
"ExpGamingCore.Server": "^4.0.0",
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
"ExpGamingLib": "^4.0.0",
|
||||||
"ExpGamingLib": "^4.0.0",
|
"ExpGamingAdmin.Warnings": "?^4.0.0",
|
||||||
"ExpGamingAdmin.Warnings": "?^4.0.0",
|
"ExpGamingCore.Role": "?^4.0.0",
|
||||||
"ExpGamingCore.Role": "?^4.0.0"
|
"ExpGamingAdmin": "?^4.0.0"
|
||||||
}
|
},
|
||||||
}
|
"submodules": {}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "AdminLib",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "The base functions required to make the others work.",
|
|
||||||
"location": "<blank>",
|
|
||||||
"keywords": [
|
|
||||||
"lib",
|
|
||||||
"ExpGaming",
|
|
||||||
"Admin"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"FactorioStdLib": "^0.8.0",
|
|
||||||
"ExpGamingCore.Role": "?^4.0.0",
|
|
||||||
"ExpGamingCore.Sync": "?^4.0.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
|
||||||
}
|
|
||||||
@@ -2,13 +2,13 @@
|
|||||||
-- @module ExpGamingAdmin.Ban@4.0.0
|
-- @module ExpGamingAdmin.Ban@4.0.0
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais ThisModule
|
-- @alias ThisModule
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0')
|
local Admin = require('ExpGamingAdmin')
|
||||||
local AdminGui = require('ExpGamingAdmin.Gui@^4.0.0')
|
local AdminGui = require('ExpGamingAdmin.Gui')
|
||||||
local Server = require('ExpGamingCore.Server@^4.0.0')
|
local Server = require('ExpGamingCore.Server')
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
local Color -- FactorioStdLib.Color@^0.8.0
|
local Color -- FactorioStdLib.Color@^0.8.0
|
||||||
local Sync -- ExpGamingCore.Sync@^4.0.0
|
local Sync -- ExpGamingCore.Sync@^4.0.0
|
||||||
|
|
||||||
@@ -16,22 +16,22 @@ local Sync -- ExpGamingCore.Sync@^4.0.0
|
|||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local ThisModule = {
|
local ThisModule = {
|
||||||
on_init=function()
|
on_init=function()
|
||||||
if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end
|
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
|
||||||
if loaded_modules['FactorioStdLib.Color@^0.8.0'] then Sync = require('FactorioStdLib.Color@^0.8.0') end
|
if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Function Define
|
-- Function Define
|
||||||
AdminGui.add_button('ban','utility/danger_icon',{'ExpGamingAdmin.tooltip-ban'},function(player,byPlayer)
|
AdminGui.add_button('Ban','utility/danger_icon',{'ExpGamingAdmin.tooltip-ban'},function(player,byPlayer)
|
||||||
Admin.open(byPlayer,player,'ban')
|
Admin.open(byPlayer,player,'Ban')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function Admin.ban(player,by_player,reason)
|
function Admin.ban(player,by_player,reason)
|
||||||
local player = Game.get_player(player)
|
player = Game.get_player(player)
|
||||||
local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '<server>'
|
local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '<server>'
|
||||||
local reason = Admin.create_reason(reason,by_player_name)
|
reason = Admin.create_reason(reason,by_player_name)
|
||||||
Admin.set_banned(player,true)
|
Admin.set_banned(player,true)
|
||||||
if Sync then Sync.emit_embeded{
|
if Sync then Sync.emit_embedded{
|
||||||
title='Player Ban',
|
title='Player Ban',
|
||||||
color=Color.to_hex(defines.textcolor.crit),
|
color=Color.to_hex(defines.textcolor.crit),
|
||||||
description='There was a player banned.',
|
description='There was a player banned.',
|
||||||
@@ -46,4 +46,4 @@ end
|
|||||||
Admin.add_action('Ban',Admin.ban)
|
Admin.add_action('Ban',Admin.ban)
|
||||||
|
|
||||||
-- Module Return
|
-- Module Return
|
||||||
return ThisModule
|
return setmetatable(ThisModule,{__call=Admin.ban})
|
||||||
@@ -1,23 +1,23 @@
|
|||||||
{
|
{
|
||||||
"name": "Ban",
|
"name": "ExpGamingAdmin.Ban",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Adds a custom ban function to the admin command set.",
|
||||||
"description": "Adds a custom ban function to the admin command set.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Ban",
|
||||||
"Ban",
|
"Admin",
|
||||||
"Admin",
|
"Set",
|
||||||
"Set",
|
"ExpGaming"
|
||||||
"ExpGaming"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingAdmin.Gui": "^4.0.0",
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
"ExpGamingCore.Server": "^4.0.0",
|
||||||
"ExpGamingAdmin.Gui": "^4.0.0",
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
"ExpGamingCore.Server": "^4.0.0",
|
"FactorioStdLib.Color": "?^0.8.0",
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
"ExpGamingCore.Sync": "?^4.0.0",
|
||||||
"FactorioStdLib.Color": "?^0.8.0",
|
"ExpGamingAdmin.ClearInventory": "?^4.0.0",
|
||||||
"ExpGamingCore.Sync": "?^4.0.0",
|
"ExpGamingAdmin": "^4.0.0"
|
||||||
"ExpGamingAdmin.ClearInventory": "?^4.0.0"
|
},
|
||||||
},
|
"collection": "ExpGamingAdmin@4.0.0",
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
--- Adds a function to clear a players inventoy and move the items to spawn.
|
--- Adds a function to clear a players inventory and move the items to spawn.
|
||||||
-- @module ExpGamingAdmin.ClearInventory@4.0.0
|
-- @module ExpGamingAdmin.ClearInventory@4.0.0
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais ThisModule
|
-- @alias ThisModule
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0')
|
local Admin = require('ExpGamingAdmin')
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
|
|
||||||
-- Module Define
|
-- Module Define
|
||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local ThisModule = {}
|
local ThisModule = {}
|
||||||
|
|
||||||
-- Function Define
|
-- Function Define
|
||||||
local inventorys = {
|
local inventories = {
|
||||||
defines.inventory.player_main,
|
defines.inventory.player_main,
|
||||||
defines.inventory.player_quickbar,
|
defines.inventory.player_quickbar,
|
||||||
defines.inventory.player_trash,
|
defines.inventory.player_trash,
|
||||||
@@ -23,7 +23,7 @@ local inventorys = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Admin.move_item_to_spawn(item,surface,chests)
|
function Admin.move_item_to_spawn(item,surface,chests)
|
||||||
local chests = chests or surface.find_entities_filtered{area={{-10,-10},{10,10}},name='iron-chest'} or {}
|
chests = chests or surface.find_entities_filtered{area={{-10,-10},{10,10}},name='iron-chest'} or {}
|
||||||
local chest = nil
|
local chest = nil
|
||||||
while not chest or not chest.get_inventory(defines.inventory.chest).can_insert(item) do
|
while not chest or not chest.get_inventory(defines.inventory.chest).can_insert(item) do
|
||||||
chest = table.remove(chests,1)
|
chest = table.remove(chests,1)
|
||||||
@@ -38,14 +38,14 @@ function Admin.move_item_to_spawn(item,surface,chests)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Admin.move_inventory(player)
|
function Admin.move_inventory(player)
|
||||||
local player = Game.get_player(player)
|
player = Game.get_player(player)
|
||||||
if not player then return end
|
if not player then return end
|
||||||
local chests = player.surface.find_entities_filtered{area={{-10,-10},{10,10}},name='iron-chest'} or {}
|
local chests = player.surface.find_entities_filtered{area={{-10,-10},{10,10}},name='iron-chest'} or {}
|
||||||
for _,_inventory in pairs(inventorys) do
|
for _,_inventory in pairs(inventories) do
|
||||||
local inventory = player.get_inventory(_inventory)
|
local inventory = player.get_inventory(_inventory)
|
||||||
if inventory then
|
if inventory then
|
||||||
for item,count in pairs(inventory.get_contents()) do
|
for item,count in pairs(inventory.get_contents()) do
|
||||||
local item = {name=item,count=count}
|
item = {name=item,count=count}
|
||||||
chests = Admin.move_item_to_spawn(item,player.surface,chests)
|
chests = Admin.move_item_to_spawn(item,player.surface,chests)
|
||||||
end
|
end
|
||||||
inventory.clear()
|
inventory.clear()
|
||||||
@@ -55,4 +55,4 @@ end
|
|||||||
|
|
||||||
Admin.add_action('Clear Inventory',Admin.move_inventory)
|
Admin.add_action('Clear Inventory',Admin.move_inventory)
|
||||||
-- Module Return
|
-- Module Return
|
||||||
return ThisModule
|
return setmetatable(ThisModule,{__call=Admin.move_inventory})
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
{
|
{
|
||||||
"name": "ClearInventory",
|
"name": "ExpGamingAdmin.ClearInventory",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Adds a function to clear a players inventoy and move the items to spawn.",
|
||||||
"description": "Adds a function to clear a players inventoy and move the items to spawn.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Spawn",
|
||||||
"Spawn",
|
"Items",
|
||||||
"Items",
|
"Admin",
|
||||||
"Admin",
|
"Move",
|
||||||
"Move",
|
"Clear",
|
||||||
"Clear",
|
"Inventory"
|
||||||
"Inventory"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
"ExpGamingAdmin": "^4.0.0"
|
||||||
"FactorioStdLib.Game": "^0.8.0"
|
},
|
||||||
},
|
"collection": "ExpGamingAdmin@4.0.0",
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
|
|
||||||
local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0')
|
local Admin = require('ExpGamingAdmin')
|
||||||
|
|
||||||
--- Used to clear all parts of a player, removing warnings, reports, jail and temp ban
|
--- Used to clear all parts of a player, removing warnings, reports, jail and temp ban
|
||||||
-- @command clear-all
|
-- @command clear-all
|
||||||
@@ -16,10 +16,10 @@ end)
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
on_init = function(self)
|
on_init = function(self)
|
||||||
if loaded_modules['ExpGamingAdmin.TempBan'] then verbose('ExpGamingAdmin.TempBan is installed; Loading tempban src') require(module_path..'/src/tempban',{Admin=Admin}) end
|
if loaded_modules['ExpGamingAdmin.TempBan'] then verbose('ExpGamingAdmin.TempBan is installed; Loading tempban src') require(module_path..'/src/tempban',{self=Admin}) end
|
||||||
if loaded_modules['ExpGamingAdmin.Jail'] then verbose('ExpGamingAdmin.Jail is installed; Loading tempban src') require(module_path..'/src/jail',{Admin=Admin}) end
|
if loaded_modules['ExpGamingAdmin.Jail'] then verbose('ExpGamingAdmin.Jail is installed; Loading tempban src') require(module_path..'/src/jail',{self=Admin}) end
|
||||||
if loaded_modules['ExpGamingAdmin.Warnings'] then verbose('ExpGamingAdmin.Warnings is installed; Loading tempban src') require(module_path..'/src/warnings',{Admin=Admin}) end
|
if loaded_modules['ExpGamingAdmin.Warnings'] then verbose('ExpGamingAdmin.Warnings is installed; Loading tempban src') require(module_path..'/src/warnings',{self=Admin}) end
|
||||||
if loaded_modules['ExpGamingAdmin.Reports'] then verbose('ExpGamingAdmin.Reports is installed; Loading tempban src') require(module_path..'/src/reports',{Admin=Admin}) end
|
if loaded_modules['ExpGamingAdmin.Reports'] then verbose('ExpGamingAdmin.Reports is installed; Loading tempban src') require(module_path..'/src/reports',{self=Admin}) end
|
||||||
if loaded_modules['ExpGamingAdmin.ClearInventory'] then verbose('ExpGamingAdmin.ClearInventory is installed; Loading tempban src') require(module_path..'/src/clear',{Admin=Admin}) end
|
if loaded_modules['ExpGamingAdmin.ClearInventory'] then verbose('ExpGamingAdmin.ClearInventory is installed; Loading tempban src') require(module_path..'/src/clear',{self=Admin}) end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
@@ -1,28 +1,29 @@
|
|||||||
{
|
{
|
||||||
"name": "Commands",
|
"name": "ExpGamingAdmin.Commands",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Admins many of the admin featues which the script can use as in game commands.",
|
||||||
"description": "Admins many of the admin featues which the script can use as in game commands.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.admin_4.0.0.zip",
|
"keywords": [
|
||||||
"keywords": [
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"Admin",
|
||||||
"Admin",
|
"Tools",
|
||||||
"Tools",
|
"Commands",
|
||||||
"Commands",
|
"Temp ban",
|
||||||
"Temp ban",
|
"Jail",
|
||||||
"Jail",
|
"Clear Inventory",
|
||||||
"Clear Inventory",
|
"Report",
|
||||||
"Report",
|
"Warnings"
|
||||||
"Warnings"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingLib": "^4.0.0",
|
||||||
"ExpGamingLib": "^4.0.0",
|
"ExpGamingCore.Command": "^4.0.0",
|
||||||
"ExpGamingCore.Command": "^4.0.0",
|
"ExpGamingAdmin.TempBan": "?^4.0.0",
|
||||||
"ExpGamingAdmin.TempBan": "?^4.0.0",
|
"ExpGamingAdmin.Jail": "?^4.0.0",
|
||||||
"ExpGamingAdmin.Jail": "?^4.0.0",
|
"ExpGamingAdmin.Warnings": "?^4.0.0",
|
||||||
"ExpGamingAdmin.Warnings": "?^4.0.0",
|
"ExpGamingAdmin.Reports": "?^4.0.0",
|
||||||
"ExpGamingAdmin.Reports": "^?4.0.0",
|
"ExpGamingAdmin.ClearInventory": "?^4.0.0",
|
||||||
"ExpGamingAdmin.ClearInventory": "?^4.0.0"
|
"ExpGamingAdmin": "^4.0.0"
|
||||||
},
|
},
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
"collection": "ExpGamingAdmin@4.0.0",
|
||||||
}
|
"submodules": {}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
local Admin = Admin
|
local Admin = self
|
||||||
|
|
||||||
--- Clears a players inventory and moves it to chests in spawn
|
--- Clears a players inventory and moves it to chests in spawn
|
||||||
-- @command clear-inv
|
-- @command clear-inv
|
||||||
@@ -7,6 +7,6 @@ commands.add_command('clear-inv', 'Clears a player\'s invetory', {
|
|||||||
['player'] = {true,'player-rank'}
|
['player'] = {true,'player-rank'}
|
||||||
}, function(event,args)
|
}, function(event,args)
|
||||||
local player = args.player
|
local player = args.player
|
||||||
if Admin.is_banned(player) then player_return({'ExpGamingAdmin.cant-report-ban',args.player}) return commands.error end
|
if Admin.is_banned(player) then player_return({'ExpGamingAdmin.cant-report-ban',args.player.name}) return commands.error end
|
||||||
Admin.move_inventory(player)
|
Admin.move_inventory(player)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
local Admin = Admin
|
local Admin = self
|
||||||
local Role = require('ExpGamingCore.Role')
|
local Role = require('ExpGamingCore.Role')
|
||||||
|
local Server = require('ExpGamingCore.Server')
|
||||||
|
|
||||||
--- Used to jail a player which stops them from moving
|
--- Used to jail a player which stops them from moving
|
||||||
-- @command jail
|
-- @command jail
|
||||||
@@ -11,8 +12,8 @@ commands.add_command('jail', 'Jails a player', {
|
|||||||
}, function(event,args)
|
}, function(event,args)
|
||||||
local player = args.player
|
local player = args.player
|
||||||
local reason = args.reason
|
local reason = args.reason
|
||||||
if Role.allowed(player,'no-report') then player_return{'ExpGamingAdmin.cant-report',args.player} return commands.error end
|
if Role.has_flag(player,'not_reportable') then player_return{'ExpGamingAdmin.cant-report',args.player.name} return commands.error end
|
||||||
if Admin.is_banned(player) then player_return{'ExpGamingCore_Command.cant-report-ban',args.player} return commands.error end
|
if Admin.is_banned(player) then player_return{'ExpGamingAdmin.cant-report-ban',args.player.name} return commands.error end
|
||||||
Admin.jail(player,event.player_index,reason)
|
Admin.jail(player,event.player_index,reason)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ commands.add_command('unjail', 'Returns a player\'s old rank', {
|
|||||||
['player']={true,'player'}
|
['player']={true,'player'}
|
||||||
}, function(event,args)
|
}, function(event,args)
|
||||||
local player = args.player
|
local player = args.player
|
||||||
if Admin.is_banned(player) then player_return({'ExpGamingCore_Command.cant-report-ban',args.player}) return commands.error end
|
if Admin.is_banned(player,true) ~= 'jail' then player_return({'ExpGamingAdmin.cant-report-ban',args.player.name}) return commands.error end
|
||||||
|
Admin.set_banned(player,false)
|
||||||
Server.interface(Role.revert,true,player,event.player_index,2)
|
Server.interface(Role.revert,true,player,event.player_index,2)
|
||||||
end)
|
end)
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
local Admin = Admin
|
local Admin = self
|
||||||
local Role = require('ExpGamingCore.Role@^4.0.0')
|
local Role = require('ExpGamingCore.Role')
|
||||||
|
local Game = require('FactorioStdLib.Game')
|
||||||
|
|
||||||
--- Reports a player
|
--- Reports a player
|
||||||
-- @command report
|
-- @command report
|
||||||
@@ -12,10 +13,10 @@ commands.add_command('report', 'Reports a player', {
|
|||||||
local _player = Game.get_player(event)
|
local _player = Game.get_player(event)
|
||||||
local player = args.player
|
local player = args.player
|
||||||
local reason = args.reason
|
local reason = args.reason
|
||||||
if Admin.is_banned(player) then player_return({'ExpGamingAdmin.cant-report-ban',args.player}) return commands.error end
|
if Admin.is_banned(player) then player_return({'ExpGamingAdmin.cant-report-ban',args.player.name}) return commands.error end
|
||||||
if Role.allowed(player,'no-report') then player_return({'ExpGamingAdmin.cant-report',args.player}) return commands.error end
|
if Role.has_flag(player,'not_reportable') then player_return({'ExpGamingAdmin.cant-report',args.player.name}) return commands.error end
|
||||||
for _,report in pairs(global.addons.reports.reports) do if report[1] == _player.name then player_return({'ExpGamingAdmin.cant-report',args.player}) return commands.error end end
|
for _,report in pairs(global.addons.reports.reports) do if report[1] == _player.name then player_return({'ExpGamingAdmin.cant-report',args.player.name}) return commands.error end end
|
||||||
for _,report in pairs(global.addons.reports.varified) do if report[1] == _player.name then player_return({'ExpGamingAdmin.cant-report',args.player}) return commands.error end end
|
for _,report in pairs(global.addons.reports.verified) do if report[1] == _player.name then player_return({'ExpGamingAdmin.cant-report',args.player.name}) return commands.error end end
|
||||||
Admin.report(player,event.player_index,reason)
|
Admin.report(player,event.player_index,reason)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -23,7 +24,12 @@ end)
|
|||||||
-- @command clear-reports
|
-- @command clear-reports
|
||||||
-- @param player the player to clear the reports of
|
-- @param player the player to clear the reports of
|
||||||
commands.add_command('clear-reports', 'Clears a player\'s reports', {
|
commands.add_command('clear-reports', 'Clears a player\'s reports', {
|
||||||
['player'] = {true,Admin.is_not_banned}
|
['player'] = {true,function(value)
|
||||||
|
local player,err = commands.validate['player'](value)
|
||||||
|
if err then return commands.error(err) end
|
||||||
|
local rtn = not Admin.is_banned(player) and player
|
||||||
|
if not rtn then return commands.error{'ExpGamingAdmin.cant-report-ban',value} end return rtn
|
||||||
|
end}
|
||||||
}, function(event,args)
|
}, function(event,args)
|
||||||
Admin.clear_reports(args.player,event.player_index)
|
Admin.clear_reports(args.player,event.player_index)
|
||||||
end)
|
end)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
local Admin = Admin
|
local Admin = self
|
||||||
|
|
||||||
--- Used to temp ban a player and give a reason
|
--- Used to temp ban a player and give a reason
|
||||||
-- @command temp-ban
|
-- @command temp-ban
|
||||||
@@ -10,6 +10,6 @@ commands.add_command('temp-ban', 'Temporarily ban a player', {
|
|||||||
}, function(event,args)
|
}, function(event,args)
|
||||||
local player = args.player
|
local player = args.player
|
||||||
local reason = args.reason
|
local reason = args.reason
|
||||||
if Admin.is_banned(player) then player_return({'ExpGamingAdmin.cant-report-ban',args.player}) return commands.error end
|
if Admin.is_banned(player) and Admin.is_banned(player,true) ~= 'jail' then player_return({'ExpGamingAdmin.cant-report-ban',args.player.name}) return commands.error end
|
||||||
Admin.temp_ban(player,event.player_index,reason)
|
Admin.temp_ban(player,event.player_index,reason)
|
||||||
end)
|
end)
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
local Admin = Admin
|
local Admin = self
|
||||||
local Role = require('ExpGamingCore.Role@^4.0.0')
|
local Role = require('ExpGamingCore.Role')
|
||||||
|
|
||||||
--- Gives a warning to a player
|
--- Gives a warning to a player
|
||||||
-- @command warn
|
-- @command warn
|
||||||
@@ -11,8 +11,8 @@ commands.add_command('warn', 'Gives a player a warning', {
|
|||||||
}, function(event,args)
|
}, function(event,args)
|
||||||
local player = args.player
|
local player = args.player
|
||||||
local reason = args.reason
|
local reason = args.reason
|
||||||
if Admin.is_banned(player) then player_return{'ExpGamingAdmin.cant-report-ban',args.player} return commands.error end
|
if Admin.is_banned(player) then player_return{'ExpGamingAdmin.cant-report-ban',args.player.name} return commands.error end
|
||||||
if Role.allowed(player,'no-report') then player_return{'ExpGamingAdmin.cant-report',args.player} return commands.error end
|
if Role.has_flag(player,'not_reportable') then player_return{'ExpGamingAdmin.cant-report',args.player.name} return commands.error end
|
||||||
Admin.give_warning(player,event.player_index,reason)
|
Admin.give_warning(player,event.player_index,reason)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -23,6 +23,6 @@ commands.add_command('clear-warnings', 'Clears a player\'s warnings', {
|
|||||||
['player'] = {true,'player'}
|
['player'] = {true,'player'}
|
||||||
}, function(event,args)
|
}, function(event,args)
|
||||||
local player = args.player
|
local player = args.player
|
||||||
if Admin.is_banned(player) then player_return({'ExpGamingAdmin.cant-report-ban',args.player}) return commands.error end
|
if Admin.is_banned(player) then player_return({'ExpGamingAdmin.cant-report-ban',args.player.name}) return commands.error end
|
||||||
Admin.clear_warings(player,event.player_index)
|
Admin.clear_warnings(player,event.player_index)
|
||||||
end)
|
end)
|
||||||
@@ -2,21 +2,20 @@
|
|||||||
-- @module ExpGamingAdmin.Gui@4.0.0
|
-- @module ExpGamingAdmin.Gui@4.0.0
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais AdminGui
|
-- @alias AdminGui
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0')
|
local Admin = require('ExpGamingAdmin')
|
||||||
local Gui = require('ExpGamingCore.Gui@^4.0.0')
|
local Gui = require('ExpGamingCore.Gui')
|
||||||
local Role = require('ExpGamingCore.Role@^4.0.0')
|
local Role = require('ExpGamingCore.Role')
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
local playerInfo -- ExpGamingPlayer.playerInfo@^4.0.0
|
local playerInfo -- ExpGamingPlayer.playerInfo@^4.0.0
|
||||||
local mod_gui = require('mod-gui')
|
|
||||||
|
|
||||||
-- Module Define
|
-- Module Define
|
||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local AdminGui = {
|
local AdminGui = {
|
||||||
on_init=function()
|
on_init=function()
|
||||||
if loaded_modules['ExpGamingPlayer.playerInfo@^4.0.0'] then playerInfo = require('ExpGamingPlayer@^4.0.0')
|
if loaded_modules['ExpGamingPlayer.playerInfo'] then playerInfo = require('ExpGamingPlayer.playerInfo')
|
||||||
else playerInfo = function(player,frame)
|
else playerInfo = function(player,frame)
|
||||||
frame.add{
|
frame.add{
|
||||||
type='label',
|
type='label',
|
||||||
@@ -30,7 +29,7 @@ local AdminGui = {
|
|||||||
|
|
||||||
function Admin.open(player,pre_select_player,pre_select_action)
|
function Admin.open(player,pre_select_player,pre_select_action)
|
||||||
Gui.center.clear(player)
|
Gui.center.clear(player)
|
||||||
Admin.center.open(player,pre_select_player,pre_select_action)
|
Admin.center(player,pre_select_player,pre_select_action)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Function Define
|
-- Function Define
|
||||||
@@ -42,7 +41,7 @@ function AdminGui.add_button(name,caption,tooltip,callback)
|
|||||||
tooltip=tooltip
|
tooltip=tooltip
|
||||||
}:on_event('click',function(event)
|
}:on_event('click',function(event)
|
||||||
local parent = event.element.parent
|
local parent = event.element.parent
|
||||||
pre_select_player = parent.player and parent.player.caption or nil
|
local pre_select_player = parent.player and parent.player.caption or nil
|
||||||
callback(pre_select_player,event.player_index)
|
callback(pre_select_player,event.player_index)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
@@ -68,12 +67,12 @@ function AdminGui.draw(frame,filter_buttons)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Gui Define
|
-- Gui Define
|
||||||
local function _players(_player,root_frame,state)
|
local function get_players(_player,root_frame,state)
|
||||||
local players = {'Select Player'}
|
local players = {'Select Player'}
|
||||||
local _players = state and game.players or game.connected_players
|
local _players = state and game.players or game.connected_players
|
||||||
for _,player in pairs(_players) do
|
for _,player in pairs(_players) do
|
||||||
if player.name ~= _player.name then
|
if player.name ~= _player.name then
|
||||||
if Admin.is_banned and Admin.is_banned(player) then else
|
if not Admin.is_banned or not Admin.is_banned(player) then
|
||||||
table.insert(players,player.name)
|
table.insert(players,player.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -82,14 +81,14 @@ local function _players(_player,root_frame,state)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local online_check = Gui.inputs.add_checkbox('online-check-admin-commands',false,'Show Offline',false,function(player,element)
|
local online_check = Gui.inputs.add_checkbox('online-check-admin-commands',false,'Show Offline',false,function(player,element)
|
||||||
element.parent['player-drop-down-admin-commands'].items = _players(player,element.parent,true)
|
element.parent['player-drop-down-admin-commands'].items = get_players(player,element.parent,true)
|
||||||
element.parent['player-drop-down-admin-commands'].selected_index = 1
|
element.parent['player-drop-down-admin-commands'].selected_index = 1
|
||||||
end,function(player,element)
|
end,function(player,element)
|
||||||
element.parent['player-drop-down-admin-commands'].items = _players(player,element.parent,false)
|
element.parent['player-drop-down-admin-commands'].items = get_players(player,element.parent,false)
|
||||||
element.parent['player-drop-down-admin-commands'].selected_index = 1
|
element.parent['player-drop-down-admin-commands'].selected_index = 1
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local player_drop_down = Gui.inputs.add_drop_down('player-drop-down-admin-commands',_players,1,function(player,selected,items,element)
|
local player_drop_down = Gui.inputs.add_drop_down('player-drop-down-admin-commands',get_players,1,function(player,selected,items,element)
|
||||||
element.parent.parent.player.caption = selected
|
element.parent.parent.player.caption = selected
|
||||||
local player_info_flow = element.parent.parent.info_flow
|
local player_info_flow = element.parent.parent.info_flow
|
||||||
player_info_flow.clear()
|
player_info_flow.clear()
|
||||||
@@ -131,7 +130,7 @@ local take_action = Gui.inputs{
|
|||||||
local _role = Role.get_highest(_player)
|
local _role = Role.get_highest(_player)
|
||||||
if role.index >= _role.index then dropdowns.warning.caption = {'ExpGamingAdmin.rank-high'} return end
|
if role.index >= _role.index then dropdowns.warning.caption = {'ExpGamingAdmin.rank-high'} return end
|
||||||
local _reason = dropdowns['reason-input-admin-commands'] and dropdowns['reason-input-admin-commands'].text
|
local _reason = dropdowns['reason-input-admin-commands'] and dropdowns['reason-input-admin-commands'].text
|
||||||
if (_action == 'Jail' or _action == 'Kick' or _action == 'Ban' or _action == 'Temp Ban') and (_reason == 'Enter Reason' or string.len(_reason) < 20) then return end
|
if (_action == 'Jail' or _action == 'Kick' or _action == 'Ban' or _action == 'Temp Ban') and (_reason == 'Enter Reason' or string.len(_reason) < 10) then return end
|
||||||
Admin.take_action(_action,_player,event.player_index,_reason)
|
Admin.take_action(_action,_player,event.player_index,_reason)
|
||||||
Gui.center.clear(event)
|
Gui.center.clear(event)
|
||||||
end)
|
end)
|
||||||
@@ -140,26 +139,9 @@ Admin.center = Gui.center{
|
|||||||
name='admin-commands',
|
name='admin-commands',
|
||||||
caption='utility/danger_icon',
|
caption='utility/danger_icon',
|
||||||
tooltip={'ExpGamingAdmin.tooltip'},
|
tooltip={'ExpGamingAdmin.tooltip'},
|
||||||
open=function(event,pre_select_player,pre_select_action)
|
draw=function(self,frame,pre_select_player,pre_select_action)
|
||||||
local _player = Game.get_player(pre_select_player)
|
|
||||||
local player = Game.get_player(event)
|
|
||||||
local _center = Gui.data.center['admin-commands']
|
|
||||||
local center_flow = Gui.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',
|
|
||||||
direction='vertical',
|
|
||||||
style=mod_gui.frame_style
|
|
||||||
}
|
|
||||||
-- only edit i made was passing diffrent arguments to the draw function, try to avoid this
|
|
||||||
local success, err = pcall(_center.draw,center_frame,_player,pre_select_action)
|
|
||||||
if not success then error(err) end
|
|
||||||
player.opened=center_frame
|
|
||||||
end,
|
|
||||||
draw=function(frame,pre_select_player,pre_select_action)
|
|
||||||
frame.caption={'ExpGamingAdmin.name'}
|
frame.caption={'ExpGamingAdmin.name'}
|
||||||
local frame = frame.add{
|
frame = frame.add{
|
||||||
type='flow',
|
type='flow',
|
||||||
direction='horizontal'
|
direction='horizontal'
|
||||||
}
|
}
|
||||||
@@ -183,7 +165,7 @@ Admin.center = Gui.center{
|
|||||||
online_check:draw(dropdowns)
|
online_check:draw(dropdowns)
|
||||||
local _drop = player_drop_down:draw(dropdowns)
|
local _drop = player_drop_down:draw(dropdowns)
|
||||||
if pre_select_player then Gui.set_dropdown_index(_drop,pre_select_player.name) end
|
if pre_select_player then Gui.set_dropdown_index(_drop,pre_select_player.name) end
|
||||||
local _drop = action_drop_down:draw(dropdowns)
|
_drop = action_drop_down:draw(dropdowns)
|
||||||
Gui.set_dropdown_index(_drop,pre_select_action)
|
Gui.set_dropdown_index(_drop,pre_select_action)
|
||||||
local _text = reason_input:draw(dropdowns)
|
local _text = reason_input:draw(dropdowns)
|
||||||
if pre_select_action == 'Jail' or pre_select_action == 'Kick' or pre_select_action == 'Ban' then
|
if pre_select_action == 'Jail' or pre_select_action == 'Kick' or pre_select_action == 'Ban' then
|
||||||
@@ -191,7 +173,7 @@ Admin.center = Gui.center{
|
|||||||
end
|
end
|
||||||
if pre_select_player then playerInfo(pre_select_player,player_info_flow,true) end
|
if pre_select_player then playerInfo(pre_select_player,player_info_flow,true) end
|
||||||
_text.style.width = 200
|
_text.style.width = 200
|
||||||
local label = dropdowns.add{
|
label = dropdowns.add{
|
||||||
name='warning',
|
name='warning',
|
||||||
type='label',
|
type='label',
|
||||||
caption='',
|
caption='',
|
||||||
@@ -200,21 +182,21 @@ Admin.center = Gui.center{
|
|||||||
label.style.single_line = false
|
label.style.single_line = false
|
||||||
label.style.width = 200
|
label.style.width = 200
|
||||||
take_action:draw(dropdowns)
|
take_action:draw(dropdowns)
|
||||||
local _caption = pre_select_player and pre_select_player.name or ''
|
local caption = pre_select_player and pre_select_player.name or ''
|
||||||
frame.add{
|
frame.add{
|
||||||
name='player',
|
name='player',
|
||||||
type='label',
|
type='label',
|
||||||
caption=_caption
|
caption=caption
|
||||||
}.style.visible = false
|
}.style.visible = false
|
||||||
local _caption = pre_select_action or ''
|
caption = pre_select_action or ''
|
||||||
frame.add{
|
frame.add{
|
||||||
name='action',
|
name='action',
|
||||||
type='label',
|
type='label',
|
||||||
caption=_caption
|
caption=caption
|
||||||
}.style.visible = false
|
}.style.visible = false
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Module Return
|
-- Module Return
|
||||||
-- calling will draw the admin buttons to that frame
|
-- calling will draw the admin buttons to that frame
|
||||||
return setmetatable(AdminGui,{__call=function(self,...) self.draw(...) end})
|
return setmetatable(AdminGui,{__call=function(self,...) return self.draw(...) end})
|
||||||
@@ -1,21 +1,23 @@
|
|||||||
{
|
{
|
||||||
"name": "Gui",
|
"name": "ExpGamingAdmin.Gui",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Adds a gui that can be used to access all the admin commands.",
|
||||||
"description": "Adds a gui that can be used to access all the admin commands.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Admin",
|
||||||
"Admin",
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"Commands",
|
||||||
"Commands",
|
"Gui"
|
||||||
"Gui"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingCore.Gui": "^4.0.0",
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
"ExpGamingCore.Role": "^4.0.0",
|
||||||
"ExpGamingCore.Gui": "^4.0.0",
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
"ExpGamingCore.Role": "^4.0.0",
|
"ExpGamingPlayer": "?^4.0.0",
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
"ExpGamingPlayer.playerInfo": "?^4.0.0",
|
||||||
"ExpGamingPlayer": "?^4.0.0"
|
"mod-gui": "*",
|
||||||
},
|
"ExpGamingAdmin": "^4.0.0"
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
},
|
||||||
}
|
"collection": "ExpGamingAdmin@4.0.0",
|
||||||
|
"submodules": {}
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,14 +2,13 @@
|
|||||||
-- @module ExpGamingAdmin.Jail@4.0.0
|
-- @module ExpGamingAdmin.Jail@4.0.0
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais ThisModule
|
-- @alias ThisModule
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0')
|
local Admin = require('ExpGamingAdmin')
|
||||||
local AdminGui = require('ExpGamingAdmin.Gui@^4.0.0')
|
local AdminGui = require('ExpGamingAdmin.Gui')
|
||||||
local Server = require('ExpGamingCore.Server@^4.0.0')
|
local Server = require('ExpGamingCore.Server')
|
||||||
local Role = require('ExpGamingCore.Role@^4.0.0')
|
local Role = require('ExpGamingCore.Role')
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
|
||||||
local Color -- FactorioStdLib.Color@^0.8.0
|
local Color -- FactorioStdLib.Color@^0.8.0
|
||||||
local Sync -- ExpGamingCore.Sync@^4.0.0
|
local Sync -- ExpGamingCore.Sync@^4.0.0
|
||||||
|
|
||||||
@@ -17,34 +16,35 @@ local Sync -- ExpGamingCore.Sync@^4.0.0
|
|||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local ThisModule = {
|
local ThisModule = {
|
||||||
on_init=function()
|
on_init=function()
|
||||||
if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end
|
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
|
||||||
if loaded_modules['FactorioStdLib.Color@^0.8.0'] then Sync = require('FactorioStdLib.Color@^0.8.0') end
|
if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Function Define
|
-- Function Define
|
||||||
AdminGui.add_button('jail','utility/clock',{'ExpGamingAdmin.tooltip-jail'},function(player,byPlayer)
|
AdminGui.add_button('jail','utility/clock',{'ExpGamingAdmin.tooltip-jail'},function(player,byPlayer)
|
||||||
Admin.open(byPlayer,player,'jail')
|
Admin.open(byPlayer,player,'Jail')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function Admin.jail(player,by_player,reason)
|
function Admin.jail(player,by_player,reason)
|
||||||
local player = Game.get_player(player)
|
player, by_player = Admin.valid_players(player,by_player)
|
||||||
local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '<server>'
|
if not player then return end
|
||||||
local reason = Admin.create_reason(reason,by_player_name)
|
reason = Admin.create_reason(reason,by_player.name)
|
||||||
if Sync then Sync.emit_embeded{
|
Admin.set_banned(player,'jail')
|
||||||
|
if Sync then Sync.emit_embedded{
|
||||||
title='Player Jail',
|
title='Player Jail',
|
||||||
color=Color.to_hex(defines.textcolor.med),
|
color=Color.to_hex(defines.textcolor.med),
|
||||||
description='There was a player jailed.',
|
description='There was a player jailed.',
|
||||||
['Player:']='<<inline>>'..player.name,
|
['Player:']='<<inline>>'..player.name,
|
||||||
['By:']='<<inline>>'..by_player_name,
|
['By:']='<<inline>>'..by_player.name,
|
||||||
['Reason:']=reason
|
['Reason:']=reason
|
||||||
} end
|
} end
|
||||||
Role.meta.last_jail = player.name
|
Role.meta.last_jail = player.name
|
||||||
Server.interface(Role.unassign,true,player,Role.get(player),by_player_name)
|
Server.interface(Role.assign,true,player,'Jail',by_player.name)
|
||||||
Server.interface(Role.assign,true,player,'Jail',by_player_name)
|
Server.interface(Role.unassign,true,player,Role.get(player),by_player.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
Admin.add_action('Jail',Admin.jail)
|
Admin.add_action('Jail',Admin.jail)
|
||||||
|
|
||||||
-- Module Return
|
-- Module Return
|
||||||
return ThisModule
|
return setmetatable(ThisModule,{__call=Admin.jail})
|
||||||
@@ -1,24 +1,24 @@
|
|||||||
{
|
{
|
||||||
"name": "Jail",
|
"name": "ExpGamingAdmin.Jail",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Adds a jail function to the admin set, require ExpGamingRole to work.",
|
||||||
"description": "Adds a jail function to the admin set, require ExpGamingRole to work.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Jail",
|
||||||
"Jail",
|
"Roles",
|
||||||
"Roles",
|
"Admin",
|
||||||
"Admin",
|
"ExpGaming"
|
||||||
"ExpGaming"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingAdmin.Gui": "^4.0.0",
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
"ExpGamingCore.Server": "^4.0.0",
|
||||||
"ExpGamingAdmin.Gui": "^4.0.0",
|
"ExpGamingCore.Role": "^4.0.0",
|
||||||
"ExpGamingCore.Server": "^4.0.0",
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
"ExpGamingCore.Role": "^4.0.0",
|
"FactorioStdLib.Color": "?^0.8.0",
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
"ExpGamingCore.Sync": "?^4.0.0",
|
||||||
"FactorioStdLib.Color": "?^0.8.0",
|
"ExpGamingAdmin.ClearInventory": "?^4.0.0",
|
||||||
"ExpGamingCore.Sync": "?^4.0.0",
|
"ExpGamingAdmin": "^4.0.0"
|
||||||
"ExpGamingAdmin.ClearInventory": "?^4.0.0"
|
},
|
||||||
},
|
"collection": "ExpGamingAdmin@4.0.0",
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
-- @module ExpGamingAdmin.Kick@4.0.0
|
-- @module ExpGamingAdmin.Kick@4.0.0
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais ThisModule
|
-- @alias ThisModule
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0')
|
local Admin = require('ExpGamingAdmin')
|
||||||
local AdminGui = require('ExpGamingAdmin.Gui@^4.0.0')
|
local AdminGui = require('ExpGamingAdmin.Gui')
|
||||||
local Server = require('ExpGamingCore.Server@^4.0.0')
|
local Server = require('ExpGamingCore.Server')
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
local Color -- FactorioStdLib.Color@^0.8.0
|
local Color -- FactorioStdLib.Color@^0.8.0
|
||||||
local Sync -- ExpGamingCore.Sync@^4.0.0
|
local Sync -- ExpGamingCore.Sync@^4.0.0
|
||||||
|
|
||||||
@@ -16,20 +16,20 @@ local Sync -- ExpGamingCore.Sync@^4.0.0
|
|||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local ThisModule = {
|
local ThisModule = {
|
||||||
on_init=function()
|
on_init=function()
|
||||||
if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end
|
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
|
||||||
if loaded_modules['FactorioStdLib.Color@^0.8.0'] then Sync = require('FactorioStdLib.Color@^0.8.0') end
|
if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
-- Function Define
|
-- Function Define
|
||||||
AdminGui.add_button('kick','utility/warning_icon',{'ExpGamingAdmin.tooltip-kick'},function(player,byPlayer)
|
AdminGui.add_button('Kick','utility/warning_icon',{'ExpGamingAdmin.tooltip-kick'},function(player,byPlayer)
|
||||||
Admin.open(byPlayer,player,'kick')
|
Admin.open(byPlayer,player,'Kick')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function Admin.kick(player,by_player,reason)
|
function Admin.kick(player,by_player,reason)
|
||||||
local player = Game.get_player(player)
|
player = Game.get_player(player)
|
||||||
|
reason = Admin.create_reason(reason,by_player_name)
|
||||||
local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '<server>'
|
local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '<server>'
|
||||||
local reason = Admin.create_reason(reason,by_player_name)
|
if Sync then Sync.emit_embedded{
|
||||||
if Sync then Sync.emit_embeded{
|
|
||||||
title='Player Kick',
|
title='Player Kick',
|
||||||
color=Color.to_hex(defines.textcolor.high),
|
color=Color.to_hex(defines.textcolor.high),
|
||||||
description='There was a player kicked.',
|
description='There was a player kicked.',
|
||||||
@@ -44,4 +44,4 @@ end
|
|||||||
Admin.add_action('Kick',Admin.kick)
|
Admin.add_action('Kick',Admin.kick)
|
||||||
|
|
||||||
-- Module Return
|
-- Module Return
|
||||||
return ThisModule
|
return setmetatable(ThisModule,{__call=Admin.kick})
|
||||||
@@ -1,23 +1,23 @@
|
|||||||
{
|
{
|
||||||
"name": "Kick",
|
"name": "ExpGamingAdmin.Kick",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Adds a kick function to the admin function set.",
|
||||||
"description": "Adds a kick function to the admin function set.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Admin",
|
||||||
"Admin",
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"Kick",
|
||||||
"Kick",
|
"Commands"
|
||||||
"Commands"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingAdmin.Gui": "^4.0.0",
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
"ExpGamingCore.Server": "^4.0.0",
|
||||||
"ExpGamingAdmin.Gui": "^4.0.0",
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
"ExpGamingCore.Server": "^4.0.0",
|
"FactorioStdLib.Color": "?^0.8.0",
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
"ExpGamingCore.Sync": "?^4.0.0",
|
||||||
"FactorioStdLib.Color": "?^0.8.0",
|
"ExpGamingAdmin.ClearInventory": "?^4.0.0",
|
||||||
"ExpGamingCore.Sync": "?^4.0.0",
|
"ExpGamingAdmin": "^4.0.0"
|
||||||
"ExpGamingAdmin.ClearInventory": "?^4.0.0"
|
},
|
||||||
},
|
"collection": "ExpGamingAdmin@4.0.0",
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,121 +2,114 @@
|
|||||||
-- @module ExpGamingAdmin.Reports@4.0.0
|
-- @module ExpGamingAdmin.Reports@4.0.0
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais ThisModule
|
-- @alias ThisModule
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0')
|
local Admin = require('ExpGamingAdmin')
|
||||||
local Server = require('ExpGamingCore.Server@^4.0.0')
|
local Role = require('ExpGamingCore.Role')
|
||||||
local Role = require('ExpGamingCore.Role@^4.0.0')
|
local Gui = require('ExpGamingCore.Gui')
|
||||||
local Gui = require('ExpGamingCore.Gui@^4.0.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Color -- FactorioStdLib.Color@^0.8.0
|
||||||
local Color = require('FactorioStdLib.Color@^0.8.0')
|
|
||||||
local Sync -- ExpGamingCore.Sync@^4.0.0
|
local Sync -- ExpGamingCore.Sync@^4.0.0
|
||||||
|
|
||||||
-- Module Define
|
-- Module Define
|
||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local ThisModule = {
|
local ThisModule = {
|
||||||
on_init=function()
|
on_init=function()
|
||||||
if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end
|
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
|
||||||
|
if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Global Define
|
-- Global Define
|
||||||
local global = global{
|
local global = global{
|
||||||
reports={},
|
reports={},
|
||||||
varified={}
|
verified={}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Local Varibles
|
-- Local Variables
|
||||||
local report_to_warnings = 1 -- used in count_reports
|
local report_to_warnings = 1 -- used in count_reports
|
||||||
local varified_to_warings = 3 -- used in count_reports
|
local verified_to_warnings = 3 -- used in count_reports
|
||||||
local reports_needed_for_jail = 6
|
local reports_needed_for_jail = 6
|
||||||
|
|
||||||
-- Function Define
|
-- Function Define
|
||||||
local function valid_players(player,by_player)
|
|
||||||
local player = Game.get_player(player)
|
|
||||||
local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '<server>'
|
|
||||||
return player, by_player_name
|
|
||||||
end
|
|
||||||
|
|
||||||
local function report_message(player,by_player,reason)
|
local function report_message(player,by_player,reason)
|
||||||
local player, by_player_name = valid_players(player,by_player)
|
player, by_player = Admin.valid_players(player,by_player)
|
||||||
if not player then return end
|
if not player then return end
|
||||||
if Admin.is_banned(player,true) == 'report' then return end
|
if Admin.is_banned(player,true) == 'report' then return end
|
||||||
Role.print(Role.meta.groups.User.lowest,{'ExpGamingAdmin.low-print',player.name,reason},defines.textcolor.info,true)
|
Role.print(Role.meta.groups.User.lowest,{'ExpGamingAdmin.low-print',player.name,reason},defines.textcolor.info,true)
|
||||||
Role.print(Role.meta.groups.Admin.lowest,{'ExpGamingAdmin.high-print',player.name,by_player_name,reason},defines.textcolor.med)
|
Role.print(Role.meta.groups.Admin.lowest,{'ExpGamingAdmin.high-print',player.name,by_player.name,reason},defines.textcolor.med)
|
||||||
if Sync then Sync.emit_embeded{
|
if Sync then Sync.emit_embedded{
|
||||||
title='Player Report',
|
title='Player Report',
|
||||||
color=Color.to_hex(defines.textcolor.med),
|
color=Color.to_hex(defines.textcolor.med),
|
||||||
description='A player was reported.',
|
description='A player was reported.',
|
||||||
['Player:']='<<inline>>'..player.name,
|
['Player:']='<<inline>>'..player.name,
|
||||||
['By:']='<<inline>>'..by_player_name,
|
['By:']='<<inline>>'..by_player.name,
|
||||||
['Reason:']=reason
|
['Reason:']=reason
|
||||||
} end
|
} end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function cheak_reports(player)
|
local function cheak_reports(player)
|
||||||
local player = Game.get_player(player)
|
player = Game.get_player(player)
|
||||||
if not player then return end
|
if not player then return end
|
||||||
local reports = Admin.count_reports(player)
|
local reports = Admin.count_reports(player)
|
||||||
if reports >= reports_needed_for_jail and global.actions[player.name] ~= 'report-jail' and Role.get_highest(player).group.name ~= 'Jail' then
|
if reports >= reports_needed_for_jail and Role.get_highest(player).group.name ~= 'Jail' then
|
||||||
global.actions[player.name] = actions.report
|
|
||||||
Admin.jail(player,'<server>','Too many user reports. Contact an Admin to be unjailed.')
|
Admin.jail(player,'<server>','Too many user reports. Contact an Admin to be unjailed.')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Admin.count_reports(player)
|
function Admin.count_reports(player)
|
||||||
local player = Game.get_player(player)
|
player = Game.get_player(player)
|
||||||
if not player then return 0 end
|
if not player then return 0 end
|
||||||
local _count = 0
|
local _count = 0
|
||||||
if global.reports[player.name] then
|
if global.reports[player.name] then
|
||||||
for _,report in pairs(global.reports[player.name]) do
|
for _ in pairs(global.reports[player.name]) do
|
||||||
_count=_count+report_to_warnings
|
_count=_count+report_to_warnings
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if global.varified[player.name] then
|
if global.verified[player.name] then
|
||||||
for _,report in pairs(global.varified[player.name]) do
|
for _ in pairs(global.verified[player.name]) do
|
||||||
_count=_count+varified_to_warings
|
_count=_count+verified_to_warnings
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return _count
|
return _count
|
||||||
end
|
end
|
||||||
|
|
||||||
function Admin.report(player,by_player,reason)
|
function Admin.report(player,by_player,reason)
|
||||||
local player, by_player_name = valid_players(player,by_player)
|
player, by_player = Admin.valid_players(player,by_player)
|
||||||
if not player or Role.allowed(player,'no-report') then return end
|
if not player or Role.has_flag(player,'not_reportable') then return end
|
||||||
if Admin.is_banned(by_player) or Role.has_flag(by_player,'is_jail') then return end
|
if Admin.is_banned(by_player) or Role.has_flag(by_player,'is_jail') then return end
|
||||||
if Role.has_flag(by_player,'is_varified') then
|
if Role.has_flag(by_player,'is_verified') then
|
||||||
global.varified[player.name] = global.varified[player.name] or {}
|
global.verified[player.name] = global.verified[player.name] or {}
|
||||||
local reports = global.varified[player.name]
|
local reports = global.verified[player.name]
|
||||||
for _,value in pairs(reports) do
|
for _,value in pairs(reports) do
|
||||||
if value[1] == by_player_name then return end
|
if value[1] == by_player.name then return end
|
||||||
end
|
end
|
||||||
table.insert(reports,{by_player_name,reason})
|
table.insert(reports,{by_player.name,reason})
|
||||||
else
|
else
|
||||||
global.reports[player.name] = global.reports[player.name] or {}
|
global.reports[player.name] = global.reports[player.name] or {}
|
||||||
local reports = global.reports[player.name]
|
local reports = global.reports[player.name]
|
||||||
for _,value in pairs(reports) do
|
for _,value in pairs(reports) do
|
||||||
if value[1] == by_player_name then return end
|
if value[1] == by_player.name then return end
|
||||||
end
|
end
|
||||||
table.insert(reports,{by_player_name,reason})
|
table.insert(reports,{by_player.name,reason})
|
||||||
end
|
end
|
||||||
report_message(player,by_player,reason)
|
report_message(player,by_player,reason)
|
||||||
cheak_reports(player)
|
cheak_reports(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Admin.clear_reports(player,by_player,no_emit)
|
function Admin.clear_reports(player,by_player,no_emit)
|
||||||
local player, by_player_name = valid_players(player,by_player)
|
player, by_player = Admin.valid_players(player,by_player)
|
||||||
if not player then return end
|
if not player then return end
|
||||||
global.reports[player.name]={}
|
global.reports[player.name]={}
|
||||||
global.varified[player.name]={}
|
global.verified[player.name]={}
|
||||||
if not no_emit and Sync then
|
if not no_emit and Sync then
|
||||||
Sync.emit_embeded{
|
Sync.emit_embedded{
|
||||||
title='Player Clear',
|
title='Player Clear',
|
||||||
color=Color.to_hex(defines.textcolor.low),
|
color=Color.to_hex(defines.textcolor.low),
|
||||||
description='A player had their reports cleared.',
|
description='A player had their reports cleared.',
|
||||||
['Player:']='<<inline>>'..player.name,
|
['Player:']='<<inline>>'..player.name,
|
||||||
['By:']='<<inline>>'..by_player_name,
|
['By:']='<<inline>>'..by_player.name,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -166,4 +159,4 @@ Admin.report_btn = Gui.inputs{
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- Module Return
|
-- Module Return
|
||||||
return ThisModule
|
return ThisModule
|
||||||
@@ -1,24 +1,25 @@
|
|||||||
{
|
{
|
||||||
"name": "Reports",
|
"name": "ExpGamingAdmin.Reports",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Adds a report system into the game that can also push notifactions to discord.",
|
||||||
"description": "Adds a report system into the game that can also push notifactions to discord.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Report",
|
||||||
"Report",
|
"Player",
|
||||||
"Player",
|
"Admin",
|
||||||
"Admin",
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"Player List",
|
||||||
"Player List",
|
"Commands"
|
||||||
"Commands"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingCore.Server": "^4.0.0",
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
"ExpGamingCore.Role": "^4.0.0",
|
||||||
"ExpGamingCore.Server": "^4.0.0",
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
"ExpGamingCore.Role": "^4.0.0",
|
"FactorioStdLib.Color": "?^0.8.0",
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
"ExpGamingCore.Sync": "?^4.0.0",
|
||||||
"FactorioStdLib.Color": "^0.8.0",
|
"ExpGamingCore.Gui": "^4.0.0",
|
||||||
"ExpGamingCore.Sync": "?^4.0.0"
|
"ExpGamingAdmin": "^4.0.0"
|
||||||
},
|
},
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
"collection": "ExpGamingAdmin@4.0.0",
|
||||||
}
|
"submodules": {}
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,22 +2,22 @@
|
|||||||
-- @module ExpGamingAdmin.Teleport@4.0.0
|
-- @module ExpGamingAdmin.Teleport@4.0.0
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais ThisModule
|
-- @alias ThisModule
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0')
|
local Admin = require('ExpGamingAdmin')
|
||||||
local AdminGui = require('ExpGamingAdmin.Gui@^4.0.0')
|
local AdminGui = require('ExpGamingAdmin.Gui')
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
|
|
||||||
-- Module Define
|
-- Module Define
|
||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local ThisModule = {}
|
local ThisModule = {}
|
||||||
|
|
||||||
-- Function Define
|
-- Function Define
|
||||||
AdminGui.add_button('goto','utility/export_slot',{'ExpGamingAdmin.tooltip-go-to'},function(player,byPlayer)
|
AdminGui.add_button('Go To','utility/export_slot',{'ExpGamingAdmin.tooltip-go-to'},function(player,byPlayer)
|
||||||
Admin.go_to(player,byPlayer)
|
Admin.go_to(player,byPlayer)
|
||||||
end)
|
end)
|
||||||
AdminGui.add_button('bring','utility/import_slot',{'ExpGamingAdmin.tooltip-bring'},function(player,byPlayer)
|
AdminGui.add_button('Bring','utility/import_slot',{'ExpGamingAdmin.tooltip-bring'},function(player,byPlayer)
|
||||||
Admin.bring(player,byPlayer)
|
Admin.bring(player,byPlayer)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -40,4 +40,4 @@ Admin.add_action('Go To',Admin.go_to)
|
|||||||
Admin.add_action('Bring',Admin.bring)
|
Admin.add_action('Bring',Admin.bring)
|
||||||
|
|
||||||
-- Module Return
|
-- Module Return
|
||||||
return ThisModule
|
return setmetatable(ThisModule,{__call=Admin.tp})
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
{
|
{
|
||||||
"name": "Teleport",
|
"name": "ExpGamingAdmin.Teleport",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Adds three function to admin: tp, bring and go to, these all move the player.",
|
||||||
"description": "Adds three function to admin: tp, bring and go to, these all move the player.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Tp",
|
||||||
"Tp",
|
"Bring",
|
||||||
"Bring",
|
"Go To",
|
||||||
"Go To",
|
"Admin",
|
||||||
"Admin",
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"Teleport",
|
||||||
"Teleport",
|
"Commands"
|
||||||
"Commands"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingAdmin.Gui": "^4.0.0",
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
"ExpGamingAdmin.Gui": "^4.0.0",
|
"ExpGamingAdmin": "^4.0.0"
|
||||||
"FactorioStdLib.Game": "^0.8.0"
|
},
|
||||||
},
|
"collection": "ExpGamingAdmin@4.0.0",
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,21 +2,22 @@
|
|||||||
-- @module ExpGamingAdmin.KicTempBan@4.0.0
|
-- @module ExpGamingAdmin.KicTempBan@4.0.0
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais ThisModule
|
-- @alias ThisModule
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0')
|
local Admin = require('ExpGamingAdmin')
|
||||||
local Server = require('ExpGamingCore.Server@^4.0.0')
|
local Server = require('ExpGamingCore.Server')
|
||||||
local Role = require('ExpGamingCore.Role@^4.0.0')
|
local Role = require('ExpGamingCore.Role')
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
local Color = require('FactorioStdLib.Color@^0.8.0')
|
local Color -- FactorioStdLib.Color@^0.8.0
|
||||||
local Sync -- ExpGamingCore.Sync@^4.0.0
|
local Sync -- ExpGamingCore.Sync@^4.0.0
|
||||||
|
|
||||||
-- Module Define
|
-- Module Define
|
||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local ThisModule = {
|
local ThisModule = {
|
||||||
on_init=function()
|
on_init=function()
|
||||||
if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end
|
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
|
||||||
|
if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ function Admin.temp_ban(player,by_player,reason)
|
|||||||
local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '<server>'
|
local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '<server>'
|
||||||
if not player or Admin.is_banned(player) then return end
|
if not player or Admin.is_banned(player) then return end
|
||||||
Admin.set_banned(player,'temp')
|
Admin.set_banned(player,'temp')
|
||||||
if Sync then Sync.emit_embeded{
|
if Sync then Sync.emit_embedded{
|
||||||
title='Player Temp-Ban',
|
title='Player Temp-Ban',
|
||||||
color=Color.to_hex(defines.textcolor.high),
|
color=Color.to_hex(defines.textcolor.high),
|
||||||
description='A player was jailed.',
|
description='A player was jailed.',
|
||||||
@@ -44,4 +45,4 @@ end
|
|||||||
Admin.add_action('Temp Ban',Admin.temp_ban)
|
Admin.add_action('Temp Ban',Admin.temp_ban)
|
||||||
|
|
||||||
-- Module Return
|
-- Module Return
|
||||||
return ThisModule
|
return setmetatable(ThisModule,{__call=Admin.temp_ban})
|
||||||
@@ -1,24 +1,24 @@
|
|||||||
{
|
{
|
||||||
"name": "TempBan",
|
"name": "ExpGamingAdmin.TempBan",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Adds a temp ban function to the admin set, requires ExpGamingCore.Role to work.",
|
||||||
"description": "Adds a temp ban function to the admin set, requires ExpGamingCore.Role to work.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Jail",
|
||||||
"Jail",
|
"Temp Ban",
|
||||||
"Temp Ban",
|
"Admin",
|
||||||
"Admin",
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"Roles"
|
||||||
"Roles"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingCore.Server": "^4.0.0",
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
"ExpGamingCore.Role": "^4.0.0",
|
||||||
"ExpGamingCore.Server": "^4.0.0",
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
"ExpGamingCore.Role": "^4.0.0",
|
"FactorioStdLib.Color": "?^0.8.0",
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
"ExpGamingCore.Sync": "?^4.0.0",
|
||||||
"FactorioStdLib.Color": "^0.8.0",
|
"ExpGamingAdmin.ClearInventory": "?^4.0.0",
|
||||||
"ExpGamingCore.Sync": "?^4.0.0",
|
"ExpGamingAdmin": "^4.0.0"
|
||||||
"ExpGamingAdmin.ClearInventory": "?^4.0.0"
|
},
|
||||||
},
|
"collection": "ExpGamingAdmin@4.0.0",
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,18 +2,18 @@
|
|||||||
-- @module ExpGamingAdmin.Warnings@4.0.0
|
-- @module ExpGamingAdmin.Warnings@4.0.0
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais ThisModule
|
-- @alias ThisModule
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0')
|
local Admin = require('ExpGamingAdmin')
|
||||||
local Server = require('ExpGamingCore.Server@^4.0.0')
|
local Server = require('ExpGamingCore.Server')
|
||||||
local Role = require('ExpGamingCore.Role@^4.0.0')
|
local Role = require('ExpGamingCore.Role')
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
local Color = require('FactorioStdLib.Color@^0.8.0')
|
local Color -- FactorioStdLib.Color@^0.8.0
|
||||||
local Sync -- ExpGamingCore.Sync@^4.0.0
|
local Sync -- ExpGamingCore.Sync@^4.0.0
|
||||||
|
|
||||||
-- Local Varibles
|
-- Local Variables
|
||||||
local take_action = 8 -- below this number no action is taken, the first admin given warning jumps to this number
|
local take_action = 8 -- the first admin given warning jumps to this number, this case kick-warn is giving
|
||||||
local remove_warnings_time = {}
|
local remove_warnings_time = {}
|
||||||
local min_time_to_remove_warning = 18000 -- this is in ticks
|
local min_time_to_remove_warning = 18000 -- this is in ticks
|
||||||
local punishments = {
|
local punishments = {
|
||||||
@@ -22,14 +22,14 @@ local punishments = {
|
|||||||
{'nothing'},
|
{'nothing'},
|
||||||
{'nothing'},
|
{'nothing'},
|
||||||
{'nothing'},
|
{'nothing'},
|
||||||
{'message',{'ExpGamingAdmin-Warnings@4-0-0.message'},defines.textcolor.info},
|
{'message',{'ExpGamingAdmin-Warnings.message'},defines.textcolor.info},
|
||||||
{'message',{'ExpGamingAdmin-Warnings@4-0-0.message'},defines.textcolor.info},
|
{'message',{'ExpGamingAdmin-Warnings.message'},defines.textcolor.info},
|
||||||
{'message',{'ExpGamingAdmin-Warnings@4-0-0.kick-warn'},defines.textcolor.med},
|
{'message',{'ExpGamingAdmin-Warnings.kick-warn'},defines.textcolor.med},
|
||||||
{'kick'},
|
{'kick'},
|
||||||
{'message',{'ExpGamingAdmin-Warnings@4-0-0.temp-warn'},defines.textcolor.high},
|
{'message',{'ExpGamingAdmin-Warnings.temp-warn'},defines.textcolor.high},
|
||||||
{'temp-ban'},
|
{'temp-ban'},
|
||||||
{'message',{'ExpGamingAdmin-Warnings@4-0-0.ban-warn'},defines.textcolor.high},
|
{'message',{'ExpGamingAdmin-Warnings.ban-warn'},defines.textcolor.high},
|
||||||
{'message',{'ExpGamingAdmin-Warnings@4-0-0.last-warn'},defines.textcolor.crit},
|
{'message',{'ExpGamingAdmin-Warnings.last-warn'},defines.textcolor.crit},
|
||||||
{'ban'}
|
{'ban'}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,10 +37,11 @@ local punishments = {
|
|||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local ThisModule = {
|
local ThisModule = {
|
||||||
on_init=function()
|
on_init=function()
|
||||||
if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end
|
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
|
||||||
if loaded_modules['ExpGamingAdmin.Reports@^4.0.0'] then
|
if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end
|
||||||
|
if loaded_modules['ExpGamingAdmin.Reports'] then
|
||||||
take_action = take_action + 1
|
take_action = take_action + 1
|
||||||
table.insert(punishments,take_action,{'report',{'ExpGamingAdmin-Warnings@4-0-0.reported'},defines.textcolor.med})
|
table.insert(punishments,take_action,{'report',{'ExpGamingAdmin-Warnings.reported'},defines.textcolor.med})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_post=function()
|
on_post=function()
|
||||||
@@ -59,17 +60,11 @@ local ThisModule = {
|
|||||||
local global = global{}
|
local global = global{}
|
||||||
|
|
||||||
-- Function Define
|
-- Function Define
|
||||||
local function valid_players(player,by_player)
|
|
||||||
local player = Game.get_player(player)
|
|
||||||
local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '<server>'
|
|
||||||
return player, by_player_name
|
|
||||||
end
|
|
||||||
|
|
||||||
local function give_punishment(player,by_player,reason)
|
local function give_punishment(player,by_player,reason)
|
||||||
local player, by_player_name = valid_players(player,by_player)
|
player, by_player = Admin.valid_players(player,by_player)
|
||||||
|
reason = reason or 'No Other Reason'
|
||||||
local warnings = Admin.get_warnings(player)
|
local warnings = Admin.get_warnings(player)
|
||||||
local punishment = punishments[warnings]
|
local punishment = punishments[warnings]
|
||||||
local reason = reason or 'No Other Reason'
|
|
||||||
if not punishment or punishment[1] == 'nothing' then return
|
if not punishment or punishment[1] == 'nothing' then return
|
||||||
elseif punishment[1] == 'message' then
|
elseif punishment[1] == 'message' then
|
||||||
local message = punishment[2]
|
local message = punishment[2]
|
||||||
@@ -81,47 +76,45 @@ local function give_punishment(player,by_player,reason)
|
|||||||
player_return(message,colour,player)
|
player_return(message,colour,player)
|
||||||
Admin.report(player,'<server>',reason)
|
Admin.report(player,'<server>',reason)
|
||||||
elseif punishment[1] == 'kick' then
|
elseif punishment[1] == 'kick' then
|
||||||
global.actions[player.name] = actions.kick
|
|
||||||
Admin.kick(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason)
|
Admin.kick(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason)
|
||||||
elseif punishment[1] == 'temp-ban' then
|
elseif punishment[1] == 'temp-ban' then
|
||||||
Admin.temp_ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason)
|
Admin.temp_ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason)
|
||||||
elseif punishment[1] == 'ban' then
|
elseif punishment[1] == 'ban' then
|
||||||
global.actions[player.name] = actions.ban
|
|
||||||
Admin.ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason)
|
Admin.ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Admin.get_warnings(player)
|
function Admin.get_warnings(player)
|
||||||
local player = Game.get_player(player)
|
player = Game.get_player(player)
|
||||||
return global[player.name] or 0
|
return global[player.name] or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function Admin.give_warning(player,by_player,reason,min)
|
function Admin.give_warning(player,by_player,reason,min)
|
||||||
local player, by_player_name = valid_players(player,by_player)
|
player, by_player = Admin.valid_players(player,by_player)
|
||||||
if not player then return end
|
if not player then return end
|
||||||
local min = Game.get_player(by_player) and take_action or min or 0
|
min = Game.get_player(by_player) and Game.get_player(by_player) ~= SERVER and take_action or min or 0
|
||||||
local warnings = Admin.get_warnings(player)
|
local warnings = Admin.get_warnings(player)
|
||||||
if warnings < min then warnings = min end
|
if warnings < min then warnings = min-1 end
|
||||||
warnings = warnings+1
|
warnings = warnings+1
|
||||||
global[player.name] = warnings
|
global[player.name] = warnings
|
||||||
if warnings > take_action then
|
if warnings > take_action then
|
||||||
player_return({'ExpGamingAdmin-Warnings@4-0-0.warning-given-by',by_player_name},defines.textcolor.info,player)
|
player_return({'ExpGamingAdmin-Warnings.warning-given-by',by_player.name},defines.textcolor.info,player)
|
||||||
game.print({'ExpGamingAdmin-Warnings@4-0-0.player-warning',player.name,by_player_name,reason})
|
game.print({'ExpGamingAdmin-Warnings.player-warning',player.name,by_player.name,reason})
|
||||||
end
|
end
|
||||||
give_punishment(player,by_player,reason)
|
give_punishment(player,by_player,reason)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Admin.clear_warings(player,by_player,no_emit)
|
function Admin.clear_warnings(player,by_player,no_emit)
|
||||||
local player, by_player_name = valid_players(player,by_player)
|
player, by_player = Admin.valid_players(player,by_player)
|
||||||
if not player then return end
|
if not player then return end
|
||||||
global[player.name]=0
|
global[player.name]=nil
|
||||||
if not no_emit and Sync then
|
if not no_emit and Sync then
|
||||||
Sync.emit_embeded{
|
Sync.emit_embedded{
|
||||||
title='Player Clear',
|
title='Player Clear',
|
||||||
color=Color.to_hex(defines.textcolor.low),
|
color=Color.to_hex(defines.textcolor.low),
|
||||||
description='A player had their warnings cleared.',
|
description='A player had their warnings cleared.',
|
||||||
['Player:']='<<inline>>'..player.name,
|
['Player:']='<<inline>>'..player.name,
|
||||||
['By:']='<<inline>>'..by_player_name,
|
['By:']='<<inline>>'..by_player.name,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -131,12 +124,12 @@ script.on_event(defines.events.on_tick,function(event)
|
|||||||
if (game.tick % min_time_to_remove_warning) == 0 then
|
if (game.tick % min_time_to_remove_warning) == 0 then
|
||||||
for name,warnings in pairs(global) do
|
for name,warnings in pairs(global) do
|
||||||
if warnings > 0 then
|
if warnings > 0 then
|
||||||
local role = Role.get(name)
|
local role = Role.get_highest(name)
|
||||||
local time_to_remove = remove_warnings_time[role.index]
|
local time_to_remove = remove_warnings_time[role.index]
|
||||||
if (game.tick % time_to_remove) == 0 then
|
if (game.tick % time_to_remove) == 0 then
|
||||||
global[name]=warnings-1
|
global[name]=warnings-1
|
||||||
if global.warnings[name] > 5 then
|
if global[name] > 5 then
|
||||||
player_return({'ExpGamingAdmin-Warnings@4-0-0.remove-warn',global[name],tick_to_display_format(time_to_remove)},defines.textcolor.low,name)
|
player_return({'ExpGamingAdmin-Warnings.remove-warn',global[name],tick_to_display_format(time_to_remove)},defines.textcolor.low,name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -145,4 +138,4 @@ script.on_event(defines.events.on_tick,function(event)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- Module Return
|
-- Module Return
|
||||||
return ThisModule
|
return ThisModule
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[ExpGamingAdmin-Warnings-4-0-0]
|
[ExpGamingAdmin-Warnings]
|
||||||
warning-given-by=This Warnings Was Given By: __1__
|
warning-given-by=This Warnings Was Given By: __1__
|
||||||
player-warning=__1__ was given a warning by __2__ reason: __3__
|
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
|
temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[ExpGamingAdmin-Warnings-4-0-0]
|
[ExpGamingAdmin-Warnings]
|
||||||
warning-given-by=This warning was given by: __1__
|
warning-given-by=This warning was given by: __1__
|
||||||
player-warning=__1__ was given a warning by __2__ for: __3__
|
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__
|
remove-warn=One of your warnings expired. You have __1__ warnings left, next warning will be removed in __2__
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[ExpGamingAdmin-Warnings-4-0-0]
|
[ExpGamingAdmin-Warnings]
|
||||||
warning-given-by=This Warnings Was Given By: __1__
|
warning-given-by=This Warnings Was Given By: __1__
|
||||||
player-warning=__1__ was given a warning by __2__ reason: __3__
|
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
|
temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[ExpGamingAdmin-Warnings-4-0-0]
|
[ExpGamingAdmin-Warnings]
|
||||||
warning-given-by=Deze waarschuwing is gegeven door: __1__
|
warning-given-by=Deze waarschuwing is gegeven door: __1__
|
||||||
player-warning=__1__ is gewaarschuwd door __2__ met de reden: __3__
|
player-warning=__1__ is gewaarschuwd door __2__ met de reden: __3__
|
||||||
temp-ban=__1__ is verbannen door __2__ en is gejailed tot de volgende reset.
|
temp-ban=__1__ is verbannen door __2__ en is gejailed tot de volgende reset.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[ExpGamingAdmin-Warnings-4-0-0]
|
[ExpGamingAdmin-Warnings]
|
||||||
warning-given-by=Den här varningen gavs av: __1__
|
warning-given-by=Den här varningen gavs av: __1__
|
||||||
player-warning=__1__ var tillfälligt bannlyst av __2__ och kommer att förbli i fängelset tills nästa återställning (reset)
|
player-warning=__1__ var tillfälligt bannlyst av __2__ och kommer att förbli i fängelset tills nästa återställning (reset)
|
||||||
remove-warn=En av dina varningar har gått ut. Du har __1__ varning kvar, nästa varning kommer at tas bort om __2__
|
remove-warn=En av dina varningar har gått ut. Du har __1__ varning kvar, nästa varning kommer at tas bort om __2__
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
{
|
{
|
||||||
"name": "Warnings",
|
"name": "ExpGamingAdmin.Warnings",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Adds a warning system into the admin set which can be used by admins and the script.",
|
||||||
"description": "Adds a warning system into the admin set which can be used by admins and the script.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Warning",
|
||||||
"Warning",
|
"Admin",
|
||||||
"Admin",
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"Report",
|
||||||
"Report",
|
"Kick",
|
||||||
"Kick",
|
"Punishments",
|
||||||
"Punishments",
|
"Ban"
|
||||||
"Ban"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingCore.Server": "^4.0.0",
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
"ExpGamingCore.Role": "^4.0.0",
|
||||||
"ExpGamingCore.Server": "^4.0.0",
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
"ExpGamingCore.Role": "^4.0.0",
|
"FactorioStdLib.Color": "?^0.8.0",
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
"ExpGamingAdmin.Reports": "?^4.0.0",
|
||||||
"FactorioStdLib.Color": "^0.8.0",
|
"ExpGamingCore.Sync": "?^4.0.0",
|
||||||
"ExpGamingAdmin.Reports": "?^4.0.0",
|
"ExpGamingAdmin": "^4.0.0"
|
||||||
"ExpGamingCore.Sync": "?^4.0.0"
|
},
|
||||||
},
|
"collection": "ExpGamingAdmin@4.0.0",
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,29 @@
|
|||||||
--- The base functions required to make the others work.
|
--- The base functions required to make the others work.
|
||||||
-- @module ExpGamingAdmin.AdminLib@4.0.0
|
-- @module ExpGamingAdmin@4.0.0
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais Admin
|
-- @alias Admin
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
|
local Color = require('FactorioStdLib.Color')
|
||||||
local Role -- ExpGamingCore.Role@^4.0.0
|
local Role -- ExpGamingCore.Role@^4.0.0
|
||||||
local Sync -- ExpGamingCore.Sync@^4.0.0
|
local Sync -- ExpGamingCore.Sync@^4.0.0
|
||||||
|
local Server -- ExpGamingCore.Server@^4.0.0
|
||||||
|
|
||||||
-- Module Define
|
-- Module Define
|
||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local Admin = {
|
local Admin = {
|
||||||
on_init=function()
|
on_init=function()
|
||||||
if loaded_modules['ExpGamingCore.Role@^4.0.0'] then Role = require('ExpGamingCore.Role@^4.0.0') end
|
if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end
|
||||||
if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end
|
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
|
||||||
if loaded_modules['ExpGamingCore.Server@^4.0.0'] then require('ExpGamingCore.Server@^4.0.0').add_module_to_interface('Admin','ExpGamingAdmin.AdminLib') end
|
if loaded_modules['ExpGamingCore.Server'] then
|
||||||
|
Server = require('ExpGamingCore.Server')
|
||||||
|
Server.add_module_to_interface('Admin','ExpGamingAdmin')
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
actions={},
|
actions={},
|
||||||
|
action_functions={},
|
||||||
action_names={}
|
action_names={}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,8 +33,14 @@ local global = global{
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- Function Define
|
-- Function Define
|
||||||
|
function Admin.valid_players(player,by_player)
|
||||||
|
player = Game.get_player(player)
|
||||||
|
by_player = Game.get_player(by_player) or SERVER
|
||||||
|
return player, by_player
|
||||||
|
end
|
||||||
|
|
||||||
function Admin.create_reason(reason,name)
|
function Admin.create_reason(reason,name)
|
||||||
local reason = reason or 'No Reason'
|
reason = reason or 'No Reason'
|
||||||
if not string.find(string.lower(reason),string.lower(name)) then reason = reason..' - '..name end
|
if not string.find(string.lower(reason),string.lower(name)) then reason = reason..' - '..name end
|
||||||
if Sync and Sync.info.date ~= '0000/00/00' and not string.find(string.lower(reason),Sync.info.date) then reason = reason..' - '..Sync.info.date end
|
if Sync and Sync.info.date ~= '0000/00/00' and not string.find(string.lower(reason),Sync.info.date) then reason = reason..' - '..Sync.info.date end
|
||||||
if not string.find(string.lower(reason),'appeal') then reason = reason..' - Vist www.explosivegaming.nl to appeal.' end
|
if not string.find(string.lower(reason),'appeal') then reason = reason..' - Vist www.explosivegaming.nl to appeal.' end
|
||||||
@@ -36,20 +48,20 @@ function Admin.create_reason(reason,name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Admin.allowed(player)
|
function Admin.allowed(player)
|
||||||
local player = Game.get_player(player)
|
player = Game.get_player(player)
|
||||||
if Role then
|
if Role then
|
||||||
return Role.allowed(player,'admin-commands')
|
return Role.allowed(player,'admin-commands')
|
||||||
else return player.admin end
|
else return player.admin end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Admin.set_banned(player,set)
|
function Admin.set_banned(player,set)
|
||||||
local player=Game.get_player(player)
|
player = Game.get_player(player)
|
||||||
if not player then return false end
|
if not player then return false end
|
||||||
global.banned[player.name] = set
|
global.banned[player.name] = set
|
||||||
end
|
end
|
||||||
|
|
||||||
function Admin.is_banned(player,detail)
|
function Admin.is_banned(player,detail)
|
||||||
local player=Game.get_player(player)
|
player = Game.get_player(player)
|
||||||
if not player then return false end
|
if not player then return false end
|
||||||
local banned = global.banned[player.name]
|
local banned = global.banned[player.name]
|
||||||
if banned == true then return true end
|
if banned == true then return true end
|
||||||
@@ -60,28 +72,28 @@ end
|
|||||||
|
|
||||||
function Admin.add_action(action,callback)
|
function Admin.add_action(action,callback)
|
||||||
verbose('Added admin action: '..action)
|
verbose('Added admin action: '..action)
|
||||||
table.insert(Admin.action_names,action)
|
Admin.actions[string.lower(action)] = table.insert(Admin.action_names,action)
|
||||||
Admin.actions[string.lower(action)] = callback
|
Admin.action_functions[string.lower(action)] = callback
|
||||||
end
|
end
|
||||||
|
|
||||||
function Admin.take_action(action,player,by_player,reason)
|
function Admin.take_action(action,player,by_player,reason)
|
||||||
|
if Admin.action_functions[string.lower(action)] then Admin.action_functions[string.lower(action)](player,by_player,reason) end
|
||||||
if Admin[action] then Admin[action](player,by_player,reason) end
|
if Admin[action] then Admin[action](player,by_player,reason) end
|
||||||
if Admin.actions[string.lower(action)] then Admin.actions[string.lower(action)](player,by_player,reason) end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Admin.clear_player(player,by_player)
|
function Admin.clear_player(player,by_player)
|
||||||
local player, by_player_name = valid_players(player,by_player)
|
player, by_player = Admin.valid_players(player,by_player)
|
||||||
if not player then return end
|
if not player then return end
|
||||||
if Admin.is_banned(player,true) == true then Server.interface(game.unban_player,true,player,by_player) end
|
if Server and Admin.is_banned(player,true) == true then Server.interface(game.unban_player,true,player) end
|
||||||
if Admin.clear_warings then Admin.clear_warings(player,by_player,true) end
|
if Admin.clear_warnings then Admin.clear_warnings(player,by_player,true) end
|
||||||
if Admin.clear_reports then Admin.clear_reports(player,by_player,true) end
|
if Admin.clear_reports then Admin.clear_reports(player,by_player,true) end
|
||||||
if Role.has_flag(player,'is_jail') then Server.interface(Role.revert,true,player,by_player,2) end
|
if Server and Role.has_flag(player,'is_jail') then Server.interface(Role.revert,true,player,by_player,2) end
|
||||||
if Sync then Sync.emit_embeded{
|
if Sync then Sync.emit_embedded{
|
||||||
title='Player Clear',
|
title='Player Clear',
|
||||||
color=Color.to_hex(defines.textcolor.low),
|
color=Color.to_hex(defines.textcolor.low),
|
||||||
description='A player had their reports and warnings cleared.',
|
description='A player had their reports and warnings cleared.',
|
||||||
['Player:']='<<inline>>'..player.name,
|
['Player:']='<<inline>>'..player.name,
|
||||||
['By:']='<<inline>>'..by_player_name,
|
['By:']='<<inline>>'..by_player.name,
|
||||||
} end
|
} end
|
||||||
Admin.set_banned(player,false)
|
Admin.set_banned(player,false)
|
||||||
end
|
end
|
||||||
15
modules/ExpGamingAdmin/locale/de.cfg
Normal file
15
modules/ExpGamingAdmin/locale/de.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
|
||||||
21
modules/ExpGamingAdmin/locale/en.cfg
Normal file
21
modules/ExpGamingAdmin/locale/en.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.
|
||||||
15
modules/ExpGamingAdmin/locale/fr.cfg
Normal file
15
modules/ExpGamingAdmin/locale/fr.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
|
||||||
15
modules/ExpGamingAdmin/locale/nl.cfg
Normal file
15
modules/ExpGamingAdmin/locale/nl.cfg
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
[ExpGamingAdmin]
|
||||||
|
name=Admin Commands
|
||||||
|
tooltip=Admin Commands kan je hier vinden.
|
||||||
|
no-info-file=Infobestand niet gevonden.
|
||||||
|
message=Selecteer een speler en de bijbehorende actie. Wees er zeker van dat je de correcte actie kiest.
|
||||||
|
warning=Fout: Je kan de rank van deze speler niet aanpassen omdat het jouw rank overtreft.
|
||||||
|
short-reason=Fout: De reden is te kort. (Warning: The reason is too short. UPDATE)
|
||||||
|
rank-high=Fout: Deze speler overtreft jouw rank.
|
||||||
|
invalid=Fout: De speler kan niet gevonden worden en/of de actie is onjuist. Probeer opnieuw!
|
||||||
|
take-action=Actie ondernemen
|
||||||
|
tooltip-ban=Ban speler
|
||||||
|
tooltip-kick=Kick speler
|
||||||
|
tooltip-jail=Jail speler
|
||||||
|
tooltip-go-to=Ga naar speler
|
||||||
|
tooltip-bring=Breng speler
|
||||||
19
modules/ExpGamingAdmin/locale/sv-SE.cfg
Normal file
19
modules/ExpGamingAdmin/locale/sv-SE.cfg
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
[ExpGamingAdmin]
|
||||||
|
name=Adminkommandon
|
||||||
|
tooltip=Adminkommando gör dit hem här
|
||||||
|
no-info-file=Ingen informationsfil kunde hittas
|
||||||
|
message=Var snäll och välj en spelare och en åtgärd att utfärda, se till att du väljer den rätta!
|
||||||
|
warning=Warning: Den här spelaren har högre rang än dig. Därför kan du inte redigera dess rang.
|
||||||
|
short-reason=Warning: Skälet är för kort.
|
||||||
|
rank-high=Warning: Den här spelaren har högre rang än dig. Därför kan du inte redigera dess rang.
|
||||||
|
invalid=Spelaren eller åtgärden är ogiltig. Var vänlig och försök igen!
|
||||||
|
take-action=Utför åtgärd.
|
||||||
|
tooltip-ban=Bannlys Spelare
|
||||||
|
tooltip-kick=Sparka Spelare
|
||||||
|
tooltip-jail=Fängsla Spelare
|
||||||
|
tooltip-go-to=Gå till Spelare
|
||||||
|
tooltip-bring=Hämta spelare
|
||||||
|
report=Rapportera Spelare
|
||||||
|
low-print=__1__ har blivit rapporterad av __2__ för: __3__
|
||||||
|
high-print=__1__ har blivit rapporterad av __2__ för: __3__
|
||||||
|
cant-report=Den här spelaren kan inte bli rapporterad.
|
||||||
@@ -1,275 +1,37 @@
|
|||||||
{
|
{
|
||||||
"name": "ExpGamingAdmin",
|
"name": "ExpGamingAdmin",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Collection",
|
"description": "A set of useful admin commands and functions that can be used by other modules.",
|
||||||
"description": "A set of useful admin commands and functions that can be used by other modules.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Admin",
|
||||||
"Admin",
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"Set",
|
||||||
"Set",
|
"Commands",
|
||||||
"Commands",
|
"Functions",
|
||||||
"Functions",
|
"Scripts",
|
||||||
"Scripts",
|
"Useful"
|
||||||
"Useful"
|
],
|
||||||
],
|
"author": "Cooldude2606",
|
||||||
"author": "Cooldude2606",
|
"contact": "Discord: Cooldude2606#5241",
|
||||||
"contact": "Discord: Cooldude2606#5241",
|
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
||||||
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
"submodules": {
|
||||||
"submodules": {
|
"ExpGamingAdmin": "4.0.0",
|
||||||
"AdminLib": {
|
"ExpGamingAdmin.Ban": "4.0.0",
|
||||||
"name": "AdminLib",
|
"ExpGamingAdmin.ClearInventory": "4.0.0",
|
||||||
"version": "4.0.0",
|
"ExpGamingAdmin.Gui": "4.0.0",
|
||||||
"type": "Submodule",
|
"ExpGamingAdmin.Jail": "4.0.0",
|
||||||
"description": "The base functions required to make the others work.",
|
"ExpGamingAdmin.Kick": "4.0.0",
|
||||||
"location": "<blank>",
|
"ExpGamingAdmin.Reports": "4.0.0",
|
||||||
"keywords": [
|
"ExpGamingAdmin.Teleport": "4.0.0",
|
||||||
"lib",
|
"ExpGamingAdmin.TempBan": "4.0.0",
|
||||||
"ExpGaming",
|
"ExpGamingAdmin.Warnings": "4.0.0",
|
||||||
"Admin"
|
"ExpGamingAdmin.Commands": "4.0.0"
|
||||||
],
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"FactorioStdLib": "^0.8.0",
|
"ExpGamingCore.Role": "?^4.0.0",
|
||||||
"ExpGamingCore.Role": "?^4.0.0",
|
"ExpGamingCore.Sync": "?^4.0.0",
|
||||||
"ExpGamingCore.Sync": "?^4.0.0"
|
"ExpGamingCore.Server": "?^4.0.0",
|
||||||
},
|
"FactorioStdLib.Game": "^0.8.0"
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
}
|
||||||
},
|
}
|
||||||
"Ban": {
|
|
||||||
"name": "Ban",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Adds a custom ban function to the admin command set.",
|
|
||||||
"location": "<blank>",
|
|
||||||
"keywords": [
|
|
||||||
"Ban",
|
|
||||||
"Admin",
|
|
||||||
"Set",
|
|
||||||
"ExpGaming"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
|
||||||
"ExpGamingAdmin.Gui": "^4.0.0",
|
|
||||||
"ExpGamingCore.Server": "^4.0.0",
|
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
|
||||||
"FactorioStdLib.Color": "?^0.8.0",
|
|
||||||
"ExpGamingCore.Sync": "?^4.0.0",
|
|
||||||
"ExpGamingAdmin.ClearInventory": "?^4.0.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
|
||||||
},
|
|
||||||
"ClearInventory": {
|
|
||||||
"name": "ClearInventory",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Adds a function to clear a players inventoy and move the items to spawn.",
|
|
||||||
"location": "<blank>",
|
|
||||||
"keywords": [
|
|
||||||
"Spawn",
|
|
||||||
"Items",
|
|
||||||
"Admin",
|
|
||||||
"Move",
|
|
||||||
"Clear",
|
|
||||||
"Inventory"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
|
||||||
"FactorioStdLib.Game": "^0.8.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
|
||||||
},
|
|
||||||
"Gui": {
|
|
||||||
"name": "Gui",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Adds a gui that can be used to access all the admin commands.",
|
|
||||||
"location": "<blank>",
|
|
||||||
"keywords": [
|
|
||||||
"Admin",
|
|
||||||
"ExpGaming",
|
|
||||||
"Commands",
|
|
||||||
"Gui"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
|
||||||
"ExpGamingCore.Gui": "^4.0.0",
|
|
||||||
"ExpGamingCore.Role": "^4.0.0",
|
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
|
||||||
"ExpGamingPlayer": "?^4.0.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
|
||||||
},
|
|
||||||
"Jail": {
|
|
||||||
"name": "Jail",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Adds a jail function to the admin set, require ExpGamingCore.Role to work.",
|
|
||||||
"location": "<blank>",
|
|
||||||
"keywords": [
|
|
||||||
"Jail",
|
|
||||||
"Roles",
|
|
||||||
"Admin",
|
|
||||||
"ExpGaming"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
|
||||||
"ExpGamingAdmin.Gui": "^4.0.0",
|
|
||||||
"ExpGamingCore.Server": "^4.0.0",
|
|
||||||
"ExpGamingCore.Role": "^4.0.0",
|
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
|
||||||
"FactorioStdLib.Color": "?^0.8.0",
|
|
||||||
"ExpGamingCore.Sync": "?^4.0.0",
|
|
||||||
"ExpGamingAdmin.ClearInventory": "?^4.0.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
|
||||||
},
|
|
||||||
"Kick": {
|
|
||||||
"name": "Kick",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Adds a kick function to the admin function set.",
|
|
||||||
"location": "<blank>",
|
|
||||||
"keywords": [
|
|
||||||
"Admin",
|
|
||||||
"ExpGaming",
|
|
||||||
"Kick",
|
|
||||||
"Commands"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
|
||||||
"ExpGamingAdmin.Gui": "^4.0.0",
|
|
||||||
"ExpGamingCore.Server": "^4.0.0",
|
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
|
||||||
"FactorioStdLib.Color": "?^0.8.0",
|
|
||||||
"ExpGamingCore.Sync": "?^4.0.0",
|
|
||||||
"ExpGamingAdmin.ClearInventory": "?^4.0.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
|
||||||
},
|
|
||||||
"Reports": {
|
|
||||||
"name": "Reports",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Adds a report system into the game that can also push notifactions to discord.",
|
|
||||||
"location": "<blank>",
|
|
||||||
"keywords": [
|
|
||||||
"Report",
|
|
||||||
"Player",
|
|
||||||
"Admin",
|
|
||||||
"ExpGaming",
|
|
||||||
"Player List",
|
|
||||||
"Commands"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
|
||||||
"ExpGamingCore.Server": "^4.0.0",
|
|
||||||
"ExpGamingCore.Role": "^4.0.0",
|
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
|
||||||
"FactorioStdLib.Color": "^0.8.0",
|
|
||||||
"ExpGamingCore.Sync": "?^4.0.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
|
||||||
},
|
|
||||||
"Teleport": {
|
|
||||||
"name": "Teleport",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Adds three function to admin: tp, bring and go to, these all move the player.",
|
|
||||||
"location": "<blank>",
|
|
||||||
"keywords": [
|
|
||||||
"Tp",
|
|
||||||
"Bring",
|
|
||||||
"Go To",
|
|
||||||
"Admin",
|
|
||||||
"ExpGaming",
|
|
||||||
"Teleport",
|
|
||||||
"Commands"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
|
||||||
"ExpGamingAdmin.Gui": "^4.0.0",
|
|
||||||
"FactorioStdLib.Game": "^0.8.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
|
||||||
},
|
|
||||||
"TempBan": {
|
|
||||||
"name": "TempBan",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Adds a temp ban function to the admin set, requires ExpGamingCore.Role to work.",
|
|
||||||
"location": "<blank>",
|
|
||||||
"keywords": [
|
|
||||||
"Jail",
|
|
||||||
"Temp Ban",
|
|
||||||
"Admin",
|
|
||||||
"ExpGaming",
|
|
||||||
"Roles"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
|
||||||
"ExpGamingCore.Server": "^4.0.0",
|
|
||||||
"ExpGamingCore.Role": "^4.0.0",
|
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
|
||||||
"FactorioStdLib.Color": "^0.8.0",
|
|
||||||
"ExpGamingCore.Sync": "?^4.0.0",
|
|
||||||
"ExpGamingAdmin.ClearInventory": "?^4.0.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
|
||||||
},
|
|
||||||
"Warnings": {
|
|
||||||
"name": "Warnings",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Adds a warning system into the admin set which can be used by admins and the script.",
|
|
||||||
"location": "<blank>",
|
|
||||||
"keywords": [
|
|
||||||
"Warning",
|
|
||||||
"Admin",
|
|
||||||
"ExpGaming",
|
|
||||||
"Report",
|
|
||||||
"Kick",
|
|
||||||
"Punishments",
|
|
||||||
"Ban"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingAdmin.AdminLib": "^4.0.0",
|
|
||||||
"ExpGamingCore.Server": "^4.0.0",
|
|
||||||
"ExpGamingCore.Role": "^4.0.0",
|
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
|
||||||
"FactorioStdLib.Color": "^0.8.0",
|
|
||||||
"ExpGamingAdmin.Reports": "?^4.0.0",
|
|
||||||
"ExpGamingCore.Sync": "?^4.0.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
|
||||||
},
|
|
||||||
"Commands": {
|
|
||||||
"name": "Commands",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Admins many of the admin featues which the script can use as in game commands.",
|
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.admin_4.0.0.zip",
|
|
||||||
"keywords": [
|
|
||||||
"ExpGaming",
|
|
||||||
"Admin",
|
|
||||||
"Tools",
|
|
||||||
"Commands",
|
|
||||||
"Temp ban",
|
|
||||||
"Jail",
|
|
||||||
"Clear Inventory",
|
|
||||||
"Report",
|
|
||||||
"Warnings"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingLib": "^4.0.0",
|
|
||||||
"ExpGamingCore.Command": "^4.0.0",
|
|
||||||
"ExpGamingAdmin.TempBan": "?^4.0.0",
|
|
||||||
"ExpGamingAdmin.Jail": "?^4.0.0",
|
|
||||||
"ExpGamingAdmin.Warnings": "?^4.0.0",
|
|
||||||
"ExpGamingAdmin.Reports": "^?4.0.0",
|
|
||||||
"ExpGamingAdmin.ClearInventory": "?^4.0.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingAdmin_4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
--- Sends messages in chat in resposce to other messages
|
--- Sends messages in chat in response to other messages
|
||||||
-- @module ExpGamingBot.autoChat
|
-- @module ExpGamingBot.autoChat
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais ThisModule
|
-- @alias ThisModule
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
local Server = require('ExpGamingCore.Server@^4.0.0')
|
local Server = require('ExpGamingCore.Server')
|
||||||
local Role -- ExpGamingCore.Role@^4.0.0
|
local Role -- ExpGamingCore.Role@^4.0.0
|
||||||
|
|
||||||
-- Local Varibles
|
-- Local Variables
|
||||||
-- lots of these are jokes, but some have uses
|
-- lots of these are jokes, but some have uses
|
||||||
|
|
||||||
-- white spaces removed and made into lower
|
-- white spaces removed and made into lower
|
||||||
@@ -34,12 +34,12 @@ local messages = {
|
|||||||
}
|
}
|
||||||
-- white spaces removed and made into lower
|
-- white spaces removed and made into lower
|
||||||
-- these are global chat commands that can be used
|
-- these are global chat commands that can be used
|
||||||
-- comands start with ! (all messages are also commands)
|
-- commands start with ! (all messages are also commands)
|
||||||
local command_syntax = '!'
|
local command_syntax = '!'
|
||||||
local commands = {
|
local commands = {
|
||||||
['online']=function(player) return {'ExpGamingBot-autoChat.players-online',#game.connected_players} end,
|
['online']=function() return {'ExpGamingBot-autoChat.players-online',#game.connected_players} end,
|
||||||
['playtime']=function(player) return {'ExpGamingBot-autoChat.map-time',tick_to_display_format(game.tick)} end,
|
['playtime']=function() return {'ExpGamingBot-autoChat.map-time',tick_to_display_format(game.tick)} end,
|
||||||
['players']=function(player) return {'ExpGamingBot-autoChat.players',#game.players} end,
|
['players']=function() return {'ExpGamingBot-autoChat.players',#game.players} end,
|
||||||
['dev']={'ExpGamingBot-autoChat.not-real-dev'},
|
['dev']={'ExpGamingBot-autoChat.not-real-dev'},
|
||||||
['blame']=function(player) local names = {'Cooldude2606','arty714','badgamernl',player.name} return {'ExpGamingBot-autoChat.blame',names[math.random(#names)]} end,
|
['blame']=function(player) local names = {'Cooldude2606','arty714','badgamernl',player.name} return {'ExpGamingBot-autoChat.blame',names[math.random(#names)]} end,
|
||||||
['readme']={'ExpGamingBot-autoChat.read-readme'},
|
['readme']={'ExpGamingBot-autoChat.read-readme'},
|
||||||
@@ -49,15 +49,17 @@ local commands = {
|
|||||||
['lenny']={'ExpGamingBot-autoChat.lenny'},
|
['lenny']={'ExpGamingBot-autoChat.lenny'},
|
||||||
['feedback']={'ExpGamingBot-autoChat.feedback'},
|
['feedback']={'ExpGamingBot-autoChat.feedback'},
|
||||||
['wiki']={'ExpGamingBot-autoChat.wiki'},
|
['wiki']={'ExpGamingBot-autoChat.wiki'},
|
||||||
['hodor']=function(player) local options = {'?','.','!','!!!'} return {'ExpGamingBot-autoChat.hodor',options[math.random(#options)]} end,
|
['hodor']=function() local options = {'?','.','!','!!!'} return {'ExpGamingBot-autoChat.hodor',options[math.random(#options)]} end,
|
||||||
['evolution']=function(player) return {'ExpGamingBot-autoChat.current-evolution',string.format('%.2f',game.forces['enemy'].evolution_factor)} end,
|
['evolution']=function() return {'ExpGamingBot-autoChat.current-evolution',string.format('%.2f',game.forces['enemy'].evolution_factor)} end,
|
||||||
--Jokes about food and drink
|
--Jokes about food and drink
|
||||||
['whattoeat']={'ExpGamingBot-autoChat.food'},
|
['whattoeat']={'ExpGamingBot-autoChat.food'},
|
||||||
|
|
||||||
['makepopcorn']=function(player) Server.new_thread{
|
['makepopcorn']=function(player) Server.new_thread{
|
||||||
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
||||||
}:on_event('timeout',function(self)
|
}:on_event('timeout',function(self)
|
||||||
if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-popcorn-2',self.data}} end
|
if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-popcorn-2',self.data}} end
|
||||||
end):open() return {'ExpGamingBot-autoChat.get-popcorn-1'} end,
|
end):open() return {'ExpGamingBot-autoChat.get-popcorn-1'} end,
|
||||||
|
|
||||||
['orderpizza']=function(player) Server.new_thread{
|
['orderpizza']=function(player) Server.new_thread{
|
||||||
timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true
|
timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true
|
||||||
}:on_event('timeout',function(self)
|
}:on_event('timeout',function(self)
|
||||||
@@ -66,6 +68,7 @@ local commands = {
|
|||||||
end
|
end
|
||||||
self.data[2]=self.data[2]+1
|
self.data[2]=self.data[2]+1
|
||||||
end):open() return {'ExpGamingBot-autoChat.order-pizza-1'} end,
|
end):open() return {'ExpGamingBot-autoChat.order-pizza-1'} end,
|
||||||
|
|
||||||
['passsomesnaps']=function(player) Server.new_thread{
|
['passsomesnaps']=function(player) Server.new_thread{
|
||||||
timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true
|
timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true
|
||||||
}:on_event('timeout',function(self)
|
}:on_event('timeout',function(self)
|
||||||
@@ -74,6 +77,7 @@ local commands = {
|
|||||||
end
|
end
|
||||||
self.data[2]=self.data[2]+1
|
self.data[2]=self.data[2]+1
|
||||||
end):open() return {'ExpGamingBot-autoChat.get-snaps-1'} end,
|
end):open() return {'ExpGamingBot-autoChat.get-snaps-1'} end,
|
||||||
|
|
||||||
['makecocktail']=function(player) Server.new_thread{
|
['makecocktail']=function(player) Server.new_thread{
|
||||||
timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true
|
timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true
|
||||||
}:on_event('timeout',function(self)
|
}:on_event('timeout',function(self)
|
||||||
@@ -82,11 +86,13 @@ local commands = {
|
|||||||
end
|
end
|
||||||
self.data[2]=self.data[2]+1
|
self.data[2]=self.data[2]+1
|
||||||
end):open() return {'ExpGamingBot-autoChat.get-cocktail-1'} end,
|
end):open() return {'ExpGamingBot-autoChat.get-cocktail-1'} end,
|
||||||
|
|
||||||
['makecoffee']=function(player) Server.new_thread{
|
['makecoffee']=function(player) Server.new_thread{
|
||||||
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
||||||
}:on_event('timeout',function(self)
|
}:on_event('timeout',function(self)
|
||||||
if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.make-coffee-2',self.data}} end
|
if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.make-coffee-2',self.data}} end
|
||||||
end):open() return {'ExpGamingBot-autoChat.make-coffee-1'} end,
|
end):open() return {'ExpGamingBot-autoChat.make-coffee-1'} end,
|
||||||
|
|
||||||
['orderpizza']=function(player) Server.new_thread{
|
['orderpizza']=function(player) Server.new_thread{
|
||||||
timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true
|
timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true
|
||||||
}:on_event('timeout',function(self)
|
}:on_event('timeout',function(self)
|
||||||
@@ -95,21 +101,25 @@ local commands = {
|
|||||||
end
|
end
|
||||||
self.data[2]=self.data[2] + 1
|
self.data[2]=self.data[2] + 1
|
||||||
end):open() return {'ExpGamingBot-autoChat.order-pizza-1'} end,
|
end):open() return {'ExpGamingBot-autoChat.order-pizza-1'} end,
|
||||||
|
|
||||||
['maketea']=function(player) Server.new_thread{
|
['maketea']=function(player) Server.new_thread{
|
||||||
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
||||||
}:on_event('timeout',function(self)
|
}:on_event('timeout',function(self)
|
||||||
if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.make-tea-2',self.data}} end
|
if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.make-tea-2',self.data}} end
|
||||||
end):open() return {'ExpGamingBot-autoChat.make-tea-1'} end,
|
end):open() return {'ExpGamingBot-autoChat.make-tea-1'} end,
|
||||||
|
|
||||||
['popcorn']=function(player) Server.new_thread{
|
['popcorn']=function(player) Server.new_thread{
|
||||||
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
||||||
}:on_event('timeout',function(self)
|
}:on_event('timeout',function(self)
|
||||||
if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-popcorn-2',self.data}} end
|
if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-popcorn-2',self.data}} end
|
||||||
end):open() return {'ExpGamingBot-autoChat.get-popcorn-1'} end,
|
end):open() return {'ExpGamingBot-autoChat.get-popcorn-1'} end,
|
||||||
|
|
||||||
['meadplease']=function(player) Server.new_thread{
|
['meadplease']=function(player) Server.new_thread{
|
||||||
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
||||||
}:on_event('timeout',function(self)
|
}:on_event('timeout',function(self)
|
||||||
if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-mead-2',self.data}} end
|
if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-mead-2',self.data}} end
|
||||||
end):open() return {'ExpGamingBot-autoChat.get-mead-1'} end,
|
end):open() return {'ExpGamingBot-autoChat.get-mead-1'} end,
|
||||||
|
|
||||||
['passabeer']=function(player) Server.new_thread{
|
['passabeer']=function(player) Server.new_thread{
|
||||||
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
||||||
}:on_event('timeout',function(self)
|
}:on_event('timeout',function(self)
|
||||||
@@ -121,7 +131,7 @@ local commands = {
|
|||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local ThisModule = {
|
local ThisModule = {
|
||||||
on_init=function()
|
on_init=function()
|
||||||
if loaded_modules['ExpGamingCore.Role@^4.0.0'] then Role = require('ExpGamingCore.Role@^4.0.0') end
|
if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,4 +163,4 @@ script.on_event(defines.events.on_console_chat,function(event)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- Module Return
|
-- Module Return
|
||||||
return ThisModule
|
return ThisModule
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
{
|
{
|
||||||
"name": "autoChat",
|
"name": "ExpGamingBot.autoChat",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Sends messages in chat based on what has been said by other players",
|
||||||
"description": "Sends messages in chat based on what has been said by other players",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Chat",
|
||||||
"Chat",
|
"Bot",
|
||||||
"Bot",
|
"Jokes",
|
||||||
"Jokes",
|
"Fun"
|
||||||
"Fun"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
"ExpGamingCore.Server": "^4.0.0",
|
||||||
"ExpGamingCore.Server": "^4.0.0",
|
"ExpGamingCore.Role": "?^4.0.0"
|
||||||
"ExpGamingCore.Role": "?^4.0.0"
|
},
|
||||||
},
|
"collection": "ExpGamingBot@4.0.0",
|
||||||
"collection": "ExpGamingBot_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
-- @module ExpGamingBot.autoMessage
|
-- @module ExpGamingBot.autoMessage
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais ThisModule
|
-- @alias ThisModule
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Server = require('ExpGamingCore.Server')
|
local Server = require('ExpGamingCore.Server')
|
||||||
@@ -10,14 +10,14 @@ local Game = require('FactorioStdLib.Game')
|
|||||||
local Role -- ExpGamingCore.Role@4.0.0
|
local Role -- ExpGamingCore.Role@4.0.0
|
||||||
local Sync -- ExpGamingCore.Sync@4.0.0
|
local Sync -- ExpGamingCore.Sync@4.0.0
|
||||||
|
|
||||||
-- Local Varibles
|
-- Local Variables
|
||||||
|
|
||||||
-- Module Define
|
-- Module Define
|
||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local ThisModule = {
|
local ThisModule = {
|
||||||
on_init=function()
|
on_init=function()
|
||||||
if loaded_modules['ExpGamingCore.Role@^4.0.0'] then Role = require('ExpGamingCore.Role@^4.0.0') end
|
if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end
|
||||||
if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end
|
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
|
||||||
end,
|
end,
|
||||||
on_post=function()
|
on_post=function()
|
||||||
--code
|
--code
|
||||||
@@ -25,7 +25,7 @@ local ThisModule = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- Event Handlers Define
|
-- Event Handlers Define
|
||||||
script.on_init(function(event)
|
script.on_init(function()
|
||||||
Server.new_thread{
|
Server.new_thread{
|
||||||
name='auto-message',
|
name='auto-message',
|
||||||
timeout=54000, -- 3240000 = 15 hours dont make the mistake i did, 54000 is 15 minutes
|
timeout=54000, -- 3240000 = 15 hours dont make the mistake i did, 54000 is 15 minutes
|
||||||
@@ -54,13 +54,12 @@ script.on_init(function(event)
|
|||||||
local data = self.data
|
local data = self.data
|
||||||
if not data.high_role or not data.low_role
|
if not data.high_role or not data.low_role
|
||||||
or not data.low then self.reopen = false return end
|
or not data.low then self.reopen = false return end
|
||||||
-- idk but this stoped working for no appent reason so i added more checks for nil values
|
|
||||||
if Role and Role.get_highest(player).index <= Role.get(data.low_role).index or player.admin then return end
|
if Role and Role.get_highest(player).index <= Role.get(data.low_role).index or player.admin then return end
|
||||||
for _,message in pairs(data.low) do
|
for _,message in pairs(data.low) do
|
||||||
player_return({'ExpGamingBot-autoMessage.message',message},nil,player)
|
player_return({'ExpGamingBot-autoMessage.message',message},nil,player)
|
||||||
end
|
end
|
||||||
end):on_event('error',function(self,err)
|
end):on_event('error',function(self,err)
|
||||||
if Sync then Sync.emit_embeded{
|
if Sync then Sync.emit_embedded{
|
||||||
title='Auto Message Error',
|
title='Auto Message Error',
|
||||||
color=Color.to_hex(defines.textcolor.bg),
|
color=Color.to_hex(defines.textcolor.bg),
|
||||||
description='Auto Message Error - Closed Thread',
|
description='Auto Message Error - Closed Thread',
|
||||||
@@ -72,4 +71,4 @@ script.on_init(function(event)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- Module Return
|
-- Module Return
|
||||||
return ThisModule
|
return ThisModule
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
{
|
{
|
||||||
"name": "autoMessage",
|
"name": "ExpGamingBot.autoMessage",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Prints a message every 15 minutes to chat.",
|
||||||
"description": "Prints a message every 15 minutes to chat.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Bot",
|
||||||
"Bot",
|
"Chat",
|
||||||
"Chat",
|
"Auto Message",
|
||||||
"Auto Message",
|
"Message"
|
||||||
"Message"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingCore.Server": "^4.0.0",
|
||||||
"ExpGamingCore.Server": "^4.0.0",
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
"ExpGamingCore.Role": "?^4.0.0",
|
||||||
"ExpGamingCore.Role": "?^4.0.0",
|
"ExpGamingCore.Sync": "?^4.0.0"
|
||||||
"ExpGamingCore.Sync": "?^4.0.0"
|
},
|
||||||
},
|
"collection": "ExpGamingBot@4.0.0",
|
||||||
"collection": "ExpGamingBot_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
-- @module ExpGamingBot.discordAlerts@4.0.0
|
-- @module ExpGamingBot.discordAlerts@4.0.0
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais ThisModule
|
-- @alias ThisModule
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Sync = require('ExpGamingCore.Sync@^4.0.0')
|
local Sync = require('ExpGamingCore.Sync')
|
||||||
local Color = require('FactorioStdLib.Color@^0.8.0')
|
local Color = require('FactorioStdLib.Color')
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
|
|
||||||
-- Module Define
|
-- Module Define
|
||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
@@ -23,7 +23,7 @@ script.on_event(defines.events.on_console_command,function(event)
|
|||||||
data.by = event.player_index and game.players[event.player_index].name or '<server>'
|
data.by = event.player_index and game.players[event.player_index].name or '<server>'
|
||||||
if data.by == '<server>' then return end
|
if data.by == '<server>' then return end
|
||||||
if command == 'config' or command == 'banlist' then
|
if command == 'config' or command == 'banlist' then
|
||||||
Sync.emit_embeded{
|
Sync.emit_embedded{
|
||||||
title='Edit To '..data.title,
|
title='Edit To '..data.title,
|
||||||
color=Color.to_hex(defines.textcolor.bg),
|
color=Color.to_hex(defines.textcolor.bg),
|
||||||
description='A player edited the '..command..'.',
|
description='A player edited the '..command..'.',
|
||||||
@@ -48,7 +48,7 @@ script.on_event(defines.events.on_console_command,function(event)
|
|||||||
if not Game.get_player(data.username) then return end
|
if not Game.get_player(data.username) then return end
|
||||||
if string.sub(command,-1) == 'e' then data.command = command..'d' else data.command = command..'ed' end
|
if string.sub(command,-1) == 'e' then data.command = command..'d' else data.command = command..'ed' end
|
||||||
data.reason = data.reason and data.reason ~= '' and data.reason or 'No Reason Required'
|
data.reason = data.reason and data.reason ~= '' and data.reason or 'No Reason Required'
|
||||||
Sync.emit_embeded{
|
Sync.emit_embedded{
|
||||||
title='Player '..data.title,
|
title='Player '..data.title,
|
||||||
color=data.colour,
|
color=data.colour,
|
||||||
description='There was a player '..data.command..'.',
|
description='There was a player '..data.command..'.',
|
||||||
@@ -60,4 +60,4 @@ script.on_event(defines.events.on_console_command,function(event)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- Module Return
|
-- Module Return
|
||||||
return ThisModule
|
return ThisModule
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
{
|
{
|
||||||
"name": "discordAlerts",
|
"name": "ExpGamingBot.discordAlerts",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Sends alerts to discord once there is a bot set up to read the alerts.",
|
||||||
"description": "Sends alerts to discord once there is a bot set up to read the alerts.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Bot",
|
||||||
"Bot",
|
"Discord",
|
||||||
"Discord",
|
"Alerts",
|
||||||
"Alerts",
|
"Messages",
|
||||||
"Messages",
|
"Acctions"
|
||||||
"Acctions"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingCore.Sync": "^4.0.0",
|
||||||
"ExpGamingCore.Sync": "^4.0.0",
|
"FactorioStdLib.Color": "^0.8.0",
|
||||||
"FactorioStdLib.Color": "^0.8.0",
|
"FactorioStdLib.Game": "^0.8.0"
|
||||||
"FactorioStdLib.Game": "^0.8.0"
|
},
|
||||||
},
|
"collection": "ExpGamingBot@4.0.0",
|
||||||
"collection": "ExpGamingBot_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,78 +1,22 @@
|
|||||||
{
|
{
|
||||||
"name": "ExpGamingBot",
|
"name": "ExpGamingBot",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Collection",
|
"description": "Different parts of a useful bot to help run a server. Discord Bot Not Included.",
|
||||||
"description": "Different parts of a useful bot to help run a server. Discord Bot Not Included.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Discord",
|
||||||
"Discord",
|
"Bot",
|
||||||
"Bot",
|
"Messages",
|
||||||
"Messages",
|
"Chat",
|
||||||
"Chat",
|
"Auto"
|
||||||
"Auto"
|
],
|
||||||
],
|
"author": "Cooldude2606",
|
||||||
"author": "Cooldude2606",
|
"contact": "Discord: Cooldude2606#5241",
|
||||||
"contact": "Discord: Cooldude2606#5241",
|
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
||||||
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
"submodules": {
|
||||||
"submodules": {
|
"ExpGamingBot.autoChat": "4.0.0",
|
||||||
"autoChat": {
|
"ExpGamingBot.autoMessage": "4.0.0",
|
||||||
"name": "autoChat",
|
"ExpGamingBot.discordAlerts": "4.0.0"
|
||||||
"version": "4.0.0",
|
},
|
||||||
"type": "Submodule",
|
"dependencies": {}
|
||||||
"description": "Sends messages in chat based on what has been said by other players",
|
}
|
||||||
"location": "<blank>",
|
|
||||||
"keywords": [
|
|
||||||
"Chat",
|
|
||||||
"Bot",
|
|
||||||
"Jokes",
|
|
||||||
"Fun"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
|
||||||
"ExpGamingCore.Role": "?^4.0.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingBot_4.0.0"
|
|
||||||
},
|
|
||||||
"autoMessage": {
|
|
||||||
"name": "autoMessage",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Prints a message every 15 minutes to chat.",
|
|
||||||
"location": "<blank>",
|
|
||||||
"keywords": [
|
|
||||||
"Bot",
|
|
||||||
"Chat",
|
|
||||||
"Auto Message",
|
|
||||||
"Message"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingCore.Server": "^4.0.0",
|
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
|
||||||
"ExpGamingCore.Role": "?^4.0.0",
|
|
||||||
"ExpGamingCore.Sync": "?^4.0.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingBot_4.0.0"
|
|
||||||
},
|
|
||||||
"discordAlerts": {
|
|
||||||
"name": "discordAlerts",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Sends alerts to discord once there is a bot set up to read the alerts.",
|
|
||||||
"location": "<blank>",
|
|
||||||
"keywords": [
|
|
||||||
"Bot",
|
|
||||||
"Discord",
|
|
||||||
"Alerts",
|
|
||||||
"Messages",
|
|
||||||
"Acctions"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingCore.Sync": "^4.0.0",
|
|
||||||
"FactorioStdLib.Color": "^0.8.0",
|
|
||||||
"FactorioStdLib.Game": "^0.8.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingBot_4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
|
|
||||||
local global = global{}
|
local global = global{}
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
|
|
||||||
-- these are the settings which are changed with scale being as +100%
|
-- these are the settings which are changed with scale being as +100%
|
||||||
local settings = {
|
local settings = {
|
||||||
@@ -37,7 +37,7 @@ script.on_event(defines.events.on_player_respawned,function(event)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- overided by ExpGamingCore.Role if present
|
-- overridden by ExpGamingCore.Role if present
|
||||||
script.on_event(defines.events.on_pre_player_died,function(event)
|
script.on_event(defines.events.on_pre_player_died,function(event)
|
||||||
local player = Game.get_player(event)
|
local player = Game.get_player(event)
|
||||||
if player.admin then
|
if player.admin then
|
||||||
@@ -54,8 +54,8 @@ end)
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
on_init= function(self)
|
on_init= function(self)
|
||||||
if loaded_modules['ExpGamingCore.Role@^4.0.0'] then
|
if loaded_modules['ExpGamingCore.Role'] then
|
||||||
local Role = require('ExpGamingCore.Role@^4.0.0')
|
local Role = require('ExpGamingCore.Role')
|
||||||
-- instant respawn
|
-- instant respawn
|
||||||
script.on_event(defines.events.on_pre_player_died,function(event)
|
script.on_event(defines.events.on_pre_player_died,function(event)
|
||||||
local player = Game.get_player(event)
|
local player = Game.get_player(event)
|
||||||
@@ -74,10 +74,10 @@ return {
|
|||||||
script.on_event(defines.events.role_change,function(event)
|
script.on_event(defines.events.role_change,function(event)
|
||||||
local player = Game.get_player(event)
|
local player = Game.get_player(event)
|
||||||
if Role.allowed(player,'bonus') then
|
if Role.allowed(player,'bonus') then
|
||||||
for _,setting in pairs(settings) do player[key] = setting*0.2 end
|
for key,setting in pairs(settings) do player[key] = setting*0.2 end
|
||||||
global[player.index]=20
|
global[player.index]=20
|
||||||
else
|
else
|
||||||
for _,setting in pairs(settings) do player[key] = 0 end
|
for key in pairs(settings) do player[key] = 0 end
|
||||||
global[player.index]=nil
|
global[player.index]=nil
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
{
|
{
|
||||||
"name": "bonus",
|
"name": "ExpGamingCommands.bonus",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Allows a bonus to be applied to players and instant respawn.",
|
||||||
"description": "Allows a bonus to be applied to players and instant respawn.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.bonus_4.0.0.zip",
|
"keywords": [
|
||||||
"keywords": [
|
"Instant Respawn",
|
||||||
"Instant Respawn",
|
"Bonus",
|
||||||
"Bonus",
|
"Cheat",
|
||||||
"Cheat",
|
"Commands",
|
||||||
"Commands",
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"Respawn"
|
||||||
"Respawn"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
"ExpGamingLib": "^4.0.0",
|
||||||
"ExpGamingLib": "^4.0.0",
|
"ExpGamingCore.Command": "^4.0.0",
|
||||||
"ExpGamingCore.Command": "^4.0.0",
|
"ExpGamingCore.Role": "?^4.0.0"
|
||||||
"ExpGamingCore.Role": "?^4.0.0"
|
},
|
||||||
},
|
"collection": "ExpGamingCommands@4.0.0",
|
||||||
"collection": "ExpGamingCommands_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
|
|
||||||
--- Toogles cheat mode for a player
|
--- Toggles cheat mode for a player
|
||||||
-- @command cheat-mode
|
-- @command cheat-mode
|
||||||
-- @param[opt] player the player to toggle if nil then the player using the command
|
-- @param[opt] player the player to toggle if nil then the player using the command
|
||||||
commands.add_command('cheat-mode', 'Toggles cheat mode for a player', {
|
commands.add_command('cheat-mode', 'Toggles cheat mode for a player', {
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
{
|
{
|
||||||
"name": "cheatMode",
|
"name": "ExpGamingCommands.cheatMode",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Adds a command which allow you to toggle cheatmode",
|
||||||
"description": "Adds a command which allow you to toggle cheatmode",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.cheatMode_4.0.0.zip",
|
"keywords": [
|
||||||
"keywords": [
|
"Cheat",
|
||||||
"Cheat",
|
"Commands",
|
||||||
"Commands",
|
"Admin",
|
||||||
"Admin",
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"Cheat Mode",
|
||||||
"Cheat Mode",
|
"Hacks"
|
||||||
"Hacks"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingCore.Command": "^4.0.0"
|
||||||
"ExpGamingCore.Command": "^4.0.0"
|
},
|
||||||
},
|
"collection": "ExpGamingCommands@4.0.0",
|
||||||
"collection": "ExpGamingCommands_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
|
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
local global = global{}
|
local global = global{}
|
||||||
|
|
||||||
--- Sets the home for a player
|
--- Sets the home for a player
|
||||||
@@ -25,7 +25,7 @@ commands.add_command('home', 'Allows you to set, remove and goto your homes', {
|
|||||||
player_return{'ExpGamingCommands-home.set',name,pos[1],pos[2]}
|
player_return{'ExpGamingCommands-home.set',name,pos[1],pos[2]}
|
||||||
elseif command == 'remove' then
|
elseif command == 'remove' then
|
||||||
if not homes[name] then player_return{'ExpGamingCommands-home.invalid',name} end
|
if not homes[name] then player_return{'ExpGamingCommands-home.invalid',name} end
|
||||||
homes[name] = nil
|
homes[name] = nil
|
||||||
homes._n=homes._n-1
|
homes._n=homes._n-1
|
||||||
player_return{'ExpGamingCommands-home.remove',name}
|
player_return{'ExpGamingCommands-home.remove',name}
|
||||||
elseif command == 'goto' then
|
elseif command == 'goto' then
|
||||||
@@ -42,6 +42,6 @@ commands.add_command('home', 'Allows you to set, remove and goto your homes', {
|
|||||||
else
|
else
|
||||||
player_return{'ExpGamingCommands-home.homes',homes._n,homes._m}
|
player_return{'ExpGamingCommands-home.homes',homes._n,homes._m}
|
||||||
local index = 1
|
local index = 1
|
||||||
for name,pos in pairs(homes) do if name ~= '_n' and name ~= '_r' and name ~= '_m' then player_return{'ExpGamingCommands-home.home',index,name,pos[1],pos[2]} index=index+1 end end
|
for home_name,pos in pairs(homes) do if home_name ~= '_n' and home_name ~= '_r' and home_name ~= '_m' then player_return{'ExpGamingCommands-home.home',index,home_name,pos[1],pos[2]} index=index+1 end end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
{
|
{
|
||||||
"name": "home",
|
"name": "ExpGamingCommands.home",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Allows players to set homes and then return to them later.",
|
||||||
"description": "Allows players to set homes and then return to them later.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.home_4.0.0.zip",
|
"keywords": [
|
||||||
"keywords": [
|
"Teleport",
|
||||||
"Teleport",
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"Home",
|
||||||
"Home",
|
"Return",
|
||||||
"Return",
|
"Set Home",
|
||||||
"Set Home",
|
"Commands"
|
||||||
"Commands"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
"ExpGamingCore.Command": "^4.0.0"
|
||||||
"ExpGamingCore.Command": "^4.0.0"
|
},
|
||||||
},
|
"collection": "ExpGamingCommands@4.0.0",
|
||||||
"collection": "ExpGamingCommands_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
|
|
||||||
local Game = require('FactorioStdLib.Game@^4.0.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
|
|
||||||
--- Kills a player of a lower rank
|
--- Kills a player of a lower rank
|
||||||
-- @command kill
|
-- @command kill
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
{
|
{
|
||||||
"name": "kill",
|
"name": "ExpGamingCommands.kill",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Adds a command which can be used to kill a player or yourself.",
|
||||||
"description": "Adds a command which can be used to kill a player or yourself.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingAdmin.Commands_4.0.0.zip",
|
"keywords": [
|
||||||
"keywords": [
|
"Command",
|
||||||
"Command",
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"Kill",
|
||||||
"Kill",
|
"Death",
|
||||||
"Death",
|
"Admin",
|
||||||
"Admin",
|
"Tool"
|
||||||
"Tool"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingCore.Command": "^4.0.0",
|
||||||
"ExpGamingCore.Command": "^4.0.0",
|
"ExpGamingCore.Role": "^4.0.0",
|
||||||
"ExpGamingCore.Role": "^4.0.0",
|
"FactorioStdLib.Game": "^0.8.0"
|
||||||
"FactorioStdLib.Game": "^0.8.0"
|
},
|
||||||
},
|
"collection": "ExpGamingCommands@4.0.0",
|
||||||
"collection": "ExpGamingCommands_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
|
|
||||||
|
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
local Role = require('ExpGamingCore.Role@^4.0.0')
|
local Role = require('ExpGamingCore.Role')
|
||||||
|
|
||||||
-- Set an item to true to disallow it from being repaired
|
-- Set an item to true to disallow it from being repaired
|
||||||
local disallow = {
|
local disallow = {
|
||||||
@@ -24,11 +24,11 @@ local repairDisallow
|
|||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local ThisModule = {
|
local ThisModule = {
|
||||||
on_init = function(self)
|
on_init = function(self)
|
||||||
if loaded_modules['ExpGamingAdmin.TempBan@^4.0.0'] then verbose('ExpGamingAdmin.TempBan is installed; Loading tempban src') repairDisallow = require(module_path..'/src/tempban') end
|
if loaded_modules['ExpGamingAdmin.TempBan'] then verbose('ExpGamingAdmin.TempBan is installed; Loading tempban src') repairDisallow = require(module_path..'/src/tempban') end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Used so that the value can be overriden if tempban is present
|
--- Used so that the value can be overridden if tempban is present
|
||||||
-- @local
|
-- @local
|
||||||
-- @function repairDisallow
|
-- @function repairDisallow
|
||||||
-- @param player the player who called the command
|
-- @param player the player who called the command
|
||||||
@@ -41,7 +41,7 @@ end
|
|||||||
--- Used to repair and heal items in an area, different ranks get different size areas
|
--- Used to repair and heal items in an area, different ranks get different size areas
|
||||||
-- @command repair
|
-- @command repair
|
||||||
-- @param range the range that items are repaired in
|
-- @param range the range that items are repaired in
|
||||||
commands.add_command('repair', 'Repairs all destoryed and damaged entites in an area.', {
|
commands.add_command('repair', 'Repairs all destroyed and damaged entities in an area.', {
|
||||||
['range']={true,'number-int'}
|
['range']={true,'number-int'}
|
||||||
}, function(event,args)
|
}, function(event,args)
|
||||||
local range = args.range
|
local range = args.range
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
{
|
{
|
||||||
"name": "repair",
|
"name": "ExpGamingCommands.repair",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Allows items to be healed and repaired with a command",
|
||||||
"description": "Allows items to be healed and repaired with a command",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.repair_4.0.0.zip",
|
"keywords": [
|
||||||
"keywords": [
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"Command",
|
||||||
"Command",
|
"Heal",
|
||||||
"Heal",
|
"Repair",
|
||||||
"Repair",
|
"Ghosts",
|
||||||
"Ghosts",
|
"Revive"
|
||||||
"Revive"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingLib": "^4.0.0",
|
||||||
"ExpGamingLib": "^4.0.0",
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
"ExpGamingCore.Role": "^4.0.0",
|
||||||
"ExpGamingCore.Role": "^4.0.0",
|
"ExpGamingAdmin.TempBan": "?^4.0.0"
|
||||||
"ExpGamingAdmin.TempBan": "?^4.0.0"
|
},
|
||||||
},
|
"collection": "ExpGamingCommands@4.0.0",
|
||||||
"collection": "ExpGamingCommands_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
-- not_luadoc=true
|
-- not_luadoc=true
|
||||||
local temp_ban = require('ExpGamingAdmin.TempBan')
|
local temp_ban = require('ExpGamingAdmin').temp_ban
|
||||||
return function(player,entity)
|
return function(player,entity)
|
||||||
player_return('You have repaired: '..entity.name..' this item is not allowed.',defines.textcolor.crit,player)
|
player_return('You have repaired: '..entity.name..' this item is not allowed.',defines.textcolor.crit,player)
|
||||||
temp_ban(player,'<server>','Attempt To Repair A Banned Item')
|
temp_ban(player,'<server>','Attempt To Repair A Banned Item')
|
||||||
|
|||||||
@@ -1,165 +1,25 @@
|
|||||||
{
|
{
|
||||||
"name": "ExpGamingCommands",
|
"name": "ExpGamingCommands",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Collection",
|
"description": "A Collection of all of the custom commands used on ExpGaming servers.",
|
||||||
"description": "A Collection of all of the custom commands used on ExpGaming servers.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands_4.0.0.zip",
|
"keywords": [
|
||||||
"keywords": [
|
"Commands",
|
||||||
"Commands",
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"Admin",
|
||||||
"Admin",
|
"Tools"
|
||||||
"Tools"
|
],
|
||||||
],
|
"author": "Cooldude2606",
|
||||||
"author": "Cooldude2606",
|
"contact": "Discord: Cooldude2606#5241",
|
||||||
"contact": "Discord: Cooldude2606#5241",
|
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
||||||
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
"submodules": {
|
||||||
"submodules": {
|
"ExpGamingCommands.bonus": "4.0.0",
|
||||||
"bonus": {
|
"ExpGamingCommands.cheatMode": "4.0.0",
|
||||||
"name": "bonus",
|
"ExpGamingCommands.home": "4.0.0",
|
||||||
"version": "4.0.0",
|
"ExpGamingCommands.kill": "4.0.0",
|
||||||
"type": "Submodule",
|
"ExpGamingCommands.repair": "4.0.0",
|
||||||
"description": "Allows a bonus to be applied to players and instant respawn.",
|
"ExpGamingCommands.tags": "4.0.0",
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.bonus_4.0.0.zip",
|
"ExpGamingCommands.teleport": "4.0.0"
|
||||||
"keywords": [
|
},
|
||||||
"Instant Respawn",
|
"dependencies": {}
|
||||||
"Bonus",
|
}
|
||||||
"Cheat",
|
|
||||||
"Commands",
|
|
||||||
"ExpGaming",
|
|
||||||
"Respawn"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
|
||||||
"ExpGamingLib": "^4.0.0",
|
|
||||||
"ExpGamingCore.Command": "^4.0.0",
|
|
||||||
"ExpGamingCore.Role": "?^4.0.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingCommands_4.0.0"
|
|
||||||
},
|
|
||||||
"cheatMode": {
|
|
||||||
"name": "cheatMode",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Adds a command which allow you to toggle cheatmode",
|
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.cheatMode_4.0.0.zip",
|
|
||||||
"keywords": [
|
|
||||||
"Cheat",
|
|
||||||
"Commands",
|
|
||||||
"Admin",
|
|
||||||
"ExpGaming",
|
|
||||||
"Cheat Mode",
|
|
||||||
"Hacks"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingCore.Command": "^4.0.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingCommands_4.0.0"
|
|
||||||
},
|
|
||||||
"home": {
|
|
||||||
"name": "home",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Allows players to set homes and then return to them later.",
|
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.home_4.0.0.zip",
|
|
||||||
"keywords": [
|
|
||||||
"Teleport",
|
|
||||||
"ExpGaming",
|
|
||||||
"Home",
|
|
||||||
"Return",
|
|
||||||
"Set Home",
|
|
||||||
"Commands"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
|
||||||
"ExpGamingCore.Command": "^4.0.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingCommands_4.0.0"
|
|
||||||
},
|
|
||||||
"kill": {
|
|
||||||
"name": "kill",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Adds a command which can be used to kill a player or yourself.",
|
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingAdmin.Commands_4.0.0.zip",
|
|
||||||
"keywords": [
|
|
||||||
"Command",
|
|
||||||
"ExpGaming",
|
|
||||||
"Kill",
|
|
||||||
"Death",
|
|
||||||
"Admin",
|
|
||||||
"Tool"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingCore.Command": "^4.0.0",
|
|
||||||
"ExpGamingCore.Role": "^4.0.0",
|
|
||||||
"FactorioStdLib.Game": "^0.8.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingCommands_4.0.0"
|
|
||||||
},
|
|
||||||
"repair": {
|
|
||||||
"name": "repair",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Allows items to be healed and repaired with a command",
|
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.repair_4.0.0.zip",
|
|
||||||
"keywords": [
|
|
||||||
"ExpGaming",
|
|
||||||
"Command",
|
|
||||||
"Heal",
|
|
||||||
"Repair",
|
|
||||||
"Ghosts",
|
|
||||||
"Revive"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingLib": "^4.0.0",
|
|
||||||
"FactorioStdLib.Game": "^0.8.0",
|
|
||||||
"ExpGamingCore.Role": "^4.0.0",
|
|
||||||
"ExpGamingAdmin.TempBan": "?^4.0.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingCommands_4.0.0"
|
|
||||||
},
|
|
||||||
"tags": {
|
|
||||||
"name": "tags",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Allows tags to be used by users.",
|
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.tags_4.0.0.zip",
|
|
||||||
"keywords": [
|
|
||||||
"Tags",
|
|
||||||
"Custom Tags",
|
|
||||||
"Commands",
|
|
||||||
"ExpGaming"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingLib": "^4.0.0",
|
|
||||||
"ExpGamingCore.Role": "?^4.0.0",
|
|
||||||
"ExpGamingCore.Command": "^4.0.0",
|
|
||||||
"FactorioStdLib.Game": "^0.8.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingCommands_4.0.0"
|
|
||||||
},
|
|
||||||
"teleport": {
|
|
||||||
"name": "teleport",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"type": "Submodule",
|
|
||||||
"description": "Adds a few commands used to teleport players.",
|
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.teleport_4.0.0.zip",
|
|
||||||
"keywords": [
|
|
||||||
"Teleport",
|
|
||||||
"Tp",
|
|
||||||
"Bring",
|
|
||||||
"GoTo",
|
|
||||||
"ExpGaming",
|
|
||||||
"Command",
|
|
||||||
"Admin",
|
|
||||||
"Tools"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ExpGamingCore.Command": "^4.0.0",
|
|
||||||
"ExpGamingAdmin.Teleport": "^4.0.0"
|
|
||||||
},
|
|
||||||
"collection": "ExpGamingCommands_4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
|
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
local Role -- ExpGamingCore.Role@^4.0.0
|
local Role -- ExpGamingCore.Role@^4.0.0
|
||||||
|
|
||||||
-- Module Define
|
-- Module Define
|
||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local ThisModule = {
|
local ThisModule = {
|
||||||
on_init=function()
|
on_init=function()
|
||||||
if loaded_modules['ExpGamingCore.Role@^4.0.0'] then Role = require('ExpGamingCore.Role@^4.0.0') end
|
if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
{
|
{
|
||||||
"name": "tags",
|
"name": "ExpGamingCommands.tags",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Allows tags to be used by users.",
|
||||||
"description": "Allows tags to be used by users.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.tags_4.0.0.zip",
|
"keywords": [
|
||||||
"keywords": [
|
"Tags",
|
||||||
"Tags",
|
"Custom Tags",
|
||||||
"Custom Tags",
|
"Commands",
|
||||||
"Commands",
|
"ExpGaming"
|
||||||
"ExpGaming"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingLib": "^4.0.0",
|
||||||
"ExpGamingLib": "^4.0.0",
|
"ExpGamingCore.Role": "?^4.0.0",
|
||||||
"ExpGamingCore.Role": "?^4.0.0",
|
"ExpGamingCore.Command": "^4.0.0",
|
||||||
"ExpGamingCore.Command": "^4.0.0",
|
"FactorioStdLib.Game": "^0.8.0"
|
||||||
"FactorioStdLib.Game": "^0.8.0"
|
},
|
||||||
},
|
"collection": "ExpGamingCommands@4.0.0",
|
||||||
"collection": "ExpGamingCommands_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
|
|
||||||
local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0')
|
local Admin = require('ExpGamingAdmin')
|
||||||
|
|
||||||
--- Teleports the user to the player given
|
--- Teleports the user to the player given
|
||||||
-- @command go-to
|
-- @command go-to
|
||||||
|
|||||||
@@ -1,22 +1,23 @@
|
|||||||
{
|
{
|
||||||
"name": "teleport",
|
"name": "ExpGamingCommands.teleport",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Adds a few commands used to teleport players.",
|
||||||
"description": "Adds a few commands used to teleport players.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.teleport_4.0.0.zip",
|
"keywords": [
|
||||||
"keywords": [
|
"Teleport",
|
||||||
"Teleport",
|
"Tp",
|
||||||
"Tp",
|
"Bring",
|
||||||
"Bring",
|
"GoTo",
|
||||||
"GoTo",
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"Command",
|
||||||
"Command",
|
"Admin",
|
||||||
"Admin",
|
"Tools"
|
||||||
"Tools"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingCore.Command": "^4.0.0",
|
||||||
"ExpGamingCore.Command": "^4.0.0",
|
"ExpGamingAdmin.Teleport": "^4.0.0",
|
||||||
"ExpGamingAdmin.Teleport": "^4.0.0"
|
"ExpGamingAdmin": "^4.0.0"
|
||||||
},
|
},
|
||||||
"collection": "ExpGamingCommands_4.0.0"
|
"collection": "ExpGamingCommands@4.0.0",
|
||||||
}
|
"submodules": {}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alias commands
|
-- @alias commands
|
||||||
|
|
||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game')
|
||||||
local Color = require('FactorioStdLib.Color@^0.8.0')
|
local Color = require('FactorioStdLib.Color')
|
||||||
|
|
||||||
--- Used as an error constant for validation
|
--- Used as an error constant for validation
|
||||||
-- @field commands.error
|
-- @field commands.error
|
||||||
@@ -13,7 +13,7 @@ local Color = require('FactorioStdLib.Color@^0.8.0')
|
|||||||
-- @usage return commands.error('err message')
|
-- @usage return commands.error('err message')
|
||||||
commands.error = setmetatable({},{__call=function(...) return ... end})
|
commands.error = setmetatable({},{__call=function(...) return ... end})
|
||||||
commands._add_command = commands.add_command
|
commands._add_command = commands.add_command
|
||||||
local data = {}
|
local commandDataStore = {}
|
||||||
local middleware = {}
|
local middleware = {}
|
||||||
|
|
||||||
--- Used to add middle ware to the command handler, functions should return true or false
|
--- Used to add middle ware to the command handler, functions should return true or false
|
||||||
@@ -27,10 +27,10 @@ function commands.add_middleware(callback) if not is_type(callback,'function') t
|
|||||||
-- @tparam ?string|table|event key the command that will be returned: string is the name, table is the command data, event is event from add_command
|
-- @tparam ?string|table|event key the command that will be returned: string is the name, table is the command data, event is event from add_command
|
||||||
-- @treturn table the command data
|
-- @treturn table the command data
|
||||||
setmetatable(commands,{
|
setmetatable(commands,{
|
||||||
__index=function(tbl,key) return is_type(key,'table') and (key.command and rawget(data,key.name) or key) or key == 'data' and data or rawget(data,key) end
|
__index=function(tbl,key) return is_type(key,'table') and (key.command and rawget(commandDataStore,key.name) or key) or key == 'data' and commandDataStore or rawget(commandDataStore,key) end
|
||||||
})
|
})
|
||||||
|
|
||||||
--- Collection of funcations that can be used to validate inputs
|
--- Collection of functions that can be used to validate inputs
|
||||||
-- @table commands.validate
|
-- @table commands.validate
|
||||||
-- @usage commands.validate[type](value,event,...)
|
-- @usage commands.validate[type](value,event,...)
|
||||||
-- @tparam string type the type that the value should be
|
-- @tparam string type the type that the value should be
|
||||||
@@ -40,11 +40,11 @@ setmetatable(commands,{
|
|||||||
-- @return[2] error constant
|
-- @return[2] error constant
|
||||||
-- @return[2] the err message
|
-- @return[2] the err message
|
||||||
-- @field __comment replace _ with - the ldoc did not like me using - in the names
|
-- @field __comment replace _ with - the ldoc did not like me using - in the names
|
||||||
-- @field string basicly does nothing but a type filed is required
|
-- @field string basically does nothing but a type filed is required
|
||||||
-- @field string_inf same as string but is infite in length, must be last arg
|
-- @field string_inf same as string but is infinite in length, must be last arg
|
||||||
-- @field string_len same as string but can define a max lengh
|
-- @field string_len same as string but can define a max length
|
||||||
-- @field number converts the input into a number
|
-- @field number converts the input into a number
|
||||||
-- @field number_int conerts the input to a number and floors it
|
-- @field number_int converts the input to a number and floors it
|
||||||
-- @field number_range allows a number in a range min < X <= max
|
-- @field number_range allows a number in a range min < X <= max
|
||||||
-- @field number_range allows a number in a range after it has been floored min < math.floor(X) <= max
|
-- @field number_range allows a number in a range after it has been floored min < math.floor(X) <= max
|
||||||
-- @field player converts the input into a valid player
|
-- @field player converts the input into a valid player
|
||||||
@@ -54,54 +54,54 @@ setmetatable(commands,{
|
|||||||
-- @field player_role-online converts the input to a player if the player is a lower rank than the user and online
|
-- @field player_role-online converts the input to a player if the player is a lower rank than the user and online
|
||||||
-- @field player_role_alive converts the input to a player if the player is a lower rank than the user and online and alive
|
-- @field player_role_alive converts the input to a player if the player is a lower rank than the user and online and alive
|
||||||
commands.validate = {
|
commands.validate = {
|
||||||
['boolean']=function(value,event) local value = value.lower() if value == 'true' or valule == 'yes' or value == 'y' or value == '1' then return true else return false end end,
|
['boolean']=function(value) value = value.lower() if value == 'true' or value == 'yes' or value == 'y' or value == '1' then return true else return false end end,
|
||||||
['string']=function(value,event) return tostring(value) end,
|
['string']=function(value) return tostring(value) end,
|
||||||
['string-inf']=function(value,event) return tostring(value) end,
|
['string-inf']=function(value) return tostring(value) end,
|
||||||
['string-list']=function(value,event,list)
|
['string-list']=function(value,event,list)
|
||||||
local rtn = tostring(value) and table.includes(list,tostring(value)) and tostring(value) or nil
|
local rtn = tostring(value) and table.includes(list,tostring(value)) and tostring(value) or nil
|
||||||
if not rtn then return commands.error{'ExpGamingCore_Command.error-string-list',table.concat(list,', ')} end return rtn end,
|
if not rtn then return commands.error{'ExpGamingCore_Command.error-string-list',table.concat(list,', ')} end return rtn end,
|
||||||
['string-len']=function(value,event,max)
|
['string-len']=function(value,event,max)
|
||||||
local rtn = tostring(value) and tostring(value):len() <= max and tostring(value) or nil
|
local rtn = tostring(value) and tostring(value):len() <= max and tostring(value) or nil
|
||||||
if not rtn then return commands.error{'ExpGamingCore_Command.error-string-len',max} end return rtn end,
|
if not rtn then return commands.error{'ExpGamingCore_Command.error-string-len',max} end return rtn end,
|
||||||
['number']=function(value,event)
|
['number']=function(value)
|
||||||
local rtn = tonumber(value) or nil
|
local rtn = tonumber(value) or nil
|
||||||
if not rtn then return commands.error{'ExpGamingCore_Command.error-number'} end return rtn end,
|
if not rtn then return commands.error{'ExpGamingCore_Command.error-number'} end return rtn end,
|
||||||
['number-int']=function(value,event)
|
['number-int']=function(value)
|
||||||
local rtn = tonumber(value) and math.floor(tonumber(value)) or nil
|
local rtn = tonumber(value) and math.floor(tonumber(value)) or nil
|
||||||
if not rtn then return commands.error{'ExpGamingCore_Command.error-number'} end return rtn end,
|
if not rtn then return commands.error{'ExpGamingCore_Command.error-number'} end return rtn end,
|
||||||
['number-range']=function(value,event,min,max)
|
['number-range']=function(value,event,min,max)
|
||||||
local rtn = tonumber(value) and tonumber(value) > min and tonumber(value) <= max and tonumber(value) or nil
|
local rtn = tonumber(value) and tonumber(value) > min and tonumber(value) <= max and tonumber(value) or nil
|
||||||
if not rtn then return commands.error{'ExpGamingCore_Command.error-number-range',min,max} end return rtn end,
|
if not rtn then return commands.error{'ExpGamingCore_Command.error-number-range',min,max} end return rtn end,
|
||||||
['number-range-int']=function(value,event,min,max)
|
['number-range-int']=function(value,event,min,max)
|
||||||
local rtn = tonumber(value) and math.floor(tonumber(value)) > min and math.floor(tonumber(value)) <= max and math.floor(tonumber(value)) or nil
|
local rtn = tonumber(value) and math.floor(tonumber(value)) > min and math.floor(tonumber(value)) <= max and math.floor(tonumber(value)) or nil
|
||||||
if not rtn then return commands.error{'ExpGamingCore_Command.error-number-range',min,max} end return rtn end,
|
if not rtn then return commands.error{'ExpGamingCore_Command.error-number-range',min,max} end return rtn end,
|
||||||
['player']=function(value,event)
|
['player']=function(value)
|
||||||
local rtn = Game.get_player(value) or nil
|
local rtn = Game.get_player(value) or nil
|
||||||
if not rtn then return commands.error{'ExpGamingCore_Command.error-player',value} end return rtn end,
|
if not rtn then return commands.error{'ExpGamingCore_Command.error-player',value} end return rtn end,
|
||||||
['player-online']=function(value,event)
|
['player-online']=function(value)
|
||||||
local player,err = commands.validate['player'](value)
|
local player,err = commands.validate['player'](value)
|
||||||
if err then return commands.error(err) end
|
if err then return commands.error(err) end
|
||||||
local rtn = player.connected and player or nil
|
local rtn = player.connected and player or nil
|
||||||
if not rtn then return commands.error{'ExpGamingCore_Command.error-player-online'} end return rtn end,
|
if not rtn then return commands.error{'ExpGamingCore_Command.error-player-online'} end return rtn end,
|
||||||
['player-alive']=function(value,event)
|
['player-alive']=function(value)
|
||||||
local player,err = commands.validate['player-online'](value)
|
local player,err = commands.validate['player-online'](value)
|
||||||
if err then return commands.error(err) end
|
if err then return commands.error(err) end
|
||||||
local rtn = player.character and player.character.health > 0 and player or nil
|
local rtn = player.character and player.character.health > 0 and player or nil
|
||||||
if not rtn then return commands.error{'ExpGamingCore_Command.error-player-alive'} end return rtn end,
|
if not rtn then return commands.error{'ExpGamingCore_Command.error-player-alive'} end return rtn end,
|
||||||
['player-rank']=function(value,event)
|
['player-rank']=function(value,event)
|
||||||
local player,err = commands.validate['player'](value)
|
local player,err = commands.validate['player'](value)
|
||||||
if err then return commands.error(err) end
|
if err then return commands.error(err) end
|
||||||
local rtn = player.admin and Game.get_player(event).admin and player or nil
|
local rtn = player.admin and Game.get_player(event).admin and player or nil
|
||||||
if not rtn then return commands.error{'ExpGamingCore_Command.error-player-rank'} end return rtn end,
|
if not rtn then return commands.error{'ExpGamingCore_Command.error-player-rank'} end return rtn end,
|
||||||
['player-rank-online']=function(value,event)
|
['player-rank-online']=function(value)
|
||||||
local player,err = commands.validate['player-online'](value)
|
local player,err = commands.validate['player-online'](value)
|
||||||
if err then return commands.error(err) end
|
if err then return commands.error(err) end
|
||||||
local player,err = commands.validate['player-rank'](player)
|
local player,err = commands.validate['player-rank'](player)
|
||||||
if err then return commands.error(err) end return player end,
|
if err then return commands.error(err) end return player end,
|
||||||
['player-rank-alive']=function(value,event)
|
['player-rank-alive']=function(value)
|
||||||
local player,err = commands.validate['player-alive'](value)
|
local player,err = commands.validate['player-alive'](value)
|
||||||
if err then return commands.error(err) end
|
if err then return commands.error(err) end
|
||||||
local player,err = commands.validate['player-rank'](player)
|
local player,err = commands.validate['player-rank'](player)
|
||||||
if err then return commands.error(err) end return player end,
|
if err then return commands.error(err) end return player end,
|
||||||
}
|
}
|
||||||
--- Adds a function to the validation list
|
--- Adds a function to the validation list
|
||||||
@@ -114,7 +114,7 @@ function commands.add_validation(name,callback) if not is_type(callback,'functio
|
|||||||
-- @tparam ?string|table|event command the command to get the inputs of
|
-- @tparam ?string|table|event command the command to get the inputs of
|
||||||
-- @treturn string the formated string for the inputs
|
-- @treturn string the formated string for the inputs
|
||||||
function commands.format_inputs(command)
|
function commands.format_inputs(command)
|
||||||
local command = commands[command]
|
command = commands[command]
|
||||||
if not is_type(command,'table') then error('Command is not valid',2) end
|
if not is_type(command,'table') then error('Command is not valid',2) end
|
||||||
local rtn = ''
|
local rtn = ''
|
||||||
for name,data in pairs(command.inputs) do
|
for name,data in pairs(command.inputs) do
|
||||||
@@ -136,13 +136,13 @@ function commands.validate_args(event)
|
|||||||
local rtn = {}
|
local rtn = {}
|
||||||
local count = 0
|
local count = 0
|
||||||
local count_opt = 0
|
local count_opt = 0
|
||||||
for name,data in pairs(command.inputs) do count = count + 1 if data[1] == false then count_opt = count_opt + 1 end end
|
for _,data in pairs(command.inputs) do count = count + 1 if data[1] == false then count_opt = count_opt + 1 end end
|
||||||
-- checks that there is some args given if there is ment to be
|
-- checks that there is some args given if there is meant to be
|
||||||
if not event.parameter then
|
if not event.parameter then
|
||||||
if count == count_opt then return rtn
|
if count == count_opt then return rtn
|
||||||
else return commands.error('invalid-inputs') end
|
else return commands.error('invalid-inputs') end
|
||||||
end
|
end
|
||||||
-- splits the args into words so that it can be used to asign values
|
-- splits the args into words so that it can be used to assign values
|
||||||
local words = string.split(event.parameter,' ')
|
local words = string.split(event.parameter,' ')
|
||||||
local index = 0
|
local index = 0
|
||||||
for _,word in pairs(words) do
|
for _,word in pairs(words) do
|
||||||
@@ -158,13 +158,13 @@ function commands.validate_args(event)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- assigns the values from the words to the args
|
-- assigns the values from the words to the args
|
||||||
local index = 0
|
index = 0
|
||||||
for name,data in pairs(command.inputs) do
|
for name,data in pairs(command.inputs) do
|
||||||
index = index+1
|
index = index+1
|
||||||
local arg = words[index]
|
local arg = words[index]
|
||||||
if not arg and data[1] then return commands.error('invalid-inputs') end
|
if not arg and data[1] then return commands.error('invalid-inputs') end
|
||||||
if data[2] == 'string-inf' then rtn[name] = table.concat(words,' ',index) break end
|
if data[2] == 'string-inf' then rtn[name] = table.concat(words,' ',index) break end
|
||||||
local valid = is_type(data[2],'function') and data[2] or commands.validate[data[2]] or error('Invalid type for command: "'..command.name..'/'..name..'"')
|
local valid = is_type(data[2],'function') and data[2] or commands.validate[data[2]] or error('Invalid validation ("'..tostring(data[2])..'") for command: "'..command.name..'/'..name..'"')
|
||||||
local temp_tbl = table.deepcopy(data) table.remove(temp_tbl,1) table.remove(temp_tbl,1)
|
local temp_tbl = table.deepcopy(data) table.remove(temp_tbl,1) table.remove(temp_tbl,1)
|
||||||
local value, err = valid(arg,event,unpack(temp_tbl))
|
local value, err = valid(arg,event,unpack(temp_tbl))
|
||||||
if value == commands.error then return value, err end
|
if value == commands.error then return value, err end
|
||||||
@@ -178,10 +178,10 @@ end
|
|||||||
-- @tparam ?index|name|player| player the player to test as
|
-- @tparam ?index|name|player| player the player to test as
|
||||||
-- @treturn table a table containg all the commands the player can use
|
-- @treturn table a table containg all the commands the player can use
|
||||||
function commands.get_commands(player)
|
function commands.get_commands(player)
|
||||||
|
player = Game.get_player(player)
|
||||||
local commands = {}
|
local commands = {}
|
||||||
local player = Game.get_player(player)
|
|
||||||
if not player then return error('Invalid player',2) end
|
if not player then return error('Invalid player',2) end
|
||||||
for name,data in pairs(data) do
|
for name,data in pairs(commandDataStore) do
|
||||||
if #middleware > 0 then for _,callback in pairs(middleware) do
|
if #middleware > 0 then for _,callback in pairs(middleware) do
|
||||||
local success, err = pcall(callback,player,name,data)
|
local success, err = pcall(callback,player,name,data)
|
||||||
if not success then error(err)
|
if not success then error(err)
|
||||||
@@ -207,7 +207,7 @@ end
|
|||||||
local function run_custom_command(command)
|
local function run_custom_command(command)
|
||||||
local data = commands.data[command.name]
|
local data = commands.data[command.name]
|
||||||
local player = Game.get_player(command) or SERVER
|
local player = Game.get_player(command) or SERVER
|
||||||
-- runs all middle ware if any, if there is no middle where then it relyis on .default_admin_only
|
-- runs all middle ware if any, if there is no middle where then it relies on .default_admin_only
|
||||||
if #middleware > 0 then for _,callback in pairs(middleware) do
|
if #middleware > 0 then for _,callback in pairs(middleware) do
|
||||||
local success, err = pcall(callback,player,command.name,command)
|
local success, err = pcall(callback,player,command.name,command)
|
||||||
if not success then error(err)
|
if not success then error(err)
|
||||||
@@ -243,7 +243,7 @@ end
|
|||||||
-- @usage --see examples in file
|
-- @usage --see examples in file
|
||||||
-- @tparam string name the name of the command
|
-- @tparam string name the name of the command
|
||||||
-- @tparam[opt='No Description'] string description the description of the command
|
-- @tparam[opt='No Description'] string description the description of the command
|
||||||
-- @tparam[opt=an infite string] 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[opt=an infinite string] 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 callback the function to call on the event
|
-- @tparam function callback the function to call on the event
|
||||||
commands.add_command = function(name, description, inputs, callback)
|
commands.add_command = function(name, description, inputs, callback)
|
||||||
if commands[name] then error('That command is already registered',2) end
|
if commands[name] then error('That command is already registered',2) end
|
||||||
@@ -254,11 +254,11 @@ commands.add_command = function(name, description, inputs, callback)
|
|||||||
end
|
end
|
||||||
verbose('Created Command: '..name)
|
verbose('Created Command: '..name)
|
||||||
-- test for string and then test for locale string
|
-- test for string and then test for locale string
|
||||||
local description = is_type(description,'string') and description
|
description = is_type(description,'string') and description
|
||||||
or is_type(description,'table') and is_type(description[1],'string') and string.find(description[1],'.+[.].+') and {description,''}
|
or is_type(description,'table') and is_type(description[1],'string') and string.find(description[1],'.+[.].+') and {description,''}
|
||||||
or 'No Description'
|
or 'No Description'
|
||||||
local inputs = is_type(inputs,'table') and inputs or {['param']={false,'string-inf'}}
|
inputs = is_type(inputs,'table') and inputs or {['param']={false,'string-inf'}}
|
||||||
data[name] = {
|
commandDataStore[name] = {
|
||||||
name=name,
|
name=name,
|
||||||
description=description,
|
description=description,
|
||||||
inputs=inputs,
|
inputs=inputs,
|
||||||
@@ -268,12 +268,12 @@ commands.add_command = function(name, description, inputs, callback)
|
|||||||
local help = is_type(description,'string') and commands.format_inputs(name)..'- '..description
|
local help = is_type(description,'string') and commands.format_inputs(name)..'- '..description
|
||||||
or is_type(description,'table') and is_type(description[1],'string') and string.find(description[1],'.+[.].+') and {description,commands.format_inputs(name)..'- '}
|
or is_type(description,'table') and is_type(description[1],'string') and string.find(description[1],'.+[.].+') and {description,commands.format_inputs(name)..'- '}
|
||||||
or commands.format_inputs(name)
|
or commands.format_inputs(name)
|
||||||
data[name].help = help
|
commandDataStore[name].help = help
|
||||||
commands._add_command(name,help,function(...)
|
commands._add_command(name,help,function(...)
|
||||||
local success, err = Manager.sandbox(run_custom_command,{},...)
|
local success, err = Manager.sandbox(run_custom_command,{},...)
|
||||||
if not success then error(err) end
|
if not success then error(err) end
|
||||||
end)
|
end)
|
||||||
return data[name]
|
return commandDataStore[name]
|
||||||
end
|
end
|
||||||
|
|
||||||
return commands
|
return commands
|
||||||
@@ -289,8 +289,8 @@ return commands
|
|||||||
commands.add_command('foo',{'foo.description'},{
|
commands.add_command('foo',{'foo.description'},{
|
||||||
['player']={true,'player'}, -- a required arg that must be a valid player
|
['player']={true,'player'}, -- a required arg that must be a valid player
|
||||||
['number']={true,'number-range',0,10}, -- a required arg that must be a number 0<X<=10
|
['number']={true,'number-range',0,10}, -- a required arg that must be a number 0<X<=10
|
||||||
['pwd']={true,function(value,event) if value == 'password123' then return true else return commands.error('Invalid Password') end} -- a requireed arg pwd that has custom validation
|
['pwd']={true,function(value,event) if value == 'password123' then return true else return commands.error('Invalid Password') end} -- a required arg pwd that has custom validation
|
||||||
['reason']={false,'string-inf'} -- an optinal arg that is and infite lengh (useful for reasons)
|
['reason']={false,'string-inf'} -- an optional arg that is and infinite length (useful for reasons)
|
||||||
},function(event,args)
|
},function(event,args)
|
||||||
args.player.print(args.number)
|
args.player.print(args.number)
|
||||||
if args.reasons then args.player.print(args.reason) end
|
if args.reasons then args.player.print(args.reason) end
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
{
|
{
|
||||||
"name": "Command",
|
"name": "ExpGamingCore.Command",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "A better command handler than the base game.",
|
||||||
"description": "A better command handler than the base game.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCore.Command_4.0.0.zip",
|
"keywords": [
|
||||||
"keywords": [
|
"Library",
|
||||||
"Library",
|
"Lib",
|
||||||
"Lib",
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"Core",
|
||||||
"Core",
|
"Commands"
|
||||||
"Commands"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"ExpGamingLib": "^4.0.0",
|
||||||
"ExpGamingLib": "^4.0.0",
|
"FactorioStdLib.Table": "^0.8.0",
|
||||||
"FactorioStdLib.Table": "^0.8.0",
|
"FactorioStdLib.Color": "^0.8.0",
|
||||||
"FactorioStdLib.Color": "^0.8.0",
|
"FactorioStdLib.Game": "^0.8.0"
|
||||||
"FactorioStdLib.Game": "^0.8.0"
|
},
|
||||||
},
|
"collection": "ExpGamingCore@4.0.0",
|
||||||
"collection": "ExpGamingCore_4.0.0"
|
"submodules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
-- defines for groups
|
-- defines for groups
|
||||||
Group{
|
|
||||||
name='Root',
|
|
||||||
disallow={}
|
|
||||||
}
|
|
||||||
|
|
||||||
Group{
|
Group{
|
||||||
name='Admin',
|
name='Admin',
|
||||||
disallow={
|
disallow={
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
-- @module ExpGamingCore@Group
|
-- @module ExpGamingCore@Group
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
-- @alais Group
|
-- @alias Group
|
||||||
|
|
||||||
-- Module Require
|
-- Module Require
|
||||||
local Game = require('FactorioStdLib.Game')
|
local Game = require('FactorioStdLib.Game')
|
||||||
@@ -14,22 +14,26 @@ local module_verbose = false
|
|||||||
-- @type Group
|
-- @type Group
|
||||||
-- @field _prototype the prototype of this class
|
-- @field _prototype the prototype of this class
|
||||||
-- @field groups a table of all groups, includes auto complete on the indexing
|
-- @field groups a table of all groups, includes auto complete on the indexing
|
||||||
|
local _GroupSelfRef
|
||||||
local Group = {
|
local Group = {
|
||||||
_prototype = {},
|
_prototype = {},
|
||||||
groups = setmetatable({},{
|
groups = setmetatable({},{
|
||||||
__index=table.autokey,
|
__index=table.autokey,
|
||||||
__newindex=function(tbl,key,value)
|
__newindex=function(tbl,key,value)
|
||||||
rawset(tbl,key,Group.define(value))
|
rawset(tbl,key,_GroupSelfRef.define(value))
|
||||||
end
|
end
|
||||||
}),
|
}),
|
||||||
on_init = function()
|
on_init = function()
|
||||||
if loaded_modules['ExpGamingCore.Server@^4.0.0'] then require('ExpGamingCore.Server@^4.0.0').add_module_to_interface('Group','ExpGamingCore.Group') end
|
if loaded_modules['ExpGamingCore.Server'] then require('ExpGamingCore.Server') end
|
||||||
end,
|
end,
|
||||||
on_post = function(self)
|
on_post = function(self)
|
||||||
|
-- creates a root role that the server can use
|
||||||
|
self{name='Root',disallow={}}
|
||||||
-- loads the groups in config
|
-- loads the groups in config
|
||||||
require(module_path..'/config',{Group=self})
|
require(module_path..'/config',{Group=self})
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
_GroupSelfRef=Group
|
||||||
|
|
||||||
-- Function Define
|
-- Function Define
|
||||||
|
|
||||||
@@ -58,7 +62,7 @@ function Group.get(mixed)
|
|||||||
if is_type(mixed,'table') and mixed.name then mixed = mixed.name end
|
if is_type(mixed,'table') and mixed.name then mixed = mixed.name end
|
||||||
if game and Game.get_player(mixed) then mixed = Game.get_player(mixed).permission_group.name end
|
if game and Game.get_player(mixed) then mixed = Game.get_player(mixed).permission_group.name end
|
||||||
local rtn = Group.groups[mixed]
|
local rtn = Group.groups[mixed]
|
||||||
if not rtn and is_type(mixed,'string') and game.permissions.get_group(mixed) then
|
if not rtn and game and is_type(mixed,'string') and game.permissions.get_group(mixed) then
|
||||||
rtn = setmetatable({disallow={},name=mixed},{
|
rtn = setmetatable({disallow={},name=mixed},{
|
||||||
__index=function(tbl,key) return Group._prototype[key] or game and game.permissions.get_group(tbl.name)[key] or nil end
|
__index=function(tbl,key) return Group._prototype[key] or game and game.permissions.get_group(tbl.name)[key] or nil end
|
||||||
})
|
})
|
||||||
@@ -73,9 +77,9 @@ end
|
|||||||
-- @tparam ?string|LuaPermissionGroup the group to add the player to
|
-- @tparam ?string|LuaPermissionGroup the group to add the player to
|
||||||
-- @treturn boolean was the player assigned
|
-- @treturn boolean was the player assigned
|
||||||
function Group.assign(player,group)
|
function Group.assign(player,group)
|
||||||
local player = Game.get_player(player)
|
player = Game.get_player(player)
|
||||||
if not player then error('Invalid player #1 given to Group.assign.',2) return end
|
if not player then error('Invalid player #1 given to Group.assign.',2) return end
|
||||||
local group = Group.get(group)
|
group = Group.get(group)
|
||||||
if not group then error('Invalid group #2 given to Group.assign.',2) return end
|
if not group then error('Invalid group #2 given to Group.assign.',2) return end
|
||||||
return group:add_player(player)
|
return group:add_player(player)
|
||||||
end
|
end
|
||||||
@@ -96,7 +100,7 @@ end
|
|||||||
-- @treturn boolean if the player was added
|
-- @treturn boolean if the player was added
|
||||||
function Group._prototype:add_player(player)
|
function Group._prototype:add_player(player)
|
||||||
if not self_test(self,'group','add_player') then return end
|
if not self_test(self,'group','add_player') then return end
|
||||||
local player = Game.get_player(player)
|
player = Game.get_player(player)
|
||||||
if not player then error('Invalid player #1 given to group.add_player.',2) return end
|
if not player then error('Invalid player #1 given to group.add_player.',2) return end
|
||||||
local raw_group = self:get_raw()
|
local raw_group = self:get_raw()
|
||||||
return raw_group.add_player(player)
|
return raw_group.add_player(player)
|
||||||
@@ -108,7 +112,7 @@ end
|
|||||||
-- @treturn boolean if the player was removed
|
-- @treturn boolean if the player was removed
|
||||||
function Group._prototype:remove_player(player)
|
function Group._prototype:remove_player(player)
|
||||||
if not self_test(self,'group','remove_player') then return end
|
if not self_test(self,'group','remove_player') then return end
|
||||||
local player = Game.get_player(player)
|
player = Game.get_player(player)
|
||||||
if not player then error('Invalid player #1 given to group.remove_player.',2) return end
|
if not player then error('Invalid player #1 given to group.remove_player.',2) return end
|
||||||
local raw_group = self:get_raw()
|
local raw_group = self:get_raw()
|
||||||
return raw_group.remove_player(player)
|
return raw_group.remove_player(player)
|
||||||
@@ -132,18 +136,18 @@ end
|
|||||||
-- this is used to create a connected_players table
|
-- this is used to create a connected_players table
|
||||||
Group._prototype.connected_players_mt = {
|
Group._prototype.connected_players_mt = {
|
||||||
__call=function(tbl) return tbl.self:get_players(true) end,
|
__call=function(tbl) return tbl.self:get_players(true) end,
|
||||||
__pairs=function(tbl)
|
__pairs=function(self)
|
||||||
local players = tbl.self:get_players(true)
|
local players = self.self:get_players(true)
|
||||||
local function next_pair(tbl,k)
|
local function next_pair(tbl,key)
|
||||||
k, v = next(players, k)
|
local k, v = next(players, key)
|
||||||
if v then return k,v end
|
if v then return k,v end
|
||||||
end
|
end
|
||||||
return next_pair, players, nil
|
return next_pair, players, nil
|
||||||
end,
|
end,
|
||||||
__ipairs=function(tbl)
|
__ipairs=function(self)
|
||||||
local players = tbl.self:get_players(true)
|
local players = self.self:get_players(true)
|
||||||
local function next_pair(tbl,k)
|
local function next_pair(tbl,key)
|
||||||
k, v = next(players, k)
|
local k, v = next(players, key)
|
||||||
if v then return k,v end
|
if v then return k,v end
|
||||||
end
|
end
|
||||||
return next_pair, players, nil
|
return next_pair, players, nil
|
||||||
@@ -154,7 +158,7 @@ Group._prototype.connected_players_mt = {
|
|||||||
-- @usage group.print('Hello, World!')
|
-- @usage group.print('Hello, World!')
|
||||||
-- @param rtn any value you wish to print, string not required
|
-- @param rtn any value you wish to print, string not required
|
||||||
-- @param colour the colour to print the message in
|
-- @param colour the colour to print the message in
|
||||||
-- @treturn number the number of players who recived the message
|
-- @treturn number the number of players who received the message
|
||||||
function Group._prototype:print(rtn,colour)
|
function Group._prototype:print(rtn,colour)
|
||||||
if not self_test(self,'group','print') then return end
|
if not self_test(self,'group','print') then return end
|
||||||
if colour and not type_error(colour,'table','Invalid argument #2 to group:print, colour is not a table.') then return end
|
if colour and not type_error(colour,'table','Invalid argument #2 to group:print, colour is not a table.') then return end
|
||||||
@@ -167,7 +171,7 @@ end
|
|||||||
-- Event Handlers Define
|
-- Event Handlers Define
|
||||||
|
|
||||||
-- creates all permission groups and links them
|
-- creates all permission groups and links them
|
||||||
script.on_event('on_init',function(event)
|
script.on_event('on_init',function()
|
||||||
for name,group in pairs(Group.groups) do
|
for name,group in pairs(Group.groups) do
|
||||||
local _group = game.permissions.create_group(name)
|
local _group = game.permissions.create_group(name)
|
||||||
verbose('Created Permission Group: '..name)
|
verbose('Created Permission Group: '..name)
|
||||||
|
|||||||
@@ -1,21 +1,22 @@
|
|||||||
{
|
{
|
||||||
"name": "Group",
|
"name": "ExpGamingCore.Group",
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"type": "Submodule",
|
"description": "Adds a system to manage and auto-create permission groups.",
|
||||||
"description": "Adds a system to manage and auto-create permission groups.",
|
"location": "FSM_ARCHIVE",
|
||||||
"location": "<blank>",
|
"keywords": [
|
||||||
"keywords": [
|
"Groups",
|
||||||
"Groups",
|
"ExpGaming",
|
||||||
"ExpGaming",
|
"System",
|
||||||
"System",
|
"Management",
|
||||||
"Management",
|
"Manage",
|
||||||
"Manage",
|
"Permissions"
|
||||||
"Permissions"
|
],
|
||||||
],
|
"dependencies": {
|
||||||
"dependencies": {
|
"FactorioStdLib": "^0.8.0",
|
||||||
"FactorioStdLib": "^0.8.0",
|
"ExpGamingCore.Server": "?^4.0.0",
|
||||||
"ExpGamingCore.Server": "?^4.0.0",
|
"ExpGamingLib": "^4.0.0",
|
||||||
"ExpGamingLib": "^4.0.0"
|
"FactorioStdLib.Game": "^0.8.0"
|
||||||
},
|
},
|
||||||
"collection": "ExpGamingCore_4.0.0"
|
"collection": "ExpGamingCore@4.0.0",
|
||||||
}
|
"submodules": {}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
--- Adds a uniform preset for guis in the center of the screen which allow for different tabs to be opened
|
--- Adds a uniform preset for guis in the center of the screen which allow for different tabs to be opened
|
||||||
-- @module ExpGamingCore.Gui.Center
|
-- @module ExpGamingCore.Gui.center
|
||||||
-- @alias center
|
-- @alias center
|
||||||
-- @author Cooldude2606
|
-- @author Cooldude2606
|
||||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||||
|
|
||||||
--- This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module
|
|
||||||
-- @function _comment
|
|
||||||
|
|
||||||
local Game = require('FactorioStdLib.Game')
|
local Game = require('FactorioStdLib.Game')
|
||||||
local Color = require('FactorioStdLib.Color')
|
local Color = require('FactorioStdLib.Color')
|
||||||
local mod_gui = require("mod-gui")
|
local Gui = require('ExpGamingCore.Gui')
|
||||||
local Gui = Gui -- this is to force gui to remain in the ENV
|
local mod_gui = require('mod-gui')
|
||||||
|
|
||||||
local center = {}
|
local center = {}
|
||||||
center._prototype = {}
|
center._prototype = {}
|
||||||
@@ -18,98 +15,103 @@ center._prototype = {}
|
|||||||
--- Adds a new obj to the center gui
|
--- Adds a new obj to the center gui
|
||||||
-- @usage Gui.center.add{name='foo',caption='Foo',tooltip='Testing',draw=function}
|
-- @usage Gui.center.add{name='foo',caption='Foo',tooltip='Testing',draw=function}
|
||||||
-- @usage return_value(player) -- opens the center gui for that player
|
-- @usage return_value(player) -- opens the center gui for that player
|
||||||
-- @param obj contains the new object, needs name, fraw is opt and is function(root_frame)
|
-- @param obj contains the new object, needs name, frame is opt and is function(root_frame)
|
||||||
-- @return the object made, used to add tabs, calling the returned value will open the center for the given player
|
-- @return the object made, used to add tabs, calling the returned value will open the center for the given player
|
||||||
function center.add(obj)
|
function center.add(obj)
|
||||||
if not is_type(obj,'table') then return end
|
if not is_type(obj,'table') then return end
|
||||||
if not is_type(obj.name,'string') then return end
|
if not is_type(obj.name,'string') then return end
|
||||||
verbose('Created Center Gui: '..obj.name)
|
verbose('Created Center Gui: '..obj.name)
|
||||||
setmetatable(obj,{__index=center._prototype,__call=function(self,player) return center.open(player,self.name) end})
|
setmetatable(obj,{__index=center._prototype,__call=function(self,player,...) return center.open(player,self.name,...) end})
|
||||||
obj.tabs = {}
|
obj.tabs = {}
|
||||||
obj._tabs = {}
|
obj._tabs = {}
|
||||||
Gui.data('center',obj.name,obj)
|
Gui.data('center',obj.name,obj)
|
||||||
Gui.toolbar(obj.name,obj.caption,obj.tooltip,obj.open)
|
if Gui.toolbar then Gui.toolbar(obj.name,obj.caption,obj.tooltip,function(event) return obj:open(event.player_index) end) end
|
||||||
return obj
|
return obj
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Used to get the center frame of the player, used mainly in script
|
--- Used to get the center frame of the player, used mainly in script
|
||||||
-- @usage Gui.center.get_flow(player) -- returns gui emelemt
|
-- @usage Gui.center.get_flow(player) -- returns gui element
|
||||||
-- @param player a player indifier to get the flow for
|
-- @param player a player identifier to get the flow for
|
||||||
-- @treturn table the gui element flow
|
-- @treturn table the gui element flow
|
||||||
function center.get_flow(player)
|
function center.get_flow(player)
|
||||||
local player = Game.get_player(player)
|
player = Game.get_player(player)
|
||||||
if not player then error('Invalid player',2) end
|
if not player then error('Invalid player',2) end
|
||||||
return player.gui.center.exp_center or player.gui.center.add{name='exp_center',type='flow'}
|
return player.gui.center.exp_center or player.gui.center.add{name='exp_center',type='flow'}
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Used to open a center frame for a player
|
--- Used to open a center frame for a player, extra params are sent to open event
|
||||||
-- @usage Gui.center.open(player,'server-info') -- return true
|
-- @usage Gui.center.open(player,'server-info') -- return true
|
||||||
-- @param player a player indifier to get the flow for
|
-- @param player a player identifier to get the flow for
|
||||||
-- @tparam string center the name of the center frame to open
|
-- @tparam string center_name the name of the center frame to open
|
||||||
-- @treturn boelon based on if it successed or not
|
-- @treturn boolean based on if it succeeded or not
|
||||||
function center.open(player,center)
|
function center.open(player,center_name,...)
|
||||||
local player = Game.get_player(player)
|
player = Game.get_player(player)
|
||||||
if not player then error('Invalid player',2) return false end
|
if not player then error('Invalid player',2) return false end
|
||||||
Gui.center.clear(player)
|
Gui.center.clear(player)
|
||||||
if not Gui.data.center[center] then return false end
|
if not Gui.data.center[center_name] then return false end
|
||||||
Gui.data.center[center].open{
|
local self = Gui.data.center[center_name]
|
||||||
element={name=center},
|
-- this function is the draw function passed to the open event
|
||||||
player_index=player.index
|
self:open(player,function(...) Gui.center._draw(self,...) end,...)
|
||||||
}
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- used as a piece of middle ware for the open event
|
||||||
|
function center._draw(self,frame,...)
|
||||||
|
game.players[frame.player_index].opened=frame
|
||||||
|
if is_type(self.draw,'function') then
|
||||||
|
local success, err = pcall(self.draw,self,frame,...)
|
||||||
|
if not success then error(err) end
|
||||||
|
else error('No Callback on center frame '..self.name) end
|
||||||
|
end
|
||||||
|
|
||||||
--- Used to open a center frame for a player
|
--- Used to open a center frame for a player
|
||||||
-- @usage Gui.center.open_tab(player,'readme','rules') -- return true
|
-- @usage Gui.center.open_tab(player,'readme','rules') -- return true
|
||||||
-- @param player a player indifier to get the flow for
|
-- @param player a player identifier to get the flow for
|
||||||
-- @tparam string center the name of the center frame to open
|
-- @tparam string center the name of the center frame to open
|
||||||
-- @tparam string tab the name of the tab to open
|
-- @tparam string tab the name of the tab to open
|
||||||
-- @treturn boelon based on if it successed or not
|
-- @treturn boolean based on if it succeeded or not
|
||||||
function center.open_tab(player,center,tab)
|
function center.open_tab(player,center_name,tab)
|
||||||
local player = Game.get_player(player)
|
player = Game.get_player(player)
|
||||||
if not player then error('Invalid player',2) end
|
if not player then error('Invalid player',2) end
|
||||||
if not Gui.center.open(player,center) then return false end
|
if not Gui.center.open(player,center_name) then return false end
|
||||||
local name = center..'_'..tab
|
local name = center_name..'_'..tab
|
||||||
if not Gui.data.inputs_button[name] then return false end
|
if not Gui.data.inputs_button[name] then return false end
|
||||||
Gui.data.inputs_button[name].events[defines.events.on_gui_click]{
|
Gui.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],
|
element=Gui.center.get_flow(player)[center_name].tab_bar.tab_bar_scroll.tab_bar_scroll_flow[name],
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Used to clear the center frame of the player, used mainly in script
|
--- Used to clear the center frame of the player, used mainly in script
|
||||||
-- @usage Gui.center.clear(player)
|
-- @usage Gui.center.clear(player)
|
||||||
-- @param player a player indifier to get the flow for
|
-- @param player a player identifier to get the flow for
|
||||||
function center.clear(player)
|
function center.clear(player)
|
||||||
local player = Game.get_player(player)
|
player = Game.get_player(player)
|
||||||
center.get_flow(player).clear()
|
center.get_flow(player).clear()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- used on the button press when the toolbar button is press, can be overriden
|
-- opens this gui for this player, draw is the draw function when event is called from center.open
|
||||||
-- not recomented for direct use see Gui.center.open
|
-- this is the default function it can be overridden when the gui is defined, simply call draw on the frame you create
|
||||||
function center._prototype.open(event)
|
-- extra values passed to draw will also be passed to the draw event
|
||||||
local player = Game.get_player(event)
|
-- extra values from center.draw and passed to the open event
|
||||||
local _center = Gui.data.center[event.element.name]
|
function center._prototype:open(player,draw,...)
|
||||||
|
player = Game.get_player(player)
|
||||||
|
draw = draw or function(...) center._draw(self,...) end
|
||||||
local center_flow = center.get_flow(player)
|
local center_flow = center.get_flow(player)
|
||||||
if center_flow[_center.name] then Gui.center.clear(player) return end
|
if center_flow[self.name] then Gui.center.clear(player) return end
|
||||||
local center_frame = center_flow.add{
|
local center_frame = center_flow.add{
|
||||||
name=_center.name,
|
name=self.name,
|
||||||
type='frame',
|
type='frame',
|
||||||
caption=_center.caption,
|
caption=self.caption,
|
||||||
direction='vertical',
|
direction='vertical',
|
||||||
style=mod_gui.frame_style
|
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_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
|
draw(center_frame,...)
|
||||||
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
|
end
|
||||||
|
|
||||||
-- this is the default draw function if one is not provided, can be overriden
|
-- this is the default draw function if one is not provided, can be overridden
|
||||||
-- not recomented for direct use see Gui.center.open
|
-- not recommended for direct use see Gui.center.open
|
||||||
function center._prototype:draw(frame)
|
function center._prototype:draw(frame)
|
||||||
Gui.bar(frame,510)
|
Gui.bar(frame,510)
|
||||||
local tab_bar = frame.add{
|
local tab_bar = frame.add{
|
||||||
@@ -121,8 +123,8 @@ function center._prototype:draw(frame)
|
|||||||
tab_bar.style.width = 510
|
tab_bar.style.width = 510
|
||||||
tab_bar.style.height = 65
|
tab_bar.style.height = 65
|
||||||
local tab_bar_scroll = tab_bar.add{
|
local tab_bar_scroll = tab_bar.add{
|
||||||
type='scroll-pane',
|
type='scroll-pane',
|
||||||
name='tab_bar_scroll',
|
name='tab_bar_scroll',
|
||||||
horizontal_scroll_policy='auto-and-reserve-space',
|
horizontal_scroll_policy='auto-and-reserve-space',
|
||||||
vertical_scroll_policy='never'
|
vertical_scroll_policy='never'
|
||||||
}
|
}
|
||||||
@@ -145,7 +147,7 @@ function center._prototype:draw(frame)
|
|||||||
tab.style.height = 305
|
tab.style.height = 305
|
||||||
local tab_scroll = tab.add{
|
local tab_scroll = tab.add{
|
||||||
type ='scroll-pane',
|
type ='scroll-pane',
|
||||||
name='tab_scroll',
|
name='tab_scroll',
|
||||||
horizontal_scroll_policy='never',
|
horizontal_scroll_policy='never',
|
||||||
vertical_scroll_policy='auto'
|
vertical_scroll_policy='auto'
|
||||||
}
|
}
|
||||||
@@ -153,8 +155,8 @@ function center._prototype:draw(frame)
|
|||||||
tab_scroll.style.vertically_stretchable = true
|
tab_scroll.style.vertically_stretchable = true
|
||||||
tab_scroll.style.width = 500
|
tab_scroll.style.width = 500
|
||||||
local tab_scroll_flow = tab_scroll.add{
|
local tab_scroll_flow = tab_scroll.add{
|
||||||
type='flow',
|
type='flow',
|
||||||
name='tab_scroll_flow',
|
name='tab_scroll_flow',
|
||||||
direction='vertical'
|
direction='vertical'
|
||||||
}
|
}
|
||||||
tab_scroll_flow.style.width = 480
|
tab_scroll_flow.style.width = 480
|
||||||
@@ -169,7 +171,7 @@ function center._prototype:draw(frame)
|
|||||||
frame.parent.add{type='frame',name='temp'}.destroy()--recenter the GUI
|
frame.parent.add{type='frame',name='temp'}.destroy()--recenter the GUI
|
||||||
end
|
end
|
||||||
|
|
||||||
--- If deafult draw is used then you can add tabs to the gui with this function
|
--- If default draw is used then you can add tabs to the gui with this function
|
||||||
-- @usage _center:add_tab('foo','Foo','Just a tab',function)
|
-- @usage _center:add_tab('foo','Foo','Just a tab',function)
|
||||||
-- @tparam string name this is the name of the tab
|
-- @tparam string name this is the name of the tab
|
||||||
-- @tparam string caption this is the words that appear on the tab button
|
-- @tparam string caption this is the words that appear on the tab button
|
||||||
@@ -206,10 +208,14 @@ function center._prototype:add_tab(name,caption,tooltip,callback)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- used so that when gui close key is pressed this will close the gui
|
-- used so that when gui close key is pressed this will close the gui
|
||||||
center._events = {[defines.events.on_gui_closed]=function(event)
|
script.on_event(defines.events.on_gui_closed,function(event)
|
||||||
if event.element and event.element.valid then event.element.destroy() end
|
if event.element and event.element.valid then event.element.destroy() end
|
||||||
end}
|
end)
|
||||||
|
|
||||||
center.on_role_change = center.clear
|
script.on_event(defines.events.on_player_respawned,center.clear)
|
||||||
|
|
||||||
|
function center.on_init()
|
||||||
|
if loaded_modules['ExpGamingCore.Role'] then script.on_event(defines.events.on_role_change,center.clear) end
|
||||||
|
end
|
||||||
-- calling will attempt to add a new gui
|
-- calling will attempt to add a new gui
|
||||||
return setmetatable(center,{__call=function(self,...) return self.add(...) end})
|
return setmetatable(center,{__call=function(self,...) return self.add(...) end})
|
||||||
24
modules/ExpGamingCore/Gui/center/softmod.json
Normal file
24
modules/ExpGamingCore/Gui/center/softmod.json
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"name": "ExpGamingCore.Gui.center",
|
||||||
|
"version": "4.0.0",
|
||||||
|
"description": "Adds a pre-made center gui format.",
|
||||||
|
"author": "Cooldude2606",
|
||||||
|
"contact": "Discord: Cooldude2606#5241",
|
||||||
|
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
||||||
|
"location": "FSM_ARCHIVE",
|
||||||
|
"keywords": [
|
||||||
|
"Gui",
|
||||||
|
"Center"
|
||||||
|
],
|
||||||
|
"collection": "ExpGamingCore.Gui@4.0.0",
|
||||||
|
"dependencies": {
|
||||||
|
"mod-gui": "*",
|
||||||
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
|
"FactorioStdLib.Color": "^0.8.0",
|
||||||
|
"ExpGamingCore.Role": "?^4.0.0",
|
||||||
|
"ExpGamingCore.Gui": "^4.0.0",
|
||||||
|
"ExpGamingCore.Gui.inputs": "^4.0.0",
|
||||||
|
"ExpGamingCore.Gui.toolbar": "?^4.0.0"
|
||||||
|
},
|
||||||
|
"submodules": {}
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@ local global = global()
|
|||||||
-- @tparam string location the location to get/set the data, center left etc...
|
-- @tparam string location the location to get/set the data, center left etc...
|
||||||
-- @tparam[opt] string key the name of the gui to set the value of
|
-- @tparam[opt] string key the name of the gui to set the value of
|
||||||
-- @param[opt] value the data that will be set can be any value but table advised
|
-- @param[opt] value the data that will be set can be any value but table advised
|
||||||
-- @treturn[1] table all the gui data that is locationed in that location
|
-- @treturn[1] table all the gui data that is located in that location
|
||||||
Gui.data = setmetatable({},{
|
Gui.data = setmetatable({},{
|
||||||
__call=function(tbl,location,key,value)
|
__call=function(tbl,location,key,value)
|
||||||
if not location then return tbl end
|
if not location then return tbl end
|
||||||
@@ -27,28 +27,11 @@ Gui.data = setmetatable({},{
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
local events = {}
|
|
||||||
local order_config = require(module_path..'/order_config')
|
|
||||||
|
|
||||||
Gui.center = require(module_path..'/src/center',{Gui=Gui})
|
|
||||||
table.merge(events,Gui.center._events)
|
|
||||||
Gui.center._events = nil
|
|
||||||
|
|
||||||
Gui.inputs = require(module_path..'/src/inputs',{Gui=Gui})
|
|
||||||
table.merge(events,Gui.inputs._events)
|
|
||||||
Gui.inputs._events = nil
|
|
||||||
|
|
||||||
Gui.left = require(module_path..'/src/left',{Gui=Gui,order_config=order_config,self_global=global})
|
|
||||||
Gui.popup = require(module_path..'/src/popup',{Gui=Gui})
|
|
||||||
Gui.toolbar = require(module_path..'/src/toolbar',{Gui=Gui,order_config=order_config})
|
|
||||||
|
|
||||||
for event,callback in pairs(events) do script.on_event(event,callback) end
|
|
||||||
|
|
||||||
--- Add a white bar to any gui frame
|
--- Add a white bar to any gui frame
|
||||||
-- @usage Gui.bar(frame,100)
|
-- @usage Gui.bar(frame,100)
|
||||||
-- @param frame the frame to draw the line to
|
-- @param frame the frame to draw the line to
|
||||||
-- @param[opt=10] width the width of the bar
|
-- @param[opt=10] width the width of the bar
|
||||||
-- @return the line that was made type is progressbar
|
-- @return the line that was made type is progress bar
|
||||||
function Gui.bar(frame,width)
|
function Gui.bar(frame,width)
|
||||||
local line = frame.add{
|
local line = frame.add{
|
||||||
type='progressbar',
|
type='progressbar',
|
||||||
@@ -61,11 +44,11 @@ function Gui.bar(frame,width)
|
|||||||
return line
|
return line
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Adds a lable that is centered
|
--- Adds a label that is centered
|
||||||
-- @usage Gui.centered_label(frane, 'Hello, world!')
|
-- @usage Gui.centered_label(frame, 'Hello, world!')
|
||||||
-- @tparam LuaGuiElement frame the parent frame to add the label to
|
-- @tparam LuaGuiElement frame the parent frame to add the label to
|
||||||
-- @tparam string string the string that the lable will have
|
-- @tparam string string the string that the label will have
|
||||||
function Gui.centered_label(frane, string)
|
function Gui.centered_label(frame, string)
|
||||||
local flow = frame.add {frame = 'flow'}
|
local flow = frame.add {frame = 'flow'}
|
||||||
local flow_style = flow.style
|
local flow_style = flow.style
|
||||||
flow_style.align = 'center'
|
flow_style.align = 'center'
|
||||||
@@ -79,13 +62,13 @@ function Gui.centered_label(frane, string)
|
|||||||
return label
|
return label
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Used to set the index of a drop down to a certian item
|
--- Used to set the index of a drop down to a certain item
|
||||||
-- @usage Gui.set_dropdown_index(dropdown,player.name) -- will select the index with the players name as the value
|
-- @usage Gui.set_dropdown_index(dropdown,player.name) -- will select the index with the players name as the value
|
||||||
-- @param dropdown the dropdown that is to be effected
|
-- @param dropdown the dropdown that is to be effected
|
||||||
-- @param _item this is the item to look for
|
-- @param _item this is the item to look for
|
||||||
-- @return returns the dropdown if it was successful
|
-- @return returns the dropdown if it was successful
|
||||||
function Gui.set_dropdown_index(dropdown,_item)
|
function Gui.set_dropdown_index(dropdown,_item)
|
||||||
if dropdown and dropdown.valid and dropdown.items and _item then else return end
|
if not dropdown or not dropdown.valid or not dropdown.items or not _item then return end
|
||||||
local _index = 1
|
local _index = 1
|
||||||
for index, item in pairs(dropdown.items) do
|
for index, item in pairs(dropdown.items) do
|
||||||
if item == _item then _index = index break end
|
if item == _item then _index = index break end
|
||||||
@@ -105,7 +88,7 @@ end
|
|||||||
-- @field surface this will over ride the surface that the camera follows on, allowing for a 'ghost surface' while keeping same position
|
-- @field surface this will over ride the surface that the camera follows on, allowing for a 'ghost surface' while keeping same position
|
||||||
-- @field respawn_open if set to true then the camera will auto re link to the player after a respawn
|
-- @field respawn_open if set to true then the camera will auto re link to the player after a respawn
|
||||||
|
|
||||||
--- Adds a camera that updates every tick (or less depeading on how many are opening) it will move to follow an entity
|
--- Adds a camera that updates every tick (or less depending 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,frame=frame,width=50,hight=50,zoom=1}
|
||||||
-- @usage Gui.cam_link{entity=game.player.character,cam=frame.camera,surface=game.surfaces['testing']}
|
-- @usage Gui.cam_link{entity=game.player.character,cam=frame.camera,surface=game.surfaces['testing']}
|
||||||
-- @tparam table data contains all other params given below
|
-- @tparam table data contains all other params given below
|
||||||
@@ -120,7 +103,7 @@ function Gui.cam_link(data)
|
|||||||
data.cam.name='camera'
|
data.cam.name='camera'
|
||||||
data.cam.position= data.entity.position
|
data.cam.position= data.entity.position
|
||||||
data.cam.surface_index= data.surface and data.surface.index or data.entity.surface.index
|
data.cam.surface_index= data.surface and data.surface.index or data.entity.surface.index
|
||||||
data.cam.zomm = data.zoom
|
data.cam.zoom = data.zoom
|
||||||
data.cam = data.frame.add(data.cam)
|
data.cam = data.frame.add(data.cam)
|
||||||
data.cam.style.width = data.width or 100
|
data.cam.style.width = data.width or 100
|
||||||
data.cam.style.height = data.height or 100
|
data.cam.style.height = data.height or 100
|
||||||
@@ -158,17 +141,13 @@ function Gui.cam_link(data)
|
|||||||
end
|
end
|
||||||
|
|
||||||
script.on_event('on_tick', function(event)
|
script.on_event('on_tick', function(event)
|
||||||
if Gui.left and ((event.tick+10)/(3600*game.speed)) % 15 == 0 then
|
|
||||||
Gui.left.update()
|
|
||||||
end
|
|
||||||
if loaded_modules['ExpGamingCore.Server'] then return end
|
if loaded_modules['ExpGamingCore.Server'] then return end
|
||||||
|
|
||||||
if global.cams and is_type(global.cams,'table') and #global.cams > 0 then
|
if global.cams and is_type(global.cams,'table') and #global.cams > 0 then
|
||||||
local update = 4
|
local update = 4
|
||||||
if global.cam_index >= #global.cams then global.cam_index = 1 end
|
if global.cam_index >= #global.cams then global.cam_index = 1 end
|
||||||
if update > #global.cams then update = #global.cams end
|
if update > #global.cams then update = #global.cams end
|
||||||
for cam_offset = 0,update do
|
for cam_offset = 0,update do
|
||||||
local _cam = global.cams[global.cam_index]
|
local _cam = global.cams[global.cam_index+cam_offset]
|
||||||
if not _cam then break end
|
if not _cam then break end
|
||||||
if not _cam.cam.valid then table.remove(global.cams,global.cam_index)
|
if not _cam.cam.valid then table.remove(global.cams,global.cam_index)
|
||||||
elseif not _cam.entity.valid then table.remove(global.cams,global.cam_index)
|
elseif not _cam.entity.valid then table.remove(global.cams,global.cam_index)
|
||||||
@@ -180,10 +159,10 @@ script.on_event('on_tick', function(event)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
script.on_event('on_player_respawned',function(event)
|
script.on_event('on_player_respawned',function(event)
|
||||||
if Gui.center then Gui.center.clear() end
|
|
||||||
if loaded_modules['ExpGamingCore.Server'] then return end
|
if loaded_modules['ExpGamingCore.Server'] then return end
|
||||||
if global.players and is_type(global.players,'table') and #global.players > 0 and global.players[event.player_index] then
|
if global.players and is_type(global.players,'table') and #global.players > 0 and global.players[event.player_index] then
|
||||||
local remove = {}
|
local remove = {}
|
||||||
|
local player = Game.get_player(event)
|
||||||
for index,cam in pairs(global.players[event.player_index]) do
|
for index,cam in pairs(global.players[event.player_index]) do
|
||||||
if cam.valid then table.insert(global.cams,{cam=cam,entity=player.character,surface=player.surface})
|
if cam.valid then table.insert(global.cams,{cam=cam,entity=player.character,surface=player.surface})
|
||||||
else table.insert(remove,index) end
|
else table.insert(remove,index) end
|
||||||
@@ -195,26 +174,15 @@ script.on_event('on_player_respawned',function(event)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
function Gui:on_init()
|
function Gui:on_init()
|
||||||
self.left:on_init(); self.left.on_init = nil
|
if loaded_modules['ExpGamingCore.Server'] then
|
||||||
self.toolbar:on_init(); self.toolbar.on_init = nil
|
Server = require('ExpGamingCore.Server')
|
||||||
if loaded_modules['ExpGamingCore.Server@^4.0.0'] then Server = require('ExpGamingCore.Server@^4.0.0') verbose('ExpGamingCore.Server is installed; Loading server src') script.on_init(require(module_path..'/src/server',{Gui=self})) end
|
verbose('ExpGamingCore.Server is installed; Loading server src')
|
||||||
if loaded_modules['ExpGamingCore.Role@^4.0.0'] then
|
script.on_init(require(module_path..'/src/server',{Gui=self}))
|
||||||
verbose('ExpGamingCore.Role is installed; Loading ranking src')
|
|
||||||
script.on_event('on_role_change',function(event)
|
|
||||||
self.toolbar.on_role_change(event)
|
|
||||||
self.center.on_role_change(event)
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
script.on_event('on_player_joined_game',function(event)
|
|
||||||
self.toolbar.on_player_joined_game(event)
|
|
||||||
self.popup.on_player_joined_game(event)
|
|
||||||
self.left.on_player_joined_game(event)
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Gui:on_post()
|
function Gui.on_post()
|
||||||
Gui.test = require(module_path..'/src/test',{Gui=Gui})
|
Gui.test = require(module_path..'/src/test',{Gui=Gui})
|
||||||
Gui.popup.load() Gui.popup.load = nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,14 +9,14 @@
|
|||||||
|
|
||||||
local Game = require('FactorioStdLib.Game')
|
local Game = require('FactorioStdLib.Game')
|
||||||
local Color = require('FactorioStdLib.Color')
|
local Color = require('FactorioStdLib.Color')
|
||||||
local mod_gui = require("mod-gui")
|
local mod_gui = require('mod-gui')
|
||||||
local Gui = Gui -- this is to force gui to remain in the ENV
|
local Gui = require('ExpGamingCore.Gui')
|
||||||
|
|
||||||
local inputs = {}
|
local inputs = {}
|
||||||
inputs._prototype = {}
|
inputs._prototype = {}
|
||||||
-- these are just so you can have short cuts to this
|
-- these are just so you can have short cuts to this
|
||||||
inputs.events = {
|
inputs.events = {
|
||||||
error='error',
|
--error={}, -- this is added after event calls are added as it is not a script event
|
||||||
state=defines.events.on_gui_checked_state_changed,
|
state=defines.events.on_gui_checked_state_changed,
|
||||||
click=defines.events.on_gui_click,
|
click=defines.events.on_gui_click,
|
||||||
elem=defines.events.on_gui_elem_changed,
|
elem=defines.events.on_gui_elem_changed,
|
||||||
@@ -33,7 +33,7 @@ inputs.events = {
|
|||||||
function inputs._prototype:on_event(event,callback)
|
function inputs._prototype:on_event(event,callback)
|
||||||
if not is_type(callback,'function') then return self end
|
if not is_type(callback,'function') then return self end
|
||||||
if inputs.events[event] then event = inputs.events[event] end
|
if inputs.events[event] then event = inputs.events[event] end
|
||||||
if event == 'error' then self._error = callback return self end
|
if event == inputs.events.error then self._error = callback return self end
|
||||||
self.events[event] = callback
|
self.events[event] = callback
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -78,8 +78,8 @@ function inputs._prototype:draw(root)
|
|||||||
local success, err = pcall(self.data._items,player,root)
|
local success, err = pcall(self.data._items,player,root)
|
||||||
if success then data.items = err else error(err) end
|
if success then data.items = err else error(err) end
|
||||||
if is_type(self.data._index,'function') then
|
if is_type(self.data._index,'function') then
|
||||||
local success, err = pcall(self.data._index,player,root)
|
local _success, _err = pcall(self.data._index,player,root)
|
||||||
if success then data.selected_index = err else error(err) end
|
if _success then data.selected_index = _err else error(_err) end
|
||||||
end
|
end
|
||||||
return root.add(data)
|
return root.add(data)
|
||||||
else
|
else
|
||||||
@@ -87,25 +87,25 @@ function inputs._prototype:draw(root)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Add a new input, this is the same as doing frame.add{} but returns a diffrent object
|
--- Add a new input, this is the same as doing frame.add{} but returns a different object
|
||||||
-- @usage Gui.inputs.add{type='button',name='test',caption='Test'}
|
-- @usage Gui.inputs.add{type='button',name='test',caption='Test'}
|
||||||
-- @usage return_value(frame) -- draws the button onto that frame
|
-- @usage return_value(frame) -- draws the button onto that frame
|
||||||
-- @tparam table obj the new element to add if caption is a sprite path then sprite is used
|
-- @tparam table obj the new element to add if caption is a sprite path then sprite is used
|
||||||
-- @treturn table the custom input object, calling the returned calue will draw the button
|
-- @treturn table the custom input object, calling the returned value will draw the button
|
||||||
function inputs.add(obj)
|
function inputs.add(obj)
|
||||||
if not is_type(obj,'table') then return end
|
if not is_type(obj,'table') then return end
|
||||||
if not is_type(obj.type,'string') then return end
|
if not is_type(obj.type,'string') then return end
|
||||||
local type = obj.type
|
local type = obj.type
|
||||||
if type == 'button' or
|
if type ~= 'button'
|
||||||
type == 'sprite-button' or
|
and type ~= 'sprite-button'
|
||||||
type == 'choose-elem-button' or
|
and type ~= 'choose-elem-button'
|
||||||
type == 'checkbox' or
|
and type ~= 'checkbox'
|
||||||
type == 'radiobutton' or
|
and type ~= 'radiobutton'
|
||||||
type == 'textfield' or
|
and type ~= 'textfield'
|
||||||
type == 'text-box' or
|
and type ~= 'text-box'
|
||||||
type == 'slider' or
|
and type ~= 'slider'
|
||||||
type == 'drop-down'
|
and type ~= 'drop-down'
|
||||||
then else return end
|
then return end
|
||||||
verbose('Created Input: '..obj.name..' ('..obj.type..')')
|
verbose('Created Input: '..obj.name..' ('..obj.type..')')
|
||||||
if obj.type == 'button' or obj.type == 'sprite-button' then obj.style = mod_gui.button_style end
|
if obj.type == 'button' or obj.type == 'sprite-button' then obj.style = mod_gui.button_style end
|
||||||
obj.draw_data = table.deepcopy(obj)
|
obj.draw_data = table.deepcopy(obj)
|
||||||
@@ -136,33 +136,26 @@ function inputs._event_handler(event)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
inputs._events = {
|
script.on_event(inputs.events,inputs._event_handler)
|
||||||
[inputs.events.state]=inputs._event_handler,
|
inputs.events.error = {}
|
||||||
[inputs.events.click]=inputs._event_handler,
|
|
||||||
[inputs.events.elem]=inputs._event_handler,
|
|
||||||
[inputs.events.state]=inputs._event_handler,
|
|
||||||
[inputs.events.text]=inputs._event_handler,
|
|
||||||
[inputs.events.slider]=inputs._event_handler,
|
|
||||||
[inputs.events.selection]=inputs._event_handler
|
|
||||||
}
|
|
||||||
|
|
||||||
-- the folwing functions are just to make inputs easier but if what you want is not include use inputs.add(obj)
|
-- the following functions are just to make inputs easier but if what you want is not include use inputs.add(obj)
|
||||||
--- Used to define a button, can have many function
|
--- Used to define a button, can have many function
|
||||||
-- @usage Gui.inputs.add_button('test','Test','Just for testing',{{condition,callback},...})
|
-- @usage Gui.inputs.add_button('test','Test','Just for testing',{{condition,callback},...})
|
||||||
-- @tparam string name the name of this button
|
-- @tparam string name the name of this button
|
||||||
-- @tparam string the display for this button, either text or sprite path
|
-- @tparam string the display for this button, either text or sprite path
|
||||||
-- @tparam string tooltip the tooltip to show on the button
|
-- @tparam string tooltip the tooltip to show on the button
|
||||||
-- @param callbacks can either be a single function or a list of function pairs see exaplmes at bottom
|
-- @param callbacks can either be a single function or a list of function pairs see examples at bottom
|
||||||
-- @treturn table the button object that was made, to allow a custom error event if wanted
|
-- @treturn table the button object that was made, to allow a custom error event if wanted
|
||||||
function inputs.add_button(name,display,tooltip,callbacks)
|
function inputs.add_button(name,display,tooltip,callbacks)
|
||||||
local button = inputs.add{
|
local rtn_button = inputs.add{
|
||||||
type='button',
|
type='button',
|
||||||
name=name,
|
name=name,
|
||||||
caption=display,
|
caption=display,
|
||||||
tooltip=tooltip
|
tooltip=tooltip
|
||||||
}
|
}
|
||||||
button.data._callbacks = callbacks
|
rtn_button.data._callbacks = callbacks
|
||||||
button:on_event('click',function(event)
|
rtn_button:on_event('click',function(event)
|
||||||
local elements = Gui.data['inputs_'..event.element.type] or {}
|
local elements = Gui.data['inputs_'..event.element.type] or {}
|
||||||
local button = elements[event.element.name]
|
local button = elements[event.element.name]
|
||||||
if not button and event.element.type == 'sprite-button' then
|
if not button and event.element.type == 'sprite-button' then
|
||||||
@@ -173,19 +166,19 @@ function inputs.add_button(name,display,tooltip,callbacks)
|
|||||||
local mouse = event.button
|
local mouse = event.button
|
||||||
local keys = {alt=event.alt,ctrl=event.control,shift=event.shift}
|
local keys = {alt=event.alt,ctrl=event.control,shift=event.shift}
|
||||||
local element = event.element
|
local element = event.element
|
||||||
local callbacks = button.data._callbacks
|
local btn_callbacks = button.data._callbacks
|
||||||
if is_type(callbacks,'function') then callbacks = {{function(...) return true end,callbacks}} end
|
if is_type(btn_callbacks,'function') then btn_callbacks = {{function() return true end,btn_callbacks}} end
|
||||||
for _,data in pairs(callbacks) do
|
for _,data in pairs(btn_callbacks) do
|
||||||
if is_type(data[1],'function') and is_type(data[2],'function') then
|
if is_type(data[1],'function') and is_type(data[2],'function') then
|
||||||
local success, err = pcall(data[1],player,mouse,keys,event)
|
local success, err = pcall(data[1],player,mouse,keys,event)
|
||||||
if success and err == true then
|
if success and err == true then
|
||||||
local success, err = pcall(data[2],player,element,event)
|
local _success, _err = pcall(data[2],player,element,event)
|
||||||
if not success then error(err) end
|
if not _success then error(_err) end
|
||||||
elseif not success then error(err) end
|
elseif not success then error(err) end
|
||||||
else error('Invalid Callback Condition Format') end
|
else error('Invalid Callback Condition Format') end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
return button
|
return rtn_button
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Used to define a choose-elem-button callback only on elem_changed
|
--- Used to define a choose-elem-button callback only on elem_changed
|
||||||
@@ -228,20 +221,19 @@ end
|
|||||||
function inputs.add_checkbox(name,radio,display,default,callback_true,callback_false)
|
function inputs.add_checkbox(name,radio,display,default,callback_true,callback_false)
|
||||||
local type = 'checkbox'; if radio then type='radiobutton' end
|
local type = 'checkbox'; if radio then type='radiobutton' end
|
||||||
local state = false; if is_type(default,'boolean') then state = default end
|
local state = false; if is_type(default,'boolean') then state = default end
|
||||||
local checkbox = inputs.add{
|
local rtn_checkbox = inputs.add{
|
||||||
type=type,
|
type=type,
|
||||||
name=name,
|
name=name,
|
||||||
caption=display,
|
caption=display,
|
||||||
state=state
|
state=state
|
||||||
}
|
}
|
||||||
if is_type(default,'function') then checkbox.data._state = default end
|
if is_type(default,'function') then rtn_checkbox.data._state = default end
|
||||||
checkbox.data._true = callback_true
|
rtn_checkbox.data._true = callback_true
|
||||||
checkbox.data._false = callback_false
|
rtn_checkbox.data._false = callback_false
|
||||||
checkbox:on_event('state',function(event)
|
rtn_checkbox:on_event('state',function(event)
|
||||||
local checkbox = Gui.data['inputs_'..event.element.type][event.element.name]
|
local checkbox = Gui.data['inputs_'..event.element.type][event.element.name]
|
||||||
local player = Game.get_player(event)
|
local player = Game.get_player(event)
|
||||||
local state = event.element.state
|
if event.element.state then
|
||||||
if state then
|
|
||||||
if is_type(checkbox.data._true,'function') then
|
if is_type(checkbox.data._true,'function') then
|
||||||
local success, err = pcall(checkbox.data._true,player,event.element)
|
local success, err = pcall(checkbox.data._true,player,event.element)
|
||||||
if not success then error(err) end
|
if not success then error(err) end
|
||||||
@@ -253,10 +245,10 @@ function inputs.add_checkbox(name,radio,display,default,callback_true,callback_f
|
|||||||
else error('Invalid Callback') end
|
else error('Invalid Callback') end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
return checkbox
|
return rtn_checkbox
|
||||||
end
|
end
|
||||||
|
|
||||||
--- 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.
|
--- Used to reset the state of radio buttons, recommended to be called on_state_change to reset any radio buttons it is meant to work with.
|
||||||
-- @usage Gui.inputs.reset_radio{radio1,radio2,...}
|
-- @usage Gui.inputs.reset_radio{radio1,radio2,...}
|
||||||
-- @param elements can be a list of elements or a single element
|
-- @param elements can be a list of elements or a single element
|
||||||
function inputs.reset_radio(elements)
|
function inputs.reset_radio(elements)
|
||||||
@@ -294,23 +286,23 @@ end
|
|||||||
-- @treturn table the text object that was made, to allow a custom error event if wanted
|
-- @treturn table the text object that was made, to allow a custom error event if wanted
|
||||||
function inputs.add_text(name,box,text,callback)
|
function inputs.add_text(name,box,text,callback)
|
||||||
local type = 'textfield'; if box then type='text-box' end
|
local type = 'textfield'; if box then type='text-box' end
|
||||||
local textbox = inputs.add{
|
local rtn_textbox = inputs.add{
|
||||||
type=type,
|
type=type,
|
||||||
name=name,
|
name=name,
|
||||||
text=text
|
text=text
|
||||||
}
|
}
|
||||||
textbox.data._callback = callback
|
rtn_textbox.data._callback = callback
|
||||||
textbox:on_event('text',function(event)
|
rtn_textbox:on_event('text',function(event)
|
||||||
local textbox = Gui.data['inputs_'..event.element.type][event.element.name]
|
local textbox = Gui.data['inputs_'..event.element.type][event.element.name]
|
||||||
local player = Game.get_player(event)
|
local player = Game.get_player(event)
|
||||||
local element = event.element
|
local element = event.element
|
||||||
local callback = textbox.data._callback
|
local event_callback = textbox.data._callback
|
||||||
if is_type(callback,'function') then
|
if is_type(event_callback,'function') then
|
||||||
local success, err = pcall(callback,player,element.text,element)
|
local success, err = pcall(event_callback,player,element.text,element)
|
||||||
if not success then error(err) end
|
if not success then error(err) end
|
||||||
else error('Invalid Callback Condition Format') end
|
else error('Invalid Callback Condition Format') end
|
||||||
end)
|
end)
|
||||||
return textbox
|
return rtn_textbox
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Used to define a slider callback only on value_changed
|
--- Used to define a slider callback only on value_changed
|
||||||
@@ -355,31 +347,29 @@ end
|
|||||||
-- @tparam function callback the callback which is called when a new index is selected function(player,selected,items,element)
|
-- @tparam function callback the callback which is called when a new index is selected function(player,selected,items,element)
|
||||||
-- @treturn table the drop-down object that was made, to allow a custom error event if wanted
|
-- @treturn table the drop-down object that was made, to allow a custom error event if wanted
|
||||||
function inputs.add_drop_down(name,items,index,callback)
|
function inputs.add_drop_down(name,items,index,callback)
|
||||||
local drop_down = inputs.add{
|
local rtn_dropdown = inputs.add{
|
||||||
type='drop-down',
|
type='drop-down',
|
||||||
name=name,
|
name=name,
|
||||||
items=items,
|
items=items,
|
||||||
selected_index=index
|
selected_index=index
|
||||||
}
|
}
|
||||||
drop_down.data._items = items
|
rtn_dropdown.data._items = items
|
||||||
drop_down.data._index = index
|
rtn_dropdown.data._index = index
|
||||||
drop_down.data._callback = callback
|
rtn_dropdown.data._callback = callback
|
||||||
drop_down:on_event('selection',function(event)
|
rtn_dropdown:on_event('selection',function(event)
|
||||||
local drop_down = Gui.data['inputs_'..event.element.type][event.element.name]
|
local dropdown = Gui.data['inputs_'..event.element.type][event.element.name]
|
||||||
local player = Game.get_player(event)
|
local player = Game.get_player(event)
|
||||||
local element = event.element
|
local element = event.element
|
||||||
local items = element.items
|
local drop_items = element.items
|
||||||
local selected = items[element.selected_index]
|
local selected = drop_items[element.selected_index]
|
||||||
local callback = drop_down.data._callback
|
local drop_callback = dropdown.data._callback
|
||||||
if is_type(callback,'function') then
|
if is_type(drop_callback,'function') then
|
||||||
local success, err = pcall(callback,player,selected,items,element)
|
local success, err = pcall(drop_callback,player,selected,drop_items,element)
|
||||||
if not success then error(err) end
|
if not success then error(err) end
|
||||||
else error('Invalid Callback Condition Format') end
|
else error('Invalid Callback Condition Format') end
|
||||||
end)
|
end)
|
||||||
return drop_down
|
return rtn_dropdown
|
||||||
end
|
end
|
||||||
|
|
||||||
-- calling will attempt to add a new input
|
-- calling will attempt to add a new input
|
||||||
return setmetatable(inputs,{__call=function(self,...) return self.add(...) end})
|
return setmetatable(inputs,{__call=function(self,...) return self.add(...) end})
|
||||||
|
|
||||||
-- to see examples look at GuiParts/test.lua
|
|
||||||
23
modules/ExpGamingCore/Gui/inputs/softmod.json
Normal file
23
modules/ExpGamingCore/Gui/inputs/softmod.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"name": "ExpGamingCore.Gui.inputs",
|
||||||
|
"version": "4.0.0",
|
||||||
|
"description": "Addds an event manager for gui inputs and easy input creation",
|
||||||
|
"author": "Cooldude2606",
|
||||||
|
"contact": "Discord: Cooldude2606#5241",
|
||||||
|
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
||||||
|
"location": "FSM_ARCHIVE",
|
||||||
|
"keywords": [
|
||||||
|
"Gui",
|
||||||
|
"Inputs",
|
||||||
|
"Buttons",
|
||||||
|
"Text Fields"
|
||||||
|
],
|
||||||
|
"collection": "ExpGamingCore.Gui@4.0.0",
|
||||||
|
"dependencies": {
|
||||||
|
"mod-gui": "*",
|
||||||
|
"FactorioStdLib.Color": "^0.8.0",
|
||||||
|
"FactorioStdLib.Game": "^0.8.0",
|
||||||
|
"ExpGamingCore.Gui": "^4.0.0"
|
||||||
|
},
|
||||||
|
"submodules": {}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user