@defold-typescript/types 0.26.0 → 0.27.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 (70) hide show
  1. package/api-availability.json +307 -307
  2. package/api-signatures.json +1311 -0
  3. package/api-targets.json +342 -0
  4. package/examples/translations.json +1984 -0
  5. package/fixtures/messages_doc.json +880 -0
  6. package/generated/versions/defold-1.12.4/gui.d.ts +43 -43
  7. package/generated/versions/defold-1.12.4/liveupdate.d.ts +22 -22
  8. package/generated/versions/defold-1.12.4/physics.d.ts +78 -75
  9. package/generated/versions/defold-1.12.4/render.d.ts +75 -55
  10. package/generated/versions/defold-1.12.4/resource.d.ts +187 -175
  11. package/generated/versions/defold-1.13.0/b2d.d.ts +33 -0
  12. package/generated/versions/defold-1.13.0/b2d_body.d.ts +676 -0
  13. package/generated/versions/defold-1.13.0/b2d_chain.d.ts +106 -0
  14. package/generated/versions/defold-1.13.0/b2d_fixture.d.ts +155 -0
  15. package/generated/versions/defold-1.13.0/b2d_joint.d.ts +823 -0
  16. package/generated/versions/defold-1.13.0/b2d_shape.d.ts +215 -0
  17. package/generated/versions/defold-1.13.0/b2d_world.d.ts +314 -0
  18. package/generated/versions/defold-1.13.0/buffer.d.ts +176 -0
  19. package/generated/versions/defold-1.13.0/camera.d.ts +302 -0
  20. package/generated/versions/defold-1.13.0/collectionfactory.d.ts +146 -0
  21. package/generated/versions/defold-1.13.0/collectionproxy.d.ts +71 -0
  22. package/generated/versions/defold-1.13.0/compute.d.ts +306 -0
  23. package/generated/versions/defold-1.13.0/crash.d.ts +143 -0
  24. package/generated/versions/defold-1.13.0/editor-vm/http.d.ts +56 -0
  25. package/generated/versions/defold-1.13.0/editor-vm/json.d.ts +10 -0
  26. package/generated/versions/defold-1.13.0/editor-vm/localization.d.ts +42 -0
  27. package/generated/versions/defold-1.13.0/editor-vm/tilemap_tiles.d.ts +80 -0
  28. package/generated/versions/defold-1.13.0/editor-vm/zip.d.ts +10 -0
  29. package/generated/versions/defold-1.13.0/editor-vm/zlib.d.ts +24 -0
  30. package/generated/versions/defold-1.13.0/editor.d.ts +1092 -0
  31. package/generated/versions/defold-1.13.0/factory.d.ts +123 -0
  32. package/generated/versions/defold-1.13.0/font.d.ts +81 -0
  33. package/generated/versions/defold-1.13.0/go.d.ts +1054 -0
  34. package/generated/versions/defold-1.13.0/graphics.d.ts +321 -0
  35. package/generated/versions/defold-1.13.0/gui.d.ts +2370 -0
  36. package/generated/versions/defold-1.13.0/html5.d.ts +53 -0
  37. package/generated/versions/defold-1.13.0/http.d.ts +84 -0
  38. package/generated/versions/defold-1.13.0/iac.d.ts +18 -0
  39. package/generated/versions/defold-1.13.0/iap.d.ts +60 -0
  40. package/generated/versions/defold-1.13.0/image.d.ts +139 -0
  41. package/generated/versions/defold-1.13.0/index.d.ts +48 -0
  42. package/generated/versions/defold-1.13.0/json.d.ts +76 -0
  43. package/generated/versions/defold-1.13.0/kinds/editor-script.d.ts +13 -0
  44. package/generated/versions/defold-1.13.0/label.d.ts +94 -0
  45. package/generated/versions/defold-1.13.0/liveupdate.d.ts +140 -0
  46. package/generated/versions/defold-1.13.0/material.d.ts +444 -0
  47. package/generated/versions/defold-1.13.0/model.d.ts +246 -0
  48. package/generated/versions/defold-1.13.0/msg.d.ts +10 -0
  49. package/generated/versions/defold-1.13.0/particlefx.d.ts +166 -0
  50. package/generated/versions/defold-1.13.0/physics.d.ts +548 -0
  51. package/generated/versions/defold-1.13.0/profiler.d.ts +233 -0
  52. package/generated/versions/defold-1.13.0/push.d.ts +66 -0
  53. package/generated/versions/defold-1.13.0/render.d.ts +1185 -0
  54. package/generated/versions/defold-1.13.0/resource.d.ts +1530 -0
  55. package/generated/versions/defold-1.13.0/socket.d.ts +795 -0
  56. package/generated/versions/defold-1.13.0/sound.d.ts +291 -0
  57. package/generated/versions/defold-1.13.0/sprite.d.ts +157 -0
  58. package/generated/versions/defold-1.13.0/sys.d.ts +695 -0
  59. package/generated/versions/defold-1.13.0/tilemap.d.ts +195 -0
  60. package/generated/versions/defold-1.13.0/timer.d.ts +114 -0
  61. package/generated/versions/defold-1.13.0/types.d.ts +61 -0
  62. package/generated/versions/defold-1.13.0/vmath.d.ts +806 -0
  63. package/generated/versions/defold-1.13.0/webview.d.ts +68 -0
  64. package/generated/versions/defold-1.13.0/window.d.ts +198 -0
  65. package/generated/versions/defold-1.13.0/zlib.d.ts +40 -0
  66. package/index.d.ts +4 -84
  67. package/package.json +11 -3
  68. package/scripts/import-defold-release.ts +18 -1
  69. package/src/example-store.ts +5 -0
  70. package/scripts/lua-types-signature-index.ts +0 -151
