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