Whenever a cvar changes, this function would be called and would give access to the name of the cvar, and the value changed.
This would allow for, say, an iterator to run and find specific entities and change a value on them. I.e. say we have a separate real-time difficulty adjustment option which allows changing the aggressiveness of custom AI. Using GetCvar often tends to drag down performance, whereas access to a local variable seems a lot cheaper.
I also suggest an actual event because not everyone would realize that they would otherwise have to build a NetworkEvent-managed CVar changer, and perform a lot of string splitting just to make it work for strings in particular.
User cvars would include the player number 0-7 while server cvars would set it to -1.
World Event: OnCvar(String/Color/Number)Changed
Moderator: GZDoom Developers
- Major Cooke
- Posts: 8175
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: World Event: OnCvar(String/Color/Number)Changed
I'm honestly a bit dubious about this one.
Part of me wants to enable this only for CVARs that get defined in CVARINFO, unless the CVAR itself has CVAR_SERVERINFO or CVAR_USERINFO set on itself.
Or - enable it for any CVAR but only in the UI context, which means it would require net events in order to affect the playsim.
Part of me wants to enable this only for CVARs that get defined in CVARINFO, unless the CVAR itself has CVAR_SERVERINFO or CVAR_USERINFO set on itself.
Or - enable it for any CVAR but only in the UI context, which means it would require net events in order to affect the playsim.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: World Event: OnCvar(String/Color/Number)Changed
Agreed. Aside from that it's also rather invasive. The devil is buried in the details which I'd rather not deal with.
- Major Cooke
- Posts: 8175
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: World Event: OnCvar(String/Color/Number)Changed
CVARINFO is actually just what I need it for. But I understand. I'll just incorporate a network event version for my menu items.