@types/gimloader 1.8.0 → 1.8.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.
Files changed (3) hide show
  1. gimloader/README.md +2 -2
  2. gimloader/index.d.ts +2659 -715
  3. gimloader/package.json +6 -3
gimloader/index.d.ts CHANGED
@@ -1,757 +1,2701 @@
1
- declare namespace Gimloader {
2
- type event = symbol | string;
3
- type eventNS = string | event[];
4
-
5
- interface ConstructorOptions {
6
- /**
7
- * @default false
8
- * @description set this to `true` to use wildcards.
9
- */
10
- wildcard?: boolean;
11
- /**
12
- * @default '.'
13
- * @description the delimiter used to segment namespaces.
14
- */
15
- delimiter?: string;
16
- /**
17
- * @default false
18
- * @description set this to `true` if you want to emit the newListener events.
19
- */
20
- newListener?: boolean;
21
- /**
22
- * @default false
23
- * @description set this to `true` if you want to emit the removeListener events.
24
- */
25
- removeListener?: boolean;
26
- /**
27
- * @default 10
28
- * @description the maximum amount of listeners that can be assigned to an event.
29
- */
30
- maxListeners?: number;
31
- /**
32
- * @default false
33
- * @description show event name in memory leak message when more than maximum amount of listeners is assigned, default false
34
- */
35
- verboseMemoryLeak?: boolean;
36
- /**
37
- * @default false
38
- * @description disable throwing uncaughtException if an error event is emitted and it has no listeners
39
- */
40
- ignoreErrors?: boolean;
41
- }
42
- interface ListenerFn {
43
- (...values: any[]): void;
44
- }
45
- interface EventAndListener {
46
- (event: string | string[], ...values: any[]): void;
47
- }
1
+ export {};
48
2
 
49
- interface WaitForFilter {
50
- (...values: any[]): boolean;
51
- }
3
+ import { Collider, ColliderDesc, RigidBody, RigidBodyDesc, Vector } from "@dimforge/rapier2d-compat";
4
+ import { EventEmitter2 } from "eventemitter2";
5
+ import { Scene as BaseScene } from "phaser";
52
6
 
53
- interface WaitForOptions {
54
- /**
55
- * @default 0
56
- */
57
- timeout: number;
58
- /**
59
- * @default null
60
- */
61
- filter: WaitForFilter;
62
- /**
63
- * @default false
64
- */
65
- handleError: boolean;
66
- /**
67
- * @default Promise
68
- */
69
- Promise: any;
70
- /**
71
- * @default false
72
- */
73
- overload: boolean;
74
- }
7
+ declare global {
8
+ namespace Gimloader {
9
+ namespace Stores {
10
+ interface Team {
11
+ characters: Map<number, string>;
12
+ id: string;
13
+ name: string;
14
+ score: number;
15
+ }
75
16
 
76
- interface CancelablePromise<T> extends Promise<T> {
77
- cancel(reason: string): undefined;
78
- }
17
+ interface Teams {
18
+ teams: Map<string, Team>;
19
+ updateCounter: number;
20
+ }
79
21
 
80
- interface OnceOptions {
81
- /**
82
- * @default 0
83
- */
84
- timeout: number;
85
- /**
86
- * @default Promise
87
- */
88
- Promise: any;
89
- /**
90
- * @default false
91
- */
92
- overload: boolean;
93
- }
22
+ interface SceneStore {
23
+ currentScene: string;
24
+ gpuTier: number;
25
+ isCursorOverCanvas: boolean;
26
+ }
94
27
 
95
- interface ListenToOptions {
96
- on?: { (event: event | eventNS, handler: ListenerFn): void };
97
- off?: { (event: event | eventNS, handler: ListenerFn): void };
98
- reducers: (event: any) => boolean | object;
99
- }
28
+ interface CharacterOptions {
29
+ id: string;
30
+ x: number;
31
+ y: number;
32
+ scale: number;
33
+ type: string;
34
+ }
100
35
 
101
- interface GeneralEventEmitter {
102
- addEventListener(event: event, handler: ListenerFn): this;
103
- removeEventListener(event: event, handler: ListenerFn): this;
104
- addListener?(event: event, handler: ListenerFn): this;
105
- removeListener?(event: event, handler: ListenerFn): this;
106
- on?(event: event, handler: ListenerFn): this;
107
- off?(event: event, handler: ListenerFn): this;
108
- }
36
+ interface Spectating {
37
+ findNewCharacter(): void;
38
+ onBeginSpectating(): void;
39
+ onEndSpectating(): void;
40
+ setShuffle(shuffle: boolean, save?: boolean): void;
41
+ }
109
42
 
110
- interface OnOptions {
111
- async?: boolean;
112
- promisify?: boolean;
113
- nextTick?: boolean;
114
- objectify?: boolean;
115
- }
43
+ interface CharacterManager {
44
+ characterContainer: import("phaser").GameObjects.Container;
45
+ characters: Map<string, Character>;
46
+ scene: Scene;
47
+ spectating: Spectating;
48
+ addCharacter(options: CharacterOptions): Character;
49
+ cullCharacters(): void;
50
+ removeCharacter(id: string): void;
51
+ update(dt: number): void;
52
+ }
116
53
 
117
- interface Listener {
118
- emitter: EventEmitter2;
119
- event: event | eventNS;
120
- listener: ListenerFn;
121
- off(): this;
122
- }
54
+ interface Removal {
55
+ overlay: Overlay;
56
+ prevMouseWasDown: boolean;
57
+ scene: Scene;
58
+ checkForItem(): void;
59
+ createStateListeners(): void;
60
+ removeSelectedItems(): void;
61
+ update(): void;
62
+ }
123
63
 
124
- class EventEmitter2 {
125
- constructor(options?: ConstructorOptions);
126
- emit(event: event | eventNS, ...values: any[]): boolean;
127
- emitAsync(event: event | eventNS, ...values: any[]): Promise<any[]>;
128
- addListener(event: event | eventNS, listener: ListenerFn): this | Listener;
129
- on(event: event | eventNS, listener: ListenerFn, options?: boolean | OnOptions): this | Listener;
130
- prependListener(event: event | eventNS, listener: ListenerFn, options?: boolean | OnOptions): this | Listener;
131
- once(event: event | eventNS, listener: ListenerFn, options?: true | OnOptions): this | Listener;
132
- prependOnceListener(
133
- event: event | eventNS,
134
- listener: ListenerFn,
135
- options?: boolean | OnOptions,
136
- ): this | Listener;
137
- many(
138
- event: event | eventNS,
139
- timesToListen: number,
140
- listener: ListenerFn,
141
- options?: boolean | OnOptions,
142
- ): this | Listener;
143
- prependMany(
144
- event: event | eventNS,
145
- timesToListen: number,
146
- listener: ListenerFn,
147
- options?: boolean | OnOptions,
148
- ): this | Listener;
149
- onAny(listener: EventAndListener): this;
150
- prependAny(listener: EventAndListener): this;
151
- offAny(listener: ListenerFn): this;
152
- removeListener(event: event | eventNS, listener: ListenerFn): this;
153
- off(event: event | eventNS, listener: ListenerFn): this;
154
- removeAllListeners(event?: event | eventNS): this;
155
- setMaxListeners(n: number): void;
156
- getMaxListeners(): number;
157
- eventNames(nsAsArray?: boolean): (event | eventNS)[];
158
- listenerCount(event?: event | eventNS): number;
159
- listeners(event?: event | eventNS): ListenerFn[];
160
- listenersAny(): ListenerFn[];
161
- waitFor(event: event | eventNS, timeout?: number): CancelablePromise<any[]>;
162
- waitFor(event: event | eventNS, filter?: WaitForFilter): CancelablePromise<any[]>;
163
- waitFor(event: event | eventNS, options?: WaitForOptions): CancelablePromise<any[]>;
164
- listenTo(target: GeneralEventEmitter, events: event | eventNS, options?: ListenToOptions): this;
165
- listenTo(target: GeneralEventEmitter, events: event[], options?: ListenToOptions): this;
166
- listenTo(target: GeneralEventEmitter, events: object, options?: ListenToOptions): this;
167
- stopListeningTo(target?: GeneralEventEmitter, event?: event | eventNS): boolean;
168
- hasListeners(event?: string): boolean;
169
- static once(emitter: EventEmitter2, event: event | eventNS, options?: OnceOptions): CancelablePromise<any[]>;
170
- static defaultMaxListeners: number;
171
- }
64
+ interface PlatformerEditing {
65
+ setTopDownControlsActive(active: boolean): void;
66
+ }
172
67
 
173
- class PluginsApi {
174
- /** A list of all the plugins installed */
175
- get list(): string[];
176
- /** Whether a plugin exists and is enabled */
177
- isEnabled(name: string): boolean;
178
- /** Gets the headers of a plugin, such as version, author, and description */
179
- getHeaders(name: string): {
180
- name: string;
181
- description: string;
182
- author: string;
183
- version: string | null;
184
- reloadRequired: string;
185
- isLibrary: string;
186
- downloadUrl: string | null;
187
- webpage: string | null;
188
- needsLib: string[];
189
- optionalLib: string[];
190
- syncEval: string;
191
- gamemode: string[];
192
- hasSettings: string;
193
- };
194
- /** Gets the exported values of a plugin, if it has been enabled */
195
- get(name: string): any;
196
- /**
197
- * @deprecated Use {@link get} instead
198
- * @hidden
199
- */
200
- getPlugin(name: string): {
201
- return: any;
202
- };
203
- }
68
+ interface SelectedDevicesOverlay {
69
+ graphics: import("phaser").GameObjects.Graphics;
70
+ scene: Scene;
71
+ showing: boolean;
72
+ hide(): void;
73
+ show(rects: Rect[]): void;
74
+ }
204
75
 
205
- class LibsApi {
206
- /** A list of all the libraries installed */
207
- get list(): string[];
208
- /** Gets whether or not a plugin is installed and enabled */
209
- isEnabled(name: string): boolean;
210
- /** Gets the headers of a library, such as version, author, and description */
211
- getHeaders(name: string): {
212
- name: string;
213
- description: string;
214
- author: string;
215
- version: string | null;
216
- reloadRequired: string;
217
- isLibrary: string;
218
- downloadUrl: string | null;
219
- webpage: string | null;
220
- needsLib: string[];
221
- optionalLib: string[];
222
- syncEval: string;
223
- gamemode: string[];
224
- hasSettings: string;
225
- };
226
- /** Gets the exported values of a library */
227
- get(name: string): any;
228
- }
76
+ interface MultiSelect {
77
+ boundingBoxAroundEverything: Rect | null;
78
+ currentlySelectedDevices: Device[];
79
+ currentlySelectedDevicesIds: string[];
80
+ hidingSelectionForDevices: boolean;
81
+ isSelecting: boolean;
82
+ modifierKeyDown: boolean;
83
+ mouseShifts: Vector[];
84
+ movedOrCopiedDevices: Device[];
85
+ overlay: Overlay;
86
+ scene: Scene;
87
+ selectedDevices: Device[];
88
+ selectedDevicesIds: string[];
89
+ selectedDevicesOverlay: SelectedDevicesOverlay;
90
+ selection: Rect | null;
91
+ addDeviceToSelection(device: Device): void;
92
+ endSelectionRect(): void;
93
+ findSelectedDevices(): void;
94
+ hasSomeSelection(): boolean;
95
+ hideSelection(): void;
96
+ multiselectDeleteKeyHandler(): void;
97
+ multiselectKeyHandler(down: boolean): void;
98
+ onDeviceAdded(device: Device): void;
99
+ onDeviceRemoved(id: string): void;
100
+ setShiftParams(): void;
101
+ startSelectionRect(): void;
102
+ unselectAll(): void;
103
+ update(): void;
104
+ updateSelectedDevicesOverlay(): void;
105
+ updateSelectionRect(): void;
106
+ }
229
107
 
230
- class ScopedRewriterApi {
231
- private readonly id;
232
- constructor(id: string);
233
- /**
234
- * Creates a hook that will modify the code of a script before it is run.
235
- * This value is cached, so this hook may not run on subsequent page loads.
236
- * addParseHook should always be called in the top level of a script.
237
- * @param prefix Limits the hook to only running on scripts beginning with this prefix.
238
- * Passing `true` will only run on the index script, and passing `false` will run on all scripts.
239
- * @param callback The function that will modify the code. Should return the modified code. Cannot have side effects.
240
- */
241
- addParseHook(prefix: string | boolean, callback: (code: string) => string): () => void;
242
- /**
243
- * Creates a shared value that can be accessed from any script.
244
- * @param id A unique identifier for the shared value.
245
- * @param value The value to be shared.
246
- * @returns A string representing the code to access the shared value.
247
- */
248
- createShared(id: string, value: any): string;
249
- /** Removes the shared value with a certain id created by {@link createShared} */
250
- removeSharedById(id: string): void;
251
- }
108
+ interface DepthSort {
109
+ overlay: Overlay;
110
+ scene: Scene;
111
+ update(): void;
112
+ }
252
113
 
253
- class RewriterApi {
254
- /**
255
- * Creates a hook that will modify the code of a script before it is run.
256
- * This value is cached, so this hook may not run on subsequent page loads.
257
- * addParseHook should always be called in the top level of a script.
258
- * @param pluginName The name of the plugin creating the hook.
259
- * @param prefix Limits the hook to only running on scripts beginning with this prefix.
260
- * Passing `true` will only run on the index script, and passing `false` will run on all scripts.
261
- * @param callback The function that will modify the code. Should return the modified code. Cannot have side effects.
262
- */
263
- addParseHook(pluginName: string, prefix: string | boolean, callback: (code: string) => string): () => void;
264
- /** Removes all hooks created by a certain plugin */
265
- removeParseHooks(pluginName: string): void;
266
- /**
267
- * Creates a shared value that can be accessed from any script.
268
- * @param pluginName The name of the plugin creating the shared value.
269
- * @param id A unique identifier for the shared value.
270
- * @param value The value to be shared.
271
- * @returns A string representing the code to access the shared value.
272
- */
273
- createShared(pluginName: string, id: string, value: any): string;
274
- /** Removes all values created by {@link createShared} by a certain plugin */
275
- removeShared(pluginName: string): void;
276
- /** Removes the shared value with a certain id created by {@link createShared} */
277
- removeSharedById(pluginName: string, id: string): void;
278
- }
114
+ interface ActionManager {
115
+ depthSort: DepthSort;
116
+ multiSelect: MultiSelect;
117
+ platformerEditing: PlatformerEditing;
118
+ removal: Removal;
119
+ update(): void;
120
+ }
279
121
 
280
- class ScopedPatcherApi {
281
- private readonly id;
282
- constructor(id: string);
283
- /**
284
- * Runs a callback after a function on an object has been run
285
- * @returns A function to remove the patch
286
- */
287
- after(object: any, method: string, callback: PatcherAfterCallback): () => void;
288
- /**
289
- * Runs a callback before a function on an object has been run.
290
- * Return true from the callback to prevent the function from running
291
- * @returns A function to remove the patch
292
- */
293
- before(object: any, method: string, callback: PatcherBeforeCallback): () => void;
294
- /**
295
- * Runs a function instead of a function on an object
296
- * @returns A function to remove the patch
297
- */
298
- instead(object: any, method: string, callback: PatcherInsteadCallback): () => void;
299
- }
122
+ interface TileKey {
123
+ depth: number;
124
+ x: number;
125
+ y: number;
126
+ }
300
127
 
301
- type PatcherInsteadCallback = (thisVal: any, args: IArguments) => void;
302
-
303
- // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
304
- type PatcherBeforeCallback = (thisVal: any, args: IArguments) => boolean | void;
305
-
306
- type PatcherAfterCallback = (thisVal: any, args: IArguments, returnVal: any) => any;
307
-
308
- class PatcherApi {
309
- /**
310
- * Runs a callback after a function on an object has been run
311
- * @returns A function to remove the patch
312
- */
313
- after(id: string, object: any, method: string, callback: PatcherAfterCallback): () => void;
314
- /**
315
- * Runs a callback before a function on an object has been run.
316
- * Return true from the callback to prevent the function from running
317
- * @returns A function to remove the patch
318
- */
319
- before(id: string, object: any, method: string, callback: PatcherBeforeCallback): () => void;
320
- /**
321
- * Runs a function instead of a function on an object
322
- * @returns A function to remove the patch
323
- */
324
- instead(id: string, object: any, method: string, callback: PatcherInsteadCallback): () => void;
325
- /** Removes all patches with a given id */
326
- unpatchAll(id: string): void;
327
- }
128
+ interface BackgroundLayersManager {
129
+ layerManager: LayerManager;
130
+ scene: Scene;
131
+ createLayer(options: {
132
+ layerId: string;
133
+ depth: number;
134
+ }): void;
135
+ fill(terrain: TerrainOption): void;
136
+ fillForPlatformer(): void;
137
+ fillForTopDown(terrain: TerrainOption): void;
138
+ removeLayer(options: {
139
+ layerId: string;
140
+ }): void;
141
+ }
328
142
 
329
- class ScopedStorageApi {
330
- private readonly id;
331
- constructor(id: string);
332
- /** Gets a value that has previously been saved */
333
- getValue(key: string, defaultValue?: any): any;
334
- /** Sets a value which can be retrieved later, persisting through reloads */
335
- setValue(key: string, value: any): void;
336
- /** Removes a value which has been saved */
337
- deleteValue(key: string): void;
338
- /** Adds a listener for when a stored value with a certain key changes */
339
- onChange(key: string, callback: ValueChangeCallback): () => void;
340
- }
143
+ interface LayerManager {
144
+ backgroundLayersManager: BackgroundLayersManager;
145
+ colliders: Map<string, Map<string, string>>;
146
+ layers: Map<string, any>;
147
+ scene: Scene;
148
+ createInitialLayers(): void;
149
+ createLayer(id: string): void;
150
+ fillBottomLayer(terrain: TerrainOption): void;
151
+ getActualLayerDepth(id: string): number;
152
+ moveLayersAboveCharacters(): void;
153
+ onWorldSizeChange(): void;
154
+ }
341
155
 
342
- type ValueChangeCallback = (value: any, remote: boolean) => void;
343
-
344
- class StorageApi {
345
- /** Gets a value that has previously been saved */
346
- getValue(pluginName: string, key: string, defaultValue?: any): any;
347
- /** Sets a value which can be retrieved later, through reloads */
348
- setValue(pluginName: string, key: string, value: any): void;
349
- /** Removes a value which has been saved */
350
- deleteValue(pluginName: string, key: string): void;
351
- /**
352
- * @deprecated use {@link deleteValue}
353
- * @hidden
354
- */
355
- get removeValue(): (pluginName: string, key: string) => void;
356
- /** Adds a listener for when a plugin's stored value with a certain key changes */
357
- onChange(pluginName: string, key: string, callback: ValueChangeCallback): () => void;
358
- /** Removes a listener added by onChange */
359
- offChange(pluginName: string, key: string, callback: ValueChangeCallback): void;
360
- /** Removes all listeners added by onChange for a certain plugin */
361
- offAllChanges(pluginName: string): void;
362
- }
156
+ interface TileManager {
157
+ cumulTime: number;
158
+ scene: Scene;
159
+ layerManager: LayerManager;
160
+ damageTileAtXY(x: number, y: number, depth: number, damage: number, healthPercent: number): void;
161
+ destroyTileByTileKey(tileKey: TileKey): void;
162
+ onMapStyleSet(): void;
163
+ regenerateTileAtXY(x: number, y: number, depth: number, healthPercent: number): void;
164
+ update(dt: number): void;
165
+ updateTeamColorTileAtXY(x: number, y: number, depth: number, team?: string, playerId?: string): void;
166
+ }
363
167
 
364
- class ScopedUIApi extends BaseUIApi {
365
- private readonly id;
366
- constructor(id: string);
367
- /**
368
- * Adds a style to the DOM
369
- * @returns A function to remove the styles
370
- */
371
- addStyles(style: string): () => void;
372
- }
168
+ interface Projectile {
169
+ id: string;
170
+ startTime: number;
171
+ endTime: number;
172
+ start: Vector;
173
+ end: Vector;
174
+ radius: number;
175
+ appearance: string;
176
+ ownerId: string;
177
+ ownerTeamId: string;
178
+ damage: number;
179
+ hitPos?: Vector;
180
+ hitTime?: number;
181
+ }
182
+
183
+ interface Projectiles {
184
+ damageMarkers: any;
185
+ dynamicDevices: Set<Device>;
186
+ fireSlashes: any;
187
+ projectileJSON: Map<string, Projectile>;
188
+ runClientSidePrediction: boolean;
189
+ scene: Scene;
190
+ addProjectile(projectile: Projectile): void;
191
+ fire(pointer: import("phaser").Input.Pointer, snap: boolean): void;
192
+ update(): void;
193
+ }
194
+
195
+ interface WorldBoundsCollider {
196
+ body: RigidBody;
197
+ collider: Collider;
198
+ }
199
+
200
+ interface BodyBounds {
201
+ minX: number;
202
+ minY: number;
203
+ maxX: number;
204
+ maxY: number;
205
+ }
206
+
207
+ interface BodyStatic {
208
+ bounds: BodyBounds;
209
+ cells: Set<string>;
210
+ }
211
+
212
+ interface Body {
213
+ collider?: Collider;
214
+ colliderDesc: ColliderDesc;
215
+ rigidBody?: RigidBody;
216
+ rigidBodyDesc: RigidBodyDesc;
217
+ static: BodyStatic;
218
+ device?: {
219
+ id: string;
220
+ };
221
+ terrain?: {
222
+ key: string;
223
+ };
224
+ }
225
+
226
+ interface ActiveBodies {
227
+ activeBodies: Set<string>;
228
+ bodyManager: BodyManager;
229
+ currentCoordinateKeys: Set<string>;
230
+ world: World;
231
+ disableBody(id: string): void;
232
+ enable(keys: Set<string>, setAll: boolean): void;
233
+ enableBodiesAlongLine(options: {
234
+ start: Vector;
235
+ end: Vector;
236
+ }): void;
237
+ enableBodiesWithinAreas(options: {
238
+ areas: Rect[];
239
+ disableActiveBodiesOutsideArea: boolean;
240
+ }): void;
241
+ enableBody(id: string): void;
242
+ setDirty(): void;
243
+ }
244
+
245
+ interface BodyManager {
246
+ activeBodies: ActiveBodies;
247
+ bodies: Map<string, Body>;
248
+ cells: Map<string, Set<string>>;
249
+ dynamicBodies: Set<string>;
250
+ gridSize: number;
251
+ staticBodies: Set<string>;
252
+ staticSensorBodies: Set<string>;
253
+ _idCount: number;
254
+ find(id: string): Body | undefined;
255
+ findPotentialStaticBodiesWithinArea(area: Rect): Set<string>;
256
+ generateId(): void;
257
+ insert(body: Body): string;
258
+ remove(id: string): void;
259
+ }
260
+
261
+ interface PhysicsManager {
262
+ bodies: BodyManager;
263
+ cumulTime: number;
264
+ lastTime: number;
265
+ physicsStep(dt: number): void;
266
+ runPhysicsLoop(dt: number): void;
267
+ world: World;
268
+ worldBoundsColliders: Set<WorldBoundsCollider>;
269
+ }
270
+
271
+ interface CreateTileOptions {
272
+ x: number;
273
+ y: number;
274
+ tileIndex: number;
275
+ terrainOption: TerrainOption;
276
+ }
277
+
278
+ interface InGameTerrainBuilder {
279
+ afterFailureWithTouch: boolean;
280
+ overlay: Overlay;
281
+ previewingTile?: Vector;
282
+ scene: Scene;
283
+ wasDown: boolean;
284
+ clearConsumeErrorMessage(): void;
285
+ clearPreviewLayer(): void;
286
+ createPreviewTile(options: CreateTileOptions): void;
287
+ update(): void;
288
+ }
289
+
290
+ interface WorldInteractives {
291
+ scene: Scene;
292
+ currentDevice?: Device;
293
+ clearCurrentDevice(): void;
294
+ setCurrentDevice(device: Device): void;
295
+ update(devices: Device[]): void;
296
+ canBeReachedByPlayer(device: Device): boolean;
297
+ findClosestInteractiveDevice(devices: Device[], x: number, y: number): Device | undefined;
298
+ }
299
+
300
+ interface ShowOverlayOptions {
301
+ x: number;
302
+ y: number;
303
+ width: number;
304
+ height: number;
305
+ depth: number;
306
+ }
307
+
308
+ interface Overlay {
309
+ scene: Scene;
310
+ showing: boolean;
311
+ showingDimensions: {
312
+ width: number;
313
+ height: number;
314
+ } | null;
315
+ showingPosition: {
316
+ x: number;
317
+ y: number;
318
+ } | null;
319
+ hide(): void;
320
+ show(options: ShowOverlayOptions): void;
321
+ }
322
+
323
+ interface DevicesPreview {
324
+ devicePreviewOverlay: Overlay;
325
+ previousDevices: Device[];
326
+ scene: Scene;
327
+ removePreviousDevices(isBeingReplaced: boolean): void;
328
+ update(): void;
329
+ }
330
+
331
+ interface DevicesAction {
332
+ inputManager: InputManager;
333
+ scene: Scene;
334
+ onClick(arg: any): void;
335
+ update(): void;
336
+ }
337
+
338
+ interface DeviceProjectiles {
339
+ device: Device;
340
+ addToDynamicDevices(): void;
341
+ collidesWithProjectile(object: Circle): boolean;
342
+ onClientPredictedHit(position: Vector): void;
343
+ removeFromDynamicDevices(): void;
344
+ setDynamic(dynamic: boolean): void;
345
+ }
346
+
347
+ interface DeviceTweens {
348
+ list: import("phaser").Tweens.Tween[];
349
+ device: Device;
350
+ add(config: import("phaser").Types.Tweens.TweenBuilderConfig): import("phaser").Tweens.Tween;
351
+ destroy(): void;
352
+ }
353
+
354
+ interface WirePoints {
355
+ device: Device;
356
+ end: Vector;
357
+ start: Vector;
358
+ onPointChange(): void;
359
+ setBoth(x: number, y: number): void;
360
+ }
361
+
362
+ interface Layers {
363
+ depth: number;
364
+ device: Device;
365
+ layer: string;
366
+ options: any;
367
+ }
368
+
369
+ interface ShadowOptions {
370
+ x: number;
371
+ y: number;
372
+ r1: number;
373
+ r2: number;
374
+ alphaMultip: number;
375
+ depth: number;
376
+ }
377
+
378
+ interface Shadows {
379
+ device: Device;
380
+ list: ShadowOptions[];
381
+ add(options: ShadowOptions): void;
382
+ destroy(): void;
383
+ forEach(callback: (shadow: ShadowOptions) => void): void;
384
+ hide(): void;
385
+ show(): void;
386
+ }
387
+
388
+ interface Circle {
389
+ x: number;
390
+ y: number;
391
+ radius: number;
392
+ }
393
+
394
+ interface RotatedCircle extends Circle {
395
+ angle: number;
396
+ }
397
+
398
+ interface VisualEditingCircle {
399
+ angle: number;
400
+ rotable: boolean;
401
+ radius: number;
402
+ minRadius: number;
403
+ maxRadius: number;
404
+ onChange(value: RotatedCircle): void;
405
+ }
406
+
407
+ interface RotatedRect extends Rect {
408
+ angle: number;
409
+ }
410
+
411
+ interface VisualEditingBox {
412
+ width: number;
413
+ height: number;
414
+ angle: number;
415
+ minWidth: number;
416
+ maxWidth: number;
417
+ minHeight: number;
418
+ maxHeight: number;
419
+ keepRatio: boolean;
420
+ rotable: boolean;
421
+ onChange(value: RotatedRect): void;
422
+ }
423
+
424
+ interface VisualEditing {
425
+ add: {
426
+ box(options: VisualEditingBox): void;
427
+ circle(options: VisualEditingCircle): void;
428
+ };
429
+ device: Device;
430
+ isActive: boolean;
431
+ shapes: (VisualEditingBox | VisualEditingCircle)[];
432
+ clear(): void;
433
+ }
434
+
435
+ interface InteractiveZones {
436
+ add: {
437
+ circle(zone: CircleShort): void;
438
+ rect(zone: Rect): void;
439
+ };
440
+ canInteractThroughColliders: boolean;
441
+ device: Device;
442
+ forceDisabled: boolean;
443
+ zones: (CircleShort | Rect)[];
444
+ contains(x: number, y: number): boolean;
445
+ destroy(): void;
446
+ getCanInteractThroughColliders(): boolean;
447
+ getInfo(): any;
448
+ getMaxDistance(x: number, y: number): number;
449
+ isInteractive(): boolean;
450
+ onPlayerCanInteract(): void;
451
+ onPlayerCantInteractAnyMore(): void;
452
+ setCanInteractThroughColliders(canInteract: boolean): void;
453
+ setForceDisabled(forceDisabled: boolean): void;
454
+ setInfo(info: any): void;
455
+ }
456
+
457
+ interface DeviceInput {
458
+ device: Device;
459
+ enabled: boolean;
460
+ hasKeyListeners: boolean;
461
+ isCurrentlyUnderMouse: boolean;
462
+ addDeviceToCursorUnderList(): void;
463
+ createKeyListeners(): void;
464
+ cutCopyHandler(action: string): void;
465
+ disable(): void;
466
+ dispose(): void;
467
+ disposeKeyListeners(): void;
468
+ enable(): void;
469
+ partIsNoLongerUnderMouse(): void;
470
+ partIsUnderMouse(): void;
471
+ removeDeviceFromCursorUnderList(): void;
472
+ }
473
+
474
+ interface DeviceUI {
475
+ device: Device;
476
+ close(): void;
477
+ open(options: Record<string, any>): void;
478
+ update(options: Record<string, any>): void;
479
+ }
480
+
481
+ interface VFX {
482
+ character: Character;
483
+ damageBoostActive: boolean;
484
+ phaseActive: boolean;
485
+ tintModifierId: string;
486
+ transparencyModifierId: string;
487
+ setTintModifier(id: string): void;
488
+ setTransparencyModifier(id: string): void;
489
+ startDamageBoostAnim(): void;
490
+ startPhaseAnim(): void;
491
+ stopDamageBoostAnim(): void;
492
+ stopPhaseAnim(): void;
493
+ }
494
+
495
+ interface TintParams {
496
+ type: string;
497
+ fromColor: string;
498
+ toColor: string;
499
+ duration: number;
500
+ tween?: import("phaser").Tweens.Tween;
501
+ ease(t: number): number;
502
+ }
503
+
504
+ interface Tint {
505
+ character: Character;
506
+ scene: Scene;
507
+ phase?: TintParams;
508
+ playerAppearanceModifierDevice?: TintParams;
509
+ immunity?: TintParams;
510
+ damageBoost?: TintParams;
511
+ getTintParams(type: string): TintParams | undefined;
512
+ setTintParams(type: string, tint?: TintParams): void;
513
+ startAnimateTint(params: TintParams): void;
514
+ stopAnimateTint(type: string): void;
515
+ update(): void;
516
+ }
517
+
518
+ interface SkinOptions {
519
+ id: string;
520
+ editStyles?: Record<string, string>;
521
+ }
522
+
523
+ interface Skin {
524
+ character: Character;
525
+ editStyles?: Record<string, string>;
526
+ latestSkinId: string;
527
+ scene: Scene;
528
+ skinId: string;
529
+ applyEditStyles(options: SkinOptions): void;
530
+ setupSkin(position: Vector): void;
531
+ updateSkin(options: SkinOptions): void;
532
+ }
533
+
534
+ interface Shadow {
535
+ character: Character;
536
+ image?: import("phaser").GameObjects.Image;
537
+ createShadow(): void;
538
+ destroy(): void;
539
+ update(): void;
540
+ }
541
+
542
+ interface TweenScaleOptions {
543
+ type: string;
544
+ scale: number;
545
+ duration: number;
546
+ }
547
+
548
+ interface Scale {
549
+ activeScale: number;
550
+ baseScale: number;
551
+ character: Character;
552
+ respawningScale: number;
553
+ scaleX: number;
554
+ scaleY: number;
555
+ scene: Scene;
556
+ spectatorScale: number;
557
+ dependencyScale: number;
558
+ isVisible: boolean;
559
+ getCurrentScale(type: number): void;
560
+ onSkinChange(): void;
561
+ setScale(type: number, scale: number): void;
562
+ tweenScale(options: TweenScaleOptions): void;
563
+ update(): void;
564
+ }
565
+
566
+ interface Position {
567
+ character: Character;
568
+ update(dt: number): void;
569
+ }
570
+
571
+ interface Network {
572
+ lastAngle?: number;
573
+ lastAngleUpdate: number;
574
+ updateAimAngle(angle: number): void;
575
+ }
576
+
577
+ interface Nametag {
578
+ alpha: number;
579
+ character: Character;
580
+ creatingTag: boolean;
581
+ depth: number;
582
+ destroyed: boolean;
583
+ followScale: boolean;
584
+ fragilityTag?: import("phaser").GameObjects.Text;
585
+ healthMode: string;
586
+ name: string;
587
+ scale: number;
588
+ scene: Scene;
589
+ tag: import("phaser").GameObjects.Text;
590
+ teamState: TeamState;
591
+ fontColor: string;
592
+ tags: import("phaser").GameObjects.Text[];
593
+ createFragilityTag(): void;
594
+ createTag(): void;
595
+ destroy(): void;
596
+ makeVisibleChanges(force?: boolean): void;
597
+ playHideAnimation(): void;
598
+ playShowUpAnimation(): void;
599
+ setName(name: string): void;
600
+ update(update: {
601
+ teamState: TeamState;
602
+ }): void;
603
+ updateFontColor(): void;
604
+ updateFragility(fragility: number): void;
605
+ updateTagAlpha(force?: boolean): void;
606
+ updateTagDepth(force?: boolean): void;
607
+ updateTagPosition(force?: boolean): void;
608
+ updateTagScale(force?: boolean): void;
609
+ }
610
+
611
+ interface CharacterInput {
612
+ character: Character;
613
+ isListeningForInput: boolean;
614
+ scene: Scene;
615
+ setupInput(): void;
616
+ }
617
+
618
+ interface TeamState {
619
+ status: string;
620
+ teamId: string;
621
+ }
622
+
623
+ interface Indicator extends Updates {
624
+ character: Character;
625
+ characterHeight: number;
626
+ depth: number;
627
+ image: import("phaser").GameObjects.Image;
628
+ isMain: boolean;
629
+ isSpectated: boolean;
630
+ lastCharacterAlpha: number;
631
+ scene: Scene;
632
+ teamState: TeamState;
633
+ destroy(): void;
634
+ makeIndicator(): void;
635
+ }
636
+
637
+ interface ImpactAnimation {
638
+ animations: Map<string, import("phaser").GameObjects.Sprite>;
639
+ character: Character;
640
+ loadedAnimations: Set<string>;
641
+ scene: Scene;
642
+ _play(animation: string): void;
643
+ destroy(): void;
644
+ load(animation: string): void;
645
+ play(animation: string): void;
646
+ }
647
+
648
+ interface Immunity {
649
+ character: Character;
650
+ classImmunityActive: boolean;
651
+ spawnImmunityActive: boolean;
652
+ activate(): void;
653
+ activateClassImmunity(): void;
654
+ activateSpawnImmunity(): void;
655
+ deactivate(): void;
656
+ deactivateClassImmunity(): void;
657
+ deactivateSpawnImmunity(): void;
658
+ isActive(): boolean;
659
+ }
660
+
661
+ interface Updates {
662
+ update(update: {
663
+ delta: number;
664
+ }): void;
665
+ updateAlpha(): void;
666
+ updateDepth(): void;
667
+ updatePosition(dt: number): void;
668
+ updateScale(): void;
669
+ }
670
+
671
+ interface Healthbar extends Updates {
672
+ character: Character;
673
+ depth: number;
674
+ isVisible: boolean;
675
+ scene: Scene;
676
+ destroy(): void;
677
+ makeIndicator(): void;
678
+ updateValue(): void;
679
+ }
680
+
681
+ interface Flip {
682
+ character: Character;
683
+ flipXLastX: number;
684
+ isFlipped: boolean;
685
+ lastX: number;
686
+ lastY: number;
687
+ update(): void;
688
+ updateFlipForMainCharacter(): void;
689
+ updateFlipForOthers(): void;
690
+ }
691
+
692
+ interface Dimensions {
693
+ character: Character;
694
+ currentDimensionsId: string;
695
+ bottomY: number;
696
+ centerX: number;
697
+ topY: number;
698
+ x: number;
699
+ onPotentialDimensionsChange(): void;
700
+ }
701
+
702
+ interface Depth {
703
+ character: Character;
704
+ currentDepth: number;
705
+ lastY: number;
706
+ update(): void;
707
+ updateDepth(): void;
708
+ }
709
+
710
+ interface Culling {
711
+ character: Character;
712
+ isInCamera: boolean;
713
+ needsCullUpdate: boolean;
714
+ scene: Scene;
715
+ shouldForceUpdate: boolean;
716
+ forceUpdate(): void;
717
+ hideObject(object: any): void;
718
+ onInCamera(): void;
719
+ onOutCamera(): void;
720
+ showObject(object: any): void;
721
+ updateNeedsUpdate(): void;
722
+ }
723
+
724
+ interface TrailParticles {
725
+ frameHeight: number;
726
+ frameWidth: number;
727
+ imageUrl: string;
728
+ numberOfFrames: number;
729
+ }
730
+
731
+ interface TrailEmitter {
732
+ frequency: number;
733
+ quantity: number;
734
+ blendMode: number;
735
+ speed: number;
736
+ speedVariation: number;
737
+ lifetime: number;
738
+ lifetimeVariation: number;
739
+ scale: number;
740
+ scaleVariation: number;
741
+ scaleThreshold: number;
742
+ rotationRandomAtStart: boolean;
743
+ rotationChange: number;
744
+ rotationChangeVariation: number;
745
+ rotationAllowNegativeChange: boolean;
746
+ alphaThresholdStart: number;
747
+ alphaThresholdEnd: number;
748
+ gravityY: number;
749
+ yOriginChange: number;
750
+ emitterZone: Partial<Vector>;
751
+ }
752
+
753
+ interface TrailAppearance {
754
+ id: string;
755
+ emitter: TrailEmitter;
756
+ particles: TrailParticles;
757
+ }
758
+
759
+ interface CharacterTrail {
760
+ character: Character;
761
+ currentAppearance: TrailAppearance;
762
+ currentAppearanceId: string;
763
+ isReady: boolean;
764
+ lastSetAlpha: number;
765
+ destroy(): void;
766
+ followCharacter(): void;
767
+ setNewAppearance(appearance: TrailAppearance): void;
768
+ update(): void;
769
+ updateAppearance(id: string): void;
770
+ }
771
+
772
+ interface TweenAlphaOptions {
773
+ alpha: number;
774
+ type: string;
775
+ duration: number;
776
+ ease?: string;
777
+ }
778
+
779
+ interface Alpha {
780
+ character: Character;
781
+ cinematicModeAlpha: number;
782
+ currentAlpha: number;
783
+ immunity: number;
784
+ phaseAlpha: number;
785
+ playerAppearanceModifierDeviceAlpha: number;
786
+ scene: Scene;
787
+ getCurrentAlpha(): number;
788
+ setAlpha(type: string, alpha: number): void;
789
+ tweenAlpha(options: TweenAlphaOptions): void;
790
+ update(): void;
791
+ }
792
+
793
+ interface EndInfo {
794
+ end: number;
795
+ start: number;
796
+ x: number;
797
+ y: number;
798
+ }
799
+
800
+ interface Point {
801
+ endTime: number;
802
+ endX: number;
803
+ endY: number;
804
+ startTime: number;
805
+ startX: number;
806
+ startY: number;
807
+ teleported: boolean;
808
+ usedTeleported: boolean;
809
+ }
810
+
811
+ interface Movement {
812
+ character: Character;
813
+ currentPoint: Point;
814
+ currentTime: number;
815
+ nonMainCharacterGrounded: boolean;
816
+ pointMap: Point[];
817
+ targetIsDirty: boolean;
818
+ targetNonMainCharacterGrounded: boolean;
819
+ targetX: number;
820
+ targetY: number;
821
+ teleportCount: number;
822
+ teleported: boolean;
823
+ getCurrentEndInfo(): EndInfo;
824
+ moveToTargetPosition(): void;
825
+ onMainCharacterTeleport(): void;
826
+ postPhysicsUpdate(dt: number): void;
827
+ setNonMainCharacterTargetGrounded(grounded: boolean): void;
828
+ setTargetX(x: number): void;
829
+ setTargetY(y: number): void;
830
+ setTeleportCount(teleportCount: number): void;
831
+ update(dt: number): void;
832
+ }
833
+
834
+ interface NonMainCharacterState {
835
+ grounded: boolean;
836
+ }
837
+
838
+ interface Animation {
839
+ availableAnimations: string[];
840
+ blinkTimer: number;
841
+ bodyAnimationLocked: boolean;
842
+ bodyAnimationStartedAt: number;
843
+ character: Character;
844
+ currentBodyAnimation: string;
845
+ currentEyeAnimation: string;
846
+ lastGroundedAnimationAt: number;
847
+ nonMainCharacterState: NonMainCharacterState;
848
+ prevNonMainCharacterState: NonMainCharacterState;
849
+ skinChanged: boolean;
850
+ destroy(): void;
851
+ onAnimationComplete(options: any): void;
852
+ onSkinChanged(): void;
853
+ playAnimationOrClearTrack(animations: string[], track: number): void;
854
+ playBodyAnimation(animation: string): void;
855
+ playBodySupplementalAnimation(animation: string): void;
856
+ playEyeAnimation(animation: string): void;
857
+ playJumpSupplementalAnimation(animation: string): void;
858
+ playMovementSupplementalAnimation(animation: string): void;
859
+ setupAnimations(): void;
860
+ startBlinkAnimation(): void;
861
+ stopBlinkAnimation(): void;
862
+ update(dt: number): void;
863
+ }
864
+
865
+ interface ProjectileAppearance {
866
+ imageUrl: string;
867
+ rotateToTarget: boolean;
868
+ scale: number;
869
+ }
870
+
871
+ interface WeaponAsset extends BaseAsset {
872
+ fireFrames: number[];
873
+ fromCharacterCenterRadius: number;
874
+ hideFireSlash: boolean;
875
+ idleFrames: number;
876
+ originX: number;
877
+ originY: number;
878
+ }
879
+
880
+ interface BaseAsset {
881
+ frameHeight: number;
882
+ frameRate: number;
883
+ frameWidth: number;
884
+ imageUrl: string;
885
+ scale: number;
886
+ }
887
+
888
+ interface ImpactAsset extends BaseAsset {
889
+ frames: number[];
890
+ hideIfNoHit?: boolean;
891
+ }
892
+
893
+ interface SoundEffect {
894
+ path: string;
895
+ volume: number;
896
+ }
897
+
898
+ interface CurrentAppearance {
899
+ id: string;
900
+ explosionSfx: SoundEffect[];
901
+ fireSfx: SoundEffect[];
902
+ impact: ImpactAsset;
903
+ projectile: ProjectileAppearance;
904
+ reloadSfx: SoundEffect;
905
+ weapon: WeaponAsset;
906
+ }
907
+
908
+ interface AimingAndLookingAround {
909
+ angleTween?: import("phaser").Tweens.Tween;
910
+ character: Character;
911
+ currentAngle?: number;
912
+ currentAppearance?: CurrentAppearance;
913
+ currentWeaponId?: string;
914
+ isAiming: boolean;
915
+ lastUsedAngle: number;
916
+ sprite: import("phaser").GameObjects.Sprite;
917
+ targetAngle?: number;
918
+ characterShouldFlipX(): boolean;
919
+ destroy(): void;
920
+ isCurrentlyAiming(): boolean;
921
+ onInventoryStateChange(): void;
922
+ playFireAnimation(): void;
923
+ setImage(appearance: CurrentAppearance): void;
924
+ setSpriteParams(skipRecalculateAlpha: boolean): void;
925
+ setTargetAngle(angle: number, instant?: boolean): void;
926
+ update(): void;
927
+ updateAnotherCharacter(): void;
928
+ updateMainCharacterMouse(): void;
929
+ updateMainCharacterTouch(): void;
930
+ }
931
+
932
+ interface ServerPosition {
933
+ packet: number;
934
+ x: number;
935
+ y: number;
936
+ jsonState: string;
937
+ teleport: boolean;
938
+ }
939
+
940
+ interface Bodies {
941
+ character: Character;
942
+ collider: Collider;
943
+ colliderDesc: ColliderDesc;
944
+ rigidBody: RigidBody;
945
+ rigidBodyDesc: RigidBodyDesc;
946
+ }
947
+
948
+ interface PhysicsInput {
949
+ _jumpKeyPressed: boolean;
950
+ activeClassDeviceId: string;
951
+ angle: number;
952
+ ignoredStaticBodies: Set<any>;
953
+ ignoredTileBodies: Set<any>;
954
+ jump: boolean;
955
+ projectileHitForcesQueue: Set<any>;
956
+ }
957
+
958
+ interface MovementState {
959
+ accelerationTicks: number;
960
+ direction: string;
961
+ xVelocity: number;
962
+ }
963
+
964
+ interface Jump {
965
+ actuallyJumped: boolean;
966
+ isJumping: boolean;
967
+ jumpCounter: number;
968
+ jumpTicks: number;
969
+ jumpsLeft: number;
970
+ xVelocityAtJumpStart: number;
971
+ }
972
+
973
+ interface PhysicsState {
974
+ forces: any[];
975
+ gravity: number;
976
+ grounded: boolean;
977
+ groundedTicks: number;
978
+ jump: Jump;
979
+ lastGroundedAngle: number;
980
+ movement: MovementState;
981
+ velocity: Vector;
982
+ }
983
+
984
+ interface Physics {
985
+ character: Character;
986
+ currentPacketId: number;
987
+ frameInputsHistory: Map<number, PhysicsInput>;
988
+ justAppliedProjectileHitForces: Set<any>;
989
+ lastClassDeviceActivationId: number;
990
+ lastPacketSent: number[];
991
+ lastSentClassDeviceActivationId: number;
992
+ lastSentTerrainUpdateId: number;
993
+ lastTerrainUpdateId: number;
994
+ newlyAddedTileBodies: Set<any>;
995
+ phase: boolean;
996
+ physicsBodyId: string;
997
+ prevState: PhysicsState;
998
+ projectileHitForcesHistory: Map<any, any>;
999
+ projectileHitForcesQueue: Set<any>;
1000
+ scene: Scene;
1001
+ state: PhysicsState;
1002
+ tickInput: TickInput;
1003
+ destroy(): void;
1004
+ getBody(): Bodies;
1005
+ postUpdate(dt: number): void;
1006
+ preUpdate(): void;
1007
+ sendToServer(): void;
1008
+ setServerPosition(serverPosition: ServerPosition): void;
1009
+ setupBody(x: number, y: number): void;
1010
+ updateDebugGraphics(): void;
1011
+ }
1012
+
1013
+ interface Character {
1014
+ aimingAndLookingAround: AimingAndLookingAround;
1015
+ alpha: Alpha;
1016
+ animation: Animation;
1017
+ body: Vector;
1018
+ characterTrail: CharacterTrail;
1019
+ culling: Culling;
1020
+ depth: Depth;
1021
+ dimensions: Dimensions;
1022
+ flip: Flip;
1023
+ healthbar: Healthbar;
1024
+ id: string;
1025
+ immunity: Immunity;
1026
+ impactAnimation: ImpactAnimation;
1027
+ indicator: Indicator;
1028
+ input: CharacterInput;
1029
+ isActive: boolean;
1030
+ isDestroyed: boolean;
1031
+ isMain: boolean;
1032
+ movement: Movement;
1033
+ nametag: Nametag;
1034
+ network: Network;
1035
+ physics: Physics;
1036
+ position: Position;
1037
+ prevBody: Vector;
1038
+ scale: Scale;
1039
+ scene: Scene;
1040
+ shadow: Shadow;
1041
+ skin: Skin;
1042
+ spine: any;
1043
+ teamId: string;
1044
+ tint: Tint;
1045
+ type: string;
1046
+ vfx: VFX;
1047
+ destroy(): void;
1048
+ setIsMain(isMain: boolean): void;
1049
+ update(dt: number): void;
1050
+ }
1051
+
1052
+ interface UpdateCullOptions {
1053
+ mainCharacter: Character;
1054
+ isPhase: boolean;
1055
+ insideView: boolean;
1056
+ }
1057
+
1058
+ interface Cull {
1059
+ device: Device;
1060
+ ignoresCull: boolean;
1061
+ isInsideView: boolean;
1062
+ margin: number;
1063
+ wasInsideView: boolean;
1064
+ getMargin(): number;
1065
+ ignoreCulling(): void;
1066
+ setMargin(margin: number): void;
1067
+ setOnEnterViewCallback(callback: () => void): void;
1068
+ setOnLeaveViewCallback(callback: () => void): void;
1069
+ onEnterViewCallback?(): void;
1070
+ onLeaveViewCallback?(): void;
1071
+ updateCull(options: UpdateCullOptions): void;
1072
+ }
1073
+
1074
+ type DeviceCollider = RectShort | CircleShort | Ellipse;
1075
+
1076
+ type ColliderOptions = {
1077
+ device: Device;
1078
+ scene: Scene;
1079
+ angle: number;
1080
+ } & Partial<RectShort & CircleShort & Ellipse>;
1081
+
1082
+ interface ColliderEntry {
1083
+ bodyId: string;
1084
+ options: ColliderOptions;
1085
+ device: Device;
1086
+ scene: Scene;
1087
+ }
1088
+
1089
+ interface Colliders {
1090
+ add: {
1091
+ box(collider: RectShort): void;
1092
+ circle(collider: CircleShort): void;
1093
+ ellipse(collider: Ellipse): void;
1094
+ };
1095
+ device: Device;
1096
+ list: ColliderEntry[];
1097
+ createOptions(collider: DeviceCollider): ColliderOptions;
1098
+ destroy(): void;
1099
+ forEach(callback: (collider: DeviceCollider) => void): void;
1100
+ hideDebug(): void;
1101
+ showDebug(): void;
1102
+ }
1103
+
1104
+ interface Rect {
1105
+ x: number;
1106
+ y: number;
1107
+ width: number;
1108
+ height: number;
1109
+ }
1110
+
1111
+ interface BoundingBox {
1112
+ cachedBoundingBox: Rect;
1113
+ device: Device;
1114
+ hardcodedBoundingBox?: Rect;
1115
+ clearCached(): void;
1116
+ clearHardcoded(): void;
1117
+ getBoundingBox(): Rect;
1118
+ isHardcoded(): boolean;
1119
+ isInsideBoundingBox(x: number, y: number): boolean;
1120
+ setHardcoded(rect: Rect): void;
1121
+ }
1122
+
1123
+ interface AppearanceVariation {
1124
+ device: Device;
1125
+ resetAppearance(): void;
1126
+ setPreviewAppearance(): void;
1127
+ setRemovalAppearance(): void;
1128
+ }
1129
+
1130
+ interface BaseDevice {
1131
+ isPreview: boolean;
1132
+ placedByClient: boolean;
1133
+ isDestroyed: boolean;
1134
+ x: number;
1135
+ y: number;
1136
+ forceUseMyState: boolean;
1137
+ options: Record<string, any>;
1138
+ state: Record<string, any>;
1139
+ prevState: Record<string, any>;
1140
+ name: string;
1141
+ id: string;
1142
+ scene: Scene;
1143
+ deviceOption: DeviceOption;
1144
+ visualEditing: VisualEditing;
1145
+ shadows: Shadows;
1146
+ input: DeviceInput;
1147
+ parts: any;
1148
+ cull: Cull;
1149
+ boundingBox: BoundingBox;
1150
+ appearanceVariation: AppearanceVariation;
1151
+ colliders: Colliders;
1152
+ interactiveZones: InteractiveZones;
1153
+ deviceUI: DeviceUI;
1154
+ layers: Layers;
1155
+ wirePoints: WirePoints;
1156
+ tweens: DeviceTweens;
1157
+ projectiles: DeviceProjectiles;
1158
+ sensors: any;
1159
+ onHide: (() => void) | null;
1160
+ onShow: (() => void) | null;
1161
+ onUpdate: (() => void) | null;
1162
+ initialStateProcessing(state: Record<string, any>): Record<string, any>;
1163
+ getMaxDepth(): number;
1164
+ onStateUpdateFromServer(key: string, value: any): void;
1165
+ getRealKey(key: string): string;
1166
+ onPostUpdate(): void;
1167
+ onInit(): void;
1168
+ onMessage(message: {
1169
+ key: string;
1170
+ data: any;
1171
+ }): void;
1172
+ onStateChange(key: string): void;
1173
+ onDestroy(options: {
1174
+ isBeingReplaced: boolean;
1175
+ }): void;
1176
+ sendToServerDevice(key: string, data: any): void;
1177
+ openDeviceUI(): void;
1178
+ checkIfCollidersEnabled(): boolean;
1179
+ destroy(options: {
1180
+ isBeingReplaced: boolean;
1181
+ }): void;
1182
+ }
1183
+
1184
+ type Device = BaseDevice & {
1185
+ [key: string]: any;
1186
+ };
1187
+
1188
+ interface Cameras {
1189
+ allCameras: Device[];
1190
+ allCamerasNeedsUpdate: boolean;
1191
+ camerasPlayerIsInside: any[];
1192
+ scene: Scene;
1193
+ wasInPrePhase: boolean;
1194
+ findNewCameras(allCameras: Device[], x: number, y: number): any;
1195
+ setCurrentCameraSizeDevice(device: Device): void;
1196
+ switchToDefaultCameraSize(reset: boolean): void;
1197
+ update(devices: Device[]): void;
1198
+ }
1199
+
1200
+ interface Devices {
1201
+ allDevices: Device[];
1202
+ cameras: Cameras;
1203
+ devicesAction: DevicesAction;
1204
+ devicesInView: Device[];
1205
+ devicesPreview: DevicesPreview;
1206
+ devicesToPostUpdate: Set<Device>;
1207
+ devicesToUpdate: Set<Device>;
1208
+ interactives: WorldInteractives;
1209
+ scene: Scene;
1210
+ visualEditingManager: any;
1211
+ addDevice(device: Device): void;
1212
+ cullDevices(): void;
1213
+ findDeviceUnderMouse(): Device | undefined;
1214
+ getDeviceById(id: string): Device | undefined;
1215
+ hasDevice(id: string): boolean;
1216
+ removeDeviceById(id: string, options: {
1217
+ isBeingReplaced: boolean;
1218
+ }): void;
1219
+ update(dt: number): void;
1220
+ }
1221
+
1222
+ interface WorldManager {
1223
+ devices: Devices;
1224
+ inGameTerrainBuilder: InGameTerrainBuilder;
1225
+ physics: PhysicsManager;
1226
+ projectiles: Projectiles;
1227
+ scene: Scene;
1228
+ terrain: any;
1229
+ wires: any;
1230
+ update(dt: number): void;
1231
+ }
1232
+
1233
+ interface MovementPointer {
1234
+ id: string;
1235
+ x: number;
1236
+ y: number;
1237
+ downX: number;
1238
+ downY: number;
1239
+ }
1240
+
1241
+ interface Mouse {
1242
+ clickListeners: Map<string, (pointer: import("phaser").Input.Pointer) => void>;
1243
+ downX: number;
1244
+ downY: number;
1245
+ isHoldingDown: boolean;
1246
+ movementPointer?: MovementPointer;
1247
+ scene: Scene;
1248
+ stopRunningClickHandlers: boolean;
1249
+ worldX: number;
1250
+ worldY: number;
1251
+ x: number;
1252
+ y: number;
1253
+ addClickListener(options: {
1254
+ callback: (pointer: import("phaser").Input.Pointer) => void;
1255
+ }): () => void;
1256
+ pointerUpdate(pointer: import("phaser").Input.Pointer): void;
1257
+ removeClickListener(id: string): void;
1258
+ shouldBecomeMovementPointer(pointer: import("phaser").Input.Pointer): boolean;
1259
+ }
1260
+
1261
+ interface KeyboardState {
1262
+ isHoldingDown: boolean;
1263
+ isHoldingLeft: boolean;
1264
+ isHoldingRight: boolean;
1265
+ isHoldingUp: boolean;
1266
+ isHoldingSpace: boolean;
1267
+ }
1268
+
1269
+ interface Keyboard {
1270
+ heldKeys: Set<string>;
1271
+ scene: Scene;
1272
+ state: KeyboardState;
1273
+ createListeners(): void;
1274
+ isKeyDown(key: number): boolean;
1275
+ }
1276
+
1277
+ interface PressedKeys {
1278
+ up: boolean;
1279
+ down: boolean;
1280
+ left: boolean;
1281
+ right: boolean;
1282
+ }
1283
+
1284
+ interface Cursor {
1285
+ scene: Scene;
1286
+ createStateListeners(): void;
1287
+ updateCursor(): void;
1288
+ }
1289
+
1290
+ interface AimCursor {
1291
+ aimCursor: import("phaser").GameObjects.Sprite;
1292
+ aimCursorWorldPos: Vector;
1293
+ centerShiftX: number;
1294
+ centerShiftY: number;
1295
+ scene: Scene;
1296
+ x: number;
1297
+ y: number;
1298
+ update(): void;
1299
+ }
1300
+
1301
+ interface TickInput {
1302
+ angle: number | null;
1303
+ jump: boolean;
1304
+ _jumpKeyPressed: boolean;
1305
+ }
1306
+
1307
+ interface InputManager {
1308
+ aimCursor: AimCursor;
1309
+ currentInput: TickInput;
1310
+ cursor: Cursor;
1311
+ isListeningForInput: boolean;
1312
+ jumpedSinceLastPhysicsFetch: boolean;
1313
+ keyboard: Keyboard;
1314
+ mouse: Mouse;
1315
+ physicsInputHandledBetweenUpdates: boolean;
1316
+ scene: Scene;
1317
+ getAimingDirection(): Vector;
1318
+ getInputAngle(): number | null;
1319
+ getKeys(): PressedKeys;
1320
+ getMouseWorldXY(): Vector;
1321
+ getPhysicsInput(): TickInput;
1322
+ refreshInput(): void;
1323
+ update(): void;
1324
+ }
1325
+
1326
+ interface Scene extends BaseScene {
1327
+ actionManager: ActionManager;
1328
+ cameraHelper: any;
1329
+ characterManager: CharacterManager;
1330
+ dt: number;
1331
+ inputManager: InputManager;
1332
+ resizeManager: any;
1333
+ shadowsManager: any;
1334
+ spine: any;
1335
+ tileManager: TileManager;
1336
+ uiManager: any;
1337
+ worldManager: WorldManager;
1338
+ create(): void;
1339
+ }
1340
+
1341
+ interface Phaser {
1342
+ mainCharacter: Character;
1343
+ mainCharacterTeleported: boolean;
1344
+ scene: Scene;
1345
+ }
1346
+
1347
+ interface NetworkStore {
1348
+ attemptingToConnect: boolean;
1349
+ attemptingToReconnect: boolean;
1350
+ authId: string;
1351
+ client: any;
1352
+ clientConnectionString: string;
1353
+ error: any;
1354
+ errorFindingServerForGame: boolean;
1355
+ errorJoiningRoom: boolean;
1356
+ failedToReconnect: boolean;
1357
+ findingServerForGame: boolean;
1358
+ hasJoinedRoom: boolean;
1359
+ isOffline: boolean;
1360
+ isUpToDateWithPingPong: boolean;
1361
+ joinedRoom: boolean;
1362
+ phaseBeforeReconnect: string | null;
1363
+ ping: number;
1364
+ room: any;
1365
+ roomIntentErrorMessage: string;
1366
+ syncingAfterReconnection: boolean;
1367
+ }
1368
+
1369
+ interface Matchmaker {
1370
+ gameCode: string;
1371
+ }
1372
+
1373
+ interface Loading {
1374
+ completedInitialLoad: boolean;
1375
+ loadedInitialDevices: boolean;
1376
+ loadedInitialTerrain: boolean;
1377
+ percentageAssetsLoaded: number;
1378
+ }
1379
+
1380
+ interface Hooks {
1381
+ hookJSON: string;
1382
+ }
1383
+
1384
+ interface EditingStore {
1385
+ accessPoints: Map<any, any>;
1386
+ gridSnap: number;
1387
+ showMemoryBarAtAllTimes: boolean;
1388
+ }
1389
+
1390
+ interface Assignment {
1391
+ hasSavedProgress: boolean;
1392
+ objective: string;
1393
+ percentageComplete: number;
1394
+ }
1395
+
1396
+ interface ActivityFeed {
1397
+ feedItems: {
1398
+ id: string;
1399
+ message: string;
1400
+ }[];
1401
+ }
1402
+
1403
+ interface CustomAssetOption {
1404
+ id: string;
1405
+ maxOnMap: number;
1406
+ memoryCost: number;
1407
+ minimumRoleLevel?: number;
1408
+ validate: any;
1409
+ }
1410
+
1411
+ interface TerrainOption {
1412
+ id: string;
1413
+ name: string;
1414
+ maskTilesUrl: string;
1415
+ borderTilesUrl: string;
1416
+ fillUrl: string;
1417
+ blockedMapStyles?: string[];
1418
+ seasonTicketRequired?: boolean;
1419
+ previewUrl: string;
1420
+ health?: number;
1421
+ minimumRoleLevel?: number;
1422
+ }
1423
+
1424
+ interface SkinOption {
1425
+ id: string;
1426
+ name: string;
1427
+ minimumRoleLevel?: number;
1428
+ }
1429
+
1430
+ interface CircleShort {
1431
+ x: number;
1432
+ y: number;
1433
+ r: number;
1434
+ }
1435
+
1436
+ interface RectShort {
1437
+ x: number;
1438
+ y: number;
1439
+ w: number;
1440
+ h: number;
1441
+ }
1442
+
1443
+ interface RotatedRectShort extends RectShort {
1444
+ angle: number;
1445
+ }
1446
+
1447
+ interface RotatedEllipse extends Ellipse {
1448
+ angle: number;
1449
+ }
1450
+
1451
+ interface Ellipse {
1452
+ x: number;
1453
+ y: number;
1454
+ r1: number;
1455
+ r2: number;
1456
+ }
1457
+
1458
+ interface PropOption {
1459
+ id: string;
1460
+ name: string;
1461
+ scaleMultip: number;
1462
+ originX: number;
1463
+ originY: number;
1464
+ imageUrl: string;
1465
+ rectColliders: RotatedRectShort[];
1466
+ circleColliders: CircleShort[];
1467
+ ellipseColliders: RotatedEllipse[];
1468
+ shadows: Ellipse[];
1469
+ seasonTicketRequired?: boolean;
1470
+ minimumRoleLevel?: number;
1471
+ defaultLayer?: string;
1472
+ }
1473
+
1474
+ interface WeaponShared {
1475
+ cooldownBetweenShots: number;
1476
+ allowAutoFire: boolean;
1477
+ startingProjectileDistanceFromCharacter: number;
1478
+ }
1479
+
1480
+ interface Weapon {
1481
+ type: string;
1482
+ appearance: string;
1483
+ shared: WeaponShared;
1484
+ bullet?: {
1485
+ ammoItemId: string;
1486
+ };
1487
+ }
1488
+
1489
+ interface ItemOption {
1490
+ type: string;
1491
+ id: string;
1492
+ name: string;
1493
+ editorName: string;
1494
+ description: string;
1495
+ previewImage: string;
1496
+ rarity?: string;
1497
+ weapon?: Weapon;
1498
+ minimumRoleLevel?: number;
1499
+ useCommand?: string;
1500
+ consumeType?: string;
1501
+ terrainId?: string;
1502
+ maxStackSize?: number;
1503
+ }
1504
+
1505
+ interface OptionSchema {
1506
+ options: any[];
1507
+ categories?: any[];
1508
+ }
1509
+
1510
+ interface DeviceInfo {
1511
+ id: string;
1512
+ name: string;
1513
+ description?: string;
1514
+ optionSchema: OptionSchema;
1515
+ defaultState: any;
1516
+ codeGridSchema: CodeGridSchema;
1517
+ wireConfig?: any;
1518
+ minimumRoleLevel?: number;
1519
+ maxOnMap?: number;
1520
+ initialMemoryCost?: number;
1521
+ subsequentMemoryCost?: number;
1522
+ supportedMapStyles?: string[];
1523
+ seasonTicketRequired?: boolean;
1524
+ maximumRoleLevel?: number;
1525
+ }
1526
+
1527
+ interface CodeGrids {
1528
+ blockCategories: string;
1529
+ customBlocks: string;
1530
+ customBlocksParsed: any[];
1531
+ }
1532
+
1533
+ interface WorldOptions {
1534
+ codeGrids: CodeGrids;
1535
+ customAssetsOptions: CustomAssetOption[];
1536
+ deviceOptions: DeviceInfo[];
1537
+ hasAllProps: boolean;
1538
+ itemOptions: ItemOption[];
1539
+ propsOptions: PropOption[];
1540
+ skinOptions: SkinOption[];
1541
+ terrainOptions: TerrainOption[];
1542
+ }
1543
+
1544
+ interface Limits {
1545
+ blocksPerCodeGrid: number;
1546
+ codeGrids: number;
1547
+ codeGridsPerDevice: number;
1548
+ collidingTiles: number;
1549
+ customAssetOnMapDefault: number;
1550
+ deviceMaxOnMapDefault: number;
1551
+ nonCollidingTiles: number;
1552
+ wires: number;
1553
+ }
1554
+
1555
+ interface Counters {
1556
+ codeGrids: number;
1557
+ collidingTiles: number;
1558
+ customAssets: Map<string, number>;
1559
+ devices: Map<string, number>;
1560
+ nonCollidingTiles: number;
1561
+ wires: number;
1562
+ }
1563
+
1564
+ interface Costs {
1565
+ codeGrid: number;
1566
+ collidingTile: number;
1567
+ customAssetDefault: number;
1568
+ deviceInitialDefault: number;
1569
+ deviceSubsequentDefault: number;
1570
+ nonCollidingTile: number;
1571
+ wire: number;
1572
+ }
1573
+
1574
+ interface MemorySystem {
1575
+ costs: Costs;
1576
+ counters: Counters;
1577
+ limits: Limits;
1578
+ maxUsedMemory: number;
1579
+ usedMemoryCost: number;
1580
+ }
1581
+
1582
+ interface CharacterData {
1583
+ allowWeaponFire: boolean;
1584
+ existsBeforeReconnect: boolean;
1585
+ fragility: number;
1586
+ health: number;
1587
+ id: string;
1588
+ isActive: boolean;
1589
+ lastPlayersTeamId: string;
1590
+ name: string;
1591
+ permissions: Permissions;
1592
+ score: number;
1593
+ teamId: string;
1594
+ type: string;
1595
+ }
1596
+
1597
+ interface Characters {
1598
+ characters: Map<string, CharacterData>;
1599
+ }
1600
+
1601
+ interface Scorebar {
1602
+ teamColors: string[];
1603
+ teams: string[];
1604
+ }
1605
+
1606
+ interface NoneGui {
1607
+ addMenu: {
1608
+ screen: string;
1609
+ };
1610
+ duringGameScreenVisible: boolean;
1611
+ optionsMenu: {
1612
+ screen: string;
1613
+ };
1614
+ screen: string;
1615
+ }
1616
+
1617
+ interface Modals {
1618
+ closeAllModals: () => void;
1619
+ cosmosModalOpen: boolean;
1620
+ switchToRegisterScreenWhenCosmosModalOpens: boolean;
1621
+ }
1622
+
1623
+ interface KnockoutAlert {
1624
+ id: string;
1625
+ name: string;
1626
+ }
1627
+
1628
+ interface GuiSlot {
1629
+ id: string;
1630
+ position: string;
1631
+ text: string;
1632
+ trackedItemId: any;
1633
+ showTrackedItemMaximumAmount: boolean;
1634
+ type: string;
1635
+ priority: number;
1636
+ color: string;
1637
+ }
1638
+
1639
+ interface DamageIndicator {
1640
+ show: boolean;
1641
+ /** `h` for red, `s` for blue, and any other string for yellow. */
1642
+ type: string;
1643
+ }
1644
+
1645
+ interface BottomInGamePrimaryContent {
1646
+ interactionWantsToBeVisible: boolean;
1647
+ prioritizeInteraction: boolean;
1648
+ }
1649
+
1650
+ interface Achievement {
1651
+ id: string;
1652
+ key: string;
1653
+ reset: () => void;
1654
+ update: () => void;
1655
+ }
1656
+
1657
+ interface GUI {
1658
+ achievement: Achievement;
1659
+ bottomInGamePrimaryContent: BottomInGamePrimaryContent;
1660
+ damageIndicator: DamageIndicator;
1661
+ guiSlots: GuiSlot[];
1662
+ guiSlotsChangeCounter: number;
1663
+ knockoutAlerts: KnockoutAlert[];
1664
+ modals: Modals;
1665
+ none: NoneGui;
1666
+ openInputBlockingUI: string[];
1667
+ playersManagerUpdateCounter: number;
1668
+ scale: number;
1669
+ scorebar?: Scorebar;
1670
+ selectedPlayerId: string;
1671
+ showingGrid: boolean;
1672
+ }
1673
+
1674
+ interface Permissions {
1675
+ adding: boolean;
1676
+ editing: boolean;
1677
+ manageCodeGrids: boolean;
1678
+ removing: boolean;
1679
+ }
1680
+
1681
+ interface GameSession {
1682
+ callToAction: any;
1683
+ countdownEnd: number;
1684
+ phase: string;
1685
+ resultsEnd: number;
1686
+ widgets: {
1687
+ widgets: any[];
1688
+ };
1689
+ }
1690
+
1691
+ interface Session {
1692
+ allowGoogleTranslate: boolean;
1693
+ amIGameOwner: boolean;
1694
+ canAddGameTime: boolean;
1695
+ cosmosBlocked: boolean;
1696
+ customTeams: {
1697
+ characterToTeamMap: Map<string, string>;
1698
+ };
1699
+ duringTransition: boolean;
1700
+ gameClockDuration: string;
1701
+ gameOwnerId: string;
1702
+ gameSession: GameSession;
1703
+ gameTime: number;
1704
+ gameTimeLastUpdateAt: number;
1705
+ globalPermissions: Permissions;
1706
+ loadingPhase: boolean;
1707
+ mapCreatorRoleLevel: number;
1708
+ mapStyle: string;
1709
+ modeType: string;
1710
+ ownerRole: string;
1711
+ phase: string;
1712
+ phaseChangedAt: number;
1713
+ version: string;
1714
+ }
1715
+
1716
+ interface ZoneDropOverrides {
1717
+ allowItemDrop: boolean;
1718
+ allowResourceDrop: boolean;
1719
+ allowWeaponDrop: boolean;
1720
+ }
1721
+
1722
+ interface XPAddition {
1723
+ amount: number;
1724
+ reason: string;
1725
+ xp: number;
1726
+ }
1727
+
1728
+ interface XP {
1729
+ additionTimeouts: Map<string, ReturnType<typeof setTimeout>>;
1730
+ additions: XPAddition[];
1731
+ showingLevelUp: boolean;
1732
+ }
1733
+
1734
+ interface MeSpectating {
1735
+ id: string;
1736
+ name: string;
1737
+ shuffle: boolean;
1738
+ }
1739
+
1740
+ interface TileToRemove {
1741
+ depth: number;
1742
+ id: string;
1743
+ x: number;
1744
+ y: number;
1745
+ }
1746
+
1747
+ interface Removing {
1748
+ deviceIdToRemove?: string;
1749
+ removingMode: string;
1750
+ removingTilesEraserSize: number;
1751
+ removingTilesLayer: number;
1752
+ removingTilesMode: string;
1753
+ tilesToRemove: TileToRemove[];
1754
+ wireIdToRemove?: string;
1755
+ }
1756
+
1757
+ interface NonDismissMessage {
1758
+ description: string;
1759
+ title: string;
1760
+ }
1761
+
1762
+ interface Mood {
1763
+ activeDeviceId: string;
1764
+ vignetteActive: boolean;
1765
+ vignetteStrength: number;
1766
+ }
1767
+
1768
+ interface MobileControls {
1769
+ left: boolean;
1770
+ right: boolean;
1771
+ up: boolean;
1772
+ }
1773
+
1774
+ interface InventorySlot {
1775
+ amount: number;
1776
+ existsBeforeReconnect: boolean;
1777
+ }
1778
+
1779
+ interface AlertFeed {
1780
+ amount: number;
1781
+ itemId: string;
1782
+ }
1783
+
1784
+ interface InteractiveSlot {
1785
+ clipSize: number;
1786
+ count: number;
1787
+ currentClip: number;
1788
+ durability: number;
1789
+ itemId: string;
1790
+ waiting: boolean;
1791
+ waitingEndTime: number;
1792
+ waitingStartTime: number;
1793
+ }
1794
+
1795
+ interface Inventory {
1796
+ activeInteractiveSlot: number;
1797
+ alertFeed?: AlertFeed;
1798
+ alertsFeed: AlertFeed[];
1799
+ currentWaitingEndTime: number;
1800
+ infiniteAmmo: boolean;
1801
+ interactiveSlotErrorMessageTimeouts: Map<string, ReturnType<typeof setTimeout>>;
1802
+ interactiveSlotErrorMessages: Map<string, string>;
1803
+ interactiveSlots: Map<string, InteractiveSlot>;
1804
+ interactiveSlotsOrder: number[];
1805
+ isCurrentWaitingSoundForItem: boolean;
1806
+ lastShotsTimestamps: Map<string, number>;
1807
+ maxSlots: number;
1808
+ slots: Map<string, InventorySlot>;
1809
+ }
1810
+
1811
+ interface InteractiveInfo {
1812
+ action: string;
1813
+ allowedToInteract: boolean;
1814
+ message: string;
1815
+ topHeader?: string;
1816
+ topHeaderColor: string;
1817
+ }
1818
+
1819
+ interface Interactives {
1820
+ deviceId: string;
1821
+ info: InteractiveInfo;
1822
+ }
1823
+
1824
+ interface Health {
1825
+ fragility: number;
1826
+ health: number;
1827
+ lives: number;
1828
+ maxHealth: number;
1829
+ maxShield: number;
1830
+ shield: number;
1831
+ }
1832
+
1833
+ interface EditingPreferences {
1834
+ cameraZoom: number;
1835
+ movementSpeed: number | null;
1836
+ phase: boolean | null;
1837
+ showGrid: boolean | null;
1838
+ topDownControlsActive: boolean;
1839
+ }
1840
+
1841
+ interface CurrentlyEditedDevice {
1842
+ deviceOptionId: string;
1843
+ id: string;
1844
+ }
1845
+
1846
+ interface EditingDevice {
1847
+ currentlyEditedDevice: CurrentlyEditedDevice;
1848
+ currentlyEditedGridId: string;
1849
+ currentlySortedDeviceId: string;
1850
+ screen: string;
1851
+ sortingState: any[];
1852
+ usingMultiselect: boolean;
1853
+ visualEditing: any;
1854
+ }
1855
+
1856
+ interface Editing {
1857
+ device: EditingDevice;
1858
+ preferences: EditingPreferences;
1859
+ wire: {
1860
+ currentlyEditedWireId: string;
1861
+ };
1862
+ }
1863
+
1864
+ interface MeDeviceUI {
1865
+ current: {
1866
+ deviceId: string;
1867
+ props: any;
1868
+ };
1869
+ desiredOpenDeviceId?: string;
1870
+ serverVersionOpenDeviceId: string;
1871
+ }
1872
+
1873
+ interface MeCustomAssets {
1874
+ currentData?: {
1875
+ shapes: Shapes;
1876
+ };
1877
+ currentIcon: string;
1878
+ currentId: string;
1879
+ currentName: string;
1880
+ currentOptionId: string;
1881
+ isUIOpen: boolean;
1882
+ openOptionId: string | null;
1883
+ pendingDeleteId: string | null;
1884
+ showDeleteConfirm: boolean;
1885
+ }
1886
+
1887
+ interface Context {
1888
+ cursorIsOverCharacterId: string;
1889
+ __devicesUnderCursor: string[];
1890
+ __wiresUnderCursor: Set<string>;
1891
+ cursorIsOverDevice: boolean;
1892
+ cursorIsOverWire: boolean;
1893
+ }
1894
+
1895
+ interface ClassDesigner {
1896
+ activeClassDeviceId: string;
1897
+ lastActivatedClassDeviceId: string;
1898
+ lastClassDeviceActivationId: number;
1899
+ }
1900
+
1901
+ interface CinematicMode {
1902
+ charactersVisible: boolean;
1903
+ enabled: boolean;
1904
+ followingMainCharacter: boolean;
1905
+ hidingGUI: boolean;
1906
+ mainCharacterVisible: boolean;
1907
+ nameTagsVisible: boolean;
1908
+ }
1909
+
1910
+ interface AddingWires {
1911
+ hoveringOverSupportedDevice: boolean;
1912
+ pointUnderMouseDeviceId?: string;
1913
+ startDeviceSelected: boolean;
1914
+ }
1915
+
1916
+ interface AddingTerrain {
1917
+ brushSize: number;
1918
+ buildTerrainAsWall: boolean;
1919
+ currentlySelectedTerrain: string;
1920
+ currentlySelectedTerrainDepth: number;
1921
+ }
1922
+
1923
+ interface ExistingDevice {
1924
+ action: string;
1925
+ id: string;
1926
+ shiftX: number;
1927
+ shiftY: number;
1928
+ use: boolean;
1929
+ }
1930
+
1931
+ interface AddingDevices {
1932
+ currentlySelectedProp: string;
1933
+ existingDevice: ExistingDevice;
1934
+ selectedDeviceType: string;
1935
+ }
1936
+
1937
+ interface Adding {
1938
+ devices: AddingDevices;
1939
+ terrain: AddingTerrain;
1940
+ wires: AddingWires;
1941
+ mode: string;
1942
+ }
1943
+
1944
+ interface Me {
1945
+ adding: Adding;
1946
+ cinematicMode: CinematicMode;
1947
+ classDesigner: ClassDesigner;
1948
+ completedInitialPlacement: boolean;
1949
+ context: Context;
1950
+ currentAction: string;
1951
+ customAssets: MeCustomAssets;
1952
+ deviceUI: MeDeviceUI;
1953
+ editing: Editing;
1954
+ gotKicked: boolean;
1955
+ health: Health;
1956
+ interactives: Interactives;
1957
+ inventory: Inventory;
1958
+ isRespawning: boolean;
1959
+ mobileControls: MobileControls;
1960
+ mood: Mood;
1961
+ movementSpeed: number;
1962
+ myTeam: string;
1963
+ nonDismissMessage: NonDismissMessage;
1964
+ phase: boolean;
1965
+ preferences: {
1966
+ startGameWithMode: string;
1967
+ };
1968
+ properties: Map<string, any>;
1969
+ removing: Removing;
1970
+ roleLevel: number;
1971
+ spawnPosition: Vector;
1972
+ spectating: MeSpectating;
1973
+ teleportCount: number;
1974
+ unredeemeedXP: number;
1975
+ xp: XP;
1976
+ zoneDropOverrides: ZoneDropOverrides;
1977
+ }
1978
+
1979
+ interface QueuedTile {
1980
+ timestamp: number;
1981
+ removedBodyIds: string[];
1982
+ }
1983
+
1984
+ interface Tile {
1985
+ collides: boolean;
1986
+ depth: number;
1987
+ terrain: string;
1988
+ x: number;
1989
+ y: number;
1990
+ }
1991
+
1992
+ interface Terrain {
1993
+ currentTerrainUpdateId: number;
1994
+ modifiedHealth: Map<string, number>;
1995
+ queuedTiles: Map<number, QueuedTile>;
1996
+ teamColorTiles: Map<string, string>;
1997
+ tiles: Map<string, Tile>;
1998
+ }
1999
+
2000
+ interface DeviceState {
2001
+ deviceId: string;
2002
+ properties: Map<string, any>;
2003
+ }
2004
+
2005
+ interface CodeGridItem {
2006
+ createdAt: number;
2007
+ existsBeforeReconnect: boolean;
2008
+ json: string;
2009
+ triggerType: string;
2010
+ owner?: string;
2011
+ triggerValue?: string;
2012
+ visitors: string[];
2013
+ }
2014
+
2015
+ interface CodeGrid {
2016
+ existsBeforeReconnect: boolean;
2017
+ items: Map<string, CodeGridItem>;
2018
+ }
2019
+
2020
+ interface CodeGridSchema {
2021
+ allowChannelGrids: boolean;
2022
+ customBlocks: any[];
2023
+ triggers: any[];
2024
+ }
2025
+
2026
+ interface DeviceOption {
2027
+ codeGridSchema: CodeGridSchema;
2028
+ defaultState: any;
2029
+ id: string;
2030
+ optionSchema: {
2031
+ options: any[];
2032
+ };
2033
+ wireConfig: any;
2034
+ }
2035
+
2036
+ interface DeviceData {
2037
+ depth: number;
2038
+ deviceOption: DeviceOption;
2039
+ existsBeforeReconnect: boolean;
2040
+ hooks: any;
2041
+ id: string;
2042
+ isPreview: boolean;
2043
+ layerId: string;
2044
+ name: any;
2045
+ options: Record<string, any>;
2046
+ props: any;
2047
+ x: number;
2048
+ y: number;
2049
+ }
2050
+
2051
+ interface WorldDevices {
2052
+ codeGrids: Map<string, CodeGrid>;
2053
+ devices: Map<string, DeviceData>;
2054
+ states: Map<string, DeviceState>;
2055
+ }
2056
+
2057
+ interface Shapes {
2058
+ circles: number[][];
2059
+ lines: number[][];
2060
+ paths: number[][];
2061
+ rects: number[][];
2062
+ }
2063
+
2064
+ interface CustomAsset {
2065
+ data: {
2066
+ shapes: Shapes;
2067
+ };
2068
+ icon: string;
2069
+ id: string;
2070
+ name: string;
2071
+ optionId: string;
2072
+ }
2073
+
2074
+ interface WorldCustomAssets {
2075
+ customAssets: Map<string, CustomAsset>;
2076
+ isUIOpen: boolean;
2077
+ updateCounter: number;
2078
+ }
2079
+
2080
+ interface World {
2081
+ customAssets: WorldCustomAssets;
2082
+ devices: WorldDevices;
2083
+ height: number;
2084
+ width: number;
2085
+ mapOptionsJSON: string;
2086
+ terrain: Terrain;
2087
+ wires: {
2088
+ wires: Map<any, any>;
2089
+ };
2090
+ }
2091
+
2092
+ interface Stores {
2093
+ activityFeed: ActivityFeed;
2094
+ assignment: Assignment;
2095
+ characters: Characters;
2096
+ editing: EditingStore;
2097
+ gui: GUI;
2098
+ hooks: Hooks;
2099
+ loading: Loading;
2100
+ matchmaker: Matchmaker;
2101
+ me: Me;
2102
+ memorySystem: MemorySystem;
2103
+ network: NetworkStore;
2104
+ phaser: Phaser;
2105
+ scene: SceneStore;
2106
+ session: Session;
2107
+ teams: Teams;
2108
+ world: World;
2109
+ worldOptions: WorldOptions;
2110
+ }
2111
+ }
2112
+
2113
+ class PluginsApi {
2114
+ /** A list of all the plugins installed */
2115
+ get list(): string[];
2116
+ /** Whether a plugin exists and is enabled */
2117
+ isEnabled(name: string): boolean;
2118
+ /** Gets the headers of a plugin, such as version, author, and description */
2119
+ getHeaders(name: string): {
2120
+ name: string;
2121
+ description: string;
2122
+ author: string;
2123
+ version: string | null;
2124
+ reloadRequired: string;
2125
+ isLibrary: string;
2126
+ downloadUrl: string | null;
2127
+ webpage: string | null;
2128
+ needsLib: string[];
2129
+ optionalLib: string[];
2130
+ syncEval: string;
2131
+ gamemode: string[];
2132
+ hasSettings: string;
2133
+ };
2134
+ /** Gets the exported values of a plugin, if it has been enabled */
2135
+ get(name: string): any;
2136
+ /**
2137
+ * @deprecated Use {@link get} instead
2138
+ * @hidden
2139
+ */
2140
+ getPlugin(name: string): {
2141
+ return: any;
2142
+ };
2143
+ }
2144
+
2145
+ class LibsApi {
2146
+ /** A list of all the libraries installed */
2147
+ get list(): string[];
2148
+ /** Gets whether or not a plugin is installed and enabled */
2149
+ isEnabled(name: string): boolean;
2150
+ /** Gets the headers of a library, such as version, author, and description */
2151
+ getHeaders(name: string): {
2152
+ name: string;
2153
+ description: string;
2154
+ author: string;
2155
+ version: string | null;
2156
+ reloadRequired: string;
2157
+ isLibrary: string;
2158
+ downloadUrl: string | null;
2159
+ webpage: string | null;
2160
+ needsLib: string[];
2161
+ optionalLib: string[];
2162
+ syncEval: string;
2163
+ gamemode: string[];
2164
+ hasSettings: string;
2165
+ };
2166
+ /** Gets the exported values of a library */
2167
+ get(name: string): any;
2168
+ }
2169
+
2170
+ class ScopedRewriterApi {
2171
+ private readonly id;
2172
+ constructor(id: string);
2173
+ /**
2174
+ * Creates a hook that will modify the code of a script before it is run.
2175
+ * This value is cached, so this hook may not run on subsequent page loads.
2176
+ * addParseHook should always be called in the top level of a script.
2177
+ * @param prefix Limits the hook to only running on scripts beginning with this prefix.
2178
+ * Passing `true` will only run on the index script, and passing `false` will run on all scripts.
2179
+ * @param callback The function that will modify the code. Should return the modified code. Cannot have side effects.
2180
+ */
2181
+ addParseHook(prefix: string | boolean, callback: (code: string) => string): () => void;
2182
+ /**
2183
+ * Creates a shared value that can be accessed from any script.
2184
+ * @param id A unique identifier for the shared value.
2185
+ * @param value The value to be shared.
2186
+ * @returns A string representing the code to access the shared value.
2187
+ */
2188
+ createShared(id: string, value: any): string;
2189
+ /** Removes the shared value with a certain id created by {@link createShared} */
2190
+ removeSharedById(id: string): void;
2191
+ }
2192
+
2193
+ class RewriterApi {
2194
+ /**
2195
+ * Creates a hook that will modify the code of a script before it is run.
2196
+ * This value is cached, so this hook may not run on subsequent page loads.
2197
+ * addParseHook should always be called in the top level of a script.
2198
+ * @param pluginName The name of the plugin creating the hook.
2199
+ * @param prefix Limits the hook to only running on scripts beginning with this prefix.
2200
+ * Passing `true` will only run on the index script, and passing `false` will run on all scripts.
2201
+ * @param callback The function that will modify the code. Should return the modified code. Cannot have side effects.
2202
+ */
2203
+ addParseHook(pluginName: string, prefix: string | boolean, callback: (code: string) => string): () => void;
2204
+ /** Removes all hooks created by a certain plugin */
2205
+ removeParseHooks(pluginName: string): void;
2206
+ /**
2207
+ * Creates a shared value that can be accessed from any script.
2208
+ * @param pluginName The name of the plugin creating the shared value.
2209
+ * @param id A unique identifier for the shared value.
2210
+ * @param value The value to be shared.
2211
+ * @returns A string representing the code to access the shared value.
2212
+ */
2213
+ createShared(pluginName: string, id: string, value: any): string;
2214
+ /** Removes all values created by {@link createShared} by a certain plugin */
2215
+ removeShared(pluginName: string): void;
2216
+ /** Removes the shared value with a certain id created by {@link createShared} */
2217
+ removeSharedById(pluginName: string, id: string): void;
2218
+ }
2219
+
2220
+ class ScopedPatcherApi {
2221
+ private readonly id;
2222
+ constructor(id: string);
2223
+ /**
2224
+ * Runs a callback after a function on an object has been run
2225
+ * @returns A function to remove the patch
2226
+ */
2227
+ after(object: any, method: string, callback: PatcherAfterCallback): () => void;
2228
+ /**
2229
+ * Runs a callback before a function on an object has been run.
2230
+ * Return true from the callback to prevent the function from running
2231
+ * @returns A function to remove the patch
2232
+ */
2233
+ before(object: any, method: string, callback: PatcherBeforeCallback): () => void;
2234
+ /**
2235
+ * Runs a function instead of a function on an object
2236
+ * @returns A function to remove the patch
2237
+ */
2238
+ instead(object: any, method: string, callback: PatcherInsteadCallback): () => void;
2239
+ }
2240
+
2241
+ type PatcherAfterCallback = (thisVal: any, args: IArguments, returnVal: any) => any;
373
2242
 
374
- interface ModalButton {
375
- text: string;
376
- style?: "primary" | "danger" | "close";
377
2243
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
378
- onClick?: (event: MouseEvent) => boolean | void;
379
- }
2244
+ type PatcherBeforeCallback = (thisVal: any, args: IArguments) => boolean | void;
380
2245
 
381
- interface ModalOptions {
382
- id: string;
383
- title: string;
384
- style: string;
385
- className: string;
386
- closeOnBackgroundClick: boolean;
387
- buttons: ModalButton[];
388
- onClosed: () => void;
389
- }
2246
+ type PatcherInsteadCallback = (thisVal: any, args: IArguments) => void;
390
2247
 
391
- class BaseUIApi {
392
- /** Shows a customizable modal to the user */
393
- showModal(element: HTMLElement | import("react").ReactElement, options?: Partial<ModalOptions>): void;
394
- }
2248
+ class PatcherApi {
2249
+ /**
2250
+ * Runs a callback after a function on an object has been run
2251
+ * @returns A function to remove the patch
2252
+ */
2253
+ after(id: string, object: any, method: string, callback: PatcherAfterCallback): () => void;
2254
+ /**
2255
+ * Runs a callback before a function on an object has been run.
2256
+ * Return true from the callback to prevent the function from running
2257
+ * @returns A function to remove the patch
2258
+ */
2259
+ before(id: string, object: any, method: string, callback: PatcherBeforeCallback): () => void;
2260
+ /**
2261
+ * Runs a function instead of a function on an object
2262
+ * @returns A function to remove the patch
2263
+ */
2264
+ instead(id: string, object: any, method: string, callback: PatcherInsteadCallback): () => void;
2265
+ /** Removes all patches with a given id */
2266
+ unpatchAll(id: string): void;
2267
+ }
395
2268
 
396
- class UIApi extends BaseUIApi {
397
- /**
398
- * Adds a style to the DOM
399
- * @returns A function to remove the styles
400
- */
401
- addStyles(id: string, style: string): () => void;
402
- /** Remove all styles with a given id */
403
- removeStyles(id: string): void;
404
- }
2269
+ class ScopedStorageApi {
2270
+ private readonly id;
2271
+ constructor(id: string);
2272
+ /** Gets a value that has previously been saved */
2273
+ getValue(key: string, defaultValue?: any): any;
2274
+ /** Sets a value which can be retrieved later, persisting through reloads */
2275
+ setValue(key: string, value: any): void;
2276
+ /** Removes a value which has been saved */
2277
+ deleteValue(key: string): void;
2278
+ /** Adds a listener for when a stored value with a certain key changes */
2279
+ onChange(key: string, callback: ValueChangeCallback): () => void;
2280
+ }
405
2281
 
406
- class ScopedNetApi extends BaseNetApi {
407
- private readonly id;
408
- private readonly defaultGamemode;
409
- constructor(id: string, defaultGamemode: string[]);
410
- /**
411
- * Runs a callback when the game is loaded, or runs it immediately if the game has already loaded.
412
- * If the \@gamemode header is set the callback will only fire if the gamemode matches one of the provided gamemodes.
413
- * @returns A function to cancel waiting for load
414
- */
415
- onLoad(callback: (type: ConnectionType, gamemode: string) => void, gamemode?: string | string[]): () => void;
416
- }
2282
+ type ValueChangeCallback = (value: any, remote: boolean) => void;
417
2283
 
418
- type ConnectionType = "None" | "Colyseus" | "Blueboat";
419
-
420
- class BaseNetApi extends EventEmitter2 {
421
- constructor();
422
- /** Which type of server the client is currently connected to */
423
- get type(): ConnectionType;
424
- /** The id of the gamemode the player is currently playing */
425
- get gamemode(): string;
426
- /** The room that the client is connected to, or null if there is no connection */
427
- get room(): any;
428
- /** Whether the user is the one hosting the current game */
429
- get isHost(): boolean;
430
- /** Sends a message to the server on a specific channel */
431
- send(channel: string, message: any): void;
432
- }
2284
+ class StorageApi {
2285
+ /** Gets a value that has previously been saved */
2286
+ getValue(pluginName: string, key: string, defaultValue?: any): any;
2287
+ /** Sets a value which can be retrieved later, through reloads */
2288
+ setValue(pluginName: string, key: string, value: any): void;
2289
+ /** Removes a value which has been saved */
2290
+ deleteValue(pluginName: string, key: string): void;
2291
+ /**
2292
+ * @deprecated use {@link deleteValue}
2293
+ * @hidden
2294
+ */
2295
+ get removeValue(): (pluginName: string, key: string) => void;
2296
+ /** Adds a listener for when a plugin's stored value with a certain key changes */
2297
+ onChange(pluginName: string, key: string, callback: ValueChangeCallback): () => void;
2298
+ /** Removes a listener added by onChange */
2299
+ offChange(pluginName: string, key: string, callback: ValueChangeCallback): void;
2300
+ /** Removes all listeners added by onChange for a certain plugin */
2301
+ offAllChanges(pluginName: string): void;
2302
+ }
433
2303
 
434
- class NetApi extends BaseNetApi {
435
- constructor();
436
- /**
437
- * Runs a callback when the game is loaded, or runs it immediately if the game has already loaded
438
- * @returns A function to cancel waiting for load
439
- */
440
- onLoad(
441
- id: string,
442
- callback: (type: ConnectionType, gamemode: string) => void,
443
- gamemode?: string | string[],
444
- ): () => void;
445
- /** Cancels any calls to {@link onLoad} with the same id */
446
- offLoad(id: string): void;
447
- /**
448
- * @deprecated Methods for both transports are now on the base net api
449
- * @hidden
450
- */
451
- get colyseus(): this;
452
- /**
453
- * @deprecated Methods for both transports are now on the base net api
454
- * @hidden
455
- */
456
- get blueboat(): this;
457
- /** @hidden */
458
- private wrappedListeners;
459
- /**
460
- * @deprecated use net.on
461
- * @hidden
462
- */
463
- addEventListener(channel: string, callback: (...args: any[]) => void): void;
464
- /**
465
- * @deprecated use net.off
466
- * @hidden
467
- */
468
- removeEventListener(channel: string, callback: (...args: any[]) => void): void;
469
- }
2304
+ class ScopedUIApi extends BaseUIApi {
2305
+ private readonly id;
2306
+ constructor(id: string);
2307
+ /**
2308
+ * Adds a style to the DOM
2309
+ * @returns A function to remove the styles
2310
+ */
2311
+ addStyles(style: string): () => void;
2312
+ }
470
2313
 
471
- class ScopedParcelApi extends BaseParcelApi {
472
- private readonly id;
473
- constructor(id: string);
474
- /**
475
- * Waits for a module to be loaded, then runs a callback
476
- * @returns A function to cancel waiting for the module
477
- */
478
- getLazy(): () => void;
479
- }
2314
+ interface ModalButton {
2315
+ text: string;
2316
+ style?: "primary" | "danger" | "close";
2317
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
2318
+ onClick?: (event: MouseEvent) => boolean | void;
2319
+ }
480
2320
 
481
- class BaseParcelApi {
482
- /**
483
- * Gets a module based on a filter, returns null if none are found
484
- * Be cautious when using this- plugins will often run before any modules load in,
485
- * meaning that if this is run on startup it will likely return nothing.
486
- * Consider using getLazy instead.
487
- */
488
- query(): any;
489
- /**
490
- * Returns an array of all loaded modules matching a filter
491
- * Be cautious when using this- plugins will often run before any modules load in,
492
- * meaning that if this is run on startup it will likely return nothing.
493
- * Consider using getLazy instead.
494
- */
495
- queryAll(): any[];
496
- }
2321
+ interface ModalOptions {
2322
+ id: string;
2323
+ title: string;
2324
+ style: string;
2325
+ className: string;
2326
+ closeOnBackgroundClick: boolean;
2327
+ buttons: ModalButton[];
2328
+ onClosed: () => void;
2329
+ }
497
2330
 
498
- class ParcelApi extends BaseParcelApi {
499
- /**
500
- * Waits for a module to be loaded, then runs a callback
501
- * @returns A function to cancel waiting for the module
502
- */
503
- getLazy(): () => void;
504
- /** Cancels any calls to getLazy with the same id */
505
- stopLazy(): void;
506
- /**
507
- * @deprecated Use {@link getLazy} instead
508
- * @hidden
509
- */
510
- get interceptRequire(): () => () => void;
511
- /**
512
- * @deprecated Use {@link stopLazy} instead
513
- * @hidden
514
- */
515
- get stopIntercepts(): () => void;
516
- }
2331
+ class BaseUIApi {
2332
+ /** Shows a customizable modal to the user */
2333
+ showModal(element: HTMLElement | import("react").ReactElement, options?: Partial<ModalOptions>): void;
2334
+ }
517
2335
 
518
- class ScopedHotkeysApi extends BaseHotkeysApi {
519
- private readonly id;
520
- constructor(id: string);
521
- /**
522
- * Adds a hotkey which will fire when certain keys are pressed
523
- * @returns A function to remove the hotkey
524
- */
525
- addHotkey(options: HotkeyOptions, callback: KeyboardCallback): () => void;
526
- /**
527
- * Adds a hotkey which can be changed by the user
528
- * @returns A function to remove the hotkey
529
- */
530
- addConfigurableHotkey(options: ConfigurableHotkeyOptions, callback: KeyboardCallback): () => void;
531
- }
2336
+ class UIApi extends BaseUIApi {
2337
+ /**
2338
+ * Adds a style to the DOM
2339
+ * @returns A function to remove the styles
2340
+ */
2341
+ addStyles(id: string, style: string): () => void;
2342
+ /** Remove all styles with a given id */
2343
+ removeStyles(id: string): void;
2344
+ }
532
2345
 
533
- type KeyboardCallback = (e: KeyboardEvent) => void;
534
-
535
- class BaseHotkeysApi {
536
- /**
537
- * Releases all keys, needed if a hotkey opens something that will
538
- * prevent keyup events from being registered, such as an alert
539
- */
540
- releaseAll(): void;
541
- /** Which key codes are currently being pressed */
542
- get pressed(): Set<string>;
543
- /**
544
- * @deprecated Use {@link pressed} instead
545
- * @hidden
546
- */
547
- get pressedKeys(): Set<string>;
548
- }
2346
+ interface ScopedNetApi extends BaseNetApi {
2347
+ new(id: string, defaultGamemode: string[]): this;
2348
+ /**
2349
+ * Runs a callback when the game is loaded, or runs it immediately if the game has already loaded.
2350
+ * If the \@gamemode header is set the callback will only fire if the gamemode matches one of the provided gamemodes.
2351
+ * @returns A function to cancel waiting for load
2352
+ */
2353
+ onLoad(
2354
+ callback: (type: ConnectionType, gamemode: string) => void,
2355
+ gamemode?: string | string[],
2356
+ ): () => void;
2357
+ }
549
2358
 
550
- interface OldConfigurableOptions {
551
- category: string;
552
- title: string;
553
- preventDefault?: boolean;
554
- defaultKeys?: Set<string>;
555
- }
2359
+ type ConnectionType = "None" | "Colyseus" | "Blueboat";
556
2360
 
557
- interface ConfigurableHotkeyOptions {
558
- category: string;
559
- /** There should be no duplicate titles within a category */
560
- title: string;
561
- preventDefault?: boolean;
562
- default?: HotkeyTrigger;
563
- }
2361
+ interface BaseNetApi extends EventEmitter2 {
2362
+ new(): this;
2363
+ /** Which type of server the client is currently connected to */
2364
+ get type(): ConnectionType;
2365
+ /** The id of the gamemode the player is currently playing */
2366
+ get gamemode(): string;
2367
+ /** The room that the client is connected to, or null if there is no connection */
2368
+ get room(): any;
2369
+ /** Whether the user is the one hosting the current game */
2370
+ get isHost(): boolean;
2371
+ /** Sends a message to the server on a specific channel */
2372
+ send(channel: string, message: any): void;
2373
+ }
564
2374
 
565
- interface HotkeyTrigger {
566
- /** Should be a keyboardevent [code](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code) */
567
- key?: string;
568
- /** Should be keyboardevent [codes](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code) */
569
- keys?: string[];
570
- ctrl?: boolean;
571
- shift?: boolean;
572
- alt?: boolean;
573
- }
2375
+ interface NetApi extends BaseNetApi {
2376
+ new(): this;
2377
+ /**
2378
+ * Runs a callback when the game is loaded, or runs it immediately if the game has already loaded
2379
+ * @returns A function to cancel waiting for load
2380
+ */
2381
+ onLoad(
2382
+ id: string,
2383
+ callback: (type: ConnectionType, gamemode: string) => void,
2384
+ gamemode?: string | string[],
2385
+ ): () => void;
2386
+ /** Cancels any calls to {@link onLoad} with the same id */
2387
+ offLoad(id: string): void;
2388
+ /**
2389
+ * @deprecated Methods for both transports are now on the base net api
2390
+ * @hidden
2391
+ */
2392
+ get colyseus(): this;
2393
+ /**
2394
+ * @deprecated Methods for both transports are now on the base net api
2395
+ * @hidden
2396
+ */
2397
+ get blueboat(): this;
574
2398
 
575
- interface HotkeyOptions extends HotkeyTrigger {
576
- preventDefault?: boolean;
577
- }
2399
+ /**
2400
+ * @deprecated use net.on
2401
+ * @hidden
2402
+ */
2403
+ addEventListener(channel: string, callback: (...args: any[]) => void): void;
2404
+ /**
2405
+ * @deprecated use net.off
2406
+ * @hidden
2407
+ */
2408
+ removeEventListener(channel: string, callback: (...args: any[]) => void): void;
2409
+ }
578
2410
 
579
- class HotkeysApi extends BaseHotkeysApi {
580
- /**
581
- * Adds a hotkey with a given id
582
- * @returns A function to remove the hotkey
583
- */
584
- addHotkey(id: string, options: HotkeyOptions, callback: KeyboardCallback): () => void;
585
- /** Removes all hotkeys with a given id */
586
- removeHotkeys(id: string): void;
587
- /**
588
- * Adds a hotkey which can be changed by the user
589
- * @param id A unique id for the hotkey, such as `myplugin-myhotkey`
590
- * @returns A function to remove the hotkey
591
- */
592
- addConfigurableHotkey(id: string, options: ConfigurableHotkeyOptions, callback: KeyboardCallback): () => void;
593
- /** Removes a configurable hotkey with a given id */
594
- removeConfigurableHotkey(id: string): void;
595
- /**
596
- * @deprecated Use {@link addHotkey} instead
597
- * @hidden
598
- */
599
- add(keys: Set<string>, callback: KeyboardCallback, preventDefault?: boolean): void;
600
- /**
601
- * @deprecated Use {@link removeHotkeys} instead
602
- * @hidden
603
- */
604
- remove(keys: Set<string>): void;
605
- /**
606
- * @deprecated Use {@link addConfigurableHotkey} instead
607
- * @hidden
608
- */
609
- addConfigurable(
610
- pluginName: string,
611
- hotkeyId: string,
612
- callback: KeyboardCallback,
613
- options: OldConfigurableOptions,
614
- ): void;
615
- /**
616
- * @deprecated Use {@link removeConfigurableHotkeys} instead
617
- * @hidden
618
- */
619
- removeConfigurable(pluginName: string, hotkeyId: string): void;
620
- }
2411
+ class ScopedParcelApi extends BaseParcelApi {
2412
+ private readonly id;
2413
+ constructor(id: string);
2414
+ /**
2415
+ * Waits for a module to be loaded, then runs a callback
2416
+ * @returns A function to cancel waiting for the module
2417
+ */
2418
+ getLazy(): () => void;
2419
+ }
621
2420
 
622
- class Api {
623
- /**
624
- * @deprecated Gimkit has switched from Parcel to vite, rendering this api useless.
625
- * @hidden
626
- */
627
- static parcel: Readonly<ParcelApi>;
628
- /** Functions to edit Gimkit's code */
629
- static rewriter: Readonly<RewriterApi>;
630
- /** Functions to listen for key combinations */
631
- static hotkeys: Readonly<HotkeysApi>;
632
- /**
633
- * Ways to interact with the current connection to the server,
634
- * and functions to send general requests
635
- */
636
- static net: Readonly<NetApi>;
637
- /** Functions for interacting with the DOM */
638
- static UI: Readonly<UIApi>;
639
- /** Functions for persisting data between reloads */
640
- static storage: Readonly<StorageApi>;
641
- /** Functions for intercepting the arguments and return values of functions */
642
- static patcher: Readonly<PatcherApi>;
643
- /** Methods for getting info on libraries */
644
- static libs: Readonly<LibsApi>;
645
- /** Gets the exported values of a library */
646
- static lib: (name: string) => any;
647
- /** Methods for getting info on plugins */
648
- static plugins: Readonly<PluginsApi>;
649
- /** Gets the exported values of a plugin, if it has been enabled */
650
- static plugin: (name: string) => any;
651
- /** Gimkit's internal react instance */
652
- static get React(): typeof import("react");
653
- /** Gimkit's internal reactDom instance */
654
- static get ReactDOM(): typeof import("react-dom/client");
655
- /** A variety of Gimkit internal objects available in 2d gamemodes */
656
- static get stores(): any;
657
- /**
658
- * Gimkit's notification object, only available when joining or playing a game
659
- *
660
- * {@link https://ant.design/components/notification}
661
- */
662
- static get notification(): any;
663
- /**
664
- * @deprecated No longer supported
665
- * @hidden
666
- */
667
- static get contextMenu(): {
668
- showContextMenu: () => void;
669
- createReactContextMenu: () => void;
670
- };
671
- /**
672
- * @deprecated No longer supported
673
- * @hidden
674
- */
675
- static get platformerPhysics(): any;
676
- /**
677
- * @deprecated The api no longer emits events. Use GL.net.loaded to listen to load events
678
- * @hidden
679
- */
680
- static addEventListener(type: string, callback: () => void): void;
681
- /**
682
- * @deprecated The api no longer emits events
683
- * @hidden
684
- */
685
- static removeEventListener(type: string, callback: () => void): void;
686
- /**
687
- * @deprecated Use {@link plugins} instead
688
- * @hidden
689
- */
690
- static get pluginManager(): Readonly<PluginsApi>;
691
- constructor(type?: string, name?: string);
692
- /**
693
- * @deprecated Gimkit has switched from Parcel to vite, rendering this api useless.
694
- * @hidden
695
- */
696
- parcel: Readonly<ScopedParcelApi>;
697
- /** Functions to edit Gimkit's code */
698
- rewriter: Readonly<ScopedRewriterApi>;
699
- /** Functions to listen for key combinations */
700
- hotkeys: Readonly<ScopedHotkeysApi>;
701
- /**
702
- * Ways to interact with the current connection to the server,
703
- * and functions to send general requests
704
- */
705
- net: Readonly<ScopedNetApi>;
706
- /** Functions for interacting with the DOM */
707
- UI: Readonly<ScopedUIApi>;
708
- /** Functions for persisting data between reloads */
709
- storage: Readonly<ScopedStorageApi>;
710
- /** Functions for intercepting the arguments and return values of functions */
711
- patcher: Readonly<ScopedPatcherApi>;
712
- /** Methods for getting info on libraries */
713
- libs: Readonly<LibsApi>;
714
- /** Gets the exported values of a library */
715
- lib: (name: string) => any;
716
- /** Methods for getting info on plugins */
717
- plugins: Readonly<PluginsApi>;
718
- /** Gets the exported values of a plugin, if it has been enabled */
719
- plugin: (name: string) => any;
720
- /** Gimkit's internal react instance */
721
- get React(): typeof import("react");
722
- /** Gimkit's internal reactDom instance */
723
- get ReactDOM(): typeof import("react-dom/client");
724
- /** A variety of gimkit internal objects available in 2d gamemodes */
725
- get stores(): any;
726
- /**
727
- * Gimkit's notification object, only available when joining or playing a game
728
- *
729
- * {@link https://ant.design/components/notification}
730
- */
731
- get notification(): any;
732
- /** Run a callback when the plugin or library is disabled */
733
- onStop: (callback: () => void) => void;
734
- /**
735
- * Run a callback when the plugin's settings menu button is clicked
736
- *
737
- * This function is not available for libraries
738
- */
739
- openSettingsMenu: (callback: () => void) => void;
740
- }
741
- }
2421
+ class BaseParcelApi {
2422
+ /**
2423
+ * Gets a module based on a filter, returns null if none are found
2424
+ * Be cautious when using this- plugins will often run before any modules load in,
2425
+ * meaning that if this is run on startup it will likely return nothing.
2426
+ * Consider using getLazy instead.
2427
+ */
2428
+ query(): any;
2429
+ /**
2430
+ * Returns an array of all loaded modules matching a filter
2431
+ * Be cautious when using this- plugins will often run before any modules load in,
2432
+ * meaning that if this is run on startup it will likely return nothing.
2433
+ * Consider using getLazy instead.
2434
+ */
2435
+ queryAll(): any[];
2436
+ }
2437
+
2438
+ class ParcelApi extends BaseParcelApi {
2439
+ /**
2440
+ * Waits for a module to be loaded, then runs a callback
2441
+ * @returns A function to cancel waiting for the module
2442
+ */
2443
+ getLazy(): () => void;
2444
+ /** Cancels any calls to getLazy with the same id */
2445
+ stopLazy(): void;
2446
+ /**
2447
+ * @deprecated Use {@link getLazy} instead
2448
+ * @hidden
2449
+ */
2450
+ get interceptRequire(): () => () => void;
2451
+ /**
2452
+ * @deprecated Use {@link stopLazy} instead
2453
+ * @hidden
2454
+ */
2455
+ get stopIntercepts(): () => void;
2456
+ }
2457
+
2458
+ class ScopedHotkeysApi extends BaseHotkeysApi {
2459
+ private readonly id;
2460
+ constructor(id: string);
2461
+ /**
2462
+ * Adds a hotkey which will fire when certain keys are pressed
2463
+ * @returns A function to remove the hotkey
2464
+ */
2465
+ addHotkey(options: HotkeyOptions, callback: KeyboardCallback): () => void;
2466
+ /**
2467
+ * Adds a hotkey which can be changed by the user
2468
+ * @returns A function to remove the hotkey
2469
+ */
2470
+ addConfigurableHotkey(options: ConfigurableHotkeyOptions, callback: KeyboardCallback): () => void;
2471
+ }
2472
+
2473
+ type KeyboardCallback = (e: KeyboardEvent) => void;
2474
+
2475
+ class BaseHotkeysApi {
2476
+ /**
2477
+ * Releases all keys, needed if a hotkey opens something that will
2478
+ * prevent keyup events from being registered, such as an alert
2479
+ */
2480
+ releaseAll(): void;
2481
+ /** Which key codes are currently being pressed */
2482
+ get pressed(): Set<string>;
2483
+ /**
2484
+ * @deprecated Use {@link pressed} instead
2485
+ * @hidden
2486
+ */
2487
+ get pressedKeys(): Set<string>;
2488
+ }
742
2489
 
743
- declare const api: Gimloader.Api;
744
- declare const GL: typeof Gimloader.Api;
745
- /** @deprecated Use GL.stores */
746
- declare const stores: any;
747
- /** @deprecated No longer supported */
748
- declare const platformerPhysics: any;
2490
+ interface OldConfigurableOptions {
2491
+ category: string;
2492
+ title: string;
2493
+ preventDefault?: boolean;
2494
+ defaultKeys?: Set<string>;
2495
+ }
749
2496
 
750
- interface Window {
751
- api: Gimloader.Api;
752
- GL: typeof Gimloader.Api;
2497
+ interface ConfigurableHotkeyOptions {
2498
+ category: string;
2499
+ /** There should be no duplicate titles within a category */
2500
+ title: string;
2501
+ preventDefault?: boolean;
2502
+ default?: HotkeyTrigger;
2503
+ }
2504
+
2505
+ interface HotkeyTrigger {
2506
+ /** Should be a keyboardevent [code](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code) */
2507
+ key?: string;
2508
+ /** Should be keyboardevent [codes](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code) */
2509
+ keys?: string[];
2510
+ ctrl?: boolean;
2511
+ shift?: boolean;
2512
+ alt?: boolean;
2513
+ }
2514
+
2515
+ interface HotkeyOptions extends HotkeyTrigger {
2516
+ preventDefault?: boolean;
2517
+ }
2518
+
2519
+ class HotkeysApi extends BaseHotkeysApi {
2520
+ /**
2521
+ * Adds a hotkey with a given id
2522
+ * @returns A function to remove the hotkey
2523
+ */
2524
+ addHotkey(id: string, options: HotkeyOptions, callback: KeyboardCallback): () => void;
2525
+ /** Removes all hotkeys with a given id */
2526
+ removeHotkeys(id: string): void;
2527
+ /**
2528
+ * Adds a hotkey which can be changed by the user
2529
+ * @param id A unique id for the hotkey, such as `myplugin-myhotkey`
2530
+ * @returns A function to remove the hotkey
2531
+ */
2532
+ addConfigurableHotkey(
2533
+ id: string,
2534
+ options: ConfigurableHotkeyOptions,
2535
+ callback: KeyboardCallback,
2536
+ ): () => void;
2537
+ /** Removes a configurable hotkey with a given id */
2538
+ removeConfigurableHotkey(id: string): void;
2539
+ /**
2540
+ * @deprecated Use {@link addHotkey} instead
2541
+ * @hidden
2542
+ */
2543
+ add(keys: Set<string>, callback: KeyboardCallback, preventDefault?: boolean): void;
2544
+ /**
2545
+ * @deprecated Use {@link removeHotkeys} instead
2546
+ * @hidden
2547
+ */
2548
+ remove(keys: Set<string>): void;
2549
+ /**
2550
+ * @deprecated Use {@link addConfigurableHotkey} instead
2551
+ * @hidden
2552
+ */
2553
+ addConfigurable(
2554
+ pluginName: string,
2555
+ hotkeyId: string,
2556
+ callback: KeyboardCallback,
2557
+ options: OldConfigurableOptions,
2558
+ ): void;
2559
+ /**
2560
+ * @deprecated Use {@link removeConfigurableHotkeys} instead
2561
+ * @hidden
2562
+ */
2563
+ removeConfigurable(pluginName: string, hotkeyId: string): void;
2564
+ }
2565
+
2566
+ class Api {
2567
+ /**
2568
+ * @deprecated Gimkit has switched from Parcel to vite, rendering this api useless.
2569
+ * @hidden
2570
+ */
2571
+ static parcel: Readonly<ParcelApi>;
2572
+ /** Functions to edit Gimkit's code */
2573
+ static rewriter: Readonly<RewriterApi>;
2574
+ /** Functions to listen for key combinations */
2575
+ static hotkeys: Readonly<HotkeysApi>;
2576
+ /**
2577
+ * Ways to interact with the current connection to the server,
2578
+ * and functions to send general requests
2579
+ */
2580
+ static net: Readonly<NetApi>;
2581
+ /** Functions for interacting with the DOM */
2582
+ static UI: Readonly<UIApi>;
2583
+ /** Functions for persisting data between reloads */
2584
+ static storage: Readonly<StorageApi>;
2585
+ /** Functions for intercepting the arguments and return values of functions */
2586
+ static patcher: Readonly<PatcherApi>;
2587
+ /** Methods for getting info on libraries */
2588
+ static libs: Readonly<LibsApi>;
2589
+ /** Gets the exported values of a library */
2590
+ static lib: (name: string) => any;
2591
+ /** Methods for getting info on plugins */
2592
+ static plugins: Readonly<PluginsApi>;
2593
+ /** Gets the exported values of a plugin, if it has been enabled */
2594
+ static plugin: (name: string) => any;
2595
+ /** Gimkit's internal react instance */
2596
+ static get React(): typeof import("react");
2597
+ /** Gimkit's internal reactDom instance */
2598
+ static get ReactDOM(): typeof import("react-dom/client");
2599
+ /** A variety of Gimkit internal objects available in 2d gamemodes */
2600
+ static get stores(): Stores.Stores;
2601
+ /**
2602
+ * Gimkit's notification object, only available when joining or playing a game
2603
+ *
2604
+ * {@link https://ant.design/components/notification}
2605
+ */
2606
+ static get notification(): any;
2607
+ /**
2608
+ * @deprecated No longer supported
2609
+ * @hidden
2610
+ */
2611
+ static get contextMenu(): {
2612
+ showContextMenu: () => void;
2613
+ createReactContextMenu: () => void;
2614
+ };
2615
+ /**
2616
+ * @deprecated No longer supported
2617
+ * @hidden
2618
+ */
2619
+ static get platformerPhysics(): any;
2620
+ /**
2621
+ * @deprecated The api no longer emits events. Use GL.net.loaded to listen to load events
2622
+ * @hidden
2623
+ */
2624
+ static addEventListener(type: string, callback: () => void): void;
2625
+ /**
2626
+ * @deprecated The api no longer emits events
2627
+ * @hidden
2628
+ */
2629
+ static removeEventListener(type: string, callback: () => void): void;
2630
+ /**
2631
+ * @deprecated Use {@link plugins} instead
2632
+ * @hidden
2633
+ */
2634
+ static get pluginManager(): Readonly<PluginsApi>;
2635
+ constructor(type?: string, name?: string);
2636
+ /**
2637
+ * @deprecated Gimkit has switched from Parcel to vite, rendering this api useless.
2638
+ * @hidden
2639
+ */
2640
+ parcel: Readonly<ScopedParcelApi>;
2641
+ /** Functions to edit Gimkit's code */
2642
+ rewriter: Readonly<ScopedRewriterApi>;
2643
+ /** Functions to listen for key combinations */
2644
+ hotkeys: Readonly<ScopedHotkeysApi>;
2645
+ /**
2646
+ * Ways to interact with the current connection to the server,
2647
+ * and functions to send general requests
2648
+ */
2649
+ net: Readonly<ScopedNetApi>;
2650
+ /** Functions for interacting with the DOM */
2651
+ UI: Readonly<ScopedUIApi>;
2652
+ /** Functions for persisting data between reloads */
2653
+ storage: Readonly<ScopedStorageApi>;
2654
+ /** Functions for intercepting the arguments and return values of functions */
2655
+ patcher: Readonly<ScopedPatcherApi>;
2656
+ /** Methods for getting info on libraries */
2657
+ libs: Readonly<LibsApi>;
2658
+ /** Gets the exported values of a library */
2659
+ lib: (name: string) => any;
2660
+ /** Methods for getting info on plugins */
2661
+ plugins: Readonly<PluginsApi>;
2662
+ /** Gets the exported values of a plugin, if it has been enabled */
2663
+ plugin: (name: string) => any;
2664
+ /** Gimkit's internal react instance */
2665
+ get React(): typeof import("react");
2666
+ /** Gimkit's internal reactDom instance */
2667
+ get ReactDOM(): typeof import("react-dom/client");
2668
+ /** A variety of gimkit internal objects available in 2d gamemodes */
2669
+ get stores(): Stores.Stores;
2670
+ /**
2671
+ * Gimkit's notification object, only available when joining or playing a game
2672
+ *
2673
+ * {@link https://ant.design/components/notification}
2674
+ */
2675
+ get notification(): any;
2676
+ /** Run a callback when the plugin or library is disabled */
2677
+ onStop: (callback: () => void) => void;
2678
+ /**
2679
+ * Run a callback when the plugin's settings menu button is clicked
2680
+ *
2681
+ * This function is not available for libraries
2682
+ */
2683
+ openSettingsMenu: (callback: () => void) => void;
2684
+ }
2685
+ }
2686
+ const api: Gimloader.Api;
2687
+ const GL: typeof Gimloader.Api;
753
2688
  /** @deprecated Use GL.stores */
754
- stores: any;
2689
+ const stores: Gimloader.Stores.Stores;
755
2690
  /** @deprecated No longer supported */
756
- platformerPhysics: any;
2691
+ const platformerPhysics: any;
2692
+
2693
+ interface Window {
2694
+ api: Gimloader.Api;
2695
+ GL: typeof Gimloader.Api;
2696
+ /** @deprecated Use GL.stores */
2697
+ stores: Gimloader.Stores.Stores;
2698
+ /** @deprecated No longer supported */
2699
+ platformerPhysics: any;
2700
+ }
757
2701
  }