@defold-typescript/types 0.5.5 → 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 +123 -124
- 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 +3 -0
- 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 +3 -0
- 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 +22 -0
- 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/fidelity-audit.ts +61 -1
- package/scripts/fidelity-baseline.json +10 -10
- package/scripts/ref-doc-delta.ts +143 -0
- package/scripts/regen.ts +18 -9
- package/src/core-types.ts +14 -0
- package/src/emit-dts.ts +219 -13
- package/src/engine-globals.d.ts +2 -0
- package/src/go-overloads.d.ts +43 -0
- package/src/index.ts +5 -0
- package/src/lifecycle.ts +157 -16
- package/src/publish-dts.ts +1 -1
package/generated/go.d.ts
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
import type { Hash, Matrix4, Opaque, Quaternion, Url, Vector, Vector3, Vector4 } from "../src/core-types";
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Functions, core hooks, messages and constants for manipulation of
|
|
7
|
+
* game objects. The "go" namespace is accessible from game object script
|
|
8
|
+
* files.
|
|
9
|
+
*/
|
|
5
10
|
namespace go {
|
|
6
11
|
/**
|
|
7
12
|
* in-back
|
|
@@ -322,11 +327,13 @@ declare global {
|
|
|
322
327
|
*
|
|
323
328
|
* @param self - reference to the script state to be used for storing data
|
|
324
329
|
* @example
|
|
325
|
-
* ```
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
+
* ```ts
|
|
331
|
+
* export default defineScript({
|
|
332
|
+
* final(self) {
|
|
333
|
+
* // report finalization
|
|
334
|
+
* msg.post("my_friend_instance", "im_dead", { my_stats: self.some_value });
|
|
335
|
+
* },
|
|
336
|
+
* });
|
|
330
337
|
* ```
|
|
331
338
|
*/
|
|
332
339
|
export function final(self: Opaque<"userdata">): void;
|
|
@@ -530,11 +537,13 @@ declare global {
|
|
|
530
537
|
*
|
|
531
538
|
* @param self - reference to the script state to be used for storing data
|
|
532
539
|
* @example
|
|
533
|
-
* ```
|
|
534
|
-
*
|
|
535
|
-
*
|
|
536
|
-
*
|
|
537
|
-
*
|
|
540
|
+
* ```ts
|
|
541
|
+
* export default defineScript({
|
|
542
|
+
* init() {
|
|
543
|
+
* // set up useful data
|
|
544
|
+
* return { my_value: 1 };
|
|
545
|
+
* },
|
|
546
|
+
* });
|
|
538
547
|
* ```
|
|
539
548
|
*/
|
|
540
549
|
export function init(self: Opaque<"userdata">): void;
|
|
@@ -646,32 +655,38 @@ declare global {
|
|
|
646
655
|
* @param action - a table containing the input data, see above for a description
|
|
647
656
|
* @returns optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
|
|
648
657
|
* @example
|
|
649
|
-
* ```
|
|
650
|
-
* This example demonstrates how a game object instance can be moved as a response to user input.
|
|
651
|
-
*
|
|
652
|
-
*
|
|
653
|
-
*
|
|
654
|
-
*
|
|
655
|
-
*
|
|
656
|
-
*
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
*
|
|
662
|
-
*
|
|
663
|
-
*
|
|
664
|
-
*
|
|
665
|
-
*
|
|
666
|
-
*
|
|
667
|
-
*
|
|
668
|
-
*
|
|
669
|
-
*
|
|
670
|
-
*
|
|
671
|
-
*
|
|
672
|
-
*
|
|
673
|
-
*
|
|
674
|
-
*
|
|
658
|
+
* ```ts
|
|
659
|
+
* // This example demonstrates how a game object instance can be moved as a response to user input.
|
|
660
|
+
* export default defineScript({
|
|
661
|
+
* init() {
|
|
662
|
+
* // acquire input focus
|
|
663
|
+
* msg.post(".", "acquire_input_focus");
|
|
664
|
+
* return {
|
|
665
|
+
* // maximum speed the instance can be moved
|
|
666
|
+
* max_speed: 2,
|
|
667
|
+
* // velocity of the instance, initially zero
|
|
668
|
+
* velocity: vmath.vector3(),
|
|
669
|
+
* };
|
|
670
|
+
* },
|
|
671
|
+
*
|
|
672
|
+
* update(self, dt) {
|
|
673
|
+
* // move the instance
|
|
674
|
+
* go.set_position(go.get_position().add(self.velocity.mul(dt)));
|
|
675
|
+
* },
|
|
676
|
+
*
|
|
677
|
+
* on_input(self, action_id, action) {
|
|
678
|
+
* // check for movement input
|
|
679
|
+
* if (action_id === hash("right")) {
|
|
680
|
+
* if (action.released) {
|
|
681
|
+
* // reset velocity if input was released
|
|
682
|
+
* self.velocity = vmath.vector3();
|
|
683
|
+
* } else {
|
|
684
|
+
* // update velocity
|
|
685
|
+
* self.velocity = vmath.vector3(action.value * self.max_speed, 0, 0);
|
|
686
|
+
* }
|
|
687
|
+
* }
|
|
688
|
+
* },
|
|
689
|
+
* });
|
|
675
690
|
* ```
|
|
676
691
|
*/
|
|
677
692
|
export function on_input(self: Opaque<"userdata">, action_id: Hash, action: Record<string | number, unknown>): boolean | unknown;
|
|
@@ -686,29 +701,34 @@ declare global {
|
|
|
686
701
|
* @param message - a table containing the message data
|
|
687
702
|
* @param sender - address of the sender
|
|
688
703
|
* @example
|
|
689
|
-
* ```
|
|
690
|
-
* This example demonstrates how a game object instance, called "a", can communicate with another instance, called "b". It
|
|
691
|
-
* is assumed that both script components of the instances has id "script".
|
|
692
|
-
*
|
|
693
|
-
*
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
*
|
|
698
|
-
*
|
|
699
|
-
*
|
|
700
|
-
*
|
|
701
|
-
*
|
|
702
|
-
*
|
|
703
|
-
*
|
|
704
|
-
*
|
|
705
|
-
*
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
*
|
|
710
|
-
*
|
|
711
|
-
*
|
|
704
|
+
* ```ts
|
|
705
|
+
* // This example demonstrates how a game object instance, called "a", can communicate with another instance, called "b". It
|
|
706
|
+
* // is assumed that both script components of the instances has id "script".
|
|
707
|
+
*
|
|
708
|
+
* // a.script — Script of instance "a":
|
|
709
|
+
* export default defineScript({
|
|
710
|
+
* init() {
|
|
711
|
+
* // let b know about some important data
|
|
712
|
+
* msg.post("b#script", "my_data", { important_value: 1 });
|
|
713
|
+
* },
|
|
714
|
+
* });
|
|
715
|
+
*
|
|
716
|
+
* // b.script — Script of instance "b":
|
|
717
|
+
* export default defineScript({
|
|
718
|
+
* init() {
|
|
719
|
+
* // store the url of instance "a" for later use, by specifying undefined as socket we
|
|
720
|
+
* // automatically use our own socket
|
|
721
|
+
* return { a_url: msg.url(undefined, go.get_id("a"), "script") };
|
|
722
|
+
* },
|
|
723
|
+
*
|
|
724
|
+
* on_message(self, message_id, message, sender) {
|
|
725
|
+
* // check message and sender
|
|
726
|
+
* if (message_id === hash("my_data") && sender === self.a_url) {
|
|
727
|
+
* // use the data in some way
|
|
728
|
+
* self.important_value = message.important_value;
|
|
729
|
+
* }
|
|
730
|
+
* },
|
|
731
|
+
* });
|
|
712
732
|
* ```
|
|
713
733
|
*/
|
|
714
734
|
export function on_message(self: Opaque<"userdata">, message_id: Hash, message: Record<string | number, unknown>, sender: Url): void;
|
|
@@ -718,69 +738,46 @@ declare global {
|
|
|
718
738
|
*
|
|
719
739
|
* @param self - reference to the script state to be used for storing data
|
|
720
740
|
* @example
|
|
721
|
-
* ```lua
|
|
722
|
-
* This example demonstrates how to tweak the speed of a game object instance that is moved on user input.
|
|
723
|
-
* function init(self)
|
|
724
|
-
* -- acquire input focus
|
|
725
|
-
* msg.post(".", "acquire_input_focus")
|
|
726
|
-
* -- maximum speed the instance can be moved, this value is tweaked in the on_reload function below
|
|
727
|
-
* self.max_speed = 2
|
|
728
|
-
* -- velocity of the instance, initially zero
|
|
729
|
-
* self.velocity = vmath.vector3()
|
|
730
|
-
* end
|
|
731
|
-
*
|
|
732
|
-
* function update(self, dt)
|
|
733
|
-
* -- move the instance
|
|
734
|
-
* go.set_position(go.get_position() + dt * self.velocity)
|
|
735
|
-
* end
|
|
736
|
-
*
|
|
737
|
-
* function on_input(self, action_id, action)
|
|
738
|
-
* -- check for movement input
|
|
739
|
-
* if action_id == hash("right") then
|
|
740
|
-
* if action.released then -- reset velocity if input was released
|
|
741
|
-
* self.velocity = vmath.vector3()
|
|
742
|
-
* else -- update velocity
|
|
743
|
-
* self.velocity = vmath.vector3(action.value * self.max_speed, 0, 0)
|
|
744
|
-
* end
|
|
745
|
-
* end
|
|
746
|
-
* end
|
|
747
|
-
*
|
|
748
|
-
* function on_reload(self)
|
|
749
|
-
* -- edit this value and reload the script component
|
|
750
|
-
* self.max_speed = 100
|
|
751
|
-
* end
|
|
752
|
-
* ```
|
|
753
|
-
*/
|
|
754
|
-
export function on_reload(self: Opaque<"userdata">): void;
|
|
755
|
-
/**
|
|
756
|
-
* This function defines a property which can then be used in the script through the self-reference.
|
|
757
|
-
* The properties defined this way are automatically exposed in the editor in game objects and collections which use the script.
|
|
758
|
-
* Note that you can only use this function outside any callback-functions like init and update.
|
|
759
|
-
*
|
|
760
|
-
* @param name - the id of the property
|
|
761
|
-
* @param value - default value of the property. In the case of a url, only the empty constructor msg.url() is allowed. In the case of a resource one of the resource constructors (eg resource.atlas(), resource.font() etc) is expected.
|
|
762
|
-
* @example
|
|
763
741
|
* ```ts
|
|
764
|
-
* // This example
|
|
765
|
-
* // whenever someone sends a "take_damage" message to the script.
|
|
766
|
-
* go.property("health", 100);
|
|
767
|
-
*
|
|
742
|
+
* // This example demonstrates how to tweak the speed of a game object instance that is moved on user input.
|
|
768
743
|
* export default defineScript({
|
|
769
|
-
* init(
|
|
770
|
-
* //
|
|
771
|
-
*
|
|
744
|
+
* init() {
|
|
745
|
+
* // acquire input focus
|
|
746
|
+
* msg.post(".", "acquire_input_focus");
|
|
747
|
+
* return {
|
|
748
|
+
* // maximum speed the instance can be moved, this value is tweaked in the on_reload function below
|
|
749
|
+
* max_speed: 2,
|
|
750
|
+
* // velocity of the instance, initially zero
|
|
751
|
+
* velocity: vmath.vector3(),
|
|
752
|
+
* };
|
|
772
753
|
* },
|
|
773
754
|
*
|
|
774
|
-
*
|
|
775
|
-
*
|
|
776
|
-
*
|
|
777
|
-
*
|
|
755
|
+
* update(self, dt) {
|
|
756
|
+
* // move the instance
|
|
757
|
+
* go.set_position(go.get_position().add(self.velocity.mul(dt)));
|
|
758
|
+
* },
|
|
759
|
+
*
|
|
760
|
+
* on_input(self, action_id, action) {
|
|
761
|
+
* // check for movement input
|
|
762
|
+
* if (action_id === hash("right")) {
|
|
763
|
+
* if (action.released) {
|
|
764
|
+
* // reset velocity if input was released
|
|
765
|
+
* self.velocity = vmath.vector3();
|
|
766
|
+
* } else {
|
|
767
|
+
* // update velocity
|
|
768
|
+
* self.velocity = vmath.vector3(action.value * self.max_speed, 0, 0);
|
|
769
|
+
* }
|
|
778
770
|
* }
|
|
779
771
|
* },
|
|
772
|
+
*
|
|
773
|
+
* on_reload(self) {
|
|
774
|
+
* // edit this value and reload the script component
|
|
775
|
+
* self.max_speed = 100;
|
|
776
|
+
* },
|
|
780
777
|
* });
|
|
781
778
|
* ```
|
|
782
779
|
*/
|
|
783
|
-
export function
|
|
780
|
+
export function on_reload(self: Opaque<"userdata">): void;
|
|
784
781
|
/**
|
|
785
782
|
* Sets the parent for a game object instance. This means that the instance will exist in the geometrical space of its parent,
|
|
786
783
|
* 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
|
|
@@ -884,17 +881,19 @@ declare global {
|
|
|
884
881
|
* @param self - reference to the script state to be used for storing data
|
|
885
882
|
* @param dt - the time-step of the frame update
|
|
886
883
|
* @example
|
|
887
|
-
* ```
|
|
888
|
-
* This example demonstrates how to move a game object instance through the script component:
|
|
889
|
-
*
|
|
890
|
-
*
|
|
891
|
-
*
|
|
892
|
-
*
|
|
893
|
-
*
|
|
894
|
-
*
|
|
895
|
-
*
|
|
896
|
-
*
|
|
897
|
-
*
|
|
884
|
+
* ```ts
|
|
885
|
+
* // This example demonstrates how to move a game object instance through the script component:
|
|
886
|
+
* export default defineScript({
|
|
887
|
+
* init() {
|
|
888
|
+
* // set initial velocity to be 1 along world x-axis
|
|
889
|
+
* return { my_velocity: vmath.vector3(1, 0, 0) };
|
|
890
|
+
* },
|
|
891
|
+
*
|
|
892
|
+
* update(self, dt) {
|
|
893
|
+
* // move the game object instance
|
|
894
|
+
* go.set_position(go.get_position().add(self.my_velocity.mul(dt)));
|
|
895
|
+
* },
|
|
896
|
+
* });
|
|
898
897
|
* ```
|
|
899
898
|
*/
|
|
900
899
|
export function update(self: Opaque<"userdata">, dt: number): void;
|
package/generated/graphics.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
declare global {
|
|
3
|
+
/**
|
|
4
|
+
* Graphics functions and constants.
|
|
5
|
+
*/
|
|
3
6
|
namespace graphics {
|
|
4
7
|
const BLEND_FACTOR_CONSTANT_ALPHA: number & { readonly __brand: "graphics.BLEND_FACTOR_CONSTANT_ALPHA" };
|
|
5
8
|
const BLEND_FACTOR_CONSTANT_COLOR: number & { readonly __brand: "graphics.BLEND_FACTOR_CONSTANT_COLOR" };
|