Push race countdowns and functions to set them

This commit is contained in:
Latapostrophe 2020-03-10 12:57:30 +01:00
parent 8c00331c2b
commit 2e5608d33b
2 changed files with 45 additions and 6 deletions

View File

@ -9891,18 +9891,12 @@ static inline int lib_getenum(lua_State *L)
return 0;
LUA_PushUserdata(L, &players[adminplayers[0]], META_PLAYER);
return 1;*/
} else if (fastcmp(word,"emeralds")) {
lua_pushinteger(L, emeralds);
return 1;
} else if (fastcmp(word,"gravity")) {
lua_pushinteger(L, gravity);
return 1;
} else if (fastcmp(word,"VERSIONSTRING")) {
lua_pushstring(L, VERSIONSTRING);
return 1;
} else if (fastcmp(word, "token")) {
lua_pushinteger(L, token);
return 1;
} else if (fastcmp(word,"gamespeed")) {
lua_pushinteger(L, gamespeed);
return 1;
@ -9936,6 +9930,12 @@ static inline int lib_getenum(lua_State *L)
} else if (fastcmp(word,"numlaps")) {
lua_pushinteger(L, cv_numlaps.value);
return 1;
} else if (fastcmp(word,"racecountdown")) {
lua_pushinteger(L, countdown);
return 1;
} else if (fastcmp(word,"exitcountdown")) {
lua_pushinteger(L, countdown2); // This name is pretty dumb. Hence why we'll prefer more descriptive names at least in Lua...
return 1;
}
return 0;
}

View File

@ -2641,6 +2641,41 @@ static int lib_kGetItemPatch(lua_State *L)
return 1;
}
// sets the remaining time before players blow up
static int lib_kSetRaceCountdown(lua_State *L)
{
tic_t c = (tic_t)luaL_checkinteger(L, 1);
countdown = c;
return 0;
}
// sets the remaining time before the race ends after everyone finishes
static int lib_kSetExitCountdown(lua_State *L)
{
tic_t c = (tic_t)luaL_checkinteger(L, 1);
NOHUD
countdown2 = c;
return 0;
}
// Sets the item cooldown before another shrink / SPB can be rolled
static int lib_kSetIndirectItemCountdown(lua_State *L)
{
tic_t c = (tic_t)luaL_checkinteger(L, 1);
NOHUD
indirectitemcooldown = c;
return 0;
}
// Sets the item cooldown before another shrink / SPB can be rolled
static int lib_kSetHyuCountdown(lua_State *L)
{
tic_t c = (tic_t)luaL_checkinteger(L, 1);
NOHUD
hyubgone = c;
return 0;
}
static luaL_Reg lib[] = {
{"print", lib_print},
{"chatprint", lib_chatprint},
@ -2868,6 +2903,10 @@ static luaL_Reg lib[] = {
{"K_GetKartAccel",lib_kGetKartAccel},
{"K_GetKartFlashing",lib_kGetKartFlashing},
{"K_GetItemPatch",lib_kGetItemPatch},
{"K_SetRaceCountdown",lib_kSetRaceCountdown},
{"K_SetExitCountdown",lib_kSetExitCountdown},
{"K_SetIndirectItemCooldown",lib_kSetIndirectItemCountdown},
{"K_SetHyudoroCooldown",lib_kSetHyuCountdown},
{NULL, NULL}
};