mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-26 20:31:30 +00:00
Added PlayerThink hook
This commit is contained in:
parent
a5db4ca572
commit
5921d17cc0
3 changed files with 23 additions and 1 deletions
|
@ -46,6 +46,7 @@ enum hook {
|
||||||
hook_HurtMsg,
|
hook_HurtMsg,
|
||||||
hook_PlayerSpawn,
|
hook_PlayerSpawn,
|
||||||
hook_PlayerQuit,
|
hook_PlayerQuit,
|
||||||
|
hook_PlayerThink,
|
||||||
hook_MusicChange,
|
hook_MusicChange,
|
||||||
hook_ShouldSpin, //SRB2KART
|
hook_ShouldSpin, //SRB2KART
|
||||||
hook_ShouldExplode, //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_IntermissionThinker(void); // Hook for Y_Ticker
|
||||||
void LUAh_VoteThinker(void); // Hook for Y_VoteTicker
|
void LUAh_VoteThinker(void); // Hook for Y_VoteTicker
|
||||||
|
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -57,6 +57,7 @@ const char *const hookNames[hook_MAX+1] = {
|
||||||
"HurtMsg",
|
"HurtMsg",
|
||||||
"PlayerSpawn",
|
"PlayerSpawn",
|
||||||
"PlayerQuit",
|
"PlayerQuit",
|
||||||
|
"PlayerThink",
|
||||||
"MusicChange",
|
"MusicChange",
|
||||||
"ShouldSpin",
|
"ShouldSpin",
|
||||||
"ShouldExplode",
|
"ShouldExplode",
|
||||||
|
@ -208,6 +209,7 @@ static int lib_addHook(lua_State *L)
|
||||||
case hook_SpinSpecial:
|
case hook_SpinSpecial:
|
||||||
case hook_JumpSpinSpecial:
|
case hook_JumpSpinSpecial:
|
||||||
case hook_PlayerSpawn:
|
case hook_PlayerSpawn:
|
||||||
|
case hook_PlayerThink:
|
||||||
lastp = &playerhooks;
|
lastp = &playerhooks;
|
||||||
break;
|
break;
|
||||||
case hook_LinedefExecute:
|
case hook_LinedefExecute:
|
||||||
|
|
20
src/p_user.c
20
src/p_user.c
|
@ -8244,8 +8244,13 @@ void P_PlayerThink(player_t *player)
|
||||||
player->playerstate = PST_REBORN;
|
player->playerstate = PST_REBORN;
|
||||||
}
|
}
|
||||||
if (player->playerstate == PST_REBORN)
|
if (player->playerstate == PST_REBORN)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
LUAh_PlayerThink(player);
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SEENAMES
|
#ifdef SEENAMES
|
||||||
if (netgame && player == &players[displayplayers[0]] && !(leveltime % (TICRATE/5)) && !splitscreen)
|
if (netgame && player == &players[displayplayers[0]] && !(leveltime % (TICRATE/5)) && !splitscreen)
|
||||||
|
@ -8368,9 +8373,14 @@ void P_PlayerThink(player_t *player)
|
||||||
P_DoTimeOver(player);
|
P_DoTimeOver(player);
|
||||||
|
|
||||||
if (player->playerstate == PST_DEAD)
|
if (player->playerstate == PST_DEAD)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
LUAh_PlayerThink(player);
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If it is set, start subtracting
|
// If it is set, start subtracting
|
||||||
// Don't allow it to go back to 0
|
// Don't allow it to go back to 0
|
||||||
|
@ -8432,7 +8442,9 @@ void P_PlayerThink(player_t *player)
|
||||||
else
|
else
|
||||||
player->mo->flags2 &= ~MF2_SHADOW;
|
player->mo->flags2 &= ~MF2_SHADOW;
|
||||||
P_DeathThink(player);
|
P_DeathThink(player);
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
LUAh_PlayerThink(player);
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8566,6 +8578,12 @@ void P_PlayerThink(player_t *player)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
P_MovePlayer(player);
|
P_MovePlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
LUAh_PlayerThink(player);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (!player->mo)
|
if (!player->mo)
|
||||||
return; // P_MovePlayer removed player->mo.
|
return; // P_MovePlayer removed player->mo.
|
||||||
|
|
Loading…
Reference in a new issue