mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
Merge branch 'playerthink-hook' into 'next'
PlayerThink Hook See merge request STJr/SRB2!557
This commit is contained in:
commit
a16c444166
3 changed files with 32 additions and 1 deletions
|
@ -57,6 +57,7 @@ enum hook {
|
|||
hook_TeamSwitch,
|
||||
hook_ViewpointSwitch,
|
||||
hook_SeenPlayer,
|
||||
hook_PlayerThink,
|
||||
|
||||
hook_MAX // last hook
|
||||
};
|
||||
|
@ -108,5 +109,6 @@ UINT8 LUAh_ViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean
|
|||
#ifdef SEENAMES
|
||||
boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend); // Hook for MT_NAMECHECK
|
||||
#endif
|
||||
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,6 +68,7 @@ const char *const hookNames[hook_MAX+1] = {
|
|||
"TeamSwitch",
|
||||
"ViewpointSwitch",
|
||||
"SeenPlayer",
|
||||
"PlayerThink",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -216,6 +217,7 @@ static int lib_addHook(lua_State *L)
|
|||
case hook_SeenPlayer:
|
||||
case hook_ShieldSpawn:
|
||||
case hook_ShieldSpecial:
|
||||
case hook_PlayerThink:
|
||||
lastp = &playerhooks;
|
||||
break;
|
||||
case hook_LinedefExecute:
|
||||
|
|
29
src/p_user.c
29
src/p_user.c
|
@ -11572,7 +11572,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
|
||||
|
@ -11673,7 +11678,12 @@ void P_PlayerThink(player_t *player)
|
|||
player->lives = 0;
|
||||
|
||||
if (player->playerstate == PST_DEAD)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
LUAh_PlayerThink(player);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11792,7 +11802,9 @@ void P_PlayerThink(player_t *player)
|
|||
{
|
||||
player->mo->flags2 &= ~MF2_SHADOW;
|
||||
P_DeathThink(player);
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUAh_PlayerThink(player);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -11833,7 +11845,12 @@ void P_PlayerThink(player_t *player)
|
|||
if (player->spectator && cmd->buttons & BT_ATTACK && !player->powers[pw_flashing] && G_GametypeHasSpectators())
|
||||
{
|
||||
if (P_SpectatorJoinGame(player))
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
LUAh_PlayerThink(player);
|
||||
#endif
|
||||
return; // player->mo was removed.
|
||||
}
|
||||
}
|
||||
|
||||
// Even if not NiGHTS, pull in nearby objects when walking around as John Q. Elliot.
|
||||
|
@ -11935,7 +11952,12 @@ void P_PlayerThink(player_t *player)
|
|||
}
|
||||
|
||||
if (!player->mo)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
LUAh_PlayerThink(player);
|
||||
#endif
|
||||
return; // P_MovePlayer removed player->mo.
|
||||
}
|
||||
|
||||
// deez New User eXperiences.
|
||||
{
|
||||
|
@ -12367,6 +12389,11 @@ void P_PlayerThink(player_t *player)
|
|||
dashmode = 0;
|
||||
}
|
||||
#undef dashmode
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUAh_PlayerThink(player);
|
||||
#endif
|
||||
|
||||
/*
|
||||
// Colormap verification
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue