Added a Lua function for playing sound files.
This commit is contained in:
parent
2518c6d155
commit
12371ef7a2
1 changed files with 15 additions and 0 deletions
|
@ -2222,6 +2222,20 @@ static int intf_set_music(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays a sound, possibly repeated.
|
||||
* - Arg 1: string.
|
||||
* - Arg 2: optional integer.
|
||||
*/
|
||||
static int intf_play_sound(lua_State *L)
|
||||
{
|
||||
char const *m = luaL_checkstring(L, 1);
|
||||
if (resources::controller->is_skipping_replay()) return 0;
|
||||
int repeats = lua_tointeger(L, 2);
|
||||
sound::play_sound(m, sound::SOUND_FX, repeats);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scrolls to given tile.
|
||||
* - Args 1,2: location.
|
||||
|
@ -2313,6 +2327,7 @@ LuaKernel::LuaKernel()
|
|||
{ "get_village_owner", &intf_get_village_owner },
|
||||
{ "is_enemy", &intf_is_enemy },
|
||||
{ "message", &intf_message },
|
||||
{ "play_sound", &intf_play_sound },
|
||||
{ "put_recall_unit", &intf_put_recall_unit },
|
||||
{ "put_unit", &intf_put_unit },
|
||||
{ "require", &intf_require },
|
||||
|
|
Loading…
Add table
Reference in a new issue