mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Cleaned Config Files
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
--- This is a very simple config file which adds a admin only auth function
|
||||||
|
-- not much to change here its more so it can be enabled and disabled from ./config/file_loader.lua
|
||||||
|
-- either way you can change the requirements to be "admin" if you wanted to
|
||||||
local Commands = require 'expcore.commands'
|
local Commands = require 'expcore.commands'
|
||||||
|
|
||||||
Commands.add_authenticator(function(player,command,tags,reject)
|
Commands.add_authenticator(function(player,command,tags,reject)
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
|
--- This file contains some common command param parse functions
|
||||||
|
-- this file is less of a config and more of a requirement but you may wish to change how some behave
|
||||||
|
-- as such you need to be confident with lua but you edit this config file
|
||||||
|
-- use Commands.add_parse('name',function(input,player,reject) end) to add a parse
|
||||||
|
-- see ./expcore/commands.lua for more details
|
||||||
local Commands = require 'expcore.commands'
|
local Commands = require 'expcore.commands'
|
||||||
local Game = require 'utils.game'
|
local Game = require 'utils.game'
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
>>>>Adds parses:
|
>>>>Adds Parses:
|
||||||
boolean
|
boolean
|
||||||
string-options - options: array
|
string-options - options: array
|
||||||
string-max-length - max_length: number
|
string-max-length - max_length: number
|
||||||
|
|||||||
20
config/file_loader.lua
Normal file
20
config/file_loader.lua
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
--- This contains a list of all files that will be loaded and the order they are loaded in
|
||||||
|
-- to stop a file from loading add "--" in front of it, remove the "--" to have the file be loaded
|
||||||
|
-- config files should be loaded after all modules are loaded
|
||||||
|
-- core files should be required by modules and not be present in this list
|
||||||
|
return {
|
||||||
|
--'example.file_not_loaded',
|
||||||
|
'modules.factorio-control', -- base factorio free play scenario
|
||||||
|
-- Game Commands
|
||||||
|
'modules.commands.me',
|
||||||
|
'modules.commands.kill',
|
||||||
|
'modules.commands.admin-chat',
|
||||||
|
'modules.commands.tag',
|
||||||
|
'modules.commands.teleport',
|
||||||
|
'modules.commands.cheat-mode',
|
||||||
|
'modules.commands.interface',
|
||||||
|
'modules.commands.help',
|
||||||
|
-- Config Files
|
||||||
|
'config.command_auth_admin', -- commands tags with admin_only are blocked for non admins
|
||||||
|
'config.permission_groups', -- loads some predefined permission groups
|
||||||
|
}
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
--- Use this file to add new permission groups to the game
|
||||||
|
-- start with Permission_Groups.new_group('name')
|
||||||
|
-- then use either :allow_all() or :disallow_all() to set the default for non specified actions
|
||||||
|
-- then use :allow{} and :disallow{} to specify certain actions to allow/disallow
|
||||||
local Event = require 'utils.event'
|
local Event = require 'utils.event'
|
||||||
local Game = require 'utils.game'
|
local Game = require 'utils.game'
|
||||||
local Permission_Groups = require 'expcore.permission_groups'
|
local Permission_Groups = require 'expcore.permission_groups'
|
||||||
|
|||||||
41
control.lua
41
control.lua
@@ -1,4 +1,8 @@
|
|||||||
-- If you're looking to configure anything, you want config.lua. Nearly everything in this file is dictated by the config.
|
|
||||||
|
--- Please go to ./config if you want to change settings, each file is commented with what it does
|
||||||
|
-- if it is not in ./config then you should not attempt to change it unless you know what you are doing
|
||||||
|
-- all files which are loaded (including the config files) are present in ./config/file_loader.lua
|
||||||
|
-- this file is the landing point for all scenarios please DO NOT edit directly, further comments are to aid development
|
||||||
|
|
||||||
-- Info on the data lifecycle and how we use it: https://github.com/Refactorio/RedMew/wiki/The-data-lifecycle
|
-- Info on the data lifecycle and how we use it: https://github.com/Refactorio/RedMew/wiki/The-data-lifecycle
|
||||||
require 'resources.data_stages'
|
require 'resources.data_stages'
|
||||||
@@ -14,34 +18,35 @@ require 'utils.math'
|
|||||||
Debug = require 'utils.debug'
|
Debug = require 'utils.debug'
|
||||||
require 'resources.version'
|
require 'resources.version'
|
||||||
|
|
||||||
local files = {
|
-- Global require function used to extract parts of a module, because simply being in common is not good enough
|
||||||
'modules.factorio-control',
|
ext_require = require('expcore.common').ext_require
|
||||||
'modules.commands.me',
|
|
||||||
'modules.commands.kill',
|
|
||||||
'modules.commands.admin-chat',
|
|
||||||
'modules.commands.tag',
|
|
||||||
'modules.commands.teleport',
|
|
||||||
'modules.commands.cheat-mode',
|
|
||||||
'modules.commands.interface',
|
|
||||||
'modules.commands.help',
|
|
||||||
'config.permission_groups'
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Loads all files in array above and logs progress
|
-- Please go to config/file_loader.lua to edit the files that are loaded
|
||||||
local total_files = string.format('%3d',#files)
|
local files = require 'config.file_loader'
|
||||||
|
|
||||||
|
-- Loads all files from the config and logs that they are loaded
|
||||||
|
local total_file_count = string.format('%3d',#files)
|
||||||
local errors = {}
|
local errors = {}
|
||||||
for index,path in pairs(files) do
|
for index,path in pairs(files) do
|
||||||
log(string.format('[INFO] Loading files %3d/%s',index,total_files))
|
|
||||||
|
-- Loads the next file in the list
|
||||||
|
log(string.format('[INFO] Loading files %3d/%s',index,total_file_count))
|
||||||
local success,file = pcall(require,path)
|
local success,file = pcall(require,path)
|
||||||
-- error checking
|
|
||||||
|
-- Error Checking
|
||||||
if not success then
|
if not success then
|
||||||
|
-- Failed to load a file
|
||||||
log('[ERROR] Failed to load file: '..path)
|
log('[ERROR] Failed to load file: '..path)
|
||||||
log('[ERROR] '..file)
|
log('[ERROR] '..file)
|
||||||
table.insert(errors,'[ERROR] '..path..' :: '..file)
|
table.insert(errors,'[ERROR] '..path..' :: '..file)
|
||||||
elseif type(file) == 'string' and file:find('not found') then
|
elseif type(file) == 'string' and file:find('not found') then
|
||||||
|
-- Returned a file not found message
|
||||||
log('[ERROR] File not found: '..path)
|
log('[ERROR] File not found: '..path)
|
||||||
table.insert(errors,'[ERROR] '..path..' :: Not Found')
|
table.insert(errors,'[ERROR] '..path..' :: Not Found')
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Logs all errors again to make it make it easy to find
|
||||||
log('[INFO] All files loaded with '..#errors..' errors:')
|
log('[INFO] All files loaded with '..#errors..' errors:')
|
||||||
for _,error in pairs(errors) do log(error) end -- logs all errors again to make it make it easy to find
|
for _,error in pairs(errors) do log(error) end
|
||||||
@@ -162,7 +162,7 @@
|
|||||||
]]
|
]]
|
||||||
|
|
||||||
local Game = require 'utils.game'
|
local Game = require 'utils.game'
|
||||||
local player_return = require('expcore.common').player_return
|
local player_return = ext_require('expcore.common','player_return')
|
||||||
|
|
||||||
local Commands = {
|
local Commands = {
|
||||||
defines={ -- common values are stored error like signals
|
defines={ -- common values are stored error like signals
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
local Commands = require 'expcore.commands'
|
local Commands = require 'expcore.commands'
|
||||||
require 'config.command_parse_general'
|
require 'config.command_parse_general'
|
||||||
require 'config.command_auth_admin'
|
|
||||||
|
|
||||||
Commands.new_command('admin-chat','Sends a message in chat that only admins can see.')
|
Commands.new_command('admin-chat','Sends a message in chat that only admins can see.')
|
||||||
:add_param('message',false) -- the message to send in the admin chat
|
:add_param('message',false) -- the message to send in the admin chat
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
local Commands = require 'expcore.commands'
|
local Commands = require 'expcore.commands'
|
||||||
require 'config.command_parse_general'
|
require 'config.command_parse_general'
|
||||||
require 'config.command_auth_admin'
|
|
||||||
|
|
||||||
Commands.new_command('toggle-cheat-mode','Toggles cheat mode for your player, or another player.')
|
Commands.new_command('toggle-cheat-mode','Toggles cheat mode for your player, or another player.')
|
||||||
:add_param('player',true,'player') -- player to toggle chest mode of, can be nil for self
|
:add_param('player',true,'player') -- player to toggle chest mode of, can be nil for self
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
local Commands = require 'expcore.commands'
|
local Commands = require 'expcore.commands'
|
||||||
local Global = require 'utils.global'
|
local Global = require 'utils.global'
|
||||||
local Common = require 'expcore.common'
|
local Common = require 'expcore.common'
|
||||||
require 'config.command_auth_admin'
|
|
||||||
|
|
||||||
-- modules that are loaded into the interface env to be accessed
|
-- modules that are loaded into the interface env to be accessed
|
||||||
local interface_modules = {
|
local interface_modules = {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
local Commands = require 'expcore.commands'
|
local Commands = require 'expcore.commands'
|
||||||
require 'config.command_parse_general'
|
require 'config.command_parse_general'
|
||||||
require 'config.command_auth_admin'
|
|
||||||
|
|
||||||
Commands.new_command('kill','Kills yourself or another player.')
|
Commands.new_command('kill','Kills yourself or another player.')
|
||||||
:add_param('player',true,'player-alive') -- the player to kill, must be alive to be valid
|
:add_param('player',true,'player-alive') -- the player to kill, must be alive to be valid
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
local Commands = require 'expcore.commands'
|
local Commands = require 'expcore.commands'
|
||||||
require 'config.command_parse_general'
|
require 'config.command_parse_general'
|
||||||
require 'config.command_auth_admin'
|
|
||||||
|
|
||||||
local function teleport(from_player,to_player)
|
local function teleport(from_player,to_player)
|
||||||
local surface = to_player.surface
|
local surface = to_player.surface
|
||||||
|
|||||||
Reference in New Issue
Block a user