@defold-typescript/types 0.50.1 → 0.52.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 +4 -58
- package/api-signatures.json +1128 -1552
- package/api-targets.json +15 -5
- package/examples/translations.json +19 -71
- package/fixtures/messages_doc.json +20 -39
- package/generated/b2d_world.d.ts +10 -10
- package/generated/buffer.d.ts +9 -9
- package/generated/builtin-messages.d.ts +16 -14
- package/generated/bullet3d_collision_object.d.ts +1 -1
- package/generated/bullet3d_constraint.d.ts +109 -7
- package/generated/bullet3d_shape.d.ts +2 -2
- package/generated/collectionfactory.d.ts +1 -1
- package/generated/collectionproxy.d.ts +2 -2
- package/generated/factory.d.ts +4 -2
- package/generated/go.d.ts +114 -220
- package/generated/graphics.d.ts +5 -0
- package/generated/gui.d.ts +148 -371
- package/generated/http.d.ts +4 -2
- package/generated/image.d.ts +56 -4
- package/generated/kinds/gui-script.d.ts +3 -0
- package/generated/kinds/render-script.d.ts +15 -15
- package/generated/kinds/script.d.ts +1 -0
- package/generated/liveupdate.d.ts +5 -1
- package/generated/material.d.ts +3 -3
- package/generated/model.d.ts +4 -5
- package/generated/particlefx.d.ts +20 -1
- package/generated/physics.d.ts +48 -4
- package/generated/render-script-modules/b2d.d.ts +711 -0
- package/generated/render-script-modules/bullet3d.d.ts +73 -0
- package/generated/render-script-modules/collectionfactory.d.ts +25 -0
- package/generated/render-script-modules/collectionproxy.d.ts +39 -0
- package/generated/render-script-modules/factory.d.ts +25 -0
- package/generated/render-script-modules/go.d.ts +436 -0
- package/generated/render-script-modules/label.d.ts +105 -0
- package/generated/render-script-modules/model.d.ts +89 -0
- package/generated/render-script-modules/particlefx.d.ts +59 -0
- package/generated/render-script-modules/physics.d.ts +333 -0
- package/generated/render-script-modules/resource.d.ts +1233 -0
- package/generated/render-script-modules/sound.d.ts +227 -0
- package/generated/render-script-modules/sprite.d.ts +68 -0
- package/generated/render-script-modules/tilemap.d.ts +43 -0
- package/generated/render.d.ts +175 -21
- package/generated/resource.d.ts +31 -10
- package/generated/sprite.d.ts +49 -1
- package/generated/sys.d.ts +78 -10
- package/generated/tilemap.d.ts +4 -4
- package/generated/versions/defold-1.12.4/buffer.d.ts +8 -8
- package/generated/versions/defold-1.12.4/collectionfactory.d.ts +1 -1
- package/generated/versions/defold-1.12.4/collectionproxy.d.ts +1 -1
- package/generated/versions/defold-1.12.4/factory.d.ts +4 -2
- package/generated/versions/defold-1.12.4/go.d.ts +115 -343
- package/generated/versions/defold-1.12.4/graphics.d.ts +1 -0
- package/generated/versions/defold-1.12.4/gui.d.ts +151 -513
- package/generated/versions/defold-1.12.4/http.d.ts +4 -2
- package/generated/versions/defold-1.12.4/image.d.ts +83 -3
- package/generated/versions/defold-1.12.4/index.d.ts +2 -0
- package/generated/versions/defold-1.12.4/liveupdate.d.ts +4 -0
- package/generated/versions/defold-1.12.4/model.d.ts +4 -5
- package/generated/versions/defold-1.12.4/particlefx.d.ts +22 -1
- package/generated/versions/defold-1.12.4/physics.d.ts +47 -3
- package/generated/versions/defold-1.12.4/render.d.ts +119 -15
- package/generated/versions/defold-1.12.4/resource.d.ts +43 -10
- package/generated/versions/defold-1.12.4/sprite.d.ts +58 -1
- package/generated/versions/defold-1.12.4/sys.d.ts +101 -6
- package/generated/versions/defold-1.12.4/tilemap.d.ts +4 -4
- package/generated/versions/defold-1.12.4/vmath.d.ts +0 -24
- package/generated/versions/defold-1.13.0/buffer.d.ts +8 -8
- package/generated/versions/defold-1.13.0/collectionfactory.d.ts +1 -1
- package/generated/versions/defold-1.13.0/collectionproxy.d.ts +1 -1
- package/generated/versions/defold-1.13.0/factory.d.ts +4 -2
- package/generated/versions/defold-1.13.0/go.d.ts +115 -370
- package/generated/versions/defold-1.13.0/graphics.d.ts +1 -0
- package/generated/versions/defold-1.13.0/gui.d.ts +151 -513
- package/generated/versions/defold-1.13.0/http.d.ts +4 -2
- package/generated/versions/defold-1.13.0/image.d.ts +83 -3
- package/generated/versions/defold-1.13.0/index.d.ts +2 -0
- package/generated/versions/defold-1.13.0/liveupdate.d.ts +4 -0
- package/generated/versions/defold-1.13.0/material.d.ts +3 -1
- package/generated/versions/defold-1.13.0/model.d.ts +4 -5
- package/generated/versions/defold-1.13.0/particlefx.d.ts +22 -1
- package/generated/versions/defold-1.13.0/physics.d.ts +47 -3
- package/generated/versions/defold-1.13.0/render.d.ts +182 -16
- package/generated/versions/defold-1.13.0/resource.d.ts +43 -10
- package/generated/versions/defold-1.13.0/sprite.d.ts +58 -1
- package/generated/versions/defold-1.13.0/sys.d.ts +101 -6
- package/generated/versions/defold-1.13.0/tilemap.d.ts +4 -4
- package/generated/versions/defold-1.13.0/vmath.d.ts +0 -24
- package/generated/versions/defold-1.13.1/buffer.d.ts +8 -8
- package/generated/versions/defold-1.13.1/collectionfactory.d.ts +1 -1
- package/generated/versions/defold-1.13.1/collectionproxy.d.ts +1 -1
- package/generated/versions/defold-1.13.1/factory.d.ts +4 -2
- package/generated/versions/defold-1.13.1/go.d.ts +115 -370
- package/generated/versions/defold-1.13.1/graphics.d.ts +1 -0
- package/generated/versions/defold-1.13.1/gui.d.ts +151 -529
- package/generated/versions/defold-1.13.1/http.d.ts +4 -2
- package/generated/versions/defold-1.13.1/image.d.ts +83 -3
- package/generated/versions/defold-1.13.1/index.d.ts +3 -0
- package/generated/versions/defold-1.13.1/liveupdate.d.ts +4 -0
- package/generated/versions/defold-1.13.1/material.d.ts +3 -1
- package/generated/versions/defold-1.13.1/model.d.ts +4 -5
- package/generated/versions/defold-1.13.1/particlefx.d.ts +22 -1
- package/generated/versions/defold-1.13.1/physics.d.ts +47 -3
- package/generated/versions/defold-1.13.1/render.d.ts +182 -16
- package/generated/versions/defold-1.13.1/resource.d.ts +43 -10
- package/generated/versions/defold-1.13.1/sprite.d.ts +58 -1
- package/generated/versions/defold-1.13.1/sys.d.ts +101 -6
- package/generated/versions/defold-1.13.1/tilemap.d.ts +4 -4
- package/generated/versions/defold-1.13.1/vmath.d.ts +0 -24
- package/generated/versions/defold-1.13.2/b2d_world.d.ts +10 -10
- package/generated/versions/defold-1.13.2/buffer.d.ts +9 -9
- package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +1 -1
- package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +109 -7
- package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +2 -2
- package/generated/versions/defold-1.13.2/collectionfactory.d.ts +1 -1
- package/generated/versions/defold-1.13.2/collectionproxy.d.ts +2 -2
- package/generated/versions/defold-1.13.2/factory.d.ts +4 -2
- package/generated/versions/defold-1.13.2/go.d.ts +114 -220
- package/generated/versions/defold-1.13.2/graphics.d.ts +1 -0
- package/generated/versions/defold-1.13.2/gui.d.ts +148 -371
- package/generated/versions/defold-1.13.2/http.d.ts +4 -2
- package/generated/versions/defold-1.13.2/image.d.ts +56 -4
- package/generated/versions/defold-1.13.2/index.d.ts +3 -0
- package/generated/versions/defold-1.13.2/liveupdate.d.ts +5 -1
- package/generated/versions/defold-1.13.2/material.d.ts +3 -3
- package/generated/versions/defold-1.13.2/model.d.ts +4 -5
- package/generated/versions/defold-1.13.2/particlefx.d.ts +20 -1
- package/generated/versions/defold-1.13.2/physics.d.ts +48 -4
- package/generated/versions/defold-1.13.2/render.d.ts +164 -20
- package/generated/versions/defold-1.13.2/resource.d.ts +31 -10
- package/generated/versions/defold-1.13.2/sprite.d.ts +49 -1
- package/generated/versions/defold-1.13.2/sys.d.ts +78 -10
- package/generated/versions/defold-1.13.2/tilemap.d.ts +4 -4
- package/generated/versions/defold-1.13.2/vmath.d.ts +0 -24
- package/generated/versions/defold-1.13.2/window.d.ts +1 -1
- package/generated/vmath.d.ts +0 -24
- package/generated/window.d.ts +1 -1
- package/identity-vocabulary.json +98 -7
- package/index.d.ts +3 -0
- package/package.json +3 -1
- package/scripts/generate-api-availability.ts +6 -22
- package/scripts/generate-api-signatures.ts +87 -21
- package/scripts/materialize-version.ts +53 -6
- package/scripts/regen.ts +256 -44
- package/scripts/signature-store-fs.ts +1 -0
- package/scripts/target-version.ts +26 -0
- package/src/api-doc.ts +26 -0
- package/src/component-properties.d.ts +226 -6
- package/src/core-types.ts +82 -20
- package/src/doc-corrections.ts +53 -5
- package/src/emit-dts.ts +1300 -269
- package/src/emit-messages.ts +289 -0
- package/src/engine-globals.d.ts +8 -2
- package/src/go-overloads.d.ts +80 -15
- package/src/gui-overloads.d.ts +489 -0
- package/src/gui-texture-removal.d.ts +41 -0
- package/src/index.ts +2 -0
- package/src/lifecycle.ts +46 -37
- package/src/luals-type-expr.ts +6 -1
- package/src/msg-overloads.d.ts +25 -13
- package/src/physics-event-guard.d.ts +39 -0
- package/src/render-overloads.d.ts +2 -2
- package/src/return-correction-provenance.ts +36 -6
- package/src/signature-store.ts +50 -0
- package/src/timers.d.ts +2 -1
- package/src/vmath-overloads.d.ts +26 -0
- package/src/window-event-guard.d.ts +5 -3
|
@@ -246,7 +246,16 @@ declare global {
|
|
|
246
246
|
* @param params - local frames and options
|
|
247
247
|
* @returns cone-twist constraint
|
|
248
248
|
*/
|
|
249
|
-
function create_cone_twist(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody"> | undefined, params: bullet3d.constraint.cone_twist_params): bullet3d.constraint.btTypedConstraint;
|
|
249
|
+
function create_cone_twist(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody"> | undefined, params: bullet3d.constraint.cone_twist_params & Required<Pick<bullet3d.constraint.cone_twist_params, "frame_b_position" | "frame_b_rotation">>): bullet3d.constraint.btTypedConstraint;
|
|
250
|
+
/**
|
|
251
|
+
* The world is derived from `body_a`.
|
|
252
|
+
*
|
|
253
|
+
* @param body_a - first body
|
|
254
|
+
* @param body_b - second body or world
|
|
255
|
+
* @param params - local frames and options
|
|
256
|
+
* @returns cone-twist constraint
|
|
257
|
+
*/
|
|
258
|
+
function create_cone_twist(body_a: Opaque<"btRigidBody">, body_b: undefined, params: bullet3d.constraint.cone_twist_params): bullet3d.constraint.btTypedConstraint;
|
|
250
259
|
/**
|
|
251
260
|
* The params table requires local frame A and, for a two-body constraint,
|
|
252
261
|
* local frame B. It optionally accepts `collide_connected`. The world is
|
|
@@ -259,7 +268,20 @@ declare global {
|
|
|
259
268
|
* @param params - local frames and options
|
|
260
269
|
* @returns generic 6-DOF constraint
|
|
261
270
|
*/
|
|
262
|
-
function create_generic_6dof(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody"> | undefined, params: bullet3d.constraint.generic_6dof_params): bullet3d.constraint.btTypedConstraint;
|
|
271
|
+
function create_generic_6dof(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody"> | undefined, params: bullet3d.constraint.generic_6dof_params & Required<Pick<bullet3d.constraint.generic_6dof_params, "frame_b_position" | "frame_b_rotation">>): bullet3d.constraint.btTypedConstraint;
|
|
272
|
+
/**
|
|
273
|
+
* The params table requires local frame A and, for a two-body constraint,
|
|
274
|
+
* local frame B. It optionally accepts `collide_connected`. The world is
|
|
275
|
+
* derived from `body_a`. The active 6-DOF solver ignores its legacy
|
|
276
|
+
* linear-reference-frame selector, so that field is rejected rather than
|
|
277
|
+
* silently accepted.
|
|
278
|
+
*
|
|
279
|
+
* @param body_a - first body
|
|
280
|
+
* @param body_b - second body or world
|
|
281
|
+
* @param params - local frames and options
|
|
282
|
+
* @returns generic 6-DOF constraint
|
|
283
|
+
*/
|
|
284
|
+
function create_generic_6dof(body_a: Opaque<"btRigidBody">, body_b: undefined, params: bullet3d.constraint.generic_6dof_params): bullet3d.constraint.btTypedConstraint;
|
|
263
285
|
/**
|
|
264
286
|
* Both bodies and both local frames are required. The params table optionally
|
|
265
287
|
* accepts `collide_connected`. The world is derived from `body_a`. The active
|
|
@@ -339,7 +361,44 @@ declare global {
|
|
|
339
361
|
* });
|
|
340
362
|
* ```
|
|
341
363
|
*/
|
|
342
|
-
function create_hinge(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody"> | undefined, params: bullet3d.constraint.hinge_params): bullet3d.constraint.btTypedConstraint;
|
|
364
|
+
function create_hinge(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody"> | undefined, params: bullet3d.constraint.hinge_params & Required<Pick<bullet3d.constraint.hinge_params, "frame_b_position" | "frame_b_rotation">>): bullet3d.constraint.btTypedConstraint;
|
|
365
|
+
/**
|
|
366
|
+
* The world is derived from `body_a`.
|
|
367
|
+
*
|
|
368
|
+
* @param body_a - first body
|
|
369
|
+
* @param body_b - second body or world
|
|
370
|
+
* @param params - local frames and options
|
|
371
|
+
* @returns hinge constraint
|
|
372
|
+
* @example
|
|
373
|
+
* ```ts
|
|
374
|
+
* // Create a motorized hinge with a 90-degree range:
|
|
375
|
+
* export default defineScript({
|
|
376
|
+
* init() {
|
|
377
|
+
* const body_a = bullet3d.get_rigid_body("/door#collisionobject");
|
|
378
|
+
* const body_b = bullet3d.get_rigid_body("/frame#collisionobject");
|
|
379
|
+
* let hinge: bullet3d.constraint.btTypedConstraint | undefined;
|
|
380
|
+
* if (body_a !== undefined) {
|
|
381
|
+
* hinge = bullet3d.constraint.create_hinge(body_a, body_b, {
|
|
382
|
+
* frame_a_position: vmath.vector3(-0.5, 0, 0),
|
|
383
|
+
* frame_a_rotation: vmath.quat(),
|
|
384
|
+
* frame_b_position: vmath.vector3(0.5, 0, 0),
|
|
385
|
+
* frame_b_rotation: vmath.quat(),
|
|
386
|
+
* });
|
|
387
|
+
* bullet3d.constraint.set_hinge_limits(hinge, -math.pi / 4, math.pi / 4);
|
|
388
|
+
* bullet3d.constraint.set_hinge_motor(hinge, true, 1.5, 2.5);
|
|
389
|
+
* }
|
|
390
|
+
* return { hinge };
|
|
391
|
+
* },
|
|
392
|
+
*
|
|
393
|
+
* final(self) {
|
|
394
|
+
* if (self.hinge !== undefined && bullet3d.constraint.is_valid(self.hinge)) {
|
|
395
|
+
* bullet3d.constraint.destroy(self.hinge);
|
|
396
|
+
* }
|
|
397
|
+
* },
|
|
398
|
+
* });
|
|
399
|
+
* ```
|
|
400
|
+
*/
|
|
401
|
+
function create_hinge(body_a: Opaque<"btRigidBody">, body_b: undefined, params: bullet3d.constraint.hinge_params): bullet3d.constraint.btTypedConstraint;
|
|
343
402
|
/**
|
|
344
403
|
* Both bodies are required. Its initial linear suspension travel is one Defold
|
|
345
404
|
* unit in either direction. The world is derived from `body_a`.
|
|
@@ -383,7 +442,50 @@ declare global {
|
|
|
383
442
|
* });
|
|
384
443
|
* ```
|
|
385
444
|
*/
|
|
386
|
-
function create_point_to_point(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody"> | undefined, params: bullet3d.constraint.point_to_point_params): bullet3d.constraint.btTypedConstraint;
|
|
445
|
+
function create_point_to_point(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody"> | undefined, params: bullet3d.constraint.point_to_point_params & Required<Pick<bullet3d.constraint.point_to_point_params, "pivot_b">>): bullet3d.constraint.btTypedConstraint;
|
|
446
|
+
/**
|
|
447
|
+
* The world is derived from `body_a`; both bodies must belong to that same world.
|
|
448
|
+
*
|
|
449
|
+
* @param body_a - first body
|
|
450
|
+
* @param body_b - second body or world
|
|
451
|
+
* @param params - pivots and options
|
|
452
|
+
* @returns point-to-point constraint
|
|
453
|
+
* @example
|
|
454
|
+
* ```ts
|
|
455
|
+
* // Join two bodies at matching local pivots and explicitly destroy the
|
|
456
|
+
* // constraint when the script is finalized:
|
|
457
|
+
* export default defineScript({
|
|
458
|
+
* init() {
|
|
459
|
+
* const body_a = bullet3d.get_rigid_body("/body_a#collisionobject");
|
|
460
|
+
* const body_b = bullet3d.get_rigid_body("/body_b#collisionobject");
|
|
461
|
+
* let constraint: bullet3d.constraint.btTypedConstraint | undefined;
|
|
462
|
+
* if (body_a !== undefined) {
|
|
463
|
+
* constraint = bullet3d.constraint.create_point_to_point(body_a, body_b, {
|
|
464
|
+
* pivot_a: vmath.vector3(0.5, 0, 0),
|
|
465
|
+
* pivot_b: vmath.vector3(-0.5, 0, 0),
|
|
466
|
+
* });
|
|
467
|
+
* }
|
|
468
|
+
* return { constraint };
|
|
469
|
+
* },
|
|
470
|
+
*
|
|
471
|
+
* final(self) {
|
|
472
|
+
* if (self.constraint !== undefined && bullet3d.constraint.is_valid(self.constraint)) {
|
|
473
|
+
* bullet3d.constraint.destroy(self.constraint);
|
|
474
|
+
* }
|
|
475
|
+
* },
|
|
476
|
+
* });
|
|
477
|
+
* ```
|
|
478
|
+
*/
|
|
479
|
+
function create_point_to_point(body_a: Opaque<"btRigidBody">, body_b: undefined, params: bullet3d.constraint.point_to_point_params): bullet3d.constraint.btTypedConstraint;
|
|
480
|
+
/**
|
|
481
|
+
* The world is derived from `body_a`.
|
|
482
|
+
*
|
|
483
|
+
* @param body_a - first body
|
|
484
|
+
* @param body_b - second body or world
|
|
485
|
+
* @param params - local frames and options
|
|
486
|
+
* @returns slider constraint
|
|
487
|
+
*/
|
|
488
|
+
function create_slider(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody"> | undefined, params: bullet3d.constraint.slider_params & Required<Pick<bullet3d.constraint.slider_params, "frame_b_position" | "frame_b_rotation">>): bullet3d.constraint.btTypedConstraint;
|
|
387
489
|
/**
|
|
388
490
|
* The world is derived from `body_a`.
|
|
389
491
|
*
|
|
@@ -392,7 +494,7 @@ declare global {
|
|
|
392
494
|
* @param params - local frames and options
|
|
393
495
|
* @returns slider constraint
|
|
394
496
|
*/
|
|
395
|
-
function create_slider(body_a: Opaque<"btRigidBody">, body_b:
|
|
497
|
+
function create_slider(body_a: Opaque<"btRigidBody">, body_b: undefined, params: bullet3d.constraint.slider_params): bullet3d.constraint.btTypedConstraint;
|
|
396
498
|
/**
|
|
397
499
|
* Both bodies are required. The world is derived from `body_a`.
|
|
398
500
|
*
|
|
@@ -567,7 +669,7 @@ declare global {
|
|
|
567
669
|
* @param constraint - slider constraint
|
|
568
670
|
* @param motor - `linear` or `angular`
|
|
569
671
|
*/
|
|
570
|
-
function get_slider_motor(constraint: bullet3d.constraint.btTypedConstraint, motor:
|
|
672
|
+
function get_slider_motor(constraint: bullet3d.constraint.btTypedConstraint, motor: "linear" | "angular"): LuaMultiReturn<[boolean, number, number]>;
|
|
571
673
|
/**
|
|
572
674
|
* Get the current slider position
|
|
573
675
|
*
|
|
@@ -781,7 +883,7 @@ declare global {
|
|
|
781
883
|
* @param target_velocity - linear or angular target velocity
|
|
782
884
|
* @param max_force - non-negative maximum linear force or angular torque
|
|
783
885
|
*/
|
|
784
|
-
function set_slider_motor(constraint: bullet3d.constraint.btTypedConstraint, motor:
|
|
886
|
+
function set_slider_motor(constraint: bullet3d.constraint.btTypedConstraint, motor: "linear" | "angular", enabled: boolean, target_velocity: number, max_force: number): void;
|
|
785
887
|
/**
|
|
786
888
|
* Generic spring 6-DOF constraints use a scale-independent damping factor from
|
|
787
889
|
* 0 to 1, where 1 means no damping. Hinge2 constraints use a damping coefficient
|
|
@@ -11,7 +11,7 @@ declare global {
|
|
|
11
11
|
*/
|
|
12
12
|
namespace bullet3d.shape {
|
|
13
13
|
type btCollisionShape = Opaque<"btCollisionShape">;
|
|
14
|
-
type definition = { type: bullet3d.shape.
|
|
14
|
+
type definition = { type: typeof bullet3d.shape.SHAPE_TYPE_SPHERE; diameter: number; position?: Vector3; rotation?: Quaternion; target_rotation?: Quaternion } | { type: typeof bullet3d.shape.SHAPE_TYPE_BOX; dimensions: Vector3; position?: Vector3; rotation?: Quaternion; target_rotation?: Quaternion } | { type: typeof bullet3d.shape.SHAPE_TYPE_CAPSULE; diameter: number; height: number; position?: Vector3; rotation?: Quaternion; target_rotation?: Quaternion } | { type: typeof bullet3d.shape.SHAPE_TYPE_HULL; vertices: Vector3[]; position?: Vector3; rotation?: Quaternion; target_rotation?: Quaternion };
|
|
15
15
|
type SHAPE_TYPE = typeof bullet3d.shape.SHAPE_TYPE_BOX | typeof bullet3d.shape.SHAPE_TYPE_CAPSULE | typeof bullet3d.shape.SHAPE_TYPE_HULL | typeof bullet3d.shape.SHAPE_TYPE_MESH | typeof bullet3d.shape.SHAPE_TYPE_SPHERE;
|
|
16
16
|
/**
|
|
17
17
|
* Box shape type Value `1`. Shape data contains positive vector3 `dimensions` in Defold units.
|
|
@@ -66,7 +66,7 @@ declare global {
|
|
|
66
66
|
* @param shape - shape handle
|
|
67
67
|
* @returns typed shape geometry in Defold units
|
|
68
68
|
*/
|
|
69
|
-
function get_shape(shape: bullet3d.shape.btCollisionShape): bullet3d.shape.definition;
|
|
69
|
+
function get_shape(shape: bullet3d.shape.btCollisionShape): bullet3d.shape.definition | { type: typeof bullet3d.shape.SHAPE_TYPE_MESH };
|
|
70
70
|
/**
|
|
71
71
|
* Get the normalized Defold shape type.
|
|
72
72
|
*
|
|
@@ -86,7 +86,7 @@ declare global {
|
|
|
86
86
|
* }
|
|
87
87
|
* ```
|
|
88
88
|
*/
|
|
89
|
-
function create(url: string | Hash | Url, position?: Vector3, rotation?: Quaternion, properties?: LuaMap<Hash, Record<string | number, unknown>> | Record<string, Record<string | number, unknown>>, scale?: number | Vector3): LuaTable<Hash, Hash
|
|
89
|
+
function create(url: string | Hash | Url, position?: Vector3, rotation?: Quaternion, properties?: LuaMap<Hash, Record<string | number, unknown>> | Record<string, Record<string | number, unknown>>, scale?: number | Vector3): LuaTable<Hash, Hash> & { get: LuaTableGetMethod<string, Hash> };
|
|
90
90
|
/**
|
|
91
91
|
* This returns status of the collection factory.
|
|
92
92
|
* Calling this function when the factory is not marked as dynamic loading always returns COMP_COLLECTION_FACTORY_STATUS_LOADED.
|
|
@@ -78,7 +78,7 @@ declare global {
|
|
|
78
78
|
* });
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
|
-
function load(url: string | Hash | Url, options: {} | undefined, callback: (self: unknown, message_id: Hash, message:
|
|
81
|
+
function load(url: string | Hash | Url, options: {} | undefined, callback: (self: unknown, message_id: Hash, message: collectionproxy.load_data, sender: Url) => void): void;
|
|
82
82
|
/**
|
|
83
83
|
* The collection should be loaded by the collection proxy.
|
|
84
84
|
* Setting the collection to "nil" will revert it back to the original collection.
|
|
@@ -102,7 +102,7 @@ declare global {
|
|
|
102
102
|
* msg.post("/go#collectionproxy", "enable");
|
|
103
103
|
* ```
|
|
104
104
|
*/
|
|
105
|
-
function set_collection(url: string | Hash | Url, prototype: string | undefined): LuaMultiReturn<[boolean, collectionproxy.RESULT]>;
|
|
105
|
+
function set_collection(url: string | Hash | Url, prototype: string | undefined): LuaMultiReturn<[boolean, collectionproxy.RESULT | undefined]>;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -43,7 +43,9 @@ declare global {
|
|
|
43
43
|
* // create a new game object and provide property values
|
|
44
44
|
* const created = factory.create("#factory", undefined, undefined, { my_value: 1 });
|
|
45
45
|
* // communicate with the object
|
|
46
|
-
*
|
|
46
|
+
* if (created !== undefined) {
|
|
47
|
+
* msg.post(created, "hello");
|
|
48
|
+
* }
|
|
47
49
|
* },
|
|
48
50
|
* });
|
|
49
51
|
* ```
|
|
@@ -59,7 +61,7 @@ declare global {
|
|
|
59
61
|
* });
|
|
60
62
|
* ```
|
|
61
63
|
*/
|
|
62
|
-
function create(url: string | Hash | Url, position?: Vector3, rotation?: Quaternion, properties?: LuaMap<string | Hash, unknown> | Record<string, unknown>, scale?: number | Vector3): Hash;
|
|
64
|
+
function create(url: string | Hash | Url, position?: Vector3, rotation?: Quaternion, properties?: LuaMap<string | Hash, unknown> | Record<string, unknown>, scale?: number | Vector3): Hash | undefined;
|
|
63
65
|
/**
|
|
64
66
|
* This returns status of the factory.
|
|
65
67
|
* Calling this function when the factory is not marked as dynamic loading always returns
|
|
@@ -276,7 +276,65 @@ declare global {
|
|
|
276
276
|
* go.animate("go", "position.y", go.PLAYBACK_LOOP_PINGPONG, 100, vec, 2.0);
|
|
277
277
|
* ```
|
|
278
278
|
*/
|
|
279
|
-
export function animate(url: SceneAddress | Hash | Url, property: string | Hash, playback: go.PLAYBACK, to: number | Vector3 | Vector4 | Quaternion, easing: Vector | go.EASING, duration: number
|
|
279
|
+
export function animate(url: SceneAddress | Hash | Url, property: string | Hash, playback: go.PLAYBACK, to: number | Vector3 | Vector4 | Quaternion, easing: Vector | go.EASING, duration: number): void;
|
|
280
|
+
/**
|
|
281
|
+
* This is only supported for numerical properties. If the node property is already being
|
|
282
|
+
* animated, that animation will be canceled and replaced by the new one.
|
|
283
|
+
* If a `complete_function` (lua function) is specified, that function will be called when the animation has completed.
|
|
284
|
+
* By starting a new animation in that function, several animations can be sequenced together. See the examples for more information.
|
|
285
|
+
* If you call `go.animate()` from a game object's `final()` function,
|
|
286
|
+
* any passed `complete_function` will be ignored and never called upon animation completion.
|
|
287
|
+
* See the properties guide for which properties can be animated and the animation guide for how
|
|
288
|
+
* them.
|
|
289
|
+
*
|
|
290
|
+
* @param url - url of the game object or component having the property
|
|
291
|
+
* @param property - id of the property to animate
|
|
292
|
+
* @param playback - playback mode of the animation
|
|
293
|
+
*
|
|
294
|
+
* - `go.PLAYBACK_ONCE_FORWARD`
|
|
295
|
+
* - `go.PLAYBACK_ONCE_BACKWARD`
|
|
296
|
+
* - `go.PLAYBACK_ONCE_PINGPONG`
|
|
297
|
+
* - `go.PLAYBACK_LOOP_FORWARD`
|
|
298
|
+
* - `go.PLAYBACK_LOOP_BACKWARD`
|
|
299
|
+
* - `go.PLAYBACK_LOOP_PINGPONG`
|
|
300
|
+
* @param to - target property value
|
|
301
|
+
* @param easing - easing to use during animation. Either specify a constant, see the animation guide for a complete list, or a vmath.vector with a curve
|
|
302
|
+
* @param duration - duration of the animation in seconds
|
|
303
|
+
* @param delay - delay before the animation starts in seconds
|
|
304
|
+
* @param complete_function - optional function to call when the animation has completed
|
|
305
|
+
*
|
|
306
|
+
* `self`
|
|
307
|
+
*
|
|
308
|
+
* script_instance The current script instance.
|
|
309
|
+
*
|
|
310
|
+
* `url`
|
|
311
|
+
*
|
|
312
|
+
* url The game object or component instance for which the property is animated.
|
|
313
|
+
*
|
|
314
|
+
* `property`
|
|
315
|
+
*
|
|
316
|
+
* hash The id of the animated property.
|
|
317
|
+
* @example
|
|
318
|
+
* Animate the position of a game object to x = 10 during 1 second, then y = 20 during 1 second:
|
|
319
|
+
* ```ts
|
|
320
|
+
* go.animate(go.get_id(), "position.x", go.PLAYBACK_ONCE_FORWARD, 10, go.EASING_LINEAR, 1, 0, () => {
|
|
321
|
+
* go.animate(go.get_id(), "position.y", go.PLAYBACK_ONCE_FORWARD, 20, go.EASING_LINEAR, 1);
|
|
322
|
+
* });
|
|
323
|
+
* ```
|
|
324
|
+
* @example
|
|
325
|
+
* Animate the y position of a game object using a crazy custom easing curve:
|
|
326
|
+
* ```ts
|
|
327
|
+
* const values = [
|
|
328
|
+
* 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
329
|
+
* 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
330
|
+
* 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
331
|
+
* 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
332
|
+
* ];
|
|
333
|
+
* const vec = vmath.vector(values);
|
|
334
|
+
* go.animate("go", "position.y", go.PLAYBACK_LOOP_PINGPONG, 100, vec, 2.0);
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
export function animate(url: SceneAddress | Hash | Url, property: string | Hash, playback: go.PLAYBACK, to: number | Vector3 | Vector4 | Quaternion, easing: Vector | go.EASING, duration: number, delay: number, complete_function?: (self: unknown, url: Url, property: Hash) => void): void;
|
|
280
338
|
/**
|
|
281
339
|
* By calling this function, all or specified stored property animations of the game object or component will be canceled.
|
|
282
340
|
* See the properties guide for which properties can be animated and the animation guide for how to animate them.
|
|
@@ -335,7 +393,43 @@ declare global {
|
|
|
335
393
|
* go.delete(ids, true);
|
|
336
394
|
* ```
|
|
337
395
|
*/
|
|
338
|
-
function _delete(id?: SceneGameObjectAddress | Hash | Url | (
|
|
396
|
+
function _delete(id?: SceneGameObjectAddress | Hash | Url | (SceneGameObjectAddress | Hash | Url)[] | LuaPairsIterable<AnyNotNil, SceneGameObjectAddress | Hash | Url> | boolean): void;
|
|
397
|
+
/**
|
|
398
|
+
* Delete one or more game objects identified by id. Deletion is asynchronous meaning that
|
|
399
|
+
* the game object(s) are scheduled for deletion which will happen at the end of the current
|
|
400
|
+
* frame. Note that game objects scheduled for deletion will be counted against
|
|
401
|
+
* `max_instances` in "game.project" until they are actually removed.
|
|
402
|
+
* Deleting a game object containing a particle FX component emitting particles will not immediately stop the particle FX from emitting particles. You need to manually stop the particle FX using `particlefx.stop()`.
|
|
403
|
+
* Deleting a game object containing a sound component that is playing will not immediately stop the sound from playing. You need to manually stop the sound using `sound.stop()`.
|
|
404
|
+
*
|
|
405
|
+
* @param id - optional id or table of id's of the instance(s) to delete, the instance of the calling script is deleted by default
|
|
406
|
+
* @param recursive - optional boolean, set to true to recursively delete child hiearchy in child to parent order
|
|
407
|
+
* @example
|
|
408
|
+
* This example demonstrates how to delete game objects
|
|
409
|
+
* ```ts
|
|
410
|
+
* // Delete the script's own game object.
|
|
411
|
+
* go.delete();
|
|
412
|
+
* // Delete a game object with the id "my_game_object".
|
|
413
|
+
* const id = go.get_id("my_game_object"); // retrieve the id of the game object to be deleted
|
|
414
|
+
* go.delete(id);
|
|
415
|
+
* // Delete a list of game objects.
|
|
416
|
+
* const ids = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
|
|
417
|
+
* go.delete(ids);
|
|
418
|
+
* ```
|
|
419
|
+
* @example
|
|
420
|
+
* This example demonstrates how to delete a game objects and their children (child to parent order)
|
|
421
|
+
* ```ts
|
|
422
|
+
* // Delete the script's own game object and its children.
|
|
423
|
+
* go.delete(true);
|
|
424
|
+
* // Delete a game object with the id "my_game_object" and its children.
|
|
425
|
+
* const id = go.get_id("my_game_object"); // retrieve the id of the game object to be deleted
|
|
426
|
+
* go.delete(id, true);
|
|
427
|
+
* // Delete a list of game objects and their children.
|
|
428
|
+
* const ids = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
|
|
429
|
+
* go.delete(ids, true);
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
432
|
+
function _delete(id: SceneGameObjectAddress | Hash | Url | (SceneGameObjectAddress | Hash | Url)[] | LuaPairsIterable<AnyNotNil, SceneGameObjectAddress | Hash | Url>, recursive: boolean): void;
|
|
339
433
|
/**
|
|
340
434
|
* This function can check for game objects in any collection by specifying
|
|
341
435
|
* the collection name in the URL.
|
|
@@ -355,36 +449,29 @@ declare global {
|
|
|
355
449
|
*/
|
|
356
450
|
export function exists(url: SceneGameObjectAddress | Hash | Url): boolean;
|
|
357
451
|
/**
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
452
|
+
* Returns or constructs an instance identifier. The instance id is a hash
|
|
453
|
+
* of the absolute path to the instance.
|
|
454
|
+
*
|
|
455
|
+
* - If `path` is specified, it can either be absolute or relative to the instance of the calling script.
|
|
456
|
+
* - If `path` is not specified, the id of the game object instance the script is attached to will be returned.
|
|
361
457
|
*
|
|
362
|
-
* @param
|
|
458
|
+
* @param path - path of the instance for which to return the id
|
|
459
|
+
* @returns instance id
|
|
363
460
|
* @example
|
|
364
461
|
* ```ts
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
462
|
+
* // For the instance with path /my_sub_collection/my_instance, the following calls
|
|
463
|
+
* // are equivalent:
|
|
464
|
+
* const id = go.get_id(); // no path, defaults to the instance containing the calling script
|
|
465
|
+
* print(id); // => hash: [/my_sub_collection/my_instance]
|
|
369
466
|
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
* msg.post("my_friend_instance", "im_dead", { my_stats: self.some_value });
|
|
373
|
-
* },
|
|
374
|
-
* });
|
|
375
|
-
* ```
|
|
376
|
-
*/
|
|
377
|
-
export function final(self: unknown): void;
|
|
378
|
-
/**
|
|
379
|
-
* This is a callback-function, which is called by the engine at fixed intervals to update the state of a script
|
|
380
|
-
* component. The function will be called if 'Fixed Update Frequency' is enabled in the Engine section of game.project.
|
|
381
|
-
* It can for instance be used to update game logic with the physics simulation if using a fixed timestep for the
|
|
382
|
-
* physics (enabled by ticking 'Use Fixed Timestep' in the Physics section of game.project).
|
|
467
|
+
* const id2 = go.get_id("/my_sub_collection/my_instance"); // absolute path
|
|
468
|
+
* print(id2); // => hash: [/my_sub_collection/my_instance]
|
|
383
469
|
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
470
|
+
* const id3 = go.get_id("my_instance"); // relative path
|
|
471
|
+
* print(id3); // => hash: [/my_sub_collection/my_instance]
|
|
472
|
+
* ```
|
|
386
473
|
*/
|
|
387
|
-
export function
|
|
474
|
+
export function get_id(): Hash;
|
|
388
475
|
/**
|
|
389
476
|
* Returns or constructs an instance identifier. The instance id is a hash
|
|
390
477
|
* of the absolute path to the instance.
|
|
@@ -408,7 +495,7 @@ declare global {
|
|
|
408
495
|
* print(id3); // => hash: [/my_sub_collection/my_instance]
|
|
409
496
|
* ```
|
|
410
497
|
*/
|
|
411
|
-
export function get_id(path
|
|
498
|
+
export function get_id(path: string): Hash;
|
|
412
499
|
/**
|
|
413
500
|
* Get the parent for a game object instance.
|
|
414
501
|
*
|
|
@@ -591,176 +678,6 @@ declare global {
|
|
|
591
678
|
* ```
|
|
592
679
|
*/
|
|
593
680
|
export function get_world_transform(id?: SceneGameObjectAddress | Hash | Url): Matrix4;
|
|
594
|
-
/**
|
|
595
|
-
* This is a callback-function, which is called by the engine when a script component is initialized. It can be used
|
|
596
|
-
* to set the initial state of the script.
|
|
597
|
-
*
|
|
598
|
-
* @param self - script instance used for storing state
|
|
599
|
-
* @example
|
|
600
|
-
* ```ts
|
|
601
|
-
* export default defineScript({
|
|
602
|
-
* init() {
|
|
603
|
-
* // set up useful data
|
|
604
|
-
* return { my_value: 1 };
|
|
605
|
-
* },
|
|
606
|
-
* });
|
|
607
|
-
* ```
|
|
608
|
-
*/
|
|
609
|
-
export function init(self: unknown): void;
|
|
610
|
-
/**
|
|
611
|
-
* This is a callback-function, which is called by the engine at the end of the frame to update the state of a script
|
|
612
|
-
* component. Use it to make final adjustments to the game object instance.
|
|
613
|
-
*
|
|
614
|
-
* @param self - script instance used for storing state
|
|
615
|
-
* @param dt - the time-step of the frame update
|
|
616
|
-
*/
|
|
617
|
-
export function late_update(self: unknown, dt: number): void;
|
|
618
|
-
/**
|
|
619
|
-
* This is a callback-function, which is called by the engine when user input is sent to the game object instance of the script.
|
|
620
|
-
* It can be used to take action on the input, e.g. move the instance according to the input.
|
|
621
|
-
* For an instance to obtain user input, it must first acquire input focus
|
|
622
|
-
* through the message `acquire_input_focus`.
|
|
623
|
-
* Any instance that has obtained input will be put on top of an
|
|
624
|
-
* input stack. Input is sent to all listeners on the stack until the
|
|
625
|
-
* end of stack is reached, or a listener returns `true`
|
|
626
|
-
* to signal that it wants input to be consumed.
|
|
627
|
-
* See the documentation of acquire_input_focus for more
|
|
628
|
-
* information.
|
|
629
|
-
*
|
|
630
|
-
* @param self - script instance used for storing state
|
|
631
|
-
* @param action_id - id of the received input action, as mapped in the input_binding-file, or `nil` for mouse movement
|
|
632
|
-
* @param action - input data for the action. **0️⃣ `gamepad` is 0-based; passed to Defold unchanged.**
|
|
633
|
-
* @returns optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
|
|
634
|
-
* @example
|
|
635
|
-
* ```ts
|
|
636
|
-
* // This example demonstrates how a game object instance can be moved as a response to user input.
|
|
637
|
-
* export default defineScript({
|
|
638
|
-
* init() {
|
|
639
|
-
* // acquire input focus
|
|
640
|
-
* msg.post(".", "acquire_input_focus");
|
|
641
|
-
* return {
|
|
642
|
-
* // maximum speed the instance can be moved
|
|
643
|
-
* max_speed: 2,
|
|
644
|
-
* // velocity of the instance, initially zero
|
|
645
|
-
* velocity: vmath.vector3(),
|
|
646
|
-
* };
|
|
647
|
-
* },
|
|
648
|
-
*
|
|
649
|
-
* update(self, dt) {
|
|
650
|
-
* // move the instance
|
|
651
|
-
* go.set_position(go.get_position().add(self.velocity.mul(dt)));
|
|
652
|
-
* },
|
|
653
|
-
*
|
|
654
|
-
* on_input(self, action_id, action) {
|
|
655
|
-
* // check for movement input
|
|
656
|
-
* if (action_id === hash("right")) {
|
|
657
|
-
* if (action.released) {
|
|
658
|
-
* // reset velocity if input was released
|
|
659
|
-
* self.velocity = vmath.vector3();
|
|
660
|
-
* } else {
|
|
661
|
-
* // update velocity
|
|
662
|
-
* self.velocity = vmath.vector3((action.value ?? 0) * self.max_speed, 0, 0);
|
|
663
|
-
* }
|
|
664
|
-
* }
|
|
665
|
-
* },
|
|
666
|
-
* });
|
|
667
|
-
* ```
|
|
668
|
-
*/
|
|
669
|
-
export function on_input(self: unknown, action_id: Hash | undefined, action: go.on_input.action): boolean | undefined;
|
|
670
|
-
/**
|
|
671
|
-
* This is a callback-function, which is called by the engine whenever a message has been sent to the script component.
|
|
672
|
-
* It can be used to take action on the message, e.g. send a response back to the sender of the message.
|
|
673
|
-
* The `message` parameter is a table containing the message data. If the message is sent from the engine, the
|
|
674
|
-
* documentation of the message specifies which data is supplied.
|
|
675
|
-
*
|
|
676
|
-
* @param self - script instance used for storing state
|
|
677
|
-
* @param message_id - id of the received message
|
|
678
|
-
* @param message - a table containing the message data
|
|
679
|
-
* @param sender - address of the sender
|
|
680
|
-
* @example
|
|
681
|
-
* This example demonstrates how a game object instance, called "a", can communicate with another instance, called "b". It
|
|
682
|
-
* is assumed that both script components of the instances has id "script".
|
|
683
|
-
* Script of instance "a":
|
|
684
|
-
* ```ts
|
|
685
|
-
* // This example demonstrates how a game object instance, called "a", can communicate with another instance, called "b". It
|
|
686
|
-
* // is assumed that both script components of the instances has id "script".
|
|
687
|
-
*
|
|
688
|
-
* // a.script — Script of instance "a":
|
|
689
|
-
* export default defineScript({
|
|
690
|
-
* init() {
|
|
691
|
-
* // let b know about some important data
|
|
692
|
-
* msg.post("b#script", "my_data", { important_value: 1 });
|
|
693
|
-
* },
|
|
694
|
-
* });
|
|
695
|
-
* ```
|
|
696
|
-
* @example
|
|
697
|
-
* Script of instance "b":
|
|
698
|
-
* ```ts
|
|
699
|
-
* // b.script — Script of instance "b":
|
|
700
|
-
* export default defineScript({
|
|
701
|
-
* init() {
|
|
702
|
-
* // store the url of instance "a" for later use, by specifying undefined as socket we
|
|
703
|
-
* // automatically use our own socket
|
|
704
|
-
* return { a_url: msg.url(undefined, go.get_id("a"), "script"), important_value: 0 };
|
|
705
|
-
* },
|
|
706
|
-
*
|
|
707
|
-
* on_message(self, message_id, message, sender) {
|
|
708
|
-
* // check message and sender
|
|
709
|
-
* if (message_id === hash("my_data") && sender === self.a_url && typeof message.important_value === "number") {
|
|
710
|
-
* // use the data in some way
|
|
711
|
-
* self.important_value = message.important_value;
|
|
712
|
-
* }
|
|
713
|
-
* },
|
|
714
|
-
* });
|
|
715
|
-
* ```
|
|
716
|
-
*/
|
|
717
|
-
export function on_message(self: unknown, message_id: Hash, message: LuaMap<AnyNotNil, unknown> | Record<string, unknown>, sender: Url): void;
|
|
718
|
-
/**
|
|
719
|
-
* This is a callback-function, which is called by the engine when the script component is reloaded, e.g. from the editor.
|
|
720
|
-
* It can be used for live development, e.g. to tweak constants or set up the state properly for the instance.
|
|
721
|
-
*
|
|
722
|
-
* @param self - script instance used for storing state
|
|
723
|
-
* @example
|
|
724
|
-
* ```ts
|
|
725
|
-
* // This example demonstrates how to tweak the speed of a game object instance that is moved on user input.
|
|
726
|
-
* export default defineScript({
|
|
727
|
-
* init() {
|
|
728
|
-
* // acquire input focus
|
|
729
|
-
* msg.post(".", "acquire_input_focus");
|
|
730
|
-
* return {
|
|
731
|
-
* // maximum speed the instance can be moved, this value is tweaked in the on_reload function below
|
|
732
|
-
* max_speed: 2,
|
|
733
|
-
* // velocity of the instance, initially zero
|
|
734
|
-
* velocity: vmath.vector3(),
|
|
735
|
-
* };
|
|
736
|
-
* },
|
|
737
|
-
*
|
|
738
|
-
* update(self, dt) {
|
|
739
|
-
* // move the instance
|
|
740
|
-
* go.set_position(go.get_position().add(self.velocity.mul(dt)));
|
|
741
|
-
* },
|
|
742
|
-
*
|
|
743
|
-
* on_input(self, action_id, action) {
|
|
744
|
-
* // check for movement input
|
|
745
|
-
* if (action_id === hash("right")) {
|
|
746
|
-
* if (action.released) {
|
|
747
|
-
* // reset velocity if input was released
|
|
748
|
-
* self.velocity = vmath.vector3();
|
|
749
|
-
* } else {
|
|
750
|
-
* // update velocity
|
|
751
|
-
* self.velocity = vmath.vector3((action.value ?? 0) * self.max_speed, 0, 0);
|
|
752
|
-
* }
|
|
753
|
-
* }
|
|
754
|
-
* },
|
|
755
|
-
*
|
|
756
|
-
* on_reload(self) {
|
|
757
|
-
* // edit this value and reload the script component
|
|
758
|
-
* self.max_speed = 100;
|
|
759
|
-
* },
|
|
760
|
-
* });
|
|
761
|
-
* ```
|
|
762
|
-
*/
|
|
763
|
-
export function on_reload(self: unknown): void;
|
|
764
681
|
/**
|
|
765
682
|
* Sets the parent for a game object instance. This means that the instance will exist in the geometrical space of its parent,
|
|
766
683
|
* like a basic transformation hierarchy or scene graph. If no parent is specified, the instance will be detached from any parent and exist in world
|
|
@@ -873,29 +790,6 @@ declare global {
|
|
|
873
790
|
* ```
|
|
874
791
|
*/
|
|
875
792
|
export function set_scale_xy(scale: number | Vector3, id?: SceneGameObjectAddress | Hash | Url): void;
|
|
876
|
-
/**
|
|
877
|
-
* This is a callback-function, which is called by the engine every frame to update the state of a script component.
|
|
878
|
-
* It can be used to perform any kind of game related tasks, e.g. moving the game object instance.
|
|
879
|
-
*
|
|
880
|
-
* @param self - script instance used for storing state
|
|
881
|
-
* @param dt - the time-step of the frame update
|
|
882
|
-
* @example
|
|
883
|
-
* ```ts
|
|
884
|
-
* // This example demonstrates how to move a game object instance through the script component:
|
|
885
|
-
* export default defineScript({
|
|
886
|
-
* init() {
|
|
887
|
-
* // set initial velocity to be 1 along world x-axis
|
|
888
|
-
* return { my_velocity: vmath.vector3(1, 0, 0) };
|
|
889
|
-
* },
|
|
890
|
-
*
|
|
891
|
-
* update(self, dt) {
|
|
892
|
-
* // move the game object instance
|
|
893
|
-
* go.set_position(go.get_position().add(self.my_velocity.mul(dt)));
|
|
894
|
-
* },
|
|
895
|
-
* });
|
|
896
|
-
* ```
|
|
897
|
-
*/
|
|
898
|
-
export function update(self: unknown, dt: number): void;
|
|
899
793
|
/**
|
|
900
794
|
* Recalculates and updates the cached world transform immediately for the target instance
|
|
901
795
|
* and its ancestors (parent chain up to the collection root). Descendants (children) are
|
|
@@ -110,6 +110,7 @@ declare global {
|
|
|
110
110
|
*/
|
|
111
111
|
max_storage_buffer_range: number;
|
|
112
112
|
}
|
|
113
|
+
type BlendFactor = typeof graphics.BLEND_FACTOR_ZERO | typeof graphics.BLEND_FACTOR_ONE | typeof graphics.BLEND_FACTOR_SRC_COLOR | typeof graphics.BLEND_FACTOR_ONE_MINUS_SRC_COLOR | typeof graphics.BLEND_FACTOR_DST_COLOR | typeof graphics.BLEND_FACTOR_ONE_MINUS_DST_COLOR | typeof graphics.BLEND_FACTOR_SRC_ALPHA | typeof graphics.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA | typeof graphics.BLEND_FACTOR_DST_ALPHA | typeof graphics.BLEND_FACTOR_ONE_MINUS_DST_ALPHA | typeof graphics.BLEND_FACTOR_SRC_ALPHA_SATURATE | typeof graphics.BLEND_FACTOR_CONSTANT_COLOR | typeof graphics.BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR | typeof graphics.BLEND_FACTOR_CONSTANT_ALPHA | typeof graphics.BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA;
|
|
113
114
|
type BufferType = typeof graphics.BUFFER_TYPE_COLOR0_BIT | typeof graphics.BUFFER_TYPE_COLOR1_BIT | typeof graphics.BUFFER_TYPE_COLOR2_BIT | typeof graphics.BUFFER_TYPE_COLOR3_BIT | typeof graphics.BUFFER_TYPE_DEPTH_BIT | typeof graphics.BUFFER_TYPE_STENCIL_BIT;
|
|
114
115
|
type State = typeof graphics.STATE_DEPTH_TEST | typeof graphics.STATE_STENCIL_TEST | typeof graphics.STATE_BLEND | typeof graphics.STATE_ALPHA_TEST | typeof graphics.STATE_CULL_FACE | typeof graphics.STATE_POLYGON_OFFSET_FILL;
|
|
115
116
|
type BLEND_EQUATION = typeof graphics.BLEND_EQUATION_ADD | typeof graphics.BLEND_EQUATION_MAX | typeof graphics.BLEND_EQUATION_MIN | typeof graphics.BLEND_EQUATION_REVERSE_SUBTRACT | typeof graphics.BLEND_EQUATION_SUBTRACT;
|