@defold-typescript/types 0.26.0 → 0.27.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.
Files changed (70) hide show
  1. package/api-availability.json +307 -307
  2. package/api-signatures.json +1311 -0
  3. package/api-targets.json +342 -0
  4. package/examples/translations.json +1984 -0
  5. package/fixtures/messages_doc.json +880 -0
  6. package/generated/versions/defold-1.12.4/gui.d.ts +43 -43
  7. package/generated/versions/defold-1.12.4/liveupdate.d.ts +22 -22
  8. package/generated/versions/defold-1.12.4/physics.d.ts +78 -75
  9. package/generated/versions/defold-1.12.4/render.d.ts +75 -55
  10. package/generated/versions/defold-1.12.4/resource.d.ts +187 -175
  11. package/generated/versions/defold-1.13.0/b2d.d.ts +33 -0
  12. package/generated/versions/defold-1.13.0/b2d_body.d.ts +676 -0
  13. package/generated/versions/defold-1.13.0/b2d_chain.d.ts +106 -0
  14. package/generated/versions/defold-1.13.0/b2d_fixture.d.ts +155 -0
  15. package/generated/versions/defold-1.13.0/b2d_joint.d.ts +823 -0
  16. package/generated/versions/defold-1.13.0/b2d_shape.d.ts +215 -0
  17. package/generated/versions/defold-1.13.0/b2d_world.d.ts +314 -0
  18. package/generated/versions/defold-1.13.0/buffer.d.ts +176 -0
  19. package/generated/versions/defold-1.13.0/camera.d.ts +302 -0
  20. package/generated/versions/defold-1.13.0/collectionfactory.d.ts +146 -0
  21. package/generated/versions/defold-1.13.0/collectionproxy.d.ts +71 -0
  22. package/generated/versions/defold-1.13.0/compute.d.ts +306 -0
  23. package/generated/versions/defold-1.13.0/crash.d.ts +143 -0
  24. package/generated/versions/defold-1.13.0/editor-vm/http.d.ts +56 -0
  25. package/generated/versions/defold-1.13.0/editor-vm/json.d.ts +10 -0
  26. package/generated/versions/defold-1.13.0/editor-vm/localization.d.ts +42 -0
  27. package/generated/versions/defold-1.13.0/editor-vm/tilemap_tiles.d.ts +80 -0
  28. package/generated/versions/defold-1.13.0/editor-vm/zip.d.ts +10 -0
  29. package/generated/versions/defold-1.13.0/editor-vm/zlib.d.ts +24 -0
  30. package/generated/versions/defold-1.13.0/editor.d.ts +1092 -0
  31. package/generated/versions/defold-1.13.0/factory.d.ts +123 -0
  32. package/generated/versions/defold-1.13.0/font.d.ts +81 -0
  33. package/generated/versions/defold-1.13.0/go.d.ts +1054 -0
  34. package/generated/versions/defold-1.13.0/graphics.d.ts +321 -0
  35. package/generated/versions/defold-1.13.0/gui.d.ts +2370 -0
  36. package/generated/versions/defold-1.13.0/html5.d.ts +53 -0
  37. package/generated/versions/defold-1.13.0/http.d.ts +84 -0
  38. package/generated/versions/defold-1.13.0/iac.d.ts +18 -0
  39. package/generated/versions/defold-1.13.0/iap.d.ts +60 -0
  40. package/generated/versions/defold-1.13.0/image.d.ts +139 -0
  41. package/generated/versions/defold-1.13.0/index.d.ts +48 -0
  42. package/generated/versions/defold-1.13.0/json.d.ts +76 -0
  43. package/generated/versions/defold-1.13.0/kinds/editor-script.d.ts +13 -0
  44. package/generated/versions/defold-1.13.0/label.d.ts +94 -0
  45. package/generated/versions/defold-1.13.0/liveupdate.d.ts +140 -0
  46. package/generated/versions/defold-1.13.0/material.d.ts +444 -0
  47. package/generated/versions/defold-1.13.0/model.d.ts +246 -0
  48. package/generated/versions/defold-1.13.0/msg.d.ts +10 -0
  49. package/generated/versions/defold-1.13.0/particlefx.d.ts +166 -0
  50. package/generated/versions/defold-1.13.0/physics.d.ts +548 -0
  51. package/generated/versions/defold-1.13.0/profiler.d.ts +233 -0
  52. package/generated/versions/defold-1.13.0/push.d.ts +66 -0
  53. package/generated/versions/defold-1.13.0/render.d.ts +1185 -0
  54. package/generated/versions/defold-1.13.0/resource.d.ts +1530 -0
  55. package/generated/versions/defold-1.13.0/socket.d.ts +795 -0
  56. package/generated/versions/defold-1.13.0/sound.d.ts +291 -0
  57. package/generated/versions/defold-1.13.0/sprite.d.ts +157 -0
  58. package/generated/versions/defold-1.13.0/sys.d.ts +695 -0
  59. package/generated/versions/defold-1.13.0/tilemap.d.ts +195 -0
  60. package/generated/versions/defold-1.13.0/timer.d.ts +114 -0
  61. package/generated/versions/defold-1.13.0/types.d.ts +61 -0
  62. package/generated/versions/defold-1.13.0/vmath.d.ts +806 -0
  63. package/generated/versions/defold-1.13.0/webview.d.ts +68 -0
  64. package/generated/versions/defold-1.13.0/window.d.ts +198 -0
  65. package/generated/versions/defold-1.13.0/zlib.d.ts +40 -0
  66. package/index.d.ts +4 -84
  67. package/package.json +11 -3
  68. package/scripts/import-defold-release.ts +18 -1
  69. package/src/example-store.ts +5 -0
  70. package/scripts/lua-types-signature-index.ts +0 -151
