Made it possible to just call EV_CrumbleChain(rover) in Lua

This commit is contained in:
toaster 2019-07-28 22:45:20 +01:00
parent 64517a1362
commit 1d799630af

View file

@ -2047,12 +2047,19 @@ static int lib_pStartQuake(lua_State *L)
static int lib_evCrumbleChain(lua_State *L)
{
sector_t *sec = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR));
sector_t *sec = NULL;
ffloor_t *rover = NULL;
NOHUD
INLEVEL
/*if (!sec)
return LUA_ErrInvalid(L, "sector_t");*/
if (lua_isuserdata(L, 2))
{
sec = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR));
if (!sec)
return LUA_ErrInvalid(L, "sector_t");
}
else
rover = *((ffloor_t **)luaL_checkudata(L, 1, META_FFLOOR));
if (!rover)
return LUA_ErrInvalid(L, "ffloor_t");
EV_CrumbleChain(sec, rover);