From 59fc3d5f773247ac9c1aaef83c6772b93e8d1c88 Mon Sep 17 00:00:00 2001
From: Eduardo Bart <edub4rt@gmail.com>
Date: Mon, 16 Jul 2012 20:04:45 -0300
Subject: [PATCH] Rename 'addons' folder to 'mods' to avoid

Use onRun event to play startup music
---
 init.lua                    |  6 +++---
 {addons => mods}/.gitignore |  0
 {addons => mods}/README.txt |  2 +-
 modules/client/client.lua   | 17 +++++++++--------
 4 files changed, 13 insertions(+), 12 deletions(-)
 rename {addons => mods}/.gitignore (100%)
 rename {addons => mods}/README.txt (70%)

diff --git a/init.lua b/init.lua
index 560fad2d..ae2c3caf 100644
--- a/init.lua
+++ b/init.lua
@@ -15,8 +15,8 @@ if not g_resources.addSearchPath(g_resources.getWorkDir() .. "modules", true) th
   g_logger.fatal("Unable to add modules directory to the search path.")
 end
 
--- try to add addons path too
-g_resources.addSearchPath(g_resources.getWorkDir() .. "addons", true)
+-- try to add mods path too
+g_resources.addSearchPath(g_resources.getWorkDir() .. "mods", true)
 
 -- setup directory for saving configurations
 g_resources.setupUserWriteDir(g_app.getCompactName())
@@ -41,7 +41,7 @@ g_modules.ensureModuleLoaded("client")
 g_modules.autoLoadModules(999)
 g_modules.ensureModuleLoaded("game")
 
--- addons 1000-9999
+-- mods 1000-9999
 g_modules.autoLoadModules(9999)
 
 if g_resources.fileExists("/otclientrc.lua") then
diff --git a/addons/.gitignore b/mods/.gitignore
similarity index 100%
rename from addons/.gitignore
rename to mods/.gitignore
diff --git a/addons/README.txt b/mods/README.txt
similarity index 70%
rename from addons/README.txt
rename to mods/README.txt
index 01f17ae5..a7dc6a2c 100644
--- a/addons/README.txt
+++ b/mods/README.txt
@@ -1 +1 @@
-This folder work exactly as modules folder, however is intended to place only addons here.
+This folder work exactly as modules folder, however is intended to place only mods here.
diff --git a/modules/client/client.lua b/modules/client/client.lua
index 5c909dfb..944ea124 100644
--- a/modules/client/client.lua
+++ b/modules/client/client.lua
@@ -36,14 +36,15 @@ function Client.init()
   g_window.setIcon(resolvepath('clienticon.png'))
   g_keyboard.bindKeyDown('Ctrl+Shift+R', Client.reloadScripts)
 
-  addEvent(function()
-    scheduleEvent(function()
-        -- Play startup music (The Silver Tree, by Mattias Westlund)
-        g_sounds.playMusic("/client/startup.ogg", 3)
-        connect(g_game, { onGameStart = function() g_sounds.stopMusic(3) end })
-        connect(g_game, { onGameEnd= function() g_sounds.playMusic("/client/startup.ogg", 3) end })
-    end, 100)
-  end, 0)
+  connect(g_app, { onRun =
+    function()
+      -- Play startup music (The Silver Tree, by Mattias Westlund)
+      g_sounds.playMusic("startup.ogg", 3)
+      connect(g_game, { onGameStart = function() g_sounds.stopMusic(3) end })
+      connect(g_game, { onGameEnd = function() g_sounds.playMusic("startup.ogg", 3) end })
+    end
+  })
+
 end
 
 function Client.terminate()