@defold-typescript/types 0.39.0 → 0.41.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.
- package/api-availability.json +4024 -716
- package/api-migrations.json +27 -0
- package/api-signatures.json +18118 -10264
- package/api-targets.json +448 -11
- package/examples/translations.json +619 -148
- package/fixtures/messages_doc.json +96 -0
- package/generated/b2d.d.ts +680 -4
- package/generated/b2d_body.d.ts +29 -103
- package/generated/b2d_chain.d.ts +5 -6
- package/generated/b2d_fixture.d.ts +34 -38
- package/generated/b2d_joint.d.ts +503 -25
- package/generated/b2d_shape.d.ts +199 -14
- package/generated/b2d_world.d.ts +57 -63
- package/generated/buffer.d.ts +33 -29
- package/generated/builtin-messages.d.ts +7 -1
- package/generated/bullet3d.d.ts +91 -0
- package/generated/bullet3d_collision_object.d.ts +433 -0
- package/generated/bullet3d_constraint.d.ts +818 -0
- package/generated/bullet3d_rigid_body.d.ts +429 -0
- package/generated/bullet3d_shape.d.ts +123 -0
- package/generated/bullet3d_world.d.ts +492 -0
- package/generated/camera.d.ts +31 -34
- package/generated/collectionfactory.d.ts +26 -27
- package/generated/collectionproxy.d.ts +22 -6
- package/generated/compute.d.ts +12 -238
- package/generated/crash.d.ts +24 -10
- package/generated/editor-vm/http.d.ts +90 -7
- package/generated/editor-vm/image.d.ts +7 -7
- package/generated/editor-vm/json.d.ts +11 -0
- package/generated/editor-vm/localization.d.ts +7 -7
- package/generated/editor-vm/tilemap_tiles.d.ts +56 -10
- package/generated/editor-vm/zip.d.ts +28 -0
- package/generated/editor.d.ts +1496 -430
- package/generated/factory.d.ts +21 -25
- package/generated/font.d.ts +64 -22
- package/generated/go.d.ts +243 -186
- package/generated/graphics.d.ts +374 -84
- package/generated/gui.d.ts +282 -492
- package/generated/html5.d.ts +5 -3
- package/generated/http.d.ts +31 -36
- package/generated/image.d.ts +127 -85
- package/generated/json.d.ts +34 -16
- package/generated/kinds/gui-script.d.ts +8 -0
- package/generated/kinds/render-script.d.ts +8 -0
- package/generated/kinds/script.d.ts +8 -0
- package/generated/label.d.ts +77 -7
- package/generated/liveupdate.d.ts +13 -10
- package/generated/material.d.ts +312 -360
- package/generated/model.d.ts +72 -42
- package/generated/particlefx.d.ts +19 -28
- package/generated/physics.d.ts +378 -144
- package/generated/profiler.d.ts +14 -24
- package/generated/render.d.ts +294 -297
- package/generated/resource.d.ts +753 -641
- package/generated/socket.d.ts +131 -134
- package/generated/sound.d.ts +65 -34
- package/generated/sprite.d.ts +39 -17
- package/generated/sys.d.ts +237 -182
- package/generated/tilemap.d.ts +21 -16
- package/generated/timer.d.ts +34 -21
- package/generated/versions/defold-1.12.4/b2d_body.d.ts +0 -7
- package/generated/versions/defold-1.12.4/buffer.d.ts +18 -17
- package/generated/versions/defold-1.12.4/camera.d.ts +23 -23
- package/generated/versions/defold-1.12.4/collectionfactory.d.ts +21 -19
- package/generated/versions/defold-1.12.4/collectionproxy.d.ts +2 -2
- package/generated/versions/defold-1.12.4/crash.d.ts +2 -2
- package/generated/versions/defold-1.12.4/factory.d.ts +15 -16
- package/generated/versions/defold-1.12.4/go.d.ts +15 -17
- package/generated/versions/defold-1.12.4/gui.d.ts +111 -193
- package/generated/versions/defold-1.12.4/html5.d.ts +4 -2
- package/generated/versions/defold-1.12.4/http.d.ts +4 -15
- package/generated/versions/defold-1.12.4/image.d.ts +38 -46
- package/generated/versions/defold-1.12.4/index.d.ts +2 -0
- package/generated/versions/defold-1.12.4/json.d.ts +10 -6
- package/generated/versions/defold-1.12.4/label.d.ts +2 -3
- package/generated/versions/defold-1.12.4/liveupdate.d.ts +5 -3
- package/generated/versions/defold-1.12.4/model.d.ts +34 -13
- package/generated/versions/defold-1.12.4/particlefx.d.ts +2 -5
- package/generated/versions/defold-1.12.4/physics.d.ts +82 -78
- package/generated/versions/defold-1.12.4/profiler.d.ts +3 -6
- package/generated/versions/defold-1.12.4/render.d.ts +160 -132
- package/generated/versions/defold-1.12.4/resource.d.ts +212 -209
- package/generated/versions/defold-1.12.4/socket.d.ts +45 -61
- package/generated/versions/defold-1.12.4/sound.d.ts +11 -11
- package/generated/versions/defold-1.12.4/sprite.d.ts +24 -6
- package/generated/versions/defold-1.12.4/sys.d.ts +45 -68
- package/generated/versions/defold-1.12.4/tilemap.d.ts +18 -11
- package/generated/versions/defold-1.12.4/timer.d.ts +5 -3
- package/generated/versions/defold-1.12.4/vmath.d.ts +5 -26
- package/generated/versions/defold-1.12.4/window.d.ts +1 -16
- package/generated/versions/defold-1.13.0/b2d_body.d.ts +10 -55
- package/generated/versions/defold-1.13.0/b2d_fixture.d.ts +25 -25
- package/generated/versions/defold-1.13.0/b2d_shape.d.ts +188 -5
- package/generated/versions/defold-1.13.0/b2d_world.d.ts +16 -10
- package/generated/versions/defold-1.13.0/buffer.d.ts +18 -17
- package/generated/versions/defold-1.13.0/camera.d.ts +27 -27
- package/generated/versions/defold-1.13.0/collectionfactory.d.ts +21 -19
- package/generated/versions/defold-1.13.0/collectionproxy.d.ts +2 -2
- package/generated/versions/defold-1.13.0/compute.d.ts +1 -70
- package/generated/versions/defold-1.13.0/crash.d.ts +2 -2
- package/generated/versions/defold-1.13.0/editor-vm/tilemap_tiles.d.ts +3 -3
- package/generated/versions/defold-1.13.0/editor.d.ts +34 -24
- package/generated/versions/defold-1.13.0/factory.d.ts +15 -16
- package/generated/versions/defold-1.13.0/go.d.ts +15 -17
- package/generated/versions/defold-1.13.0/graphics.d.ts +121 -37
- package/generated/versions/defold-1.13.0/gui.d.ts +111 -193
- package/generated/versions/defold-1.13.0/html5.d.ts +4 -2
- package/generated/versions/defold-1.13.0/http.d.ts +4 -15
- package/generated/versions/defold-1.13.0/image.d.ts +38 -46
- package/generated/versions/defold-1.13.0/index.d.ts +2 -0
- package/generated/versions/defold-1.13.0/json.d.ts +10 -6
- package/generated/versions/defold-1.13.0/label.d.ts +2 -3
- package/generated/versions/defold-1.13.0/liveupdate.d.ts +7 -5
- package/generated/versions/defold-1.13.0/material.d.ts +69 -107
- package/generated/versions/defold-1.13.0/model.d.ts +34 -13
- package/generated/versions/defold-1.13.0/particlefx.d.ts +2 -5
- package/generated/versions/defold-1.13.0/physics.d.ts +82 -78
- package/generated/versions/defold-1.13.0/profiler.d.ts +3 -6
- package/generated/versions/defold-1.13.0/render.d.ts +160 -132
- package/generated/versions/defold-1.13.0/resource.d.ts +217 -210
- package/generated/versions/defold-1.13.0/socket.d.ts +45 -61
- package/generated/versions/defold-1.13.0/sound.d.ts +11 -11
- package/generated/versions/defold-1.13.0/sprite.d.ts +24 -6
- package/generated/versions/defold-1.13.0/sys.d.ts +45 -68
- package/generated/versions/defold-1.13.0/tilemap.d.ts +18 -11
- package/generated/versions/defold-1.13.0/timer.d.ts +5 -3
- package/generated/versions/defold-1.13.0/vmath.d.ts +5 -26
- package/generated/versions/defold-1.13.0/window.d.ts +1 -16
- package/generated/versions/defold-1.13.1/b2d.d.ts +33 -0
- package/generated/versions/defold-1.13.1/b2d_body.d.ts +636 -0
- package/generated/versions/defold-1.13.1/b2d_chain.d.ts +106 -0
- package/generated/versions/defold-1.13.1/b2d_fixture.d.ts +157 -0
- package/generated/versions/defold-1.13.1/b2d_joint.d.ts +823 -0
- package/generated/versions/defold-1.13.1/b2d_shape.d.ts +400 -0
- package/generated/versions/defold-1.13.1/b2d_world.d.ts +320 -0
- package/generated/versions/defold-1.13.1/buffer.d.ts +189 -0
- package/generated/versions/defold-1.13.1/camera.d.ts +303 -0
- package/generated/versions/defold-1.13.1/collectionfactory.d.ts +151 -0
- package/generated/versions/defold-1.13.1/collectionproxy.d.ts +93 -0
- package/generated/versions/defold-1.13.1/compute.d.ts +237 -0
- package/generated/versions/defold-1.13.1/crash.d.ts +143 -0
- package/generated/versions/defold-1.13.1/editor-vm/http.d.ts +56 -0
- package/generated/versions/defold-1.13.1/editor-vm/image.d.ts +48 -0
- package/generated/versions/defold-1.13.1/editor-vm/json.d.ts +10 -0
- package/generated/versions/defold-1.13.1/editor-vm/localization.d.ts +42 -0
- package/generated/versions/defold-1.13.1/editor-vm/tilemap_tiles.d.ts +80 -0
- package/generated/versions/defold-1.13.1/editor-vm/zip.d.ts +10 -0
- package/generated/versions/defold-1.13.1/editor-vm/zlib.d.ts +24 -0
- package/generated/versions/defold-1.13.1/editor.d.ts +1121 -0
- package/generated/versions/defold-1.13.1/factory.d.ts +124 -0
- package/generated/versions/defold-1.13.1/font.d.ts +81 -0
- package/generated/versions/defold-1.13.1/go.d.ts +1107 -0
- package/generated/versions/defold-1.13.1/graphics.d.ts +411 -0
- package/generated/versions/defold-1.13.1/gui.d.ts +2353 -0
- package/generated/versions/defold-1.13.1/html5.d.ts +55 -0
- package/generated/versions/defold-1.13.1/http.d.ts +77 -0
- package/generated/versions/defold-1.13.1/image.d.ts +131 -0
- package/generated/versions/defold-1.13.1/index.d.ts +57 -0
- package/generated/versions/defold-1.13.1/json.d.ts +80 -0
- package/generated/versions/defold-1.13.1/kinds/editor-script.d.ts +14 -0
- package/generated/versions/defold-1.13.1/label.d.ts +93 -0
- package/generated/versions/defold-1.13.1/liveupdate.d.ts +142 -0
- package/generated/versions/defold-1.13.1/material.d.ts +408 -0
- package/generated/versions/defold-1.13.1/model.d.ts +272 -0
- package/generated/versions/defold-1.13.1/msg.d.ts +10 -0
- package/generated/versions/defold-1.13.1/particlefx.d.ts +163 -0
- package/generated/versions/defold-1.13.1/physics.d.ts +559 -0
- package/generated/versions/defold-1.13.1/profiler.d.ts +235 -0
- package/generated/versions/defold-1.13.1/render.d.ts +1190 -0
- package/generated/versions/defold-1.13.1/resource.d.ts +1523 -0
- package/generated/versions/defold-1.13.1/socket.d.ts +784 -0
- package/generated/versions/defold-1.13.1/sound.d.ts +292 -0
- package/generated/versions/defold-1.13.1/sprite.d.ts +175 -0
- package/generated/versions/defold-1.13.1/sys.d.ts +678 -0
- package/generated/versions/defold-1.13.1/tilemap.d.ts +208 -0
- package/generated/versions/defold-1.13.1/timer.d.ts +125 -0
- package/generated/versions/defold-1.13.1/types.d.ts +61 -0
- package/generated/versions/defold-1.13.1/vmath.d.ts +774 -0
- package/generated/versions/defold-1.13.1/window.d.ts +183 -0
- package/generated/versions/defold-1.13.1/zlib.d.ts +41 -0
- package/generated/vmath.d.ts +6 -26
- package/generated/window.d.ts +71 -71
- package/identity-vocabulary.json +561 -0
- package/index.d.ts +8 -0
- package/package.json +13 -2
- package/scripts/example-store-io.ts +12 -1
- package/scripts/extension-goldens.ts +1 -0
- package/scripts/fidelity-baseline.json +146 -46
- package/scripts/generate-api-availability.ts +90 -12
- package/scripts/generate-api-signatures.ts +14 -3
- package/scripts/import-defold-release.ts +85 -24
- package/scripts/prose-constants.ts +157 -0
- package/scripts/regen.ts +396 -78
- package/scripts/shared-handle-methods.ts +53 -0
- package/scripts/signature-store-fs.ts +1 -0
- package/scripts/sync-api-docs.ts +16 -5
- package/src/api-availability.ts +0 -0
- package/src/api-doc.ts +201 -3
- package/src/api-identity.ts +252 -0
- package/src/component-properties.d.ts +33 -0
- package/src/core-types.ts +28 -3
- package/src/correction-pins.ts +49 -0
- package/src/custom-messages.d.ts +4 -3
- package/src/doc-comment.ts +139 -23
- package/src/doc-corrections.ts +108 -0
- package/src/editor-vm-globals.d.ts +5 -2
- package/src/emit-dts.ts +2474 -281
- package/src/emit-messages.ts +52 -0
- package/src/engine-globals.d.ts +2 -2
- package/src/example-store.ts +125 -14
- package/src/field-correction-coverage.ts +204 -0
- package/src/fnv1a.ts +16 -0
- package/src/go-overloads.d.ts +33 -13
- package/src/index-base-table.ts +145 -0
- package/src/index-slot-classifications.ts +588 -0
- package/src/index.ts +39 -2
- package/src/library-index-slot-classifications.ts +332 -0
- package/src/lifecycle.ts +61 -199
- package/src/luals-type-expr.ts +354 -0
- package/src/msg-overloads.d.ts +0 -1
- package/src/param-correction-provenance.ts +64 -0
- package/src/return-correction-provenance.ts +58 -16
- package/src/script-api.ts +3 -1
- package/src/sys-overloads.d.ts +48 -0
- package/src/vmath-overloads.d.ts +27 -1
- package/src/window-event-guard.d.ts +6 -9
- package/url-parameters.json +1 -2
|
@@ -47,6 +47,14 @@ declare global {
|
|
|
47
47
|
* @returns true if contact events are enabled
|
|
48
48
|
*/
|
|
49
49
|
function are_contact_events_enabled(shape_id: Opaque<"b2Shape">): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Check if contact events are enabled for a shape.
|
|
52
|
+
*
|
|
53
|
+
* @param body - The body that owns the shape.
|
|
54
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
55
|
+
* @returns true if contact events are enabled
|
|
56
|
+
*/
|
|
57
|
+
function are_contact_events_enabled(body: Opaque<"b2Body">, shape_index: number): boolean;
|
|
50
58
|
/**
|
|
51
59
|
* Check if hit events are enabled for a shape.
|
|
52
60
|
*
|
|
@@ -54,6 +62,14 @@ declare global {
|
|
|
54
62
|
* @returns true if hit events are enabled
|
|
55
63
|
*/
|
|
56
64
|
function are_hit_events_enabled(shape_id: Opaque<"b2Shape">): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Check if hit events are enabled for a shape.
|
|
67
|
+
*
|
|
68
|
+
* @param body - The body that owns the shape.
|
|
69
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
70
|
+
* @returns true if hit events are enabled
|
|
71
|
+
*/
|
|
72
|
+
function are_hit_events_enabled(body: Opaque<"b2Body">, shape_index: number): boolean;
|
|
57
73
|
/**
|
|
58
74
|
* Check if pre-solve events are enabled for a shape.
|
|
59
75
|
*
|
|
@@ -61,6 +77,14 @@ declare global {
|
|
|
61
77
|
* @returns true if pre-solve events are enabled
|
|
62
78
|
*/
|
|
63
79
|
function are_pre_solve_events_enabled(shape_id: Opaque<"b2Shape">): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Check if pre-solve events are enabled for a shape.
|
|
82
|
+
*
|
|
83
|
+
* @param body - The body that owns the shape.
|
|
84
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
85
|
+
* @returns true if pre-solve events are enabled
|
|
86
|
+
*/
|
|
87
|
+
function are_pre_solve_events_enabled(body: Opaque<"b2Body">, shape_index: number): boolean;
|
|
64
88
|
/**
|
|
65
89
|
* Check if sensor events are enabled for a shape.
|
|
66
90
|
*
|
|
@@ -68,6 +92,14 @@ declare global {
|
|
|
68
92
|
* @returns true if sensor events are enabled
|
|
69
93
|
*/
|
|
70
94
|
function are_sensor_events_enabled(shape_id: Opaque<"b2Shape">): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Check if sensor events are enabled for a shape.
|
|
97
|
+
*
|
|
98
|
+
* @param body - The body that owns the shape.
|
|
99
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
100
|
+
* @returns true if sensor events are enabled
|
|
101
|
+
*/
|
|
102
|
+
function are_sensor_events_enabled(body: Opaque<"b2Body">, shape_index: number): boolean;
|
|
71
103
|
/**
|
|
72
104
|
* Enable or disable contact events for a shape.
|
|
73
105
|
*
|
|
@@ -75,6 +107,14 @@ declare global {
|
|
|
75
107
|
* @param enable - true to enable contact events
|
|
76
108
|
*/
|
|
77
109
|
function enable_contact_events(shape_id: Opaque<"b2Shape">, enable: boolean): void;
|
|
110
|
+
/**
|
|
111
|
+
* Enable or disable contact events for a shape.
|
|
112
|
+
*
|
|
113
|
+
* @param body - The body that owns the shape.
|
|
114
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
115
|
+
* @param enable - true to enable contact events
|
|
116
|
+
*/
|
|
117
|
+
function enable_contact_events(body: Opaque<"b2Body">, shape_index: number, enable: boolean): void;
|
|
78
118
|
/**
|
|
79
119
|
* Enable or disable hit events for a shape.
|
|
80
120
|
*
|
|
@@ -82,6 +122,14 @@ declare global {
|
|
|
82
122
|
* @param enable - true to enable hit events
|
|
83
123
|
*/
|
|
84
124
|
function enable_hit_events(shape_id: Opaque<"b2Shape">, enable: boolean): void;
|
|
125
|
+
/**
|
|
126
|
+
* Enable or disable hit events for a shape.
|
|
127
|
+
*
|
|
128
|
+
* @param body - The body that owns the shape.
|
|
129
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
130
|
+
* @param enable - true to enable hit events
|
|
131
|
+
*/
|
|
132
|
+
function enable_hit_events(body: Opaque<"b2Body">, shape_index: number, enable: boolean): void;
|
|
85
133
|
/**
|
|
86
134
|
* Enable or disable pre-solve events for a shape.
|
|
87
135
|
*
|
|
@@ -89,6 +137,14 @@ declare global {
|
|
|
89
137
|
* @param enable - true to enable pre-solve events
|
|
90
138
|
*/
|
|
91
139
|
function enable_pre_solve_events(shape_id: Opaque<"b2Shape">, enable: boolean): void;
|
|
140
|
+
/**
|
|
141
|
+
* Enable or disable pre-solve events for a shape.
|
|
142
|
+
*
|
|
143
|
+
* @param body - The body that owns the shape.
|
|
144
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
145
|
+
* @param enable - true to enable pre-solve events
|
|
146
|
+
*/
|
|
147
|
+
function enable_pre_solve_events(body: Opaque<"b2Body">, shape_index: number, enable: boolean): void;
|
|
92
148
|
/**
|
|
93
149
|
* Enable or disable sensor events for a shape.
|
|
94
150
|
*
|
|
@@ -96,6 +152,14 @@ declare global {
|
|
|
96
152
|
* @param enable - true to enable sensor events
|
|
97
153
|
*/
|
|
98
154
|
function enable_sensor_events(shape_id: Opaque<"b2Shape">, enable: boolean): void;
|
|
155
|
+
/**
|
|
156
|
+
* Enable or disable sensor events for a shape.
|
|
157
|
+
*
|
|
158
|
+
* @param body - The body that owns the shape.
|
|
159
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
160
|
+
* @param enable - true to enable sensor events
|
|
161
|
+
*/
|
|
162
|
+
function enable_sensor_events(body: Opaque<"b2Body">, shape_index: number, enable: boolean): void;
|
|
99
163
|
/**
|
|
100
164
|
* Get the body owning a shape.
|
|
101
165
|
*
|
|
@@ -103,6 +167,14 @@ declare global {
|
|
|
103
167
|
* @returns owning body
|
|
104
168
|
*/
|
|
105
169
|
function get_body(shape_id: Opaque<"b2Shape">): Opaque<"b2Body">;
|
|
170
|
+
/**
|
|
171
|
+
* Get the body owning a shape.
|
|
172
|
+
*
|
|
173
|
+
* @param body - The body that owns the shape.
|
|
174
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
175
|
+
* @returns owning body
|
|
176
|
+
*/
|
|
177
|
+
function get_body(body: Opaque<"b2Body">, shape_index: number): Opaque<"b2Body">;
|
|
106
178
|
/**
|
|
107
179
|
* Get the closest point on a shape.
|
|
108
180
|
*
|
|
@@ -111,6 +183,15 @@ declare global {
|
|
|
111
183
|
* @returns closest world point on the shape
|
|
112
184
|
*/
|
|
113
185
|
function get_closest_point(shape_id: Opaque<"b2Shape">, target: Vector3): Vector3;
|
|
186
|
+
/**
|
|
187
|
+
* Get the closest point on a shape.
|
|
188
|
+
*
|
|
189
|
+
* @param body - The body that owns the shape.
|
|
190
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
191
|
+
* @param target - world target point
|
|
192
|
+
* @returns closest world point on the shape
|
|
193
|
+
*/
|
|
194
|
+
function get_closest_point(body: Opaque<"b2Body">, shape_index: number, target: Vector3): Vector3;
|
|
114
195
|
/**
|
|
115
196
|
* Get shape contact capacity.
|
|
116
197
|
*
|
|
@@ -118,6 +199,14 @@ declare global {
|
|
|
118
199
|
* @returns maximum contact data count
|
|
119
200
|
*/
|
|
120
201
|
function get_contact_capacity(shape_id: Opaque<"b2Shape">): number;
|
|
202
|
+
/**
|
|
203
|
+
* Get shape contact capacity.
|
|
204
|
+
*
|
|
205
|
+
* @param body - The body that owns the shape.
|
|
206
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
207
|
+
* @returns maximum contact data count
|
|
208
|
+
*/
|
|
209
|
+
function get_contact_capacity(body: Opaque<"b2Body">, shape_index: number): number;
|
|
121
210
|
/**
|
|
122
211
|
* Get touching contact data for a shape.
|
|
123
212
|
*
|
|
@@ -125,6 +214,14 @@ declare global {
|
|
|
125
214
|
* @returns array of contact tables
|
|
126
215
|
*/
|
|
127
216
|
function get_contact_data(shape_id: Opaque<"b2Shape">): Record<string | number, unknown>;
|
|
217
|
+
/**
|
|
218
|
+
* Get touching contact data for a shape.
|
|
219
|
+
*
|
|
220
|
+
* @param body - The body that owns the shape.
|
|
221
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
222
|
+
* @returns array of contact tables
|
|
223
|
+
*/
|
|
224
|
+
function get_contact_data(body: Opaque<"b2Body">, shape_index: number): Record<string | number, unknown>;
|
|
128
225
|
/**
|
|
129
226
|
* Get mass data for a shape.
|
|
130
227
|
*
|
|
@@ -132,6 +229,14 @@ declare global {
|
|
|
132
229
|
* @returns table with `mass`, `center`, and `inertia`
|
|
133
230
|
*/
|
|
134
231
|
function get_mass_data(shape_id: Opaque<"b2Shape">): { mass: number; center: Vector3; inertia: number };
|
|
232
|
+
/**
|
|
233
|
+
* Get mass data for a shape.
|
|
234
|
+
*
|
|
235
|
+
* @param body - The body that owns the shape.
|
|
236
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
237
|
+
* @returns table with `mass`, `center`, and `inertia`
|
|
238
|
+
*/
|
|
239
|
+
function get_mass_data(body: Opaque<"b2Body">, shape_index: number): { mass: number; center: Vector3; inertia: number };
|
|
135
240
|
/**
|
|
136
241
|
* Get shape material id.
|
|
137
242
|
*
|
|
@@ -139,6 +244,14 @@ declare global {
|
|
|
139
244
|
* @returns shape material id
|
|
140
245
|
*/
|
|
141
246
|
function get_material(shape_id: Opaque<"b2Shape">): number;
|
|
247
|
+
/**
|
|
248
|
+
* Get shape material id.
|
|
249
|
+
*
|
|
250
|
+
* @param body - The body that owns the shape.
|
|
251
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
252
|
+
* @returns shape material id
|
|
253
|
+
*/
|
|
254
|
+
function get_material(body: Opaque<"b2Body">, shape_index: number): number;
|
|
142
255
|
/**
|
|
143
256
|
* Get sensor overlap capacity.
|
|
144
257
|
*
|
|
@@ -146,6 +259,14 @@ declare global {
|
|
|
146
259
|
* @returns maximum sensor overlap count
|
|
147
260
|
*/
|
|
148
261
|
function get_sensor_capacity(shape_id: Opaque<"b2Shape">): number;
|
|
262
|
+
/**
|
|
263
|
+
* Get sensor overlap capacity.
|
|
264
|
+
*
|
|
265
|
+
* @param body - The body that owns the shape.
|
|
266
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
267
|
+
* @returns maximum sensor overlap count
|
|
268
|
+
*/
|
|
269
|
+
function get_sensor_capacity(body: Opaque<"b2Body">, shape_index: number): number;
|
|
149
270
|
/**
|
|
150
271
|
* Get sensor overlaps.
|
|
151
272
|
*
|
|
@@ -153,13 +274,29 @@ declare global {
|
|
|
153
274
|
* @returns array of shape info tables
|
|
154
275
|
*/
|
|
155
276
|
function get_sensor_overlaps(shape_id: Opaque<"b2Shape">): { shape_id: number }[];
|
|
277
|
+
/**
|
|
278
|
+
* Get sensor overlaps.
|
|
279
|
+
*
|
|
280
|
+
* @param body - The body that owns the shape.
|
|
281
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
282
|
+
* @returns array of shape info tables
|
|
283
|
+
*/
|
|
284
|
+
function get_sensor_overlaps(body: Opaque<"b2Body">, shape_index: number): { shape_id: number }[];
|
|
156
285
|
/**
|
|
157
286
|
* Get a shape's geometry.
|
|
158
287
|
*
|
|
159
288
|
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
160
289
|
* @returns shape table with numeric `type` from `b2d.shape.SHAPE_TYPE_*`
|
|
161
290
|
*/
|
|
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 };
|
|
291
|
+
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; center1?: Vector3; center2?: Vector3 };
|
|
292
|
+
/**
|
|
293
|
+
* Get a shape's geometry.
|
|
294
|
+
*
|
|
295
|
+
* @param body - The body that owns the shape.
|
|
296
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
297
|
+
* @returns shape table with numeric `type` from `b2d.shape.SHAPE_TYPE_*`
|
|
298
|
+
*/
|
|
299
|
+
function get_shape(body: Opaque<"b2Body">, shape_index: number): { 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; center1?: Vector3; center2?: Vector3 };
|
|
163
300
|
/**
|
|
164
301
|
* Get the world owning a shape.
|
|
165
302
|
*
|
|
@@ -167,6 +304,14 @@ declare global {
|
|
|
167
304
|
* @returns owning world
|
|
168
305
|
*/
|
|
169
306
|
function get_world(shape_id: Opaque<"b2Shape">): Opaque<"b2World">;
|
|
307
|
+
/**
|
|
308
|
+
* Get the world owning a shape.
|
|
309
|
+
*
|
|
310
|
+
* @param body - The body that owns the shape.
|
|
311
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
312
|
+
* @returns owning world
|
|
313
|
+
*/
|
|
314
|
+
function get_world(body: Opaque<"b2Body">, shape_index: number): Opaque<"b2World">;
|
|
170
315
|
/**
|
|
171
316
|
* Validate a shape handle.
|
|
172
317
|
*
|
|
@@ -174,6 +319,14 @@ declare global {
|
|
|
174
319
|
* @returns true if the shape handle still refers to a live Box2D shape
|
|
175
320
|
*/
|
|
176
321
|
function is_valid(shape_id: Opaque<"b2Shape">): boolean;
|
|
322
|
+
/**
|
|
323
|
+
* Validate a shape handle.
|
|
324
|
+
*
|
|
325
|
+
* @param body - The body that owns the shape.
|
|
326
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
327
|
+
* @returns true if the shape handle still refers to a live Box2D shape
|
|
328
|
+
*/
|
|
329
|
+
function is_valid(body: Opaque<"b2Body">, shape_index: number): boolean;
|
|
177
330
|
/**
|
|
178
331
|
* Ray cast a shape directly.
|
|
179
332
|
*
|
|
@@ -183,7 +336,18 @@ declare global {
|
|
|
183
336
|
* @param max_fraction - optional maximum translation fraction, defaults to 1
|
|
184
337
|
* @returns hit table with `point`, `normal`, `fraction`, and `iterations`, or nil
|
|
185
338
|
*/
|
|
186
|
-
function ray_cast(shape_id: Opaque<"b2Shape">, origin: Vector3, translation: Vector3, max_fraction?: number): { point: Vector3; normal: Vector3; fraction: number; iterations: number };
|
|
339
|
+
function ray_cast(shape_id: Opaque<"b2Shape">, origin: Vector3, translation: Vector3, max_fraction?: number): { point: Vector3; normal: Vector3; fraction: number; iterations: number } | undefined;
|
|
340
|
+
/**
|
|
341
|
+
* Ray cast a shape directly.
|
|
342
|
+
*
|
|
343
|
+
* @param body - The body that owns the shape.
|
|
344
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
345
|
+
* @param origin - world ray origin
|
|
346
|
+
* @param translation - world ray translation
|
|
347
|
+
* @param max_fraction - optional maximum translation fraction, defaults to 1
|
|
348
|
+
* @returns hit table with `point`, `normal`, `fraction`, and `iterations`, or nil
|
|
349
|
+
*/
|
|
350
|
+
function ray_cast(body: Opaque<"b2Body">, shape_index: number, origin: Vector3, translation: Vector3, max_fraction?: number): { point: Vector3; normal: Vector3; fraction: number; iterations: number } | undefined;
|
|
187
351
|
/**
|
|
188
352
|
* Set shape material id.
|
|
189
353
|
*
|
|
@@ -191,6 +355,14 @@ declare global {
|
|
|
191
355
|
* @param material - shape material id
|
|
192
356
|
*/
|
|
193
357
|
function set_material(shape_id: Opaque<"b2Shape">, material: number): void;
|
|
358
|
+
/**
|
|
359
|
+
* Set shape material id.
|
|
360
|
+
*
|
|
361
|
+
* @param body - The body that owns the shape.
|
|
362
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
363
|
+
* @param material - shape material id
|
|
364
|
+
*/
|
|
365
|
+
function set_material(body: Opaque<"b2Body">, shape_index: number, material: number): void;
|
|
194
366
|
/**
|
|
195
367
|
* This updates the shape geometry using the same table format as
|
|
196
368
|
* `b2d.body.create_shape` and `b2d.shape.get_shape`. The body mass is not
|
|
@@ -204,13 +376,24 @@ declare global {
|
|
|
204
376
|
* const body = b2d.get_body("#collisionobject");
|
|
205
377
|
* if (body !== undefined) {
|
|
206
378
|
* const circle = b2d.shape.get_shape(body, 1);
|
|
207
|
-
*
|
|
208
|
-
* b2d.shape.set_shape(body, 1,
|
|
379
|
+
* const radius = "radius" in circle ? circle.radius : undefined;
|
|
380
|
+
* b2d.shape.set_shape(body, 1, { type: b2d.shape.SHAPE_TYPE_CIRCLE, radius: radius ?? 16, center: vmath.vector3(24, 0, 0) }, true);
|
|
209
381
|
* b2d.shape.set_shape(body, 2, { type: b2d.shape.SHAPE_TYPE_SEGMENT, v1: vmath.vector3(-32, 0, 0), v2: vmath.vector3(32, 0, 0) });
|
|
210
382
|
* }
|
|
211
383
|
* ```
|
|
212
384
|
*/
|
|
213
|
-
function set_shape(shape_id: Opaque<"b2Shape">, definition: { type
|
|
385
|
+
function set_shape(shape_id: Opaque<"b2Shape">, definition: { type: typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_BOX; hx: number; hy: number; center?: Vector3; angle?: number } | { type: typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_BOX; vertices: Vector3[] } | { type: typeof b2d.shape.SHAPE_TYPE_CIRCLE; radius: number; center?: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_CAPSULE; radius: number; center1: Vector3; center2: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_EDGE | typeof b2d.shape.SHAPE_TYPE_SEGMENT; v1: Vector3; v2: Vector3 }, update_mass?: boolean): void;
|
|
386
|
+
/**
|
|
387
|
+
* This updates the shape geometry using the same table format as
|
|
388
|
+
* `b2d.body.create_shape` and `b2d.shape.get_shape`. The body mass is not
|
|
389
|
+
* updated unless `update_mass` is true.
|
|
390
|
+
*
|
|
391
|
+
* @param body - The body that owns the shape.
|
|
392
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
393
|
+
* @param definition - shape table with numeric `type` from `b2d.shape.SHAPE_TYPE_*`
|
|
394
|
+
* @param update_mass - true to reset body mass from shapes
|
|
395
|
+
*/
|
|
396
|
+
function set_shape(body: Opaque<"b2Body">, shape_index: number, definition: { type: typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_BOX; hx: number; hy: number; center?: Vector3; angle?: number } | { type: typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_BOX; vertices: Vector3[] } | { type: typeof b2d.shape.SHAPE_TYPE_CIRCLE; radius: number; center?: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_CAPSULE; radius: number; center1: Vector3; center2: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_EDGE | typeof b2d.shape.SHAPE_TYPE_SEGMENT; v1: Vector3; v2: Vector3 }, update_mass?: boolean): void;
|
|
214
397
|
}
|
|
215
398
|
}
|
|
216
399
|
|
|
@@ -17,7 +17,7 @@ declare global {
|
|
|
17
17
|
* @param filter - optional query filter with `category_bits` and `mask_bits`
|
|
18
18
|
* @returns travel fraction before collision
|
|
19
19
|
*/
|
|
20
|
-
function cast_mover(world: Opaque<"b2World">, capsule: { center1
|
|
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
21
|
/**
|
|
22
22
|
* Cast a ray.
|
|
23
23
|
*
|
|
@@ -48,7 +48,7 @@ declare global {
|
|
|
48
48
|
* @param filter - optional query filter with `category_bits`, `mask_bits`, and optional `group_index`
|
|
49
49
|
* @returns hit table with `fixture`, `shape`, `point`, `normal`, `fraction`, `node_visits`, and `leaf_visits`, or nil
|
|
50
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 };
|
|
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 } | undefined;
|
|
52
52
|
/**
|
|
53
53
|
* The translation is the ray displacement from `origin`.
|
|
54
54
|
*
|
|
@@ -69,7 +69,7 @@ declare global {
|
|
|
69
69
|
* @param filter - optional query filter with `category_bits`, `mask_bits`, and optional `group_index`
|
|
70
70
|
* @param max_results - optional maximum result count
|
|
71
71
|
*/
|
|
72
|
-
function cast_shape(world: Opaque<"b2World">, shape: { type
|
|
72
|
+
function cast_shape(world: Opaque<"b2World">, shape: { type: typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_BOX; hx: number; hy: number; center?: Vector3; angle?: number } | { type: typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_BOX; vertices: Vector3[] } | { type: typeof b2d.shape.SHAPE_TYPE_CIRCLE; radius: number; center?: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_CAPSULE; radius: number; center1: Vector3; center2: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_EDGE | typeof b2d.shape.SHAPE_TYPE_SEGMENT; v1: Vector3; v2: Vector3; v0?: Vector3; v3?: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_CHAIN; vertices: Vector3[]; 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
73
|
/**
|
|
74
74
|
* The shape table uses the same circle, capsule, segment, polygon, and box formats
|
|
75
75
|
* as `b2d.body.create_shape`. The translation is the shape displacement.
|
|
@@ -80,7 +80,7 @@ declare global {
|
|
|
80
80
|
* @param filter - optional query filter with `category_bits` and `mask_bits`
|
|
81
81
|
* @param max_results - optional maximum result count. Omit or pass 0 for unlimited results.
|
|
82
82
|
*/
|
|
83
|
-
function cast_shape(world: Opaque<"b2World">, shape: { type
|
|
83
|
+
function cast_shape(world: Opaque<"b2World">, shape: { type: typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_BOX; hx: number; hy: number; center?: Vector3; angle?: number } | { type: typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_BOX; vertices: Vector3[] } | { type: typeof b2d.shape.SHAPE_TYPE_CIRCLE; radius: number; center?: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_CAPSULE; radius: number; center1: Vector3; center2: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_EDGE | typeof b2d.shape.SHAPE_TYPE_SEGMENT; v1: Vector3; v2: Vector3; v0?: Vector3; v3?: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_CHAIN; vertices: Vector3[]; 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
84
|
/**
|
|
85
85
|
* The capsule table has `center1`, `center2`, and `radius` fields. Plane result
|
|
86
86
|
* tables include `shape`, `normal`, `offset`, and `hit`.
|
|
@@ -91,7 +91,7 @@ declare global {
|
|
|
91
91
|
* @param max_results - optional maximum result count. Omit or pass 0 for unlimited results.
|
|
92
92
|
* @returns array of plane result tables
|
|
93
93
|
*/
|
|
94
|
-
function collide_mover(world: Opaque<"b2World">, capsule: { center1
|
|
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
95
|
/**
|
|
96
96
|
* Enable or disable continuous collision.
|
|
97
97
|
*
|
|
@@ -127,7 +127,7 @@ declare global {
|
|
|
127
127
|
* @param world - world
|
|
128
128
|
* @param definition - explosion definition
|
|
129
129
|
*/
|
|
130
|
-
function explode(world: Opaque<"b2World">, definition:
|
|
130
|
+
function explode(world: Opaque<"b2World">, definition: { position: Vector3; radius: number; falloff: number; impulse_per_length: number; mask_bits?: number }): void;
|
|
131
131
|
/**
|
|
132
132
|
* Get the number of awake bodies.
|
|
133
133
|
*
|
|
@@ -227,8 +227,11 @@ declare global {
|
|
|
227
227
|
* @param aabb - table with `lower` and `upper` vector3 fields
|
|
228
228
|
* @param filter - optional query filter with `category_bits`, `mask_bits`, and optional `group_index`
|
|
229
229
|
* @param max_results - optional maximum result count
|
|
230
|
+
* @returns `[fixtures, stats]`:
|
|
231
|
+
* - `fixtures` — array of fixture info tables. **⚠️ `index` is 1-based; passed to Defold unchanged.**
|
|
232
|
+
* - `stats` — table with `node_visits` and `leaf_visits`
|
|
230
233
|
*/
|
|
231
|
-
function overlap_aabb(world: Opaque<"b2World">, aabb: { lower
|
|
234
|
+
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
235
|
/**
|
|
233
236
|
* The AABB table has `lower` and `upper` `vector3` fields.
|
|
234
237
|
*
|
|
@@ -237,7 +240,7 @@ declare global {
|
|
|
237
240
|
* @param filter - optional query filter with `category_bits` and `mask_bits`
|
|
238
241
|
* @param max_results - optional maximum result count. Omit or pass 0 for unlimited results.
|
|
239
242
|
*/
|
|
240
|
-
function overlap_aabb(world: Opaque<"b2World">, aabb: { lower
|
|
243
|
+
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
244
|
/**
|
|
242
245
|
* Overlap a shape.
|
|
243
246
|
*
|
|
@@ -245,8 +248,11 @@ declare global {
|
|
|
245
248
|
* @param shape - shape table using the same format as the `shape` field in `b2d.body.create_fixture`
|
|
246
249
|
* @param filter - optional query filter with `category_bits`, `mask_bits`, and optional `group_index`
|
|
247
250
|
* @param max_results - optional maximum result count
|
|
251
|
+
* @returns `[fixtures, stats]`:
|
|
252
|
+
* - `fixtures` — array of fixture info tables. **⚠️ `index` is 1-based; passed to Defold unchanged.**
|
|
253
|
+
* - `stats` — table with `node_visits` and `leaf_visits`
|
|
248
254
|
*/
|
|
249
|
-
function overlap_shape(world: Opaque<"b2World">, shape: { type
|
|
255
|
+
function overlap_shape(world: Opaque<"b2World">, shape: { type: typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_BOX; hx: number; hy: number; center?: Vector3; angle?: number } | { type: typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_BOX; vertices: Vector3[] } | { type: typeof b2d.shape.SHAPE_TYPE_CIRCLE; radius: number; center?: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_CAPSULE; radius: number; center1: Vector3; center2: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_EDGE | typeof b2d.shape.SHAPE_TYPE_SEGMENT; v1: Vector3; v2: Vector3; v0?: Vector3; v3?: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_CHAIN; vertices: Vector3[]; 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
256
|
/**
|
|
251
257
|
* The shape table uses the same circle, capsule, segment, polygon, and box formats
|
|
252
258
|
* as `b2d.body.create_shape`.
|
|
@@ -256,7 +262,7 @@ declare global {
|
|
|
256
262
|
* @param filter - optional query filter with `category_bits` and `mask_bits`
|
|
257
263
|
* @param max_results - optional maximum result count. Omit or pass 0 for unlimited results.
|
|
258
264
|
*/
|
|
259
|
-
function overlap_shape(world: Opaque<"b2World">, shape: { type
|
|
265
|
+
function overlap_shape(world: Opaque<"b2World">, shape: { type: typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_BOX; hx: number; hy: number; center?: Vector3; angle?: number } | { type: typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_BOX; vertices: Vector3[] } | { type: typeof b2d.shape.SHAPE_TYPE_CIRCLE; radius: number; center?: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_CAPSULE; radius: number; center1: Vector3; center2: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_EDGE | typeof b2d.shape.SHAPE_TYPE_SEGMENT; v1: Vector3; v2: Vector3; v0?: Vector3; v3?: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_CHAIN; vertices: Vector3[]; 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
266
|
/**
|
|
261
267
|
* Rebuild the static broad-phase tree.
|
|
262
268
|
*
|
|
@@ -88,10 +88,10 @@ declare global {
|
|
|
88
88
|
* // copy entire stream
|
|
89
89
|
* const srcstream = buffer.get_stream(srcbuffer, hash("xyz"));
|
|
90
90
|
* const dststream = buffer.get_stream(dstbuffer, hash("xyz"));
|
|
91
|
-
* buffer.copy_stream(dststream, 0, srcstream, 0, srcstream.length);
|
|
91
|
+
* buffer.copy_stream(dststream, 0, srcstream, 0, srcstream.length());
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
|
-
function copy_stream(dst: Opaque<"bufferstream"> & { [index: number]: number }, dstoffset: number, src: Opaque<"bufferstream"> & { [index: number]: number }, srcoffset: number, count: number): void;
|
|
94
|
+
function copy_stream(dst: Opaque<"bufferstream"> & { [index: number]: number; length: LuaLengthMethod<number> }, dstoffset: number, src: Opaque<"bufferstream"> & { [index: number]: number; length: LuaLengthMethod<number> }, srcoffset: number, count: number): void;
|
|
95
95
|
/**
|
|
96
96
|
* Create a new data buffer containing a specified set of streams. A data buffer
|
|
97
97
|
* can contain one or more streams with typed data. This is useful for managing
|
|
@@ -102,33 +102,34 @@ declare global {
|
|
|
102
102
|
* @param declaration - A table where each entry (table) describes a stream
|
|
103
103
|
*
|
|
104
104
|
* - hash | string `name`: The name of the stream
|
|
105
|
-
*
|
|
106
105
|
* - constant `type`: The data type of the stream
|
|
107
|
-
*
|
|
108
106
|
* - number `count`: The number of values each element should hold
|
|
109
107
|
* @returns the new buffer
|
|
110
108
|
* @example
|
|
111
109
|
* ```ts
|
|
112
110
|
* // How to create and initialize a buffer
|
|
113
111
|
* export default defineScript({
|
|
114
|
-
* init(
|
|
112
|
+
* init() {
|
|
115
113
|
* const size = 128;
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
114
|
+
* const [width, height] = [size, size];
|
|
115
|
+
* const [r, g, b] = [0xff, 0x80, 0x10];
|
|
116
|
+
* const image = buffer.create(size * size, [{ name: hash("rgb"), type: buffer.VALUE_TYPE_UINT8, count: 3 }]);
|
|
117
|
+
* const imagestream = buffer.get_stream(image, hash("rgb"));
|
|
118
|
+
*
|
|
119
|
+
* for (let y = 0; y < height; y++) {
|
|
120
|
+
* for (let x = 0; x < width; x++) {
|
|
121
|
+
* const index = y * width * 3 + x * 3;
|
|
122
|
+
* imagestream[index + 0] = r;
|
|
123
|
+
* imagestream[index + 1] = g;
|
|
124
|
+
* imagestream[index + 2] = b;
|
|
125
125
|
* }
|
|
126
126
|
* }
|
|
127
|
+
* return { image, imagestream };
|
|
127
128
|
* },
|
|
128
129
|
* });
|
|
129
130
|
* ```
|
|
130
131
|
*/
|
|
131
|
-
function create(element_count: number, declaration: { name?: Hash | string; type
|
|
132
|
+
function create(element_count: number, declaration: { name?: Hash | string; type: buffer.ValueType; count?: number }[]): Opaque<"buffer">;
|
|
132
133
|
/**
|
|
133
134
|
* Get a copy of all the bytes from a specified stream as a Lua string.
|
|
134
135
|
*
|
|
@@ -136,7 +137,7 @@ declare global {
|
|
|
136
137
|
* @param stream_name - the name of the stream
|
|
137
138
|
* @returns the buffer data as a Lua string
|
|
138
139
|
*/
|
|
139
|
-
function get_bytes(buffer: Opaque<"buffer">, stream_name: Hash): string;
|
|
140
|
+
function get_bytes(buffer: Opaque<"buffer">, stream_name: Hash | string): string;
|
|
140
141
|
/**
|
|
141
142
|
* Get a named metadata entry from a buffer along with its type.
|
|
142
143
|
*
|
|
@@ -160,7 +161,7 @@ declare global {
|
|
|
160
161
|
* @param stream_name - the stream name
|
|
161
162
|
* @returns the data stream
|
|
162
163
|
*/
|
|
163
|
-
function get_stream(buffer: Opaque<"buffer">, stream_name: Hash | string): Opaque<"bufferstream"> & { [index: number]: number };
|
|
164
|
+
function get_stream(buffer: Opaque<"buffer">, stream_name: Hash | string): Opaque<"bufferstream"> & { [index: number]: number; length: LuaLengthMethod<number> };
|
|
164
165
|
/**
|
|
165
166
|
* Creates or updates a metadata array entry on a buffer.
|
|
166
167
|
* The value type and count given when updating the entry should match those used when first creating it.
|