quake2ts 0.0.212 → 0.0.213

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3864,9 +3864,18 @@ function createCGameImport(imports, state) {
3864
3864
  },
3865
3865
  // Cvars
3866
3866
  cvar: (name, value, flags) => {
3867
- const existing = imports.host?.cvars?.get(name);
3868
- if (existing) return existing;
3869
- return null;
3867
+ if (!imports.host || !imports.host.cvars) {
3868
+ return null;
3869
+ }
3870
+ const existing = imports.host.cvars.get(name);
3871
+ if (existing) {
3872
+ return existing;
3873
+ }
3874
+ return imports.host.cvars.register({
3875
+ name,
3876
+ defaultValue: value,
3877
+ flags
3878
+ });
3870
3879
  },
3871
3880
  cvar_set: (name, value) => {
3872
3881
  imports.host?.cvars?.setValue(name, value);