quake2ts 0.0.212 → 0.0.214

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.
@@ -3895,9 +3895,18 @@ function createCGameImport(imports, state) {
3895
3895
  },
3896
3896
  // Cvars
3897
3897
  cvar: (name, value, flags) => {
3898
- const existing = imports.host?.cvars?.get(name);
3899
- if (existing) return existing;
3900
- return null;
3898
+ if (!imports.host || !imports.host.cvars) {
3899
+ return null;
3900
+ }
3901
+ const existing = imports.host.cvars.get(name);
3902
+ if (existing) {
3903
+ return existing;
3904
+ }
3905
+ return imports.host.cvars.register({
3906
+ name,
3907
+ defaultValue: value,
3908
+ flags
3909
+ });
3901
3910
  },
3902
3911
  cvar_set: (name, value) => {
3903
3912
  imports.host?.cvars?.setValue(name, value);