@evitcastudio/kit 2.1.2 → 2.3.0

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 (58) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +123 -59
  3. package/lib/bundle/cli/cli.js +1398 -53
  4. package/lib/bundle/cli/kit-game-templates/multi/README.md +5 -0
  5. package/lib/bundle/cli/kit-game-templates/multi/bun-build.ts +109 -0
  6. package/lib/bundle/cli/kit-game-templates/multi/favicon.ico +0 -0
  7. package/lib/bundle/cli/kit-game-templates/multi/package.json +24 -0
  8. package/lib/bundle/cli/kit-game-templates/multi/src/client/c-network.ts +22 -0
  9. package/lib/bundle/cli/kit-game-templates/multi/src/client/index.html +9 -0
  10. package/lib/bundle/cli/kit-game-templates/multi/src/client/index.ts +45 -0
  11. package/lib/bundle/cli/kit-game-templates/multi/src/client/packets/s-packets.ts +5 -0
  12. package/lib/bundle/cli/kit-game-templates/multi/src/client/vendor/vylocity-game-engine/vylo.client.js +19 -0
  13. package/lib/bundle/cli/kit-game-templates/multi/src/map-types.ts +9 -0
  14. package/lib/bundle/cli/kit-game-templates/multi/src/resources/default-atlas.vyi +0 -0
  15. package/lib/bundle/cli/kit-game-templates/multi/src/resources/default-macro.vymac +27 -0
  16. package/lib/bundle/cli/kit-game-templates/multi/src/resources/main-map.vym +1 -0
  17. package/lib/bundle/cli/kit-game-templates/multi/src/server/index.ts +58 -0
  18. package/lib/bundle/cli/kit-game-templates/multi/src/server/packets/c-packets.ts +5 -0
  19. package/lib/bundle/cli/kit-game-templates/multi/src/server/s-network.ts +16 -0
  20. package/lib/bundle/cli/kit-game-templates/multi/src/server/settings.json +4 -0
  21. package/lib/bundle/cli/kit-game-templates/multi/src/server/vendor/vylocity-game-engine/vylo.server.js +1 -0
  22. package/lib/bundle/cli/kit-game-templates/multi/src/types/shared-types.ts +13 -0
  23. package/lib/bundle/cli/kit-game-templates/multi/src/vylo.d.ts +3850 -0
  24. package/lib/bundle/cli/kit-game-templates/multi/tsconfig.json +28 -0
  25. package/lib/bundle/cli/kit-game-templates/single/README.md +5 -0
  26. package/lib/bundle/cli/kit-game-templates/single/bun-build.ts +33 -0
  27. package/lib/bundle/cli/kit-game-templates/single/bun-serve.ts +28 -0
  28. package/lib/bundle/cli/kit-game-templates/single/favicon.ico +0 -0
  29. package/lib/bundle/cli/kit-game-templates/single/package.json +23 -0
  30. package/lib/bundle/cli/kit-game-templates/single/src/index.html +12 -0
  31. package/lib/bundle/cli/kit-game-templates/single/src/index.ts +37 -0
  32. package/lib/bundle/cli/kit-game-templates/single/src/map-types.ts +9 -0
  33. package/lib/bundle/cli/kit-game-templates/single/src/resources/default-atlas.vyi +0 -0
  34. package/lib/bundle/cli/kit-game-templates/single/src/resources/default-macro.vymac +27 -0
  35. package/lib/bundle/cli/kit-game-templates/single/src/resources/main-map.vym +1 -0
  36. package/lib/bundle/cli/kit-game-templates/single/src/style.css +0 -0
  37. package/lib/bundle/cli/kit-game-templates/single/src/types/vylo.d.ts +3850 -0
  38. package/lib/bundle/cli/kit-game-templates/single/src/vendor/vylocity-game-engine/vylo.client.js +19 -0
  39. package/lib/bundle/cli/kit-game-templates/single/tsconfig.json +28 -0
  40. package/lib/cli/init.d.ts +15 -0
  41. package/lib/cli/init.d.ts.map +1 -0
  42. package/lib/cli/init.js +190 -0
  43. package/lib/cli/main.d.ts +13 -0
  44. package/lib/cli/main.d.ts.map +1 -0
  45. package/lib/cli/main.js +16 -0
  46. package/lib/cli/resource-builder.d.ts +6 -0
  47. package/lib/cli/resource-builder.d.ts.map +1 -0
  48. package/lib/cli/resource-builder.js +191 -0
  49. package/lib/cli/types.d.ts +11 -0
  50. package/lib/cli/types.d.ts.map +1 -0
  51. package/lib/cli/types.js +1 -0
  52. package/lib/index.d.ts +2 -1
  53. package/lib/index.d.ts.map +1 -1
  54. package/lib/plugins/network/index.d.ts +7 -0
  55. package/lib/plugins/network/index.d.ts.map +1 -1
  56. package/lib/plugins/network/index.js +18 -5
  57. package/lib/types/vylo.d.ts +3848 -3848
  58. package/package.json +13 -5
