Skip to content

Commit

Permalink
Dynamic loading of modules (fixes #71)
Browse files Browse the repository at this point in the history
  • Loading branch information
Timo Smit committed Jan 18, 2017
1 parent 7a93c4b commit cd4bf52
Show file tree
Hide file tree
Showing 84 changed files with 423 additions and 388 deletions.
16 changes: 8 additions & 8 deletions luamods/wolfadmin/admin/admin.lua
Expand Up @@ -15,16 +15,16 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local db = require "luamods.wolfadmin.db.db"
local db = require (wolfa_getLuaPath()..".db.db")

local players = require "luamods.wolfadmin.players.players"
-- local stats = require "luamods.wolfadmin.players.stats"
local players = require (wolfa_getLuaPath()..".players.players")
-- local stats = require (wolfa_getLuaPath()..".players.stats")

local constants = require "luamods.wolfadmin.util.constants"
local events = require "luamods.wolfadmin.util.events"
local files = require "luamods.wolfadmin.util.files"
local settings = require "luamods.wolfadmin.util.settings"
local util = require "luamods.wolfadmin.util.util"
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 util = require (wolfa_getLuaPath()..".util.util")

local admin = {}

Expand Down
18 changes: 9 additions & 9 deletions luamods/wolfadmin/admin/balancer.lua
Expand Up @@ -15,17 +15,17 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local constants = require "luamods.wolfadmin.util.constants"
local util = require "luamods.wolfadmin.util.util"
local bits = require "luamods.wolfadmin.util.bits"
local tables = require "luamods.wolfadmin.util.tables"
local events = require "luamods.wolfadmin.util.events"
local timers = require "luamods.wolfadmin.util.timers"
local settings = require "luamods.wolfadmin.util.settings"
local constants = require (wolfa_getLuaPath()..".util.constants")
local util = require (wolfa_getLuaPath()..".util.util")
local bits = require (wolfa_getLuaPath()..".util.bits")
local tables = require (wolfa_getLuaPath()..".util.tables")
local events = require (wolfa_getLuaPath()..".util.events")
local timers = require (wolfa_getLuaPath()..".util.timers")
local settings = require (wolfa_getLuaPath()..".util.settings")

local admin = require "luamods.wolfadmin.admin.admin"
local admin = require (wolfa_getLuaPath()..".admin.admin")

local teams = require "luamods.wolfadmin.game.teams"
local teams = require (wolfa_getLuaPath()..".game.teams")

local balancer = {}

Expand Down
8 changes: 4 additions & 4 deletions luamods/wolfadmin/admin/bans.lua
Expand Up @@ -15,12 +15,12 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local db = require "luamods.wolfadmin.db.db"
local db = require (wolfa_getLuaPath()..".db.db")

local players = require "luamods.wolfadmin.players.players"
local players = require (wolfa_getLuaPath()..".players.players")

local events = require "luamods.wolfadmin.util.events"
local settings = require "luamods.wolfadmin.util.settings"
local events = require (wolfa_getLuaPath()..".util.events")
local settings = require (wolfa_getLuaPath()..".util.settings")

local bans = {}

Expand Down
8 changes: 4 additions & 4 deletions luamods/wolfadmin/admin/history.lua
Expand Up @@ -15,12 +15,12 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local db = require "luamods.wolfadmin.db.db"
local db = require (wolfa_getLuaPath()..".db.db")

local players = require "luamods.wolfadmin.players.players"
local players = require (wolfa_getLuaPath()..".players.players")

local events = require "luamods.wolfadmin.util.events"
local settings = require "luamods.wolfadmin.util.settings"
local events = require (wolfa_getLuaPath()..".util.events")
local settings = require (wolfa_getLuaPath()..".util.settings")

local history = {}

Expand Down
8 changes: 4 additions & 4 deletions luamods/wolfadmin/admin/mutes.lua
Expand Up @@ -15,12 +15,12 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local db = require "luamods.wolfadmin.db.db"
local db = require (wolfa_getLuaPath()..".db.db")

local players = require "luamods.wolfadmin.players.players"
local players = require (wolfa_getLuaPath()..".players.players")

local events = require "luamods.wolfadmin.util.events"
local timers = require "luamods.wolfadmin.util.timers"
local events = require (wolfa_getLuaPath()..".util.events")
local timers = require (wolfa_getLuaPath()..".util.timers")

local mutes = {}

Expand Down
6 changes: 3 additions & 3 deletions luamods/wolfadmin/admin/rules.lua
Expand Up @@ -15,9 +15,9 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local events = require "luamods.wolfadmin.util.events"
local files = require "luamods.wolfadmin.util.files"
local settings = require "luamods.wolfadmin.util.settings"
local events = require (wolfa_getLuaPath()..".util.events")
local files = require (wolfa_getLuaPath()..".util.files")
local settings = require (wolfa_getLuaPath()..".util.settings")

local rules = {}

Expand Down
12 changes: 6 additions & 6 deletions luamods/wolfadmin/auth/acl.lua
Expand Up @@ -15,15 +15,15 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local auth = require "luamods.wolfadmin.auth.auth"
local auth = require (wolfa_getLuaPath()..".auth.auth")

local db = require "luamods.wolfadmin.db.db"
local db = require (wolfa_getLuaPath()..".db.db")

local players = require "luamods.wolfadmin.players.players"
local players = require (wolfa_getLuaPath()..".players.players")

local events = require "luamods.wolfadmin.util.events"
local files = require "luamods.wolfadmin.util.files"
local tables = require "luamods.wolfadmin.util.tables"
local events = require (wolfa_getLuaPath()..".util.events")
local files = require (wolfa_getLuaPath()..".util.files")
local tables = require (wolfa_getLuaPath()..".util.tables")

local acl = {}

Expand Down
10 changes: 5 additions & 5 deletions luamods/wolfadmin/auth/auth.lua
Expand Up @@ -15,9 +15,9 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local events = require "luamods.wolfadmin.util.events"
local files = require "luamods.wolfadmin.util.files"
local settings = require "luamods.wolfadmin.util.settings"
local events = require (wolfa_getLuaPath()..".util.events")
local files = require (wolfa_getLuaPath()..".util.files")
local settings = require (wolfa_getLuaPath()..".util.settings")

local auth = {}

Expand Down Expand Up @@ -114,9 +114,9 @@ auth.PERM_IMMUNE = "immune"
-- this, but it will suffice.
function auth.oninit()
if settings.get("g_standalone") == 1 then
srv = require "luamods.wolfadmin.auth.acl"
srv = require (wolfa_getLuaPath()..".auth.acl")
else
srv = require "luamods.wolfadmin.auth.shrubbot"
srv = require (wolfa_getLuaPath()..".auth.shrubbot")
end

if settings.get("g_standalone") == 1 and et.trap_Cvar_Get("g_shrubbot") ~= "" then
Expand Down
6 changes: 3 additions & 3 deletions luamods/wolfadmin/auth/shrubbot.lua
Expand Up @@ -15,10 +15,10 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local events = require "luamods.wolfadmin.util.events"
local files = require "luamods.wolfadmin.util.files"
local events = require (wolfa_getLuaPath()..".util.events")
local files = require (wolfa_getLuaPath()..".util.files")

local auth = require "luamods.wolfadmin.auth.auth"
local auth = require (wolfa_getLuaPath()..".auth.auth")

local shrubbot = {}

Expand Down
8 changes: 4 additions & 4 deletions luamods/wolfadmin/commands/admin/admintest.lua
Expand Up @@ -15,13 +15,13 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local auth = require "luamods.wolfadmin.auth.auth"
local auth = require (wolfa_getLuaPath()..".auth.auth")

local commands = require "luamods.wolfadmin.commands.commands"
local commands = require (wolfa_getLuaPath()..".commands.commands")

local players = require "luamods.wolfadmin.players.players"
local players = require (wolfa_getLuaPath()..".players.players")

local settings = require "luamods.wolfadmin.util.settings"
local settings = require (wolfa_getLuaPath()..".util.settings")

function commandAdminTest(clientId, cmdArguments)
local level = auth.getlevel(clientId)
Expand Down
6 changes: 3 additions & 3 deletions luamods/wolfadmin/commands/admin/balance.lua
Expand Up @@ -15,9 +15,9 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local commands = require "luamods.wolfadmin.commands.commands"
local auth = require "luamods.wolfadmin.auth.auth"
local balancer = require "luamods.wolfadmin.admin.balancer"
local commands = require (wolfa_getLuaPath()..".commands.commands")
local auth = require (wolfa_getLuaPath()..".auth.auth")
local balancer = require (wolfa_getLuaPath()..".admin.balancer")

function commandBalance(clientId, cmdArguments)
if cmdArguments[1] == "enable" then
Expand Down
12 changes: 6 additions & 6 deletions luamods/wolfadmin/commands/admin/ban.lua
Expand Up @@ -15,15 +15,15 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local auth = require "luamods.wolfadmin.auth.auth"
local auth = require (wolfa_getLuaPath()..".auth.auth")

local bans = require "luamods.wolfadmin.admin.bans"
local history = require "luamods.wolfadmin.admin.history"
local bans = require (wolfa_getLuaPath()..".admin.bans")
local history = require (wolfa_getLuaPath()..".admin.history")

local commands = require "luamods.wolfadmin.commands.commands"
local commands = require (wolfa_getLuaPath()..".commands.commands")

local util = require "luamods.wolfadmin.util.util"
local settings = require "luamods.wolfadmin.util.settings"
local util = require (wolfa_getLuaPath()..".util.util")
local settings = require (wolfa_getLuaPath()..".util.settings")

function commandBan(clientId, cmdArguments)
if cmdArguments[1] == nil then
Expand Down
6 changes: 3 additions & 3 deletions luamods/wolfadmin/commands/admin/enablevote.lua
Expand Up @@ -15,9 +15,9 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local commands = require "luamods.wolfadmin.commands.commands"
local auth = require "luamods.wolfadmin.auth.auth"
local voting = require "luamods.wolfadmin.game.voting"
local commands = require (wolfa_getLuaPath()..".commands.commands")
local auth = require (wolfa_getLuaPath()..".auth.auth")
local voting = require (wolfa_getLuaPath()..".game.voting")

function commandEnableVote(clientId, cmdArguments)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "chat \"^denablevote: ^9next map voting has been enabled.\";")
Expand Down
10 changes: 5 additions & 5 deletions luamods/wolfadmin/commands/admin/finger.lua
Expand Up @@ -15,14 +15,14 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local auth = require "luamods.wolfadmin.auth.auth"
local auth = require (wolfa_getLuaPath()..".auth.auth")

