Add P_Telekinesis and P_IsFlagAtBase to Lua.

This commit is contained in:
wolfy852 2014-05-25 21:41:05 -05:00
parent 9987d132fb
commit a8f5406233
5 changed files with 28 additions and 2 deletions

View File

@ -769,6 +769,18 @@ static int lib_pSpawnSpinMobj(lua_State *L)
return 0;
}
static int lib_pTelekinesis(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
fixed_t thrust = (fixed_t)luaL_checkinteger(L, 2);
fixed_t range = (fixed_t)luaL_checkinteger(L, 3);
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
P_Telekinesis(player, thrust, range);
return 0;
}
// P_MAP
///////////
@ -1195,6 +1207,16 @@ static int lib_pThingOnSpecial3DFloor(lua_State *L)
return 1;
}
static int lib_pIsFlagAtBase(lua_State *L)
{
mobjtype_t flag = luaL_checkinteger(L, 1);
NOHUD
if (flag > MT_LASTFREESLOT)
return luaL_error(L, "mobjtype_t out of bounds error!");
lua_pushboolean(L, P_IsFlagAtBase(flag));
return 1;
}
static int lib_pSetupLevelSky(lua_State *L)
{
INT32 skynum = (INT32)luaL_checkinteger(L, 1);
@ -1680,6 +1702,7 @@ static luaL_Reg lib[] = {
{"P_DoJump",lib_pDoJump},
{"P_SpawnThokMobj",lib_pSpawnThokMobj},
{"P_SpawnSpinMobj",lib_pSpawnSpinMobj},
{"P_Telekinesis",lib_pTelekinesis},
// p_map
{"P_CheckPosition",lib_pCheckPosition},
@ -1722,6 +1745,7 @@ static luaL_Reg lib[] = {
{"P_SpawnLightningFlash",lib_pSpawnLightningFlash},
{"P_FadeLight",lib_pFadeLight},
{"P_ThingOnSpecial3DFloor",lib_pThingOnSpecial3DFloor},
{"P_IsFlagAtBase",lib_pIsFlagAtBase},
{"P_SetupLevelSky",lib_pSetupLevelSky},
{"P_SetSkyboxMobj",lib_pSetSkyboxMobj},
{"P_StartQuake",lib_pStartQuake},

View File

@ -166,6 +166,7 @@ void P_TransferToAxis(player_t *player, INT32 axisnum);
boolean P_PlayerMoving(INT32 pnum);
void P_SpawnThokMobj(player_t *player);
void P_SpawnSpinMobj(player_t *player, mobjtype_t type);
void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range);
void P_PlayLivesJingle(player_t *player);
#define P_PlayRinglossSound(s) S_StartSound(s, (mariomode) ? sfx_mario8 : sfx_altow1 + P_RandomKey(4));

View File

@ -3109,7 +3109,7 @@ void P_SetupSignExit(player_t *player)
//
// Checks to see if a flag is at its base.
//
static boolean P_IsFlagAtBase(mobjtype_t flag)
boolean P_IsFlagAtBase(mobjtype_t flag)
{
thinker_t *think;
mobj_t *mo;

View File

@ -56,6 +56,7 @@ INT32 P_FindSpecialLineFromTag(INT16 special, INT16 tag, INT32 start);
INT32 P_FindMinSurroundingLight(sector_t *sector, INT32 max);
void P_SetupSignExit(player_t *player);
boolean P_IsFlagAtBase(mobjtype_t flag);
void P_SwitchWeather(INT32 weathernum);

View File

@ -3592,7 +3592,7 @@ static void P_DoJumpShield(player_t *player)
// Morph's fancy stuff-moving character ability
// +ve thrust pushes away, -ve thrust pulls in
//
static void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range)
void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range)
{
thinker_t *th;
mobj_t *mo2;