@@ -0,0 +1,246 @@
1
+ /** @noSelfInFile */
2
+ import type { Hash, Opaque, Url, Vector3 } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Model API documentation
7
+ */
8
+ namespace model {
9
+ /**
10
+ * Cancels all animation on a model component.
11
+ *
12
+ * @param url - the model for which to cancel the animation
13
+ */
14
+ function cancel(url: string | Hash | Url): void;
15
+ /**
16
+ * Get AABB of the whole model in local coordinate space.
17
+ * AABB information return as a table with `min` and `max` fields, where `min` and `max` has type `vmath.vector3`.
18
+ *
19
+ * @param url - the model
20
+ * @returns A table containing AABB of the model. If model has no meshes - return vmath.vector3(0,0,0) for min and max fields.
21
+ * @example
22
+ * ```ts
23
+ * model.get_aabb("#model"); // => { min = vmath.vector3(-2.5, -3.0, 0), max = vmath.vector3(1.5, 5.5, 0) }
24
+ * model.get_aabb("#empty"); // => { min = vmath.vector3(0, 0, 0), max = vmath.vector3(0, 0, 0) }
25
+ * ```
26
+ */
27
+ function get_aabb(url: string | Hash | Url): { min: Vector3; max: Vector3 };
28
+ /**
29
+ * Returns a table of numbers with one entry per morph target on the first mesh of the model that has morph targets.
30
+ * Values reflect the rig state at call time (after animation, and any active script override from model.set_blend_weights).
31
+ *
32
+ * @param url - the model component
33
+ * @returns array of weight values, or empty table if the model has no morph targets
34
+ * @example
35
+ * ```ts
36
+ * const weights = model.get_blend_weights("#model");
37
+ * weights[1] = 0.75;
38
+ * weights[2] = 0.25;
39
+ * model.set_blend_weights("#model", weights);
40
+ * ```
41
+ */
42
+ function get_blend_weights(url: string | Hash | Url): number[];
43
+ /**
44
+ * Gets the id of the game object that corresponds to a model skeleton bone.
45
+ * The returned game object can be used for parenting and transform queries.
46
+ * This function has complexity `O(n)`, where `n` is the number of bones in the model skeleton.
47
+ * Game objects corresponding to a model skeleton bone can not be individually deleted.
48
+ *
49
+ * @param url - the model to query
50
+ * @param bone_id - id of the corresponding bone
51
+ * @returns id of the game object
52
+ * @example
53
+ * ```ts
54
+ * // The following examples assume that the model component has id "model".
55
+ * // How to parent the game object of the calling script to the "right_hand" bone
56
+ * // of the model in a player game object:
57
+ * export default defineScript({
58
+ * init(self) {
59
+ * const parent = model.get_go("player#model", "right_hand");
60
+ * msg.post(".", "set_parent", { parent_id: parent });
61
+ * },
62
+ * });
63
+ * ```
64
+ */
65
+ function get_go(url: string | Hash | Url, bone_id: string | Hash): Hash;
66
+ /**
67
+ * Get AABB of all meshes.
68
+ * AABB information return as a table with `min` and `max` fields, where `min` and `max` has type `vmath.vector3`.
69
+ *
70
+ * @param url - the model
71
+ * @returns A table containing info about all AABB in the format
72
+ * @example
73
+ * ```ts
74
+ * model.get_mesh_aabb("#model"); // => { hash("Sword") = { min = vmath.vector3(-0.5, -0.5, 0), max = vmath.vector3(0.5, 0.5, 0) }, hash("Shield") = { min = vmath.vector3(-0.5, -0.5, -0.5), max = vmath.vector3(0.5, 0.5, 0.5) } }
75
+ * ```
76
+ */
77
+ function get_mesh_aabb(url: string | Hash | Url): LuaMap<Hash, { min: Vector3; max: Vector3 }>;
78
+ /**
79
+ * Get the enabled state of a mesh
80
+ *
81
+ * @param url - the model
82
+ * @param mesh_id - the id of the mesh
83
+ * @returns true if the mesh is visible, false otherwise
84
+ * @example
85
+ * ```ts
86
+ * export default defineScript({
87
+ * init(self) {
88
+ * if (model.get_mesh_enabled("#model", "Sword")) {
89
+ * // set properties specific for the sword
90
+ * self.weapon_properties = game.data.weapons["Sword"];
91
+ * }
92
+ * },
93
+ * });
94
+ * ```
95
+ */
96
+ function get_mesh_enabled(url: string | Hash | Url, mesh_id: string | Hash | Url): boolean;
97
+ /**
98
+ * Plays an animation on a model component with specified playback
99
+ * mode and parameters.
100
+ * An optional completion callback function can be provided that will be called when
101
+ * the animation has completed playing. If no function is provided,
102
+ * a model_animation_done message is sent to the script that started the animation.
103
+ * The callback is not called (or message sent) if the animation is
104
+ * cancelled with model.cancel. The callback is called (or message sent) only for
105
+ * animations that play with the following playback modes:
106
+ *
107
+ * - `go.PLAYBACK_ONCE_FORWARD`
108
+ *
109
+ * - `go.PLAYBACK_ONCE_BACKWARD`
110
+ *
111
+ * - `go.PLAYBACK_ONCE_PINGPONG`
112
+ *
113
+ * @param url - the model for which to play the animation
114
+ * @param anim_id - id of the animation to play
115
+ * @param playback - playback mode of the animation
116
+ *
117
+ * - `go.PLAYBACK_ONCE_FORWARD`
118
+ *
119
+ * - `go.PLAYBACK_ONCE_BACKWARD`
120
+ *
121
+ * - `go.PLAYBACK_ONCE_PINGPONG`
122
+ *
123
+ * - `go.PLAYBACK_LOOP_FORWARD`
124
+ *
125
+ * - `go.PLAYBACK_LOOP_BACKWARD`
126
+ *
127
+ * - `go.PLAYBACK_LOOP_PINGPONG`
128
+ * @param play_properties - optional table with properties
129
+ * Play properties table:
130
+ *
131
+ * `blend_duration`
132
+ * number Duration of a linear blend between the current and new animation.
133
+ * `offset`
134
+ * number The normalized initial value of the animation cursor when the animation starts playing.
135
+ * `playback_rate`
136
+ * number The rate with which the animation will be played. Must be positive.
137
+ * @param complete_function - function to call when the animation has completed.
138
+ *
139
+ * `self`
140
+ * object The current object.
141
+ * `message_id`
142
+ * hash The name of the completion message, `"model_animation_done"`.
143
+ * `message`
144
+ * table Information about the completion:
145
+ *
146
+ * - hash `animation_id` - the animation that was completed.
147
+ *
148
+ * - constant `playback` - the playback mode for the animation.
149
+ *
150
+ * `sender`
151
+ * url The invoker of the callback: the model component.
152
+ * @example
153
+ * ```ts
154
+ * // The following examples assume that the model has id "model".
155
+ * // How to play the "jump" animation followed by the "run" animation:
156
+ * function anim_done(self, message_id, message, sender) {
157
+ * if (message_id === hash("model_animation_done")) {
158
+ * if (message.animation_id === hash("jump")) {
159
+ * // open animation done, chain with "run"
160
+ * const properties = { blend_duration: 0.2 };
161
+ * model.play_anim(url, "run", go.PLAYBACK_LOOP_FORWARD, properties, anim_done);
162
+ * }
163
+ * }
164
+ * }
165
+ *
166
+ * export default defineScript({
167
+ * init(self) {
168
+ * const url = msg.url("#model");
169
+ * const play_properties = { blend_duration: 0.1 };
170
+ * // first blend during 0.1 sec into the jump, then during 0.2 s into the run animation
171
+ * model.play_anim(url, "jump", go.PLAYBACK_ONCE_FORWARD, play_properties, anim_done);
172
+ * },
173
+ * });
174
+ * ```
175
+ */
176
+ function play_anim(url: string | Hash | Url, anim_id: string | Hash, playback: Opaque<"constant">, play_properties?: { blend_duration?: number; offset?: number; playback_rate?: number }, complete_function?: (self: unknown, message_id: unknown, message: unknown, sender: unknown) => void): void;
177
+ /**
178
+ * Resets a shader constant for a model component.
179
+ * The constant must be defined in the material assigned to the model.
180
+ * Resetting a constant through this function implies that the value defined in the material will be used.
181
+ * Which model to reset a constant for is identified by the URL.
182
+ *
183
+ * @param url - the model that should have a constant reset.
184
+ * @param constant - name of the constant.
185
+ * @example
186
+ * ```ts
187
+ * model.reset_constant("#model", "tint");
188
+ * ```
189
+ */
190
+ function reset_constant(url: string | Hash | Url, constant: string | Hash): void;
191
+ /**
192
+ * Copies numeric values from `weights` into each morph target slot for every mesh on the model that has morph targets.
193
+ * At most as many weights are applied as each mesh has morph targets; extra entries in the table are ignored.
194
+ * Missing weights leave the tail zero-filled for meshes with more targets than entries.
195
+ * The override is re-applied every frame after animations run, until cleared by omitting `weights` or passing `nil`.
196
+ * To reset the weights, use `model.set_blend_weights(url)` or `model.set_blend_weights(url, nil)`.
197
+ *
198
+ * @param url - the model component
199
+ * @param weights - array of weight values (1-based indices). Omit or pass `nil` to clear the override and return morphs to animation only
200
+ * @example
201
+ * ```ts
202
+ * model.set_blend_weights("#model", [0, 1, 0.5, 0]);
203
+ * model.set_blend_weights("#model");
204
+ * ```
205
+ */
206
+ function set_blend_weights(url: string | Hash | Url, weights?: number[]): void;
207
+ /**
208
+ * Enable or disable visibility of a mesh
209
+ *
210
+ * @param url - the model
211
+ * @param mesh_id - the id of the mesh
212
+ * @param enabled - true if the mesh should be visible, false if it should be hideen
213
+ * @example
214
+ * ```ts
215
+ * export default defineScript({
216
+ * init(self) {
217
+ * model.set_mesh_enabled("#model", "Sword", false); // hide the sword
218
+ * model.set_mesh_enabled("#model", "Axe", true); // show the axe
219
+ * },
220
+ * });
221
+ * ```
222
+ */
223
+ function set_mesh_enabled(url: string | Hash | Url, mesh_id: string | Hash | Url, enabled: boolean): void;
224
+ interface properties {
225
+ /**
226
+ * The current animation set on the component. The type of the property is hash.
227
+ */
228
+ animation: Hash;
229
+ /**
230
+ * The normalized animation cursor. The type of the property is number.
231
+ * Please note that model events may not fire as expected when the cursor is manipulated directly.
232
+ */
233
+ cursor: number;
234
+ /**
235
+ * The animation playback rate. A multiplier to the animation playback rate. The type of the property is number.
236
+ */
237
+ playback_rate: number;
238
+ /**
239
+ * The texture hash id of the model. Used for getting/setting model texture for unit 0-7
240
+ */
241
+ textureN: Hash;
242
+ }
243
+ }
244
+ }
245
+
246
+ export {};
@@ -0,0 +1,10 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * Functions for passing messages and constructing URL objects.
5
+ */
6
+ namespace msg {
7
+ }
8
+ }
9
+
10
+ export {};
@@ -0,0 +1,166 @@
1
+ /** @noSelfInFile */
2
+ import type { Hash, Url, Vector4 } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Functions and properties for controlling particle effect component playback and
7
+ * shader constants.
8
+ */
9
+ namespace particlefx {
10
+ /**
11
+ * The emitter is not spawning any particles, but has particles that are still alive.
12
+ */
13
+ const EMITTER_STATE_POSTSPAWN: number & { readonly __brand: "particlefx.EMITTER_STATE_POSTSPAWN" };
14
+ /**
15
+ * The emitter will be in this state when it has been started but before spawning any particles. Normally the emitter is in this state for a short time, depending on if a start delay has been set for this emitter or not.
16
+ */
17
+ const EMITTER_STATE_PRESPAWN: number & { readonly __brand: "particlefx.EMITTER_STATE_PRESPAWN" };
18
+ /**
19
+ * The emitter does not have any living particles and will not spawn any particles in this state.
20
+ */
21
+ const EMITTER_STATE_SLEEPING: number & { readonly __brand: "particlefx.EMITTER_STATE_SLEEPING" };
22
+ /**
23
+ * The emitter is spawning particles.
24
+ */
25
+ const EMITTER_STATE_SPAWNING: number & { readonly __brand: "particlefx.EMITTER_STATE_SPAWNING" };
26
+ /**
27
+ * Starts playing a particle FX component.
28
+ * Particle FX started this way need to be manually stopped through `particlefx.stop()`.
29
+ * Which particle FX to play is identified by the URL.
30
+ * A particle FX will continue to emit particles even if the game object the particle FX component belonged to is deleted. You can call `particlefx.stop()` to stop it from emitting more particles.
31
+ *
32
+ * @param url - the particle fx that should start playing.
33
+ * @param emitter_state_function - optional callback function that will be called when an emitter attached to this particlefx changes state.
34
+ *
35
+ * `self`
36
+ * object The current object
37
+ * `id`
38
+ * hash The id of the particle fx component
39
+ * `emitter`
40
+ * hash The id of the emitter
41
+ * `state`
42
+ * constant the new state of the emitter:
43
+ *
44
+ * - `particlefx.EMITTER_STATE_SLEEPING`
45
+ *
46
+ * - `particlefx.EMITTER_STATE_PRESPAWN`
47
+ *
48
+ * - `particlefx.EMITTER_STATE_SPAWNING`
49
+ *
50
+ * - `particlefx.EMITTER_STATE_POSTSPAWN`
51
+ * @example
52
+ * ```ts
53
+ * // How to play a particle fx when a game object is created.
54
+ * // The callback receives the hash of the path to the particlefx, the hash of the id
55
+ * // of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_.
56
+ * function emitter_state_change(self, id, emitter, state) {
57
+ * if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
58
+ * // exhaust is done spawning particles...
59
+ * }
60
+ * }
61
+ *
62
+ * export default defineScript({
63
+ * init(self) {
64
+ * particlefx.play("#particlefx", emitter_state_change);
65
+ * },
66
+ * });
67
+ * ```
68
+ */
69
+ function play(url: string | Hash | Url, emitter_state_function?: (self: unknown, id: unknown, emitter: unknown, state: unknown) => void): void;
70
+ /**
71
+ * Resets a shader constant for a particle FX component emitter.
72
+ * The constant must be defined in the material assigned to the emitter.
73
+ * Resetting a constant through this function implies that the value defined in the material will be used.
74
+ * Which particle FX to reset a constant for is identified by the URL.
75
+ *
76
+ * @param url - the particle FX that should have a constant reset
77
+ * @param emitter - the id of the emitter
78
+ * @param constant - the name of the constant
79
+ * @example
80
+ * ```ts
81
+ * // The following examples assume that the particle FX has id "particlefx", it
82
+ * // contains an emitter with the id "emitter" and that the default-material in
83
+ * // builtins is used, which defines the constant "tint".
84
+ * // If you assign a custom material to the sprite, you can reset the constants
85
+ * // defined there in the same manner.
86
+ * // How to reset the tinting of particles from an emitter:
87
+ * export default defineScript({
88
+ * init(self) {
89
+ * particlefx.reset_constant("#particlefx", "emitter", "tint");
90
+ * },
91
+ * });
92
+ * ```
93
+ */
94
+ function reset_constant(url: string | Hash | Url, emitter: string | Hash, constant: string | Hash): void;
95
+ /**
96
+ * Sets a shader constant for a particle FX component emitter.
97
+ * The constant must be defined in the material assigned to the emitter.
98
+ * Setting a constant through this function will override the value set for that constant in the material.
99
+ * The value will be overridden until particlefx.reset_constant is called.
100
+ * Which particle FX to set a constant for is identified by the URL.
101
+ *
102
+ * @param url - the particle FX that should have a constant set
103
+ * @param emitter - the id of the emitter
104
+ * @param constant - the name of the constant
105
+ * @param value - the value of the constant
106
+ * @example
107
+ * ```ts
108
+ * // The following examples assume that the particle FX has id "particlefx", it
109
+ * // contains an emitter with the id "emitter" and that the default-material in
110
+ * // builtins is used, which defines the constant "tint".
111
+ * // If you assign a custom material to the sprite, you can reset the constants
112
+ * // defined there in the same manner.
113
+ * // How to tint particles from an emitter red:
114
+ * export default defineScript({
115
+ * init(self) {
116
+ * particlefx.set_constant("#particlefx", "emitter", "tint", vmath.vector4(1, 0, 0, 1));
117
+ * },
118
+ * });
119
+ * ```
120
+ */
121
+ function set_constant(url: string | Hash | Url, emitter: string | Hash, constant: string | Hash, value: Vector4): void;
122
+ /**
123
+ * Stops a particle FX component from playing.
124
+ * Stopping a particle FX does not remove already spawned particles.
125
+ * Which particle FX to stop is identified by the URL.
126
+ *
127
+ * @param url - the particle fx that should stop playing
128
+ * @param options - Options when stopping the particle fx. Supported options:
129
+ *
130
+ * - boolean `clear`: instantly clear spawned particles
131
+ * @example
132
+ * ```ts
133
+ * // How to stop a particle fx when a game object is deleted and immediately also
134
+ * // clear any spawned particles:
135
+ * export default defineScript({
136
+ * final(self) {
137
+ * particlefx.stop("#particlefx", { clear: true });
138
+ * },
139
+ * });
140
+ * ```
141
+ */
142
+ function stop(url: string | Hash | Url, options?: { clear?: boolean }): void;
143
+ interface properties {
144
+ /**
145
+ * The animation used during rendering by an emitter in a particle FX component.
146
+ * The property type is a hash and refers to a valid animation in an atlas or a tile source resource.
147
+ * If the animation isn't found, and error will be thrown.
148
+ */
149
+ animation: Hash;
150
+ /**
151
+ * The image used during rendering by an emitter in a particle FX component.
152
+ * The property type is a hash and refers to an image resource (atlas or tile source).
153
+ * Note: When setting the image, if the currently playing animation of the emitter
154
+ * isn't found in the new image, the animation will be set to the first animation found.
155
+ */
156
+ image: Hash;
157
+ /**
158
+ * The material used during rendering by an emitter in a particle FX component.
159
+ * The property type is a hash and refers to a material resource.
160
+ */
161
+ material: Hash;
162
+ }
163
+ }
164
+ }
165
+
166
+ export {};