local commands = require "luamods.wolfadmin.commands.commands"
local commands = require (wolfa_getLuaPath()..".commands.commands")

local players = require "luamods.wolfadmin.players.players"
local players = require (wolfa_getLuaPath()..".players.players")

local settings = require "luamods.wolfadmin.util.settings"
local util = require "luamods.wolfadmin.util.util"
local settings = require (wolfa_getLuaPath()..".util.settings")
local util = require (wolfa_getLuaPath()..".util.util")

function commandFinger(clientId, cmdArguments)
if cmdArguments[1] == nil then
Expand Down
8 changes: 4 additions & 4 deletions luamods/wolfadmin/commands/admin/gib.lua
Expand Up @@ -15,13 +15,13 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local auth = require "luamods.wolfadmin.auth.auth"
local auth = require (wolfa_getLuaPath()..".auth.auth")

local commands = require "luamods.wolfadmin.commands.commands"
local commands = require (wolfa_getLuaPath()..".commands.commands")

local players = require "luamods.wolfadmin.players.players"
local players = require (wolfa_getLuaPath()..".players.players")

local settings = require "luamods.wolfadmin.util.settings"
local settings = require (wolfa_getLuaPath()..".util.settings")

function commandGib(clientId, cmdArguments)
if cmdArguments[1] == nil then
Expand Down
10 changes: 5 additions & 5 deletions luamods/wolfadmin/commands/admin/greeting.lua
Expand Up @@ -15,11 +15,11 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local util = require "luamods.wolfadmin.util.util"
local auth = require "luamods.wolfadmin.auth.auth"
local commands = require "luamods.wolfadmin.commands.commands"
local settings = require "luamods.wolfadmin.util.settings"
local greetings = require "luamods.wolfadmin.players.greetings"
local util = require (wolfa_getLuaPath()..".util.util")
local auth = require (wolfa_getLuaPath()..".auth.auth")
local commands = require (wolfa_getLuaPath()..".commands.commands")
local settings = require (wolfa_getLuaPath()..".util.settings")
local greetings = require (wolfa_getLuaPath()..".players.greetings")

