mirror of
https://github.com/edubart/otclient.git
synced 2025-10-20 14:33:26 +02:00
Refactoring and flexibility changes
* Split game module into game and game_interface * Move core_lib to corelib * Move miniwindow to corelib * Introduce init.lua script for initializing the client, giving much more flexibility * OTClient is no longer Application derived and is much simpler
This commit is contained in:
48
init.lua
Normal file
48
init.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
-- this is the first file executed when the application starts
|
||||
-- we have to load the first modules form here
|
||||
|
||||
-- setup application name and version
|
||||
g_app.setName('OTClient')
|
||||
g_app.setCompactName('otclient')
|
||||
g_app.setVersion('0.4.0_dev')
|
||||
|
||||
-- setup logger
|
||||
g_logger.setLogFile(g_resources.getWorkDir() .. g_app.getCompactName() .. ".log")
|
||||
|
||||
-- print first terminal message
|
||||
g_logger.info(g_app.getName() .. ' ' .. g_app.getVersion() .. ' (rev ' .. g_app.getBuildRevision() .. ') built on ' .. g_app.getBuildDate())
|
||||
|
||||
-- add modules directory to the search path
|
||||
if not g_resources.addToSearchPath(g_resources.getWorkDir() .. "modules", true) then
|
||||
g_logger.fatal("Unable to add modules directory to the search path.")
|
||||
end
|
||||
|
||||
-- try to add addons path too
|
||||
g_resources.addToSearchPath(g_resources.getWorkDir() .. "addons", true)
|
||||
|
||||
-- setup directory for saving configurations
|
||||
g_resources.setupWriteDir(g_app.getCompactName())
|
||||
|
||||
-- load configurations
|
||||
g_configs.load("/config.otml")
|
||||
|
||||
g_modules.discoverModules()
|
||||
|
||||
-- core modules 0-99
|
||||
g_modules.autoLoadModules(99);
|
||||
g_modules.ensureModuleLoaded("corelib")
|
||||
|
||||
-- client modules 100-499
|
||||
g_modules.autoLoadModules(499);
|
||||
g_modules.ensureModuleLoaded("client")
|
||||
|
||||
-- game modules 500-999
|
||||
g_modules.autoLoadModules(999);
|
||||
g_modules.ensureModuleLoaded("game")
|
||||
|
||||
-- addons 1000-9999
|
||||
g_modules.autoLoadModules(9999)
|
||||
|
||||
if g_resources.fileExists("/otclientrc.lua") then
|
||||
dofile("/otclientrc.lua")
|
||||
end
|
Reference in New Issue
Block a user