-
Notifications
You must be signed in to change notification settings - Fork 0
sound.path
Guy Fraser edited this page Sep 14, 2016
·
3 revisions
Define base path for sound assets defined in your style sheets v0.0.3+
Affects all files processed by the [sound API](sound API), except filenames which start with
__
(double underscore) as that usually indicates a fully specified path.
Set the base path (always do this at the start of your data.lua
):
sound.path = '__<ModName>__/<Path>'
Where:
-
<ModName>
(String) - name of your mod as defined in itsinfo.json
file -
<Path>
(String) - optional path, eg. to a/sounds
folder.
Clearing the path (always do this at the end of your data.lua
):
sound.path = nil
Define a path to your sounds folder:
-- always set the path, even if you don't plan on using it
-- (in which case just set it to nil)
sound.path = '__MyAwesoneMod__/sounds'
local noise = sound.effect 'gui-click.ogg'
-- path treated as: '__MyAwesoneMod__/sounds/gui-click.ogg'
sound.path = nil -- clear the path
Using a custom path for a specific asset:
sound.path = '__MyAwesoneMod__/sounds'
local noise = sound.effect '__SomeMod__/audio/gui-click.ogg'
-- path treated as: '__SomeMod__/audio-/gui-click.ogg'
sound.path = nil -- clear the path
Because a full path is specified, it won't be prefixed with sound.path
.