mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-10 07:12:03 +00:00
Add player taunt functions to Lua
People have REALLY wanted these for their scripts
This commit is contained in:
parent
188c0164b6
commit
09e9e2ba4d
3 changed files with 91 additions and 7 deletions
14
src/k_kart.c
14
src/k_kart.c
|
@ -1520,7 +1520,7 @@ void K_KartMoveAnimation(player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
static void K_TauntVoiceTimers(player_t *player)
|
||||
void K_TauntVoiceTimers(player_t *player)
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
|
@ -1529,7 +1529,7 @@ static void K_TauntVoiceTimers(player_t *player)
|
|||
player->kartstuff[k_voices] = 4*TICRATE;
|
||||
}
|
||||
|
||||
static void K_RegularVoiceTimers(player_t *player)
|
||||
void K_RegularVoiceTimers(player_t *player)
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
|
@ -1540,7 +1540,7 @@ static void K_RegularVoiceTimers(player_t *player)
|
|||
player->kartstuff[k_tauntvoices] = 4*TICRATE;
|
||||
}
|
||||
|
||||
static void K_PlayAttackTaunt(mobj_t *source)
|
||||
void K_PlayAttackTaunt(mobj_t *source)
|
||||
{
|
||||
sfxenum_t pick = P_RandomKey(2); // Gotta roll the RNG every time this is called for sync reasons
|
||||
boolean tasteful = (!source->player || !source->player->kartstuff[k_tauntvoices]);
|
||||
|
@ -1554,7 +1554,7 @@ static void K_PlayAttackTaunt(mobj_t *source)
|
|||
K_TauntVoiceTimers(source->player);
|
||||
}
|
||||
|
||||
static void K_PlayBoostTaunt(mobj_t *source)
|
||||
void K_PlayBoostTaunt(mobj_t *source)
|
||||
{
|
||||
sfxenum_t pick = P_RandomKey(2); // Gotta roll the RNG every time this is called for sync reasons
|
||||
boolean tasteful = (!source->player || !source->player->kartstuff[k_tauntvoices]);
|
||||
|
@ -1568,7 +1568,7 @@ static void K_PlayBoostTaunt(mobj_t *source)
|
|||
K_TauntVoiceTimers(source->player);
|
||||
}
|
||||
|
||||
static void K_PlayOvertakeSound(mobj_t *source)
|
||||
void K_PlayOvertakeSound(mobj_t *source)
|
||||
{
|
||||
boolean tasteful = (!source->player || !source->player->kartstuff[k_voices]);
|
||||
|
||||
|
@ -1588,7 +1588,7 @@ static void K_PlayOvertakeSound(mobj_t *source)
|
|||
K_RegularVoiceTimers(source->player);
|
||||
}
|
||||
|
||||
static void K_PlayHitEmSound(mobj_t *source)
|
||||
void K_PlayHitEmSound(mobj_t *source)
|
||||
{
|
||||
if (cv_kartvoices.value)
|
||||
S_StartSound(source, sfx_khitem);
|
||||
|
@ -1598,7 +1598,7 @@ static void K_PlayHitEmSound(mobj_t *source)
|
|||
K_RegularVoiceTimers(source->player);
|
||||
}
|
||||
|
||||
static void K_PlayPowerGloatSound(mobj_t *source)
|
||||
void K_PlayPowerGloatSound(mobj_t *source)
|
||||
{
|
||||
if (cv_kartvoices.value)
|
||||
S_StartSound(source, sfx_kgloat);
|
||||
|
|
|
@ -24,6 +24,13 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid)
|
|||
void K_MatchGenericExtraFlags(mobj_t *mo, mobj_t *master);
|
||||
void K_RespawnChecker(player_t *player);
|
||||
void K_KartMoveAnimation(player_t *player);
|
||||
void K_TauntVoiceTimers(player_t *player);
|
||||
void K_RegularVoiceTimers(player_t *player);
|
||||
void K_PlayAttackTaunt(player_t *player);
|
||||
void K_PlayBoostTaunt(player_t *player);
|
||||
void K_PlayOvertakeSound(player_t *player);
|
||||
void K_PlayHitEmSound(player_t *player);
|
||||
void K_PlayPowerGloatSound(player_t *player);
|
||||
void K_KartPlayerHUDUpdate(player_t *player);
|
||||
void K_KartPlayerThink(player_t *player, ticcmd_t *cmd);
|
||||
void K_KartPlayerAfterThink(player_t *player);
|
||||
|
|
|
@ -2442,6 +2442,76 @@ static int lib_kMomentumToFacing(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kTauntVoiceTimers(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_TauntVoiceTimers(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kRegularVoiceTimers(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_RegularVoiceTimers(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kPlayAttackTaunt(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_PlayAttackTaunt(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kPlayBoostTaunt(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_PlayBoostTaunt(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kPlayOvertakeSound(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_PlayOvertakeSound(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kPlayHitEmSound(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_PlayHitEmSound(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kPlayPowerGloatSound(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_PlayPowerGloatSound(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kGetKartSpeed(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
|
@ -2698,6 +2768,13 @@ static luaL_Reg lib[] = {
|
|||
{"K_StripItems",lib_kStripItems},
|
||||
{"K_StripOther",lib_kStripOther},
|
||||
{"K_MomentumToFacing",lib_kMomentumToFacing},
|
||||
{"K_TauntVoiceTimers",lib_kTauntVoiceTimers},
|
||||
{"K_RegularVoiceTimers",lib_kRegularVoiceTimers},
|
||||
{"K_PlayAttackTaunt",lib_kPlayAttackTaunt},
|
||||
{"K_PlayBoostTaunt",lib_kPlayBoostTaunt},
|
||||
{"K_PlayOvertakeSound",lib_kPlayOvertakeSound},
|
||||
{"K_PlayHitEmSound",lib_kPlayHitEmSound},
|
||||
{"K_PlayPowerGloatSound",lib_kPlayPowerGloatSound},
|
||||
{"K_GetKartSpeed",lib_kGetKartSpeed},
|
||||
{"K_GetKartAccel",lib_kGetKartAccel},
|
||||
{"K_GetKartFlashing",lib_kGetKartFlashing},
|
||||
|
|
Loading…
Reference in a new issue