Expose K_DebtStingPlayer to Lua

This commit is contained in:
JugadorXEI 2025-08-08 02:52:24 +02:00
parent eb23e80376
commit 7de76dc130
2 changed files with 16 additions and 1 deletions

View file

@ -5008,7 +5008,7 @@ void K_DebtStingPlayer(player_t *player, mobj_t *source)
{ {
INT32 length = TICRATE; INT32 length = TICRATE;
if (source->player) if (source && source->player)
{ {
length += (4 * (source->player->kartweight - player->kartweight)); length += (4 * (source->player->kartweight - player->kartweight));
} }

View file

@ -4083,6 +4083,20 @@ static int lib_kExplodePlayer(lua_State *L)
return 1; return 1;
} }
static int lib_kDebtStingPlayer(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
mobj_t *source = NULL;
NOHUD
INLEVEL
if (!player)
return LUA_ErrInvalid(L, "player_t");
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
K_DebtStingPlayer(player, source);
return 0;
}
static int lib_kTakeBumpersFromPlayer(lua_State *L) static int lib_kTakeBumpersFromPlayer(lua_State *L)
{ {
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
@ -5637,6 +5651,7 @@ static luaL_Reg lib[] = {
{"K_StumblePlayer",lib_kStumblePlayer}, {"K_StumblePlayer",lib_kStumblePlayer},
{"K_CheckStumble",lib_kCheckStumble}, {"K_CheckStumble",lib_kCheckStumble},
{"K_ExplodePlayer",lib_kExplodePlayer}, {"K_ExplodePlayer",lib_kExplodePlayer},
{"K_DebtStingPlayer",lib_kDebtStingPlayer},
{"K_TakeBumpersFromPlayer",lib_kTakeBumpersFromPlayer}, {"K_TakeBumpersFromPlayer",lib_kTakeBumpersFromPlayer},
{"K_MineFlashScreen",lib_kMineFlashScreen}, {"K_MineFlashScreen",lib_kMineFlashScreen},
{"K_SpawnMineExplosion",lib_kSpawnMineExplosion}, {"K_SpawnMineExplosion",lib_kSpawnMineExplosion},