-- CONFIG
APP_NAME = "Resurgence"
APP_VERSION = 800
DEFAULT_LAYOUT = "retro"

Services = {
  website = "",
  updater = "",
  stats = "",
  crash = "",
  feedback = "",
  status = ""
}

Servers = {
  Resurgence = "23.191.72.11:7171:800"
}

ALLOW_CUSTOM_SERVERS = false

g_app.setName("Resurgence")

-- CONFIG END

g_logger.info(os.date("== application started at %b %d %Y %X"))
g_logger.info(g_app.getName() .. ' ' .. g_app.getVersion() .. ' rev ' .. g_app.getBuildRevision() .. ' (' .. g_app.getBuildCommit() .. ') made by ' .. g_app.getAuthor() .. ' built on ' .. g_app.getBuildDate() .. ' for arch ' .. g_app.getBuildArch())

if not g_resources.directoryExists("/data") then
  g_logger.fatal("Data dir doesn't exist.")
end

if not g_resources.directoryExists("/modules") then
  g_logger.fatal("Modules dir doesn't exist.")
end

g_configs.loadSettings("/config.otml")

local settings = g_configs.getSettings()
local layout = DEFAULT_LAYOUT

if g_app.isMobile() then
  layout = "mobile"
elseif settings:exists('layout') then
  layout = settings:getValue('layout')
end

g_resources.setLayout(layout)

g_modules.discoverModules()
g_modules.ensureModuleLoaded("corelib")

local function loadModules()
  g_modules.autoLoadModules(99)
  g_modules.ensureModuleLoaded("gamelib")

  g_modules.autoLoadModules(499)
  g_modules.ensureModuleLoaded("client")

  g_modules.autoLoadModules(999)
  g_modules.ensureModuleLoaded("game_interface")

  g_modules.autoLoadModules(9999)
end

loadModules()