Lua: Hook PlayerMsg to code, remove vestigial mute variable from it¨

This commit is contained in:
JugadorXEI 2025-08-15 19:54:46 +02:00
parent 294e60bf8d
commit c4464fa87c
3 changed files with 5 additions and 3 deletions

View file

@ -705,6 +705,9 @@ static void Got_Saycmd(const UINT8 **p, INT32 playernum)
}
}
}
if (LUA_HookPlayerMsg(playernum, target, flags, msg))
return;
// If it's a CSAY, just CECHO and be done with it.
if (flags & HU_CSAY)

View file

@ -137,7 +137,7 @@ int LUA_HookMobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
int LUA_HookMobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype);
int LUA_HookMobjMoveBlocked(mobj_t *, mobj_t *, line_t *);
void LUA_HookSpecialExecute(activator_t *activator, INT32 *args, char **stringargs);
int LUA_HookPlayerMsg(int source, int target, int flags, char *msg, int mute);
int LUA_HookPlayerMsg(int source, int target, int flags, char *msg);
int LUA_HookHurtMsg(player_t *, mobj_t *inflictor, mobj_t *source, UINT8 damagetype);
int LUA_HookMapThingSpawn(mobj_t *, mapthing_t *);
int LUA_HookFollowMobj(player_t *, mobj_t *);

View file

@ -842,7 +842,7 @@ void LUA_HookSpecialExecute(activator_t *activator, INT32 *args, char **stringar
}
}
int LUA_HookPlayerMsg(int source, int target, int flags, char *msg, int mute)
int LUA_HookPlayerMsg(int source, int target, int flags, char *msg)
{
Hook_State hook;
if (prepare_hook(&hook, false, HOOK(PlayerMsg)))
@ -862,7 +862,6 @@ int LUA_HookPlayerMsg(int source, int target, int flags, char *msg, int mute)
LUA_PushUserdata(gL, &players[target-1], META_PLAYER); // target
}
lua_pushstring(gL, msg); // msg
lua_pushboolean(gL, mute); // the message was supposed to be eaten by spamprotecc.
call_hooks(&hook, 1, res_true);
}