@@ -0,0 +1,548 @@
1
+ /** @noSelfInFile */
2
+ import type { Hash, Url, Vector3 } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Collision object physics API documentation
7
+ */
8
+ namespace physics {
9
+ /**
10
+ * The following properties are available when connecting a joint of `JOINT_TYPE_FIXED` type:
11
+ */
12
+ const JOINT_TYPE_FIXED: number & { readonly __brand: "physics.JOINT_TYPE_FIXED" };
13
+ /**
14
+ * The following properties are available when connecting a joint of `JOINT_TYPE_HINGE` type:
15
+ */
16
+ const JOINT_TYPE_HINGE: number & { readonly __brand: "physics.JOINT_TYPE_HINGE" };
17
+ /**
18
+ * The following properties are available when connecting a joint of `JOINT_TYPE_SLIDER` type:
19
+ */
20
+ const JOINT_TYPE_SLIDER: number & { readonly __brand: "physics.JOINT_TYPE_SLIDER" };
21
+ /**
22
+ * The following properties are available when connecting a joint of `JOINT_TYPE_SPRING` type:
23
+ */
24
+ const JOINT_TYPE_SPRING: number & { readonly __brand: "physics.JOINT_TYPE_SPRING" };
25
+ /**
26
+ * The following properties are available when connecting a joint of `JOINT_TYPE_WELD` type:
27
+ */
28
+ const JOINT_TYPE_WELD: number & { readonly __brand: "physics.JOINT_TYPE_WELD" };
29
+ /**
30
+ * The following properties are available when connecting a joint of `JOINT_TYPE_WHEEL` type:
31
+ */
32
+ const JOINT_TYPE_WHEEL: number & { readonly __brand: "physics.JOINT_TYPE_WHEEL" };
33
+ const SHAPE_TYPE_BOX: number & { readonly __brand: "physics.SHAPE_TYPE_BOX" };
34
+ const SHAPE_TYPE_CAPSULE: number & { readonly __brand: "physics.SHAPE_TYPE_CAPSULE" };
35
+ const SHAPE_TYPE_HULL: number & { readonly __brand: "physics.SHAPE_TYPE_HULL" };
36
+ const SHAPE_TYPE_SPHERE: number & { readonly __brand: "physics.SHAPE_TYPE_SPHERE" };
37
+ /**
38
+ * Create a physics joint between two collision object components.
39
+ * Note: Currently only supported in 2D physics.
40
+ *
41
+ * @param joint_type - the joint type
42
+ * @param collisionobject_a - first collision object
43
+ * @param joint_id - id of the joint
44
+ * @param position_a - local position where to attach the joint on the first collision object
45
+ * @param collisionobject_b - second collision object
46
+ * @param position_b - local position where to attach the joint on the second collision object
47
+ * @param properties - optional joint specific properties table
48
+ * See each joint type for possible properties field. The one field that is accepted for all joint types is:
49
+ * - boolean `collide_connected`: Set this flag to true if the attached bodies should collide.
50
+ */
51
+ function create_joint(joint_type: number, collisionobject_a: string | Hash | Url, joint_id: string | Hash, position_a: Vector3, collisionobject_b: string | Hash | Url, position_b: Vector3, properties?: { collide_connected?: boolean }): void;
52
+ /**
53
+ * Destroy an already physics joint. The joint has to be created before a
54
+ * destroy can be issued.
55
+ * Note: Currently only supported in 2D physics.
56
+ *
57
+ * @param collisionobject - collision object where the joint exist
58
+ * @param joint_id - id of the joint
59
+ */
60
+ function destroy_joint(collisionobject: string | Hash | Url, joint_id: string | Hash): void;
61
+ /**
62
+ * Get the gravity in runtime. The gravity returned is not global, it will return
63
+ * the gravity for the collection that the function is called from.
64
+ * Note: For 2D physics the z component will always be zero.
65
+ *
66
+ * @returns gravity vector of collection
67
+ * @example
68
+ * ```ts
69
+ * export default defineScript({
70
+ * init(self) {
71
+ * let gravity = physics.get_gravity();
72
+ * // Inverse gravity!
73
+ * gravity = -gravity;
74
+ * physics.set_gravity(gravity);
75
+ * },
76
+ * });
77
+ * ```
78
+ */
79
+ function get_gravity(): Vector3;
80
+ /**
81
+ * Returns the group name of a collision object as a hash.
82
+ *
83
+ * @param url - the collision object to return the group of.
84
+ * @returns hash value of the group.
85
+ *
86
+ * `local function check_is_enemy()
87
+ * local group = physics.get_group("#collisionobject")
88
+ * return group == hash("enemy")
89
+ * end
90
+ * `
91
+ */
92
+ function get_group(url: string | Hash | Url): Hash;
93
+ /**
94
+ * Get a table for properties for a connected joint. The joint has to be created before
95
+ * properties can be retrieved.
96
+ * Note: Currently only supported in 2D physics.
97
+ *
98
+ * @param collisionobject - collision object where the joint exist
99
+ * @param joint_id - id of the joint
100
+ * @returns properties table. See the joint types for what fields are available, the only field available for all types is:
101
+ *
102
+ * - boolean `collide_connected`: Set this flag to true if the attached bodies should collide.
103
+ */
104
+ function get_joint_properties(collisionobject: string | Hash | Url, joint_id: string | Hash): { collide_connected: boolean };
105
+ /**
106
+ * Get the reaction force for a joint. The joint has to be created before
107
+ * the reaction force can be calculated.
108
+ * Note: Currently only supported in 2D physics.
109
+ *
110
+ * @param collisionobject - collision object where the joint exist
111
+ * @param joint_id - id of the joint
112
+ * @returns reaction force for the joint
113
+ */
114
+ function get_joint_reaction_force(collisionobject: string | Hash | Url, joint_id: string | Hash): Vector3;
115
+ /**
116
+ * Get the reaction torque for a joint. The joint has to be created before
117
+ * the reaction torque can be calculated.
118
+ * Note: Currently only supported in 2D physics.
119
+ *
120
+ * @param collisionobject - collision object where the joint exist
121
+ * @param joint_id - id of the joint
122
+ * @returns the reaction torque on bodyB in N*m.
123
+ */
124
+ function get_joint_reaction_torque(collisionobject: string | Hash | Url, joint_id: string | Hash): number;
125
+ /**
126
+ * Returns true if the specified group is set in the mask of a collision
127
+ * object, false otherwise.
128
+ *
129
+ * @param url - the collision object to check the mask of.
130
+ * @param group - the name of the group to check for.
131
+ * @returns boolean value of the maskbit. 'true' if present, 'false' otherwise.
132
+ *
133
+ * `local function is_invincible()
134
+ * -- check if the collisionobject would collide with the "bullet" group
135
+ * local invincible = physics.get_maskbit("#collisionobject", "bullet")
136
+ * return invincible
137
+ * end
138
+ * `
139
+ */
140
+ function get_maskbit(url: string | Hash | Url, group: string): boolean;
141
+ /**
142
+ * Gets collision shape data from a collision object
143
+ *
144
+ * @param url - the collision object.
145
+ * @param shape - the name of the shape to get data for.
146
+ * @returns A table containing meta data about the physics shape
147
+ *
148
+ * `type`
149
+ * number The shape type. Supported values:
150
+ *
151
+ * - `physics.SHAPE_TYPE_SPHERE`
152
+ *
153
+ * - `physics.SHAPE_TYPE_BOX`
154
+ *
155
+ * - `physics.SHAPE_TYPE_CAPSULE` *Only supported for 3D physics*
156
+ *
157
+ * - `physics.SHAPE_TYPE_HULL`
158
+ *
159
+ * The returned table contains different fields depending on which type the shape is.
160
+ * If the shape is a sphere:
161
+ *
162
+ * `diameter`
163
+ * number the diameter of the sphere shape
164
+ *
165
+ * If the shape is a box:
166
+ *
167
+ * `dimensions`
168
+ * vector3 a `vmath.vector3` of the box dimensions
169
+ *
170
+ * If the shape is a capsule:
171
+ *
172
+ * `diameter`
173
+ * number the diameter of the capsule poles
174
+ * `height`
175
+ * number the height of the capsule
176
+ *
177
+ * `local function get_shape_meta()
178
+ * local sphere = physics.get_shape("#collisionobject", "my_sphere_shape")
179
+ * -- returns a table with sphere.diameter
180
+ * return sphere
181
+ * end
182
+ * `
183
+ */
184
+ function get_shape(url: string | Hash | Url, shape: string | Hash): { type: number; diameter: number; dimensions: Vector3; diameter: number; height: number };
185
+ /**
186
+ * Ray casts are used to test for intersections against collision objects in the physics world.
187
+ * Collision objects of types kinematic, dynamic and static are tested against. Trigger objects
188
+ * do not intersect with ray casts.
189
+ * Which collision objects to hit is filtered by their collision groups and can be configured
190
+ * through `groups`.
191
+ * NOTE: Ray casts will ignore collision objects that contain the starting point of the ray. This is a limitation in Box2D.
192
+ *
193
+ * @param from - the world position of the start of the ray
194
+ * @param to - the world position of the end of the ray
195
+ * @param groups - a lua table containing the hashed groups for which to test collisions against
196
+ * @param options - a lua table containing options for the raycast.
197
+ *
198
+ * `all`
199
+ * boolean Set to `true` to return all ray cast hits. If `false`, it will only return the closest hit.
200
+ * @returns It returns a list. If missed it returns `nil`. See ray_cast_response for details on the returned values.
201
+ * @example
202
+ * ```ts
203
+ * // How to perform a ray cast synchronously:
204
+ * export default defineScript({
205
+ * init(self) {
206
+ * self.groups = [hash("world"), hash("enemy")];
207
+ * },
208
+ *
209
+ * update(self, dt) {
210
+ * // request ray cast
211
+ * const result = physics.raycast(from, to, self.groups, { all: true });
212
+ * if (result !== undefined) {
213
+ * // act on the hit (see 'ray_cast_response')
214
+ * for (const result of results) {
215
+ * handle_result(result);
216
+ * }
217
+ * }
218
+ * },
219
+ * });
220
+ * ```
221
+ */
222
+ function raycast(from: Vector3, to: Vector3, groups: Hash[], options?: { all?: boolean }): { fraction: number; position: Vector3; normal: Vector3; id: Hash; group: Hash; request_id: number }[] | undefined;
223
+ /**
224
+ * Ray casts are used to test for intersections against collision objects in the physics world.
225
+ * Collision objects of types kinematic, dynamic and static are tested against. Trigger objects
226
+ * do not intersect with ray casts.
227
+ * Which collision objects to hit is filtered by their collision groups and can be configured
228
+ * through `groups`.
229
+ * The actual ray cast will be performed during the physics-update.
230
+ *
231
+ * - If an object is hit, the result will be reported via a ray_cast_response message.
232
+ *
233
+ * - If there is no object hit, the result will be reported via a ray_cast_missed message.
234
+ *
235
+ * NOTE: Ray casts will ignore collision objects that contain the starting point of the ray. This is a limitation in Box2D.
236
+ *
237
+ * @param from - the world position of the start of the ray
238
+ * @param to - the world position of the end of the ray
239
+ * @param groups - a lua table containing the hashed groups for which to test collisions against
240
+ * @param request_id - a number in range [0,255]. It will be sent back in the response for identification, 0 by default
241
+ * @example
242
+ * ```ts
243
+ * // How to perform a ray cast asynchronously:
244
+ * export default defineScript({
245
+ * init(self) {
246
+ * self.my_groups = [hash("my_group1"), hash("my_group2")];
247
+ * },
248
+ *
249
+ * update(self, dt) {
250
+ * // request ray cast
251
+ * physics.raycast_async(my_start, my_end, self.my_groups);
252
+ * },
253
+ *
254
+ * on_message(self, message_id, message, sender) {
255
+ * // check for the response
256
+ * if (message_id === hash("ray_cast_response")) {
257
+ * // act on the hit
258
+ * } else if (message_id === hash("ray_cast_missed")) {
259
+ * // act on the miss
260
+ * }
261
+ * },
262
+ * });
263
+ * ```
264
+ */
265
+ function raycast_async(from: Vector3, to: Vector3, groups: Hash[], request_id?: number): void;
266
+ /**
267
+ * Only one physics world event listener can be set at a time.
268
+ *
269
+ * @param callback - A callback that receives an information about all the physics interactions in this physics world.
270
+ *
271
+ * `self`
272
+ * object The calling script
273
+ * `event`
274
+ * constant The type of event. Can be one of these messages:
275
+ *
276
+ * - contact_point_event
277
+ *
278
+ * - collision_event
279
+ *
280
+ * - trigger_event
281
+ *
282
+ * - ray_cast_response
283
+ *
284
+ * - ray_cast_missed
285
+ *
286
+ * `data`
287
+ * table The callback value data is a table that contains event-related data. See the documentation for details on the messages.
288
+ * @example
289
+ * ```ts
290
+ * function physics_world_listener(self, events) {
291
+ * for (const event of events) {
292
+ * const event_type = event["type"];
293
+ * if (event_type === hash("contact_point_event")) {
294
+ * pprint(event);
295
+ * // {
296
+ * // distance = 2.1490633487701,
297
+ * // applied_impulse = 0
298
+ * // a = { --[[0x113f7c6c0]]
299
+ * // group = hash: [box],
300
+ * // id = hash: [/box]
301
+ * // mass = 0,
302
+ * // normal = vmath.vector3(0.379, 0.925, -0),
303
+ * // position = vmath.vector3(517.337, 235.068, 0),
304
+ * // instance_position = vmath.vector3(480, 144, 0),
305
+ * // relative_velocity = vmath.vector3(-0, -0, -0),
306
+ * // },
307
+ * // b = { --[[0x113f7c840]]
308
+ * // group = hash: [circle],
309
+ * // id = hash: [/circle]
310
+ * // mass = 0,
311
+ * // normal = vmath.vector3(-0.379, -0.925, 0),
312
+ * // position = vmath.vector3(517.337, 235.068, 0),
313
+ * // instance_position = vmath.vector3(-0.0021, 0, -0.0022),
314
+ * // relative_velocity = vmath.vector3(0, 0, 0),
315
+ * // },
316
+ * // }
317
+ * } else if (event === hash("collision_event")) {
318
+ * pprint(event);
319
+ * // {
320
+ * // a = {
321
+ * // group = hash: [default],
322
+ * // position = vmath.vector3(183, 666, 0),
323
+ * // id = hash: [/go1]
324
+ * // },
325
+ * // b = {
326
+ * // group = hash: [default],
327
+ * // position = vmath.vector3(185, 704.05865478516, 0),
328
+ * // id = hash: [/go2]
329
+ * // }
330
+ * // }
331
+ * } else if (event === hash("trigger_event")) {
332
+ * pprint(event);
333
+ * // {
334
+ * // enter = true,
335
+ * // b = {
336
+ * // group = hash: [default],
337
+ * // id = hash: [/go2]
338
+ * // },
339
+ * // a = {
340
+ * // group = hash: [default],
341
+ * // id = hash: [/go1]
342
+ * // }
343
+ * // },
344
+ * } else if (event === hash("ray_cast_response")) {
345
+ * pprint(event);
346
+ * // {
347
+ * // group = hash: [default],
348
+ * // request_id = 0,
349
+ * // position = vmath.vector3(249.92222595215, 249.92222595215, 0),
350
+ * // fraction = 0.68759721517563,
351
+ * // normal = vmath.vector3(0, 1, 0),
352
+ * // id = hash: [/go]
353
+ * // }
354
+ * } else if (event === hash("ray_cast_missed")) {
355
+ * pprint(event);
356
+ * // {
357
+ * // request_id = 0
358
+ * // },
359
+ * }
360
+ * }
361
+ * }
362
+ *
363
+ * export default defineScript({
364
+ * init(self) {
365
+ * physics.set_event_listener(physics_world_listener);
366
+ * },
367
+ * });
368
+ * ```
369
+ */
370
+ function set_event_listener(callback?: (self: unknown, events: unknown) => void): void;
371
+ /**
372
+ * Set the gravity in runtime. The gravity change is not global, it will only affect
373
+ * the collection that the function is called from.
374
+ * Note: For 2D physics the z component of the gravity vector will be ignored.
375
+ *
376
+ * @param gravity - the new gravity vector
377
+ * @example
378
+ * ```ts
379
+ * export default defineScript({
380
+ * init(self) {
381
+ * // Set "upside down" gravity for this collection.
382
+ * physics.set_gravity(vmath.vector3(0, 10.0, 0));
383
+ * },
384
+ * });
385
+ * ```
386
+ */
387
+ function set_gravity(gravity: Vector3): void;
388
+ /**
389
+ * Updates the group property of a collision object to the specified
390
+ * string value. The group name should exist i.e. have been used in
391
+ * a collision object in the editor.
392
+ *
393
+ * @param url - the collision object affected.
394
+ * @param group - the new group name to be assigned.
395
+ *
396
+ * `local function change_collision_group()
397
+ * physics.set_group("#collisionobject", "enemy")
398
+ * end
399
+ * `
400
+ */
401
+ function set_group(url: string | Hash | Url, group: string): void;
402
+ /**
403
+ * Flips the collision shapes horizontally for a collision object
404
+ *
405
+ * @param url - the collision object that should flip its shapes
406
+ * @param flip - `true` if the collision object should flip its shapes, `false` if not
407
+ * @example
408
+ * ```ts
409
+ * export default defineScript({
410
+ * init(self) {
411
+ * self.fliph = true; // set on some condition
412
+ * physics.set_hflip("#collisionobject", self.fliph);
413
+ * },
414
+ * });
415
+ * ```
416
+ */
417
+ function set_hflip(url: string | Hash | Url, flip: boolean): void;
418
+ /**
419
+ * Updates the properties for an already connected joint. The joint has to be created before
420
+ * properties can be changed.
421
+ * Note: Currently only supported in 2D physics.
422
+ *
423
+ * @param collisionobject - collision object where the joint exist
424
+ * @param joint_id - id of the joint
425
+ * @param properties - joint specific properties table
426
+ * Note: The `collide_connected` field cannot be updated/changed after a connection has been made.
427
+ */
428
+ function set_joint_properties(collisionobject: string | Hash | Url, joint_id: string | Hash, properties: { collide_connected?: boolean }): void;
429
+ /**
430
+ * Sets or clears the masking of a group (maskbit) in a collision object.
431
+ *
432
+ * @param url - the collision object to change the mask of.
433
+ * @param group - the name of the group (maskbit) to modify in the mask.
434
+ * @param maskbit - boolean value of the new maskbit. 'true' to enable, 'false' to disable.
435
+ *
436
+ * `local function make_invincible()
437
+ * -- no longer collide with the "bullet" group
438
+ * physics.set_maskbit("#collisionobject", "bullet", false)
439
+ * end
440
+ * `
441
+ */
442
+ function set_maskbit(url: string | Hash | Url, group: string, maskbit: boolean): void;
443
+ /**
444
+ * Sets collision shape data for a collision object. Please note that updating data in 3D
445
+ * can be quite costly for box and capsules. Because of the physics engine, the cost
446
+ * comes from having to recreate the shape objects when certain shapes needs to be updated.
447
+ *
448
+ * @param url - the collision object.
449
+ * @param shape - the name of the shape to get data for.
450
+ * @param table - the shape data to update the shape with.
451
+ * See physics.get_shape for a detailed description of each field in the data table.
452
+ *
453
+ * `local function set_shape_data()
454
+ * -- set capsule shape data
455
+ * local data = {}
456
+ * data.type = physics.SHAPE_TYPE_CAPSULE
457
+ * data.diameter = 10
458
+ * data.height = 20
459
+ * physics.set_shape("#collisionobject", "my_capsule_shape", data)
460
+ *
461
+ * -- set sphere shape data
462
+ * data = {}
463
+ * data.type = physics.SHAPE_TYPE_SPHERE
464
+ * data.diameter = 10
465
+ * physics.set_shape("#collisionobject", "my_sphere_shape", data)
466
+ *
467
+ * -- set box shape data
468
+ * data = {}
469
+ * data.type = physics.SHAPE_TYPE_BOX
470
+ * data.dimensions = vmath.vector3(10, 10, 5)
471
+ * physics.set_shape("#collisionobject", "my_box_shape", data)
472
+ * end
473
+ * `
474
+ */
475
+ function set_shape(url: string | Hash | Url, shape: string | Hash, table: { type?: number; diameter?: number; dimensions?: Vector3; diameter?: number; height?: number }): void;
476
+ /**
477
+ * Flips the collision shapes vertically for a collision object
478
+ *
479
+ * @param url - the collision object that should flip its shapes
480
+ * @param flip - `true` if the collision object should flip its shapes, `false` if not
481
+ * @example
482
+ * ```ts
483
+ * export default defineScript({
484
+ * init(self) {
485
+ * self.flipv = true; // set on some condition
486
+ * physics.set_vflip("#collisionobject", self.flipv);
487
+ * },
488
+ * });
489
+ * ```
490
+ */
491
+ function set_vflip(url: string | Hash | Url, flip: boolean): void;
492
+ /**
493
+ * The function recalculates the density of each shape based on the total area of all shapes and the specified mass, then updates the mass of the body accordingly.
494
+ * Note: Currently only supported in 2D physics.
495
+ *
496
+ * @param collisionobject - the collision object whose mass needs to be updated.
497
+ * @param mass - the new mass value to set for the collision object.
498
+ * @example
499
+ * ```ts
500
+ * physics.update_mass("#collisionobject", 14);
501
+ * ```
502
+ */
503
+ function update_mass(collisionobject: string | Hash | Url, mass: number): void;
504
+ /**
505
+ * Collision objects tend to fall asleep when inactive for a small period of time for
506
+ * efficiency reasons. This function wakes them up.
507
+ *
508
+ * @param url - the collision object to wake.
509
+ *
510
+ * `function on_input(self, action_id, action)
511
+ * if action_id == hash("test") and action.pressed then
512
+ * physics.wakeup("#collisionobject")
513
+ * end
514
+ * end
515
+ * `
516
+ */
517
+ function wakeup(url: string | Hash | Url): void;
518
+ interface properties {
519
+ /**
520
+ * The angular damping value for the collision object. Setting this value alters the damping of
521
+ * angular motion of the object (rotation). Valid values are between 0 (no damping) and 1 (full damping).
522
+ */
523
+ angular_damping: number;
524
+ /**
525
+ * The current angular velocity of the collision object component as a vector3.
526
+ * The velocity is measured as a rotation around the vector with a speed equivalent to the vector length
527
+ * in radians/s.
528
+ */
529
+ angular_velocity: Vector3;
530
+ /**
531
+ * The linear damping value for the collision object. Setting this value alters the damping of
532
+ * linear motion of the object. Valid values are between 0 (no damping) and 1 (full damping).
533
+ */
534
+ linear_damping: number;
535
+ /**
536
+ * The current linear velocity of the collision object component as a vector3.
537
+ * The velocity is measured in units/s (pixels/s).
538
+ */
539
+ linear_velocity: Vector3;
540
+ /**
541
+ * READ ONLY Returns the defined physical mass of the collision object component as a number.
542
+ */
543
+ mass: number;
544
+ }
545
+ }
546
+ }
547
+
548
+ export {};