delet serverjoin stuff i forgor and add old should spin stuff
This commit is contained in:
1 parent
14ec6e0674
commit
5598526f52
1 file changed
+57
-36
+57
-36
@@ -980,6 +980,63 @@ int LUA_HookKey(INT32 keycode, int hooktype)
|
||||
|
||||
//// SNED HELP PLS
|
||||
|
||||
|
||||
UINT8 LUAh_ShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source)
|
||||
{
|
||||
/*
|
||||
hook_p hookp;
|
||||
UINT8 shouldDamage = 0; // 0 = default, 1 = force yes, 2 = force no.
|
||||
int HOOKSINDEX;
|
||||
if (!gL || !(hooksAvailable[hook_ShouldSpin/8] & (1<<(hook_ShouldSpin%8))))
|
||||
return 0;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "hooks");
|
||||
HOOKSINDEX = lua_gettop(gL);
|
||||
I_Assert(lua_istable(L, HOOKSINDEX));
|
||||
|
||||
// We can afford not to check for mobj type because it will always be MT_PLAYER in this case.
|
||||
|
||||
for (hookp = roothook; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type != hook_ShouldSpin)
|
||||
continue;
|
||||
|
||||
ps_lua_mobjhooks.value.i++;
|
||||
if (lua_gettop(gL) == 2)
|
||||
{
|
||||
LUA_PushUserdata(gL, player, META_PLAYER);
|
||||
LUA_PushUserdata(gL, inflictor, META_MOBJ);
|
||||
LUA_PushUserdata(gL, source, META_MOBJ);
|
||||
}
|
||||
lua_rawgeti(gL, HOOKSINDEX, hookp->id);
|
||||
lua_pushvalue(gL, -4);
|
||||
lua_pushvalue(gL, -4);
|
||||
lua_pushvalue(gL, -4);
|
||||
if (lua_pcall(gL, 3, 1, 1)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
hookp->error = true;
|
||||
continue;
|
||||
}
|
||||
if (!lua_isnil(gL, -1))
|
||||
{
|
||||
if (lua_toboolean(gL, -1))
|
||||
shouldDamage = 1; // Force yes
|
||||
else
|
||||
shouldDamage = 2; // Force no
|
||||
}
|
||||
lua_pop(gL, 1);
|
||||
}
|
||||
|
||||
lua_settop(gL, 0);
|
||||
return shouldDamage;
|
||||
*/
|
||||
}
|
||||
|
||||
// Hook for K_ExplodePlayer. Determines if yes or no we should get damaged reguardless of circumstances.
|
||||
UINT8 LUAh_ShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source)
|
||||
{
|
||||
@@ -1249,39 +1306,3 @@ boolean LUAh_PlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source)
|
||||
return hooked;
|
||||
*/
|
||||
}
|
||||
|
||||
void LUAh_ServerJoin(void)
|
||||
{
|
||||
/*
|
||||
hook_p hookp;
|
||||
int HOOKSINDEX;
|
||||
if (!gL || !(hooksAvailable[hook_ServerJoin/8] & (1<<(hook_ServerJoin%8))))
|
||||
return;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "hooks");
|
||||
HOOKSINDEX = lua_gettop(gL);
|
||||
I_Assert(lua_istable(L, HOOKSINDEX));
|
||||
|
||||
// We can afford not to look for target->type because it will always be MT_PLAYER.
|
||||
|
||||
for (hookp = roothook; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type != hook_ServerJoin)
|
||||
continue;
|
||||
|
||||
lua_rawgeti(gL, HOOKSINDEX, hookp->id);
|
||||
if (lua_pcall(gL, 0, 0, 1)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
hookp->error = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
lua_settop(gL, 0);
|
||||
*/
|
||||
}
|
||||
Reference in new issue
Block a user