@defold-typescript/types 0.5.4 → 0.6.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-targets.json +1 -1
- package/generated/b2d.d.ts +3 -0
- package/generated/buffer.d.ts +44 -38
- package/generated/builtin-messages.d.ts +1 -1
- package/generated/camera.d.ts +3 -0
- package/generated/collectionfactory.d.ts +47 -40
- package/generated/collectionproxy.d.ts +23 -18
- package/generated/crash.d.ts +3 -0
- package/generated/factory.d.ts +32 -24
- package/generated/go.d.ts +293 -293
- package/generated/graphics.d.ts +3 -0
- package/generated/gui.d.ts +303 -283
- package/generated/http.d.ts +26 -16
- package/generated/iac.d.ts +3 -0
- package/generated/iap.d.ts +6 -3
- package/generated/image.d.ts +30 -26
- package/generated/json.d.ts +36 -32
- package/generated/kinds/gui-script.d.ts +7 -5
- package/generated/kinds/render-script.d.ts +7 -5
- package/generated/kinds/script.d.ts +7 -5
- package/generated/label.d.ts +16 -9
- package/generated/liveupdate.d.ts +29 -26
- package/generated/model.d.ts +57 -45
- package/generated/msg.d.ts +12 -9
- package/generated/particlefx.d.ts +50 -34
- package/generated/physics.d.ts +153 -133
- package/generated/profiler.d.ts +45 -41
- package/generated/push.d.ts +5 -2
- package/generated/render.d.ts +410 -349
- package/generated/resource.d.ts +619 -572
- package/generated/socket.d.ts +49 -33
- package/generated/sound.d.ts +83 -72
- package/generated/sprite.d.ts +36 -32
- package/generated/sys.d.ts +198 -189
- package/generated/tilemap.d.ts +43 -39
- package/generated/timer.d.ts +42 -36
- package/generated/vmath.d.ts +254 -229
- package/generated/webview.d.ts +3 -0
- package/generated/window.d.ts +23 -17
- package/generated/zlib.d.ts +15 -12
- package/index.d.ts +3 -1
- package/package.json +6 -2
- package/scripts/example-store-io.ts +18 -0
- package/scripts/fidelity-audit.ts +61 -1
- package/scripts/fidelity-baseline.json +10 -10
- package/scripts/ref-doc-delta.ts +143 -0
- package/scripts/regen.ts +23 -10
- package/src/core-types.ts +14 -0
- package/src/doc-comment.ts +2 -1
- package/src/emit-dts.ts +238 -18
- package/src/engine-globals.d.ts +2 -0
- package/src/example-store.ts +44 -0
- package/src/go-overloads.d.ts +73 -0
- package/src/index.ts +5 -0
- package/src/lifecycle.ts +157 -16
- package/src/message-dispatch.d.ts +21 -0
- package/src/message-guard.d.ts +19 -0
- package/src/msg-overloads.d.ts +20 -0
- package/src/publish-dts.ts +1 -1
package/generated/msg.d.ts
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import type { Hash, Url } from "../src/core-types";
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Functions for passing messages and constructing URL objects.
|
|
7
|
+
*/
|
|
5
8
|
namespace msg {
|
|
6
9
|
/**
|
|
7
10
|
* This is equivalent to `msg.url(nil)` or `msg.url("#")`, which creates an url to the current
|
|
@@ -49,16 +52,16 @@ declare global {
|
|
|
49
52
|
* @param fragment - fragment of the URL
|
|
50
53
|
* @returns a new URL
|
|
51
54
|
* @example
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* const my_socket = "main"; // specify by valid name
|
|
57
|
+
* const my_path = hash("/my_collection/my_gameobject"); // specify as string or hash
|
|
58
|
+
* const my_fragment = "component"; // specify as string or hash
|
|
59
|
+
* const my_url = msg.url(my_socket, my_path, my_fragment);
|
|
57
60
|
*
|
|
58
|
-
* print(my_url)
|
|
59
|
-
* print(my_url.socket)
|
|
60
|
-
* print(my_url.path)
|
|
61
|
-
* print(my_url.fragment)
|
|
61
|
+
* print(my_url); // => url: [main:/my_collection/my_gameobject#component]
|
|
62
|
+
* print(my_url.socket); // => 786443 (internal numeric value)
|
|
63
|
+
* print(my_url.path); // => hash: [/my_collection/my_gameobject]
|
|
64
|
+
* print(my_url.fragment); // => hash: [component]
|
|
62
65
|
* ```
|
|
63
66
|
*/
|
|
64
67
|
function url(socket?: string | Hash, path?: string | Hash, fragment?: string | Hash): Url;
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
import type { Hash, Url, Vector4 } from "../src/core-types";
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Functions and properties for controlling particle effect component playback and
|
|
7
|
+
* shader constants.
|
|
8
|
+
*/
|
|
5
9
|
namespace particlefx {
|
|
6
10
|
/**
|
|
7
11
|
* The emitter is not spawning any particles, but has particles that are still alive.
|
|
@@ -40,19 +44,21 @@ declare global {
|
|
|
40
44
|
* - `particlefx.EMITTER_STATE_SPAWNING`
|
|
41
45
|
* - `particlefx.EMITTER_STATE_POSTSPAWN`
|
|
42
46
|
* @example
|
|
43
|
-
* ```
|
|
44
|
-
* How to play a particle fx when a game object is created.
|
|
45
|
-
* The callback receives the hash of the path to the particlefx, the hash of the id
|
|
46
|
-
* of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_.
|
|
47
|
-
*
|
|
48
|
-
* if emitter
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* // How to play a particle fx when a game object is created.
|
|
49
|
+
* // The callback receives the hash of the path to the particlefx, the hash of the id
|
|
50
|
+
* // of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_.
|
|
51
|
+
* function emitter_state_change(self, id, emitter, state) {
|
|
52
|
+
* if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
|
|
53
|
+
* // exhaust is done spawning particles...
|
|
54
|
+
* }
|
|
55
|
+
* }
|
|
52
56
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
57
|
+
* export default defineScript({
|
|
58
|
+
* init(self) {
|
|
59
|
+
* particlefx.play("#particlefx", emitter_state_change);
|
|
60
|
+
* },
|
|
61
|
+
* });
|
|
56
62
|
* ```
|
|
57
63
|
*/
|
|
58
64
|
function play(url: string | Hash | Url, emitter_state_function?: (self: unknown, id: unknown, emitter: unknown, state: unknown) => void): void;
|
|
@@ -66,14 +72,18 @@ declare global {
|
|
|
66
72
|
* @param emitter - the id of the emitter
|
|
67
73
|
* @param constant - the name of the constant
|
|
68
74
|
* @example
|
|
69
|
-
* ```
|
|
70
|
-
* The following examples
|
|
71
|
-
* contains an emitter with the id "emitter" and that the default-material in
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
75
|
+
* ```ts
|
|
76
|
+
* // The following examples assume that the particle FX has id "particlefx", it
|
|
77
|
+
* // contains an emitter with the id "emitter" and that the default-material in
|
|
78
|
+
* // builtins is used, which defines the constant "tint".
|
|
79
|
+
* // If you assign a custom material to the sprite, you can reset the constants
|
|
80
|
+
* // defined there in the same manner.
|
|
81
|
+
* // How to reset the tinting of particles from an emitter:
|
|
82
|
+
* export default defineScript({
|
|
83
|
+
* init(self) {
|
|
84
|
+
* particlefx.reset_constant("#particlefx", "emitter", "tint");
|
|
85
|
+
* },
|
|
86
|
+
* });
|
|
77
87
|
* ```
|
|
78
88
|
*/
|
|
79
89
|
function reset_constant(url: string | Hash | Url, emitter: string | Hash, constant: string | Hash): void;
|
|
@@ -89,14 +99,18 @@ declare global {
|
|
|
89
99
|
* @param constant - the name of the constant
|
|
90
100
|
* @param value - the value of the constant
|
|
91
101
|
* @example
|
|
92
|
-
* ```
|
|
93
|
-
* The following examples
|
|
94
|
-
* contains an emitter with the id "emitter" and that the default-material in
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
102
|
+
* ```ts
|
|
103
|
+
* // The following examples assume that the particle FX has id "particlefx", it
|
|
104
|
+
* // contains an emitter with the id "emitter" and that the default-material in
|
|
105
|
+
* // builtins is used, which defines the constant "tint".
|
|
106
|
+
* // If you assign a custom material to the sprite, you can reset the constants
|
|
107
|
+
* // defined there in the same manner.
|
|
108
|
+
* // How to tint particles from an emitter red:
|
|
109
|
+
* export default defineScript({
|
|
110
|
+
* init(self) {
|
|
111
|
+
* particlefx.set_constant("#particlefx", "emitter", "tint", vmath.vector4(1, 0, 0, 1));
|
|
112
|
+
* },
|
|
113
|
+
* });
|
|
100
114
|
* ```
|
|
101
115
|
*/
|
|
102
116
|
function set_constant(url: string | Hash | Url, emitter: string | Hash, constant: string | Hash, value: Vector4): void;
|
|
@@ -109,12 +123,14 @@ declare global {
|
|
|
109
123
|
* @param options - Options when stopping the particle fx. Supported options:
|
|
110
124
|
* - boolean `clear`: instantly clear spawned particles
|
|
111
125
|
* @example
|
|
112
|
-
* ```
|
|
113
|
-
* How to stop a particle fx when a game object is deleted and immediately also
|
|
114
|
-
* any spawned particles:
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
126
|
+
* ```ts
|
|
127
|
+
* // How to stop a particle fx when a game object is deleted and immediately also
|
|
128
|
+
* // clear any spawned particles:
|
|
129
|
+
* export default defineScript({
|
|
130
|
+
* final(self) {
|
|
131
|
+
* particlefx.stop("#particlefx", { clear: true });
|
|
132
|
+
* },
|
|
133
|
+
* });
|
|
118
134
|
* ```
|
|
119
135
|
*/
|
|
120
136
|
function stop(url: string | Hash | Url, options?: { clear?: boolean }): void;
|
package/generated/physics.d.ts
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
import type { Hash, Url, Vector3 } from "../src/core-types";
|
|
3
3
|
|
|
4
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
|
+
*/
|
|
5
10
|
namespace physics {
|
|
6
11
|
/**
|
|
7
12
|
* The following properties are available when connecting a joint of `JOINT_TYPE_FIXED` type:
|
|
@@ -62,13 +67,15 @@ declare global {
|
|
|
62
67
|
*
|
|
63
68
|
* @returns gravity vector of collection
|
|
64
69
|
* @example
|
|
65
|
-
* ```
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
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
|
+
* });
|
|
72
79
|
* ```
|
|
73
80
|
*/
|
|
74
81
|
function get_gravity(): Vector3;
|
|
@@ -178,25 +185,27 @@ declare global {
|
|
|
178
185
|
* boolean Set to `true` to return all ray cast hits. If `false`, it will only return the closest hit.
|
|
179
186
|
* @returns It returns a list. If missed it returns `nil`. See ray_cast_response for details on the returned values.
|
|
180
187
|
* @example
|
|
181
|
-
* ```
|
|
182
|
-
* How to perform a ray cast synchronously:
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
188
|
+
* ```ts
|
|
189
|
+
* // How to perform a ray cast synchronously:
|
|
190
|
+
* export default defineScript({
|
|
191
|
+
* init(self) {
|
|
192
|
+
* self.groups = [hash("world"), hash("enemy")];
|
|
193
|
+
* },
|
|
186
194
|
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
* if result
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
195
|
+
* update(self, dt) {
|
|
196
|
+
* // request ray cast
|
|
197
|
+
* const result = physics.raycast(from, to, self.groups, { all: true });
|
|
198
|
+
* if (result !== undefined) {
|
|
199
|
+
* // act on the hit (see 'ray_cast_response')
|
|
200
|
+
* for (const result of results) {
|
|
201
|
+
* handle_result(result);
|
|
202
|
+
* }
|
|
203
|
+
* }
|
|
204
|
+
* },
|
|
205
|
+
* });
|
|
197
206
|
* ```
|
|
198
207
|
*/
|
|
199
|
-
function raycast(from: Vector3, to: Vector3, groups:
|
|
208
|
+
function raycast(from: Vector3, to: Vector3, groups: Hash[], options?: { all?: boolean }): Record<string | number, unknown> | unknown;
|
|
200
209
|
/**
|
|
201
210
|
* Ray casts are used to test for intersections against collision objects in the physics world.
|
|
202
211
|
* Collision objects of types kinematic, dynamic and static are tested against. Trigger objects
|
|
@@ -213,28 +222,30 @@ declare global {
|
|
|
213
222
|
* @param groups - a lua table containing the hashed groups for which to test collisions against
|
|
214
223
|
* @param request_id - a number in range [0,255]. It will be sent back in the response for identification, 0 by default
|
|
215
224
|
* @example
|
|
216
|
-
* ```
|
|
217
|
-
* How to perform a ray cast asynchronously:
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
225
|
+
* ```ts
|
|
226
|
+
* // How to perform a ray cast asynchronously:
|
|
227
|
+
* export default defineScript({
|
|
228
|
+
* init(self) {
|
|
229
|
+
* self.my_groups = [hash("my_group1"), hash("my_group2")];
|
|
230
|
+
* },
|
|
221
231
|
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* physics.raycast_async(my_start, my_end, self.my_groups)
|
|
225
|
-
*
|
|
232
|
+
* update(self, dt) {
|
|
233
|
+
* // request ray cast
|
|
234
|
+
* physics.raycast_async(my_start, my_end, self.my_groups);
|
|
235
|
+
* },
|
|
226
236
|
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
* if message_id
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
237
|
+
* on_message(self, message_id, message, sender) {
|
|
238
|
+
* // check for the response
|
|
239
|
+
* if (message_id === hash("ray_cast_response")) {
|
|
240
|
+
* // act on the hit
|
|
241
|
+
* } else if (message_id === hash("ray_cast_missed")) {
|
|
242
|
+
* // act on the miss
|
|
243
|
+
* }
|
|
244
|
+
* },
|
|
245
|
+
* });
|
|
235
246
|
* ```
|
|
236
247
|
*/
|
|
237
|
-
function raycast_async(from: Vector3, to: Vector3, groups:
|
|
248
|
+
function raycast_async(from: Vector3, to: Vector3, groups: Hash[], request_id?: number): void;
|
|
238
249
|
/**
|
|
239
250
|
* Only one physics world event listener can be set at a time.
|
|
240
251
|
*
|
|
@@ -251,82 +262,85 @@ declare global {
|
|
|
251
262
|
* `data`
|
|
252
263
|
* table The callback value data is a table that contains event-related data. See the documentation for details on the messages.
|
|
253
264
|
* @example
|
|
254
|
-
* ```
|
|
255
|
-
*
|
|
256
|
-
* for
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
265
|
+
* ```ts
|
|
266
|
+
* function physics_world_listener(self, events) {
|
|
267
|
+
* for (const event of events) {
|
|
268
|
+
* const event_type = event["type"];
|
|
269
|
+
* if (event_type === hash("contact_point_event")) {
|
|
270
|
+
* pprint(event);
|
|
271
|
+
* // {
|
|
272
|
+
* // distance = 2.1490633487701,
|
|
273
|
+
* // applied_impulse = 0
|
|
274
|
+
* // a = { --[[0x113f7c6c0]]
|
|
275
|
+
* // group = hash: [box],
|
|
276
|
+
* // id = hash: [/box]
|
|
277
|
+
* // mass = 0,
|
|
278
|
+
* // normal = vmath.vector3(0.379, 0.925, -0),
|
|
279
|
+
* // position = vmath.vector3(517.337, 235.068, 0),
|
|
280
|
+
* // instance_position = vmath.vector3(480, 144, 0),
|
|
281
|
+
* // relative_velocity = vmath.vector3(-0, -0, -0),
|
|
282
|
+
* // },
|
|
283
|
+
* // b = { --[[0x113f7c840]]
|
|
284
|
+
* // group = hash: [circle],
|
|
285
|
+
* // id = hash: [/circle]
|
|
286
|
+
* // mass = 0,
|
|
287
|
+
* // normal = vmath.vector3(-0.379, -0.925, 0),
|
|
288
|
+
* // position = vmath.vector3(517.337, 235.068, 0),
|
|
289
|
+
* // instance_position = vmath.vector3(-0.0021, 0, -0.0022),
|
|
290
|
+
* // relative_velocity = vmath.vector3(0, 0, 0),
|
|
291
|
+
* // },
|
|
292
|
+
* // }
|
|
293
|
+
* } else if (event === hash("collision_event")) {
|
|
294
|
+
* pprint(event);
|
|
295
|
+
* // {
|
|
296
|
+
* // a = {
|
|
297
|
+
* // group = hash: [default],
|
|
298
|
+
* // position = vmath.vector3(183, 666, 0),
|
|
299
|
+
* // id = hash: [/go1]
|
|
300
|
+
* // },
|
|
301
|
+
* // b = {
|
|
302
|
+
* // group = hash: [default],
|
|
303
|
+
* // position = vmath.vector3(185, 704.05865478516, 0),
|
|
304
|
+
* // id = hash: [/go2]
|
|
305
|
+
* // }
|
|
306
|
+
* // }
|
|
307
|
+
* } else if (event === hash("trigger_event")) {
|
|
308
|
+
* pprint(event);
|
|
309
|
+
* // {
|
|
310
|
+
* // enter = true,
|
|
311
|
+
* // b = {
|
|
312
|
+
* // group = hash: [default],
|
|
313
|
+
* // id = hash: [/go2]
|
|
314
|
+
* // },
|
|
315
|
+
* // a = {
|
|
316
|
+
* // group = hash: [default],
|
|
317
|
+
* // id = hash: [/go1]
|
|
318
|
+
* // }
|
|
319
|
+
* // },
|
|
320
|
+
* } else if (event === hash("ray_cast_response")) {
|
|
321
|
+
* pprint(event);
|
|
322
|
+
* // {
|
|
323
|
+
* // group = hash: [default],
|
|
324
|
+
* // request_id = 0,
|
|
325
|
+
* // position = vmath.vector3(249.92222595215, 249.92222595215, 0),
|
|
326
|
+
* // fraction = 0.68759721517563,
|
|
327
|
+
* // normal = vmath.vector3(0, 1, 0),
|
|
328
|
+
* // id = hash: [/go]
|
|
329
|
+
* // }
|
|
330
|
+
* } else if (event === hash("ray_cast_missed")) {
|
|
331
|
+
* pprint(event);
|
|
332
|
+
* // {
|
|
333
|
+
* // request_id = 0
|
|
334
|
+
* // },
|
|
335
|
+
* }
|
|
336
|
+
* }
|
|
337
|
+
* }
|
|
326
338
|
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
339
|
+
* export default defineScript({
|
|
340
|
+
* init(self) {
|
|
341
|
+
* physics.set_event_listener(physics_world_listener);
|
|
342
|
+
* },
|
|
343
|
+
* });
|
|
330
344
|
* ```
|
|
331
345
|
*/
|
|
332
346
|
function set_event_listener(callback?: (self: unknown, events: unknown) => void): void;
|
|
@@ -337,11 +351,13 @@ declare global {
|
|
|
337
351
|
*
|
|
338
352
|
* @param gravity - the new gravity vector
|
|
339
353
|
* @example
|
|
340
|
-
* ```
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
354
|
+
* ```ts
|
|
355
|
+
* export default defineScript({
|
|
356
|
+
* init(self) {
|
|
357
|
+
* // Set "upside down" gravity for this collection.
|
|
358
|
+
* physics.set_gravity(vmath.vector3(0, 10.0, 0));
|
|
359
|
+
* },
|
|
360
|
+
* });
|
|
345
361
|
* ```
|
|
346
362
|
*/
|
|
347
363
|
function set_gravity(gravity: Vector3): void;
|
|
@@ -364,11 +380,13 @@ declare global {
|
|
|
364
380
|
* @param url - the collision object that should flip its shapes
|
|
365
381
|
* @param flip - `true` if the collision object should flip its shapes, `false` if not
|
|
366
382
|
* @example
|
|
367
|
-
* ```
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
383
|
+
* ```ts
|
|
384
|
+
* export default defineScript({
|
|
385
|
+
* init(self) {
|
|
386
|
+
* self.fliph = true; // set on some condition
|
|
387
|
+
* physics.set_hflip("#collisionobject", self.fliph);
|
|
388
|
+
* },
|
|
389
|
+
* });
|
|
372
390
|
* ```
|
|
373
391
|
*/
|
|
374
392
|
function set_hflip(url: string | Hash | Url, flip: boolean): void;
|
|
@@ -432,11 +450,13 @@ declare global {
|
|
|
432
450
|
* @param url - the collision object that should flip its shapes
|
|
433
451
|
* @param flip - `true` if the collision object should flip its shapes, `false` if not
|
|
434
452
|
* @example
|
|
435
|
-
* ```
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
*
|
|
439
|
-
*
|
|
453
|
+
* ```ts
|
|
454
|
+
* export default defineScript({
|
|
455
|
+
* init(self) {
|
|
456
|
+
* self.flipv = true; // set on some condition
|
|
457
|
+
* physics.set_vflip("#collisionobject", self.flipv);
|
|
458
|
+
* },
|
|
459
|
+
* });
|
|
440
460
|
* ```
|
|
441
461
|
*/
|
|
442
462
|
function set_vflip(url: string | Hash | Url, flip: boolean): void;
|
|
@@ -447,8 +467,8 @@ declare global {
|
|
|
447
467
|
* @param collisionobject - the collision object whose mass needs to be updated.
|
|
448
468
|
* @param mass - the new mass value to set for the collision object.
|
|
449
469
|
* @example
|
|
450
|
-
* ```
|
|
451
|
-
*
|
|
470
|
+
* ```ts
|
|
471
|
+
* physics.update_mass("#collisionobject", 14);
|
|
452
472
|
* ```
|
|
453
473
|
*/
|
|
454
474
|
function update_mass(collisionobject: string | Hash | Url, mass: number): void;
|