diff --git a/src/g_game.c b/src/g_game.c index b94c590c..3b7ef158 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2331,6 +2331,11 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) } } P_MovePlayerToSpawn(playernum, spawnpoint); + +#ifdef HAVE_BLUA + LUAh_PlayerSpawn(&players[playernum]); // Lua hook for player spawning :) +#endif + } mapthing_t *G_FindCTFStart(INT32 playernum) diff --git a/src/lua_hook.h b/src/lua_hook.h index da2dcdc3..4eb08378 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -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 G_SpawnPlayer #endif diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 5230886a..2c1aa1ce 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -53,6 +53,7 @@ const char *const hookNames[hook_MAX+1] = { "LinedefExecute", "PlayerMsg", "HurtMsg", + "PlayerSpawn", NULL };