@@ -0,0 +1,3850 @@
1
+ declare global {
2
+
3
+
4
+ /**The world object.*/
5
+ type World = {
6
+
7
+ /**
8
+ * returns an array of diobs in the world depending on the provided arguments; if pType is not set, all diobs in the game will be returned; if pType is set but pChild is not, all diobs with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs in the game will be returned
9
+ * @env Client | Server
10
+ * @param {string} [pType] - optional; string containing type path to return
11
+ * @param {boolean} [pChild] - optional; boolean that determines if child types are included
12
+ * @returns {Diob[]} returns an array of diobs in the world depending on the provided arguments; if pType is not set, all diobs in the game will be returned; if pType is set but pChild is not, all diobs with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs in the game will be returned
13
+ */
14
+ getDiobs(pType?: string, pChild?: boolean): Diob[]
15
+
16
+ /**
17
+ * object that will become the contents of 'settings.json' file for your game server
18
+ * @env Client | Server
19
+ */
20
+ serverSettings: {[key: string]: unknown, 'port'?: number,'name'?: string,'accessCode'?: 'string','secure'?: {'key': string, 'cert': string}}
21
+
22
+ /**
23
+ * alphanumeric string between 1 and 48 characters needed to list a server and use the api for the game
24
+ * @env Client | Server
25
+ */
26
+ webAccessCode: string
27
+
28
+ /**
29
+ * SERVER-ONLY; default 10000; number of milliseconds to wait before pinging a client to see if it is still connected
30
+ * @env Server
31
+ */
32
+ pingDelay: number
33
+
34
+ /**
35
+ * SERVER-ONLY; default port to use when hosting; if the host sets a port in settings.json that port will override this one
36
+ * @env Server
37
+ */
38
+ mainPort: number
39
+
40
+ /**
41
+ * type of map to use; 'normal' or 'isometric'
42
+ * @env Client | Server
43
+ */
44
+ mapMode: 'normal' | 'isometric'
45
+
46
+ /**
47
+ * a string containing the address of the server to automatically connect players to; example '127.0.0.1:1234'
48
+ * @env Client | Server
49
+ */
50
+ mainServer: string
51
+
52
+ /**
53
+ * passes an array of objects containing information about the game servers currently online; example {'name': 'Server 1', 'address': '127.0.0.1:1234', 'players': 12, 'guests': 2} would be the data for a server named Server 1 with 12 players and 2 guests on it at 127.0.0.1:1234 address to pFunc
54
+ * @env Client | Server
55
+ * @param {Function} pFunc - function to call after the servers have been retrieved
56
+ */
57
+ getServers(pFunc: Function): void
58
+
59
+ /**
60
+ * returns an array of diobs in the world that have the tag pTag
61
+ * @env Client | Server
62
+ * @param {string} pTag - string containing tag to look for
63
+ * @returns {Diob[]} returns an array of diobs in the world that have the tag pTag
64
+ */
65
+ getDiobsByTag(pTag: string): Diob[]
66
+
67
+ /**
68
+ * returns an object {'width': world.gameWidth, 'height': world.gameHeight} containing the width and height of the game
69
+ * @env Client | Server
70
+ * @returns {{'width': number, 'height': number}} returns an object {'width': world.gameWidth, 'height': world.gameHeight} containing the width and height of the game
71
+ */
72
+ getGameSize(): {'width': number, 'height': number}
73
+
74
+ /**
75
+ * closes the socket connection
76
+ * @env Client | Server
77
+ * @param {string} pAddress - address of server to open a socket to; example '127.0.0.1:1234'
78
+ * @param {Function} pFunc - function to call once the socket has been opened; an object holding the socket information is passed into pFunc
79
+ * @param {object} pSettings - object containing settings values; example: {'secure': true}
80
+ */
81
+ openWebSocket(pAddress: string, pFunc: Function, pSettings: object): void
82
+
83
+ /**
84
+ * name that the server's js file will have, default being 'server' making it 'server.js'
85
+ * @env Client | Server
86
+ */
87
+ serverFileName: string
88
+
89
+ /**
90
+ * closes the host socket
91
+ * @env Server
92
+ * @param {number} pPort - the port to listen for sockets on
93
+ * @param {Function} pFunc - the function to call once the host socket has started
94
+ * @returns {unknown[]} returns an array of all the socket client objects
95
+ */
96
+ hostWebSocket(pPort: number, pFunc: Function): unknown[]
97
+
98
+ /**
99
+ * checks if Vylocity account pName is a subscriber of the game then calls pFunc; server-side only
100
+ * @env Server
101
+ * @param {string | number} pName - name of the Vyocity account to check sub of
102
+ * @param {Function} pFunc - function to call after the sub check; function is called with up to two parameters where the first is true or false depending on if the account is a sub or not and the second is a string containing an error message if there was one
103
+ */
104
+ checkSub(pName: string | number, pFunc: Function): void
105
+
106
+ /**
107
+ * plays a sound to all objects in pArr; returns the Sound object
108
+ * @env Client | Server
109
+ * @param {string | {'soundName': string, 'volume': number}} pSound - either a string with the name of a sound file, or a string containing the path of a Sound object, or an actual Sound object, or a basic object with the proper information; ex ( {'soundName': 'name', 'volume': 50} )
110
+ * @param {unknown} [pArr] - optional list of objects to play sound to
111
+ * @param {unknown} [pStart] - optional; time to start playing the sound at
112
+ * @param {unknown} [pDuration] - optional; how long to play the sound for
113
+ * @returns {void} returns the Sound object
114
+ */
115
+ playSound(pSound: string | {'soundName': string, 'volume': number}, pArr?: unknown, pStart?: unknown, pDuration?: unknown): void
116
+
117
+ /**
118
+ * sends a request of method pMethod to the url pLink and passes the response into pFunc
119
+ * @env Client | Server
120
+ * @param {string} pLink - string containing the link to send a request to; for example 'https://vylocity.com/'
121
+ * @param {string} [pMethod] - optional; string containing method type of request, ex 'POST', 'GET'
122
+ * @param {object} [pHeaders] - optional; object containing custom headers
123
+ * @param {unknown} [pData] - optional; data to send with method 'POST'
124
+ * @param {Function} [pFunc] - optional; function to call after the request has been sent and a response received, the arguments of the function will be (pData, pError) where pData is the data returned and pError the error (if there is one)
125
+ */
126
+ sendRequest(pLink: string, pMethod?: string, pHeaders?: object, pData?: unknown, pFunc?: Function): void
127
+
128
+ /**
129
+ * SERVER-ONLY; a string containing addresses allowed to use scripts to access and download resources from this game server (currently set for .vyr|.json|.txt files); default '*' which allows all addresses
130
+ * @env Server
131
+ */
132
+ resourceOrigin: string
133
+
134
+ /**
135
+ * map to be loaded when the game starts
136
+ * @env Client | Server
137
+ */
138
+ mainMap: string
139
+
140
+ /**
141
+ * a string containing the address of the server to download resources from (game server or web server); default '.' which is same address as the game; if using web server, add htaccess file in the resources folder to set header Access-Control-Allow-Origin ex of htaccess file: ( Header set Access-Control-Allow-Origin "*" ); this feature only works for the client of multiplayer, if playing solo the resources at the index location will be used and the server in multiplayer will use its own resource location
142
+ * @env Client | Server
143
+ */
144
+ resourceServer: string
145
+
146
+ /**
147
+ * returns an object {'width': world.tileWidth, 'height': world.tileHeight} containing the width and height of the game tiles
148
+ * @env Client | Server
149
+ * @returns {{'width': number, 'height': number}} returns an object {'width': world.tileWidth, 'height': world.tileHeight} containing the width and height of the game tiles
150
+ */
151
+ getTileSize(): {'width': number, 'height': number}
152
+
153
+ /**
154
+ * gracefully reboot the server
155
+ * @env Client | Server
156
+ */
157
+ reboot(): void
158
+
159
+ /**
160
+ * string containing the name of the default macro atlas
161
+ * @env Client | Server
162
+ */
163
+ mainMacro: string
164
+
165
+ /**
166
+ * returns an array of objects that are in pArr depending on the provided arguments; if pType is not set, all objects in the game will be returned; if pType is set but pChild is not, all diobs with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs in the game will be returned
167
+ * @env Client | Server
168
+ * @param {unknown[]} pArr - array to check for objects in
169
+ * @param {string} [pType] - optional; string containing type path to return
170
+ * @param {boolean} [pChild] - optional; boolean that determines if child types are included
171
+ * @returns {unknown[]} returns an array of objects that are in pArr depending on the provided arguments; if pType is not set, all objects in the game will be returned; if pType is set but pChild is not, all diobs with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs in the game will be returned
172
+ */
173
+ getObjectsFromArray(pArr: unknown[], pType?: string, pChild?: boolean): unknown[]
174
+
175
+ /**
176
+ * returns a string containing the address of the server or client; for example '1.2.3.4:1234' for server and 'localhost' always for client
177
+ * @env Client | Server
178
+ * @returns {string} returns a string containing the address of the server or client; for example '1.2.3.4:1234' for server and 'localhost' always for client
179
+ */
180
+ getHostAddress(): string
181
+
182
+ /**
183
+ * goes to pLink and passes the content of the page to pFunc once it is finished
184
+ * @env Client
185
+ * @param {string} pLink - string containing the link to read; for example 'http://vylocity.com/'
186
+ * @param {Function} pFunc - function to call after the content has been retrieved
187
+ * @param {unknown} [pMime] - CLIENT-ONLY; optional; set the mime type; ex text/html or application/octet-stream
188
+ */
189
+ getWebContent(pLink: string, pFunc: Function, pMime?: unknown): void
190
+
191
+ /**
192
+ * SERVER-ONLY; reference to the node process (https://nodejs.org/api/process.html); warning: for advanced users
193
+ * @env Server
194
+ */
195
+ nodeProcess: NodeJS.Process
196
+
197
+ /**
198
+ * version of the game
199
+ * @env Client | Server
200
+ */
201
+ gameVersion: string | number
202
+
203
+ /**
204
+ * displays pMes to the console
205
+ * @env Client | Server
206
+ * @param {string} pMes - message to display
207
+ */
208
+ log(pMes: string): void
209
+
210
+ /**
211
+ * returns a string containing the game version
212
+ * @env Client | Server
213
+ * @returns {string | number} returns a string containing the game version
214
+ */
215
+ getGameVersion(): string | number
216
+
217
+ /**
218
+ * outputs text to an interface element for all clients; if pInt or pEl is not set or is invalid, text goes to client.mainOutput
219
+ * @env Client | Server
220
+ * @param {string} pText - text to be displayed
221
+ * @param {string} pInt - string containing interface file name to output to
222
+ * @param {string} pEl - string containing the interface element name to output to
223
+ */
224
+ outputText(pText: string, pInt: string, pEl: string): void
225
+
226
+ /**
227
+ * SERVER-ONLY; a string containing the address that can access the API ( '*' to allow all ) or an array of strings for each address with access
228
+ * @env Server
229
+ */
230
+ apiOrigin: string | string[]
231
+
232
+ /**
233
+ * sends a string message pMes to another server located at pAddress; game server getting the message must have World/apiOrigin set to allow the message
234
+ * @env Client | Server
235
+ * @param {string} pAddress - address of the server to send a message to
236
+ * @param {string} pMes - string containing the message to send
237
+ * @param {Function} [pCallback] - optional; function to call after the message has been sent; the function will have two arguments, the first being an error if there was one, the second being the response from the server (the return value of the World/onMessage)
238
+ */
239
+ sendMessage(pAddress: string, pMes: string, pCallback?: Function): void
240
+
241
+ /**
242
+ * called when a map finishes loading
243
+ * @env Client | Server
244
+ * @event
245
+ * @param {string | number} pName - name of map that has loaded
246
+ */
247
+ onMapLoaded(pName: string | number): void
248
+
249
+ /**
250
+ * string containing the path of the mob for the player to control
251
+ * @env Client | Server
252
+ */
253
+ mainMob: string
254
+
255
+ /**
256
+ * returns an array of all connected clients
257
+ * @env Client | Server
258
+ * @returns {Client[]} returns an array of all connected clients
259
+ */
260
+ getClients(): Client[]
261
+
262
+ /**
263
+ * terminates the connection and prevents any queued data from being processed
264
+ * @env Server
265
+ * @param {object} pDatabase - object containing database information
266
+ * @param {Function} [pFunc] - optional; hostname of database; default localhost
267
+ * @returns {object} returns one argument that contains any error information<br />
268
+ called: returns the connection pool object after connecting to the MySQL database pDatabase
269
+ */
270
+ openMySQL(pDatabase: object, pFunc?: Function): object
271
+
272
+ /**
273
+ * returns a string containing information about what the code type is; code ran in solo will return 'local'; code ran in multi-player client will return 'client'; code ran on the server will return 'server'
274
+ * @env Client | Server
275
+ * @returns {'local' | 'client' | 'server'} returns a string containing information about what the code type is; code ran in solo will return 'local'; code ran in multi-player client will return 'client'; code ran on the server will return 'server'
276
+ */
277
+ getCodeType(): 'local' | 'client' | 'server'
278
+
279
+ /**
280
+ * gracefully shut down the server
281
+ * @env Client | Server
282
+ */
283
+ shutdown(): void
284
+
285
+ /**
286
+ * returns the diob with the specified ID
287
+ * @env Client | Server
288
+ * @param {string} pID - id of the diob to get
289
+ * @returns {Diob} returns the diob with the specified ID
290
+ */
291
+ getDiobByID(pID: string): Diob
292
+
293
+ /**
294
+ * an object containing width and height of tiles on the map {'width': 32, 'height': 32}; acts as the default size of diobs
295
+ * @env Client | Server
296
+ */
297
+ tileSize: {'width': number, 'height': number}
298
+
299
+ /**
300
+ * a number; 1 for single player game, 2 for multi-player game, 3 for single and multi-player
301
+ * @env Client | Server
302
+ */
303
+ playerMode: 1 | 2 | 3
304
+
305
+ /**
306
+ * returns a string contain server IP and port in 'ip:port' format
307
+ * @env Client | Server
308
+ * @returns {string} returns a string contain server IP and port in 'ip:port' format
309
+ */
310
+ getAddress(): string
311
+
312
+ /**
313
+ * sends a notification with the message pMessage to the Vylocity account pName and then calls pFunc; server-side only
314
+ * @env Server
315
+ * @param {string | number} pName - name of the Vyocity account to send notification to
316
+ * @param {unknown} pMessage - message to send; 256 characters max
317
+ * @param {Function} pFunc - function to call after the notification has been sent or attempted; function is called with up to two parameters where the first is true or false depending on the success of the send and the second is a string containing an error message if there was one
318
+ */
319
+ sendNotification(pName: string | number, pMessage: unknown, pFunc: Function): void
320
+
321
+ /**
322
+ * only manually set this if you are using the offline IDE and are setting the source to match the game id for vylocity.com
323
+ * @env Client | Server
324
+ */
325
+ gameID: number
326
+
327
+ /**
328
+ * evaluates the JavaScript code in the pScript string; if the world is running on the server-side this code will be Node.js
329
+ * @env Client | Server
330
+ * @param {string} pScript - a string containing the JavaScript code to evaluate
331
+ */
332
+ evalWebScript(pScript: string): void
333
+
334
+ /**
335
+ * returns a number containing the game's player mode
336
+ * @env Client | Server
337
+ * @returns {number} returns a number containing the game's player mode
338
+ */
339
+ getPlayerMode(): number
340
+
341
+ /**
342
+ * array of files to preload when the game starts up or '*' to load all resources; if no name is provided, all resources of that type will be preloaded; for example [{'type': 'icon', 'name': 'icon1'}, {'type': 'sound'}] to load an icon named icon1 and all sound resources; all interface files and macro files are automatically preloaded; you may include remote resources by giving the object a 'remote' property and setting it to the web URL path of the resource
343
+ * @env Client | Server
344
+ */
345
+ preloadResources: {'type': string, 'name': string}[] | '*'
346
+
347
+ /**
348
+ * kicks the client pClient and displays the pReason message to them if there is one
349
+ * @env Client | Server
350
+ * @param {Client} pClient - client to kick
351
+ * @param {string} [pReason] - optional; message to display to the client being kicked
352
+ */
353
+ kickClient(pClient: Client, pReason?: string): void
354
+
355
+ /**
356
+ * SERVER-ONLY; default 50; number of milliseconds to wait before sending built-in engine packets (custom client packets are sent immediately)
357
+ * @env Server
358
+ */
359
+ packetDelay: number
360
+
361
+ /**
362
+ * default 45; how many tiles to combine into chunks to improve efficiency for rendering and networking; recommended to use at least 1.5x map view, so if the map view is 1920x1080 and the tile size is 32x32, you would want at least 90 chunk (90x90 tiles); if a part of the remaining map (after other parts have been chunked) is smaller than the chunk size, it will be added to the nearest chunk instead
363
+ * @env Client | Server
364
+ */
365
+ mapChunk: number
366
+
367
+ /**
368
+ * sends the data for the pD diob to all clients in the world, if pVar is set it will send only those variables, if it is not set it will only send built-in engine variables
369
+ * @env Server
370
+ * @param {Diob} pD - reference to the diob to send
371
+ * @param {unknown[]} [pVar] - optional; variable name or array of variable names
372
+ */
373
+ sendDiob(pD: Diob, pVar?: unknown[]): void
374
+
375
+ }
376
+
377
+
378
+
379
+ /**The base object that Diob extends from.*/
380
+ type Object = {
381
+
382
+ /**
383
+ * object containing ticker details if in an active ticker; set to null to remove from ticker
384
+ * @env Client | Server
385
+ */
386
+ inTicker: object
387
+
388
+ /**
389
+ * sets the pVal value of the pVar static variable belonging to the type pType; static variables are variables that belong to all Objects of this type collectively and are different than normal variables, usually static variables can only be set once, but VyScript static variables may be changed if that is what the developer wants
390
+ * @env Client | Server
391
+ * @param {unknown} pVar - name of the static variable to set
392
+ * @param {boolean} pVal - value to give to the static variable
393
+ */
394
+ setStaticVariable(pVar: unknown, pVal: boolean): void
395
+
396
+ /**
397
+ * returns the static variable value belonging to the type pType
398
+ * @env Client | Server
399
+ * @param {unknown} pVar - name of the static variable to get
400
+ * @returns {unknown} returns the static variable value belonging to the type pType
401
+ */
402
+ getStaticVariable(pVar: unknown): unknown
403
+
404
+ }
405
+
406
+
407
+
408
+ /**The diob object.*/
409
+ type Diob = {
410
+
411
+ /**
412
+ * returns true if this Diob is currently shown on the screen, false if not
413
+ * @env Client | Server
414
+ * @returns {void} returns true if this Diob is currently shown on the screen, false if not
415
+ */
416
+ checkScreenShown(): void
417
+
418
+ /**
419
+ * removes the specified filter
420
+ * @env Client | Server
421
+ * @param {string | number} pName - name of filter to remove
422
+ */
423
+ removeFilter(pName: string | number): void
424
+
425
+ /**
426
+ * sets the diob's overlays to the array pOver
427
+ * @env Client | Server
428
+ * @param {Diob[]} pOver - array of overlays to set this diob's overlays to
429
+ * @param {boolean} [pSave] - optional; if set, removed overlays will not be deleted, otherwise this call will delete removed overlays after removing them from the overlays
430
+ */
431
+ setOverlays(pOver: Diob[], pSave?: boolean): void
432
+
433
+ /**
434
+ * when this diob has a transition change; if pVar, pChange, and pStart are all unset then this is the event called when all transitions have ended
435
+ * @env Client | Server
436
+ * @event
437
+ * @param {string} pVar - a string containing the name of the variable involved in the transition
438
+ * @param {unknown} pChange - the amount changed
439
+ * @param {object} pStart - if this is set then this is the event called when a transition starts; this will be a reference to the transition object used
440
+ */
441
+ onTransition(pVar: string, pChange: unknown, pStart: object): void
442
+
443
+ /**
444
+ * returns an array of diobs currently in this diob's viewer array
445
+ * @env Client | Server
446
+ * @returns {unknown[]} returns an array of diobs currently in this diob's viewer array
447
+ */
448
+ getInvisibilityViewers(): unknown[]
449
+
450
+ /**
451
+ * if set, diob will be invisible to all other diobs with visibility less than this value
452
+ * @env Client | Server
453
+ */
454
+ invisibility: number
455
+
456
+ /**
457
+ * sets this diob's icon anchor to pX and pY; default is 0.5,0.5 which is the center of the diob's icon (0,0 would be the top-left corner);
458
+ * @env Client | Server
459
+ * @param {number} pX - default 0.5; x value of the diob's icon anchor
460
+ * @param {number} [pY] - optional; default 0.5; y value of the diob's icon anchor
461
+ */
462
+ setAnchor(pX: number, pY?: number): void
463
+
464
+ /**
465
+ * modifies scale, angle, or alpha of the over screen
466
+ * @env Client | Server
467
+ * @param {object} pMod - object containing mods; scale, angle, alpha; ex ( {'angle': 0.8} )
468
+ * @param {unknown} [pAdd] - optional; if set, the values in pMod will be added to the current mod object
469
+ */
470
+ setOverScreenMod(pMod: object, pAdd?: unknown): void
471
+
472
+ /**
473
+ * moves this to specified location; if pVal1 and pVal2 are numbers, this is moved to the coordinate pVal1, pVal2; if pVal1 is an object but not a tile, this is moved to the location of object; if pVal1 is a tile, this is moved to that tile
474
+ * @env Client | Server
475
+ */
476
+ setLoc(): Diob
477
+
478
+ /**
479
+ * returns the current diob being used as a mask
480
+ * @env Client | Server
481
+ * @returns {Diob} returns the current diob being used as a mask
482
+ */
483
+ getMask(): Diob
484
+
485
+ /**
486
+ * a string to be displayed as text above the diob
487
+ * @env Client | Server
488
+ */
489
+ text: string
490
+
491
+ /**
492
+ * adds pDiob to this diob's viewer array, allowing pDiob to always see this diob
493
+ * @env Client | Server
494
+ * @param {Diob} pDiob - the diob to add
495
+ */
496
+ addInvisibilityViewer(pDiob: Diob): void
497
+
498
+ /**
499
+ * when this diob and pD have overlapping bounding boxes and one of them changes position and stays overlapped
500
+ * @env Client | Server
501
+ * @event
502
+ * @param {Diob} pD - diob that is crossed with this diob
503
+ * @param {unknown} pInit - if set, pD was relocated and initiated the event
504
+ */
505
+ onCrossedRelocated(pD: Diob, pInit: unknown): void
506
+
507
+ /**
508
+ * turns this diob's sprite into a repeating pattern; call with no arguments to return to a normal sprite
509
+ * @env Client | Server
510
+ * @param {number} pX - default 0; position where the pattern starts on the x-axis
511
+ * @param {number} pY - default 0; position where the pattern starts on the y-axis
512
+ * @param {number} [pWidth] - optional; width of the pattern
513
+ * @param {number} [pHeight] - optional; height of the pattern
514
+ */
515
+ setPattern(pX: number, pY: number, pWidth?: number, pHeight?: number): void
516
+
517
+ /**
518
+ * determines if the object is dense or not; true or false for dense or not, or a number for value, over 1 for different densities; for example, density 3 diobs can move over density 2 and lower diobs but not anything density 3 or higher
519
+ * @env Client | Server
520
+ */
521
+ density: unknown
522
+
523
+ /**
524
+ * name of icon inside object's icon atlas
525
+ * @env Client | Server
526
+ */
527
+ iconName: string
528
+
529
+ /**
530
+ * adds the specified filter
531
+ * @env Client | Server
532
+ * @param {string | number} pName - name of the filter; only one name may be used at a time, using the name will remove the old filter with that name
533
+ * @param {string} pType - the type of filter to add; below is the types and their specific possible pArgs values
534
+ * @param {unknown} pArgs - color-based filter
535
+ */
536
+ addFilter(pName: string | number, pType: string, pArgs: unknown): void
537
+
538
+ /**
539
+ * position of object on the grid x-axis
540
+ * @env Client | Server
541
+ */
542
+ xCoord: number
543
+
544
+ /**
545
+ * sets the width and height of the diob
546
+ * @env Client | Server
547
+ * @param {number} pWidth - value to set the diob's width to
548
+ * @param {number} pHeight - value to set the diob's height to
549
+ */
550
+ setSize(pWidth: number, pHeight: number): void
551
+
552
+ /**
553
+ * called when a packet is sent from this diob on the client or server using diob.sendPacket
554
+ * @env Client | Server
555
+ * @event
556
+ * @param {Client} pClient - client that sent the packet
557
+ * @param {string | number} pName - name of packet
558
+ * @param {unknown} pData - any data containing information for packet; ex {'a': 1, 'b': 2} or 'test'
559
+ */
560
+ onPacket(pClient: Client, pName: string | number, pData: unknown): void
561
+
562
+ /**
563
+ * called when the mouse clicks this object
564
+ * @env Client | Server
565
+ * @event
566
+ * @param {Client} pClient - client of the mouse
567
+ * @param {number} pX - the x position of the mouse over the diob
568
+ * @param {number} pY - the y position of the mouse over the diob
569
+ * @param {unknown} pButton - the button used; 1 for left, 2 for middle, 3 for right
570
+ */
571
+ onMouseClick(pClient: Client, pX: number, pY: number, pButton: unknown): void
572
+
573
+ /**
574
+ * the region that the diob is in
575
+ * @env Client | Server
576
+ */
577
+ region: unknown
578
+
579
+ /**
580
+ * name of atlas the object's icon is in
581
+ * @env Client | Server
582
+ */
583
+ atlasName: string
584
+
585
+ /**
586
+ * returns an array of diobs that are crossing this diob using the provided arguments; if pType is not set, all diobs will be returned; if pType is set but pChild is not, all diobs with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs will be returned
587
+ * @env Client | Server
588
+ * @param {string} [pType] - optional; string containing type path to return
589
+ * @param {boolean} [pChild] - optional; boolean that determines if child types are included
590
+ * @returns {Diob[]} returns an array of diobs that are crossing this diob using the provided arguments; if pType is not set, all diobs will be returned; if pType is set but pChild is not, all diobs with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs will be returned
591
+ */
592
+ getCrossed(pType?: string, pChild?: boolean): Diob[]
593
+
594
+ /**
595
+ * changes the appearance of the diob based on the values provided by pDiob
596
+ * @env Client | Server
597
+ * @param {Diob} pDiob - object containing the appearance information or a diob itself; values used: atlasName, iconName, iconState, width, height, layer, scale, color, alpha, transform, anchor, angle, composite, plane, text, textStyle, animator, overlays, overScreen
598
+ */
599
+ setAppearance(pDiob: Diob): void
600
+
601
+ /**
602
+ * sets the x and y origin offsets
603
+ * @env Client | Server
604
+ * @param {number} pX - the x offset of the origin of this object from the left
605
+ * @param {number} pY - the y offset of the origin of this object from the top
606
+ */
607
+ setOrigin(pX: number, pY: number): void
608
+
609
+ /**
610
+ * if set, the client will not interpolation position changes
611
+ * @env Client | Server
612
+ */
613
+ preventInterpolation: unknown
614
+
615
+ /**
616
+ * default 0; number of pixels to offset the text by on the y-axis
617
+ * @env Client | Server
618
+ */
619
+ textStyle: object
620
+
621
+ /**
622
+ * name of the type of the object
623
+ * @env Client | Server
624
+ */
625
+ type: string
626
+
627
+ /**
628
+ * unique ID of the diob
629
+ * @env Client | Server
630
+ */
631
+ id: unknown
632
+
633
+ /**
634
+ * the diob's transformation matrix or transformation object; example [scaleX, skewY, 0, skewX, scaleY, 0, moveX, moveY, 1] where scaleX scales the diob's appearance on the x-axis, skewY skews on the y-axis, moveX moves on the x-axis, skewX skews on the x-axis, scaleY scales on the y-axis, moveY moves on the y-axis, and the last three are static for matrix; example {'scaleX': 2, 'skewY': 0.1} would scale by 2 on the x-axis and skew by 0.1 on the y-axis for object
635
+ * @env Client | Server
636
+ */
637
+ transform: object | number[]
638
+
639
+ /**
640
+ * sets the scale of the diob
641
+ * @env Client | Server
642
+ * @param {number} pX - number to scale the width of the diob by; for example 2 would be a 200% scale
643
+ * @param {number} [pY] - optional; number to scale the height of the diob by; for example 2 would be a 200% scale; pX used if null
644
+ */
645
+ setScale(pX: number, pY?: number): void
646
+
647
+ /**
648
+ * transitions this diob's pO properties from their current values to the new values over time; if pO is not set all transitions will be cancelled and all properties will automatically go to their end transition values; current allowed properties: alpha, angle, scale, xScale, yScale, xIconOffset, yIconOffset
649
+ * @env Client | Server
650
+ * @param {object} pO - object containing properties to transition; ex {'alpha': 0.5, 'xIconOffset': 20}
651
+ * @param {number} pS - number of steps to take to transition the properties; default 1; -1 for a step every frame
652
+ * @param {number} pT - number of milliseconds between each step; default 100; if pS is -1 then this is the total time
653
+ * @param {number} [pQ] - optional; if set, this transition will be added to a queue and happen after the current transition finishes or the rest of the queue clears; set as -1 to merge this with the last thing in the queue
654
+ * @param {number} [pLoop] - optional; if set, this transition will be added to the current loop of transitions and repeat until told to stop, if this transition is first, this can be set to a specify number to stop looping after that amount of loops; -1 to loop forever
655
+ * @param {string} [pEase] - optional; use an easing equation that isn't linear; options: 'quadraticIn', 'quadraticOut', 'quadraticInOut', 'cubicIn', 'cubicOut', 'cubicInOut', 'quarticIn', 'quarticOut', 'quarticInOut', 'quinticIn', 'quinticOut', 'quinticInOut', 'sineIn', 'sineOut', 'sineInOut', 'expoIn', 'expoOut', 'expoInOut', 'circularIn', 'circularOut', 'circularInOut'
656
+ */
657
+ setTransition(pO: object, pS: number, pT: number, pQ?: number, pLoop?: number, pEase?: string): void
658
+
659
+ /**
660
+ * the tile that the diob is on
661
+ * @env Client | Server
662
+ */
663
+ loc: unknown
664
+
665
+ /**
666
+ * when this diob leaves the client's screen view
667
+ * @env Client | Server
668
+ * @event
669
+ * @param {Client} pClient - a reference to the client
670
+ */
671
+ onScreenHide(pClient: Client): void
672
+
673
+ /**
674
+ * returns the transformation matrix of this diob
675
+ * @env Client | Server
676
+ * @param {unknown} [pAsObj] - optional; if set, the diob's transformation matrix will be returned as an object, for example {'scaleX': scaleX, 'skewY': skewY}
677
+ * @returns {void} returns the transformation matrix of this diob
678
+ */
679
+ getTransform(pAsObj?: unknown): void
680
+
681
+ /**
682
+ * returns the over screen mod
683
+ * @env Client | Server
684
+ * @returns {void} returns the over screen mod
685
+ */
686
+ getOverScreenMod(): void
687
+
688
+ /**
689
+ * returns an object {'atlas': atlasName, 'icon': iconName} containing the diob's icon atlas and icon names
690
+ * @env Client | Server
691
+ * @returns {object} returns an object {'atlas': atlasName, 'icon': iconName} containing the diob's icon atlas and icon names
692
+ */
693
+ getIcon(): object
694
+
695
+ /**
696
+ * grabs an object with the screen x offset, y offset, width, height, settings, and either an array of pixel data or a data url depending on pType (data returned client-side only). The data can then be changed and used elsewhere or drawn onto another screen. To read the width and height you could use object.width and object.height, where object is the object returned by the function. The object data array is as follows: object.data[0] is the red value (0-255) of the pixel at 0,0, object.data[1] is the green value (0-255) of the pixel at 0,0, object.data[2] is the blue value (0-255) of the pixel at 0,0, and object.data[3] is the alpha value (0-255) of the pixel at 0,0. Then object.data[4], object.data[5], object.data[6], and object.data[7] are the respective values for the pixel at 1,0. This trend continues through the whole array for every pixel. object ex: {'x': 0, 'y': 0, 'width': 100, 'height': 100, 'data': ''}
697
+ * @env Client
698
+ * @param {string} pType - type of data to get; 'url', 'pixels', 'canvas', or 'sprite'
699
+ */
700
+ getOverScreen(pType: string): void
701
+
702
+ /**
703
+ * angle of the diob (0 to 2PI)
704
+ * @env Client | Server
705
+ */
706
+ angle: number
707
+
708
+ /**
709
+ * changes the over screen information; adding data optional
710
+ * @env Client | Server
711
+ * @param {number} pX - x offset of display
712
+ * @param {number} pY - y offset of display
713
+ * @param {number} pWidth - width of display
714
+ * @param {number} pHeight - height of display
715
+ * @param {unknown} [pData] - optional; data to add to the screen
716
+ * @param {object} [pSet] - optional; settings object; ex ( {'scaleNearest': true} );
717
+ */
718
+ setOverScreen(pX: number, pY: number, pWidth: number, pHeight: number, pData?: unknown, pSet?: object): void
719
+
720
+ /**
721
+ * when this diob changes maps; this event will be called twice if the map has not already been loaded, once before loading and once after the loading has completed (the first event will have pBefore set)
722
+ * @env Client | Server
723
+ * @event
724
+ * @param {string} pMap - name of the old map or name of the new map if pBefore is set
725
+ * @param {unknown} pBefore - if set then the map is currently loading and this is the pre-load event
726
+ */
727
+ onMapChange(pMap: string, pBefore: unknown): void
728
+
729
+ /**
730
+ * returns an object {'width': width, 'height': height} containing the diob's width and height
731
+ * @env Client | Server
732
+ * @returns {object} returns an object {'width': width, 'height': height} containing the diob's width and height
733
+ */
734
+ getSize(): object
735
+
736
+ /**
737
+ * custom string used to identify the diob
738
+ * @env Client | Server
739
+ */
740
+ tag: string
741
+
742
+ /**
743
+ * all invisible diobs with invisibility levels equal to or less than this will be visible to this diob
744
+ * @env Client | Server
745
+ */
746
+ visibility: number
747
+
748
+ /**
749
+ * called when the mouse double clicks this object
750
+ * @env Client | Server
751
+ * @event
752
+ * @param {Client} pClient - client of the mouse
753
+ * @param {number} pX - the x position of the mouse over the diob
754
+ * @param {number} pY - the y position of the mouse over the diob
755
+ * @param {unknown} pButton - the button used; 1 for left, 2 for middle
756
+ */
757
+ onMouseDblClick(pClient: Client, pX: number, pY: number, pButton: unknown): void
758
+
759
+ /**
760
+ * when an object exits the contents of another object
761
+ * @env Client | Server
762
+ * @event
763
+ * @param {Diob} pDiob - object that exited
764
+ */
765
+ onExited(pDiob: Diob): void
766
+
767
+ /**
768
+ * performs the specified draw function using the specified pArgs object; ex ( {'type': 'image', 'image': this, 'x': 1, 'y': 1} )
769
+ * @env Client | Server
770
+ * @param {object | object[]} pArgs - an object or array of objects which determines the settings of the draw
771
+ */
772
+ overScreenDraw(pArgs: object | object[]): void
773
+
774
+ /**
775
+ * how visible the diob appears; (0 to 1); 0 completely invisible, 1 completely visible, between partially visible, higher the number the more visible
776
+ * @env Client | Server
777
+ */
778
+ alpha: number
779
+
780
+ /**
781
+ * changes display icon of object
782
+ * @env Client | Server
783
+ * @param {string} pAtlas - name of atlas icon is in
784
+ * @param {string} pIcon - name of icon in pAtlas
785
+ */
786
+ setIcon(pAtlas: string, pIcon: string): void
787
+
788
+ /**
789
+ * position on the y-axis of the origin from the top edge of the diob
790
+ * @env Client | Server
791
+ */
792
+ yOrigin: number
793
+
794
+ /**
795
+ * position of object on the grid y-axis
796
+ * @env Client | Server
797
+ */
798
+ yCoord: number
799
+
800
+ /**
801
+ * returns an object {'x': xOrigin, 'y': yOrigin} containing the diob's x and y origin offsets
802
+ * @env Client | Server
803
+ * @returns {object} returns an object {'x': xOrigin, 'y': yOrigin} containing the diob's x and y origin offsets
804
+ */
805
+ getOrigin(): object
806
+
807
+ /**
808
+ * when this diob changes icons
809
+ * @env Client | Server
810
+ * @event
811
+ */
812
+ onIconUpdate(): void
813
+
814
+ /**
815
+ * returns an object {'x': x,'y': y} containing the x and y icon offsets
816
+ * @env Client | Server
817
+ * @returns {object} returns an object {'x': x,'y': y} containing the x and y icon offsets
818
+ */
819
+ getIconOffsets(): object
820
+
821
+ /**
822
+ * turns pMask into a mask which this diob interacts with; transparent portions of the pMask's icon will cut out those same spots from this diob's icon
823
+ * @env Client | Server
824
+ * @param {Diob} pMask - diob to use as a mask
825
+ */
826
+ setMask(pMask: Diob): void
827
+
828
+ /**
829
+ * if this diob is an Overlay type or is being used as an overlay, this will be set; if the overlay has a parent diob, this will be a reference to that diob
830
+ * @env Client | Server
831
+ */
832
+ isOverlay: unknown
833
+
834
+ /**
835
+ * height to use when calculating y position relayering
836
+ * @env Client | Server
837
+ */
838
+ relayerHeight: unknown
839
+
840
+ /**
841
+ * SERVER-ONLY; if set, the server will not update clients when changes are made; can be 'true' to prevent all clients from getting updated or can be an object containing variables and/or specific clients to ignore; possible variables 'pos', 'dir', 'icon'; ex ( {'type': ['pos', 'dir'], 'client': [someClient]} )
842
+ * @env Server
843
+ */
844
+ preventClientUpdates: unknown
845
+
846
+ /**
847
+ * called when a mouse wheel button is scrolled upward while over this object
848
+ * @env Client | Server
849
+ * @event
850
+ * @param {Client} pClient - client of the mouse
851
+ * @param {number} pX - the x position of the mouse over the diob
852
+ * @param {number} pY - the y position of the mouse over the diob
853
+ */
854
+ onMouseWheelScrollUp(pClient: Client, pX: number, pY: number): void
855
+
856
+ /**
857
+ * data shared automatically from the server-side to clients that have a sync for this diob; changing the variable will update any clients that have this diob's sync in realtime
858
+ * @env Client | Server
859
+ */
860
+ clientSyncData: unknown
861
+
862
+ /**
863
+ * sends a packet to a client or server specifically for this diob, depending on where the code is executed; client code executing this will send the packet to the server; server code executing this will send the packet to the client; this will invoke Diob/onPacket on client-side if the sendPacket is server-side and on the server-side if it is on the client-side
864
+ * @env Client | Server
865
+ * @param {string | number} pName - name of packet to send
866
+ * @param {unknown} pData - data to be sent; ex {'a': 1, 'b': 2} or 'test'
867
+ * @param {Client} [pClient] - SERVER ONLY; optional; specific client or array of clients to send this packet to; if no client is specified the packet will be sent to all clients currently synced with this diob
868
+ */
869
+ sendPacket(pName: string | number, pData: unknown, pClient?: Client): void
870
+
871
+ /**
872
+ * returns an object {'x': x, 'y': y} containing the x and y coord offsets of the object
873
+ * @env Client | Server
874
+ * @returns {object} returns an object {'x': x, 'y': y} containing the x and y coord offsets of the object
875
+ */
876
+ getCoordOffsets(): object
877
+
878
+ /**
879
+ * removes all overlays with the pOver type or the exact overlay matching pOver
880
+ * @env Client | Server
881
+ * @param {string | Diob | Object} pOver - string of the type of object or overlay to remove or actual overlay to remove
882
+ * @param {unknown} [pSave] - optional; if set, the overlay will not be deleted, otherwise this call will delete pOver after removing it from the overlays
883
+ */
884
+ removeOverlay(pOver: string | Diob | Object, pSave?: unknown): void
885
+
886
+ /**
887
+ * called when the mouse exits this object
888
+ * @env Client | Server
889
+ * @event
890
+ * @param {Client} pClient - client of the mouse
891
+ * @param {number} pX - the x position of the mouse over the diob
892
+ * @param {number} pY - the y position of the mouse over the diob
893
+ */
894
+ onMouseExit(pClient: Client, pX: number, pY: number): void
895
+
896
+ /**
897
+ * returns an object {'x': x, 'y': y} containing the x and y positions of the diob on the map
898
+ * @env Client | Server
899
+ * @returns {{'x': number,'y': number}} returns an object {'x': x, 'y': y} containing the x and y positions of the diob on the map
900
+ */
901
+ getPos(): {'x': number,'y': number}
902
+
903
+ /**
904
+ * how many pixels object is offset on the grid x-axis from the xCoord
905
+ * @env Client | Server
906
+ */
907
+ xCoordOffset: number
908
+
909
+ /**
910
+ * if set, any movable with the same density as this diob may cross over it
911
+ * @env Client | Server
912
+ */
913
+ allowDensityCross: boolean
914
+
915
+ /**
916
+ * when an object enters the contents of another object
917
+ * @env Client | Server
918
+ * @event
919
+ * @param {Diob} pDiob - object that entered
920
+ */
921
+ onEntered(pDiob: Diob): void
922
+
923
+ /**
924
+ * height of the collision box of the object
925
+ * @env Client | Server
926
+ */
927
+ height: number
928
+
929
+ /**
930
+ * string containing composite value that determines how this diob is drawn with other diobs on the same plane; possible values: normal, add, multiply, screen
931
+ * @env Client | Server
932
+ */
933
+ composite: 'source-over' | 'source-atop' | 'source-in' | 'source-out' | 'destination-over' | 'destination-atop' | 'destination-in' | 'destination-out' | 'lighter' | 'copy' | 'xor' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity'
934
+
935
+ /**
936
+ * sets the animation frame to pFrame and freezes for pDelay milliseconds before returning to the previous frame or continuing on if pCont is set
937
+ * @env Client | Server
938
+ * @param {number} pFrame - frame number
939
+ * @param {number} [pDelay] - optional; delay in milliseconds to freeze the newly set frame for; passing in -1 will pause the animation until you unpause it by changing the diob's 'animator.isPaused' to false
940
+ * @param {boolean} [pCont] - optional; if true, animation will play like normal after the frame delay; false will return the animation to the frame it was at before the set after the delay
941
+ */
942
+ setFrame(pFrame: number, pDelay?: number, pCont?: boolean): void
943
+
944
+ /**
945
+ * returns an object containing the information for the diob's current animation; current variables, onFrame for the current frame the animation is on, frameCount for total number of frames in the animation, atlasName for atlas of the current animation, iconName for icon name of current animation, iconState for state of current animation; example {'onFrame': 1, 'frameCount' 20, 'atlasName': '', 'iconName': '', 'iconState': ''}
946
+ * @env Client | Server
947
+ * @param {boolean} [pVal] - optional; string with name of specific value to get; options: 'onFrame', 'frameCount', 'atlasName', 'iconName', 'iconState'
948
+ * @returns {object,number} returns an object containing the information for the diob's current animation; current variables, onFrame for the current frame the animation is on, frameCount for total number of frames in the animation, atlasName for atlas of the current animation, iconName for icon name of current animation, iconState for state of current animation; example {'onFrame': 1, 'frameCount' 20, 'atlasName': '', 'iconName': '', 'iconState': ''}
949
+ */
950
+ getAnimation(pVal?: boolean): object,number
951
+
952
+ /**
953
+ * when this diob and pMovable no longer have overlapping bounding boxes
954
+ * @env Client | Server
955
+ * @event
956
+ * @param {Diob} pDiob - diob that uncrossed with this diob
957
+ */
958
+ onUncrossed(pDiob: Diob): void
959
+
960
+ /**
961
+ * called when a mouse button has been pressed while over this object
962
+ * @env Client | Server
963
+ * @event
964
+ * @param {Client} pClient - client of the mouse
965
+ * @param {number} pX - the x position of the mouse over the diob
966
+ * @param {number} pY - the y position of the mouse over the diob
967
+ * @param {unknown} pButton - the button used; 1 for left, 2 for middle, 3 for right
968
+ */
969
+ onMouseDown(pClient: Client, pX: number, pY: number, pButton: unknown): void
970
+
971
+ /**
972
+ * called when the mouse moves after entering this object
973
+ * @env Client | Server
974
+ * @event
975
+ * @param {Client} pClient - client of the mouse
976
+ * @param {number} pX - the x position of the mouse over the diob
977
+ * @param {number} pY - the y position of the mouse over the diob
978
+ */
979
+ onMouseMove(pClient: Client, pX: number, pY: number): void
980
+
981
+ /**
982
+ * returns the coords of the diob with an object {'x': x, 'y': y}
983
+ * @env Client | Server
984
+ * @returns {object} returns the coords of the diob with an object {'x': x, 'y': y}
985
+ */
986
+ getCoords(): object
987
+
988
+ /**
989
+ * CLIENT-ONLY; if set, the client will not update the draw layer of this diob when it changes location on the screen
990
+ * @env Client
991
+ */
992
+ preventScreenRelayer: boolean
993
+
994
+ /**
995
+ * calls on the client-side when clientSyncData is changed by the server
996
+ * @env Client | Server
997
+ * @event
998
+ * @param {unknown} pOld - old data in clientSyncData
999
+ */
1000
+ onClientSyncData(pOld: unknown): void
1001
+
1002
+ /**
1003
+ * returns an array of locations the diob is on; if diob is a tile, it returns an array containing only itself
1004
+ * @env Client | Server
1005
+ * @returns {Diob[]} returns an array of locations the diob is on; if diob is a tile, it returns an array containing only itself
1006
+ */
1007
+ getLocs(): Diob[]
1008
+
1009
+ /**
1010
+ * name of the lowest level parent type
1011
+ * @env Client | Server
1012
+ */
1013
+ baseType: string
1014
+
1015
+ /**
1016
+ * sets the coord offset of the object
1017
+ * @env Client | Server
1018
+ * @param {number} pX - the x offset from the xCoord
1019
+ * @param {number} pY - the y offset from the yCoord
1020
+ */
1021
+ setCoordOffsets(pX: number, pY: number): void
1022
+
1023
+ /**
1024
+ * name of object
1025
+ * @env Client | Server
1026
+ */
1027
+ name: unknown
1028
+
1029
+ /**
1030
+ * sets the icon state of the diob's icon
1031
+ * @env Client | Server
1032
+ * @param {string} pState - state of the icon to set
1033
+ * @param {number} [pFrame] - optional; if true, animation will start from the frame the last iconState left off on
1034
+ */
1035
+ setIconState(pState: string, pFrame?: number): void
1036
+
1037
+ /**
1038
+ * when this diob has an overlay removed from it
1039
+ * @env Client | Server
1040
+ * @event
1041
+ * @param {Diob} pD - the diob that was removed from the overlays
1042
+ */
1043
+ onRemoveOverlay(pD: Diob): void
1044
+
1045
+ /**
1046
+ * called when a mouse button is released while over this object
1047
+ * @env Client | Server
1048
+ * @event
1049
+ * @param {Client} pClient - client of the mouse
1050
+ * @param {number} pX - the x position of the mouse over the diob
1051
+ * @param {number} pY - the y position of the mouse over the diob
1052
+ * @param {unknown} pButton - the button used; 1 for left, 2 for middle, 3 for right
1053
+ */
1054
+ onMouseUp(pClient: Client, pX: number, pY: number, pButton: unknown): void
1055
+
1056
+ /**
1057
+ * position on the x-axis of the origin from the left edge of the diob
1058
+ * @env Client | Server
1059
+ */
1060
+ xOrigin: number
1061
+
1062
+ /**
1063
+ * when pMovable attempts to cross this diob resulting in overlapping bounding boxes; this function must return 'true' in order for pMovable to cross; this event is called for both diobs if they are both movable; tiles do not have this event
1064
+ * @env Client | Server
1065
+ * @event
1066
+ * @param {unknown} pMovable - movable that is attempting to cross with this diob
1067
+ * @param {unknown} pInit - if set, pMovable initiated the event
1068
+ */
1069
+ onCross(pMovable: unknown, pInit: unknown): void
1070
+
1071
+ /**
1072
+ * position on the y-axis from top to bottom of the map
1073
+ * @env Client | Server
1074
+ */
1075
+ yPos: number
1076
+
1077
+ /**
1078
+ * when this diob has an overlay added to it
1079
+ * @env Client | Server
1080
+ * @event
1081
+ * @param {Diob} pD - the diob added as an overlay
1082
+ */
1083
+ onAddOverlay(pD: Diob): void
1084
+
1085
+ /**
1086
+ * adds an overlay to the object which is a visual icon that always follows the object; returns the new overlay
1087
+ * @env Client | Server
1088
+ * @param {string | Diob | Object} pOver - string of the type of object or overlay to add an overlay of or actual diob to get type from
1089
+ * @param {number | boolean} [pAppearance] - optional; if 1 or positive, this overlay will be be treated as if it is part of the the parent's actual appearance - appearance settings such as angle and alpha of the parent will be used for this overlay and the overlay will be drawn directly on top of the parent so no other diobs that are not an overlay of the parent can appear between it and the parent (it will basically be an extension of the parent's icon); if this is false or 0, the overlay will be treated as an independent diob that just follows the parent around; if -1 or negative it will be treated like if it was 1 but it will appear under the parent instead of above it
1090
+ * @param {boolean} [pSkipEvent] - optional; if true, the onAddOverlay event will not be called
1091
+ * @returns {void} returns the new overlay
1092
+ */
1093
+ addOverlay(pOver: string | Diob | Object, pAppearance?: number | boolean, pSkipEvent?: boolean): void
1094
+
1095
+ /**
1096
+ * when this diob enters the client's screen view
1097
+ * @env Client | Server
1098
+ * @event
1099
+ * @param {Client} pClient - a reference to the client
1100
+ */
1101
+ onScreenShow(pClient: Client): void
1102
+
1103
+ /**
1104
+ * if set, will share animation with all other diobs with the same sync id; ex {'sync': 'water'}
1105
+ * @env Client | Server
1106
+ */
1107
+ animator: object
1108
+
1109
+ /**
1110
+ * state of the icon
1111
+ * @env Client | Server
1112
+ */
1113
+ iconState: unknown
1114
+
1115
+ /**
1116
+ * return data related to the internal sprite of the diob which
1117
+ * @env Client | Server
1118
+ * @param {string} pType - the type of data to get 'url' for data url, 'pixels' for array of pixel data, 'canvas' for an HTML canvas element
1119
+ */
1120
+ getSpriteData(pType: string): void
1121
+
1122
+ /**
1123
+ * when this diob and pD have overlapping bounding boxes
1124
+ * @env Client | Server
1125
+ * @event
1126
+ * @param {Diob} pD - diob that crossed with this diob
1127
+ * @param {unknown} pInit - if set, pD was relocated and initiated the event
1128
+ */
1129
+ onCrossed(pD: Diob, pInit: unknown): void
1130
+
1131
+ /**
1132
+ * set the diob's sprite to pData
1133
+ * @env Client | Server
1134
+ * @param {unknown} pData - the data used as the sprite
1135
+ * @param {string} [pType] - optional; default 'url'; the type of data to get 'url' for data url
1136
+ */
1137
+ setSpriteData(pData: unknown, pType?: string): void
1138
+
1139
+ /**
1140
+ * removed pDiob from this diob's viewer array
1141
+ * @env Client | Server
1142
+ * @param {Diob} pDiob - the diob to remove
1143
+ */
1144
+ removeInvisibilityViewer(pDiob: Diob): void
1145
+
1146
+ /**
1147
+ * y-axis offset of the icon
1148
+ * @env Client | Server
1149
+ */
1150
+ yIconOffset: number
1151
+
1152
+ /**
1153
+ * determines if the cursor executes mouse events on this object or not; 0 to ignore mouse events, 1 for icon size to determine mouse events, 2 for physical size to determine mouse events
1154
+ * @env Client | Server
1155
+ */
1156
+ mouseOpacity: unknown
1157
+
1158
+ /**
1159
+ * sets the movable's map position to pX, pY
1160
+ * @env Client | Server
1161
+ * @param {number} pX - value to set the movable's x position on the map to
1162
+ * @param {number} pY - value to set the movable's y position on the map to
1163
+ * @param {string} [pMap] - optional; string containing name of map to set position on
1164
+ */
1165
+ setPos(pX: number, pY: number, pMap?: string): void
1166
+
1167
+ /**
1168
+ * returns an array of diobs in the diob's contents using the provided arguments; if pType is not set, all diobs in the diob's contents will be returned; if pType is set but pChild is not, all diobs with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs in the game will be returned
1169
+ * @env Client | Server
1170
+ * @param {string} [pType] - optional; string containing type path to return
1171
+ * @param {boolean} [pChild] - optional; boolean that determines if child types are included
1172
+ * @returns {unknown[]} returns an array of diobs in the diob's contents using the provided arguments; if pType is not set, all diobs in the diob's contents will be returned; if pType is set but pChild is not, all diobs with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs in the game will be returned
1173
+ */
1174
+ getContents(pType?: string, pChild?: boolean): unknown[]
1175
+
1176
+ /**
1177
+ * called when the mouse enters this object
1178
+ * @env Client | Server
1179
+ * @event
1180
+ * @param {Client} pClient - client of the mouse
1181
+ * @param {number} pX - the x position of the mouse over the diob
1182
+ * @param {number} pY - the y position of the mouse over the diob
1183
+ */
1184
+ onMouseEnter(pClient: Client, pX: number, pY: number): void
1185
+
1186
+ /**
1187
+ * order of display of the diob; diobs with the same plane appear together with layers determining the order; a diob with a plane of 1 and layer 1000 will appear below a diob with plane 2 (default planes: Diob 0, Movable 1, Particle 2)
1188
+ * @env Client | Server
1189
+ */
1190
+ plane: unknown
1191
+
1192
+ /**
1193
+ * x-axis offset of the icon
1194
+ * @env Client | Server
1195
+ */
1196
+ xIconOffset: number
1197
+
1198
+ /**
1199
+ * returns an array of filter names
1200
+ * @env Client | Server
1201
+ * @returns {string[]} returns an array of filter names
1202
+ */
1203
+ getFilters(): string[]
1204
+
1205
+ /**
1206
+ * name of the map
1207
+ * @env Client | Server
1208
+ */
1209
+ mapName: unknown
1210
+
1211
+ /**
1212
+ * sets the x and y icon offsets
1213
+ * @env Client | Server
1214
+ * @param {number} pX - the x offset of the icon of this object
1215
+ * @param {number} pY - the y offset of the icon of this object
1216
+ */
1217
+ setIconOffsets(pX: number, pY: number): void
1218
+
1219
+ /**
1220
+ * when a movable bumps into this diob
1221
+ * @env Client | Server
1222
+ * @event
1223
+ * @param {unknown} pMovable - movable that did the bumping
1224
+ */
1225
+ onBumped(pMovable: unknown): void
1226
+
1227
+ /**
1228
+ * called when a mouse wheel button is scrolled downward while over this object
1229
+ * @env Client | Server
1230
+ * @event
1231
+ * @param {Client} pClient - client of the mouse
1232
+ * @param {number} pX - the x position of the mouse over the diob
1233
+ * @param {number} pY - the y position of the mouse over the diob
1234
+ */
1235
+ onMouseWheelScrollDown(pClient: Client, pX: number, pY: number): void
1236
+
1237
+ /**
1238
+ * hex, rgb, rgba, color matrix value, or a tint object; applies color filter to diob; ex ( '#000000' ); ex ( 'rgb(10, 20, 30)' ); ex ( {'tint': 0x444444} )
1239
+ * @env Client | Server
1240
+ */
1241
+ color: string | number[] | {'tint': number}
1242
+
1243
+ /**
1244
+ * name of the highest level parent type
1245
+ * @env Client | Server
1246
+ */
1247
+ parentType: unknown
1248
+
1249
+ /**
1250
+ * width of the collision box of the object
1251
+ * @env Client | Server
1252
+ */
1253
+ width: number
1254
+
1255
+ /**
1256
+ * 0 for no scale or an object {'x': 2, 'y': 2} containing the information for the scale
1257
+ * @env Client | Server
1258
+ */
1259
+ scale: unknown
1260
+
1261
+ /**
1262
+ * how many pixels object is offset on the grid y-axis from its yCoord
1263
+ * @env Client | Server
1264
+ */
1265
+ yCoordOffset: number
1266
+
1267
+ /**
1268
+ * position on the x-axis from left to right of the map
1269
+ * @env Client | Server
1270
+ */
1271
+ xPos: number
1272
+
1273
+ /**
1274
+ * order of display of the diob; higher layer objects appear above lower layer objects
1275
+ * @env Client | Server
1276
+ */
1277
+ layer: unknown
1278
+
1279
+ /**
1280
+ * returns an array of diobs that are overlays of this diob using the provided arguments; if pType is not set, all diobs will be returned; if pType is set but pChild is not, all diobs with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs will be returned
1281
+ * @env Client | Server
1282
+ * @param {string} [pType] - optional; string containing type path to return
1283
+ * @param {boolean} [pChild] - optional; boolean that determines if child types are included
1284
+ * @returns {Diob[]} returns an array of diobs that are overlays of this diob using the provided arguments; if pType is not set, all diobs will be returned; if pType is set but pChild is not, all diobs with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs will be returned
1285
+ */
1286
+ getOverlays(pType?: string, pChild?: boolean): Diob[]
1287
+
1288
+ /**
1289
+ * default 0.5; number for both x and y anchors or an object containing both {'x': 0, 'y': 0}; determines where the icon's origin is
1290
+ * @env Client | Server
1291
+ */
1292
+ anchor: {'x': number, 'y': number}
1293
+ [key: string]: any
1294
+
1295
+ }
1296
+
1297
+
1298
+
1299
+ /**The movable object.*/
1300
+ type Movable = {
1301
+
1302
+ /**
1303
+ * moves movable in the direction of pDir using movable's stepSize until told to stop; takes density into consideration; you can stop movement by calling a different movement function or calling this function with no or null arguments
1304
+ * @env Client | Server
1305
+ * @param {string} pDir - direction to move movable in
1306
+ */
1307
+ moveDir(pDir: string): void
1308
+
1309
+ /**
1310
+ * moves the movable by pX x pixels and pY y pixels until told to stop; takes obstacles into consideration; you can stop movement by calling a different movement function or calling this function with no or null arguments
1311
+ * @env Client | Server
1312
+ * @param {number} pX - x value to step by
1313
+ * @param {number} pY - y value to step by
1314
+ */
1315
+ movePos(pX: number, pY: number): void
1316
+
1317
+ /**
1318
+ * true if moving using the built-in movement
1319
+ * @env Client | Server
1320
+ */
1321
+ isMoving: unknown
1322
+
1323
+ /**
1324
+ * steps the movable by pX x pixels and pY y pixels; takes obstacles into consideration; returns true or false depending on if the step was successful
1325
+ * @env Client | Server
1326
+ * @param {number} pX - x value to step by
1327
+ * @param {number} pY - y value to step by
1328
+ * @param {unknown} pGlide - if set, movement will not stop unless move directions are blocked
1329
+ * @param {unknown} pSlide - if set, the step will occur without changing the movable's direction
1330
+ * @returns {void} returns true or false depending on if the step was successful
1331
+ */
1332
+ stepPos(pX: number, pY: number, pGlide: unknown, pSlide: unknown): void
1333
+
1334
+ /**
1335
+ * optional; time between each step, default is 60 steps a second for smoothest possible movement (default of 16.6667)
1336
+ * @env Client | Server
1337
+ */
1338
+ moveSettings: unknown
1339
+
1340
+ /**
1341
+ * moves movable pSize pixels in the direction of pDir; if pSize is not set, the size is the movable's stepSize; takes obstacles into consideration; returns true or false depending on if the step was successful
1342
+ * @env Client | Server
1343
+ * @param {string} pDir - direction to move movable in
1344
+ * @param {unknown} pSize - size of step to take
1345
+ * @param {unknown} pSlide - if set, the step will occur without changing the movable's direction
1346
+ * @returns {void} returns true or false depending on if the step was successful
1347
+ */
1348
+ stepDir(pDir: string, pSize: unknown, pSlide: unknown): void
1349
+
1350
+ /**
1351
+ * calls either movable.stepPos or movable.stepDir depending on the specified arguments; if pArg1 is a number, movable.stepPos will be called, otherwise movable.stepDir will be called; returns true or false depending on if the step was successful
1352
+ * @env Client | Server
1353
+ * @returns {void} returns true or false depending on if the step was successful
1354
+ */
1355
+ step(): void
1356
+
1357
+ /**
1358
+ * calls either movable.movePos or movable.moveDir depending on the specified arguments; if pArg1 is a number, movable.movePos will be called, otherwise movable.moveDir will be called; this moves the movable until told to stop; you can stop movement by calling a different movement function or calling this function with no or null arguments
1359
+ * @env Client | Server
1360
+ */
1361
+ move(): void
1362
+
1363
+ /**
1364
+ * string containing the direction of the movable; 'north', 'south', 'east', 'west', 'northwest', 'northeast', 'southwest', 'southeast'
1365
+ * @env Client | Server
1366
+ */
1367
+ dir: unknown
1368
+ [key: string]: any
1369
+
1370
+ }
1371
+
1372
+
1373
+
1374
+ /**The particle object.*/
1375
+ type Particle = {
1376
+
1377
+ /**
1378
+ * CLIENT-ONLY; if set, the client will not update the draw layer of this diob when it changes location on the screen
1379
+ * @env Client
1380
+ */
1381
+ preventScreenRelayer: boolean
1382
+ [key: string]: any
1383
+
1384
+ }
1385
+
1386
+
1387
+
1388
+ /**The tile object.*/
1389
+ type Tile = {
1390
+
1391
+ /**
1392
+ * when an object exits the contents of another object
1393
+ * @env Client | Server
1394
+ * @event
1395
+ * @param {Diob} pDiob - object that exited
1396
+ */
1397
+ onExited(pDiob: Diob): void
1398
+
1399
+ /**
1400
+ * called before the diob enters the tile; returning false will prevent the diob from entering
1401
+ * @env Client | Server
1402
+ * @event
1403
+ * @param {Diob} pDiob - diob trying to enter this tile
1404
+ * @param {string} pDir - direction of movement diob is attempting to make to enter the tile
1405
+ */
1406
+ onEnter(pDiob: Diob, pDir: string): void
1407
+
1408
+ /**
1409
+ * when an object enters the contents of another object
1410
+ * @env Client | Server
1411
+ * @event
1412
+ * @param {Diob} pDiob - object that entered
1413
+ */
1414
+ onEntered(pDiob: Diob): void
1415
+
1416
+ /**
1417
+ * called before the diob exits the tile; returning false will prevent the diob from exiting
1418
+ * @env Client | Server
1419
+ * @event
1420
+ * @param {Diob} pDiob - diob trying to exit this tile
1421
+ * @param {string} pDir - direction of movement diob is attempting to make to exit the tile
1422
+ */
1423
+ onExit(pDiob: Diob, pDir: string): void
1424
+ [key: string]: any
1425
+
1426
+ }
1427
+
1428
+
1429
+
1430
+ /**The region object.*/
1431
+ type Region = {
1432
+
1433
+ /**
1434
+ * when an object exits the contents of another object
1435
+ * @env Client | Server
1436
+ * @event
1437
+ * @param {Diob} pDiob - object that exited
1438
+ */
1439
+ onExited(pDiob: Diob): void
1440
+
1441
+ /**
1442
+ * when an object enters the contents of another object
1443
+ * @env Client | Server
1444
+ * @event
1445
+ * @param {Diob} pDiob - object that entered
1446
+ */
1447
+ onEntered(pDiob: Diob): void
1448
+ [key: string]: any
1449
+
1450
+ }
1451
+
1452
+
1453
+
1454
+ /**The mob object.*/
1455
+ type Mob = {
1456
+
1457
+ /**
1458
+ * a reference to the client of this mob
1459
+ * @env Client | Server
1460
+ */
1461
+ client: Client
1462
+
1463
+ /**
1464
+ * when a client no longer has control of a mob
1465
+ * @env Client | Server
1466
+ * @event
1467
+ */
1468
+ onLogout(): void
1469
+
1470
+ /**
1471
+ * when a client has taken control of the mob
1472
+ * @env Client | Server
1473
+ * @event
1474
+ */
1475
+ onLogin(): void
1476
+ [key: string]: any
1477
+
1478
+ }
1479
+
1480
+
1481
+
1482
+ /**The overlay object.*/
1483
+ type Overlay = {
1484
+
1485
+ /**
1486
+ * if true, this overlay will appear directly above the parent and use the same appearance properties as the parent, such as angle and alpha; the overlay will basically be an extension of the parent's icon; instead of true this can be an object containing information on the appearMask, 'shareIcon' to have the overlay share the same iconName as the parent, 'isUnder' to make the overlay appear under the parent instead of above, and 'ownMod' to let the overlay use its own alpha, angle, scale, transform, and composite variables, 'ownState' to have this overlay not sync up with the parent's iconState; ex {'shareIcon': true, 'isUnder': true}
1487
+ * @env Client | Server
1488
+ */
1489
+ appearMask: unknown
1490
+ [key: string]: any
1491
+
1492
+ }
1493
+
1494
+
1495
+
1496
+ /**The sound object.*/
1497
+ type Sound = {
1498
+
1499
+ /**
1500
+ * number of seconds that have been played into the sound
1501
+ * @env Client | Server
1502
+ */
1503
+ currentTime: number
1504
+
1505
+ /**
1506
+ * fades the sound's volume in or out from the current volume to pVol over pDur seconds
1507
+ * @env Client | Server
1508
+ * @param {number} pVol - number between 0 and 100
1509
+ * @param {number} pDur - number of seconds
1510
+ */
1511
+ fade(pVol: number, pDur: number): void
1512
+
1513
+ /**
1514
+ * if true, the sound has been manually stopped
1515
+ * @env Client | Server
1516
+ */
1517
+ isStopped: boolean
1518
+
1519
+ /**
1520
+ * resume the sound
1521
+ * @env Client | Server
1522
+ */
1523
+ resume(): void
1524
+
1525
+ /**
1526
+ * sets the volume of this Sound
1527
+ * @env Client | Server
1528
+ * @param {number} pVol - number between 0 and 100
1529
+ */
1530
+ setVolume(pVol: number): void
1531
+
1532
+ /**
1533
+ * stop the sound
1534
+ * @env Client | Server
1535
+ */
1536
+ stop(): void
1537
+
1538
+ /**
1539
+ * called when the sound finishes playing
1540
+ * @env Client | Server
1541
+ * @event
1542
+ */
1543
+ onEnded(): void
1544
+
1545
+ /**
1546
+ * number of seconds to play the sound for up to the sound file duration
1547
+ * @env Client | Server
1548
+ */
1549
+ duration: number
1550
+
1551
+ /**
1552
+ * called when the sound starts to playing for the first time
1553
+ * @env Client | Server
1554
+ * @event
1555
+ */
1556
+ onStarted(): void
1557
+
1558
+ /**
1559
+ * returns an ArrayBuffer containing the raw sound data; soundName must already be loaded before calling this
1560
+ * @env Client | Server
1561
+ * @returns {ArrayBuffer} returns an ArrayBuffer containing the raw sound data; soundName must already be loaded before calling this
1562
+ */
1563
+ getRawData(): ArrayBuffer
1564
+
1565
+ /**
1566
+ * called when the sound is manually resumed
1567
+ * @env Client | Server
1568
+ * @event
1569
+ */
1570
+ onResumed(): void
1571
+
1572
+ /**
1573
+ * returns an AudioBuffer containing the useful data on the sound's buffer; the sound must already be loaded and playing
1574
+ * @env Client | Server
1575
+ * @returns {AudioBuffer} returns an AudioBuffer containing the useful data on the sound's buffer; the sound must already be loaded and playing
1576
+ */
1577
+ getBuffer(): AudioBuffer
1578
+
1579
+ /**
1580
+ * name of the sound file associated with this sound object
1581
+ * @env Client | Server
1582
+ */
1583
+ soundName: string
1584
+
1585
+ /**
1586
+ * number of seconds to start playing the sound at
1587
+ * @env Client | Server
1588
+ */
1589
+ startTime: number
1590
+
1591
+ /**
1592
+ * turns looping on or off; if pLoop is not set, loop will be toggled
1593
+ * @env Client | Server
1594
+ * @param {unknown} [pLoop] - optional; true to loop, false to stop loop
1595
+ */
1596
+ setLoop(pLoop?: unknown): void
1597
+
1598
+ /**
1599
+ * number between 0 and 100; volume of this sound object; default 100
1600
+ * @env Client | Server
1601
+ */
1602
+ volume: number
1603
+
1604
+ /**
1605
+ * returns an AudioContext containing the useful data on the sound's context; the sound must already be loaded and playing
1606
+ * @env Client | Server
1607
+ * @returns {AudioContext} returns an AudioContext containing the useful data on the sound's context; the sound must already be loaded and playing
1608
+ */
1609
+ getContext(): AudioContext
1610
+
1611
+ /**
1612
+ * called when the sound is manually stopped
1613
+ * @env Client | Server
1614
+ * @event
1615
+ */
1616
+ onStopped(): void
1617
+
1618
+ /**
1619
+ * if true sound loops; if false sound plays once
1620
+ * @env Client | Server
1621
+ */
1622
+ loop: boolean
1623
+
1624
+ }
1625
+
1626
+
1627
+
1628
+ /**The interface object.*/
1629
+ type Interface = {
1630
+
1631
+ /**
1632
+ * shows the interface element
1633
+ * @env Client | Server
1634
+ */
1635
+ show(): void
1636
+
1637
+ /**
1638
+ * default false; if set this interface will not scale or move when the window changes size
1639
+ * @env Client | Server
1640
+ */
1641
+ preventAutoScale: boolean
1642
+
1643
+ /**
1644
+ * returns the name of the interface the interface object is part of
1645
+ * @env Client | Server
1646
+ * @returns {string} returns the name of the interface the interface object is part of
1647
+ */
1648
+ getInterfaceName(): string
1649
+
1650
+ /**
1651
+ * default 0; number of pixels to offset the text by on the y-axis
1652
+ * @env Client | Server
1653
+ */
1654
+ textStyle: object
1655
+
1656
+ /**
1657
+ * executes any default commands or custom executed event of object
1658
+ * @env Client | Server
1659
+ * @param {Client} pClient - client to execute with
1660
+ */
1661
+ execute(pClient: Client): void
1662
+
1663
+ /**
1664
+ * returns an object {'x': x,'y': y} containing the x and y positions of the interface element on the screen
1665
+ * @env Client | Server
1666
+ * @returns {{'x': number,'y': number}} returns an object {'x': x,'y': y} containing the x and y positions of the interface element on the screen
1667
+ */
1668
+ getPos(): {'x': number,'y': number}
1669
+
1670
+ /**
1671
+ * string containing composite value that determines how this diob is drawn with other diobs on the same plane; possible values: source-over, source-atop, source-in, source-out, destination-over, destination-atop, destination-in, destination-out, lighter, copy, xor, multiply, screen, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, hue, saturation, color, luminosity
1672
+ * @env Client | Server
1673
+ */
1674
+ composite: 'source-over' | 'source-atop' | 'source-in' | 'source-out' | 'destination-over' | 'destination-atop' | 'destination-in' | 'destination-out' | 'lighter' | 'copy' | 'xor' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity'
1675
+
1676
+ /**
1677
+ * returns the client this interface element belongs to, if there is one
1678
+ * @env Client | Server
1679
+ * @returns {void} returns the client this interface element belongs to, if there is one
1680
+ */
1681
+ getClient(): void
1682
+
1683
+ /**
1684
+ * position on the y-axis from top to bottom of the interface element on the screen
1685
+ * @env Client | Server
1686
+ */
1687
+ yPos: number
1688
+
1689
+ /**
1690
+ * locks the interface element to an edge of the screen; only works if preventAutoScale is enabled; possible values: top, top-left, top-right, right, left, bottom, bottom-right, bottom-left
1691
+ * @env Client | Server
1692
+ */
1693
+ edgeLock: 'top' | 'top-left' | 'top-right' | 'right' | 'left' | 'bottom' | 'bottom-right' | 'bottom-left'
1694
+
1695
+ /**
1696
+ * type of interface; TextBox/CommandInput/TextInput/PassInput/WebBox/TextArea/Default
1697
+ * @env Client | Server
1698
+ */
1699
+ interfaceType: string
1700
+
1701
+ /**
1702
+ * moves the interface element to the specified screen location
1703
+ * @env Client | Server
1704
+ * @param {number} pX - position on the x-axis of the screen; from left to right
1705
+ * @param {number} pY - position on the y-axis of the screen; from top to bottom
1706
+ */
1707
+ setPos(pX: number, pY: number): void
1708
+
1709
+ /**
1710
+ * true if the interface is hidden; false otherwise
1711
+ * @env Client | Server
1712
+ */
1713
+ isHidden: boolean
1714
+
1715
+ /**
1716
+ * returns the DOM/HTML element attached to this interface element, if there is one; access `innerBox` to get the box that `text` is added to
1717
+ * @env Client | Server
1718
+ * @returns {void} returns the DOM/HTML element attached to this interface element, if there is one; access `innerBox` to get the box that `text` is added to
1719
+ */
1720
+ getDOM(): void
1721
+
1722
+ /**
1723
+ * hides the interface element
1724
+ * @env Client | Server
1725
+ */
1726
+ hide(): void
1727
+
1728
+ /**
1729
+ * position on the x-axis from left to right of the interface element on the screen
1730
+ * @env Client | Server
1731
+ */
1732
+ xPos: number
1733
+ [key: string]: any
1734
+
1735
+ }
1736
+
1737
+
1738
+
1739
+ /**The client object.*/
1740
+ type Client = {
1741
+
1742
+ /**
1743
+ * stores pData as a string locally on the client's computer and can be referenced using pKey; leaving pKey and pData blank will clear all local storage; 3000 characters are allowed to be saved per game (keys and values combined)
1744
+ * @env Client | Server
1745
+ * @param {unknown} pKey - key used to reference the stored data
1746
+ * @param {unknown} pData - data as a string to store locally for the client
1747
+ */
1748
+ setLocalStorage(pKey: unknown, pData: unknown): void
1749
+
1750
+ /**
1751
+ * returns an object {'x': x, 'y': y} containing the x and y position on the map that currently matches the pX and pY position on the screen
1752
+ * @env Client | Server
1753
+ * @param {number} pX - x position on the screen
1754
+ * @param {number} pY - y position on the screen
1755
+ * @param {object} [pO] - optional; an existing object to set the x and y of
1756
+ * @returns {{'x': number, 'y': number}} returns an object {'x': x, 'y': y} containing the x and y position on the map that currently matches the pX and pY position on the screen
1757
+ */
1758
+ getPosFromScreen(pX: number, pY: number, pO?: object): {'x': number, 'y': number}
1759
+
1760
+ /**
1761
+ * returns the interface element object of the specified interface
1762
+ * @env Client | Server
1763
+ * @param {string} pInterface - name of the interface to get element from
1764
+ * @param {Diob} pElement - name of the element to get
1765
+ * @returns {Diob} returns the interface element object of the specified interface
1766
+ */
1767
+ getInterfaceElement(pInterface: string, pElement: Diob): Diob
1768
+
1769
+ /**
1770
+ * removes the specified filter
1771
+ * @env Client | Server
1772
+ * @param {string | number} pName - name of filter to remove
1773
+ */
1774
+ removeFilter(pName: string | number): void
1775
+
1776
+ /**
1777
+ * sets the client's overlays to the array pOver
1778
+ * @env Client | Server
1779
+ * @param {Diob[]} pOver - array of overlays to set this client's overlays to
1780
+ */
1781
+ setOverlays(pOver: Diob[]): void
1782
+
1783
+ /**
1784
+ * brings up a confirm window asking the user to select "yes" or "no"; returns true or false
1785
+ * @env Client | Server
1786
+ * @param {string} pMes - message to display in the confirm window
1787
+ * @param {Function} pFunc - function to call after input; the first argument will be the input; can be a "callback array" containing the function, the 'this', and arguments; ex ( [this.someFunc, this] )
1788
+ * @returns {void} returns true or false
1789
+ */
1790
+ confirm(pMes: string, pFunc: Function): void
1791
+
1792
+ /**
1793
+ * amount of blank tiles that can be seen on the left and right of the view
1794
+ * @env Client | Server
1795
+ */
1796
+ xEdgeLimit: number
1797
+
1798
+ /**
1799
+ * performs the specified draw function using the specified pArgs object; ex ( {'type': 'image', 'image': this, 'x': 1, 'y': 1} )
1800
+ * @env Client | Server
1801
+ * @param {object | object[]} pArgs - an object or array of objects which determines the settings of the draw
1802
+ * @param {string | number} pName - type of draw
1803
+ */
1804
+ topScreenDraw(pArgs: object | object[], pName: string | number): void
1805
+
1806
+ /**
1807
+ * returns an object {'x': x, 'y': y} containing the x and y offsets of client's view eye
1808
+ * @env Client | Server
1809
+ * @returns {{'x': number, 'y': number}} returns an object {'x': x, 'y': y} containing the x and y offsets of client's view eye
1810
+ */
1811
+ getViewEyeOffsets(): {'x': number, 'y': number}
1812
+
1813
+ /**
1814
+ * creates a new top screen named pName with the layer pLayer
1815
+ * @env Client | Server
1816
+ * @param {string | number} pName - name of the top screen to create
1817
+ * @param {unknown} [pLayer] - optional; layer to give the screen
1818
+ * @param {object} [pSet] - optional; settings object; ex ( {'scaleType': 'nearest'} );
1819
+ */
1820
+ createTopScreen(pName: string | number, pLayer?: unknown, pSet?: object): void
1821
+
1822
+ /**
1823
+ * returns an object containing the x and y of the game scale; ex: {'x': 2, 'y': 2}
1824
+ * @env Client | Server
1825
+ * @param {object} [pO] - optional; an existing object to set the x and y of
1826
+ * @returns {{'x': number, 'y': number}} returns an object containing the x and y of the game scale; ex: {'x': 2, 'y': 2}
1827
+ */
1828
+ getScreenScale(pO?: object): {'x': number, 'y': number}
1829
+
1830
+ /**
1831
+ * ends movement of client.playerMob in the direction of pDir
1832
+ * @env Client | Server
1833
+ * @param {string} pDir - name of direction to stop moving the client's playerMob in; pDir being undefined ends all movement
1834
+ */
1835
+ endMove(pDir: string): void
1836
+
1837
+ /**
1838
+ * returns the name of the account the client is logged in with
1839
+ * @env Client | Server
1840
+ * @returns {string} returns the name of the account the client is logged in with
1841
+ */
1842
+ getAccountName(): string
1843
+
1844
+ /**
1845
+ * adds the specified filter
1846
+ * @env Client | Server
1847
+ * @param {string | number} pName - name of the filter; only one name may be used at a time, using the name will remove the old filter with that name
1848
+ * @param {string} pType - the type of filter to add; below is the types and their specific possible pArgs values
1849
+ * @param {unknown} pArgs - color-based filter
1850
+ */
1851
+ addFilter(pName: string | number, pType: string, pArgs: unknown): void
1852
+
1853
+ /**
1854
+ * removes the client command from the client's commands
1855
+ * @env Client | Server
1856
+ * @param {string} pCommand - name of the client command to remove
1857
+ */
1858
+ removeCommand(pCommand: string): void
1859
+
1860
+ /**
1861
+ * sets the background of the client's screen background
1862
+ * @env Client | Server
1863
+ * @param {string} pBack - string containing a color, for example '#000' for black
1864
+ */
1865
+ setScreenBackground(pBack: string): void
1866
+
1867
+ /**
1868
+ * sets the client's max FPS to pFPS
1869
+ * @env Client | Server
1870
+ * @param {unknown} pFPS - cap the amount the FPS the client will try to reach when drawing the screen; default 60
1871
+ */
1872
+ setMaxFPS(pFPS: unknown): void
1873
+
1874
+ /**
1875
+ * returns a reference to the web tag with the id pID
1876
+ * @env Client | Server
1877
+ * @param {string} pID - id of the web tag
1878
+ * @returns {HTMLElement} returns a reference to the web tag with the id pID
1879
+ */
1880
+ getWebTag(pID: string): HTMLElement
1881
+
1882
+ /**
1883
+ * sets the style of pStyle to the value of pValue of the web tag with the id pID
1884
+ * @env Client | Server
1885
+ * @param {string} pID - id of the web tag to set the style of
1886
+ * @param {unknown} pStyle - type of style to set
1887
+ * @param {string} pValue - value as a string to set the style to
1888
+ */
1889
+ setWebTagStyle(pID: string, pStyle: unknown, pValue: string): void
1890
+
1891
+ /**
1892
+ * sets the HTML of the web box behind the game screen
1893
+ * @env Client | Server
1894
+ * @param {string} pBack - string containing HTML to set use in the web box behind the game screen
1895
+ */
1896
+ setWebBackground(pBack: string): void
1897
+
1898
+ /**
1899
+ * clears all the keys the client is holding and calls their key up events; if the client continues to hold the key and once the user manually releases the key, the key event may still continue to trigger, so take that into consideration
1900
+ * @env Client | Server
1901
+ */
1902
+ clearKeyDownEvents(): void
1903
+
1904
+ /**
1905
+ * focuses on the interface element object
1906
+ * @env Client | Server
1907
+ */
1908
+ setFocus(): void
1909
+
1910
+ /**
1911
+ * sets the variable pVar to pVal for the plane pPlane
1912
+ * @env Client | Server
1913
+ * @param {number} pPlane - value of plane to set
1914
+ * @param {string} pVar - string containing name of variable to set
1915
+ * @param {boolean} pVal - value to give this plane's pVar variable
1916
+ */
1917
+ setPlane(pPlane: number, pVar: string, pVal: boolean): void
1918
+
1919
+ /**
1920
+ * sets the client's view eye offsets
1921
+ * @env Client | Server
1922
+ * @param {number} pX - amount of pixels for the screen to be offset from the client's view eye on the x-axis
1923
+ * @param {number} pY - amount of pixels for the screen to be offset from the client's view eye on the y-axis
1924
+ */
1925
+ setViewEyeOffsets(pX: number, pY: number): void
1926
+
1927
+ /**
1928
+ * plays a sound to this client; returns the Sound object
1929
+ * @env Client | Server
1930
+ * @param {string | {'soundName': string, 'volume': number}} pSound - either a string with the name of a sound file, or a string containing the path of a Sound object, or an actual Sound object, or a basic object with the proper information; ex ( {'soundName': 'name', 'volume': 50} )
1931
+ * @param {unknown} [pStart] - optional; time to start playing the sound at
1932
+ * @param {unknown} [pDuration] - optional; how long to play the sound for
1933
+ * @returns {void} returns the Sound object
1934
+ */
1935
+ playSound(pSound: string | {'soundName': string, 'volume': number}, pStart?: unknown, pDuration?: unknown): void
1936
+
1937
+ /**
1938
+ * gets the data as a string that is stored with the key pKey on the client's computer
1939
+ * @env Client | Server
1940
+ * @param {unknown} pKey - key used to get data stored locally on the client's computer
1941
+ */
1942
+ getLocalStorage(pKey: unknown): Storage
1943
+
1944
+ /**
1945
+ * executes the event pEvent of the web tag with the id pID
1946
+ * @env Client | Server
1947
+ * @param {string} pID - id of the web tag to call the event of
1948
+ * @param {unknown} pEvent - name of the event to call; onMouseDown, onMouseUp, onMouseClick, onMouseDblClick, onMouseMove
1949
+ */
1950
+ callWebTagEvent(pID: string, pEvent: unknown): void
1951
+
1952
+ /**
1953
+ * returns an array of names of all created interfaces
1954
+ * @env Client | Server
1955
+ * @returns {string[]} returns an array of names of all created interfaces
1956
+ */
1957
+ getInterfaceNames(): string[]
1958
+
1959
+ /**
1960
+ * removes the script with the pName name from the game
1961
+ * @env Client | Server
1962
+ * @param {string | number} pName - name of script to remove
1963
+ */
1964
+ removeWebScript(pName: string | number): void
1965
+
1966
+ /**
1967
+ * loads a JavaScript file into the project
1968
+ * @env Client | Server
1969
+ * @param {string | number} pName - name to give the script
1970
+ * @param {unknown} pLink - link to the JavaScript file to load
1971
+ * @param {unknown} [pModule] - optional; load script as a module
1972
+ * @param {Function} [pFunc] - optional; function to call after the JavaScript file has loaded
1973
+ */
1974
+ addWebScript(pName: string | number, pLink: unknown, pModule?: unknown, pFunc?: Function): void
1975
+
1976
+ /**
1977
+ * a string containing the HTML to display behind the game screen; #web_background to set the style of the entire background
1978
+ * @env Client | Server
1979
+ */
1980
+ webBackground: string
1981
+
1982
+ /**
1983
+ * sets the client's screenView to pView or default if pView is null
1984
+ * @env Client | Server
1985
+ * @param {object} pView - an object containing new information for the client's screenView; for example {'scaleTo': 'ratio', 'scaleNearest': true} would mean the client's screenView keeps its ratio and scales pixels to their nearest neighbor; 'scaleNearest' means pixels will stay pixelated and will not try to blend with other pixels, 'scaleTo': 'normal' means normal scaling, 'scaleTo': 'ratio' means the width and height of the window keep their aspect ratio when scaled, 'scaleTo': 'multiple' means the game will only show in scales that are multiples of two when scaled, 'scaleTo': 'none' prevents all scaling
1986
+ */
1987
+ setScreenView(pView: object): void
1988
+
1989
+ /**
1990
+ * returns an object containing the cursor information; ex ( {'cursor': 'default', 'x': 0, 'y': 0} )
1991
+ * @env Client | Server
1992
+ * @returns {{'cursor': string, 'x': number, 'y': number}} returns an object containing the cursor information; ex ( {'cursor': 'default', 'x': 0, 'y': 0} )
1993
+ */
1994
+ getMouseCursor(): {'cursor': string, 'x': number, 'y': number}
1995
+
1996
+ /**
1997
+ * returns a screenView object containing the information of the client's screenView; for example {'scaleTo': 'ratio', 'scaleNearest': true} would mean the client's screenView keeps its ratio and scales pixels to their nearest neighbor
1998
+ * @env Client | Server
1999
+ * @returns {object} returns a screenView object containing the information of the client's screenView; for example {'scaleTo': 'ratio', 'scaleNearest': true} would mean the client's screenView keeps its ratio and scales pixels to their nearest neighbor
2000
+ */
2001
+ getScreenView(): object
2002
+
2003
+ /**
2004
+ * calls the client command of pCommand with the arguments of pArgs
2005
+ * @env Client
2006
+ * @param {string} pCommand - name of the client command to call
2007
+ * @param {unknown[]} pArgs - array of arguments to pass to the command
2008
+ * @param {unknown} [pSend] - CLIENT-ONLY; optional; if set the command will also be sent to the server
2009
+ */
2010
+ callCommand(pCommand: string, pArgs: unknown[], pSend?: unknown): void
2011
+
2012
+ /**
2013
+ * name of the interface element to send default messages to (ex: 'interface1.output1' )
2014
+ * @env Client | Server
2015
+ */
2016
+ mainOutput: string
2017
+
2018
+ /**
2019
+ * sets the focus on the web tag with the id pID
2020
+ * @env Client | Server
2021
+ * @param {string} pID - id of the web tag to set focus to
2022
+ */
2023
+ setWebTagFocus(pID: string): void
2024
+
2025
+ /**
2026
+ * hides the interface of pInterface if pElement is not specified, otherwise it only hides pElement
2027
+ * @env Client | Server
2028
+ * @param {string} pInterface - name of the interface to hide or the interface containing pElement
2029
+ * @param {Diob} [pElement] - optional; name of interface lement in pInterface to hide
2030
+ */
2031
+ hideInterface(pInterface: string, pElement?: Diob): void
2032
+
2033
+ /**
2034
+ * returns a mapView object containing the information of the client's mapView; for example {'width': 640, 'height': 640} would mean the client's mapView is 640 by 640 pixels in size
2035
+ * @env Client | Server
2036
+ * @returns {object} returns a mapView object containing the information of the client's mapView; for example {'width': 640, 'height': 640} would mean the client's mapView is 640 by 640 pixels in size
2037
+ */
2038
+ getMapView(): object
2039
+
2040
+ /**
2041
+ * toggles load screen on and off
2042
+ * @env Client | Server
2043
+ * @param {boolean} [pVal] - optional; true to show load screen, false to hide load screen
2044
+ */
2045
+ toggleLoadScreen(pVal?: boolean): void
2046
+
2047
+ /**
2048
+ * toggles macro capturing on and off
2049
+ * @env Client | Server
2050
+ * @param {boolean} [pVal] - optional; true to resume capturing macros, false to pause capturing macros
2051
+ */
2052
+ toggleMacroCapture(pVal?: boolean): void
2053
+
2054
+ /**
2055
+ * removes a web tag with the id of pID from the client's screen
2056
+ * @env Client | Server
2057
+ * @param {string} pID - id of the web tag to remove from the client's screen
2058
+ */
2059
+ removeWebTag(pID: string): void
2060
+
2061
+ /**
2062
+ * sets the view eye of the client to be centered on pDiob; the default is the player mob
2063
+ * @env Client | Server
2064
+ * @param {Diob} pDiob - diob to have the client's screen view centered on
2065
+ */
2066
+ setViewEye(pDiob: Diob): void
2067
+
2068
+ /**
2069
+ * returns an object containing the width and height of the game window; ex: {'width': 100, 'height': 100}
2070
+ * @env Client | Server
2071
+ * @param {object} [pO] - optional; an existing object to set the width and height of
2072
+ * @returns {{'width': number, 'height': number}} returns an object containing the width and height of the game window; ex: {'width': 100, 'height': 100}
2073
+ */
2074
+ getWindowSize(pO?: object): {'width': number, 'height': number}
2075
+
2076
+ /**
2077
+ * SERVER-ONLY; setting this will prevent the server from automatically loading interfaces on the server-side; if you want the server to have access, you will need to show the interface manually
2078
+ * @env Server
2079
+ */
2080
+ preventServerInterfaces: boolean
2081
+
2082
+ /**
2083
+ * adds a new command to the client's commands; if pFunc is null and pCommand is the name of an pre-defined command, that command will be added
2084
+ * @env Client | Server
2085
+ * @param {string} pCommand - name of the client command to be added
2086
+ * @param {Function} pFunc - function to be called when the command is executed
2087
+ */
2088
+ addCommand(pCommand: string, pFunc: Function): void
2089
+
2090
+ /**
2091
+ * sets the client's mainOutput
2092
+ * @env Client | Server
2093
+ * @param {string} pOutput - name of the interface element to send default messages to (ex: 'interface1.output1' )
2094
+ */
2095
+ setMainOutput(pOutput: string): void
2096
+
2097
+ /**
2098
+ * creates a new custom macro named pName with the keyDown command of pDown and the keyUp command of pUp; custom macros override macro atlas macros
2099
+ * @env Client | Server
2100
+ * @param {string | number} pName - name of the custom macro
2101
+ * @param {string} pKey - string of key that will execute the macro
2102
+ * @param {string} [pDown] - optional; string containing the command to be executed when the key is pushed down; example 'test(1)' would execute the 'test' client command with one parameter equal to '1'
2103
+ * @param {string} [pUp] - optional; string containing the command to be executed when the key is let go of; example 'test(1)' would execute the 'test' client command with one parameter equal to '1'
2104
+ */
2105
+ addCustomMacro(pName: string | number, pKey: string, pDown?: string, pUp?: string): void
2106
+
2107
+ /**
2108
+ * returns an object containing information about the client's browser and operating system; example {'platform': 'Netscape', 'version': 'Chrome/38.0.2125.104', 'vendor': 'Google', 'language': 'en-US', 'system': 'Windows 95'}
2109
+ * @env Client | Server
2110
+ * @returns {Navigator} returns an object containing information about the client's browser and operating system; example {'platform': 'Netscape', 'version': 'Chrome/38.0.2125.104', 'vendor': 'Google', 'language': 'en-US', 'system': 'Windows 95'}
2111
+ */
2112
+ getNavigator(): Navigator
2113
+
2114
+ /**
2115
+ * true or false; true acts the same as 'scaleNearest' when scaling, but it also removes smoothing caused by other things
2116
+ * @env Client | Server
2117
+ */
2118
+ screenView: unknown
2119
+
2120
+ /**
2121
+ * displays the interface of pInterface, if not already displayed, along with all elements of the interface with that are not hidden by default; if pElement is specified, it makes that element no longer hidden
2122
+ * @env Client | Server
2123
+ * @param {string} pInterface - name of interface to show
2124
+ * @param {Diob} [pElement] - optional; name of interface element in pInterface to show
2125
+ * @param {boolean} [pForce] - optional; if set, all hidden elements will be forced to be shown
2126
+ */
2127
+ showInterface(pInterface: string, pElement?: Diob, pForce?: boolean): void
2128
+
2129
+ /**
2130
+ * moves the client.playerMob in the direction pDir until told to stop via endMove(pDir)
2131
+ * @env Client | Server
2132
+ * @param {string} pDir - name of direction to move client.playerMob
2133
+ */
2134
+ startMove(pDir: string): void
2135
+
2136
+ /**
2137
+ * a string containing the address the client is connected to the server with (in format IP:port, or 'localhost' if not connected to a server)
2138
+ * @env Client | Server
2139
+ */
2140
+ address: string
2141
+
2142
+ /**
2143
+ * string containing CSS to be used as a web style (ex '.test{font-weight: bold;}.test2{color: #000;}' ); style can be referenced by the name 'default'
2144
+ * @env Client | Server
2145
+ */
2146
+ mainWebStyle: string
2147
+
2148
+ /**
2149
+ * returns the canvas element that this element is drawn on to
2150
+ * @env Client | Server
2151
+ * @param {unknown} pInt - name of the interface that element is on
2152
+ * @param {unknown} pEl - name of the element
2153
+ * @returns {HTMLCanvasElement} returns the canvas element that this element is drawn on to
2154
+ */
2155
+ getInterfaceCanvas(pInt: unknown, pEl: unknown): HTMLCanvasElement
2156
+
2157
+ /**
2158
+ * adds a custom font
2159
+ * @env Client | Server
2160
+ * @param {string | number} pName - name of the font
2161
+ * @param {string} pPath - url or path to the font file
2162
+ * @param {unknown} [pRemote] - optional; set this if the path is outside of the project
2163
+ * @param {object} [pStyle] - optional; custom style object to apply to the font; ex {'font-weight': bold}
2164
+ */
2165
+ addCustomFont(pName: string | number, pPath: string, pRemote?: unknown, pStyle?: object): void
2166
+
2167
+ /**
2168
+ * sends a packet to a client or server, depending on where the code is executed; client code executing this will send the packet to the server; server code executing this will send the packet to the client; this will invoke Client/onPacket on client-side if the sendPacket is server-side and on the server-side if it is on the client-side
2169
+ * @env Client | Server
2170
+ * @param {string | number} pName - name of packet to send
2171
+ * @param {unknown} pData - an object containing data to be sent; ex {'a': 1, 'b': 2}
2172
+ * @param {boolean} [pForce] - optional; send the packet immediately instead of buffering it with the packet delay
2173
+ */
2174
+ sendPacket(pName: string | number, pData: unknown, pForce?: boolean): void
2175
+
2176
+ /**
2177
+ * toggles screen drawing on and off
2178
+ * @env Client | Server
2179
+ * @param {boolean} [pVal] - optional; true to resume screen drawing, false to pause all screen drawing, 'map' to pause only the map drawing
2180
+ */
2181
+ toggleScreenDrawing(pVal?: boolean): void
2182
+
2183
+ /**
2184
+ * removes all overlays with the pOver type or the exact overlay matching pOver
2185
+ * @env Client | Server
2186
+ * @param {string | Diob | Object} pOver - string of the type of object or overlay to remove or actual overlay to remove
2187
+ */
2188
+ removeOverlay(pOver: string | Diob | Object): void
2189
+
2190
+ /**
2191
+ * adds an interface element to the interface and returns it
2192
+ * @env Client | Server
2193
+ * @param {string} pType - type of interface object to add
2194
+ * @param {string} pInterface - name of the interface to add the interface element to
2195
+ * @param {string | number} [pName] - optional; name to give the element being added
2196
+ * @param {number} [pX] - optional; x position to give the element
2197
+ * @param {number} [pY] - optional; y position to the give the element
2198
+ * @param {unknown[]} [pArgs] - optional; array of arguments to pass to the onNew event of the interface element being created
2199
+ * @returns {Diob} returns it
2200
+ */
2201
+ addInterfaceElement(pType: string, pInterface: string, pName?: string | number, pX?: number, pY?: number, pArgs?: unknown[]): Diob
2202
+
2203
+ /**
2204
+ * sets the content of the web tag with the id pID to the value of pContent
2205
+ * @env Client | Server
2206
+ * @param {string} pID - id of the web tag to set the content of
2207
+ * @param {string} pContent - string containing the content to change the web tag's content to
2208
+ */
2209
+ setWebTagContent(pID: string, pContent: string): void
2210
+
2211
+ /**
2212
+ * amount of pixels the client's view is offset by from the view eye on the y-axis
2213
+ * @env Client | Server
2214
+ */
2215
+ yViewEyeOffset: number
2216
+
2217
+ /**
2218
+ * a reference to the player mob of this client
2219
+ * @env Client | Server
2220
+ */
2221
+ mob: Diob
2222
+
2223
+ /**
2224
+ * brings up an alert window with pMes in it
2225
+ * @env Client | Server
2226
+ * @param {string} pMes - message to show in the alert
2227
+ */
2228
+ alert(pMes: string): void
2229
+
2230
+ /**
2231
+ * returns the current FPS
2232
+ * @env Client | Server
2233
+ * @returns {number} returns the current FPS
2234
+ */
2235
+ getFPS(): number
2236
+
2237
+ /**
2238
+ * set in order to tell the engine the client is in an input and key commands should be used as text input, false for normal; engine automatically sets this for most inputs
2239
+ * @env Client | Server
2240
+ */
2241
+ inInput: boolean
2242
+
2243
+ /**
2244
+ * returns the diob the client's screen eye is currently set to
2245
+ * @env Client | Server
2246
+ * @returns {Diob} returns the diob the client's screen eye is currently set to
2247
+ */
2248
+ getViewEye(): Diob
2249
+
2250
+ /**
2251
+ * moves the client to a new server located at the address pAddress
2252
+ * @env Client | Server
2253
+ * @param {unknown} pAddres - address for the server to move the client to; example '127.0.0.1:1234'
2254
+ */
2255
+ changeServer(pAddres: unknown): void
2256
+
2257
+ /**
2258
+ * returns an array of interface elements on the interface pInterface depending on the provided arguments; if pType is not set, all elements on the interface will be returned; if pType is set but pChild is not, elements on the interface with the exact type of pType will be returned; if pType is set and pChild is set, all elements with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Interface/A' with pChild undefined, all elements with the exact type of 'Interface/A' will be returned, but if pChild is set, then all types starting with 'Interface/A' on the interface will be returned
2259
+ * @env Client | Server
2260
+ * @param {string} pInterface - name of the interface to get element from
2261
+ * @param {string} [pType] - optional; string containing type path to return
2262
+ * @param {boolean} [pChild] - optional; boolean that determines if child types are included
2263
+ * @returns {Diob[]} returns an array of interface elements on the interface pInterface depending on the provided arguments; if pType is not set, all elements on the interface will be returned; if pType is set but pChild is not, elements on the interface with the exact type of pType will be returned; if pType is set and pChild is set, all elements with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Interface/A' with pChild undefined, all elements with the exact type of 'Interface/A' will be returned, but if pChild is set, then all types starting with 'Interface/A' on the interface will be returned
2264
+ */
2265
+ getInterfaceElements(pInterface: string, pType?: string, pChild?: boolean): Diob[]
2266
+
2267
+ /**
2268
+ * returns the content of the web tag with the id of pID
2269
+ * @env Client | Server
2270
+ * @param {string} pID - id of the web tag to get the content of
2271
+ * @returns {string} returns the content of the web tag with the id of pID
2272
+ */
2273
+ getWebTagContent(pID: string): string
2274
+
2275
+ /**
2276
+ * changes the name and layer of the top screen with the name pName; adding data optional
2277
+ * @env Client | Server
2278
+ * @param {string | number} pName - name of the top screen to set
2279
+ * @param {unknown} pNewName - new name of the top screen
2280
+ * @param {unknown} pNewLayer - new layer of the top screen
2281
+ * @param {unknown} [pNewData] - optional; data to add to the screen
2282
+ * @param {unknown} [pNewSet] - optional; new settings object
2283
+ */
2284
+ setTopScreen(pName: string | number, pNewName: unknown, pNewLayer: unknown, pNewData?: unknown, pNewSet?: unknown): void
2285
+
2286
+ /**
2287
+ * sets the edge limit of the map for the client
2288
+ * @env Client | Server
2289
+ * @param {number} pX - number of black tiles visible on the left and right edges of the map; -1 for default
2290
+ * @param {number} pY - number of black tiles visible on the top and bottom edges of the map; -1 for default
2291
+ */
2292
+ setEdgeLimit(pX: number, pY: number): void
2293
+
2294
+ /**
2295
+ * sets the client's mapView to pView or default if pView is null
2296
+ * @env Client | Server
2297
+ * @param {object} pView - an object containing new information for the client's mapView; for example {'width': 640, 'height': 640} would set the client's mapView to 640 by 640 pixels
2298
+ */
2299
+ setMapView(pView: object): void
2300
+
2301
+ /**
2302
+ * brings up a prompt window to ask for text from the user
2303
+ * @env Client | Server
2304
+ * @param {unknown} pTitle - title of the prompt
2305
+ * @param {string} pMes - default text in the input
2306
+ * @param {Function} pFunc - function to call after input; the first argument will be the input; can be a "callback array" containing the function, the 'this', and arguments; ex ( [this.someFunc, this] )
2307
+ */
2308
+ prompt(pTitle: unknown, pMes: string, pFunc: Function): void
2309
+
2310
+ /**
2311
+ * amount of pixels the client's view is offset by from the view eye on the x-axis
2312
+ * @env Client | Server
2313
+ */
2314
+ xViewEyeOffset: number
2315
+
2316
+ /**
2317
+ * returns true if pInt is currently shown, false if not; if pEl is set, checks if the specified element is shown
2318
+ * @env Client | Server
2319
+ * @param {unknown} pInt - name of the interface
2320
+ * @param {unknown} [pEl] - optional; name of the element
2321
+ * @returns {boolean} returns true if pInt is currently shown, false if not; if pEl is set, checks if the specified element is shown
2322
+ */
2323
+ checkInterfaceShown(pInt: unknown, pEl?: unknown): boolean
2324
+
2325
+ /**
2326
+ * outputs text to an interface element; if pInt or pEl is not set or is invalid, text goes to client.mainOutput
2327
+ * @env Client | Server
2328
+ * @param {string} pText - text to be displayed
2329
+ * @param {string} pInt - string containing interface file name to output to
2330
+ * @param {string} pEl - string containing the interface element name to output to
2331
+ */
2332
+ outputText(pText: string, pInt: string, pEl: string): void
2333
+
2334
+ /**
2335
+ * returns an array of diobs on the screen that overlap the specified position box depending on the provided arguments; if pType is not set, all diobs in the position box will be returned; if pType is set but pChild is not, diobs in the position box with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Interface' with pChild undefined, all diobs with the exact type of 'Interface' will be returned, but if pChild is set, then all interfaces on the screen will be returned
2336
+ * @env Client | Server
2337
+ * @param {number} pX - starting x position
2338
+ * @param {number} pY - starting y position
2339
+ * @param {string} [pType] - optional; ending x position
2340
+ * @param {boolean} [pChild] - optional; ending y position
2341
+ * @param {string} [pPage] - optional; string containing type path to return
2342
+ * @returns {Diob[]} returns an array of diobs on the screen that overlap the specified position box depending on the provided arguments; if pType is not set, all diobs in the position box will be returned; if pType is set but pChild is not, diobs in the position box with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Interface' with pChild undefined, all diobs with the exact type of 'Interface' will be returned, but if pChild is set, then all interfaces on the screen will be returned
2343
+ */
2344
+ getInterfaceElementsFromScreen(pX: number, pY: number, pType?: string, pChild?: boolean, pPage?: string): Diob[]
2345
+
2346
+ /**
2347
+ * removes a font from being usable
2348
+ * @env Client | Server
2349
+ * @param {string | number} pName - name of the font to remove
2350
+ */
2351
+ removeCustomFont(pName: string | number): void
2352
+
2353
+ /**
2354
+ * string containing a color (null for transparent) to set the client's screen background to, for example '#000' for black; default is '#000'
2355
+ * @env Client | Server
2356
+ */
2357
+ screenBackground: string | null
2358
+
2359
+ /**
2360
+ * adds an overlay to the client which is a visual icon that always follows the screen; returns the new overlay; if pOver is already an overlay of a diob it will remove it form that diob and add it to this diob
2361
+ * @env Client | Server
2362
+ * @param {string | Diob | Object} pOver - string of the type of object or overlay to add an overlay of or actual diob to add
2363
+ * @param {number | boolean} [pAppearance] - optional; if true, this overlay will be be treated as if it is part of the the parent's actual appearance - appearance settings such as angle and alpha of the parent will be used for this overlay and the overlay will be drawn directly on top of the parent so no other diobs that are not an overlay of the parent can appear between it and the parent (it will basically be an extension of the parent's icon); if this is false, the overlay will be treated as an independent diob that just follows the parent around; instead of true or false this can be an object containing information on the appearMask, 'shareIcon' to have the overlay share the same iconName as the parent and 'isUnder' to make the overlay appear under the parent instead of above, 'ownState' to have this overlay not sync up with the parent's iconState; ex {'shareIcon': true, 'isUnder': true}
2364
+ * @param {boolean} [pSkipEvent] - optional; if true, the onAddOverlay event will not be called
2365
+ * @returns {Diob} returns the new overlay; if pOver is already an overlay of a diob it will remove it form that diob and add it to this diob
2366
+ */
2367
+ addOverlay(pOver: string | Diob | Object, pAppearance?: number | boolean, pSkipEvent?: boolean): Diob
2368
+
2369
+ /**
2370
+ * changes the macro file the client uses
2371
+ * @env Client | Server
2372
+ * @param {string} pMacro - name of macro file to set client macros to
2373
+ */
2374
+ setMacroAtlas(pMacro: string): void
2375
+
2376
+ /**
2377
+ * grabs an object with the screen name, layer, settings, and either an array of pixel data or a data url depending on pType for the entire screen named pName or the default top screen if no name is given. The array of pixel data can then be changed and used elsewhere or drawn onto another screen. To read the width and height you could use object.width and object.height, where object is the object returned by the function. The object data array is as follows: object.data[0] is the red value (0-255) of the pixel at 0,0, object.data[1] is the green value (0-255) of the pixel at 0,0, object.data[2] is the blue value (0-255) of the pixel at 0,0, and object.data[3] is the alpha value (0-255) of the pixel at 0,0. Then object.data[4], object.data[5], object.data[6], and object.data[7] are the respective values for the pixel at 1,0. This trend continues through the whole array for every pixel. object ex: {'name': '', 'layer': 1, 'data': ''}
2378
+ * @env Client | Server
2379
+ * @param {string | number} [pName] - optional; name of the top screen to get the data of
2380
+ * @param {string} [pType] - optional; type of data to get; 'url' or 'pixels' or 'canvas'
2381
+ */
2382
+ getTopScreen(pName?: string | number, pType?: string): void
2383
+
2384
+ /**
2385
+ * sets the cursor of the client
2386
+ * @env Client | Server
2387
+ * @param {string} pCursor - a string containing the name of the cursor for built-in cursors, a URL path to an image, or a diob; built-in (auto, all-scroll, crosshair, default, help, inherit, move, pointer, progress, text, vertical-text, wait, no-drop, not-allowed, e-resize, n-resize, s-resize, w-resize, col-resize, row-resize, ne-resize, nw-resize, se-resize, sw-resize); passing a diob will use the diob's icon; blank for default
2388
+ * @param {number} [pX] - optional; offsets the icon left or right by pX pixels
2389
+ * @param {number} [pY] - optional; offsets the icon up or down by pY pixels
2390
+ */
2391
+ setMouseCursor(pCursor: string, pX?: number, pY?: number): void
2392
+
2393
+ /**
2394
+ * maximum number of frames the client will attempt to draw per second; default 60
2395
+ * @env Client | Server
2396
+ */
2397
+ maxFPS: number
2398
+
2399
+ /**
2400
+ * removes a CSS style with the name pName
2401
+ * @env Client | Server
2402
+ * @param {string | number} pName - unique name of style
2403
+ */
2404
+ removeWebStyle(pName: string | number): void
2405
+
2406
+ /**
2407
+ * returns an object {'step': step, 'max': {'x': x, 'y': y}} containing delay details of client's view eye
2408
+ * @env Client | Server
2409
+ * @returns {{'step': number, 'max': {'x': number, 'y': number}}} returns an object {'step': step, 'max': {'x': x, 'y': y}} containing delay details of client's view eye
2410
+ */
2411
+ getViewEyeDelay(): {'step': number, 'max': {'x': number, 'y': number}}
2412
+
2413
+ /**
2414
+ * returns address of the client, 'localhost' for local or 'ip:port' if connected to a server
2415
+ * @env Client | Server
2416
+ * @returns {string} returns address of the client, 'localhost' for local or 'ip:port' if connected to a server
2417
+ */
2418
+ getAddress(): string
2419
+
2420
+ /**
2421
+ * returns an array of custom macro names
2422
+ * @env Client | Server
2423
+ * @returns {string[]} returns an array of custom macro names
2424
+ */
2425
+ getCustomMacroNames(): string[]
2426
+
2427
+ /**
2428
+ * returns an object {'x': x, 'y': y} containing the x and y position of the client's screen on the map
2429
+ * @env Client | Server
2430
+ * @param {object} [pO] - optional; an existing object to set the x and y of
2431
+ * @returns {{'x': number, 'y': number}} returns an object {'x': x, 'y': y} containing the x and y position of the client's screen on the map
2432
+ */
2433
+ getScreenPos(pO?: object): {'x': number, 'y': number}
2434
+
2435
+ /**
2436
+ * evaluates the JavaScript code in the pScript string; returns undefined on the server-side
2437
+ * @env Client | Server
2438
+ * @param {string} pScript - a string containing the JavaScript code to evaluate
2439
+ * @returns {void} returns undefined on the server-side
2440
+ */
2441
+ evalWebScript(pScript: string): void
2442
+
2443
+ /**
2444
+ * amount of blank tiles that can be seen on the top and bottom of the view
2445
+ * @env Client | Server
2446
+ */
2447
+ yEdgeLimit: number
2448
+
2449
+ /**
2450
+ * returns an object containing the mouse position; ex ( {'x': 0, 'y': 0} )
2451
+ * @env Client | Server
2452
+ * @returns {{'x': number, 'y': number}} returns an object containing the mouse position; ex ( {'x': 0, 'y': 0} )
2453
+ */
2454
+ getMousePos(): {'x': number, 'y': number}
2455
+
2456
+ /**
2457
+ * returns object currently being focused by this client
2458
+ * @env Client | Server
2459
+ * @returns {object} returns object currently being focused by this client
2460
+ */
2461
+ getFocus(): object
2462
+
2463
+ /**
2464
+ * returns the diob plane pPlane ir specified, otherwise returns an array of existing planes; you can then alter it like any other diob and all visual changes will be applied to all diobs on this plane
2465
+ * @env Client | Server
2466
+ * @param {number} [pPlane] - optional; value of plane to get
2467
+ * @returns {Diob | Diob[]} returns the diob plane pPlane ir specified, otherwise returns an array of existing planes; you can then alter it like any other diob and all visual changes will be applied to all diobs on this plane
2468
+ */
2469
+ getPlane(pPlane?: number): Diob | Diob[]
2470
+
2471
+ /**
2472
+ * sets the client's game screen size to pWidth width and pHeight height
2473
+ * @env Client | Server
2474
+ * @param {number} pWidth - width as a number
2475
+ * @param {number} pHeight - height as a number
2476
+ */
2477
+ setScreenSize(pWidth: number, pHeight: number): void
2478
+
2479
+ /**
2480
+ * returns an array of filter names
2481
+ * @env Client | Server
2482
+ * @returns {string[]} returns an array of filter names
2483
+ */
2484
+ getFilters(): string[]
2485
+
2486
+ /**
2487
+ * sets the client's view eye delay which is how many pixels the screen can be off center of the view eye and how quickly it catches up to the view eye; set step to 0 for no delay (the default)
2488
+ * @env Client | Server
2489
+ * @param {number} pDelay - object containing eye delay information; possible values 'step' (determines number of pixels the eye moves per frame; default 0) and 'max' (object determining maximum distance in pixels the screen can be from the eye {'x': 100, 'y': 100}); ex {'step': 2, 'max': {'x': 100, 'y': 100}}
2490
+ */
2491
+ setViewEyeDelay(pDelay: number): void
2492
+
2493
+ /**
2494
+ * removes an interface element from the interface
2495
+ * @env Client | Server
2496
+ * @param {string} pInterface - name of the interface to remove an interface element from
2497
+ * @param {string | number} pName - name of the interface element to remove
2498
+ */
2499
+ removeInterfaceElement(pInterface: string, pName: string | number): void
2500
+
2501
+ /**
2502
+ * returns an object containing the width and height of the game screen; ex: {'width': 100, 'height': 100}
2503
+ * @env Client | Server
2504
+ * @param {object} [pO] - optional; an existing object to set the width and height of
2505
+ * @returns {{'width': number, 'height': number}} returns an object containing the width and height of the game screen; ex: {'width': 100, 'height': 100}
2506
+ */
2507
+ getScreenSize(pO?: object): {'width': number, 'height': number}
2508
+
2509
+ /**
2510
+ * hex, rgb, rgba, color matrix value, or a tint object; applies color filter to diob; ex ( '#000000' ); ex ( 'rgb(10, 20, 30)' ); ex ( {'tint': 0x444444} )
2511
+ * @env Client | Server
2512
+ */
2513
+ color: string | number[] | {'tint': number}
2514
+
2515
+ /**
2516
+ * creates a new interface file named pName
2517
+ * @env Client | Server
2518
+ * @param {string | number} pName - name of the interface to create
2519
+ */
2520
+ createInterface(pName: string | number): void
2521
+
2522
+ /**
2523
+ * sends the data for the pD diob to the client, if pVar is set it will send only those variables, if it is not set it will only send built-in engine variables
2524
+ * @env Server
2525
+ * @param {Diob} pD - reference to the diob to send
2526
+ * @param {unknown[]} [pVar] - optional; variable name or array of variable names
2527
+ */
2528
+ sendDiob(pD: Diob, pVar?: unknown[]): void
2529
+
2530
+ /**
2531
+ * adds CSS style
2532
+ * @env Client | Server
2533
+ * @param {string | number} pName - unique name of style
2534
+ * @param {unknown} pStyle - text as CSS to add to the client
2535
+ */
2536
+ addWebStyle(pName: string | number, pStyle: unknown): void
2537
+
2538
+ /**
2539
+ * removes the custom macro pName from the client's custom macros
2540
+ * @env Client | Server
2541
+ * @param {string | number} pName - name of the custom macro
2542
+ */
2543
+ removeCustomMacro(pName: string | number): void
2544
+
2545
+ /**
2546
+ * object containing eye delay information; possible values 'step' (determines number of pixels the eye moves per frame; default 1) and 'max' (object determining maximum distance in pixels the screen can be from the eye {'x': 100, 'y': 100}); ex {'step': 2, 'max': {'x': 100, 'y': 100}}
2547
+ * @env Client | Server
2548
+ */
2549
+ viewEyeDelay: {'step': number, 'max': {'x': number, 'y': number}}
2550
+
2551
+ /**
2552
+ * sets the client's playerMob to pMob
2553
+ * @env Client | Server
2554
+ * @param {Diob} pMob - reference to a Mob diob to give this client control of
2555
+ */
2556
+ setPlayerMob(pMob: Diob): void
2557
+
2558
+ /**
2559
+ * returns an array of diobs that are overlays of this diob using the provided arguments; if pType is not set, all diobs will be returned; if pType is set but pChild is not, all diobs with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs will be returned
2560
+ * @env Client | Server
2561
+ * @param {string} [pType] - optional; string containing type path to return
2562
+ * @param {boolean} [pChild] - optional; boolean that determines if child types are included
2563
+ * @returns {Diob[]} returns an array of diobs that are overlays of this diob using the provided arguments; if pType is not set, all diobs will be returned; if pType is set but pChild is not, all diobs with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs will be returned
2564
+ */
2565
+ getOverlays(pType?: string, pChild?: boolean): Diob[]
2566
+
2567
+ /**
2568
+ * optional; if set, the map will not scale based on the window size
2569
+ * @env Client | Server
2570
+ */
2571
+ mapView: object
2572
+ [key: string]: any
2573
+
2574
+ }
2575
+
2576
+
2577
+
2578
+ /**The resource object.*/
2579
+ type Resource = {
2580
+
2581
+ /**
2582
+ * sets a game resource to use the resource file located at pPath
2583
+ * @env Client | Server
2584
+ * @param {string} pType - type of file to set
2585
+ * @param {string | number} pName - name of file to set; this will be referenced in the project; example if pName was set to 'my_atlas' ( atlasName = 'my_atlas' )
2586
+ * @param {string} pPath - path to the file; if not a remote file this will be the name of the file (or path if any sub directories were added) inside resources/files/ for the game, otherwise it will be a web URL path to the file
2587
+ * @param {unknown} [pRemote] - optional; if set the pPath file will be treated like a web URL
2588
+ */
2589
+ setResource(pType: string, pName: string | number, pPath: string, pRemote?: unknown): void
2590
+
2591
+ /**
2592
+ * returns the direct path to the resource
2593
+ * @env Client | Server
2594
+ * @param {string} pType - type of file to get
2595
+ * @param {string | number} pName - name of file to get
2596
+ * @returns {string} returns the direct path to the resource
2597
+ */
2598
+ getResourcePath(pType: string, pName: string | number): string
2599
+
2600
+ /**
2601
+ * loads the resource of type pType with the name pName and then calls the function pFunc
2602
+ * @env Client | Server
2603
+ * @param {string} pType - type of file to load
2604
+ * @param {string | number} pName - name of file to load
2605
+ * @param {Function} pFunc - function to call after the resource has finished loading or failed to load
2606
+ */
2607
+ loadResource(pType: string, pName: string | number, pFunc: Function): void
2608
+
2609
+ /**
2610
+ * returns a string containing the text inside of a loaded non-VS text file; the file must already be loaded to get the text
2611
+ * @env Client | Server
2612
+ * @param {string | number} pName - name of loaded file to get text of
2613
+ * @returns {string} returns a string containing the text inside of a loaded non-VS text file; the file must already be loaded to get the text
2614
+ */
2615
+ getFileText(pName: string | number): string
2616
+
2617
+ }
2618
+
2619
+
2620
+
2621
+ /**The util object.*/
2622
+ type Util = {
2623
+
2624
+ /**
2625
+ * returns pVal converted to a float number
2626
+ * @env Client | Server
2627
+ * @param {boolean} pVal - value to get number from
2628
+ * @returns {number} returns pVal converted to a float number
2629
+ */
2630
+ parseFloat(pVal: boolean): number
2631
+
2632
+ /**
2633
+ * unzips gzipped data and returns the unzipped data
2634
+ * @env Client | Server
2635
+ * @param {unknown} pData - gzipped data
2636
+ * @returns {string} returns the unzipped data
2637
+ */
2638
+ gzUnzip(pData: unknown): string
2639
+
2640
+ /**
2641
+ * returns a string containing the type of variable
2642
+ * @env Client | Server
2643
+ * @param {unknown} pVar - variable to check
2644
+ * @returns {string} returns a string containing the type of variable
2645
+ */
2646
+ getVariableType(pVar: unknown): string
2647
+
2648
+ /**
2649
+ * handles either a stored callback function or a "callback array" and returns the results
2650
+ * @env Client | Server
2651
+ * @param {[Function, this: Diob | Object, [arg1: unknown, arg2: unknown]]} [pCallback] - reference to a function or a "callback array" which contains the reference to the callback function, followed by the call owner (the `this` of the function call), then an optional array of arguments; ex ( [this.func, this, [arg1, arg2]] )
2652
+ * @returns {void} returns the results
2653
+ */
2654
+ handleCallback(pCallback?: [Function, this: Diob | Object, [arg1: unknown, arg2: unknown]]): void
2655
+
2656
+ /**
2657
+ * converts pRad into degrees and returns the number
2658
+ * @env Client | Server
2659
+ * @param {unknown} pRad - radians to convert
2660
+ * @returns {number} returns the number
2661
+ */
2662
+ toDegrees(pRad: unknown): number
2663
+
2664
+ /**
2665
+ * returns pVal converted to a number value
2666
+ * @env Client | Server
2667
+ * @param {boolean} pVal - value to get number from
2668
+ * @returns {number} returns pVal converted to a number value
2669
+ */
2670
+ toNumber(pVal: boolean): number
2671
+
2672
+ /**
2673
+ * creates an object from pString and returns it if the string is a valid object format
2674
+ * @env Client | Server
2675
+ * @param {string} pString - string to create an object from; ex ( "{'name': 'test', 'value1': 1}" )
2676
+ * @returns {object | undefined} returns it if the string is a valid object format
2677
+ */
2678
+ stringToObject(pString: string): object | undefined
2679
+
2680
+ /**
2681
+ * returns new text that has been encoded to make it a valid URI component
2682
+ * @env Client | Server
2683
+ * @param {string} pText - text to encode
2684
+ * @returns {string} returns new text that has been encoded to make it a valid URI component
2685
+ */
2686
+ encodeURIComponent(pText: string): string
2687
+
2688
+ /**
2689
+ * returns true if value is a string; returns false if value is not a string
2690
+ * @env Client | Server
2691
+ * @param {boolean} pVal - value to check for string
2692
+ * @returns {string} returns true if value is a string; returns false if value is not a string
2693
+ */
2694
+ isString(pVal: boolean): string
2695
+
2696
+ /**
2697
+ * returns true if value is an object; returns false if value is not an object
2698
+ * @env Client | Server
2699
+ * @param {boolean} pVal - value to check for object
2700
+ * @returns {boolean} returns true if value is an object; returns false if value is not an object
2701
+ */
2702
+ isObject(pVal: boolean): boolean
2703
+
2704
+ /**
2705
+ * text to encode HTML tags of
2706
+ * @env Client | Server
2707
+ * @param {string} pText - text to encode HTML tags of
2708
+ * @returns {string} returns a new text with HTML tags encoded; '<' becomes '&amp;lt;', '>' becomes '&amp;gt;', '/' becomes '&amp;#47;'
2709
+ */
2710
+ encodeWebTags(pText: string): string
2711
+
2712
+ /**
2713
+ * returns new text that has been decoded
2714
+ * @env Client | Server
2715
+ * @param {string} pText - text to decode
2716
+ * @returns {string} returns new text that has been decoded
2717
+ */
2718
+ decodeURI(pText: string): string
2719
+
2720
+ /**
2721
+ * converts pDeg into radians and returns the number
2722
+ * @env Client | Server
2723
+ * @param {unknown} pDeg - degrees to convert
2724
+ * @returns {number} returns the number
2725
+ */
2726
+ toRadians(pDeg: unknown): number
2727
+
2728
+ /**
2729
+ * returns true if value is an array; returns false if value is not an array
2730
+ * @env Client | Server
2731
+ * @param {boolean} pVal - value to check for array
2732
+ * @returns {boolean} returns true if value is an array; returns false if value is not an array
2733
+ */
2734
+ isArray(pVal: boolean): boolean
2735
+
2736
+ /**
2737
+ * returns an array containing the values of pO
2738
+ * @env Client | Server
2739
+ * @param {object} pO - object to get values from
2740
+ * @returns {unknown[]} returns an array containing the values of pO
2741
+ */
2742
+ getObjectValues(pO: object): unknown[]
2743
+
2744
+ /**
2745
+ * copies all variables from pC and gives them to pO; warning: trying to copy an object that has recursive references will reach a stack limit and throw an error
2746
+ * @env Client | Server
2747
+ * @param {object} pO - object to set variables of
2748
+ * @param {object} pC - object to copy variables from
2749
+ * @param {boolean} [pD] - optional; set this if copying from a Vylocity Object or an object that references another Vylocity Object
2750
+ */
2751
+ copyObject(pO: object, pC: object, pD?: boolean): void
2752
+
2753
+ /**
2754
+ * returns new text that has been encoded to make it a valid URI
2755
+ * @env Client | Server
2756
+ * @param {string} pText - text to encode
2757
+ * @returns {string} returns new text that has been encoded to make it a valid URI
2758
+ */
2759
+ encodeURI(pText: string): string
2760
+
2761
+ /**
2762
+ * returns a randomly picked item from pVal1 (if an array and pVal2 is not set) or all the arguments provided
2763
+ * @env Client | Server
2764
+ * @param {unknown[]} pValn - first value to pick from or an array to pick from
2765
+ * @returns {unknown} returns a randomly picked item from pVal1 (if an array and pVal2 is not set) or all the arguments provided
2766
+ */
2767
+ pick(pValn: unknown[]): unknown
2768
+
2769
+ /**
2770
+ * returns pVal converted to a whole number
2771
+ * @env Client | Server
2772
+ * @param {boolean} pVal - value to get number from
2773
+ * @param {number} pRadix - number between 2 and 36 to use as the base for the supplied number; 10 for normal base (0-9), 16 for hex (0-F)
2774
+ * @returns {number} returns pVal converted to a whole number
2775
+ */
2776
+ parseInt(pVal: boolean, pRadix: number): number
2777
+
2778
+ /**
2779
+ * returns a regular expression pattern from the pPattern string using the pFlags flag
2780
+ * @env Client | Server
2781
+ * @param {unknown} pPattern - regular expression (regex) pattern string
2782
+ * @param {unknown} [pFlags] - optional; 'g' = global match; 'i' = ignore case; 'm' = multiline, treat start and end characters (^ and $) as working over multiple lines;
2783
+ * @returns {RegExp} returns a regular expression pattern from the pPattern string using the pFlags flag
2784
+ */
2785
+ regExp(pPattern: unknown, pFlags?: unknown): RegExp
2786
+
2787
+ /**
2788
+ * returns char or string associated with the code pCode
2789
+ * @env Client | Server
2790
+ * @param {unknown} pCode - code to get character of; can use multiple codes separated by commas which returns the codes as a string
2791
+ * @returns {string} returns the codes as a string<br />
2792
+ called: returns char or string associated with the code pCode
2793
+ */
2794
+ getCharFromCode(pCode: unknown): string
2795
+
2796
+ /**
2797
+ * returns true if value is a number; returns false if value is not a number
2798
+ * @env Client | Server
2799
+ * @param {boolean} pVal - value to check for number
2800
+ * @returns {boolean} returns true if value is a number; returns false if value is not a number
2801
+ */
2802
+ isNumber(pVal: boolean): boolean
2803
+
2804
+ /**
2805
+ * returns new style as text after being processed by the engine, translating vyi: and vyf: tags and so on
2806
+ * @env Client | Server
2807
+ * @param {string} pStyle - string containing web styles
2808
+ * @returns {void} returns new style as text after being processed by the engine, translating vyi: and vyf: tags and so on
2809
+ */
2810
+ getWebStyle(pStyle: string): void
2811
+
2812
+ /**
2813
+ * returns true if value is a function; returns false if value is not a function
2814
+ * @env Client | Server
2815
+ * @param {boolean} pVal - value to check for function
2816
+ * @returns {boolean} returns true if value is a function; returns false if value is not a function
2817
+ */
2818
+ isFunction(pVal: boolean): boolean
2819
+
2820
+ /**
2821
+ * returns an array containing the values all of key names (variable names) of pO
2822
+ * @env Client | Server
2823
+ * @param {object} pO - object to get key names from
2824
+ * @returns {string[]} returns an array containing the values all of key names (variable names) of pO
2825
+ */
2826
+ getObjectKeys(pO: object): string[]
2827
+
2828
+ /**
2829
+ * converts an ArrayBuffer to a base64 string
2830
+ * @env Client | Server
2831
+ * @param {unknown} pArrBuff - ArrayBuffer to convert to base64
2832
+ */
2833
+ arrayBufferToBase64(pArrBuff: unknown): void
2834
+
2835
+ /**
2836
+ * returns pVal converted to a string value
2837
+ * @env Client | Server
2838
+ * @param {boolean} pVal - value to get string from
2839
+ * @returns {string} returns pVal converted to a string value
2840
+ */
2841
+ toString(pVal: boolean): string
2842
+
2843
+ /**
2844
+ * returns new text that has been decoded
2845
+ * @env Client | Server
2846
+ * @param {string} pText - text to decode
2847
+ * @returns {string} returns new text that has been decoded
2848
+ */
2849
+ decodeURIComponent(pText: string): string
2850
+
2851
+ /**
2852
+ * gets all the variables that can be saved and returns a new object that contains those values which can then be saved (no internal engine variables, no functions, no references to Vylocity Objects)
2853
+ * @env Client | Server
2854
+ * @param {object} pS - object to get saveable values from
2855
+ * @param {object} [pO] - optional; alter this object and return it as the return object
2856
+ * @returns {object} returns a new object that contains those values which can then be saved (no internal engine variables, no functions, no references to Vylocity Objects)
2857
+ */
2858
+ getSaveObject(pS: object, pO?: object): object
2859
+
2860
+ }
2861
+
2862
+
2863
+
2864
+ /**The event object.*/
2865
+ type Event = {
2866
+
2867
+ /**
2868
+ * remove pO to the ticker
2869
+ * @env Client | Server
2870
+ * @param {unknown} pO - reference to the object
2871
+ */
2872
+ removeTicker(pO: unknown): void
2873
+
2874
+ /**
2875
+ * add pO to the ticker
2876
+ * @env Client | Server
2877
+ * @param {unknown} pO - reference to the object
2878
+ * @param {object} [pS] - optional; an object containing settings for this object's ticker
2879
+ */
2880
+ addTicker(pO: unknown, pS?: object): void
2881
+
2882
+ /**
2883
+ * forces a thread to stop doing its executions
2884
+ * @env Client | Server
2885
+ * @param {boolean} pVal - variable linking to the thread to be interrupted
2886
+ */
2887
+ interruptThread(pVal: boolean): void
2888
+
2889
+ /**
2890
+ * returns an array of all active objects with tickers running
2891
+ * @env Client | Server
2892
+ * @returns {Diob[] | Object[]} returns an array of all active objects with tickers running
2893
+ */
2894
+ getTickers(): Diob[] | Object[]
2895
+
2896
+ /**
2897
+ * prevents a specific spawn from occuring
2898
+ * @env Client | Server
2899
+ * @param {boolean} pVal - variable linking to the spawn to be interrupted
2900
+ */
2901
+ interruptSpawn(pVal: boolean): void
2902
+
2903
+ /**
2904
+ * pauses or resumes all tickers
2905
+ * @env Client | Server
2906
+ * @param {boolean} [pBool] - optional; true or false
2907
+ */
2908
+ toggleTicker(pBool?: boolean): void
2909
+
2910
+ }
2911
+
2912
+
2913
+
2914
+ /**The file object.*/
2915
+ type File = {
2916
+
2917
+ /**
2918
+ * checks if pFile exists
2919
+ * @env Server
2920
+ * @param {string} pFile - path to the file or directory to check
2921
+ * @param {Function} pFunc - function to call after pPath has been checked; first argument pExists determines if pPath exists or not
2922
+ */
2923
+ exists(pFile: string, pFunc: Function): void
2924
+
2925
+ /**
2926
+ * returns an object containing stat information for the file at pPath and calls pFunc with the first argument being the stat object and the second being an error (if any)
2927
+ * @env Server
2928
+ * @param {string} pPath - path to the file to get stats for
2929
+ * @param {Function} pFunc - function to call after
2930
+ * @returns {object} returns an object containing stat information for the file at pPath and calls pFunc with the first argument being the stat object and the second being an error (if any)
2931
+ */
2932
+ getStats(pPath: string, pFunc: Function): object
2933
+
2934
+ /**
2935
+ * reads the data and returns the data in pFunc
2936
+ * @env Server
2937
+ * @param {string} pFile - path to the file
2938
+ * @param {Function} pFunc - function to call after reading is complete; first argument pData is set to the data read; second arg pErr is set if an error has occured
2939
+ * @returns {void} returns the data in pFunc
2940
+ */
2941
+ readText(pFile: string, pFunc: Function): void
2942
+
2943
+ /**
2944
+ * creates pFile if it does not exist and then saves the pSave object to the file; overwrites existing data
2945
+ * @env Server
2946
+ * @param {string} pFile - path to the file
2947
+ * @param {object} pSave - object to save to the file for example ( {'value1': 1, 'value2': 2} )
2948
+ * @param {Function} pFunc - function to call after writing is complete; first argument pErr is set if an error has occured
2949
+ */
2950
+ writeSave(pFile: string, pSave: object, pFunc: Function): void
2951
+
2952
+ /**
2953
+ * creates pFile if needed and then add pData to the end of the file
2954
+ * @env Server
2955
+ * @param {string} pFile - path to the file
2956
+ * @param {unknown} pData - text to add to the end of pFile
2957
+ * @param {Function} pFunc - function to call after appending is complete; first argument pErr is set if an error has occured
2958
+ */
2959
+ appendText(pFile: string, pData: unknown, pFunc: Function): void
2960
+
2961
+ /**
2962
+ * provides an array of files in pPath directory
2963
+ * @env Server
2964
+ * @param {string} pPath - path to the directory
2965
+ * @param {Function} pFunc - function to call after the directory has been read; first argument pFiles is an array of the files in the directory, second argument pErr is an error if there is one
2966
+ */
2967
+ readDir(pPath: string, pFunc: Function): void
2968
+
2969
+ /**
2970
+ * deletes the file or directory at pPath; all child files are also deleted
2971
+ * @env Server
2972
+ * @param {string} pPath - path to the file or directory to delete
2973
+ * @param {Function} pFunc - function to call after pPath has been removed
2974
+ */
2975
+ remove(pPath: string, pFunc: Function): void
2976
+
2977
+ /**
2978
+ * provides a stat object which contains information on the file; you can use isFile() and isDirectory() on the object to check if they are files or directories
2979
+ * @env Server
2980
+ * @param {string} pPath - path to the file or directory
2981
+ * @param {Function} pFunc - function to call after pPath has been checked; first argument pStat is an object containing stat information for the file, second argument pErr is an error if there is one
2982
+ */
2983
+ stat(pPath: string, pFunc: Function): void
2984
+
2985
+ /**
2986
+ * creates a new directory at the location of pPath
2987
+ * @env Server
2988
+ * @param {string} pPath - path to create the new directory
2989
+ * @param {Function} pFunc - function to call after the directory has been made
2990
+ */
2991
+ makeDir(pPath: string, pFunc: Function): void
2992
+
2993
+ /**
2994
+ * returns an array of file names inside the pPath dir and calls pFunc with the first argument being the array and the second being an error (if any)
2995
+ * @env Server
2996
+ * @param {string} pPath - path to the directory to get contents of
2997
+ * @param {Function} pFunc - function to call after
2998
+ * @returns {string[]} returns an array of file names inside the pPath dir and calls pFunc with the first argument being the array and the second being an error (if any)
2999
+ */
3000
+ getDir(pPath: string, pFunc: Function): string[]
3001
+
3002
+ /**
3003
+ * reads pFile and returns an object from the data in pFunc
3004
+ * @env Server
3005
+ * @param {string} pFile - path to the file
3006
+ * @param {Function} pFunc - function to call after reading is complete; first argument pData is set to the data read; second arg pErr is set if an error has occured
3007
+ * @returns {object} returns an object from the data in pFunc
3008
+ */
3009
+ readSave(pFile: string, pFunc: Function): object
3010
+
3011
+ /**
3012
+ * creates pFile if needed and then writes pData to the file; overwrites existing data
3013
+ * @env Server
3014
+ * @param {string} pFile - path to the file
3015
+ * @param {unknown} pData - text to put into the file
3016
+ * @param {Function} pFunc - function to call after writing is complete; first argument pErr is set if an error occurs
3017
+ */
3018
+ writeText(pFile: string, pData: unknown, pFunc: Function): void
3019
+
3020
+ }
3021
+
3022
+
3023
+
3024
+ /**The icon object.*/
3025
+ type Icon = {
3026
+
3027
+ /**
3028
+ * creates a new blank icon named pIcon inside of the atlas pAtlas
3029
+ * @env Client | Server
3030
+ * @param {string} pAtlas - name of the icon atlas to add the icon to
3031
+ * @param {string} pIcon - name of the new icon
3032
+ * @param {number} [pWidth] - optional; width of the new icon; uses tileWidth if not defined
3033
+ * @param {number} [pHeight] - optional; height of the new icon; uses tileHeight if not defined
3034
+ */
3035
+ newIcon(pAtlas: string, pIcon: string, pWidth?: number, pHeight?: number): void
3036
+
3037
+ /**
3038
+ * alters color of the specified icon(s) based on the specified info; For example {'type': 'normal', 'red': 100} or just {'red': 100} would add 100 red to all pixels; {'red': -100} would reduce 100 red from all pixels; {'type': 'swap', 'red': 100, 'blue': 100, 'green': 100, 'newRed': 200} would find all pixels with the color rgb(100, 100, 100) and replace it with rgb(200, 100, 100); If any of the colors are not included, such as 'alpha', it will ignore that color, otherwise if it is set, it will take that color into account; {'type': 'multiply', 'hex': '#FFF'} would multiply blend white onto the icon, you can use 'hex' for the red, green, and blue values; for 'swap' you can use 'colors' which should equal an array of objects containing all of the color swaps you want to do if there is more than one
3039
+ * @env Client | Server
3040
+ * @param {object} pInfo - an object containing information to be used for the color alteration
3041
+ * @param {string} pAtlas - name of the icon atlas involved
3042
+ * @param {string} pIcon - name of the icon involved
3043
+ * @param {string} [pState] - optional; name of the icon state involved
3044
+ * @param {number} [pFrame] - optional; number of the frame involved
3045
+ * @param {Function} [pFunc] - optional; function to call after the icon has changed; passes an error as the first argument if there was en error
3046
+ */
3047
+ alterColor(pInfo: object, pAtlas: string, pIcon: string, pState?: string, pFrame?: number, pFunc?: Function): void
3048
+
3049
+ /**
3050
+ * returns object containing the width and height of the icon; ex {'width': 100, 'height': 100}
3051
+ * @env Client | Server
3052
+ * @param {string} pAtlas - name of the icon atlas
3053
+ * @param {string} pIcon - name of the icon
3054
+ * @param {string} [pState] - optional; name of the state
3055
+ * @param {number} [pFrame] - optional; number of the frame
3056
+ * @returns {object} returns object containing the width and height of the icon; ex {'width': 100, 'height': 100}
3057
+ */
3058
+ getIconSize(pAtlas: string, pIcon: string, pState?: string, pFrame?: number): object
3059
+
3060
+ /**
3061
+ * returns a string containing the base64 data url for the icon which can then be used to display the icon as an image in HTML
3062
+ * @env Client | Server
3063
+ * @param {string} pAtlas - name of the icon atlas
3064
+ * @param {string} pIcon - name of the icon
3065
+ * @param {string} [pState] - optional; name of the state
3066
+ * @param {number} [pFrame] - optional; number of the frame
3067
+ * @returns {string} returns a string containing the base64 data url for the icon which can then be used to display the icon as an image in HTML
3068
+ */
3069
+ getDataURL(pAtlas: string, pIcon: string, pState?: string, pFrame?: number): string
3070
+
3071
+ /**
3072
+ * grabs an object with the width and height of the icon and an array of pixel data for the entire icon. The array of pixel data can then be changed and used elsewhere or drawn onto another icon. To read the width and height you could use object.width and object.height, where object is the object returned by the function. The object data array is as follows: object.data[0] is the red value (0-255) of the pixel at 0,0, object.data[1] is the green value (0-255) of the pixel at 0,0, object.data[2] is the blue value (0-255) of the pixel at 0,0, and object.data[3] is the alpha value (0-255) of the pixel at 0,0. Then object.data[4], object.data[5], object.data[6], and object.data[7] are the respective values for the pixel at 1,0. This trend continues through the whole array for every pixel.
3073
+ * @env Client | Server
3074
+ * @param {string} pAtlas - name of the icon atlas involved
3075
+ * @param {string} pIcon - name of the icon involved
3076
+ * @param {string} [pState] - optional; name of the icon state involved
3077
+ * @param {number} [pFrame] - optional; number of the frame involved
3078
+ */
3079
+ getRawData(pAtlas: string, pIcon: string, pState?: string, pFrame?: number): ArrayBuffer
3080
+
3081
+ /**
3082
+ * change frame pFrame delay to pDelay
3083
+ * @env Client | Server
3084
+ * @param {string} pAtlas - name of the icon atlas to add the frame to
3085
+ * @param {string} pIcon - name of the icon involved
3086
+ * @param {string} pState - name of the icon state involved
3087
+ * @param {number} pFrame - frame number
3088
+ * @param {number} pDelay - delay number
3089
+ */
3090
+ setFrameDelay(pAtlas: string, pIcon: string, pState: string, pFrame: number, pDelay: number): void
3091
+
3092
+ /**
3093
+ * get delay of pFrame
3094
+ * @env Client | Server
3095
+ * @param {string} pAtlas - name of the icon atlas to add the frame to
3096
+ * @param {string} pIcon - name of the icon involved
3097
+ * @param {string} pState - name of the icon state involved
3098
+ * @param {number} pFrame - frame number
3099
+ */
3100
+ getFrameDelay(pAtlas: string, pIcon: string, pState: string, pFrame: number): void
3101
+
3102
+ /**
3103
+ * loads all the images for each specified icon; icon images are loaded when an icon or state is shown to a client, if you plan on altering an icon that the client hasn't seen yet, you'll want to use this function to cache it first
3104
+ * @env Client | Server
3105
+ * @param {string} pAtlas - name of the icon atlas
3106
+ * @param {string} [pIcon] - optional; name of the icon
3107
+ * @param {Function} [pFunc] - optional; function called after the images have been loaded and cached
3108
+ */
3109
+ cacheImage(pAtlas: string, pIcon?: string, pFunc?: Function): void
3110
+
3111
+ /**
3112
+ * returns an array of strings containing the names of all the icons in pAtlas
3113
+ * @env Client | Server
3114
+ * @param {string} pAtlas - name of the icon atlas
3115
+ * @returns {string[]} returns an array of strings containing the names of all the icons in pAtlas
3116
+ */
3117
+ getIconNames(pAtlas: string): string[]
3118
+
3119
+ /**
3120
+ * returns number of frames the icon has
3121
+ * @env Client | Server
3122
+ * @param {string} pAtlas - name of the icon atlas to add the frame to
3123
+ * @param {string} pIcon - name of the icon involved
3124
+ * @param {string} pState - name of the icon state involved
3125
+ * @returns {number} returns number of frames the icon has
3126
+ */
3127
+ getFrameCount(pAtlas: string, pIcon: string, pState: string): number
3128
+
3129
+ /**
3130
+ * creates a new blank frame; if pState is defined the frame is added to the state, otherwise it is added to pIcon
3131
+ * @env Client | Server
3132
+ * @param {number} pDelay - number of milliseconds to give the frame delay; null for default, which is 100
3133
+ * @param {string} pAtlas - name of the icon atlas to add the frame to
3134
+ * @param {string} pIcon - name of the icon involved
3135
+ * @param {string} [pState] - optional; name of the icon state involved
3136
+ */
3137
+ newFrame(pDelay: number, pAtlas: string, pIcon: string, pState?: string): void
3138
+
3139
+ /**
3140
+ * creates a clone of an atlas, icon, icon state, or frame
3141
+ * @env Client | Server
3142
+ * @param {object} pArgs - an object containing the information for the clone; useable varables: 'atlas', 'newAtlas', 'icon', 'newIcon', 'state', 'newState', and 'frame'
3143
+ */
3144
+ clone(pArgs: object): void
3145
+
3146
+ /**
3147
+ * creates a new blank icon state named pState for pIcon in the atlas pAtlas
3148
+ * @env Client | Server
3149
+ * @param {string} pAtlas - name of the icon atlas to add the icon state to
3150
+ * @param {string} pIcon - name of the icon to add the icon state to
3151
+ * @param {string} pState - name of the new icon state
3152
+ */
3153
+ newIconState(pAtlas: string, pIcon: string, pState: string): void
3154
+
3155
+ /**
3156
+ * performs the specified draw function on the specified icon using the specified pArgs object; ex ( {'type': 'image', 'image': this, 'x': 1, 'y': 1} )
3157
+ * @env Client | Server
3158
+ * @param {object | object[]} pArgs - an object or array of objects which determines the settings of the draw
3159
+ * @param {string} pAtlas - type of draw
3160
+ * @param {string} pIcon - draw an image
3161
+ * @param {string} pState - either a path to an image or a diob (in which case the diob's icon will be used) or an object containing icon information (ex {'atlasName': 'test', 'iconName': 'a', 'iconState': 's', 'frame': 2} )
3162
+ * @param {number} pFrame - x position to draw the image
3163
+ * @param {Function} pFunc - y position to draw the image
3164
+ */
3165
+ draw(pArgs: object | object[], pAtlas: string, pIcon: string, pState: string, pFrame: number, pFunc: Function): void
3166
+
3167
+ /**
3168
+ * changes the icon to match the pixel data given with pData
3169
+ * @env Client | Server
3170
+ * @param {unknown} pData - pixel data object to use
3171
+ * @param {string} pAtlas - name of the icon atlas involved
3172
+ * @param {string} pIcon - name of the icon involved
3173
+ * @param {string} [pState] - optional; name of the icon state involved
3174
+ * @param {number} [pFrame] - optional; number of the frame involved
3175
+ * @param {Function} [pFunc] - optional; function to call after the icon data has changed and loaded
3176
+ */
3177
+ setRawData(pData: unknown, pAtlas: string, pIcon: string, pState?: string, pFrame?: number, pFunc?: Function): void
3178
+
3179
+ /**
3180
+ * returns an array of strings containing the names of all the icon states belonging to the icon pIcon in icon atlas pAtlas
3181
+ * @env Client | Server
3182
+ * @param {string} pAtlas - name of the icon atlas
3183
+ * @param {string} pIcon - name of the icon
3184
+ * @returns {string[]} returns an array of strings containing the names of all the icon states belonging to the icon pIcon in icon atlas pAtlas
3185
+ */
3186
+ getIconStateNames(pAtlas: string, pIcon: string): string[]
3187
+
3188
+ /**
3189
+ * create a new icon atlas with the name pAtlas
3190
+ * @env Client | Server
3191
+ */
3192
+ newAtlas(): void
3193
+
3194
+ /**
3195
+ * sets the image of the specified icon using the pData data URL
3196
+ * @env Client | Server
3197
+ * @param {unknown} pData - text containing data URL
3198
+ * @param {string} pAtlas - name of the icon atlas
3199
+ * @param {string} pIcon - name of the icon
3200
+ * @param {string} [pState] - optional; name of the state
3201
+ * @param {number} [pFrame] - optional; number of the frame
3202
+ * @param {Function} [pFunc] - optional; function to call after the icon has changed; passes an error as the first argument if there was en error
3203
+ */
3204
+ setDataURL(pData: unknown, pAtlas: string, pIcon: string, pState?: string, pFrame?: number, pFunc?: Function): void
3205
+
3206
+ /**
3207
+ * applies a filter to the icon(s) involved; possible filter types: 'grayscale', 'invert', 'darken', 'lighten'
3208
+ * @env Client | Server
3209
+ * @param {object} pFilter - an object containing needed information for filter; {'type': 'darken', 'value': 10} would darken the image by 10;
3210
+ * @param {string} pAtlas - name of the icon atlas involved
3211
+ * @param {string} pIcon - name of the icon involved
3212
+ * @param {string} [pState] - optional; name of the icon state involved
3213
+ * @param {number} [pFrame] - optional; number of the frame involved
3214
+ * @param {Function} [pFunc] - optional; function to call after the icon has changed; passes an error as the first argument if there was en error
3215
+ */
3216
+ applyFilter(pFilter: object, pAtlas: string, pIcon: string, pState?: string, pFrame?: number, pFunc?: Function): void
3217
+
3218
+ }
3219
+
3220
+
3221
+
3222
+ /**The map object.*/
3223
+ type Map = {
3224
+
3225
+ /**
3226
+ * returns number of tiles between pA and pB
3227
+ * @env Client | Server
3228
+ * @param {Diob | Object} pA - Diob reference or object containing location information; ex {'xCoord': 1, 'yCoord': 1, 'mapName': 'map'}
3229
+ * @param {Diob | Object} pB - Diob reference or object containing location information; ex {'xCoord': 1, 'yCoord': 1, 'mapName': 'map'}
3230
+ * @returns {number} returns number of tiles between pA and pB
3231
+ */
3232
+ getTileDist(pA: Diob | Object, pB: Diob | Object): number
3233
+
3234
+ /**
3235
+ * returns an array of diobs on the map pMap depending on the provided arguments; if pType is not set, all diobs on the map will be returned; if pType is set but pChild is not, diobs on the map with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs on the map will be returned
3236
+ * @env Client | Server
3237
+ * @param {string} pMap - name of the map to get diobs from
3238
+ * @param {string} [pType] - optional; string containing type path to return
3239
+ * @param {boolean} [pChild] - optional; boolean that determines if child types are included
3240
+ * @param {Diob[]} [pAdd] - optional; if set, tiles and regions on the map will also be returned
3241
+ * @returns {Diob[]} returns an array of diobs on the map pMap depending on the provided arguments; if pType is not set, all diobs on the map will be returned; if pType is set but pChild is not, diobs on the map with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs on the map will be returned
3242
+ */
3243
+ getDiobs(pMap: string, pType?: string, pChild?: boolean, pAdd?: Diob[]): Diob[]
3244
+
3245
+ /**
3246
+ * changes the sized of pMap to the width and height of pW and pH; reducing the size will delete diobs that are no longer within the map size
3247
+ * @env Client | Server
3248
+ * @param {string} pMap - name of the map to set the size of
3249
+ * @param {number} pW - width in tiles to give the map
3250
+ * @param {number} pH - height in tiles to give the map
3251
+ * @param {string} pTile - tile object type to use as the default tiles for newly created tiles
3252
+ */
3253
+ setMapSize(pMap: string, pW: number, pH: number, pTile: string): void
3254
+
3255
+ /**
3256
+ * returns an array containing all the non-tile diobs on the map within x and y tiles around the specified diob that are visible to the diob
3257
+ * @env Client | Server
3258
+ * @param {Diob | Object} pO - diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
3259
+ * @param {boolean} pOmit - either x distance or x and y distance
3260
+ * @returns {Diob[]} returns an array containing all the non-tile diobs on the map within x and y tiles around the specified diob that are visible to the diob
3261
+ */
3262
+ getTileRangeView(pO: Diob | Object, pOmit: boolean): Diob[]
3263
+
3264
+ /**
3265
+ * sets the Tile at pLoc to pT and returns the new tile
3266
+ * @env Client | Server
3267
+ * @param {Diob | Object} pLoc - either a Tile reference or an object containing location information; ex {'xCoord': 1, 'yCoord': 1, 'mapName': 'map'}
3268
+ * @param {string} pT - either a type string containing the type of a new Tile or a reference to a Tile that does not already have a location on the map
3269
+ * @returns {Diob} returns the new tile
3270
+ */
3271
+ setLoc(pLoc: Diob | Object, pT: string): Diob
3272
+
3273
+ /**
3274
+ * returns the tiles on pMap within the specified area; if no area is specified, all tiles will be returned
3275
+ * @env Client | Server
3276
+ * @param {string} pMap - name of the map to get tiles from
3277
+ * @param {number} [pX] - optional; starting x coordinate
3278
+ * @param {number} [pY] - optional; starting y coordinate
3279
+ * @param {number} [pW] - optional; number of tiles to get from the right of pX; negative numbers to get tiles from the left
3280
+ * @param {number} [pH] - optional; number of tiles to get from below pY; negative numbers to get tiles from above
3281
+ * @returns {Diob[]} returns the tiles on pMap within the specified area; if no area is specified, all tiles will be returned
3282
+ */
3283
+ getTiles(pMap: string, pX?: number, pY?: number, pW?: number, pH?: number): Diob[]
3284
+
3285
+ /**
3286
+ * returns an array of diobs on the map pMap that have the tag pTag
3287
+ * @env Client | Server
3288
+ * @param {string} pTag - string containing tag to look for
3289
+ * @param {string} [pMap] - optional; name of map to search
3290
+ * @returns {Diob[]} returns an array of diobs on the map pMap that have the tag pTag
3291
+ */
3292
+ getDiobsByTag(pTag: string, pMap?: string): Diob[]
3293
+
3294
+ /**
3295
+ * returns number of pixels between the center of pA and the center of pB; you can change the origin by passing custom objects and changing the width and height by double of the amount to offset
3296
+ * @env Client | Server
3297
+ * @param {Diob | Object} pA - Diob reference or object containing location and size information; ex {'xPos': 1, 'yPos': 1, 'mapName': 'map', 'width': 32, 'height': 32}
3298
+ * @param {Diob | Object} pB - Diob reference or object containing location and size information; ex {'xPos': 1, 'yPos': 1, 'mapName': 'map', 'width': 32, 'height': 32}
3299
+ * @param {boolean} [pEdge] - optional; if set, the edges of the diobs will be used instead of the center
3300
+ * @returns {number} returns number of pixels between the center of pA and the center of pB; you can change the origin by passing custom objects and changing the width and height by double of the amount to offset
3301
+ */
3302
+ getDist(pA: Diob | Object, pB: Diob | Object, pEdge?: boolean): number
3303
+
3304
+ /**
3305
+ * returns a the angle in radians between pA and pB
3306
+ * @env Client | Server
3307
+ * @param {Diob | Object} pA - first diob
3308
+ * @param {Diob | Object} pB - second diob
3309
+ * @param {boolean} pCenter - set to get angle from the centers
3310
+ * @returns {number} returns a the angle in radians between pA and pB
3311
+ */
3312
+ getAngle(pA: Diob | Object, pB: Diob | Object, pCenter: boolean): number
3313
+
3314
+ /**
3315
+ * returns an array containing all the non-tile diobs on the map within x and y positional units around the specified diob that are visible to the diob and that have the same type as pType or a parent type of pType if pChild is enabled
3316
+ * @env Client | Server
3317
+ * @param {Diob | Object} pO - diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
3318
+ * @param {string} pType - type or parent type of diobs to get
3319
+ * @param {boolean} pChild - true to include all child diobs; false to include only diobs with the exact type of pType
3320
+ * @param {boolean} pOmit - either x distance or x and y distance
3321
+ * @returns {Diob[]} returns an array containing all the non-tile diobs on the map within x and y positional units around the specified diob that are visible to the diob and that have the same type as pType or a parent type of pType if pChild is enabled
3322
+ */
3323
+ getRangeViewByType(pO: Diob | Object, pType: string, pChild: boolean, pOmit: boolean): Diob[]
3324
+
3325
+ /**
3326
+ * returns an array containing all the non-tile diobs on the map within x and y tiles around the specified diob that are able to see the diob and that have the same type as pType or a parent type of pType if pChild is enabled
3327
+ * @env Client | Server
3328
+ * @param {Diob | Object} pO - diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
3329
+ * @param {string} pType - type or parent type of diobs to get
3330
+ * @param {boolean} pChild - true to include all child diobs; false to include only diobs with the exact type of pType
3331
+ * @param {boolean} pOmit - either x distance or x and y distance
3332
+ * @returns {Diob[]} returns an array containing all the non-tile diobs on the map within x and y tiles around the specified diob that are able to see the diob and that have the same type as pType or a parent type of pType if pChild is enabled
3333
+ */
3334
+ getTileRangeViewersByType(pO: Diob | Object, pType: string, pChild: boolean, pOmit: boolean): Diob[]
3335
+
3336
+ /**
3337
+ * reference to a tile that exists in the void, this tile is used if a movable interacts with the edge of the map
3338
+ * @env Client | Server
3339
+ */
3340
+ void: Diob
3341
+
3342
+ /**
3343
+ * array containing all the direction strings; ['east', 'northeast', 'north', 'northwest', 'west', 'southwest', 'south', 'southeast']
3344
+ * @env Client | Server
3345
+ */
3346
+ dirs: ['east', 'northeast', 'north', 'northwest', 'west', 'southwest', 'south', 'southeast']
3347
+
3348
+ /**
3349
+ * returns an array containing all the tiles on the map within x and y pixels around the specified diob
3350
+ * @env Client | Server
3351
+ * @param {Diob | Object} pD - diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
3352
+ * @param {string} pType - either x distance or x and y distance
3353
+ * @param {boolean} pChild - if set, y distance
3354
+ * @param {boolean} pOmit - type or parent type of tiles to get
3355
+ * @returns {Diob[]} returns an array containing all the tiles on the map within x and y pixels around the specified diob
3356
+ */
3357
+ getTilesByRange(pD: Diob | Object, pType: string, pChild: boolean, pOmit: boolean): Diob[]
3358
+
3359
+ /**
3360
+ * returns a tile of a given location; if pVal1 and pVal2 are numbers and pVal3 is a string, it returns the tile at the coordinates pVal1, pVal2 on the map pVal3; if pVal1 is an object and not a tile, it returns the object's location; if pVal1 is a tile, it returns the tile back
3361
+ * @env Client | Server
3362
+ * @returns {Diob} returns a tile of a given location; if pVal1 and pVal2 are numbers and pVal3 is a string, it returns the tile at the coordinates pVal1, pVal2 on the map pVal3; if pVal1 is an object and not a tile, it returns the object's location; if pVal1 is a tile, it returns the tile back
3363
+ */
3364
+ getLoc(): Diob
3365
+
3366
+ /**
3367
+ * returns the Tile next to the location of pL based on the direction of pDir
3368
+ * @env Client | Server
3369
+ * @param {Diob | Object} pL - reference to Diob or location object; ex {'xCoord': 1, 'yCoord': 1, 'mapName': 'map'}
3370
+ * @param {string} pDir - string containing direction
3371
+ * @returns {Diob} returns the Tile next to the location of pL based on the direction of pDir
3372
+ */
3373
+ getLocByDir(pL: Diob | Object, pDir: string): Diob
3374
+
3375
+ /**
3376
+ * deletes the map and all diobs on it
3377
+ * @env Client | Server
3378
+ * @param {string | number} pName - name of the map to delete
3379
+ */
3380
+ deleteMap(pName: string | number): void
3381
+
3382
+ /**
3383
+ * returns the Tile by the position pX, pY on the map pMap
3384
+ * @env Client | Server
3385
+ * @param {number} pX - x position
3386
+ * @param {number} pY - y position
3387
+ * @param {string} pMap - map name
3388
+ * @returns {Diob} returns the Tile by the position pX, pY on the map pMap
3389
+ */
3390
+ getLocByPos(pX: number, pY: number, pMap: string): Diob
3391
+
3392
+ /**
3393
+ * returns an array of all map names of maps currently loaded
3394
+ * @env Client | Server
3395
+ * @returns {string[]} returns an array of all map names of maps currently loaded
3396
+ */
3397
+ getMaps(): string[]
3398
+
3399
+ /**
3400
+ * returns a string containing the direction from pA to pB from their origins
3401
+ * @env Client | Server
3402
+ * @param {Diob | Object} pA - first diob
3403
+ * @param {Diob | Object} pB - second diob
3404
+ * @param {boolean} pCenter - set to get dir from the centers
3405
+ * @param {boolean} pCard - if set, only cardinal directions will be returned (north, south, east, west)
3406
+ * @returns {string[]} returns a string containing the direction from pA to pB from their origins
3407
+ */
3408
+ getDir(pA: Diob | Object, pB: Diob | Object, pCenter: boolean, pCard: boolean): string[]
3409
+
3410
+ /**
3411
+ * returns an array of diobs in the Region pR on all loaded maps or on the map pMap if specified with a type of pType (if specified) or a child of pType if pChild is set
3412
+ * @env Client | Server
3413
+ * @param {string} pR - either a type string containing the type of Region or a reference to a Region
3414
+ * @param {string} pType - type or parent type of diobs to get
3415
+ * @param {boolean} pChild - true to include all child diobs; false to include only diobs with the exact type of pType
3416
+ * @param {string} [pMap] - optional; name of the map to check the Region of; if not set all loaded maps with the specified Region will be used
3417
+ * @returns {unknown[]} returns an array of diobs in the Region pR on all loaded maps or on the map pMap if specified with a type of pType (if specified) or a child of pType if pChild is set
3418
+ */
3419
+ getDiobsByRegion(pR: string, pType: string, pChild: boolean, pMap?: string): unknown[]
3420
+
3421
+ /**
3422
+ * returns an array containing all the non-tile diobs on the map within x and y tiles around the specified diob that are able to see the diob
3423
+ * @env Client | Server
3424
+ * @param {Diob | Object} pO - diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
3425
+ * @param {boolean} pOmit - either x distance or x and y distance
3426
+ * @returns {Diob[]} returns an array containing all the non-tile diobs on the map within x and y tiles around the specified diob that are able to see the diob
3427
+ */
3428
+ getTileRangeViewers(pO: Diob | Object, pOmit: boolean): Diob[]
3429
+
3430
+ /**
3431
+ * returns an array of diobs on the map pMap that overlap the specified position box depending on the provided arguments; if pType is not set, all diobs in the position box will be returned; if pType is set but pChild is not, diobs in the position box with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs on the map will be returned
3432
+ * @env Client | Server
3433
+ * @param {string} pMap - name of the map to get diobs from
3434
+ * @param {number} pX - starting x position
3435
+ * @param {number} pY - starting y position
3436
+ * @param {string} [pType] - optional; ending x position
3437
+ * @param {boolean} [pChild] - optional; ending y position
3438
+ * @param {string} [pAdd] - optional; string containing type path to return
3439
+ * @returns {unknown[]} returns an array of diobs on the map pMap that overlap the specified position box depending on the provided arguments; if pType is not set, all diobs in the position box will be returned; if pType is set but pChild is not, diobs in the position box with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all mobs on the map will be returned
3440
+ */
3441
+ getDiobsByPos(pMap: string, pX: number, pY: number, pType?: string, pChild?: boolean, pAdd?: string): unknown[]
3442
+
3443
+ /**
3444
+ * creates a new map which is a clone of a map file
3445
+ * @env Client | Server
3446
+ * @param {string} pMap - name of the map file to clone
3447
+ * @param {string | number} pName - name to give the new cloned map
3448
+ * @param {Function} [pFunc] - optional; function to call once the clone is finished
3449
+ */
3450
+ cloneMap(pMap: string, pName: string | number, pFunc?: Function): void
3451
+
3452
+ /**
3453
+ * returns an array containing all the non-tile diobs on the map within x and y positional units around the specified diob that are able to see the diob
3454
+ * @env Client | Server
3455
+ * @param {Diob | Object} pO - diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
3456
+ * @param {boolean} pOmit - either x distance or x and y distance
3457
+ * @returns {Diob[]} returns an array containing all the non-tile diobs on the map within x and y positional units around the specified diob that are able to see the diob
3458
+ */
3459
+ getRangeViewers(pO: Diob | Object, pOmit: boolean): Diob[]
3460
+
3461
+ /**
3462
+ * returns an array containing all the non-tile diobs on the map within x and y positional units around the specified diob
3463
+ * @env Client | Server
3464
+ * @param {Diob | Object} pO - diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
3465
+ * @param {boolean} pOmit - either x distance or x and y distance
3466
+ * @returns {Diob[]} returns an array containing all the non-tile diobs on the map within x and y positional units around the specified diob
3467
+ */
3468
+ getRange(pO: Diob | Object, pOmit: boolean): Diob[]
3469
+
3470
+ /**
3471
+ * returns an array containing all the non-tile diobs on the map within x and y positional units around the specified diob that have the same type as pType or a parent type of pType if pChild is enabled
3472
+ * @env Client | Server
3473
+ * @param {Diob | Object} pO - diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
3474
+ * @param {string} pType - type or parent type of diobs to get
3475
+ * @param {boolean} pChild - true to include all child diobs; false to include only diobs with the exact type of pType
3476
+ * @param {boolean} pOmit - either x distance or x and y distance
3477
+ * @returns {Diob[]} returns an array containing all the non-tile diobs on the map within x and y positional units around the specified diob that have the same type as pType or a parent type of pType if pChild is enabled
3478
+ */
3479
+ getRangeByType(pO: Diob | Object, pType: string, pChild: boolean, pOmit: boolean): Diob[]
3480
+
3481
+ /**
3482
+ * returns an array containing all the non-tile diobs on the map within x and y tiles around the specified diob that have the same type as pType or a parent type of pType if pChild is enabled
3483
+ * @env Client | Server
3484
+ * @param {Diob | Object} pO - diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
3485
+ * @param {string} pType - type or parent type of diobs to get
3486
+ * @param {boolean} pChild - true to include all child diobs; false to include only diobs with the exact type of pType
3487
+ * @param {boolean} pOmit - either x distance or x and y distance
3488
+ * @returns {Diob[]} returns an array containing all the non-tile diobs on the map within x and y tiles around the specified diob that have the same type as pType or a parent type of pType if pChild is enabled
3489
+ */
3490
+ getTileRangeByType(pO: Diob | Object, pType: string, pChild: boolean, pOmit: boolean): Diob[]
3491
+
3492
+ /**
3493
+ * returns an array containing all the non-tile diobs on the map within x and y positional units around the specified diob that are able to see the diob and that have the same type as pType or a parent type of pType if pChild is enabled
3494
+ * @env Client | Server
3495
+ * @param {Diob | Object} pO - diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
3496
+ * @param {string} pType - type or parent type of diobs to get
3497
+ * @param {boolean} pChild - true to include all child diobs; false to include only diobs with the exact type of pType
3498
+ * @param {boolean} pOmit - either x distance or x and y distance
3499
+ * @returns {Diob[]} returns an array containing all the non-tile diobs on the map within x and y positional units around the specified diob that are able to see the diob and that have the same type as pType or a parent type of pType if pChild is enabled
3500
+ */
3501
+ getRangeViewersByType(pO: Diob | Object, pType: string, pChild: boolean, pOmit: boolean): Diob[]
3502
+
3503
+ /**
3504
+ * returns an array active clients that have player mobs on the map pMap
3505
+ * @env Client | Server
3506
+ * @param {string} pMap - name of the map to get clients from
3507
+ * @returns {Client[]} returns an array active clients that have player mobs on the map pMap
3508
+ */
3509
+ getClients(pMap: string): Client[]
3510
+
3511
+ /**
3512
+ * returns the region based on the type pType
3513
+ * @env Client | Server
3514
+ * @param {string} pType - type of the region to grab
3515
+ * @returns {Diob} returns the region based on the type pType
3516
+ */
3517
+ getRegionByType(pType: string): Diob
3518
+
3519
+ /**
3520
+ * returns an array containing all the non-tile diobs on the map within x and y tiles around the specified diob that are visible by the diob and that have the same type as pType or a parent type of pType if pChild is enabled
3521
+ * @env Client | Server
3522
+ * @param {Diob | Object} pO - diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
3523
+ * @param {string} pType - type or parent type of diobs to get
3524
+ * @param {boolean} pChild - true to include all child diobs; false to include only diobs with the exact type of pType
3525
+ * @param {boolean} pOmit - either x distance or x and y distance
3526
+ * @returns {Diob[]} returns an array containing all the non-tile diobs on the map within x and y tiles around the specified diob that are visible by the diob and that have the same type as pType or a parent type of pType if pChild is enabled
3527
+ */
3528
+ getTileRangeViewByType(pO: Diob | Object, pType: string, pChild: boolean, pOmit: boolean): Diob[]
3529
+
3530
+ /**
3531
+ * sets the Region at pLoc to pR and returns the Region
3532
+ * @env Client | Server
3533
+ * @param {Diob | Object} pLoc - either a Tile reference or an object containing location information; ex {'xCoord': 1, 'yCoord': 1, 'mapName': 'map'}
3534
+ * @param {string} pR - either a type string containing the type of a new Region or a reference to a Region
3535
+ * @returns {Diob} returns the Region
3536
+ */
3537
+ setRegion(pLoc: Diob | Object, pR: string): Diob
3538
+
3539
+ /**
3540
+ * returns an array of diobs on the map and screen depending on the provided arguments; if pType is not set, all map diobs on the screen will be returned; if pType is set but pChild is not, map diobs on the screen with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all map mobs on the screen will be returned
3541
+ * @env Client
3542
+ * @param {string} [pType] - optional; string containing type path to return
3543
+ * @param {boolean} [pChild] - optional; boolean that determines if child types are included
3544
+ * @param {Diob[]} [pAdd] - optional; if set, tiles and regions on the screen will also be returned
3545
+ * @returns {Diob[]} returns an array of diobs on the map and screen depending on the provided arguments; if pType is not set, all map diobs on the screen will be returned; if pType is set but pChild is not, map diobs on the screen with the exact type of pType will be returned; if pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned; for example, if pType is set to 'Mob' with pChild undefined, all diobs with the exact type of 'Mob' will be returned, but if pChild is set, then all map mobs on the screen will be returned
3546
+ */
3547
+ getScreenDiobs(pType?: string, pChild?: boolean, pAdd?: Diob[]): Diob[]
3548
+
3549
+ /**
3550
+ * returns the direction string if pD.dir was rotated by pAngle radians; set pD to {'dir': 'east'} to find the raw direction from a raw angle, defaults to east if nothing passed in
3551
+ * @env Client | Server
3552
+ * @param {Diob} [pD] - optional; reference to diob or direction object; ex {'dir': 'east'}
3553
+ * @param {number} [pAngle] - optional; angle in radians
3554
+ * @returns {string} returns the direction string if pD.dir was rotated by pAngle radians; set pD to {'dir': 'east'} to find the raw direction from a raw angle, defaults to east if nothing passed in
3555
+ */
3556
+ getDirByAngle(pD?: Diob, pAngle?: number): string
3557
+
3558
+ /**
3559
+ * creates a new map with the name pName and a size of pX, pY
3560
+ * @env Client | Server
3561
+ * @param {string | number} pName - unique name of the map
3562
+ * @param {number} pX - amount of tiles on the x-axis
3563
+ * @param {number} pY - amount of tiles on the y-axis
3564
+ * @param {string} pTile - tile object type to use as the default tiles
3565
+ */
3566
+ createMap(pName: string | number, pX: number, pY: number, pTile: string): void
3567
+
3568
+ /**
3569
+ * sends the data for the pD diob to all clients on the pMap map, if pVar is set it will send only those variables, if it is not set it will only send built-in engine variables
3570
+ * @env Server
3571
+ * @param {string} pMap - name of the map
3572
+ * @param {Diob} pD - reference to the diob to send
3573
+ * @param {unknown[]} [pVar] - optional; variable name or array of variable names
3574
+ */
3575
+ sendDiob(pMap: string, pD: Diob, pVar?: unknown[]): void
3576
+
3577
+ /**
3578
+ * returns an array containing all the non-tile diobs on the map within x and y positional units around the specified diob that are visible to the diob
3579
+ * @env Client | Server
3580
+ * @param {Diob | Object} pO - diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
3581
+ * @param {boolean} pOmit - either x distance or x and y distance
3582
+ * @returns {Diob[]} returns an array containing all the non-tile diobs on the map within x and y positional units around the specified diob that are visible to the diob
3583
+ */
3584
+ getRangeView(pO: Diob | Object, pOmit: boolean): Diob[]
3585
+
3586
+ /**
3587
+ * returns an array containing all the non-tile diobs on the map within x and y tiles around the specified diob
3588
+ * @env Client | Server
3589
+ * @param {Diob | Object} pO - diob or range object to get range from; range object example {'map': 'name', 'x': 1, 'y': 1}; using a range object will use the tile at the specified location for the reference diob
3590
+ * @param {boolean} pOmit - either x distance or x and y distance
3591
+ * @returns {Diob[]} returns an array containing all the non-tile diobs on the map within x and y tiles around the specified diob
3592
+ */
3593
+ getTileRange(pO: Diob | Object, pOmit: boolean): Diob[]
3594
+
3595
+ /**
3596
+ * returns an object {'x': x, 'y': y, 'xPos': xPos, 'yPos': yPos} containing the number of x and y tiles on the map and the physical size of the map
3597
+ * @env Client | Server
3598
+ * @param {string} pMap - name of the map to get the size of
3599
+ * @returns {{'x': number, 'y': number, 'xPos': number, 'yPos': number}} returns an object {'x': x, 'y': y, 'xPos': xPos, 'yPos': yPos} containing the number of x and y tiles on the map and the physical size of the map
3600
+ */
3601
+ getMapSize(pMap: string): {'x': number, 'y': number, 'xPos': number, 'yPos': number}
3602
+
3603
+ }
3604
+
3605
+
3606
+
3607
+ /**The macro object.*/
3608
+ type Macro = {
3609
+
3610
+ /**
3611
+ * creates a new blank macro atlas named pName
3612
+ * @env Client | Server
3613
+ * @param {string | number} pName - name of the new macro atlas
3614
+ */
3615
+ newMacroAtlas(pName: string | number): void
3616
+
3617
+ /**
3618
+ * creates a new macro with the keyUp command pUp, and keyDown command pDown, and the name pName and adds it to the macro atlas pAtlas
3619
+ * @env Client | Server
3620
+ * @param {string | number} pName - name of the macro to create
3621
+ * @param {string} pAtlas - name of the macro atlas to add the new macro to
3622
+ * @param {string} pKey - string of key that will execute this macro
3623
+ * @param {string} [pDown] - optional; string containing the command to execute when the key is pushed down; example 'test(1)' would execute the client command 'test' with one parameter that is equal to '1'
3624
+ * @param {string} [pUp] - optional; string containing the command to execute when the key is let go of; example 'test(1)' would execute the client command 'test' with one parameter that is equal to '1'
3625
+ */
3626
+ newMacro(pName: string | number, pAtlas: string, pKey: string, pDown?: string, pUp?: string): void
3627
+
3628
+ /**
3629
+ * returns an array containing the names of all the macros in the macro atlas pAtlas
3630
+ * @env Client | Server
3631
+ * @param {string} pAtlas - name of the macro atlas
3632
+ * @returns {string[]} returns an array containing the names of all the macros in the macro atlas pAtlas
3633
+ */
3634
+ getMacroNames(pAtlas: string): string[]
3635
+
3636
+ /**
3637
+ * returns an array containing the names of all the currently loaded macro atlases
3638
+ * @env Client | Server
3639
+ * @returns {string[]} returns an array containing the names of all the currently loaded macro atlases
3640
+ */
3641
+ getMacroAtlasNames(): string[]
3642
+
3643
+ /**
3644
+ * removes the macro pName from the macro atlas pAtlas
3645
+ * @env Client | Server
3646
+ * @param {string | number} pName - name of the macro to remove
3647
+ * @param {string} pAtlas - name of the macro atlas to remove the macro from
3648
+ */
3649
+ removeMacro(pName: string | number, pAtlas: string): void
3650
+
3651
+ }
3652
+
3653
+
3654
+
3655
+ /**The type object.*/
3656
+ type Type = {
3657
+
3658
+ /**
3659
+ * returns an object containing all the default variables belonging to the type pType
3660
+ * @env Client | Server
3661
+ * @param {string} pType - type to get variables of
3662
+ * @param {unknown} [pAll] - optional; if set every variable this type has will be returned, if false only variables belonging directly to this type will be returned
3663
+ * @returns {unknown[]} returns an object containing all the default variables belonging to the type pType
3664
+ */
3665
+ getVariables(pType: string, pAll?: unknown): unknown[]
3666
+
3667
+ /**
3668
+ * returns the default value of the pVar variable belonging to the type pType
3669
+ * @env Client | Server
3670
+ * @param {string} pType - type to get variable of
3671
+ * @param {unknown} pVar - name of the variable to get
3672
+ * @param {unknown} [pOwn] - optional; if set the returned value will be undefined if the variable belongs to an inherited object
3673
+ * @returns {unknown} returns the default value of the pVar variable belonging to the type pType
3674
+ */
3675
+ getVariable(pType: string, pVar: unknown, pOwn?: unknown): unknown
3676
+
3677
+ /**
3678
+ * sets the type pType's default variables specified within the pVars object; example {'a': 1, 'b': 2} would set this type's 'a' and 'b' variables respectively
3679
+ * @env Client | Server
3680
+ * @param {string} pType - type to set variables for
3681
+ * @param {object} pVars - object containing new variables and their values
3682
+ */
3683
+ setVariables(pType: string, pVars: object): void
3684
+
3685
+ /**
3686
+ * makes the type pType inherit from the type pInherit; this change only works for newly created objects, objects already in existence will not change
3687
+ * @env Client | Server
3688
+ * @param {string} pType - type to add inheritance to
3689
+ * @param {unknown} pInherit - type to inherit from
3690
+ */
3691
+ addInheritance(pType: string, pInherit: unknown): void
3692
+
3693
+ /**
3694
+ * creates a new type called pType
3695
+ * @env Client | Server
3696
+ * @param {string} pType - type to create
3697
+ */
3698
+ newType(pType: string): void
3699
+
3700
+ /**
3701
+ * returns the default value of the pName function belonging to the type pType
3702
+ * @env Client | Server
3703
+ * @param {string} pType - type to get function of
3704
+ * @param {string | number} pName - name of the function to get
3705
+ * @returns {Function} returns the default value of the pName function belonging to the type pType
3706
+ */
3707
+ getFunction(pType: string, pName: string | number): Function
3708
+
3709
+ /**
3710
+ * returns an array of the type pType custom inheritances
3711
+ * @env Client | Server
3712
+ * @param {string} pType - type to get inheritances of
3713
+ * @returns {string[]} returns an array of the type pType custom inheritances
3714
+ */
3715
+ getInheritances(pType: string): string[]
3716
+
3717
+ /**
3718
+ * sets the pVal value of the pVar static variable belonging to the type pType; static variables are variables that belong to all Objects of this type collectively and are different than normal variables, usually static variables can only be set once, but VyScript static variables may be changed if that is what the developer wants; these variables are not inherited by child types
3719
+ * @env Client | Server
3720
+ * @param {string} pType - type to set static variable of
3721
+ * @param {unknown} pVar - name of the static variable to set
3722
+ * @param {boolean} pVal - value to give to the static variable
3723
+ */
3724
+ setStaticVariable(pType: string, pVar: unknown, pVal: boolean): void
3725
+
3726
+ /**
3727
+ * sets the type pType's pName function to pFunc; this change only works for newly created objects, objects already in existence will not change
3728
+ * @env Client | Server
3729
+ * @param {string} pType - type to set function for
3730
+ * @param {string | number} pName - string containing the name of the function
3731
+ * @param {Function} pFunc - function
3732
+ */
3733
+ setFunction(pType: string, pName: string | number, pFunc: Function): void
3734
+
3735
+ /**
3736
+ * returns the static variable value belonging to the type pType
3737
+ * @env Client | Server
3738
+ * @param {string} pType - type to get static variable of
3739
+ * @param {unknown} pVar - name of the static variable to get
3740
+ * @returns {unknown} returns the static variable value belonging to the type pType
3741
+ */
3742
+ getStaticVariable(pType: string, pVar: unknown): unknown
3743
+
3744
+ /**
3745
+ * returns an array of all Object types in the game; if pParent is set, only child types of pParent are returned
3746
+ * @env Client | Server
3747
+ * @param {unknown} [pParent] - optional; parent type to start with
3748
+ * @param {boolean} [pOmit] - optional; if set will not return the included path, only the children
3749
+ * @returns {string[]} returns an array of all Object types in the game; if pParent is set, only child types of pParent are returned
3750
+ */
3751
+ getTypes(pParent?: unknown, pOmit?: boolean): string[]
3752
+
3753
+ /**
3754
+ * removes the inheritance pInherit from the type pType; this change only works for newly created objects, objects already in existence will not change
3755
+ * @env Client | Server
3756
+ * @param {string} pType - type to remove inheritance from
3757
+ * @param {unknown} pInherit - type of inheritance
3758
+ */
3759
+ removeInheritance(pType: string, pInherit: unknown): void
3760
+
3761
+ /**
3762
+ * calls the function pFunc attached to the type pType as if the function belonged to the object pDiob using the arguments pArgs
3763
+ * @env Client | Server
3764
+ * @param {string} pType - type to call function of
3765
+ * @param {Function} pFunc - name of function to call
3766
+ * @param {Diob} pDiob - array of arguments to pass in
3767
+ * @param {unknown[]} pArgs - calls the function pFunc attached to the type pType as if the function belonged to the object pDiob using the arguments pArgs
3768
+ */
3769
+ callFunction(pType: string, pFunc: Function, pDiob: Diob, pArgs: unknown[]): void
3770
+
3771
+ /**
3772
+ * checks to see if pType is a valid type that exists in the game; if pType2 is defined, checks if pType is pType2 or a child of pType2
3773
+ * @env Client | Server
3774
+ * @param {string} pType - type to check
3775
+ */
3776
+ isType(pType: string): boolean
3777
+
3778
+ }
3779
+
3780
+
3781
+ /**The vylo type*/
3782
+ type VyloType = {
3783
+
3784
+ /**The world object.*/
3785
+ World: World
3786
+ /**The client object.*/
3787
+ Client: Client
3788
+ /**The resource object.*/
3789
+ Resource: Resource
3790
+ /**The util object.*/
3791
+ Util: Util
3792
+ /**The event object.*/
3793
+ Event: Event
3794
+ /**The file object.*/
3795
+ File: File
3796
+ /**The icon object.*/
3797
+ Icon: Icon
3798
+ /**The map object.*/
3799
+ Map: Map
3800
+ /**The type object.*/
3801
+ Type: Type
3802
+
3803
+ /**
3804
+ * The global object referencing all global variables in VyScript.
3805
+ * @env Client | Server
3806
+ */
3807
+ global: { [key: string]: unknown };
3808
+
3809
+ /**
3810
+ * Loads the engine. When using loadResource before this is called, the resources will be treated as preloaded resources.
3811
+ * @env Client | Server
3812
+ * @returns {Promise<void>}
3813
+ */
3814
+ load: () => Promise<void>;
3815
+
3816
+ /**
3817
+ * Deletes the Diob referenced by pDiob.
3818
+ * @env Client | Server
3819
+ * @param {Diob} pDiob - A reference to the Diob to delete.
3820
+ * @param {...unknown[]} [pArgN - Optional parameters to pass as arguments into the Diob's onDel() event function.
3821
+ * @template T - The type of additional arguments.
3822
+ * @returns {void}
3823
+ */
3824
+ delDiob: <T = unknown>(pDiob: Diob, ...pArgN: T[]) => void;
3825
+
3826
+ /**
3827
+ * Creates a new Diob with the specified Object type of pType and returns it.
3828
+ * @env Client | Server
3829
+ * @param pType - A string containing the type path of the Object to be created as a Diob.
3830
+ * @param {...unknown[]} [pArgN] - optional; Parameters to pass as arguments into the Diob's onNew() event function.
3831
+ * @template T - The type of additional arguments.
3832
+ * @returns {Diob} - The newly created Diob.
3833
+ */
3834
+ newDiob: <T = unknown>(pType: string, ...pArgN: T[]) => Diob;
3835
+
3836
+ /**
3837
+ * Creates a new type called pType.
3838
+ * @env Client | Server
3839
+ * @param {string} pType - Type to alter /create.
3840
+ * @param {object} [pVars] - optional; object containing variables to give the type.
3841
+ * @param {string[]} [pInherits] - optional; array of type strings to inherit.
3842
+ * @returns {void}
3843
+ */
3844
+ setType: (pType: string, pVars: object, pInherits?: string[]) => void
3845
+
3846
+ }
3847
+ }
3848
+
3849
+
3850
+ export { VyloType, World, Diob, Movable, Particle, Tile, Region, Mob, Overlay, Sound, Interface, Client, Resource, Util, Icon, Macro, Type };