s2cfgtojson 2.1.2 → 2.1.4
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 +3 -24
- package/Struct.test.mts +6 -6
- package/package.json +1 -1
- package/types.mts +1745 -0
package/Struct.mts
CHANGED
|
@@ -1,33 +1,12 @@
|
|
|
1
|
-
export type Value = Omit<Struct, "toTs"> | string | boolean | number;
|
|
2
1
|
const defaultEntries = new Set(["_isArray", "_useAsterisk"]);
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export type GetTsType<In extends Struct, E = In["entries"]> = {
|
|
7
|
-
[key in Exclude<keyof E, keyof DefaultEntries>]: E[key] extends Struct
|
|
8
|
-
? GetTsType<E[key]>
|
|
9
|
-
: E[key];
|
|
10
|
-
};
|
|
11
|
-
type RKey<In> = Exclude<keyof In, keyof DefaultEntries>;
|
|
12
|
-
|
|
13
|
-
export type GetStructType<In> =
|
|
14
|
-
In extends Array<any>
|
|
15
|
-
? Struct<{ [key: number]: GetStructType<In[number]> }>
|
|
16
|
-
: In extends Record<any, any>
|
|
17
|
-
? Struct<{ [key in RKey<In>]: GetStructType<In[key]> }>
|
|
18
|
-
: In extends string
|
|
19
|
-
? In
|
|
20
|
-
: In extends number
|
|
21
|
-
? number
|
|
22
|
-
: In extends boolean
|
|
23
|
-
? boolean
|
|
24
|
-
: never;
|
|
2
|
+
export * from "./types.mts";
|
|
3
|
+
import { DefaultEntries, Value, Entries, Struct as IStruct } from "./types.mts";
|
|
25
4
|
|
|
26
5
|
/**
|
|
27
6
|
* This file is part of the Stalker 2 Modding Tools project.
|
|
28
7
|
* This is a base class for all structs.
|
|
29
8
|
*/
|
|
30
|
-
export abstract class Struct<T extends Entries = {}> {
|
|
9
|
+
export abstract class Struct<T extends Entries = {}> implements IStruct<T> {
|
|
31
10
|
isRoot?: boolean;
|
|
32
11
|
refurl?: string;
|
|
33
12
|
refkey?: string | number;
|
package/Struct.test.mts
CHANGED
|
@@ -83,13 +83,13 @@ struct.end`,
|
|
|
83
83
|
TriggeredCooldowns : struct.begin
|
|
84
84
|
[0] : struct.begin
|
|
85
85
|
CooldownTag = Ability.Cooldown.RunAttack
|
|
86
|
-
Duration = 50
|
|
86
|
+
Duration = 50
|
|
87
87
|
struct.end
|
|
88
88
|
struct.end
|
|
89
89
|
Effects : struct.begin
|
|
90
90
|
[0] : struct.begin
|
|
91
91
|
EffectPrototypeSID = MutantMediumAttackCameraShake
|
|
92
|
-
Chance = 1
|
|
92
|
+
Chance = 1
|
|
93
93
|
struct.end
|
|
94
94
|
struct.end
|
|
95
95
|
struct.end`;
|
|
@@ -129,8 +129,8 @@ struct.end`;
|
|
|
129
129
|
[0] : struct.begin
|
|
130
130
|
ItemPrototypeSID = DutyArmor_3_U1
|
|
131
131
|
Weight = 1
|
|
132
|
-
MinDurability = 1
|
|
133
|
-
MaxDurability = 1
|
|
132
|
+
MinDurability = 1
|
|
133
|
+
MaxDurability = 1
|
|
134
134
|
struct.end
|
|
135
135
|
struct.end
|
|
136
136
|
struct.end
|
|
@@ -176,8 +176,8 @@ struct.end`;
|
|
|
176
176
|
[0] : struct.begin
|
|
177
177
|
ItemPrototypeSID = DutyMask_1
|
|
178
178
|
Weight = 2
|
|
179
|
-
MinDurability = 1
|
|
180
|
-
MaxDurability = 1
|
|
179
|
+
MinDurability = 1
|
|
180
|
+
MaxDurability = 1
|
|
181
181
|
struct.end
|
|
182
182
|
struct.end
|
|
183
183
|
struct.end
|