Add CV_ADDEDBYLUA, show all Lua cvars on the cheats menu

This commit is contained in:
James R 2023-08-27 02:08:04 -07:00 committed by toaster
parent 30e8d1663d
commit f552791052
4 changed files with 4 additions and 2 deletions

View file

@ -140,6 +140,7 @@ typedef enum
// used on menus
CV_CHEAT = 2048, // Don't let this be used in multiplayer unless cheats are on.
CV_NOLUA = 4096,/* don't let this be called from Lua */
CV_ADDEDBYLUA = 8192,
} cvflags_t;
struct CV_PossibleValue_t

View file

@ -6845,6 +6845,7 @@ struct int_const_s const INT_CONST[] = {
{"CV_HIDDEN",CV_HIDDEN},
{"CV_CHEAT",CV_CHEAT},
{"CV_NOLUA",CV_NOLUA},
{"CV_ADDEDBYLUA",CV_ADDEDBYLUA},
// v_video flags
{"V_NOSCALEPATCH",V_NOSCALEPATCH},

View file

@ -411,7 +411,7 @@ static int lib_cvRegisterVar(lua_State *L)
return luaL_error(L, M_GetText("Variable %s has CV_CALL without a function\n"), cvar->name);
// actually time to register it to the console now! Finally!
cvar->flags |= CV_MODIFIED;
cvar->flags |= CV_MODIFIED | CV_ADDEDBYLUA;
CV_RegisterVar(cvar);
if (cvar->flags & CV_MODIFIED)
return luaL_error(L, "failed to register cvar (probable conflict with internal variable/command names)");

View file

@ -64,7 +64,7 @@ void list_cvars()
{
for (consvar_t* var = consvar_vars; var; var = var->next)
{
if (!(var->flags & CV_CHEAT))
if (!(var->flags & (CV_CHEAT | CV_ADDEDBYLUA)))
{
continue;
}