Call LUA_HookLinedefExecute from LUA_HookSpecialExecute

Lets me directly use activator and means cleaner looking special code
This commit is contained in:
NepDisk 2025-05-10 08:51:45 -04:00
parent f5f878e2eb
commit 1790eb413c
2 changed files with 9 additions and 6 deletions

View file

@ -901,6 +901,7 @@ int LUA_HookMobjMoveBlocked(mobj_t *t1, mobj_t *t2, line_t *line)
return hook.status;
}
// Backwards Compatability For older scripts
void LUA_HookLinedefExecute(line_t *line, mobj_t *mo, sector_t *sector)
{
Hook_State hook;
@ -922,6 +923,13 @@ void LUA_HookLinedefExecute(line_t *line, mobj_t *mo, sector_t *sector)
void LUA_HookSpecialExecute(activator_t *activator, INT32 *args, char **stringargs)
{
Hook_State hook;
if (activator->line)
{
// Run the old hook if possible.
LUA_HookLinedefExecute(activator->line, activator->mo, activator->sector);
}
if (prepare_string_hook
(&hook, 0, STRING_HOOK(SpecialExecute), stringargs[0]))
{

View file

@ -3459,12 +3459,7 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha
if (stringargs[0])
{
if (line && mo && callsec)
{
// Allow running the old hook as well.
LUA_HookLinedefExecute(line, mo, callsec);
}
// Also executes the old hook as well.
LUA_HookSpecialExecute(activator, args, stringargs);
}
else