mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-05 15:43:08 +00:00
VoteThinker Hook for Lua
This commit is contained in:
parent
e801057559
commit
af4922b53e
3 changed files with 28 additions and 0 deletions
|
|
@ -52,6 +52,7 @@ enum hook {
|
||||||
hook_PlayerSquish, //SRB2KART
|
hook_PlayerSquish, //SRB2KART
|
||||||
hook_PlayerCmd, //SRB2KART
|
hook_PlayerCmd, //SRB2KART
|
||||||
hook_IntermissionThinker, //SRB2KART
|
hook_IntermissionThinker, //SRB2KART
|
||||||
|
hook_VoteThinker, //SRB2KART
|
||||||
|
|
||||||
hook_MAX // last hook
|
hook_MAX // last hook
|
||||||
};
|
};
|
||||||
|
|
@ -101,5 +102,6 @@ boolean LUAh_PlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source);
|
||||||
boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Allows to write to player cmd before the game does anything with them.
|
boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Allows to write to player cmd before the game does anything with them.
|
||||||
|
|
||||||
void LUAh_IntermissionThinker(void); // Hook for Y_Ticker
|
void LUAh_IntermissionThinker(void); // Hook for Y_Ticker
|
||||||
|
void LUAh_VoteThinker(void); // Hook for Y_VoteTicker
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ const char *const hookNames[hook_MAX+1] = {
|
||||||
"PlayerSquish",
|
"PlayerSquish",
|
||||||
"PlayerCmd",
|
"PlayerCmd",
|
||||||
"IntermissionThinker",
|
"IntermissionThinker",
|
||||||
|
"VoteThinker",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -442,6 +443,27 @@ void LUAh_IntermissionThinker(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hook for Y_VoteTicker
|
||||||
|
void LUAh_VoteThinker(void)
|
||||||
|
{
|
||||||
|
hook_p hookp;
|
||||||
|
if (!gL || !(hooksAvailable[hook_VoteThinker/8] & (1<<(hook_VoteThinker%8))))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (hookp = roothook; hookp; hookp = hookp->next)
|
||||||
|
if (hookp->type == hook_VoteThinker)
|
||||||
|
{
|
||||||
|
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||||
|
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||||
|
if (lua_pcall(gL, 0, 0, 0)) {
|
||||||
|
if (!hookp->error || cv_debug & DBG_LUA)
|
||||||
|
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||||
|
lua_pop(gL, 1);
|
||||||
|
hookp->error = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Hook for mobj collisions
|
// Hook for mobj collisions
|
||||||
UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which)
|
UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which)
|
||||||
|
|
|
||||||
|
|
@ -1251,6 +1251,10 @@ void Y_VoteTicker(void)
|
||||||
if (paused || P_AutoPause() || !voteclient.loaded)
|
if (paused || P_AutoPause() || !voteclient.loaded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
LUAh_VoteThinker();
|
||||||
|
#endif
|
||||||
|
|
||||||
votetic++;
|
votetic++;
|
||||||
|
|
||||||
if (votetic == voteendtic)
|
if (votetic == voteendtic)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue