s2cfgtojson 4.2.1 → 4.2.2

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.
package/Struct.mts CHANGED
@@ -114,10 +114,15 @@ export class Struct {
114
114
  }
115
115
 
116
116
  clone() {
117
- const isRoot = this.__internal__.isRoot;
118
- this.__internal__.isRoot = true;
119
- const newInstance = Struct.fromString(this.toString())[0] as this;
120
- this.__internal__.isRoot = isRoot;
117
+ const newInstance = new Struct() as typeof this;
118
+ newInstance.__internal__ = new Refs(this.__internal__);
119
+ this.forEach(([k, v]) => {
120
+ if (v instanceof Struct) {
121
+ newInstance[k] = v.clone();
122
+ } else {
123
+ newInstance[k] = v;
124
+ }
125
+ });
121
126
  return newInstance;
122
127
  }
123
128
 
package/Struct.test.mts CHANGED
@@ -311,6 +311,7 @@ struct.end`;
311
311
  const b = a.clone() as TradePrototype;
312
312
 
313
313
  expect(a === b).toBe(false);
314
+ expect(a.TradeGenerators === b.TradeGenerators).toBe(false);
314
315
  expect(a.toString()).toBe(b.toString());
315
316
  });
316
317
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "s2cfgtojson",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "description": "Converts Stalker 2 Cfg file into POJOs",
5
5
  "keywords": [
6
6
  "stalker",