mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Merge branch 'playerspawn-hook' into 'next'
Add PlayerSpawn hook to Lua I don't know how I did this but I did. Something about staring at code from 3AM till 5AM... Here's a test script too: ```Lua addHook("PlayerSpawn", function(player) player.health = 99 end) ``` See merge request !48
This commit is contained in:
commit
4302cfaa00
3 changed files with 8 additions and 0 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -53,6 +53,7 @@ const char *const hookNames[hook_MAX+1] = {
|
|||
"LinedefExecute",
|
||||
"PlayerMsg",
|
||||
"HurtMsg",
|
||||
"PlayerSpawn",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue