@defold-typescript/types 0.19.4 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) 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/buffer.d.ts +1 -1
  13. package/generated/builtin-messages.d.ts +18 -0
  14. package/generated/camera.d.ts +62 -5
  15. package/generated/compute.d.ts +306 -0
  16. package/generated/crash.d.ts +2 -2
  17. package/generated/go.d.ts +31 -6
  18. package/generated/graphics.d.ts +95 -0
  19. package/generated/gui.d.ts +4 -6
  20. package/generated/image.d.ts +3 -3
  21. package/generated/json.d.ts +2 -2
  22. package/generated/kinds/gui-script.d.ts +7 -0
  23. package/generated/kinds/render-script.d.ts +7 -0
  24. package/generated/kinds/script.d.ts +7 -0
  25. package/generated/label.d.ts +1 -1
  26. package/generated/liveupdate.d.ts +22 -4
  27. package/generated/material.d.ts +444 -0
  28. package/generated/model.d.ts +46 -5
  29. package/generated/physics.d.ts +2 -4
  30. package/generated/profiler.d.ts +2 -3
  31. package/generated/render.d.ts +25 -9
  32. package/generated/resource.d.ts +2 -2
  33. package/generated/socket.d.ts +35 -35
  34. package/generated/sprite.d.ts +15 -1
  35. package/generated/sys.d.ts +1 -1
  36. package/generated/tilemap.d.ts +14 -0
  37. package/generated/timer.d.ts +1 -1
  38. package/generated/versions/defold-1.12.4/b2d.d.ts +27 -0
  39. package/generated/versions/defold-1.12.4/b2d_body.d.ts +348 -0
  40. package/generated/versions/defold-1.12.4/buffer.d.ts +176 -0
  41. package/generated/versions/defold-1.12.4/camera.d.ts +245 -0
  42. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +146 -0
  43. package/generated/versions/defold-1.12.4/collectionproxy.d.ts +71 -0
  44. package/generated/versions/defold-1.12.4/crash.d.ts +143 -0
  45. package/generated/versions/defold-1.12.4/factory.d.ts +123 -0
  46. package/generated/versions/defold-1.12.4/font.d.ts +81 -0
  47. package/generated/versions/defold-1.12.4/go.d.ts +1029 -0
  48. package/generated/versions/defold-1.12.4/graphics.d.ts +226 -0
  49. package/generated/versions/defold-1.12.4/gui.d.ts +2372 -0
  50. package/generated/versions/defold-1.12.4/html5.d.ts +53 -0
  51. package/generated/versions/defold-1.12.4/http.d.ts +84 -0
  52. package/generated/versions/defold-1.12.4/iac.d.ts +18 -0
  53. package/generated/versions/defold-1.12.4/iap.d.ts +60 -0
  54. package/generated/versions/defold-1.12.4/image.d.ts +139 -0
  55. package/generated/versions/defold-1.12.4/index.d.ts +41 -0
  56. package/generated/versions/defold-1.12.4/json.d.ts +76 -0
  57. package/generated/versions/defold-1.12.4/label.d.ts +94 -0
  58. package/generated/versions/defold-1.12.4/liveupdate.d.ts +122 -0
  59. package/generated/versions/defold-1.12.4/model.d.ts +205 -0
  60. package/generated/versions/defold-1.12.4/msg.d.ts +10 -0
  61. package/generated/versions/defold-1.12.4/particlefx.d.ts +166 -0
  62. package/generated/versions/defold-1.12.4/physics.d.ts +547 -0
  63. package/generated/versions/defold-1.12.4/profiler.d.ts +234 -0
  64. package/generated/versions/defold-1.12.4/push.d.ts +66 -0
  65. package/generated/versions/defold-1.12.4/render.d.ts +1149 -0
  66. package/generated/versions/defold-1.12.4/resource.d.ts +1518 -0
  67. package/generated/versions/defold-1.12.4/socket.d.ts +795 -0
  68. package/generated/versions/defold-1.12.4/sound.d.ts +291 -0
  69. package/generated/versions/defold-1.12.4/sprite.d.ts +143 -0
  70. package/generated/versions/defold-1.12.4/sys.d.ts +695 -0
  71. package/generated/versions/defold-1.12.4/tilemap.d.ts +181 -0
  72. package/generated/versions/defold-1.12.4/timer.d.ts +114 -0
  73. package/generated/versions/defold-1.12.4/types.d.ts +61 -0
  74. package/generated/versions/defold-1.12.4/vmath.d.ts +806 -0
  75. package/generated/versions/defold-1.12.4/webview.d.ts +68 -0
  76. package/generated/versions/defold-1.12.4/window.d.ts +198 -0
  77. package/generated/versions/defold-1.12.4/zlib.d.ts +40 -0
  78. package/index.d.ts +22 -0
  79. package/package.json +8 -1
  80. package/scripts/fidelity-audit.ts +69 -12
  81. package/scripts/fidelity-baseline.json +56 -0
  82. package/scripts/generate-api-availability.ts +139 -0
  83. package/scripts/generate-api-signatures.ts +66 -0
  84. package/scripts/import-defold-release.ts +480 -0
  85. package/scripts/materialize-version.ts +45 -20
  86. package/scripts/regen.ts +53 -6
  87. package/scripts/sync-api-docs.ts +89 -41
  88. package/src/api-availability.ts +0 -0
  89. package/src/core-types.ts +9 -0
  90. package/src/emit-dts.ts +685 -17
  91. package/src/emit-messages.ts +72 -2
  92. package/src/index.ts +26 -1
  93. package/src/lifecycle.ts +43 -2
@@ -0,0 +1,215 @@
1
+ /** @noSelfInFile */
2
+ import type { Opaque, Vector3 } from "../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Constants for functional shape tables used with `b2d.body.create_fixture`
7
+ * and returned from `b2d.fixture.get_shape`.
8
+ */
9
+ namespace b2d.shape {
10
+ type b2Shape = Opaque<"b2Shape">;
11
+ /**
12
+ * Uses the polygon enum value, but indicates the `hx`/`hy` box convenience format.
13
+ */
14
+ const SHAPE_TYPE_BOX: number & { readonly __brand: "b2d.shape.SHAPE_TYPE_BOX" };
15
+ /**
16
+ * Capsule shape type.
17
+ */
18
+ const SHAPE_TYPE_CAPSULE: number & { readonly __brand: "b2d.shape.SHAPE_TYPE_CAPSULE" };
19
+ /**
20
+ * Chain shape type.
21
+ */
22
+ const SHAPE_TYPE_CHAIN: number & { readonly __brand: "b2d.shape.SHAPE_TYPE_CHAIN" };
23
+ /**
24
+ * Circle shape type.
25
+ */
26
+ const SHAPE_TYPE_CIRCLE: number & { readonly __brand: "b2d.shape.SHAPE_TYPE_CIRCLE" };
27
+ /**
28
+ * Edge shape type.
29
+ */
30
+ const SHAPE_TYPE_EDGE: number & { readonly __brand: "b2d.shape.SHAPE_TYPE_EDGE" };
31
+ /**
32
+ * Grid shape type.
33
+ */
34
+ const SHAPE_TYPE_GRID: number & { readonly __brand: "b2d.shape.SHAPE_TYPE_GRID" };
35
+ /**
36
+ * Polygon shape type.
37
+ */
38
+ const SHAPE_TYPE_POLYGON: number & { readonly __brand: "b2d.shape.SHAPE_TYPE_POLYGON" };
39
+ /**
40
+ * Segment shape type.
41
+ */
42
+ const SHAPE_TYPE_SEGMENT: number & { readonly __brand: "b2d.shape.SHAPE_TYPE_SEGMENT" };
43
+ /**
44
+ * Check if contact events are enabled for a shape.
45
+ *
46
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
47
+ * @returns true if contact events are enabled
48
+ */
49
+ function are_contact_events_enabled(shape_id: Opaque<"b2Shape">): boolean;
50
+ /**
51
+ * Check if hit events are enabled for a shape.
52
+ *
53
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
54
+ * @returns true if hit events are enabled
55
+ */
56
+ function are_hit_events_enabled(shape_id: Opaque<"b2Shape">): boolean;
57
+ /**
58
+ * Check if pre-solve events are enabled for a shape.
59
+ *
60
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
61
+ * @returns true if pre-solve events are enabled
62
+ */
63
+ function are_pre_solve_events_enabled(shape_id: Opaque<"b2Shape">): boolean;
64
+ /**
65
+ * Check if sensor events are enabled for a shape.
66
+ *
67
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
68
+ * @returns true if sensor events are enabled
69
+ */
70
+ function are_sensor_events_enabled(shape_id: Opaque<"b2Shape">): boolean;
71
+ /**
72
+ * Enable or disable contact events for a shape.
73
+ *
74
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
75
+ * @param enable - true to enable contact events
76
+ */
77
+ function enable_contact_events(shape_id: Opaque<"b2Shape">, enable: boolean): void;
78
+ /**
79
+ * Enable or disable hit events for a shape.
80
+ *
81
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
82
+ * @param enable - true to enable hit events
83
+ */
84
+ function enable_hit_events(shape_id: Opaque<"b2Shape">, enable: boolean): void;
85
+ /**
86
+ * Enable or disable pre-solve events for a shape.
87
+ *
88
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
89
+ * @param enable - true to enable pre-solve events
90
+ */
91
+ function enable_pre_solve_events(shape_id: Opaque<"b2Shape">, enable: boolean): void;
92
+ /**
93
+ * Enable or disable sensor events for a shape.
94
+ *
95
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
96
+ * @param enable - true to enable sensor events
97
+ */
98
+ function enable_sensor_events(shape_id: Opaque<"b2Shape">, enable: boolean): void;
99
+ /**
100
+ * Get the body owning a shape.
101
+ *
102
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
103
+ * @returns owning body
104
+ */
105
+ function get_body(shape_id: Opaque<"b2Shape">): Opaque<"b2Body">;
106
+ /**
107
+ * Get the closest point on a shape.
108
+ *
109
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
110
+ * @param target - world target point
111
+ * @returns closest world point on the shape
112
+ */
113
+ function get_closest_point(shape_id: Opaque<"b2Shape">, target: Vector3): Vector3;
114
+ /**
115
+ * Get shape contact capacity.
116
+ *
117
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
118
+ * @returns maximum contact data count
119
+ */
120
+ function get_contact_capacity(shape_id: Opaque<"b2Shape">): number;
121
+ /**
122
+ * Get touching contact data for a shape.
123
+ *
124
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
125
+ * @returns array of contact tables
126
+ */
127
+ function get_contact_data(shape_id: Opaque<"b2Shape">): Record<string | number, unknown>;
128
+ /**
129
+ * Get mass data for a shape.
130
+ *
131
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
132
+ * @returns table with `mass`, `center`, and `inertia`
133
+ */
134
+ function get_mass_data(shape_id: Opaque<"b2Shape">): { mass: number; center: Vector3; inertia: number };
135
+ /**
136
+ * Get shape material id.
137
+ *
138
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
139
+ * @returns shape material id
140
+ */
141
+ function get_material(shape_id: Opaque<"b2Shape">): number;
142
+ /**
143
+ * Get sensor overlap capacity.
144
+ *
145
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
146
+ * @returns maximum sensor overlap count
147
+ */
148
+ function get_sensor_capacity(shape_id: Opaque<"b2Shape">): number;
149
+ /**
150
+ * Get sensor overlaps.
151
+ *
152
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
153
+ * @returns array of shape info tables
154
+ */
155
+ function get_sensor_overlaps(shape_id: Opaque<"b2Shape">): { shape_id: number }[];
156
+ /**
157
+ * Get a shape's geometry.
158
+ *
159
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
160
+ * @returns shape table with numeric `type` from `b2d.shape.SHAPE_TYPE_*`
161
+ */
162
+ function get_shape(shape_id: Opaque<"b2Shape">): { type: number; radius?: number; center?: Vector3; v0?: Vector3; v1?: Vector3; v2?: Vector3; v3?: Vector3; vertices?: Vector3[]; hx?: number; hy?: number; angle?: number; loop?: boolean; prev_vertex?: Vector3; next_vertex?: Vector3 };
163
+ /**
164
+ * Get the world owning a shape.
165
+ *
166
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
167
+ * @returns owning world
168
+ */
169
+ function get_world(shape_id: Opaque<"b2Shape">): Opaque<"b2World">;
170
+ /**
171
+ * Validate a shape handle.
172
+ *
173
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
174
+ * @returns true if the shape handle still refers to a live Box2D shape
175
+ */
176
+ function is_valid(shape_id: Opaque<"b2Shape">): boolean;
177
+ /**
178
+ * Ray cast a shape directly.
179
+ *
180
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
181
+ * @param origin - world ray origin
182
+ * @param translation - world ray translation
183
+ * @param max_fraction - optional maximum translation fraction, defaults to 1
184
+ * @returns hit table with `point`, `normal`, `fraction`, and `iterations`, or nil
185
+ */
186
+ function ray_cast(shape_id: Opaque<"b2Shape">, origin: Vector3, translation: Vector3, max_fraction: number): { point: Vector3; normal: Vector3; fraction: number; iterations: number };
187
+ /**
188
+ * Set shape material id.
189
+ *
190
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
191
+ * @param material - shape material id
192
+ */
193
+ function set_material(shape_id: Opaque<"b2Shape">, material: number): void;
194
+ /**
195
+ * This updates the shape geometry using the same table format as
196
+ * `b2d.body.create_shape` and `b2d.shape.get_shape`. The body mass is not
197
+ * updated unless `update_mass` is true.
198
+ *
199
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
200
+ * @param definition - shape table with numeric `type` from `b2d.shape.SHAPE_TYPE_*`
201
+ * @param update_mass - true to reset body mass from shapes
202
+ * @example
203
+ * ```ts
204
+ * const body = b2d.get_body("#collisionobject");
205
+ * const circle = b2d.shape.get_shape(body, 1);
206
+ * circle.center = vmath.vector3(24, 0, 0);
207
+ * b2d.shape.set_shape(body, 1, circle, true);
208
+ * b2d.shape.set_shape(body, 2, { type: b2d.shape.SHAPE_TYPE_SEGMENT, v1: vmath.vector3(-32, 0, 0), v2: vmath.vector3(32, 0, 0) });
209
+ * ```
210
+ */
211
+ function set_shape(shape_id: Opaque<"b2Shape">, definition: { type?: number; radius?: number; center?: Vector3; v0?: Vector3; v1?: Vector3; v2?: Vector3; v3?: Vector3; vertices?: Vector3[]; hx?: number; hy?: number; angle?: number; loop?: boolean; prev_vertex?: Vector3; next_vertex?: Vector3 }, update_mass: boolean): void;
212
+ }
213
+ }
214
+
215
+ export {};
@@ -0,0 +1,314 @@
1
+ /** @noSelfInFile */
2
+ import type { Opaque, Vector3 } from "../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Query and cast functions for the Defold-owned Box2D v2 world.
7
+ */
8
+ namespace b2d.world {
9
+ /**
10
+ * The capsule table has `center1`, `center2`, and `radius` fields. The return
11
+ * value is the fraction of `translation` that can be traveled before collision,
12
+ * or 1 if there is no hit.
13
+ *
14
+ * @param world - world
15
+ * @param capsule - capsule table with `center1`, `center2`, and `radius`
16
+ * @param translation - capsule displacement
17
+ * @param filter - optional query filter with `category_bits` and `mask_bits`
18
+ * @returns travel fraction before collision
19
+ */
20
+ function cast_mover(world: Opaque<"b2World">, capsule: { center1?: Vector3; center2?: Vector3; radius?: number }, translation: Vector3, filter?: { category_bits?: number; mask_bits?: number }): number;
21
+ /**
22
+ * Cast a ray.
23
+ *
24
+ * @param world - world from `b2d.get_world` or `b2d.body.get_world`
25
+ * @param origin - world ray origin
26
+ * @param translation - world ray translation
27
+ * @param filter - optional query filter with `category_bits`, `mask_bits`, and optional `group_index`
28
+ * @param max_results - optional maximum result count
29
+ */
30
+ function cast_ray(world: Opaque<"b2World">, origin: Vector3, translation: Vector3, filter: { category_bits?: number; mask_bits?: number; group_index?: number }, max_results: number): LuaMultiReturn<[{ fixture: number; shape: number; point: Vector3; normal: Vector3; fraction: number }[], { node_visits: number; leaf_visits: number }]>;
31
+ /**
32
+ * The translation is the ray displacement from `origin`. Result order is not
33
+ * guaranteed by Box2D.
34
+ *
35
+ * @param world - world
36
+ * @param origin - ray start position
37
+ * @param translation - ray displacement
38
+ * @param filter - optional query filter with `category_bits` and `mask_bits`
39
+ * @param max_results - optional maximum result count. Omit or pass 0 for unlimited results.
40
+ */
41
+ function cast_ray(world: Opaque<"b2World">, origin: Vector3, translation: Vector3, filter?: { category_bits?: number; mask_bits?: number; group_index?: number }, max_results?: number): LuaMultiReturn<[{ fixture: number; shape: number; point: Vector3; normal: Vector3; fraction: number }[], { node_visits: number; leaf_visits: number }]>;
42
+ /**
43
+ * Cast a ray and return the closest hit.
44
+ *
45
+ * @param world - world from `b2d.get_world` or `b2d.body.get_world`
46
+ * @param origin - world ray origin
47
+ * @param translation - world ray translation
48
+ * @param filter - optional query filter with `category_bits`, `mask_bits`, and optional `group_index`
49
+ * @returns hit table with `fixture`, `shape`, `point`, `normal`, `fraction`, `node_visits`, and `leaf_visits`, or nil
50
+ */
51
+ function cast_ray_closest(world: Opaque<"b2World">, origin: Vector3, translation: Vector3, filter: { category_bits?: number; mask_bits?: number; group_index?: number }): { fixture: number; shape: number; point: Vector3; normal: Vector3; fraction: number; node_visits: number; leaf_visits: number };
52
+ /**
53
+ * The translation is the ray displacement from `origin`.
54
+ *
55
+ * @param world - world
56
+ * @param origin - ray start position
57
+ * @param translation - ray displacement
58
+ * @param filter - optional query filter with `category_bits` and `mask_bits`
59
+ * @returns closest cast hit table with `node_visits` and `leaf_visits`, or `nil` on miss
60
+ */
61
+ function cast_ray_closest(world: Opaque<"b2World">, origin: Vector3, translation: Vector3, filter?: { category_bits?: number; mask_bits?: number; group_index?: number }): { fixture: number; shape: number; point: Vector3; normal: Vector3; fraction: number; node_visits: number; leaf_visits: number } | undefined;
62
+ /**
63
+ * Uses Box2D v2 time-of-impact for fixture child shapes that support distance proxies.
64
+ * Grid fixture children are skipped.
65
+ *
66
+ * @param world - world from `b2d.get_world` or `b2d.body.get_world`
67
+ * @param shape - shape table using the same format as the `shape` field in `b2d.body.create_fixture`
68
+ * @param translation - world shape translation
69
+ * @param filter - optional query filter with `category_bits`, `mask_bits`, and optional `group_index`
70
+ * @param max_results - optional maximum result count
71
+ */
72
+ function cast_shape(world: Opaque<"b2World">, shape: { type?: number; radius?: number; center?: Vector3; v0?: Vector3; v1?: Vector3; v2?: Vector3; v3?: Vector3; vertices?: Vector3[]; hx?: number; hy?: number; angle?: number; loop?: boolean; prev_vertex?: Vector3; next_vertex?: Vector3 }, translation: Vector3, filter: { category_bits?: number; mask_bits?: number; group_index?: number }, max_results: number): LuaMultiReturn<[{ fixture: number; shape: number; point: Vector3; normal: Vector3; fraction: number }[], { node_visits: number; leaf_visits: number }]>;
73
+ /**
74
+ * The shape table uses the same circle, capsule, segment, polygon, and box formats
75
+ * as `b2d.body.create_shape`. The translation is the shape displacement.
76
+ *
77
+ * @param world - world
78
+ * @param shape - shape table
79
+ * @param translation - shape displacement
80
+ * @param filter - optional query filter with `category_bits` and `mask_bits`
81
+ * @param max_results - optional maximum result count. Omit or pass 0 for unlimited results.
82
+ */
83
+ function cast_shape(world: Opaque<"b2World">, shape: { type?: number; radius?: number; center?: Vector3; v0?: Vector3; v1?: Vector3; v2?: Vector3; v3?: Vector3; vertices?: Vector3[]; hx?: number; hy?: number; angle?: number; loop?: boolean; prev_vertex?: Vector3; next_vertex?: Vector3 }, translation: Vector3, filter?: { category_bits?: number; mask_bits?: number; group_index?: number }, max_results?: number): LuaMultiReturn<[{ fixture: number; shape: number; point: Vector3; normal: Vector3; fraction: number }[], { node_visits: number; leaf_visits: number }]>;
84
+ /**
85
+ * The capsule table has `center1`, `center2`, and `radius` fields. Plane result
86
+ * tables include `shape`, `normal`, `offset`, and `hit`.
87
+ *
88
+ * @param world - world
89
+ * @param capsule - capsule table with `center1`, `center2`, and `radius`
90
+ * @param filter - optional query filter with `category_bits` and `mask_bits`
91
+ * @param max_results - optional maximum result count. Omit or pass 0 for unlimited results.
92
+ * @returns array of plane result tables
93
+ */
94
+ function collide_mover(world: Opaque<"b2World">, capsule: { center1?: Vector3; center2?: Vector3; radius?: number }, filter?: { category_bits?: number; mask_bits?: number }, max_results?: number): Record<string | number, unknown>;
95
+ /**
96
+ * Enable or disable continuous collision.
97
+ *
98
+ * @param world - world
99
+ * @param enable - true to enable continuous collision
100
+ */
101
+ function enable_continuous(world: Opaque<"b2World">, enable: boolean): void;
102
+ /**
103
+ * Enable or disable world sleeping.
104
+ *
105
+ * @param world - world
106
+ * @param enable - true to allow sleeping
107
+ */
108
+ function enable_sleeping(world: Opaque<"b2World">, enable: boolean): void;
109
+ /**
110
+ * Enable or disable speculative collision.
111
+ *
112
+ * @param world - world
113
+ * @param enable - true to enable speculative collision
114
+ */
115
+ function enable_speculative(world: Opaque<"b2World">, enable: boolean): void;
116
+ /**
117
+ * Enable or disable warm starting.
118
+ *
119
+ * @param world - world
120
+ * @param enable - true to enable warm starting
121
+ */
122
+ function enable_warm_starting(world: Opaque<"b2World">, enable: boolean): void;
123
+ /**
124
+ * The definition table requires `position`, `radius`, `falloff`, and
125
+ * `impulse_per_length`. It may also include `mask_bits`.
126
+ *
127
+ * @param world - world
128
+ * @param definition - explosion definition
129
+ */
130
+ function explode(world: Opaque<"b2World">, definition: Record<string | number, unknown>): void;
131
+ /**
132
+ * Get the number of awake bodies.
133
+ *
134
+ * @param world - world
135
+ * @returns awake body count
136
+ */
137
+ function get_awake_body_count(world: Opaque<"b2World">): number;
138
+ /**
139
+ * The returned table contains `body_count`, `shape_count`, `contact_count`,
140
+ * `joint_count`, `island_count`, `stack_used`, `static_tree_height`,
141
+ * `tree_height`, `byte_count`, `task_count`, and `color_counts`.
142
+ *
143
+ * @param world - world
144
+ * @returns world counters
145
+ */
146
+ function get_counters(world: Opaque<"b2World">): Record<string | number, unknown>;
147
+ /**
148
+ * Get world gravity.
149
+ *
150
+ * @param world - world
151
+ * @returns gravity vector
152
+ */
153
+ function get_gravity(world: Opaque<"b2World">): Vector3;
154
+ /**
155
+ * Get the hit event threshold.
156
+ *
157
+ * @param world - world
158
+ * @returns hit event threshold in project units per second
159
+ */
160
+ function get_hit_event_threshold(world: Opaque<"b2World">): number;
161
+ /**
162
+ * Get the maximum linear speed.
163
+ *
164
+ * @param world - world
165
+ * @returns maximum linear speed in project units per second
166
+ */
167
+ function get_maximum_linear_speed(world: Opaque<"b2World">): number;
168
+ /**
169
+ * The returned table contains Box2D timing fields including `step`, `pairs`,
170
+ * `collide`, `solve`, `merge_islands`, `prepare_stages`, `solve_constraints`,
171
+ * `prepare_constraints`, `integrate_velocities`, `warm_start`,
172
+ * `solve_impulses`, `integrate_positions`, `relax_impulses`,
173
+ * `apply_restitution`, `store_impulses`, `split_islands`, `transforms`,
174
+ * `hit_events`, `refit`, `bullets`, `sleep_islands`, and `sensors`.
175
+ *
176
+ * @param world - world
177
+ * @returns world profiling data
178
+ */
179
+ function get_profile(world: Opaque<"b2World">): Record<string | number, unknown>;
180
+ /**
181
+ * Get the restitution threshold.
182
+ *
183
+ * @param world - world
184
+ * @returns restitution threshold in project units per second
185
+ */
186
+ function get_restitution_threshold(world: Opaque<"b2World">): number;
187
+ /**
188
+ * Get whether continuous collision is enabled.
189
+ *
190
+ * @param world - world
191
+ * @returns true if continuous collision is enabled
192
+ */
193
+ function is_continuous_enabled(world: Opaque<"b2World">): boolean;
194
+ /**
195
+ * The world is locked during callbacks and some simulation phases. Functions
196
+ * marked as locked during callbacks cannot be called while this returns true.
197
+ *
198
+ * @param world - world
199
+ * @returns true if the world is locked
200
+ */
201
+ function is_locked(world: Opaque<"b2World">): boolean;
202
+ /**
203
+ * Get whether world sleeping is enabled.
204
+ *
205
+ * @param world - world
206
+ * @returns true if sleeping is enabled
207
+ */
208
+ function is_sleeping_enabled(world: Opaque<"b2World">): boolean;
209
+ /**
210
+ * Check whether a world handle is valid.
211
+ *
212
+ * @param world - world
213
+ * @returns true if the world handle is valid
214
+ */
215
+ function is_valid(world: Opaque<"b2World">): boolean;
216
+ /**
217
+ * Get whether warm starting is enabled.
218
+ *
219
+ * @param world - world
220
+ * @returns true if warm starting is enabled
221
+ */
222
+ function is_warm_starting_enabled(world: Opaque<"b2World">): boolean;
223
+ /**
224
+ * Overlap an AABB.
225
+ *
226
+ * @param world - world from `b2d.get_world` or `b2d.body.get_world`
227
+ * @param aabb - table with `lower` and `upper` vector3 fields
228
+ * @param filter - optional query filter with `category_bits`, `mask_bits`, and optional `group_index`
229
+ * @param max_results - optional maximum result count
230
+ */
231
+ function overlap_aabb(world: Opaque<"b2World">, aabb: { lower?: Vector3; upper?: Vector3 }, filter: { category_bits?: number; mask_bits?: number; group_index?: number }, max_results: number): LuaMultiReturn<[{ index: number; type: number; sensor: boolean; density: number; friction: number; restitution: number; child_count: number }[], { node_visits: number; leaf_visits: number }]>;
232
+ /**
233
+ * The AABB table has `lower` and `upper` `vector3` fields.
234
+ *
235
+ * @param world - world
236
+ * @param aabb - AABB table with `lower` and `upper`
237
+ * @param filter - optional query filter with `category_bits` and `mask_bits`
238
+ * @param max_results - optional maximum result count. Omit or pass 0 for unlimited results.
239
+ */
240
+ function overlap_aabb(world: Opaque<"b2World">, aabb: { lower?: Vector3; upper?: Vector3 }, filter?: { category_bits?: number; mask_bits?: number; group_index?: number }, max_results?: number): LuaMultiReturn<[{ shape_id: number }[], { node_visits: number; leaf_visits: number }]>;
241
+ /**
242
+ * Overlap a shape.
243
+ *
244
+ * @param world - world from `b2d.get_world` or `b2d.body.get_world`
245
+ * @param shape - shape table using the same format as the `shape` field in `b2d.body.create_fixture`
246
+ * @param filter - optional query filter with `category_bits`, `mask_bits`, and optional `group_index`
247
+ * @param max_results - optional maximum result count
248
+ */
249
+ function overlap_shape(world: Opaque<"b2World">, shape: { type?: number; radius?: number; center?: Vector3; v0?: Vector3; v1?: Vector3; v2?: Vector3; v3?: Vector3; vertices?: Vector3[]; hx?: number; hy?: number; angle?: number; loop?: boolean; prev_vertex?: Vector3; next_vertex?: Vector3 }, filter: { category_bits?: number; mask_bits?: number; group_index?: number }, max_results: number): LuaMultiReturn<[{ index: number; type: number; sensor: boolean; density: number; friction: number; restitution: number; child_count: number }[], { node_visits: number; leaf_visits: number }]>;
250
+ /**
251
+ * The shape table uses the same circle, capsule, segment, polygon, and box formats
252
+ * as `b2d.body.create_shape`.
253
+ *
254
+ * @param world - world
255
+ * @param shape - shape table
256
+ * @param filter - optional query filter with `category_bits` and `mask_bits`
257
+ * @param max_results - optional maximum result count. Omit or pass 0 for unlimited results.
258
+ */
259
+ function overlap_shape(world: Opaque<"b2World">, shape: { type?: number; radius?: number; center?: Vector3; v0?: Vector3; v1?: Vector3; v2?: Vector3; v3?: Vector3; vertices?: Vector3[]; hx?: number; hy?: number; angle?: number; loop?: boolean; prev_vertex?: Vector3; next_vertex?: Vector3 }, filter?: { category_bits?: number; mask_bits?: number; group_index?: number }, max_results?: number): LuaMultiReturn<[{ shape_id: number }[], { node_visits: number; leaf_visits: number }]>;
260
+ /**
261
+ * Rebuild the static broad-phase tree.
262
+ *
263
+ * @param world - world
264
+ */
265
+ function rebuild_static_tree(world: Opaque<"b2World">): void;
266
+ /**
267
+ * Set contact solver tuning.
268
+ *
269
+ * @param world - world
270
+ * @param hertz - contact stiffness frequency in hertz
271
+ * @param damping_ratio - contact damping ratio
272
+ * @param pushout - pushout velocity in project units per second
273
+ */
274
+ function set_contact_tuning(world: Opaque<"b2World">, hertz: number, damping_ratio: number, pushout: number): void;
275
+ /**
276
+ * Set world gravity.
277
+ *
278
+ * @param world - world
279
+ * @param gravity - gravity vector
280
+ */
281
+ function set_gravity(world: Opaque<"b2World">, gravity: Vector3): void;
282
+ /**
283
+ * Set the hit event threshold.
284
+ *
285
+ * @param world - world
286
+ * @param threshold - hit event threshold in project units per second
287
+ */
288
+ function set_hit_event_threshold(world: Opaque<"b2World">, threshold: number): void;
289
+ /**
290
+ * Set joint solver tuning.
291
+ *
292
+ * @param world - world
293
+ * @param hertz - joint stiffness frequency in hertz
294
+ * @param damping_ratio - joint damping ratio
295
+ */
296
+ function set_joint_tuning(world: Opaque<"b2World">, hertz: number, damping_ratio: number): void;
297
+ /**
298
+ * Set the maximum linear speed.
299
+ *
300
+ * @param world - world
301
+ * @param speed - maximum linear speed in project units per second
302
+ */
303
+ function set_maximum_linear_speed(world: Opaque<"b2World">, speed: number): void;
304
+ /**
305
+ * Collisions below this relative speed use inelastic collision response.
306
+ *
307
+ * @param world - world
308
+ * @param threshold - restitution threshold in project units per second
309
+ */
310
+ function set_restitution_threshold(world: Opaque<"b2World">, threshold: number): void;
311
+ }
312
+ }
313
+
314
+ export {};
@@ -142,7 +142,7 @@ declare global {
142
142
  * if (values) print(`${values.length} values in 'somefloats'`);
143
143
  * ```
144
144
  */
145
- function get_metadata(buf: Opaque<"buffer">, metadata_name: Hash | string): LuaMultiReturn<[number[] | unknown, Opaque<"constant"> | unknown]>;
145
+ function get_metadata(buf: Opaque<"buffer">, metadata_name: Hash | string): LuaMultiReturn<[number[] | undefined, Opaque<"constant"> | undefined]>;
146
146
  /**
147
147
  * Get a specified stream from a buffer.
148
148
  *
@@ -2,17 +2,22 @@ import type { Hash, Matrix4, Vector3, Vector4 } from "../src/core-types";
2
2
 
3
3
  declare global {
4
4
  interface BuiltinMessages {
5
+ /** @deprecated since 1.13.0 */
6
+ acquire_camera_focus: Record<string, never>;
5
7
  acquire_input_focus: Record<string, never>;
6
8
  animation_done: { current_tile: number; id: Hash };
7
9
  apply_force: { force: Vector3; position: Vector3 };
8
10
  async_load: Record<string, never>;
9
11
  clear_color: { color: Vector4 };
12
+ collision_event: { a: Record<string | number, unknown>; b: Record<string | number, unknown> };
10
13
  collision_response: { other_id: Hash; other_position: Vector3; other_group: Hash; own_group: Hash };
14
+ contact_point_event: { applied_impulse: number; distance: number; a: Record<string | number, unknown>; b: Record<string | number, unknown> };
11
15
  contact_point_response: { position: Vector3; normal: Vector3; relative_velocity: Vector3; distance: number; applied_impulse: number; life_time: number; mass: number; other_mass: number; other_id: Hash; other_position: Vector3; other_group: Hash; own_group: Hash };
12
16
  disable: Record<string, never>;
13
17
  draw_debug_text: { position: Vector3; text: string; color: Vector4 };
14
18
  draw_line: { start_point: Vector3; end_point: Vector3; color: Vector4 };
15
19
  enable: Record<string, never>;
20
+ exit: { code: number };
16
21
  final: Record<string, never>;
17
22
  init: Record<string, never>;
18
23
  layout_changed: { id: Hash; previous_id: Hash };
@@ -24,14 +29,27 @@ declare global {
24
29
  proxy_unloaded: Record<string, never>;
25
30
  ray_cast_missed: { group: Hash; request_id: number };
26
31
  ray_cast_response: { fraction: number; position: Vector3; normal: Vector3; id: Hash; group: Hash; request_id: number };
32
+ reboot: { arg1: string; arg2: string; arg3: string; arg4: string; arg5: string; arg6: string };
33
+ /** @deprecated since 1.13.0 */
34
+ release_camera_focus: Record<string, never>;
27
35
  release_input_focus: Record<string, never>;
36
+ resize: { height: number; width: number };
37
+ resume_rendering: Record<string, never>;
38
+ set_camera: { aspect_ratio: number; fov: number; near_z: number; far_z: number; orthographic_projection: boolean; orthographic_zoom: number; orthographic_mode: number };
28
39
  set_gain: { gain: number };
29
40
  set_parent: { parent_id?: Hash; keep_world_transform?: 0 | 1 };
30
41
  set_time_step: { factor: number; mode: number };
42
+ set_update_frequency: { frequency: number };
31
43
  set_view_projection: { id: Hash; view: Matrix4; projection: Matrix4 };
44
+ set_vsync: { swap_interval: number };
32
45
  sound_done: { play_id: number };
33
46
  sound_stopped: { play_id: number };
47
+ start_record: { file_name: string; frame_period: number; fps: number };
48
+ stop_record: Record<string, never>;
34
49
  stop_sound: Record<string, never>;
50
+ toggle_physics_debug: Record<string, never>;
51
+ toggle_profile: Record<string, never>;
52
+ trigger_event: { enter: boolean; a: Record<string | number, unknown>; b: Record<string | number, unknown> };
35
53
  trigger_response: { other_id: Hash; enter: boolean; other_group: Hash; own_group: Hash };
36
54
  unload: Record<string, never>;
37
55
  window_resized: { height: number; width: number };