function commandGreeting(clientId, cmdArguments)
local greeting = greetings.get(clientId)
Expand Down
6 changes: 3 additions & 3 deletions luamods/wolfadmin/commands/admin/help.lua
Expand Up @@ -15,9 +15,9 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local auth = require "luamods.wolfadmin.auth.auth"
local commands = require "luamods.wolfadmin.commands.commands"
local settings = require "luamods.wolfadmin.util.settings"
local auth = require (wolfa_getLuaPath()..".auth.auth")
local commands = require (wolfa_getLuaPath()..".commands.commands")
local settings = require (wolfa_getLuaPath()..".util.settings")

function commandHelp(clientId, cmdArguments)
local cmds = commands.getadmin()
Expand Down
6 changes: 3 additions & 3 deletions luamods/wolfadmin/commands/admin/incognito.lua
Expand Up @@ -15,11 +15,11 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local auth = require "luamods.wolfadmin.auth.auth"
local auth = require (wolfa_getLuaPath()..".auth.auth")

local commands = require "luamods.wolfadmin.commands.commands"
local commands = require (wolfa_getLuaPath()..".commands.commands")

local players = require "luamods.wolfadmin.players.players"
local players = require (wolfa_getLuaPath()..".players.players")

function commandIncognito(clientId, cmdArguments)
local fileName = et.trap_Cvar_Get("g_shrubbot")
Expand Down
10 changes: 5 additions & 5 deletions luamods/wolfadmin/commands/admin/kick.lua
Expand Up @@ -15,14 +15,14 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local auth = require "luamods.wolfadmin.auth.auth"
local auth = require (wolfa_getLuaPath()..".auth.auth")

