mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-20 19:02:37 +00:00
Merge branch 'lua-improvement' into 'master'
General Lua improvements See merge request KartKrew/Kart!86
This commit is contained in:
commit
fd5a8d663b
5 changed files with 234 additions and 69 deletions
|
@ -8788,6 +8788,35 @@ struct {
|
|||
|
||||
{"V_CHARCOLORSHIFT",V_CHARCOLORSHIFT},
|
||||
{"V_ALPHASHIFT",V_ALPHASHIFT},
|
||||
|
||||
// SRB2Kart
|
||||
// kartitems_t
|
||||
{"KITEM_SAD",KITEM_SAD}, // Actual items (can be set for k_itemtype)
|
||||
{"KITEM_NONE",KITEM_NONE},
|
||||
{"KITEM_SNEAKER",KITEM_SNEAKER},
|
||||
{"KITEM_ROCKETSNEAKER",KITEM_ROCKETSNEAKER},
|
||||
{"KITEM_INVINCIBILITY",KITEM_INVINCIBILITY},
|
||||
{"KITEM_BANANA",KITEM_BANANA},
|
||||
{"KITEM_EGGMAN",KITEM_EGGMAN},
|
||||
{"KITEM_ORBINAUT",KITEM_ORBINAUT},
|
||||
{"KITEM_JAWZ",KITEM_JAWZ},
|
||||
{"KITEM_MINE",KITEM_MINE},
|
||||
{"KITEM_BALLHOG",KITEM_BALLHOG},
|
||||
{"KITEM_SPB",KITEM_SPB},
|
||||
{"KITEM_GROW",KITEM_GROW},
|
||||
{"KITEM_SHRINK",KITEM_SHRINK},
|
||||
{"KITEM_THUNDERSHIELD",KITEM_THUNDERSHIELD},
|
||||
{"KITEM_HYUDORO",KITEM_HYUDORO},
|
||||
{"KITEM_POGOSPRING",KITEM_POGOSPRING},
|
||||
{"KITEM_KITCHENSINK",KITEM_KITCHENSINK},
|
||||
{"NUMKARTITEMS",NUMKARTITEMS},
|
||||
{"KRITEM_TRIPLESNEAKER",KRITEM_TRIPLESNEAKER}, // Additional roulette IDs (not usable for much in Lua besides K_GetItemPatch)
|
||||
{"KRITEM_TRIPLEBANANA",KRITEM_TRIPLEBANANA},
|
||||
{"KRITEM_TENFOLDBANANA",KRITEM_TENFOLDBANANA},
|
||||
{"KRITEM_TRIPLEORBINAUT",KRITEM_TRIPLEORBINAUT},
|
||||
{"KRITEM_QUADORBINAUT",KRITEM_QUADORBINAUT},
|
||||
{"KRITEM_DUALJAWZ",KRITEM_DUALJAWZ},
|
||||
{"NUMKARTRESULTS",NUMKARTRESULTS},
|
||||
#endif
|
||||
|
||||
{NULL,0}
|
||||
|
@ -9698,11 +9727,11 @@ static inline int lib_getenum(lua_State *L)
|
|||
return 0;
|
||||
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"admin")) {
|
||||
//if (!playeringame[adminplayer] || IsPlayerAdmin(serverplayer))
|
||||
//return 0;
|
||||
//LUA_PushUserdata(L, &players[adminplayer], META_PLAYER);
|
||||
return 1;
|
||||
/*} else if (fastcmp(word,"admin")) { // Replaced with IsPlayerAdmin
|
||||
if (!playeringame[adminplayer] || IsPlayerAdmin(serverplayer))
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[adminplayer], META_PLAYER);
|
||||
return 1;*/
|
||||
} else if (fastcmp(word,"emeralds")) {
|
||||
lua_pushinteger(L, emeralds);
|
||||
return 1;
|
||||
|
@ -9715,6 +9744,27 @@ static inline int lib_getenum(lua_State *L)
|
|||
} else if (fastcmp(word, "token")) {
|
||||
lua_pushinteger(L, token);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"gamespeed")) {
|
||||
lua_pushinteger(L, gamespeed);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"encoremode")) {
|
||||
lua_pushboolean(L, encoremode);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"franticitems")) {
|
||||
lua_pushboolean(L, franticitems);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"comeback")) {
|
||||
lua_pushboolean(L, comeback);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"wantedcalcdelay")) {
|
||||
lua_pushinteger(L, wantedcalcdelay);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"indirectitemcooldown")) {
|
||||
lua_pushinteger(L, indirectitemcooldown);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"thwompsactive")) {
|
||||
lua_pushboolean(L, thwompsactive);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
19
src/k_kart.c
19
src/k_kart.c
|
@ -2257,7 +2257,8 @@ void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32
|
|||
mobj->momy = FixedMul(FixedDiv(mobjy - y, dist), FixedDiv(dist, 6*FRACUNIT));
|
||||
mobj->momz = FixedMul(FixedDiv(mobjz - z, dist), FixedDiv(dist, 6*FRACUNIT));
|
||||
|
||||
P_SetTarget(&mobj->target, source);
|
||||
if (source && !P_MobjWasRemoved(source))
|
||||
P_SetTarget(&mobj->target, source);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4374,7 +4375,7 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
|
|||
return turnvalue;
|
||||
}
|
||||
|
||||
fixed_t K_GetKartDriftSparkValue(player_t *player)
|
||||
INT32 K_GetKartDriftSparkValue(player_t *player)
|
||||
{
|
||||
UINT8 kartspeed = (G_BattleGametype() && player->kartstuff[k_bumper] <= 0)
|
||||
? 1
|
||||
|
@ -4384,9 +4385,9 @@ fixed_t K_GetKartDriftSparkValue(player_t *player)
|
|||
|
||||
static void K_KartDrift(player_t *player, boolean onground)
|
||||
{
|
||||
fixed_t dsone = K_GetKartDriftSparkValue(player);
|
||||
fixed_t dstwo = dsone*2;
|
||||
fixed_t dsthree = dstwo*2;
|
||||
INT32 dsone = K_GetKartDriftSparkValue(player);
|
||||
INT32 dstwo = dsone*2;
|
||||
INT32 dsthree = dstwo*2;
|
||||
|
||||
// Drifting is actually straffing + automatic turning.
|
||||
// Holding the Jump button will enable drifting.
|
||||
|
@ -6791,7 +6792,7 @@ static void K_drawKartBumpersOrKarma(void)
|
|||
}
|
||||
}
|
||||
|
||||
fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fixed_t my)
|
||||
static fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fixed_t my)
|
||||
{
|
||||
fixed_t dist, x;
|
||||
fixed_t range = RING_DIST/3;
|
||||
|
@ -7376,9 +7377,9 @@ static void K_drawKartFirstPerson(void)
|
|||
|
||||
if (stplyr->mo)
|
||||
{
|
||||
fixed_t dsone = K_GetKartDriftSparkValue(stplyr);
|
||||
fixed_t dstwo = dsone*2;
|
||||
fixed_t dsthree = dstwo*2;
|
||||
INT32 dsone = K_GetKartDriftSparkValue(stplyr);
|
||||
INT32 dstwo = dsone*2;
|
||||
INT32 dsthree = dstwo*2;
|
||||
|
||||
#ifndef DONTLIKETOASTERSFPTWEAKS
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@ void K_RepairOrbitChain(mobj_t *orbit);
|
|||
player_t *K_FindJawzTarget(mobj_t *actor, player_t *source);
|
||||
boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y);
|
||||
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue);
|
||||
fixed_t K_GetKartDriftSparkValue(player_t *player);
|
||||
INT32 K_GetKartDriftSparkValue(player_t *player);
|
||||
void K_DropItems(player_t *player);
|
||||
void K_StripItems(player_t *player);
|
||||
void K_StripOther(player_t *player);
|
||||
|
@ -64,7 +64,6 @@ void K_CheckSpectateStatus(void);
|
|||
const char *K_GetItemPatch(UINT8 item, boolean tiny);
|
||||
INT32 K_calcSplitFlags(INT32 snapflags);
|
||||
void K_LoadKartHUDGraphics(void);
|
||||
fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fixed_t my);
|
||||
void K_drawKartHUD(void);
|
||||
void K_drawKartFreePlay(UINT32 flashtime);
|
||||
void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UINT8 mode);
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
#include "g_game.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "console.h"
|
||||
#include "k_kart.h"
|
||||
#include "k_kart.h" // SRB2Kart
|
||||
#include "d_netcmd.h" // IsPlayerAdmin
|
||||
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
|
@ -142,6 +143,16 @@ static int lib_evalMath(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_isPlayerAdmin(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
//HUDSAFE
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
lua_pushboolean(L, IsPlayerAdmin(player-players));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// M_RANDOM
|
||||
//////////////
|
||||
|
||||
|
@ -1708,6 +1719,25 @@ static int lib_rSetPlayerSkin(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// R_DATA
|
||||
////////////
|
||||
|
||||
static int lib_rCheckTextureNumForName(lua_State *L)
|
||||
{
|
||||
const char *name = luaL_checkstring(L, 1);
|
||||
//HUDSAFE
|
||||
lua_pushinteger(L, R_CheckTextureNumForName(name));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_rTextureNumForName(lua_State *L)
|
||||
{
|
||||
const char *name = luaL_checkstring(L, 1);
|
||||
//HUDSAFE
|
||||
lua_pushinteger(L, R_TextureNumForName(name));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// S_SOUND
|
||||
////////////
|
||||
|
||||
|
@ -2057,8 +2087,8 @@ static int lib_kIsPlayerLosing(lua_State *L)
|
|||
//HUDSAFE
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_IsPlayerLosing(player);
|
||||
return 0;
|
||||
lua_pushboolean(L, K_IsPlayerLosing(player));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kIsPlayerWanted(lua_State *L)
|
||||
|
@ -2067,16 +2097,16 @@ static int lib_kIsPlayerWanted(lua_State *L)
|
|||
//HUDSAFE
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_IsPlayerWanted(player);
|
||||
return 0;
|
||||
lua_pushboolean(L, K_IsPlayerWanted(player));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kKartBouncing(lua_State *L)
|
||||
{
|
||||
mobj_t *mobj1 = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
mobj_t *mobj2 = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
boolean bounce = luaL_checkboolean(L, 3);
|
||||
boolean solid = luaL_checkboolean(L, 4);
|
||||
boolean bounce = lua_optboolean(L, 3);
|
||||
boolean solid = lua_optboolean(L, 4);
|
||||
NOHUD
|
||||
if (!mobj1)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
|
@ -2112,13 +2142,13 @@ static int lib_kDoInstashield(lua_State *L)
|
|||
static int lib_kSpawnBattlePoints(lua_State *L)
|
||||
{
|
||||
player_t *source = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
player_t *victim = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||
player_t *victim = NULL;
|
||||
UINT8 amount = (UINT8)luaL_checkinteger(L, 3);
|
||||
NOHUD
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (!victim)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||
victim = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||
K_SpawnBattlePoints(source, victim, amount);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2126,14 +2156,14 @@ static int lib_kSpawnBattlePoints(lua_State *L)
|
|||
static int lib_kSpinPlayer(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
INT32 type = (INT32)luaL_checkinteger(L, 3);
|
||||
boolean trapitem = luaL_checkboolean(L, 4);
|
||||
mobj_t *source = NULL;
|
||||
INT32 type = (INT32)luaL_optinteger(L, 3, 0);
|
||||
boolean trapitem = lua_optboolean(L, 4);
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||
source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
K_SpinPlayer(player, source, type, trapitem);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2141,12 +2171,12 @@ static int lib_kSpinPlayer(lua_State *L)
|
|||
static int lib_kSquishPlayer(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
mobj_t *source = NULL;
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||
source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
K_SquishPlayer(player, source);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2154,15 +2184,15 @@ static int lib_kSquishPlayer(lua_State *L)
|
|||
static int lib_kExplodePlayer(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
mobj_t *inflictor = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||
mobj_t *source = NULL;
|
||||
mobj_t *inflictor = NULL;
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (!inflictor)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||
source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
||||
inflictor = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||
K_ExplodePlayer(player, source, inflictor);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2171,7 +2201,7 @@ static int lib_kStealBumper(lua_State *L)
|
|||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
player_t *victim = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||
boolean force = luaL_checkboolean(L, 3);
|
||||
boolean force = lua_optboolean(L, 3);
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
|
@ -2186,17 +2216,28 @@ static int lib_kSpawnKartExplosion(lua_State *L)
|
|||
fixed_t x = luaL_checkfixed(L, 1);
|
||||
fixed_t y = luaL_checkfixed(L, 2);
|
||||
fixed_t z = luaL_checkfixed(L, 3);
|
||||
fixed_t radius = luaL_checkfixed(L, 4);
|
||||
INT32 number = (INT32)luaL_checkinteger(L, 5);
|
||||
mobjtype_t type = luaL_checkinteger(L, 6);
|
||||
angle_t rotangle = luaL_checkangle(L, 7);
|
||||
boolean spawncenter = luaL_checkboolean(L, 8);
|
||||
boolean ghostit = luaL_checkboolean(L, 9);
|
||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 10, META_MOBJ));
|
||||
fixed_t radius = (fixed_t)luaL_optinteger(L, 4, 32*FRACUNIT);
|
||||
INT32 number = (INT32)luaL_optinteger(L, 5, 32);
|
||||
mobjtype_t type = luaL_optinteger(L, 6, MT_MINEEXPLOSION);
|
||||
angle_t rotangle = luaL_optinteger(L, 7, 0);
|
||||
boolean spawncenter = lua_opttrueboolean(L, 8);
|
||||
boolean ghostit = lua_optboolean(L, 9);
|
||||
mobj_t *source = NULL;
|
||||
NOHUD
|
||||
if (!lua_isnone(L, 10) && lua_isuserdata(L, 10))
|
||||
source = *((mobj_t **)luaL_checkudata(L, 10, META_MOBJ));
|
||||
K_SpawnKartExplosion(x, y, z, radius, number, type, rotangle, spawncenter, ghostit, source);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kSpawnMineExplosion(lua_State *L)
|
||||
{
|
||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
UINT8 color = (UINT8)luaL_optinteger(L, 2, SKINCOLOR_KETCHUP);
|
||||
NOHUD
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
K_SpawnKartExplosion(x, y, z, radius, number, type, rotangle, spawncenter, ghostit, source);
|
||||
K_SpawnMineExplosion(source, color);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2223,7 +2264,7 @@ static int lib_kSpawnSparkleTrail(lua_State *L)
|
|||
static int lib_kSpawnWipeoutTrail(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
boolean translucent = luaL_checkboolean(L, 2);
|
||||
boolean translucent = lua_optboolean(L, 2);
|
||||
NOHUD
|
||||
if (!mo)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
|
@ -2244,7 +2285,7 @@ static int lib_kDriftDustHandling(lua_State *L)
|
|||
static int lib_kDoSneaker(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
INT32 type = luaL_checkinteger(L, 2);
|
||||
INT32 type = luaL_optinteger(L, 2, 0);
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
|
@ -2255,8 +2296,8 @@ static int lib_kDoSneaker(lua_State *L)
|
|||
static int lib_kDoPogoSpring(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
fixed_t vertispeed = luaL_checkfixed(L, 2);
|
||||
UINT8 sound = luaL_checkinteger(L, 3);
|
||||
fixed_t vertispeed = (fixed_t)luaL_optinteger(L, 2, 0);
|
||||
UINT8 sound = (UINT8)luaL_optinteger(L, 3, 1);
|
||||
NOHUD
|
||||
if (!mo)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
|
@ -2267,15 +2308,15 @@ static int lib_kDoPogoSpring(lua_State *L)
|
|||
static int lib_kKillBananaChain(lua_State *L)
|
||||
{
|
||||
mobj_t *banana = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
mobj_t *inflictor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
mobj_t *inflictor = NULL;
|
||||
mobj_t *source = NULL;
|
||||
NOHUD
|
||||
if (!banana)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (!inflictor)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||
inflictor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
||||
source = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||
K_KillBananaChain(banana, inflictor, source);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2290,6 +2331,59 @@ static int lib_kRepairOrbitChain(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kFindJawzTarget(lua_State *L)
|
||||
{
|
||||
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
player_t *source = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||
//HUDSAFE
|
||||
if (!actor)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
LUA_PushUserdata(L, K_FindJawzTarget(actor, source), META_PLAYER);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kGetKartDriftSparkValue(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
//HUDSAFE
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
lua_pushinteger(L, K_GetKartDriftSparkValue(player));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kDropItems(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_DropItems(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kStripItems(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_StripItems(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kStripOther(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_StripOther(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kMomentumToFacing(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
|
@ -2303,12 +2397,12 @@ static int lib_kMomentumToFacing(lua_State *L)
|
|||
static int lib_kGetKartSpeed(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
boolean doboostpower = luaL_checkboolean(L, 2);
|
||||
boolean doboostpower = lua_optboolean(L, 2);
|
||||
//HUDSAFE
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
lua_pushinteger(L, K_GetKartSpeed(player, doboostpower));
|
||||
return 0;
|
||||
lua_pushfixed(L, K_GetKartSpeed(player, doboostpower));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kGetKartAccel(lua_State *L)
|
||||
|
@ -2317,8 +2411,8 @@ static int lib_kGetKartAccel(lua_State *L)
|
|||
//HUDSAFE
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
lua_pushinteger(L, K_GetKartAccel(player));
|
||||
return 0;
|
||||
lua_pushfixed(L, K_GetKartAccel(player));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kGetKartFlashing(lua_State *L)
|
||||
|
@ -2328,7 +2422,16 @@ static int lib_kGetKartFlashing(lua_State *L)
|
|||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
lua_pushinteger(L, K_GetKartFlashing(player));
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kGetItemPatch(lua_State *L)
|
||||
{
|
||||
UINT8 item = (UINT8)luaL_optinteger(L, 1, KITEM_NONE);
|
||||
boolean tiny = lua_optboolean(L, 2);
|
||||
//HUDSAFE
|
||||
lua_pushstring(L, K_GetItemPatch(item, tiny));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static luaL_Reg lib[] = {
|
||||
|
@ -2336,6 +2439,7 @@ static luaL_Reg lib[] = {
|
|||
{"chatprint", lib_chatprint},
|
||||
{"chatprintf", lib_chatprintf},
|
||||
{"EvalMath", lib_evalMath},
|
||||
{"IsPlayerAdmin", lib_isPlayerAdmin},
|
||||
|
||||
// m_random
|
||||
{"P_RandomFixed",lib_pRandomFixed},
|
||||
|
@ -2479,6 +2583,10 @@ static luaL_Reg lib[] = {
|
|||
{"R_Frame2Char",lib_rFrame2Char},
|
||||
{"R_SetPlayerSkin",lib_rSetPlayerSkin},
|
||||
|
||||
// r_data
|
||||
{"R_CheckTextureNumForName",lib_rCheckTextureNumForName),
|
||||
{"R_TextureNumForName",lib_rTextureNumForName),
|
||||
|
||||
// s_sound
|
||||
{"S_StartSound",lib_sStartSound},
|
||||
{"S_StartSoundAtVolume",lib_sStartSoundAtVolume},
|
||||
|
@ -2520,6 +2628,7 @@ static luaL_Reg lib[] = {
|
|||
{"K_ExplodePlayer",lib_kExplodePlayer},
|
||||
{"K_StealBumper",lib_kStealBumper},
|
||||
{"K_SpawnKartExplosion",lib_kSpawnKartExplosion},
|
||||
{"K_SpawnMineExplosion",lib_kSpawnMineExplosion},
|
||||
{"K_SpawnBoostTrail",lib_kSpawnBoostTrail},
|
||||
{"K_SpawnSparkleTrail",lib_kSpawnSparkleTrail},
|
||||
{"K_SpawnWipeoutTrail",lib_kSpawnWipeoutTrail},
|
||||
|
@ -2528,10 +2637,16 @@ static luaL_Reg lib[] = {
|
|||
{"K_DoPogoSpring",lib_kDoPogoSpring},
|
||||
{"K_KillBananaChain",lib_kKillBananaChain},
|
||||
{"K_RepairOrbitChain",lib_kRepairOrbitChain},
|
||||
{"K_FindJawzTarget",lib_kFindJawzTarget},
|
||||
{"K_GetKartDriftSparkValue",lib_kGetKartDriftSparkValue},
|
||||
{"K_DropItems",lib_kDropItems},
|
||||
{"K_StripItems",lib_kStripItems},
|
||||
{"K_StripOther",lib_kStripOther},
|
||||
{"K_MomentumToFacing",lib_kMomentumToFacing},
|
||||
{"K_GetKartSpeed",lib_kGetKartSpeed},
|
||||
{"K_GetKartAccel",lib_kGetKartAccel},
|
||||
{"K_GetKartFlashing",lib_kGetKartFlashing},
|
||||
{"K_GetItemPatch",lib_kGetItemPatch},
|
||||
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
|
|
@ -720,16 +720,16 @@ static int side_set(lua_State *L)
|
|||
side->rowoffset = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case side_toptexture:
|
||||
side->toptexture = luaL_checkinteger(L, 3);
|
||||
side->toptexture = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case side_bottomtexture:
|
||||
side->bottomtexture = luaL_checkinteger(L, 3);
|
||||
side->bottomtexture = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case side_midtexture:
|
||||
side->midtexture = luaL_checkinteger(L, 3);
|
||||
side->midtexture = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case side_repeatcnt:
|
||||
side->repeatcnt = luaL_checkinteger(L, 3);
|
||||
side->repeatcnt = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue