Commit 5921d17c authored by ChaoLoveIceMDBoy's avatar ChaoLoveIceMDBoy Committed by James R.
Browse files

Added PlayerThink hook

parent a5db4ca5
......@@ -46,6 +46,7 @@ enum hook {
hook_HurtMsg,
hook_PlayerSpawn,
hook_PlayerQuit,
hook_PlayerThink,
hook_MusicChange,
hook_ShouldSpin, //SRB2KART
hook_ShouldExplode, //SRB2KART
......@@ -110,5 +111,6 @@ boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Allows to write to p
void LUAh_IntermissionThinker(void); // Hook for Y_Ticker
void LUAh_VoteThinker(void); // Hook for Y_VoteTicker
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
#endif
......@@ -57,6 +57,7 @@ const char *const hookNames[hook_MAX+1] = {
"HurtMsg",
"PlayerSpawn",
"PlayerQuit",
"PlayerThink",
"MusicChange",
"ShouldSpin",
"ShouldExplode",
......@@ -208,6 +209,7 @@ static int lib_addHook(lua_State *L)
case hook_SpinSpecial:
case hook_JumpSpinSpecial:
case hook_PlayerSpawn:
case hook_PlayerThink:
lastp = &playerhooks;
break;
case hook_LinedefExecute:
......
......@@ -8244,7 +8244,12 @@ void P_PlayerThink(player_t *player)
player->playerstate = PST_REBORN;
}
if (player->playerstate == PST_REBORN)
{
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return;
}
}
#ifdef SEENAMES
......@@ -8368,7 +8373,12 @@ void P_PlayerThink(player_t *player)
P_DoTimeOver(player);
if (player->playerstate == PST_DEAD)
{
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return;
}
}
}
......@@ -8432,7 +8442,9 @@ void P_PlayerThink(player_t *player)
else
player->mo->flags2 &= ~MF2_SHADOW;
P_DeathThink(player);
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return;
}
......@@ -8566,6 +8578,12 @@ void P_PlayerThink(player_t *player)
}
else
P_MovePlayer(player);
}
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
if (!player->mo)
return; // P_MovePlayer removed player->mo.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment