brs-js 2.0.0 → 2.0.1

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/src/types.ts DELETED
@@ -1,240 +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 UnrealType =
18
- | UnrealClass
19
- | UnrealObject
20
- | UnrealBoolean
21
- | UnrealFloat
22
- | UnrealColor
23
- | UnrealByte
24
- | UnrealRotator;
25
-
26
- export interface User {
27
- id: Uuid;
28
- name: string;
29
- }
30
-
31
- export interface Owner extends User {
32
- bricks: number;
33
- }
34
-
35
- export enum Direction {
36
- XPositive,
37
- XNegative,
38
- YPositive,
39
- YNegative,
40
- ZPositive,
41
- ZNegative,
42
- }
43
-
44
- export enum Rotation {
45
- Deg0,
46
- Deg90,
47
- Deg180,
48
- Deg270,
49
- }
50
-
51
- export type ColorRgb = [number, number, number];
52
-
53
- export interface Collision {
54
- player: boolean;
55
- weapon: boolean;
56
- interaction: boolean;
57
- tool: boolean;
58
- }
59
-
60
- export interface AppliedComponent {
61
- [property: string]: UnrealType;
62
- }
63
-
64
- export interface DefinedComponents {
65
- [component_name: string]: {
66
- version: number;
67
- brick_indices: number[];
68
- properties: { [property: string]: string };
69
- };
70
- }
71
-
72
- export interface Components {
73
- [component_name: string]: AppliedComponent;
74
- }
75
-
76
- export type Vector = [number, number, number];
77
-
78
- export interface BrickV1 {
79
- asset_name_index: number;
80
- size: Vector;
81
- position: Vector;
82
- direction: Direction;
83
- rotation: Rotation;
84
- collision: boolean;
85
- visibility: boolean;
86
- color: UnrealColor | number;
87
- }
88
-
89
- export interface BrickV2 extends BrickV1 {
90
- material_index: number;
91
- }
92
-
93
- export interface BrickV3 extends BrickV2 {
94
- owner_index: number;
95
- }
96
-
97
- export interface BrickV8 extends BrickV3 {
98
- components: Components;
99
- }
100
-
101
- export type BrickV9 = Modify<
102
- BrickV8,
103
- {
104
- physical_index: number;
105
- material_intensity: number;
106
- color: ColorRgb | number;
107
- }
108
- >;
109
-
110
- export type BrickV10 = Modify<
111
- BrickV9,
112
- {
113
- collision: Collision;
114
- }
115
- >;
116
-
117
- export interface BrsV1 {
118
- version: 1;
119
- map: string;
120
- author: User;
121
- description: string;
122
- brick_count: number;
123
- mods: string[];
124
- brick_assets: string[];
125
- colors: UnrealColor[];
126
- bricks: BrickV1[];
127
- }
128
-
129
- export type BrsV2 = Modify<
130
- BrsV1,
131
- {
132
- version: 2;
133
- materials: string[];
134
- bricks: BrickV2[];
135
- }
136
- >;
137
-
138
- export type BrsV3 = Modify<
139
- BrsV2,
140
- {
141
- version: 3;
142
- brick_owners: User[];
143
- bricks: BrickV3[];
144
- }
145
- >;
146
-
147
- export type BrsV4 = Modify<
148
- BrsV3,
149
- {
150
- version: 4;
151
- save_time: Uint8Array;
152
- }
153
- >;
154
-
155
- // not sure what part of 8 makes up 5-7 but nobody should have any saves in those versions
156
-
157
- export type BrsV8 = Modify<
158
- BrsV4,
159
- {
160
- version: 8;
161
- host: User;
162
- brick_owners: Owner[];
163
- preview?: Bytes;
164
- game_version: number;
165
- bricks: BrickV8[];
166
- components: DefinedComponents;
167
- }
168
- >;
169
-
170
- export type BrsV9 = Modify<
171
- BrsV8,
172
- {
173
- version: 9;
174
- physical_materials: string[];
175
- bricks: BrickV9[];
176
- }
177
- >;
178
-
179
- export type BrsV10 = Modify<
180
- BrsV9,
181
- {
182
- version: 10;
183
- bricks: BrickV10[];
184
- }
185
- >;
186
-
187
- // a save read from a file
188
- export type ReadSaveObject =
189
- | BrsV1
190
- | BrsV2
191
- | BrsV3
192
- | BrsV4
193
- | BrsV8
194
- | BrsV9
195
- | BrsV10;
196
-
197
- // a brick a user provides
198
- export interface Brick {
199
- asset_name_index?: number;
200
- size: Vector;
201
- position: Vector;
202
- direction?: Direction;
203
- rotation?: Rotation;
204
- collision?: boolean | Partial<Collision>;
205
- visibility?: boolean;
206
- material_index?: number;
207
- physical_index?: number;
208
- material_intensity?: number;
209
- color?: ColorRgb | number;
210
- owner_index?: number;
211
- components?: Components;
212
- }
213
-
214
- // save a user can write
215
- export interface WriteSaveObject {
216
- game_version?: number;
217
- map?: string;
218
- description?: string;
219
- author?: Partial<User>;
220
- host?: Partial<User>;
221
- mods?: string[];
222
- brick_assets?: string[];
223
- colors?: UnrealColor[];
224
- materials?: string[];
225
- brick_owners?: Partial<Owner>[];
226
- physical_materials?: string[];
227
- preview?: Bytes;
228
- bricks: Brick[];
229
- save_time?: ArrayLike<number>;
230
- components?: DefinedComponents;
231
- }
232
-
233
- export interface ReadOptions {
234
- bricks?: boolean;
235
- preview?: boolean;
236
- }
237
-
238
- export interface WriteOptions {
239
- compress?: boolean;
240
- }