TTT2
TTT2 copied to clipboard
ConVars: utilize globals for CreateConVar flags
Is your feature request related to a problem? Please describe. Consolidate CreateConVar flags into client/server constants. There's reasonably only a few configurations that matter:
- SERVER-only:
FCVAR_ARCHIVE
,FCVAR_NOTIFY
- CLIENT-only:
FCVAR_ARCHIVE
- SHARED:
FCVAR_ARCHIVE
,FCVAR_NOTIFY
,FCVAR_REPLICATED
Odds and ends:
- Rarely, things are marked as
FCVAR_CHEAT
but those are concommands. -
ttt_damage_own_healthstation
hasFCVAR_NONE
set, which seems like a mistake. -
sh_equip_items.lua
hasFCVAR_SERVER_CAN_EXECUTE
on server-only convars, which doesn't matter if the client doesn't have them defined. - A few client-exclusive convars have
FCVAR_USERINFO
but there's no point in this value being sent to the server if it can't be read. Could be harmlessly added to CLIENT-only scope. - No other
FCVAR
variant is utilized in the code.
Describe the solution you'd like
Add values to the global scope for re-use, so that the intent can be compared against the realm
of the CreateConVar declaration.
-
CV_FLAGS_SERVER = bit.bor(FCVAR_ARCHIVE, FCVAR_NOTIFY)
-
CV_FLAGS_CLIENT= FCVAR_ARCHIVE
-
CV_FLAGS_SHARED = bit.bor(FCVAR_ARCHIVE, FCVAR_NOTIFY, FCVAR_REPLICATED)
Describe alternatives you've considered This seems pretty reasonable, I can't imagine anything more clear. A way to define a CreateConVar with an appropriate language string would be nice, but because the localizations exist in the MENU/CLIENT state it's not always possible for the SERVER to use them.
Additional context A lot of things broke recently because some silent error handling for ClientCreateConVar stopped happening, and it brought it to my attention to pay more attention to what gets applied when.