local admin = require "luamods.wolfadmin.admin.admin"
local history = require "luamods.wolfadmin.admin.history"
local admin = require (wolfa_getLuaPath()..".admin.admin")
local history = require (wolfa_getLuaPath()..".admin.history")

local commands = require "luamods.wolfadmin.commands.commands"
local commands = require (wolfa_getLuaPath()..".commands.commands")

local settings = require "luamods.wolfadmin.util.settings"
local settings = require (wolfa_getLuaPath()..".util.settings")

function commandKick(clientId, cmdArguments)
if cmdArguments[1] == nil then
Expand Down
6 changes: 3 additions & 3 deletions luamods/wolfadmin/commands/admin/kickbots.lua
Expand Up @@ -15,9 +15,9 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local auth = require "luamods.wolfadmin.auth.auth"
local commands = require "luamods.wolfadmin.commands.commands"
local bots = require "luamods.wolfadmin.game.bots"
local auth = require (wolfa_getLuaPath()..".auth.auth")
local commands = require (wolfa_getLuaPath()..".commands.commands")
local bots = require (wolfa_getLuaPath()..".game.bots")

function commandBotsOff(clientId, cmdArguments)
bots.enable(false)
Expand Down
14 changes: 7 additions & 7 deletions luamods/wolfadmin/commands/admin/listaliases.lua
Expand Up @@ -15,17 +15,17 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local auth = require "luamods.wolfadmin.auth.auth"
local auth = require (wolfa_getLuaPath()..".auth.auth")

local db = require "luamods.wolfadmin.db.db"
local db = require (wolfa_getLuaPath()..".db.db")

local commands = require "luamods.wolfadmin.commands.commands"
local commands = require (wolfa_getLuaPath()..".commands.commands")

local players = require "luamods.wolfadmin.players.players"
local players = require (wolfa_getLuaPath()..".players.players")

local pagination = require "luamods.wolfadmin.util.pagination"
local settings = require "luamods.wolfadmin.util.settings"
local util = require "luamods.wolfadmin.util.util"
local pagination = require (wolfa_getLuaPath()..".util.pagination")
local settings = require (wolfa_getLuaPath()..".util.settings")
local util = require (wolfa_getLuaPath()..".util.util")

function commandListAliases(clientId, cmdArguments)
if not db.isconnected() then
Expand Down

0 comments on commit cd4bf52

Please sign in to comment.