Added sounds

This commit is contained in:
Vladislav Khorev committed 2026-07-07 23:05:01 +03:00
1 parent c6ba8bd008
commit 124208f2a4
26 files changed
+210 -36

No files matched your search

+9 -1
View File
@@ -33,7 +33,7 @@ namespace ZL {
ScriptEngine::ScriptEngine() = default;
ScriptEngine::~ScriptEngine() = default;
void ScriptEngine::init(Location* loc, Inventory* inventory, const std::string& scriptPath) {
void ScriptEngine::init(Location* loc, Inventory* inventory, AudioPlayerAsync* audioPlayer, const std::string& scriptPath) {
impl = std::make_unique<Impl>();
sol::state& lua = impl->lua;
@@ -773,6 +773,14 @@ namespace ZL {
}
});
api.set_function("play_sound",
[audioPlayer](const std::string& soundPath) -> void {
if (audioPlayer)
{
audioPlayer->playSoundAsync(soundPath);
}
});
lua.script_file(scriptPath);
}