brs-js 2.0.12 → 2.0.14
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/dist/dist.js +1 -1
- package/dist/dist.js.map +1 -0
- package/dist/dist.node.js +1 -1
- package/dist/dist.node.js.map +1 -0
- package/dist/dist.web.js +1 -1
- package/dist/dist.web.js.map +1 -0
- package/package.json +1 -1
- package/.babelrc +0 -5
- package/.prettierrc +0 -7
- package/debug/Conf Spacestation.brs +0 -0
- package/debug/Electrks_Feminine_Challenge.brs +0 -0
- package/debug/a5bricks.brs +0 -0
- package/debug/a5p2.2.brs +0 -0
- package/debug/a5p2.brs +0 -0
- package/debug/audio.brs +0 -0
- package/debug/brick a5.brs +0 -0
- package/debug/brick qa.brs +0 -0
- package/debug/brickparty.brs +0 -0
- package/debug/brsv10.brs +0 -0
- package/debug/brsv10brick.brs +0 -0
- package/debug/bruteforce.js +0 -254
- package/debug/click brick.brs +0 -0
- package/debug/clone.html +0 -36
- package/debug/ctf_tileset.brs +0 -0
- package/debug/ctf_tileset_5.brs +0 -0
- package/debug/evil.brs +0 -0
- package/debug/evilwrite.js +0 -390
- package/debug/foo.txt +0 -3080
- package/debug/kenko_big.brs +0 -0
- package/debug/light.brs +0 -0
- package/debug/out.json +0 -105
- package/debug/read.js +0 -30
- package/debug/readSpeed.js +0 -32
- package/debug/readTest.js +0 -45
- package/debug/temp.brs +0 -0
- package/debug/western.brs +0 -0
- package/examples/ATCFort.brs +0 -0
- package/examples/read_example.html +0 -34
- package/examples/read_example.js +0 -21
- package/examples/write_example.js +0 -25
- package/examples/write_planet.html +0 -144
- package/examples/write_simplex.html +0 -82
- package/examples/write_wedge_sphere.html +0 -173
- package/src/constants.ts +0 -6
- package/src/index.ts +0 -15
- package/src/read.ts +0 -57
- package/src/read.v1.ts +0 -99
- package/src/read.v10.ts +0 -185
- package/src/read.v2.ts +0 -102
- package/src/read.v3.ts +0 -111
- package/src/read.v4.ts +0 -112
- package/src/read.v8.ts +0 -172
- package/src/read.v9.ts +0 -181
- package/src/types.ts +0 -341
- package/src/utils.ts +0 -651
- package/src/uuid.ts +0 -78
- package/src/write.ts +0 -287
- package/test/lib.test.js +0 -51
- package/test/utils.test.js +0 -209
- package/tsconfig.json +0 -18
- package/webpack.config.js +0 -64
package/src/types.ts
DELETED
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
export interface BRSBytes extends Uint8Array {
|
|
2
|
-
brsOffset: number;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
type Modify<T, R> = Omit<T, keyof R> & R;
|
|
6
|
-
|
|
7
|
-
export type Bytes = Uint8Array | BRSBytes;
|
|
8
|
-
export type Uuid = string;
|
|
9
|
-
|
|
10
|
-
export type UnrealClass = string;
|
|
11
|
-
export type UnrealObject = string;
|
|
12
|
-
export type UnrealBoolean = boolean;
|
|
13
|
-
export type UnrealFloat = number;
|
|
14
|
-
export type UnrealColor = [number, number, number, number];
|
|
15
|
-
export type UnrealByte = number;
|
|
16
|
-
export type UnrealRotator = [number, number, number];
|
|
17
|
-
export type UnrealString = string;
|
|
18
|
-
export type UnrealType =
|
|
19
|
-
| UnrealClass
|
|
20
|
-
| UnrealObject
|
|
21
|
-
| UnrealBoolean
|
|
22
|
-
| UnrealFloat
|
|
23
|
-
| UnrealColor
|
|
24
|
-
| UnrealByte
|
|
25
|
-
| UnrealRotator
|
|
26
|
-
| UnrealString;
|
|
27
|
-
|
|
28
|
-
type UnrealTypeFromString<T> = T extends 'Class'
|
|
29
|
-
? UnrealClass
|
|
30
|
-
: T extends 'Object'
|
|
31
|
-
? UnrealObject
|
|
32
|
-
: T extends 'Boolean'
|
|
33
|
-
? UnrealBoolean
|
|
34
|
-
: T extends 'Float'
|
|
35
|
-
? UnrealFloat
|
|
36
|
-
: T extends 'Color'
|
|
37
|
-
? UnrealColor
|
|
38
|
-
: T extends 'Byte'
|
|
39
|
-
? UnrealByte
|
|
40
|
-
: T extends 'Rotator'
|
|
41
|
-
? UnrealRotator
|
|
42
|
-
: T extends 'String'
|
|
43
|
-
? UnrealString
|
|
44
|
-
: UnrealType;
|
|
45
|
-
|
|
46
|
-
export interface User {
|
|
47
|
-
id: Uuid;
|
|
48
|
-
name: string;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface Owner extends User {
|
|
52
|
-
bricks: number;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export enum Direction {
|
|
56
|
-
XPositive,
|
|
57
|
-
XNegative,
|
|
58
|
-
YPositive,
|
|
59
|
-
YNegative,
|
|
60
|
-
ZPositive,
|
|
61
|
-
ZNegative,
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export enum Rotation {
|
|
65
|
-
Deg0,
|
|
66
|
-
Deg90,
|
|
67
|
-
Deg180,
|
|
68
|
-
Deg270,
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export type ColorRgb = [number, number, number];
|
|
72
|
-
|
|
73
|
-
export interface Collision {
|
|
74
|
-
player: boolean;
|
|
75
|
-
weapon: boolean;
|
|
76
|
-
interaction: boolean;
|
|
77
|
-
tool: boolean;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface AppliedComponent {
|
|
81
|
-
[property: string]: UnrealType;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface UnknownComponents {
|
|
85
|
-
[component_name: string]: {
|
|
86
|
-
version: number;
|
|
87
|
-
brick_indices?: number[];
|
|
88
|
-
properties: { [property: string]: string };
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export type KnownComponents = {
|
|
93
|
-
BCD_SpotLight: {
|
|
94
|
-
version: 1;
|
|
95
|
-
brick_indices?: number[];
|
|
96
|
-
properties: {
|
|
97
|
-
Rotation: 'Rotator';
|
|
98
|
-
InnerConeAngle: 'Float';
|
|
99
|
-
OuterConeAngle: 'Float';
|
|
100
|
-
Brightness: 'Float';
|
|
101
|
-
Radius: 'Float';
|
|
102
|
-
Color: 'Color';
|
|
103
|
-
bUseBrickColor: 'Boolean';
|
|
104
|
-
bCastShadows: 'Boolean';
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
BCD_PointLight: {
|
|
108
|
-
version: 1;
|
|
109
|
-
brick_indices?: number[];
|
|
110
|
-
properties: {
|
|
111
|
-
bMatchBrickShape: 'Boolean';
|
|
112
|
-
Brightness: 'Float';
|
|
113
|
-
Radius: 'Float';
|
|
114
|
-
Color: 'Color';
|
|
115
|
-
bUseBrickColor: 'Boolean';
|
|
116
|
-
bCastShadows: 'Boolean';
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
BCD_ItemSpawn: {
|
|
120
|
-
version: 1;
|
|
121
|
-
brick_indices?: number[];
|
|
122
|
-
properties: {
|
|
123
|
-
PickupClass: 'Class';
|
|
124
|
-
bPickupEnabled: 'Boolean';
|
|
125
|
-
bPickupRespawnOnMinigameReset: 'Boolean';
|
|
126
|
-
PickupMinigameResetRespawnDelay: 'Float';
|
|
127
|
-
bPickupAutoDisableOnPickup: 'Boolean';
|
|
128
|
-
PickupRespawnTime: 'Float';
|
|
129
|
-
PickupOffsetDirection: 'Byte';
|
|
130
|
-
PickupOffsetDistance: 'Float';
|
|
131
|
-
PickupRotation: 'Rotator';
|
|
132
|
-
PickupScale: 'Float';
|
|
133
|
-
bPickupAnimationEnabled: 'Boolean';
|
|
134
|
-
PickupAnimationAxis: 'Byte';
|
|
135
|
-
bPickupAnimationAxisLocal: 'Boolean';
|
|
136
|
-
PickupSpinSpeed: 'Float';
|
|
137
|
-
PickupBobSpeed: 'Float';
|
|
138
|
-
PickupBobHeight: 'Float';
|
|
139
|
-
PickupAnimationPhase: 'Float';
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
BCD_Interact: {
|
|
143
|
-
version: 1;
|
|
144
|
-
brick_indices?: number[];
|
|
145
|
-
properties: {
|
|
146
|
-
bPlayInteractSound: 'Boolean';
|
|
147
|
-
Message: 'String';
|
|
148
|
-
ConsoleTag: 'String';
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
BCD_AudioEmitter: {
|
|
152
|
-
version: 1;
|
|
153
|
-
brick_indices?: number[];
|
|
154
|
-
properties: {
|
|
155
|
-
AudioDescriptor: 'Object';
|
|
156
|
-
VolumeMultiplier: 'Float';
|
|
157
|
-
PitchMultiplier: 'Float';
|
|
158
|
-
InnerRadius: 'Float';
|
|
159
|
-
MaxDistance: 'Float';
|
|
160
|
-
bSpatialization: 'Boolean';
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
export interface DefinedComponents
|
|
166
|
-
extends UnknownComponents,
|
|
167
|
-
Partial<KnownComponents> {}
|
|
168
|
-
|
|
169
|
-
export type Components<C extends DefinedComponents> = {
|
|
170
|
-
[T in keyof C]: {
|
|
171
|
-
[V in keyof C[T]['properties']]: UnrealTypeFromString<
|
|
172
|
-
C[T]['properties'][V]
|
|
173
|
-
>;
|
|
174
|
-
};
|
|
175
|
-
} & { [component_name: string]: AppliedComponent };
|
|
176
|
-
|
|
177
|
-
export type Vector = [number, number, number];
|
|
178
|
-
|
|
179
|
-
export interface BrickV1 {
|
|
180
|
-
asset_name_index: number;
|
|
181
|
-
size: Vector;
|
|
182
|
-
position: Vector;
|
|
183
|
-
direction: Direction;
|
|
184
|
-
rotation: Rotation;
|
|
185
|
-
collision: boolean;
|
|
186
|
-
visibility: boolean;
|
|
187
|
-
color: UnrealColor | number;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export interface BrickV2 extends BrickV1 {
|
|
191
|
-
material_index: number;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export interface BrickV3 extends BrickV2 {
|
|
195
|
-
owner_index: number;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
export interface BrickV8 extends BrickV3 {
|
|
199
|
-
components: Components<DefinedComponents>;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export type BrickV9 = Modify<
|
|
203
|
-
BrickV8,
|
|
204
|
-
{
|
|
205
|
-
physical_index: number;
|
|
206
|
-
material_intensity: number;
|
|
207
|
-
color: ColorRgb | number;
|
|
208
|
-
}
|
|
209
|
-
>;
|
|
210
|
-
|
|
211
|
-
export type BrickV10 = Modify<
|
|
212
|
-
BrickV9,
|
|
213
|
-
{
|
|
214
|
-
collision: Collision;
|
|
215
|
-
}
|
|
216
|
-
>;
|
|
217
|
-
|
|
218
|
-
export interface BrsV1 {
|
|
219
|
-
version: 1;
|
|
220
|
-
map: string;
|
|
221
|
-
author: User;
|
|
222
|
-
description: string;
|
|
223
|
-
brick_count: number;
|
|
224
|
-
mods: string[];
|
|
225
|
-
brick_assets: string[];
|
|
226
|
-
colors: UnrealColor[];
|
|
227
|
-
bricks: BrickV1[];
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
export type BrsV2 = Modify<
|
|
231
|
-
BrsV1,
|
|
232
|
-
{
|
|
233
|
-
version: 2;
|
|
234
|
-
materials: string[];
|
|
235
|
-
bricks: BrickV2[];
|
|
236
|
-
}
|
|
237
|
-
>;
|
|
238
|
-
|
|
239
|
-
export type BrsV3 = Modify<
|
|
240
|
-
BrsV2,
|
|
241
|
-
{
|
|
242
|
-
version: 3;
|
|
243
|
-
brick_owners: User[];
|
|
244
|
-
bricks: BrickV3[];
|
|
245
|
-
}
|
|
246
|
-
>;
|
|
247
|
-
|
|
248
|
-
export type BrsV4 = Modify<
|
|
249
|
-
BrsV3,
|
|
250
|
-
{
|
|
251
|
-
version: 4;
|
|
252
|
-
save_time: Uint8Array;
|
|
253
|
-
}
|
|
254
|
-
>;
|
|
255
|
-
|
|
256
|
-
// not sure what part of 8 makes up 5-7 but nobody should have any saves in those versions
|
|
257
|
-
|
|
258
|
-
export type BrsV8 = Modify<
|
|
259
|
-
BrsV4,
|
|
260
|
-
{
|
|
261
|
-
version: 8;
|
|
262
|
-
host: User;
|
|
263
|
-
brick_owners: Owner[];
|
|
264
|
-
preview?: Bytes;
|
|
265
|
-
game_version: number;
|
|
266
|
-
bricks: BrickV8[];
|
|
267
|
-
components: DefinedComponents;
|
|
268
|
-
}
|
|
269
|
-
>;
|
|
270
|
-
|
|
271
|
-
export type BrsV9 = Modify<
|
|
272
|
-
BrsV8,
|
|
273
|
-
{
|
|
274
|
-
version: 9;
|
|
275
|
-
physical_materials: string[];
|
|
276
|
-
bricks: BrickV9[];
|
|
277
|
-
}
|
|
278
|
-
>;
|
|
279
|
-
|
|
280
|
-
export type BrsV10 = Modify<
|
|
281
|
-
BrsV9,
|
|
282
|
-
{
|
|
283
|
-
version: 10;
|
|
284
|
-
bricks: BrickV10[];
|
|
285
|
-
}
|
|
286
|
-
>;
|
|
287
|
-
|
|
288
|
-
// a save read from a file
|
|
289
|
-
export type ReadSaveObject =
|
|
290
|
-
| BrsV1
|
|
291
|
-
| BrsV2
|
|
292
|
-
| BrsV3
|
|
293
|
-
| BrsV4
|
|
294
|
-
| BrsV8
|
|
295
|
-
| BrsV9
|
|
296
|
-
| BrsV10;
|
|
297
|
-
|
|
298
|
-
// a brick a user provides
|
|
299
|
-
export interface Brick {
|
|
300
|
-
asset_name_index?: number;
|
|
301
|
-
size: Vector;
|
|
302
|
-
position: Vector;
|
|
303
|
-
direction?: Direction;
|
|
304
|
-
rotation?: Rotation;
|
|
305
|
-
collision?: boolean | Partial<Collision>;
|
|
306
|
-
visibility?: boolean;
|
|
307
|
-
material_index?: number;
|
|
308
|
-
physical_index?: number;
|
|
309
|
-
material_intensity?: number;
|
|
310
|
-
color?: ColorRgb | number | UnrealColor | number[];
|
|
311
|
-
owner_index?: number;
|
|
312
|
-
components?: Components<DefinedComponents>;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
// save a user can write
|
|
316
|
-
export interface WriteSaveObject {
|
|
317
|
-
game_version?: number;
|
|
318
|
-
map?: string;
|
|
319
|
-
description?: string;
|
|
320
|
-
author?: Partial<User>;
|
|
321
|
-
host?: Partial<User>;
|
|
322
|
-
mods?: string[];
|
|
323
|
-
brick_assets?: string[];
|
|
324
|
-
colors?: UnrealColor[];
|
|
325
|
-
materials?: string[];
|
|
326
|
-
brick_owners?: Partial<Owner>[];
|
|
327
|
-
physical_materials?: string[];
|
|
328
|
-
preview?: Bytes;
|
|
329
|
-
bricks: Brick[];
|
|
330
|
-
save_time?: ArrayLike<number>;
|
|
331
|
-
components?: DefinedComponents;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
export interface ReadOptions {
|
|
335
|
-
bricks?: boolean;
|
|
336
|
-
preview?: boolean;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
export interface WriteOptions {
|
|
340
|
-
compress?: boolean;
|
|
341
|
-
}
|