Browse Source

Rename 'addons' folder to 'mods' to avoid

Use onRun event to play startup music
Eduardo Bart 7 years ago
parent
commit
59fc3d5f77
4 changed files with 13 additions and 10 deletions
  1. 3
    1
      init.lua
  2. 0
    0
      mods/.gitignore
  3. 1
    1
      mods/README.txt
  4. 9
    8
      modules/client/client.lua

+ 3
- 1
init.lua View File

@@ -15,8 +15,8 @@ if not g_resources.addSearchPath(g_resources.getWorkDir() .. "modules", true) th
15 15
   g_logger.fatal("Unable to add modules directory to the search path.")
16 16
 end
17 17
 
18
-g_resources.addSearchPath(g_resources.getWorkDir() .. "addons", true)
18
+-- try to add mods path too
19
+g_resources.addSearchPath(g_resources.getWorkDir() .. "mods", true)
19 20
 
20 21
 -- setup directory for saving configurations
21 22
 g_resources.setupUserWriteDir(g_app.getCompactName())
@@ -41,7 +41,7 @@ g_modules.ensureModuleLoaded("client")
41 41
 g_modules.autoLoadModules(999)
42 42
 g_modules.ensureModuleLoaded("game")
43 43
 
44
+-- mods 1000-9999
44 45
 g_modules.autoLoadModules(9999)
45 46
 
46 47
 if g_resources.fileExists("/otclientrc.lua") then

addons/.gitignore → mods/.gitignore View File


addons/README.txt → mods/README.txt View File

@@ -1 +1 @@
1
-This folder work exactly as modules folder, however is intended to place only addons here.
1
+This folder work exactly as modules folder, however is intended to place only mods here.

+ 9
- 8
modules/client/client.lua View File

@@ -36,14 +36,15 @@ function Client.init()
36 36
   g_window.setIcon(resolvepath('clienticon.png'))
37 37
   g_keyboard.bindKeyDown('Ctrl+Shift+R', Client.reloadScripts)
38 38
 
39
-  addEvent(function()
40
-    scheduleEvent(function()
41
-        -- Play startup music (The Silver Tree, by Mattias Westlund)
42
-        g_sounds.playMusic("/client/startup.ogg", 3)
43
-        connect(g_game, { onGameStart = function() g_sounds.stopMusic(3) end })
44
-        connect(g_game, { onGameEnd= function() g_sounds.playMusic("/client/startup.ogg", 3) end })
45
-    end, 100)
46
-  end, 0)
39
+  connect(g_app, { onRun =
40
+    function()
41
+      -- Play startup music (The Silver Tree, by Mattias Westlund)
42
+      g_sounds.playMusic("startup.ogg", 3)
43
+      connect(g_game, { onGameStart = function() g_sounds.stopMusic(3) end })
44
+      connect(g_game, { onGameEnd = function() g_sounds.playMusic("startup.ogg", 3) end })
45
+    end
46
+  })
47
+
47 48
 end
48 49
 
49 50
 function Client.terminate()

Loading…
Cancel
Save