Add PlayerSpawn hook

This commit is contained in:
wolfy852 committed 2016-02-14 06:10:20 -06:00
1 parent 5d1c8d2968
commit db3797fd35
3 files changed
+9

No files matched your search

+2
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
+1
View File
@@ -53,6 +53,7 @@ const char *const hookNames[hook_MAX+1] = {
"LinedefExecute",
"PlayerMsg",
"HurtMsg",
"PlayerSpawn",
NULL
};
+6
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)