Add PlayerSpawn hook

This commit is contained in:
wolfy852 2016-02-14 05:19:40 -06:00
parent 5d1c8d2968
commit db3797fd35
3 changed files with 9 additions and 0 deletions

View File

@ -42,6 +42,7 @@ enum hook {
hook_LinedefExecute,
hook_PlayerMsg,
hook_HurtMsg,
hook_PlayerSpawn,
hook_MAX // last hook
};
@ -75,5 +76,6 @@ boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_B
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for P_SpawnPlayer
#endif

View File

@ -53,6 +53,7 @@ const char *const hookNames[hook_MAX+1] = {
"LinedefExecute",
"PlayerMsg",
"HurtMsg",
"PlayerSpawn",
NULL
};

View File

@ -8294,6 +8294,12 @@ void P_SpawnPlayer(INT32 playernum)
// Spawn with a pity shield if necessary.
P_DoPityCheck(p);
#ifdef HAVE_BLUA
if (LUAh_PlayerSpawn(p)) // Lua hook for player spawning :)
;
#endif
}
void P_AfterPlayerSpawn(INT32 playernum)