From 1ab9877e77da9efbd81fa1198431d1f8938aa46b Mon Sep 17 00:00:00 2001 From: Timo Smit Date: Thu, 10 Jan 2019 14:20:04 +0100 Subject: [PATCH] Basic Lua 5.0 compatibility for ETPro --- luascripts/wolfadmin/admin/admin.lua | 10 +-- luascripts/wolfadmin/admin/balancer.lua | 16 ++-- luascripts/wolfadmin/admin/bans.lua | 4 +- luascripts/wolfadmin/admin/history.lua | 4 +- luascripts/wolfadmin/admin/mutes.lua | 8 +- luascripts/wolfadmin/admin/rules.lua | 8 +- luascripts/wolfadmin/auth/acl.lua | 10 +-- luascripts/wolfadmin/auth/auth.lua | 10 +-- luascripts/wolfadmin/auth/shrubbot.lua | 4 +- luascripts/wolfadmin/auth/shrubbot/etpub.lua | 2 +- luascripts/wolfadmin/auth/shrubbot/nq.lua | 2 +- luascripts/wolfadmin/auth/shrubbot/silent.lua | 2 +- .../wolfadmin/commands/admin/admintest.lua | 8 +- .../wolfadmin/commands/admin/balance.lua | 6 +- luascripts/wolfadmin/commands/admin/ban.lua | 12 +-- .../wolfadmin/commands/admin/cointoss.lua | 6 +- .../wolfadmin/commands/admin/enablevote.lua | 6 +- .../wolfadmin/commands/admin/finger.lua | 8 +- luascripts/wolfadmin/commands/admin/gib.lua | 10 +-- .../wolfadmin/commands/admin/greeting.lua | 6 +- luascripts/wolfadmin/commands/admin/help.lua | 6 +- .../wolfadmin/commands/admin/incognito.lua | 4 +- luascripts/wolfadmin/commands/admin/kick.lua | 10 +-- .../wolfadmin/commands/admin/kickbots.lua | 6 +- .../wolfadmin/commands/admin/listaliases.lua | 12 +-- .../wolfadmin/commands/admin/listmaps.lua | 6 +- .../wolfadmin/commands/admin/listplayers.lua | 12 +-- luascripts/wolfadmin/commands/admin/lock.lua | 12 +-- luascripts/wolfadmin/commands/admin/mute.lua | 14 ++-- .../wolfadmin/commands/admin/needbots.lua | 6 +- .../wolfadmin/commands/admin/nextmap.lua | 6 +- luascripts/wolfadmin/commands/admin/pause.lua | 6 +- luascripts/wolfadmin/commands/admin/plock.lua | 6 +- .../wolfadmin/commands/admin/punlock.lua | 6 +- luascripts/wolfadmin/commands/admin/put.lua | 12 +-- .../wolfadmin/commands/admin/putbots.lua | 12 +-- .../wolfadmin/commands/admin/readconfig.lua | 12 +-- luascripts/wolfadmin/commands/admin/reset.lua | 6 +- .../wolfadmin/commands/admin/resetsprees.lua | 12 +-- .../wolfadmin/commands/admin/restart.lua | 8 +- luascripts/wolfadmin/commands/admin/rules.lua | 6 +- .../wolfadmin/commands/admin/setlevel.lua | 12 +-- .../wolfadmin/commands/admin/showbans.lua | 14 ++-- .../wolfadmin/commands/admin/showhistory.lua | 14 ++-- .../wolfadmin/commands/admin/shuffle.lua | 6 +- .../wolfadmin/commands/admin/shufflesr.lua | 6 +- luascripts/wolfadmin/commands/admin/slap.lua | 10 +-- .../wolfadmin/commands/admin/spec999.lua | 12 +-- .../wolfadmin/commands/admin/sprees.lua | 8 +- luascripts/wolfadmin/commands/admin/stats.lua | 6 +- luascripts/wolfadmin/commands/admin/swap.lua | 6 +- luascripts/wolfadmin/commands/admin/time.lua | 6 +- luascripts/wolfadmin/commands/admin/unban.lua | 10 +-- .../wolfadmin/commands/admin/unlock.lua | 12 +-- .../wolfadmin/commands/admin/unmute.lua | 10 +-- .../wolfadmin/commands/admin/unpause.lua | 6 +- luascripts/wolfadmin/commands/admin/vmute.lua | 12 +-- .../wolfadmin/commands/admin/vunmute.lua | 6 +- luascripts/wolfadmin/commands/admin/warn.lua | 12 +-- luascripts/wolfadmin/commands/client/ac.lua | 6 +- .../wolfadmin/commands/client/callvote.lua | 4 +- luascripts/wolfadmin/commands/client/pm.lua | 10 +-- luascripts/wolfadmin/commands/client/r.lua | 6 +- luascripts/wolfadmin/commands/client/say.lua | 8 +- luascripts/wolfadmin/commands/client/team.lua | 10 +-- .../wolfadmin/commands/client/wolfadmin.lua | 2 +- luascripts/wolfadmin/commands/commands.lua | 14 ++-- luascripts/wolfadmin/commands/server/acl.lua | 8 +- .../wolfadmin/commands/server/cannounce.lua | 4 +- .../wolfadmin/commands/server/cchat.lua | 4 +- luascripts/wolfadmin/commands/server/ccp.lua | 4 +- luascripts/wolfadmin/commands/server/ccpm.lua | 4 +- .../wolfadmin/commands/server/cmusic.lua | 4 +- luascripts/wolfadmin/commands/server/csay.lua | 4 +- luascripts/wolfadmin/db/db.lua | 8 +- luascripts/wolfadmin/db/mysql.lua | 10 +-- luascripts/wolfadmin/db/sqlite3.lua | 10 +-- luascripts/wolfadmin/game/bots.lua | 8 +- luascripts/wolfadmin/game/fireteams.lua | 2 +- luascripts/wolfadmin/game/game.lua | 8 +- luascripts/wolfadmin/game/sprees.lua | 18 ++-- luascripts/wolfadmin/game/teams.lua | 6 +- luascripts/wolfadmin/game/voting.lua | 12 +-- luascripts/wolfadmin/main.lua | 84 +++++++++++-------- luascripts/wolfadmin/players/greetings.lua | 18 ++-- luascripts/wolfadmin/players/players.lua | 6 +- luascripts/wolfadmin/players/stats.lua | 2 +- luascripts/wolfadmin/util/bits.lua | 2 +- luascripts/wolfadmin/util/debug.lua | 2 +- luascripts/wolfadmin/util/events.lua | 4 +- luascripts/wolfadmin/util/files.lua | 6 +- luascripts/wolfadmin/util/logs.lua | 4 +- luascripts/wolfadmin/util/pagination.lua | 2 +- luascripts/wolfadmin/util/settings.lua | 6 +- luascripts/wolfadmin/util/tables.lua | 2 +- luascripts/wolfadmin/util/timers.lua | 4 +- luascripts/wolfadmin/util/util.lua | 2 +- 97 files changed, 413 insertions(+), 395 deletions(-) diff --git a/luascripts/wolfadmin/admin/admin.lua b/luascripts/wolfadmin/admin/admin.lua index 6ed91f9..14e198a 100644 --- a/luascripts/wolfadmin/admin/admin.lua +++ b/luascripts/wolfadmin/admin/admin.lua @@ -15,13 +15,13 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local events = require (wolfa_getLuaPath()..".util.events") -local settings = require (wolfa_getLuaPath()..".util.settings") -local util = require (wolfa_getLuaPath()..".util.util") +local events = wolfa_requireModule("util.events") +local settings = wolfa_requireModule("util.settings") +local util = wolfa_requireModule("util.util") local admin = {} diff --git a/luascripts/wolfadmin/admin/balancer.lua b/luascripts/wolfadmin/admin/balancer.lua index 8e2f7e1..9af7dc5 100644 --- a/luascripts/wolfadmin/admin/balancer.lua +++ b/luascripts/wolfadmin/admin/balancer.lua @@ -15,15 +15,15 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local teams = require (wolfa_getLuaPath()..".game.teams") +local teams = wolfa_requireModule("game.teams") -local constants = require (wolfa_getLuaPath()..".util.constants") -local bits = require (wolfa_getLuaPath()..".util.bits") -local events = require (wolfa_getLuaPath()..".util.events") -local settings = require (wolfa_getLuaPath()..".util.settings") -local tables = require (wolfa_getLuaPath()..".util.tables") -local timers = require (wolfa_getLuaPath()..".util.timers") -local util = require (wolfa_getLuaPath()..".util.util") +local constants = wolfa_requireModule("util.constants") +local bits = wolfa_requireModule("util.bits") +local events = wolfa_requireModule("util.events") +local settings = wolfa_requireModule("util.settings") +local tables = wolfa_requireModule("util.tables") +local timers = wolfa_requireModule("util.timers") +local util = wolfa_requireModule("util.util") local balancer = {} diff --git a/luascripts/wolfadmin/admin/bans.lua b/luascripts/wolfadmin/admin/bans.lua index 2bc2aa0..0f2df01 100644 --- a/luascripts/wolfadmin/admin/bans.lua +++ b/luascripts/wolfadmin/admin/bans.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") local bans = {} diff --git a/luascripts/wolfadmin/admin/history.lua b/luascripts/wolfadmin/admin/history.lua index a5680f3..acc3ff3 100644 --- a/luascripts/wolfadmin/admin/history.lua +++ b/luascripts/wolfadmin/admin/history.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") local history = {} diff --git a/luascripts/wolfadmin/admin/mutes.lua b/luascripts/wolfadmin/admin/mutes.lua index ee677fa..cd54f52 100644 --- a/luascripts/wolfadmin/admin/mutes.lua +++ b/luascripts/wolfadmin/admin/mutes.lua @@ -15,12 +15,12 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local events = require (wolfa_getLuaPath()..".util.events") -local timers = require (wolfa_getLuaPath()..".util.timers") +local events = wolfa_requireModule("util.events") +local timers = wolfa_requireModule("util.timers") local mutes = {} diff --git a/luascripts/wolfadmin/admin/rules.lua b/luascripts/wolfadmin/admin/rules.lua index 708d6e3..07a41ed 100644 --- a/luascripts/wolfadmin/admin/rules.lua +++ b/luascripts/wolfadmin/admin/rules.lua @@ -15,11 +15,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local events = require (wolfa_getLuaPath()..".util.events") -local files = require (wolfa_getLuaPath()..".util.files") -local settings = require (wolfa_getLuaPath()..".util.settings") +local events = wolfa_requireModule("util.events") +local files = wolfa_requireModule("util.files") +local settings = wolfa_requireModule("util.settings") -local toml = require "toml" +local toml = wolfa_requireLib("toml") local rules = {} diff --git a/luascripts/wolfadmin/auth/acl.lua b/luascripts/wolfadmin/auth/acl.lua index 11a0111..8bde24c 100644 --- a/luascripts/wolfadmin/auth/acl.lua +++ b/luascripts/wolfadmin/auth/acl.lua @@ -15,13 +15,13 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local events = require (wolfa_getLuaPath()..".util.events") -local settings = require (wolfa_getLuaPath()..".util.settings") -local tables = require (wolfa_getLuaPath()..".util.tables") +local events = wolfa_requireModule("util.events") +local settings = wolfa_requireModule("util.settings") +local tables = wolfa_requireModule("util.tables") local acl = {} diff --git a/luascripts/wolfadmin/auth/auth.lua b/luascripts/wolfadmin/auth/auth.lua index 390ec26..ec85d2b 100644 --- a/luascripts/wolfadmin/auth/auth.lua +++ b/luascripts/wolfadmin/auth/auth.lua @@ -15,10 +15,10 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local events = require (wolfa_getLuaPath()..".util.events") -local settings = require (wolfa_getLuaPath()..".util.settings") +local events = wolfa_requireModule("util.events") +local settings = wolfa_requireModule("util.settings") local auth = {} @@ -129,11 +129,11 @@ function auth.onGameInit() return end - srv = require (wolfa_getLuaPath()..".auth.acl") + srv = wolfa_requireModule("auth.acl") srv.readPermissions() else - srv = require (wolfa_getLuaPath()..".auth.shrubbot") + srv = wolfa_requireModule("auth.shrubbot") srv.loadFlags(et.trap_Cvar_Get("fs_game")) end diff --git a/luascripts/wolfadmin/auth/shrubbot.lua b/luascripts/wolfadmin/auth/shrubbot.lua index 74d3923..321ff57 100644 --- a/luascripts/wolfadmin/auth/shrubbot.lua +++ b/luascripts/wolfadmin/auth/shrubbot.lua @@ -17,12 +17,12 @@ local shrubbot = {} -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") local flags function shrubbot.loadFlags(mod) - flags = require (wolfa_getLuaPath()..".auth.shrubbot."..mod) + flags = wolfa_requireModule("auth.shrubbot."..mod) end function shrubbot.isPlayerAllowed(clientId, permission) diff --git a/luascripts/wolfadmin/auth/shrubbot/etpub.lua b/luascripts/wolfadmin/auth/shrubbot/etpub.lua index bf81a6e..409dc15 100644 --- a/luascripts/wolfadmin/auth/shrubbot/etpub.lua +++ b/luascripts/wolfadmin/auth/shrubbot/etpub.lua @@ -15,7 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -- ETPub shrubbot flags -- left by mod: fjlovyDHJOTY diff --git a/luascripts/wolfadmin/auth/shrubbot/nq.lua b/luascripts/wolfadmin/auth/shrubbot/nq.lua index 8715a44..a63a075 100644 --- a/luascripts/wolfadmin/auth/shrubbot/nq.lua +++ b/luascripts/wolfadmin/auth/shrubbot/nq.lua @@ -15,7 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -- NoQuarter shrubbot flags -- left by mod: jlqyFHOQY diff --git a/luascripts/wolfadmin/auth/shrubbot/silent.lua b/luascripts/wolfadmin/auth/shrubbot/silent.lua index 2bcd833..c8675e4 100644 --- a/luascripts/wolfadmin/auth/shrubbot/silent.lua +++ b/luascripts/wolfadmin/auth/shrubbot/silent.lua @@ -15,7 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -- silEnT shrubbot flags -- left by mod: fhjovyDHJOTY diff --git a/luascripts/wolfadmin/commands/admin/admintest.lua b/luascripts/wolfadmin/commands/admin/admintest.lua index 4193a5c..809f2ea 100644 --- a/luascripts/wolfadmin/commands/admin/admintest.lua +++ b/luascripts/wolfadmin/commands/admin/admintest.lua @@ -15,13 +15,13 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local settings = require (wolfa_getLuaPath()..".util.settings") +local settings = wolfa_requireModule("util.settings") function commandAdminTest(clientId, command) local level = auth.getPlayerLevel(clientId) diff --git a/luascripts/wolfadmin/commands/admin/balance.lua b/luascripts/wolfadmin/commands/admin/balance.lua index da531bd..a53f683 100644 --- a/luascripts/wolfadmin/commands/admin/balance.lua +++ b/luascripts/wolfadmin/commands/admin/balance.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local commands = require (wolfa_getLuaPath()..".commands.commands") -local auth = require (wolfa_getLuaPath()..".auth.auth") -local balancer = require (wolfa_getLuaPath()..".admin.balancer") +local commands = wolfa_requireModule("commands.commands") +local auth = wolfa_requireModule("auth.auth") +local balancer = wolfa_requireModule("admin.balancer") function commandBalance(clientId, command, action) if action == "enable" then diff --git a/luascripts/wolfadmin/commands/admin/ban.lua b/luascripts/wolfadmin/commands/admin/ban.lua index 968fb08..7d05e08 100644 --- a/luascripts/wolfadmin/commands/admin/ban.lua +++ b/luascripts/wolfadmin/commands/admin/ban.lua @@ -15,15 +15,15 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local bans = require (wolfa_getLuaPath()..".admin.bans") -local history = require (wolfa_getLuaPath()..".admin.history") +local bans = wolfa_requireModule("admin.bans") +local history = wolfa_requireModule("admin.history") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local util = require (wolfa_getLuaPath()..".util.util") -local settings = require (wolfa_getLuaPath()..".util.settings") +local util = wolfa_requireModule("util.util") +local settings = wolfa_requireModule("util.settings") function commandBan(clientId, command, victim, ...) local cmdClient diff --git a/luascripts/wolfadmin/commands/admin/cointoss.lua b/luascripts/wolfadmin/commands/admin/cointoss.lua index bb60f4e..55d3872 100644 --- a/luascripts/wolfadmin/commands/admin/cointoss.lua +++ b/luascripts/wolfadmin/commands/admin/cointoss.lua @@ -15,11 +15,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") function commandCoinToss(clientId, command) math.randomseed(os.time()) diff --git a/luascripts/wolfadmin/commands/admin/enablevote.lua b/luascripts/wolfadmin/commands/admin/enablevote.lua index 4273131..7e424af 100644 --- a/luascripts/wolfadmin/commands/admin/enablevote.lua +++ b/luascripts/wolfadmin/commands/admin/enablevote.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local commands = require (wolfa_getLuaPath()..".commands.commands") -local auth = require (wolfa_getLuaPath()..".auth.auth") -local voting = require (wolfa_getLuaPath()..".game.voting") +local commands = wolfa_requireModule("commands.commands") +local auth = wolfa_requireModule("auth.auth") +local voting = wolfa_requireModule("game.voting") function commandEnableVote(clientId, command) et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^denablevote: ^9next map voting has been enabled.\";") diff --git a/luascripts/wolfadmin/commands/admin/finger.lua b/luascripts/wolfadmin/commands/admin/finger.lua index cc2f55b..43e1379 100644 --- a/luascripts/wolfadmin/commands/admin/finger.lua +++ b/luascripts/wolfadmin/commands/admin/finger.lua @@ -15,13 +15,13 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local settings = require (wolfa_getLuaPath()..".util.settings") +local settings = wolfa_requireModule("util.settings") function commandFinger(clientId, command, victim) local cmdClient diff --git a/luascripts/wolfadmin/commands/admin/gib.lua b/luascripts/wolfadmin/commands/admin/gib.lua index 81164da..f70e66e 100644 --- a/luascripts/wolfadmin/commands/admin/gib.lua +++ b/luascripts/wolfadmin/commands/admin/gib.lua @@ -15,14 +15,14 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local constants = require (wolfa_getLuaPath()..".util.constants") -local settings = require (wolfa_getLuaPath()..".util.settings") +local constants = wolfa_requireModule("util.constants") +local settings = wolfa_requireModule("util.settings") function commandGib(clientId, command, victim) local cmdClient diff --git a/luascripts/wolfadmin/commands/admin/greeting.lua b/luascripts/wolfadmin/commands/admin/greeting.lua index abbd1b3..4321e76 100644 --- a/luascripts/wolfadmin/commands/admin/greeting.lua +++ b/luascripts/wolfadmin/commands/admin/greeting.lua @@ -15,11 +15,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local greetings = require (wolfa_getLuaPath()..".players.greetings") +local greetings = wolfa_requireModule("players.greetings") function commandGreeting(clientId, command) local greeting = greetings.get(clientId) diff --git a/luascripts/wolfadmin/commands/admin/help.lua b/luascripts/wolfadmin/commands/admin/help.lua index 87838fa..ac3d836 100644 --- a/luascripts/wolfadmin/commands/admin/help.lua +++ b/luascripts/wolfadmin/commands/admin/help.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") -local settings = require (wolfa_getLuaPath()..".util.settings") +local auth = wolfa_requireModule("auth.auth") +local commands = wolfa_requireModule("commands.commands") +local settings = wolfa_requireModule("util.settings") function commandHelp(clientId, command, cmd) local cmds = commands.getadmin() diff --git a/luascripts/wolfadmin/commands/admin/incognito.lua b/luascripts/wolfadmin/commands/admin/incognito.lua index b2ec615..9714016 100644 --- a/luascripts/wolfadmin/commands/admin/incognito.lua +++ b/luascripts/wolfadmin/commands/admin/incognito.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") function commandIncognito(clientId, command) local isIncognito = auth.isPlayerAllowed(clientId, auth.PERM_INCOGNITO, true) diff --git a/luascripts/wolfadmin/commands/admin/kick.lua b/luascripts/wolfadmin/commands/admin/kick.lua index 79a5c27..c92a37b 100644 --- a/luascripts/wolfadmin/commands/admin/kick.lua +++ b/luascripts/wolfadmin/commands/admin/kick.lua @@ -15,14 +15,14 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local admin = require (wolfa_getLuaPath()..".admin.admin") -local history = require (wolfa_getLuaPath()..".admin.history") +local admin = wolfa_requireModule("admin.admin") +local history = wolfa_requireModule("admin.history") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local settings = require (wolfa_getLuaPath()..".util.settings") +local settings = wolfa_requireModule("util.settings") function commandKick(clientId, command, victim, ...) local cmdClient diff --git a/luascripts/wolfadmin/commands/admin/kickbots.lua b/luascripts/wolfadmin/commands/admin/kickbots.lua index 9e47633..6e15198 100644 --- a/luascripts/wolfadmin/commands/admin/kickbots.lua +++ b/luascripts/wolfadmin/commands/admin/kickbots.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") -local bots = require (wolfa_getLuaPath()..".game.bots") +local auth = wolfa_requireModule("auth.auth") +local commands = wolfa_requireModule("commands.commands") +local bots = wolfa_requireModule("game.bots") function commandBotsOff(clientId, command) bots.enable(false) diff --git a/luascripts/wolfadmin/commands/admin/listaliases.lua b/luascripts/wolfadmin/commands/admin/listaliases.lua index 16cd732..e2bde88 100644 --- a/luascripts/wolfadmin/commands/admin/listaliases.lua +++ b/luascripts/wolfadmin/commands/admin/listaliases.lua @@ -15,16 +15,16 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local pagination = require (wolfa_getLuaPath()..".util.pagination") -local util = require (wolfa_getLuaPath()..".util.util") +local pagination = wolfa_requireModule("util.pagination") +local util = wolfa_requireModule("util.util") function commandListAliases(clientId, command, victim, offset) local cmdClient diff --git a/luascripts/wolfadmin/commands/admin/listmaps.lua b/luascripts/wolfadmin/commands/admin/listmaps.lua index f810398..34b905c 100644 --- a/luascripts/wolfadmin/commands/admin/listmaps.lua +++ b/luascripts/wolfadmin/commands/admin/listmaps.lua @@ -15,11 +15,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local game = require (wolfa_getLuaPath()..".game.game") +local game = wolfa_requireModule("game.game") function commandListMaps(clientId, command) local maps = game.getMaps() diff --git a/luascripts/wolfadmin/commands/admin/listplayers.lua b/luascripts/wolfadmin/commands/admin/listplayers.lua index 58c5886..d0c659c 100644 --- a/luascripts/wolfadmin/commands/admin/listplayers.lua +++ b/luascripts/wolfadmin/commands/admin/listplayers.lua @@ -15,16 +15,16 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local fireteams = require (wolfa_getLuaPath()..".game.fireteams") +local fireteams = wolfa_requireModule("game.fireteams") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local settings = require (wolfa_getLuaPath()..".util.settings") -local util = require (wolfa_getLuaPath()..".util.util") +local settings = wolfa_requireModule("util.settings") +local util = wolfa_requireModule("util.util") function commandListPlayers(clientId, command) local playersOnline = {} diff --git a/luascripts/wolfadmin/commands/admin/lock.lua b/luascripts/wolfadmin/commands/admin/lock.lua index 7d53410..9bab0cc 100644 --- a/luascripts/wolfadmin/commands/admin/lock.lua +++ b/luascripts/wolfadmin/commands/admin/lock.lua @@ -15,15 +15,15 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local teams = require (wolfa_getLuaPath()..".game.teams") +local teams = wolfa_requireModule("game.teams") -local util = require (wolfa_getLuaPath()..".util.util") -local constants = require (wolfa_getLuaPath()..".util.constants") -local settings = require (wolfa_getLuaPath()..".util.settings") +local util = wolfa_requireModule("util.util") +local constants = wolfa_requireModule("util.constants") +local settings = wolfa_requireModule("util.settings") function commandLock(clientId, command, team) if team == nil or (team ~= constants.TEAM_AXIS_SC and team ~= constants.TEAM_ALLIES_SC and team ~= constants.TEAM_SPECTATORS_SC and team ~= "all") then diff --git a/luascripts/wolfadmin/commands/admin/mute.lua b/luascripts/wolfadmin/commands/admin/mute.lua index 3b67fc7..e2ffcd8 100644 --- a/luascripts/wolfadmin/commands/admin/mute.lua +++ b/luascripts/wolfadmin/commands/admin/mute.lua @@ -15,17 +15,17 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local history = require (wolfa_getLuaPath()..".admin.history") -local mutes = require (wolfa_getLuaPath()..".admin.mutes") +local history = wolfa_requireModule("admin.history") +local mutes = wolfa_requireModule("admin.mutes") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local util = require (wolfa_getLuaPath()..".util.util") -local settings = require (wolfa_getLuaPath()..".util.settings") +local util = wolfa_requireModule("util.util") +local settings = wolfa_requireModule("util.settings") function commandMute(clientId, command, victim, ...) local cmdClient diff --git a/luascripts/wolfadmin/commands/admin/needbots.lua b/luascripts/wolfadmin/commands/admin/needbots.lua index 3055e4f..93fd414 100644 --- a/luascripts/wolfadmin/commands/admin/needbots.lua +++ b/luascripts/wolfadmin/commands/admin/needbots.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") -local bots = require (wolfa_getLuaPath()..".game.bots") +local auth = wolfa_requireModule("auth.auth") +local commands = wolfa_requireModule("commands.commands") +local bots = wolfa_requireModule("game.bots") function commandBotsOn(clientId, command) bots.enable(true) diff --git a/luascripts/wolfadmin/commands/admin/nextmap.lua b/luascripts/wolfadmin/commands/admin/nextmap.lua index 57c5eb8..123de3f 100644 --- a/luascripts/wolfadmin/commands/admin/nextmap.lua +++ b/luascripts/wolfadmin/commands/admin/nextmap.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") -local settings = require (wolfa_getLuaPath()..".util.settings") +local auth = wolfa_requireModule("auth.auth") +local commands = wolfa_requireModule("commands.commands") +local settings = wolfa_requireModule("util.settings") function commandNextMap(clientId, command) et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dnextmap: ^9next map was loaded.\";") diff --git a/luascripts/wolfadmin/commands/admin/pause.lua b/luascripts/wolfadmin/commands/admin/pause.lua index 80d72c4..9d1ef20 100644 --- a/luascripts/wolfadmin/commands/admin/pause.lua +++ b/luascripts/wolfadmin/commands/admin/pause.lua @@ -15,11 +15,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local settings = require (wolfa_getLuaPath()..".util.settings") +local settings = wolfa_requireModule("util.settings") function commandPause(clientId, command) et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dpause: ^9map paused.\";") diff --git a/luascripts/wolfadmin/commands/admin/plock.lua b/luascripts/wolfadmin/commands/admin/plock.lua index b4d5daa..44e683f 100644 --- a/luascripts/wolfadmin/commands/admin/plock.lua +++ b/luascripts/wolfadmin/commands/admin/plock.lua @@ -15,11 +15,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") function commandPlayerLock(clientId, command, victim) local cmdClient diff --git a/luascripts/wolfadmin/commands/admin/punlock.lua b/luascripts/wolfadmin/commands/admin/punlock.lua index 618cd88..1444776 100644 --- a/luascripts/wolfadmin/commands/admin/punlock.lua +++ b/luascripts/wolfadmin/commands/admin/punlock.lua @@ -15,11 +15,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") function commandPlayerUnlock(clientId, command, victim) local cmdClient diff --git a/luascripts/wolfadmin/commands/admin/put.lua b/luascripts/wolfadmin/commands/admin/put.lua index b3f3ec5..3002a3e 100644 --- a/luascripts/wolfadmin/commands/admin/put.lua +++ b/luascripts/wolfadmin/commands/admin/put.lua @@ -15,15 +15,15 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local admin = require (wolfa_getLuaPath()..".admin.admin") +local admin = wolfa_requireModule("admin.admin") -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local util = require (wolfa_getLuaPath()..".util.util") -local constants = require (wolfa_getLuaPath()..".util.constants") -local settings = require (wolfa_getLuaPath()..".util.settings") +local util = wolfa_requireModule("util.util") +local constants = wolfa_requireModule("util.constants") +local settings = wolfa_requireModule("util.settings") function commandPlayerLock(clientId, command, victim, team) local cmdClient diff --git a/luascripts/wolfadmin/commands/admin/putbots.lua b/luascripts/wolfadmin/commands/admin/putbots.lua index 95e1b8a..b17a048 100644 --- a/luascripts/wolfadmin/commands/admin/putbots.lua +++ b/luascripts/wolfadmin/commands/admin/putbots.lua @@ -15,12 +15,12 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") -local constants = require (wolfa_getLuaPath()..".util.constants") -local util = require (wolfa_getLuaPath()..".util.util") -local balancer = require (wolfa_getLuaPath()..".admin.balancer") -local commands = require (wolfa_getLuaPath()..".commands.commands") -local bots = require (wolfa_getLuaPath()..".game.bots") +local auth = wolfa_requireModule("auth.auth") +local constants = wolfa_requireModule("util.constants") +local util = wolfa_requireModule("util.util") +local balancer = wolfa_requireModule("admin.balancer") +local commands = wolfa_requireModule("commands.commands") +local bots = wolfa_requireModule("game.bots") function commandPutBots(clientId, command, team) if team == nil and team ~= constants.TEAM_AXIS_SC and team ~= constants.TEAM_ALLIES_SC and team ~= constants.TEAM_SPECTATORS_SC then diff --git a/luascripts/wolfadmin/commands/admin/readconfig.lua b/luascripts/wolfadmin/commands/admin/readconfig.lua index bae4848..a144900 100644 --- a/luascripts/wolfadmin/commands/admin/readconfig.lua +++ b/luascripts/wolfadmin/commands/admin/readconfig.lua @@ -15,17 +15,17 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local rules = require (wolfa_getLuaPath()..".admin.rules") +local rules = wolfa_requireModule("admin.rules") -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local sprees = require (wolfa_getLuaPath()..".game.sprees") +local sprees = wolfa_requireModule("game.sprees") -local greetings = require (wolfa_getLuaPath()..".players.greetings") +local greetings = wolfa_requireModule("players.greetings") -local settings = require (wolfa_getLuaPath()..".util.settings") +local settings = wolfa_requireModule("util.settings") function commandReadconfig(clientId, command) settings.load() diff --git a/luascripts/wolfadmin/commands/admin/reset.lua b/luascripts/wolfadmin/commands/admin/reset.lua index dfda995..ab3b908 100644 --- a/luascripts/wolfadmin/commands/admin/reset.lua +++ b/luascripts/wolfadmin/commands/admin/reset.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") -local settings = require (wolfa_getLuaPath()..".util.settings") +local auth = wolfa_requireModule("auth.auth") +local commands = wolfa_requireModule("commands.commands") +local settings = wolfa_requireModule("util.settings") function commandReset(clientId, command) et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dreset: ^9match reset.\";") diff --git a/luascripts/wolfadmin/commands/admin/resetsprees.lua b/luascripts/wolfadmin/commands/admin/resetsprees.lua index edcab1f..7dc2192 100644 --- a/luascripts/wolfadmin/commands/admin/resetsprees.lua +++ b/luascripts/wolfadmin/commands/admin/resetsprees.lua @@ -15,16 +15,16 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local game = require (wolfa_getLuaPath()..".game.game") -local sprees = require (wolfa_getLuaPath()..".game.sprees") +local game = wolfa_requireModule("game.game") +local sprees = wolfa_requireModule("game.sprees") -local settings = require (wolfa_getLuaPath()..".util.settings") +local settings = wolfa_requireModule("util.settings") function commandResetSprees(clientId, command, map) if not db.isConnected() then diff --git a/luascripts/wolfadmin/commands/admin/restart.lua b/luascripts/wolfadmin/commands/admin/restart.lua index 8315530..394ec43 100644 --- a/luascripts/wolfadmin/commands/admin/restart.lua +++ b/luascripts/wolfadmin/commands/admin/restart.lua @@ -15,10 +15,10 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") -local game = require (wolfa_getLuaPath()..".game.game") -local settings = require (wolfa_getLuaPath()..".util.settings") +local auth = wolfa_requireModule("auth.auth") +local commands = wolfa_requireModule("commands.commands") +local game = wolfa_requireModule("game.game") +local settings = wolfa_requireModule("util.settings") function commandRestart(clientId, command) et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^drestart: ^9map restarted.\";") diff --git a/luascripts/wolfadmin/commands/admin/rules.lua b/luascripts/wolfadmin/commands/admin/rules.lua index a04b361..66fe807 100644 --- a/luascripts/wolfadmin/commands/admin/rules.lua +++ b/luascripts/wolfadmin/commands/admin/rules.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") -local rules = require (wolfa_getLuaPath()..".admin.rules") +local auth = wolfa_requireModule("auth.auth") +local commands = wolfa_requireModule("commands.commands") +local rules = wolfa_requireModule("admin.rules") function commandRules(clientId, command, rule) if not rule then diff --git a/luascripts/wolfadmin/commands/admin/setlevel.lua b/luascripts/wolfadmin/commands/admin/setlevel.lua index 71bf524..04b21de 100644 --- a/luascripts/wolfadmin/commands/admin/setlevel.lua +++ b/luascripts/wolfadmin/commands/admin/setlevel.lua @@ -15,16 +15,16 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local admin = require (wolfa_getLuaPath()..".admin.admin") -local history = require (wolfa_getLuaPath()..".admin.history") +local admin = wolfa_requireModule("admin.admin") +local history = wolfa_requireModule("admin.history") -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local settings = require (wolfa_getLuaPath()..".util.settings") +local settings = wolfa_requireModule("util.settings") function commandSetLevel(clientId, command, victim, level) local cmdClient diff --git a/luascripts/wolfadmin/commands/admin/showbans.lua b/luascripts/wolfadmin/commands/admin/showbans.lua index 96b8dbd..29b7d8e 100644 --- a/luascripts/wolfadmin/commands/admin/showbans.lua +++ b/luascripts/wolfadmin/commands/admin/showbans.lua @@ -15,17 +15,17 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local bans = require (wolfa_getLuaPath()..".admin.bans") +local bans = wolfa_requireModule("admin.bans") -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local pagination = require (wolfa_getLuaPath()..".util.pagination") -local settings = require (wolfa_getLuaPath()..".util.settings") -local util = require (wolfa_getLuaPath()..".util.util") +local pagination = wolfa_requireModule("util.pagination") +local settings = wolfa_requireModule("util.settings") +local util = wolfa_requireModule("util.util") function commandShowBans(clientId, offset) if not db.isConnected() then diff --git a/luascripts/wolfadmin/commands/admin/showhistory.lua b/luascripts/wolfadmin/commands/admin/showhistory.lua index 93b3b33..567d020 100644 --- a/luascripts/wolfadmin/commands/admin/showhistory.lua +++ b/luascripts/wolfadmin/commands/admin/showhistory.lua @@ -15,17 +15,17 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local history = require (wolfa_getLuaPath()..".admin.history") +local history = wolfa_requireModule("admin.history") -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local util = require (wolfa_getLuaPath()..".util.util") -local pagination = require (wolfa_getLuaPath()..".util.pagination") -local settings = require (wolfa_getLuaPath()..".util.settings") +local util = wolfa_requireModule("util.util") +local pagination = wolfa_requireModule("util.pagination") +local settings = wolfa_requireModule("util.settings") function commandListHistory(clientId, command, victim, offset) local cmdClient diff --git a/luascripts/wolfadmin/commands/admin/shuffle.lua b/luascripts/wolfadmin/commands/admin/shuffle.lua index c8fca1f..0bc7f23 100644 --- a/luascripts/wolfadmin/commands/admin/shuffle.lua +++ b/luascripts/wolfadmin/commands/admin/shuffle.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") -local settings = require (wolfa_getLuaPath()..".util.settings") +local auth = wolfa_requireModule("auth.auth") +local commands = wolfa_requireModule("commands.commands") +local settings = wolfa_requireModule("util.settings") function commandShuffle(clientId, command) et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dshuffle: ^9teams were shuffled by XP.\";") diff --git a/luascripts/wolfadmin/commands/admin/shufflesr.lua b/luascripts/wolfadmin/commands/admin/shufflesr.lua index a3fef0b..a353c32 100644 --- a/luascripts/wolfadmin/commands/admin/shufflesr.lua +++ b/luascripts/wolfadmin/commands/admin/shufflesr.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") -local settings = require (wolfa_getLuaPath()..".util.settings") +local auth = wolfa_requireModule("auth.auth") +local commands = wolfa_requireModule("commands.commands") +local settings = wolfa_requireModule("util.settings") function commandShuffleSR(clientId, command) et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dshuffle: ^9teams were shuffled by Skill Rating.\";") diff --git a/luascripts/wolfadmin/commands/admin/slap.lua b/luascripts/wolfadmin/commands/admin/slap.lua index fd39229..1d8d109 100644 --- a/luascripts/wolfadmin/commands/admin/slap.lua +++ b/luascripts/wolfadmin/commands/admin/slap.lua @@ -15,14 +15,14 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local constants = require (wolfa_getLuaPath()..".util.constants") -local settings = require (wolfa_getLuaPath()..".util.settings") +local constants = wolfa_requireModule("util.constants") +local settings = wolfa_requireModule("util.settings") function commandSlap(clientId, command, victim) local cmdClient diff --git a/luascripts/wolfadmin/commands/admin/spec999.lua b/luascripts/wolfadmin/commands/admin/spec999.lua index 326733f..d846c65 100644 --- a/luascripts/wolfadmin/commands/admin/spec999.lua +++ b/luascripts/wolfadmin/commands/admin/spec999.lua @@ -15,16 +15,16 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local admin = require (wolfa_getLuaPath()..".admin.admin") +local admin = wolfa_requireModule("admin.admin") -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local constants = require (wolfa_getLuaPath()..".util.constants") -local settings = require (wolfa_getLuaPath()..".util.settings") +local constants = wolfa_requireModule("util.constants") +local settings = wolfa_requireModule("util.settings") function commandSpec999(clientId, command) local count = 0 diff --git a/luascripts/wolfadmin/commands/admin/sprees.lua b/luascripts/wolfadmin/commands/admin/sprees.lua index 1853c97..70c1e0c 100644 --- a/luascripts/wolfadmin/commands/admin/sprees.lua +++ b/luascripts/wolfadmin/commands/admin/sprees.lua @@ -15,13 +15,13 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local sprees = require (wolfa_getLuaPath()..".game.sprees") +local sprees = wolfa_requireModule("game.sprees") function commandShowSprees(clientId, command) if not db.isConnected() then diff --git a/luascripts/wolfadmin/commands/admin/stats.lua b/luascripts/wolfadmin/commands/admin/stats.lua index 8b57d80..0b451de 100644 --- a/luascripts/wolfadmin/commands/admin/stats.lua +++ b/luascripts/wolfadmin/commands/admin/stats.lua @@ -15,11 +15,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local util = require (wolfa_getLuaPath()..".util.util") +local util = wolfa_requireModule("util.util") function commandShowStats(clientId, command, victim) local cmdClient diff --git a/luascripts/wolfadmin/commands/admin/swap.lua b/luascripts/wolfadmin/commands/admin/swap.lua index cc2a994..edad683 100644 --- a/luascripts/wolfadmin/commands/admin/swap.lua +++ b/luascripts/wolfadmin/commands/admin/swap.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") -local settings = require (wolfa_getLuaPath()..".util.settings") +local auth = wolfa_requireModule("auth.auth") +local commands = wolfa_requireModule("commands.commands") +local settings = wolfa_requireModule("util.settings") function commandSwap(clientId, command) et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dswap: ^9teams swapped.\";") diff --git a/luascripts/wolfadmin/commands/admin/time.lua b/luascripts/wolfadmin/commands/admin/time.lua index fe41909..a9b816d 100644 --- a/luascripts/wolfadmin/commands/admin/time.lua +++ b/luascripts/wolfadmin/commands/admin/time.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") -local settings = require (wolfa_getLuaPath()..".util.settings") +local auth = wolfa_requireModule("auth.auth") +local commands = wolfa_requireModule("commands.commands") +local settings = wolfa_requireModule("util.settings") function commandTime(clientId, command) et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dtime: ^9current time is ^7"..os.date("%H:%M:%S").."^9.\";") diff --git a/luascripts/wolfadmin/commands/admin/unban.lua b/luascripts/wolfadmin/commands/admin/unban.lua index 1cb0668..277e614 100644 --- a/luascripts/wolfadmin/commands/admin/unban.lua +++ b/luascripts/wolfadmin/commands/admin/unban.lua @@ -15,15 +15,15 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local bans = require (wolfa_getLuaPath()..".admin.bans") +local bans = wolfa_requireModule("admin.bans") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local settings = require (wolfa_getLuaPath()..".util.settings") +local settings = wolfa_requireModule("util.settings") function commandRemoveBan(clientId, command, banId) if settings.get("g_standalone") == 0 or not db.isConnected() then diff --git a/luascripts/wolfadmin/commands/admin/unlock.lua b/luascripts/wolfadmin/commands/admin/unlock.lua index 4ac9b45..0307baa 100644 --- a/luascripts/wolfadmin/commands/admin/unlock.lua +++ b/luascripts/wolfadmin/commands/admin/unlock.lua @@ -15,15 +15,15 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local teams = require (wolfa_getLuaPath()..".game.teams") +local teams = wolfa_requireModule("game.teams") -local util = require (wolfa_getLuaPath()..".util.util") -local constants = require (wolfa_getLuaPath()..".util.constants") -local settings = require (wolfa_getLuaPath()..".util.settings") +local util = wolfa_requireModule("util.util") +local constants = wolfa_requireModule("util.constants") +local settings = wolfa_requireModule("util.settings") function commandUnlock(clientId, command, team) if team == nil or (team ~= constants.TEAM_AXIS_SC and team ~= constants.TEAM_ALLIES_SC and team ~= constants.TEAM_SPECTATORS_SC and team ~= "all") then diff --git a/luascripts/wolfadmin/commands/admin/unmute.lua b/luascripts/wolfadmin/commands/admin/unmute.lua index 33c1d19..cbb385b 100644 --- a/luascripts/wolfadmin/commands/admin/unmute.lua +++ b/luascripts/wolfadmin/commands/admin/unmute.lua @@ -15,15 +15,15 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local mutes = require (wolfa_getLuaPath()..".admin.mutes") +local mutes = wolfa_requireModule("admin.mutes") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local settings = require (wolfa_getLuaPath()..".util.settings") +local settings = wolfa_requireModule("util.settings") function commandUnmute(clientId, command, victim) local cmdClient diff --git a/luascripts/wolfadmin/commands/admin/unpause.lua b/luascripts/wolfadmin/commands/admin/unpause.lua index 0088cdf..3b9aa8f 100644 --- a/luascripts/wolfadmin/commands/admin/unpause.lua +++ b/luascripts/wolfadmin/commands/admin/unpause.lua @@ -15,11 +15,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local settings = require (wolfa_getLuaPath()..".util.settings") +local settings = wolfa_requireModule("util.settings") function commandUnpause(clientId, command) et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dpause: ^9map unpaused.\";") diff --git a/luascripts/wolfadmin/commands/admin/vmute.lua b/luascripts/wolfadmin/commands/admin/vmute.lua index 19af9ea..9948eac 100644 --- a/luascripts/wolfadmin/commands/admin/vmute.lua +++ b/luascripts/wolfadmin/commands/admin/vmute.lua @@ -15,16 +15,16 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local history = require (wolfa_getLuaPath()..".admin.history") -local mutes = require (wolfa_getLuaPath()..".admin.mutes") +local history = wolfa_requireModule("admin.history") +local mutes = wolfa_requireModule("admin.mutes") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local util = require (wolfa_getLuaPath()..".util.util") +local util = wolfa_requireModule("util.util") function commandVoiceMute(clientId, command, victim, ...) local cmdClient diff --git a/luascripts/wolfadmin/commands/admin/vunmute.lua b/luascripts/wolfadmin/commands/admin/vunmute.lua index b4f7340..26ca2a4 100644 --- a/luascripts/wolfadmin/commands/admin/vunmute.lua +++ b/luascripts/wolfadmin/commands/admin/vunmute.lua @@ -15,11 +15,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") function commandVoiceUnmute(clientId, command, victim) local cmdClient diff --git a/luascripts/wolfadmin/commands/admin/warn.lua b/luascripts/wolfadmin/commands/admin/warn.lua index 84f4c8d..81dc98f 100644 --- a/luascripts/wolfadmin/commands/admin/warn.lua +++ b/luascripts/wolfadmin/commands/admin/warn.lua @@ -15,17 +15,17 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local history = require (wolfa_getLuaPath()..".admin.history") +local history = wolfa_requireModule("admin.history") -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local settings = require (wolfa_getLuaPath()..".util.settings") +local settings = wolfa_requireModule("util.settings") function commandWarn(clientId, command, victim, ...) local cmdClient diff --git a/luascripts/wolfadmin/commands/client/ac.lua b/luascripts/wolfadmin/commands/client/ac.lua index 1e34036..9960d43 100644 --- a/luascripts/wolfadmin/commands/client/ac.lua +++ b/luascripts/wolfadmin/commands/client/ac.lua @@ -15,11 +15,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") function commandAdminChat(clientId, command, ...) if not ... then diff --git a/luascripts/wolfadmin/commands/client/callvote.lua b/luascripts/wolfadmin/commands/client/callvote.lua index 78adf32..08d3a10 100644 --- a/luascripts/wolfadmin/commands/client/callvote.lua +++ b/luascripts/wolfadmin/commands/client/callvote.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local events = require (wolfa_getLuaPath()..".util.events") +local events = wolfa_requireModule("util.events") function commandCallVote(clientId, command) local voteArguments = {} diff --git a/luascripts/wolfadmin/commands/client/pm.lua b/luascripts/wolfadmin/commands/client/pm.lua index f9da58d..8d73e31 100644 --- a/luascripts/wolfadmin/commands/client/pm.lua +++ b/luascripts/wolfadmin/commands/client/pm.lua @@ -15,13 +15,13 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local logs = require (wolfa_getLuaPath()..".util.logs") -local settings = require (wolfa_getLuaPath()..".util.settings") -local util = require (wolfa_getLuaPath()..".util.util") +local logs = wolfa_requireModule("util.logs") +local settings = wolfa_requireModule("util.settings") +local util = wolfa_requireModule("util.util") function commandPersonalMessage(clientId, command, recipient, ...) if recipient and ... then diff --git a/luascripts/wolfadmin/commands/client/r.lua b/luascripts/wolfadmin/commands/client/r.lua index e30293b..0096e69 100644 --- a/luascripts/wolfadmin/commands/client/r.lua +++ b/luascripts/wolfadmin/commands/client/r.lua @@ -15,10 +15,10 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local logs = require (wolfa_getLuaPath()..".util.logs") -local players = require (wolfa_getLuaPath()..".players.players") +local logs = wolfa_requireModule("util.logs") +local players = wolfa_requireModule("players.players") function commandR(clientId, command, ...) if not ... then diff --git a/luascripts/wolfadmin/commands/client/say.lua b/luascripts/wolfadmin/commands/client/say.lua index cf84289..38342bf 100644 --- a/luascripts/wolfadmin/commands/client/say.lua +++ b/luascripts/wolfadmin/commands/client/say.lua @@ -15,12 +15,12 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local logs = require (wolfa_getLuaPath()..".util.logs") -local settings = require (wolfa_getLuaPath()..".util.settings") +local logs = wolfa_requireModule("util.logs") +local settings = wolfa_requireModule("util.settings") local types = { ["say"] = "chat", diff --git a/luascripts/wolfadmin/commands/client/team.lua b/luascripts/wolfadmin/commands/client/team.lua index cb75a98..976bd20 100644 --- a/luascripts/wolfadmin/commands/client/team.lua +++ b/luascripts/wolfadmin/commands/client/team.lua @@ -15,14 +15,14 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local teams = require (wolfa_getLuaPath()..".game.teams") +local teams = wolfa_requireModule("game.teams") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local util = require (wolfa_getLuaPath()..".util.util") -local settings = require (wolfa_getLuaPath()..".util.settings") +local util = wolfa_requireModule("util.util") +local settings = wolfa_requireModule("util.settings") function commandTeam(clientId, command) if players.isTeamLocked(clientId) then diff --git a/luascripts/wolfadmin/commands/client/wolfadmin.lua b/luascripts/wolfadmin/commands/client/wolfadmin.lua index 316f2b8..6cdf454 100644 --- a/luascripts/wolfadmin/commands/client/wolfadmin.lua +++ b/luascripts/wolfadmin/commands/client/wolfadmin.lua @@ -15,7 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") function commandWolfAdmin(clientId, command) et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^3This server is running ^7Wolf^1Admin ^7"..wolfa_getVersion().." ^3("..wolfa_getRelease().."^3)\";") diff --git a/luascripts/wolfadmin/commands/commands.lua b/luascripts/wolfadmin/commands/commands.lua index 69f764b..5e469d5 100644 --- a/luascripts/wolfadmin/commands/commands.lua +++ b/luascripts/wolfadmin/commands/commands.lua @@ -15,13 +15,13 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local util = require (wolfa_getLuaPath()..".util.util") -local events = require (wolfa_getLuaPath()..".util.events") -local files = require (wolfa_getLuaPath()..".util.files") -local logs = require (wolfa_getLuaPath()..".util.logs") -local tables = require (wolfa_getLuaPath()..".util.tables") +local util = wolfa_requireModule("util.util") +local events = wolfa_requireModule("util.events") +local files = wolfa_requireModule("util.files") +local logs = wolfa_requireModule("util.logs") +local tables = wolfa_requireModule("util.tables") local commands = {} @@ -96,7 +96,7 @@ function commands.loadFiles(dir) for _, file in pairs(files) do if string.match(string.lower(file), "^[a-z0-9]+%.lua$") then - require (wolfa_getLuaPath()..".commands."..dir.."."..string.sub(file, 1, string.len(file) - 4)) + wolfa_requireModule("commands."..dir.."."..string.sub(file, 1, string.len(file) - 4)) amount = amount + 1 end diff --git a/luascripts/wolfadmin/commands/server/acl.lua b/luascripts/wolfadmin/commands/server/acl.lua index 8a5e808..e01ff50 100644 --- a/luascripts/wolfadmin/commands/server/acl.lua +++ b/luascripts/wolfadmin/commands/server/acl.lua @@ -15,13 +15,13 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local acl = require (wolfa_getLuaPath()..".auth.acl") +local acl = wolfa_requireModule("auth.acl") -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local settings = require (wolfa_getLuaPath()..".util.settings") +local settings = wolfa_requireModule("util.settings") function commandAclListLevels() for _, level in ipairs(acl.getLevels()) do diff --git a/luascripts/wolfadmin/commands/server/cannounce.lua b/luascripts/wolfadmin/commands/server/cannounce.lua index 1e024e4..6d60a5e 100644 --- a/luascripts/wolfadmin/commands/server/cannounce.lua +++ b/luascripts/wolfadmin/commands/server/cannounce.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local util = require (wolfa_getLuaPath()..".util.util") +local util = wolfa_requireModule("util.util") function commandClientAnnounce(command, clientId, text) local clientId = tonumber(clientId) diff --git a/luascripts/wolfadmin/commands/server/cchat.lua b/luascripts/wolfadmin/commands/server/cchat.lua index 20ef61b..793086a 100644 --- a/luascripts/wolfadmin/commands/server/cchat.lua +++ b/luascripts/wolfadmin/commands/server/cchat.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local util = require (wolfa_getLuaPath()..".util.util") +local util = wolfa_requireModule("util.util") function commandClientChatPrint(command, clientId, text) local clientId = tonumber(clientId) diff --git a/luascripts/wolfadmin/commands/server/ccp.lua b/luascripts/wolfadmin/commands/server/ccp.lua index 80b8f31..8b2714a 100644 --- a/luascripts/wolfadmin/commands/server/ccp.lua +++ b/luascripts/wolfadmin/commands/server/ccp.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local util = require (wolfa_getLuaPath()..".util.util") +local util = wolfa_requireModule("util.util") function commandClientCenterPrint(command, clientId, text) local clientId = tonumber(clientId) diff --git a/luascripts/wolfadmin/commands/server/ccpm.lua b/luascripts/wolfadmin/commands/server/ccpm.lua index 23c1291..88b2a7c 100644 --- a/luascripts/wolfadmin/commands/server/ccpm.lua +++ b/luascripts/wolfadmin/commands/server/ccpm.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local util = require (wolfa_getLuaPath()..".util.util") +local util = wolfa_requireModule("util.util") function commandClientCPM(command, clientId, text) local clientId = tonumber(clientId) diff --git a/luascripts/wolfadmin/commands/server/cmusic.lua b/luascripts/wolfadmin/commands/server/cmusic.lua index cd8879d..7d9e62a 100644 --- a/luascripts/wolfadmin/commands/server/cmusic.lua +++ b/luascripts/wolfadmin/commands/server/cmusic.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local util = require (wolfa_getLuaPath()..".util.util") +local util = wolfa_requireModule("util.util") function commandClientPlayMusic(command, clientId, text) local clientId = tonumber(clientId) diff --git a/luascripts/wolfadmin/commands/server/csay.lua b/luascripts/wolfadmin/commands/server/csay.lua index edb4737..3223d71 100644 --- a/luascripts/wolfadmin/commands/server/csay.lua +++ b/luascripts/wolfadmin/commands/server/csay.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local commands = require (wolfa_getLuaPath()..".commands.commands") +local commands = wolfa_requireModule("commands.commands") -local util = require (wolfa_getLuaPath()..".util.util") +local util = wolfa_requireModule("util.util") function commandClientConsolePrint(command, clientId, text) local clientId = tonumber(clientId) diff --git a/luascripts/wolfadmin/db/db.lua b/luascripts/wolfadmin/db/db.lua index ac41465..a92ebe5 100644 --- a/luascripts/wolfadmin/db/db.lua +++ b/luascripts/wolfadmin/db/db.lua @@ -15,8 +15,8 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local events = require (wolfa_getLuaPath()..".util.events") -local settings = require (wolfa_getLuaPath()..".util.settings") +local events = wolfa_requireModule("util.events") +local settings = wolfa_requireModule("util.settings") local db = {} @@ -32,9 +32,9 @@ end function db.oninit() if settings.get("db_type") ~= "none" then if settings.get("db_type") == "sqlite3" then - con = require (wolfa_getLuaPath()..".db.sqlite3") + con = wolfa_requireModule("db.sqlite3") elseif settings.get("db_type") == "mysql" then - con = require (wolfa_getLuaPath()..".db.mysql") + con = wolfa_requireModule("db.mysql") else outputDebug("Invalid database system (none|sqlite3|mysql), defaulting to 'none'.") diff --git a/luascripts/wolfadmin/db/mysql.lua b/luascripts/wolfadmin/db/mysql.lua index 13f7eca..97c123c 100644 --- a/luascripts/wolfadmin/db/mysql.lua +++ b/luascripts/wolfadmin/db/mysql.lua @@ -15,12 +15,12 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local constants = require (wolfa_getLuaPath()..".util.constants") -local util = require (wolfa_getLuaPath()..".util.util") -local settings = require (wolfa_getLuaPath()..".util.settings") -local tables = require (wolfa_getLuaPath()..".util.tables") +local constants = wolfa_requireModule("util.constants") +local util = wolfa_requireModule("util.util") +local settings = wolfa_requireModule("util.settings") +local tables = wolfa_requireModule("util.tables") local luasql = require "luasql.mysql" diff --git a/luascripts/wolfadmin/db/sqlite3.lua b/luascripts/wolfadmin/db/sqlite3.lua index 4b5859a..61db4f0 100644 --- a/luascripts/wolfadmin/db/sqlite3.lua +++ b/luascripts/wolfadmin/db/sqlite3.lua @@ -15,12 +15,12 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local constants = require (wolfa_getLuaPath()..".util.constants") -local util = require (wolfa_getLuaPath()..".util.util") -local settings = require (wolfa_getLuaPath()..".util.settings") -local tables = require (wolfa_getLuaPath()..".util.tables") +local constants = wolfa_requireModule("util.constants") +local util = wolfa_requireModule("util.util") +local settings = wolfa_requireModule("util.settings") +local tables = wolfa_requireModule("util.tables") local luasql = require "luasql.sqlite3" diff --git a/luascripts/wolfadmin/game/bots.lua b/luascripts/wolfadmin/game/bots.lua index 60f30ba..d31f0bb 100644 --- a/luascripts/wolfadmin/game/bots.lua +++ b/luascripts/wolfadmin/game/bots.lua @@ -15,11 +15,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local events = require (wolfa_getLuaPath()..".util.events") -local settings = require (wolfa_getLuaPath()..".util.settings") -local util = require (wolfa_getLuaPath()..".util.util") +local events = wolfa_requireModule("util.events") +local settings = wolfa_requireModule("util.settings") +local util = wolfa_requireModule("util.util") local bots = {} diff --git a/luascripts/wolfadmin/game/fireteams.lua b/luascripts/wolfadmin/game/fireteams.lua index 0a62d8e..e5c13df 100644 --- a/luascripts/wolfadmin/game/fireteams.lua +++ b/luascripts/wolfadmin/game/fireteams.lua @@ -15,7 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local bits = require (wolfa_getLuaPath()..".util.bits") +local bits = wolfa_requireModule("util.bits") local fireteams = {} diff --git a/luascripts/wolfadmin/game/game.lua b/luascripts/wolfadmin/game/game.lua index 16dcacb..92226aa 100644 --- a/luascripts/wolfadmin/game/game.lua +++ b/luascripts/wolfadmin/game/game.lua @@ -15,11 +15,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local events = require (wolfa_getLuaPath()..".util.events") -local settings = require (wolfa_getLuaPath()..".util.settings") -local util = require (wolfa_getLuaPath()..".util.util") +local events = wolfa_requireModule("util.events") +local settings = wolfa_requireModule("util.settings") +local util = wolfa_requireModule("util.util") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") local game = {} diff --git a/luascripts/wolfadmin/game/sprees.lua b/luascripts/wolfadmin/game/sprees.lua index a6d5adc..6f24ab2 100644 --- a/luascripts/wolfadmin/game/sprees.lua +++ b/luascripts/wolfadmin/game/sprees.lua @@ -15,19 +15,19 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local game = require (wolfa_getLuaPath()..".game.game") +local game = wolfa_requireModule("game.game") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local bits = require (wolfa_getLuaPath()..".util.bits") -local constants = require (wolfa_getLuaPath()..".util.constants") -local events = require (wolfa_getLuaPath()..".util.events") -local files = require (wolfa_getLuaPath()..".util.files") -local settings = require (wolfa_getLuaPath()..".util.settings") +local bits = wolfa_requireModule("util.bits") +local constants = wolfa_requireModule("util.constants") +local events = wolfa_requireModule("util.events") +local files = wolfa_requireModule("util.files") +local settings = wolfa_requireModule("util.settings") -local toml = require "toml" +local toml = wolfa_requireLib("toml") local sprees = {} diff --git a/luascripts/wolfadmin/game/teams.lua b/luascripts/wolfadmin/game/teams.lua index 70decad..86e8625 100644 --- a/luascripts/wolfadmin/game/teams.lua +++ b/luascripts/wolfadmin/game/teams.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local constants = require (wolfa_getLuaPath()..".util.constants") -local tables = require (wolfa_getLuaPath()..".util.tables") -local events = require (wolfa_getLuaPath()..".util.events") +local constants = wolfa_requireModule("util.constants") +local tables = wolfa_requireModule("util.tables") +local events = wolfa_requireModule("util.events") local teams = {} diff --git a/luascripts/wolfadmin/game/voting.lua b/luascripts/wolfadmin/game/voting.lua index 657c846..818b3f9 100644 --- a/luascripts/wolfadmin/game/voting.lua +++ b/luascripts/wolfadmin/game/voting.lua @@ -15,13 +15,13 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local constants = require (wolfa_getLuaPath()..".util.constants") -local events = require (wolfa_getLuaPath()..".util.events") -local settings = require (wolfa_getLuaPath()..".util.settings") -local timers = require (wolfa_getLuaPath()..".util.timers") -local util = require (wolfa_getLuaPath()..".util.util") +local constants = wolfa_requireModule("util.constants") +local events = wolfa_requireModule("util.events") +local settings = wolfa_requireModule("util.settings") +local timers = wolfa_requireModule("util.timers") +local util = wolfa_requireModule("util.util") local voting = {} diff --git a/luascripts/wolfadmin/main.lua b/luascripts/wolfadmin/main.lua index ec4dcbe..0ccdaeb 100644 --- a/luascripts/wolfadmin/main.lua +++ b/luascripts/wolfadmin/main.lua @@ -55,7 +55,8 @@ local release = "4 January 2019" local basepath local homepath -local luapath +local lualibspath +local luamodspath -- need to do this somewhere else function wolfa_getVersion() @@ -74,53 +75,70 @@ function wolfa_getHomePath() return homepath end -function wolfa_getLuaPath() - return luapath +function wolfa_getLuaLibsPath() + return lualibspath +end + +function wolfa_getLuaModsPath() + return luamodspath +end + +function wolfa_requireLib(lib) + return require(wolfa_getLuaLibsPath().."/"..string.gsub(lib, "%.", "/")) +end + +function wolfa_requireModule(module) + return require(wolfa_getLuaModsPath().."/"..string.gsub(module, "%.", "/")) end function et_InitGame(levelTime, randomSeed, restartMap) -- set up paths basepath = string.gsub(et.trap_Cvar_Get("fs_basepath"), "\\", "/").."/"..et.trap_Cvar_Get("fs_game").."/" homepath = string.gsub(et.trap_Cvar_Get("fs_homepath"), "\\", "/").."/"..et.trap_Cvar_Get("fs_game").."/" - luapath = string.gsub(debug.getinfo(1).source, "[\\/]", "."):sub(0, -10) + lualibspath = "lualibs" + luamodspath = "luascripts/wolfadmin" + + if debug then + luamodspath = string.sub(debug.getinfo(1).source, 0, -10) + end -- load modules - require (wolfa_getLuaPath()..".util.debug") + wolfa_requireModule("util.debug") - admin = require (wolfa_getLuaPath()..".admin.admin") - balancer = require (wolfa_getLuaPath()..".admin.balancer") - bans = require (wolfa_getLuaPath()..".admin.bans") - history = require (wolfa_getLuaPath()..".admin.history") - mutes = require (wolfa_getLuaPath()..".admin.mutes") - rules = require (wolfa_getLuaPath()..".admin.rules") + admin = wolfa_requireModule("admin.admin") + balancer = wolfa_requireModule("admin.balancer") + bans = wolfa_requireModule("admin.bans") + history = wolfa_requireModule("admin.history") + mutes = wolfa_requireModule("admin.mutes") + rules = wolfa_requireModule("admin.rules") - auth = require (wolfa_getLuaPath()..".auth.auth") + auth = wolfa_requireModule("auth.auth") - db = require (wolfa_getLuaPath()..".db.db") + db = wolfa_requireModule("db.db") - commands = require (wolfa_getLuaPath()..".commands.commands") + commands = wolfa_requireModule("commands.commands") - bots = require (wolfa_getLuaPath()..".game.bots") - game = require (wolfa_getLuaPath()..".game.game") - fireteams = require (wolfa_getLuaPath()..".game.fireteams") - sprees = require (wolfa_getLuaPath()..".game.sprees") - teams = require (wolfa_getLuaPath()..".game.teams") - voting = require (wolfa_getLuaPath()..".game.voting") + bots = wolfa_requireModule("game.bots") + game = wolfa_requireModule("game.game") + fireteams = wolfa_requireModule("game.fireteams") + sprees = wolfa_requireModule("game.sprees") + teams = wolfa_requireModule("game.teams") + voting = wolfa_requireModule("game.voting") - greetings = require (wolfa_getLuaPath()..".players.greetings") - players = require (wolfa_getLuaPath()..".players.players") - stats = require (wolfa_getLuaPath()..".players.stats") + greetings = wolfa_requireModule("players.greetings") + players = wolfa_requireModule("players.players") + stats = wolfa_requireModule("players.stats") - bits = require (wolfa_getLuaPath()..".util.bits") - constants = require (wolfa_getLuaPath()..".util.constants") - events = require (wolfa_getLuaPath()..".util.events") - files = require (wolfa_getLuaPath()..".util.files") - logs = require (wolfa_getLuaPath()..".util.logs") - pagination = require (wolfa_getLuaPath()..".util.pagination") - settings = require (wolfa_getLuaPath()..".util.settings") - tables = require (wolfa_getLuaPath()..".util.tables") - timers = require (wolfa_getLuaPath()..".util.timers") - util = require (wolfa_getLuaPath()..".util.util") + bits = wolfa_requireModule("util.bits") + constants = wolfa_requireModule("util.constants") + events = wolfa_requireModule("util.events") + files = wolfa_requireModule("util.files") + logs = wolfa_requireModule("util.logs") + pagination = wolfa_requireModule("util.pagination") + settings = wolfa_requireModule("util.settings") + tables = wolfa_requireModule("util.tables") + timers = wolfa_requireModule("util.timers") + util = wolfa_requireModule("util.util") -- register the module et.RegisterModname("WolfAdmin "..wolfa_getVersion()) diff --git a/luascripts/wolfadmin/players/greetings.lua b/luascripts/wolfadmin/players/greetings.lua index 33d88ac..b55bbc3 100644 --- a/luascripts/wolfadmin/players/greetings.lua +++ b/luascripts/wolfadmin/players/greetings.lua @@ -15,19 +15,19 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") +local auth = wolfa_requireModule("auth.auth") -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local constants = require (wolfa_getLuaPath()..".util.constants") -local util = require (wolfa_getLuaPath()..".util.util") -local events = require (wolfa_getLuaPath()..".util.events") -local settings = require (wolfa_getLuaPath()..".util.settings") -local files = require (wolfa_getLuaPath()..".util.files") +local constants = wolfa_requireModule("util.constants") +local util = wolfa_requireModule("util.util") +local events = wolfa_requireModule("util.events") +local settings = wolfa_requireModule("util.settings") +local files = wolfa_requireModule("util.files") -local toml = require "toml" +local toml = wolfa_requireLib("toml") local greetings = {} diff --git a/luascripts/wolfadmin/players/players.lua b/luascripts/wolfadmin/players/players.lua index 1fbcd14..83d1ba1 100644 --- a/luascripts/wolfadmin/players/players.lua +++ b/luascripts/wolfadmin/players/players.lua @@ -15,10 +15,10 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local db = require (wolfa_getLuaPath()..".db.db") +local db = wolfa_requireModule("db.db") -local bits = require (wolfa_getLuaPath()..".util.bits") -local events = require (wolfa_getLuaPath()..".util.events") +local bits = wolfa_requireModule("util.bits") +local events = wolfa_requireModule("util.events") local players = {} diff --git a/luascripts/wolfadmin/players/stats.lua b/luascripts/wolfadmin/players/stats.lua index 2f1d90c..683b30e 100644 --- a/luascripts/wolfadmin/players/stats.lua +++ b/luascripts/wolfadmin/players/stats.lua @@ -15,7 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") local stats = {} diff --git a/luascripts/wolfadmin/util/bits.lua b/luascripts/wolfadmin/util/bits.lua index d9ac459..9952932 100644 --- a/luascripts/wolfadmin/util/bits.lua +++ b/luascripts/wolfadmin/util/bits.lua @@ -15,7 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local util = require (wolfa_getLuaPath()..".util.util") +local util = wolfa_requireModule("util.util") local bits = {} diff --git a/luascripts/wolfadmin/util/debug.lua b/luascripts/wolfadmin/util/debug.lua index f42e571..7ed37de 100644 --- a/luascripts/wolfadmin/util/debug.lua +++ b/luascripts/wolfadmin/util/debug.lua @@ -15,7 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local settings = require (wolfa_getLuaPath()..".util.settings") +local settings = wolfa_requireModule("util.settings") local COLOURS_CHAT = { [1] = "^_", -- termination diff --git a/luascripts/wolfadmin/util/events.lua b/luascripts/wolfadmin/util/events.lua index 1a1974a..33b266e 100644 --- a/luascripts/wolfadmin/util/events.lua +++ b/luascripts/wolfadmin/util/events.lua @@ -15,8 +15,8 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local constants = require (wolfa_getLuaPath()..".util.constants") -local util = require (wolfa_getLuaPath()..".util.util") +local constants = wolfa_requireModule("util.constants") +local util = wolfa_requireModule("util.util") local events = {} diff --git a/luascripts/wolfadmin/util/files.lua b/luascripts/wolfadmin/util/files.lua index 10dcda3..f0533a2 100644 --- a/luascripts/wolfadmin/util/files.lua +++ b/luascripts/wolfadmin/util/files.lua @@ -15,7 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local settings = require (wolfa_getLuaPath()..".util.settings") +local settings = wolfa_requireModule("util.settings") local files = {} @@ -24,9 +24,9 @@ function files.ls(directory) local entries = {} if platform == "unix" then - command = 'ls -1 "'..wolfa_getBasePath()..wolfa_getLuaPath():gsub("%.", "/").."/"..directory..'"' + command = 'ls -1 "'..wolfa_getBasePath()..wolfa_getLuaModsPath():gsub("%.", "/").."/"..directory..'"' elseif platform == "windows" then - command = 'dir "'..wolfa_getBasePath()..wolfa_getLuaPath():gsub("%.", "/").."/"..directory..'" /b' + command = 'dir "'..wolfa_getBasePath()..wolfa_getLuaModsPath():gsub("%.", "/").."/"..directory..'" /b' end for filename in io.popen(command):lines() do diff --git a/luascripts/wolfadmin/util/logs.lua b/luascripts/wolfadmin/util/logs.lua index a9f990c..ff5d420 100644 --- a/luascripts/wolfadmin/util/logs.lua +++ b/luascripts/wolfadmin/util/logs.lua @@ -15,9 +15,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local players = require (wolfa_getLuaPath()..".players.players") +local players = wolfa_requireModule("players.players") -local settings = require (wolfa_getLuaPath()..".util.settings") +local settings = wolfa_requireModule("util.settings") local logs = {} diff --git a/luascripts/wolfadmin/util/pagination.lua b/luascripts/wolfadmin/util/pagination.lua index e7790a2..c41fec8 100644 --- a/luascripts/wolfadmin/util/pagination.lua +++ b/luascripts/wolfadmin/util/pagination.lua @@ -15,7 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local util = require (wolfa_getLuaPath()..".util.util") +local util = wolfa_requireModule("util.util") local pagination = {} diff --git a/luascripts/wolfadmin/util/settings.lua b/luascripts/wolfadmin/util/settings.lua index 362ad12..5720e7e 100644 --- a/luascripts/wolfadmin/util/settings.lua +++ b/luascripts/wolfadmin/util/settings.lua @@ -15,8 +15,8 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local toml = require "toml" -local events = require (wolfa_getLuaPath()..".util.events") +local toml = wolfa_requireLib("toml") +local events = wolfa_requireModule("util.events") local settings = {} @@ -159,7 +159,7 @@ function settings.load() -- compatibility for 1.1.* and lower outputDebug("Using .cfg files is deprecated as of 1.2.0. Please consider updating to .toml files.", 3) - local files = require (wolfa_getLuaPath()..".util.files") + local files = wolfa_requireModule("util.files") local _, array = files.loadFromCFG("wolfadmin.cfg", "[a-z]+") for blocksname, settings in pairs(array) do diff --git a/luascripts/wolfadmin/util/tables.lua b/luascripts/wolfadmin/util/tables.lua index 8eab4c2..6180d88 100644 --- a/luascripts/wolfadmin/util/tables.lua +++ b/luascripts/wolfadmin/util/tables.lua @@ -15,7 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local util = require (wolfa_getLuaPath()..".util.util") +local util = wolfa_requireModule("util.util") local tables = {} diff --git a/luascripts/wolfadmin/util/timers.lua b/luascripts/wolfadmin/util/timers.lua index d1caf80..fe72f30 100644 --- a/luascripts/wolfadmin/util/timers.lua +++ b/luascripts/wolfadmin/util/timers.lua @@ -15,8 +15,8 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local events = require (wolfa_getLuaPath()..".util.events") -local tables = require (wolfa_getLuaPath()..".util.tables") +local events = wolfa_requireModule("util.events") +local tables = wolfa_requireModule("util.tables") local timers = {} diff --git a/luascripts/wolfadmin/util/util.lua b/luascripts/wolfadmin/util/util.lua index 54462de..30f7f6c 100644 --- a/luascripts/wolfadmin/util/util.lua +++ b/luascripts/wolfadmin/util/util.lua @@ -15,7 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local constants = require (wolfa_getLuaPath()..".util.constants") +local constants = wolfa_requireModule("util.constants") local util = {}