RobustToolbox icon indicating copy to clipboard operation
RobustToolbox copied to clipboard

Need way to mark CVars as "do not modify from this point"

Open PJB3005 opened this issue 1 year ago • 0 comments

There are many CVars which are read once during startup and shouldn't be modified after, mostly because their effects wouldn't apply and it would be confusing if you tried.

This is especially complicated because CVars are read during various stages of game init. For example, network properties like send buffer size are read before content gets any chance to initialize (e.g. SS14 config presets), but most engine properties are read later, and many of those still fall under "can't be dynamically changed". While thinking about #5390 I realized any solution here needs to account for both of these cases.

My idea right now is that IConfigurationManager should have a "lock" function, which would be called when the CVar is read by the manager. Presumably, have a combined "read + lock" extension method that can do both in one call for brevity.

I'm not 100% sure whether this should be a hard lock or should simply print an error to console when you try.

PJB3005 avatar Aug 22 '24 23:08 PJB3005