mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 04:41:23 +00:00
Add S_StopSoundByID to Lua
It was brought up to me in another server that character creators might want to have unique engine sounds. While I don't want to support that ourselves, as we have consistent engines for gameplay reasons, this gives people the ability to script around it if they so choose. Plus, it's just generally useful and I'm surprised vanilla hasn't added it, even though they have the function to stop ALL sounds on an object.
This commit is contained in:
parent
514cd0794b
commit
ad79b4b83b
1 changed files with 12 additions and 0 deletions
|
@ -1824,6 +1824,17 @@ static int lib_sStopSound(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_sStopSoundByID(lua_State *L)
|
||||
{
|
||||
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
sfxenum_t sound_id = luaL_checkinteger(L, 2);
|
||||
NOHUD
|
||||
if (!origin)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
S_StopSoundByID(origin, sound_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_sChangeMusic(lua_State *L)
|
||||
{
|
||||
#ifdef MUSICSLOT_COMPATIBILITY
|
||||
|
@ -2617,6 +2628,7 @@ static luaL_Reg lib[] = {
|
|||
{"S_StartSound",lib_sStartSound},
|
||||
{"S_StartSoundAtVolume",lib_sStartSoundAtVolume},
|
||||
{"S_StopSound",lib_sStopSound},
|
||||
{"S_StopSoundByID",lib_sStopSoundByID},
|
||||
{"S_ChangeMusic",lib_sChangeMusic},
|
||||
{"S_SpeedMusic",lib_sSpeedMusic},
|
||||
{"S_StopMusic",lib_sStopMusic},
|
||||
|
|
Loading…
Reference in a new issue