From 72133b74985f9862669ab8dab46ed80cd7b45343 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sat, 26 Jan 2019 16:55:26 +0100 Subject: [PATCH] No more ghetto check, and some more descriptive comments on the Hook --- src/g_game.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index d93a2e9f..58787495 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1612,10 +1612,18 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) } } - // Lua: Allow this hook to overwrite ticcmd. - // Be aware that you can't actually write anything inside the player with this hook, only cmd may be altered. + /* Lua: Allow this hook to overwrite ticcmd. + We check if we're actually in a level because for some reason this Hook would run in menus and on the titlescreen otherwise. + Be aware that within this hook, nothing but this player's cmd can be edited (otherwise we'd run in some pretty bad synching problems since this is clientsided, or something) + + Possible usages for this are: + -Forcing the player to perform an action, which could otherwise require terrible, terrible hacking to replicate. + -Preventing the player to perform an action, which would ALSO require some weirdo hacks. + -Making some galaxy brain autopilot Lua if you're a masochist + -Making a Mario Kart 8 Deluxe tier baby mode that steers you away from walls and whatnot. You know what, do what you want! + */ #ifdef HAVE_BLUA - if (playeringame[consoleplayer]) // safe to assume we can't do anything if consoleplayer isn't in the game. + if (gamestate == GS_LEVEL) LUAh_PlayerCmd(player, cmd); #endif