feat(sound): implement Script_PlaySound

This commit is contained in:
fallenoak 2025-11-22 13:44:11 -06:00
parent 29f5a17499
commit 20613ed8a0
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D

View File

@ -5,7 +5,25 @@
#include "util/Unimplemented.hpp" #include "util/Unimplemented.hpp"
int32_t Script_PlaySound(lua_State* L) { int32_t Script_PlaySound(lua_State* L) {
WHOA_UNIMPLEMENTED(0); if (lua_isnumber(L, 1)) {
int32_t id = lua_tonumber(L, 1);
SI2::PlayUISound(id);
return 0;
}
if (!lua_isstring(L, 1)) {
lua_pushfstring(L, "Usage: PlaySound(\"sound\")");
lua_error(L);
}
char name[256];
SStrCopy(name, lua_tostring(L, 1), sizeof(name));
int32_t id = SI2::GetSoundKitID(name);
SI2::PlayUISound(id);
return 0;
} }
int32_t Script_PlayMusic(lua_State* L) { int32_t Script_PlayMusic(lua_State* L) {