@defold-typescript/types 0.51.0 → 0.53.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 (228) hide show
  1. package/api-availability.json +4 -58
  2. package/api-signatures.json +2804 -3172
  3. package/api-targets.json +15 -5
  4. package/examples/translations.json +19 -71
  5. package/generated/b2d.d.ts +39 -39
  6. package/generated/b2d_body.d.ts +11 -11
  7. package/generated/b2d_chain.d.ts +3 -3
  8. package/generated/b2d_fixture.d.ts +5 -5
  9. package/generated/b2d_joint.d.ts +29 -29
  10. package/generated/b2d_shape.d.ts +13 -13
  11. package/generated/b2d_world.d.ts +15 -15
  12. package/generated/buffer.d.ts +10 -11
  13. package/generated/bullet3d.d.ts +6 -6
  14. package/generated/bullet3d_collision_object.d.ts +10 -10
  15. package/generated/bullet3d_constraint.d.ts +173 -71
  16. package/generated/bullet3d_rigid_body.d.ts +3 -3
  17. package/generated/bullet3d_shape.d.ts +11 -11
  18. package/generated/bullet3d_world.d.ts +20 -20
  19. package/generated/camera.d.ts +4 -4
  20. package/generated/collectionfactory.d.ts +2 -3
  21. package/generated/collectionproxy.d.ts +5 -5
  22. package/generated/compute.d.ts +5 -5
  23. package/generated/crash.d.ts +7 -7
  24. package/generated/editor-vm/http.d.ts +13 -13
  25. package/generated/editor-vm/image.d.ts +4 -4
  26. package/generated/editor-vm/json.d.ts +1 -1
  27. package/generated/editor-vm/tilemap_tiles.d.ts +9 -9
  28. package/generated/editor-vm/zip.d.ts +4 -4
  29. package/generated/editor.d.ts +183 -183
  30. package/generated/factory.d.ts +2 -3
  31. package/generated/font.d.ts +4 -4
  32. package/generated/go.d.ts +122 -230
  33. package/generated/graphics.d.ts +23 -25
  34. package/generated/gui.d.ts +186 -423
  35. package/generated/http.d.ts +3 -3
  36. package/generated/image.d.ts +63 -11
  37. package/generated/json.d.ts +4 -4
  38. package/generated/kinds/gui-script.d.ts +2 -0
  39. package/generated/kinds/render-script.d.ts +14 -15
  40. package/generated/label.d.ts +5 -5
  41. package/generated/liveupdate.d.ts +7 -3
  42. package/generated/material.d.ts +49 -49
  43. package/generated/model.d.ts +46 -14
  44. package/generated/particlefx.d.ts +24 -5
  45. package/generated/physics.d.ts +64 -20
  46. package/generated/profiler.d.ts +3 -5
  47. package/generated/render-script-modules/b2d.d.ts +711 -0
  48. package/generated/render-script-modules/bullet3d.d.ts +73 -0
  49. package/generated/render-script-modules/collectionfactory.d.ts +24 -0
  50. package/generated/render-script-modules/collectionproxy.d.ts +39 -0
  51. package/generated/render-script-modules/factory.d.ts +24 -0
  52. package/generated/render-script-modules/go.d.ts +434 -0
  53. package/generated/render-script-modules/label.d.ts +105 -0
  54. package/generated/render-script-modules/model.d.ts +121 -0
  55. package/generated/render-script-modules/particlefx.d.ts +59 -0
  56. package/generated/render-script-modules/physics.d.ts +333 -0
  57. package/generated/render-script-modules/resource.d.ts +1232 -0
  58. package/generated/render-script-modules/sound.d.ts +227 -0
  59. package/generated/render-script-modules/sprite.d.ts +68 -0
  60. package/generated/render-script-modules/tilemap.d.ts +43 -0
  61. package/generated/render.d.ts +172 -47
  62. package/generated/resource.d.ts +81 -61
  63. package/generated/socket.d.ts +18 -23
  64. package/generated/sound.d.ts +6 -6
  65. package/generated/sprite.d.ts +51 -3
  66. package/generated/sys.d.ts +87 -24
  67. package/generated/tilemap.d.ts +3 -3
  68. package/generated/timer.d.ts +3 -3
  69. package/generated/versions/defold-1.12.4/b2d.d.ts +2 -2
  70. package/generated/versions/defold-1.12.4/b2d_body.d.ts +2 -2
  71. package/generated/versions/defold-1.12.4/buffer.d.ts +8 -8
  72. package/generated/versions/defold-1.12.4/go.d.ts +117 -345
  73. package/generated/versions/defold-1.12.4/graphics.d.ts +2 -1
  74. package/generated/versions/defold-1.12.4/gui.d.ts +169 -532
  75. package/generated/versions/defold-1.12.4/http.d.ts +2 -2
  76. package/generated/versions/defold-1.12.4/image.d.ts +82 -2
  77. package/generated/versions/defold-1.12.4/index.d.ts +1 -0
  78. package/generated/versions/defold-1.12.4/label.d.ts +1 -1
  79. package/generated/versions/defold-1.12.4/liveupdate.d.ts +4 -0
  80. package/generated/versions/defold-1.12.4/model.d.ts +42 -10
  81. package/generated/versions/defold-1.12.4/particlefx.d.ts +23 -2
  82. package/generated/versions/defold-1.12.4/physics.d.ts +46 -2
  83. package/generated/versions/defold-1.12.4/render.d.ts +83 -7
  84. package/generated/versions/defold-1.12.4/resource.d.ts +50 -17
  85. package/generated/versions/defold-1.12.4/socket.d.ts +12 -12
  86. package/generated/versions/defold-1.12.4/sound.d.ts +1 -1
  87. package/generated/versions/defold-1.12.4/sprite.d.ts +59 -2
  88. package/generated/versions/defold-1.12.4/sys.d.ts +103 -8
  89. package/generated/versions/defold-1.12.4/tilemap.d.ts +1 -1
  90. package/generated/versions/defold-1.12.4/vmath.d.ts +0 -24
  91. package/generated/versions/defold-1.12.4/window.d.ts +3 -4
  92. package/generated/versions/defold-1.13.0/b2d.d.ts +2 -2
  93. package/generated/versions/defold-1.13.0/b2d_body.d.ts +2 -2
  94. package/generated/versions/defold-1.13.0/b2d_chain.d.ts +1 -1
  95. package/generated/versions/defold-1.13.0/b2d_joint.d.ts +1 -1
  96. package/generated/versions/defold-1.13.0/b2d_shape.d.ts +1 -1
  97. package/generated/versions/defold-1.13.0/buffer.d.ts +8 -8
  98. package/generated/versions/defold-1.13.0/camera.d.ts +1 -1
  99. package/generated/versions/defold-1.13.0/go.d.ts +117 -372
  100. package/generated/versions/defold-1.13.0/graphics.d.ts +2 -1
  101. package/generated/versions/defold-1.13.0/gui.d.ts +169 -532
  102. package/generated/versions/defold-1.13.0/http.d.ts +2 -2
  103. package/generated/versions/defold-1.13.0/image.d.ts +82 -2
  104. package/generated/versions/defold-1.13.0/index.d.ts +1 -0
  105. package/generated/versions/defold-1.13.0/label.d.ts +1 -1
  106. package/generated/versions/defold-1.13.0/liveupdate.d.ts +4 -0
  107. package/generated/versions/defold-1.13.0/material.d.ts +3 -1
  108. package/generated/versions/defold-1.13.0/model.d.ts +42 -10
  109. package/generated/versions/defold-1.13.0/particlefx.d.ts +23 -2
  110. package/generated/versions/defold-1.13.0/physics.d.ts +46 -2
  111. package/generated/versions/defold-1.13.0/render.d.ts +147 -9
  112. package/generated/versions/defold-1.13.0/resource.d.ts +50 -17
  113. package/generated/versions/defold-1.13.0/socket.d.ts +12 -12
  114. package/generated/versions/defold-1.13.0/sound.d.ts +1 -1
  115. package/generated/versions/defold-1.13.0/sprite.d.ts +59 -2
  116. package/generated/versions/defold-1.13.0/sys.d.ts +103 -8
  117. package/generated/versions/defold-1.13.0/tilemap.d.ts +1 -1
  118. package/generated/versions/defold-1.13.0/vmath.d.ts +0 -24
  119. package/generated/versions/defold-1.13.0/window.d.ts +3 -4
  120. package/generated/versions/defold-1.13.1/b2d.d.ts +2 -2
  121. package/generated/versions/defold-1.13.1/b2d_body.d.ts +2 -2
  122. package/generated/versions/defold-1.13.1/b2d_chain.d.ts +1 -1
  123. package/generated/versions/defold-1.13.1/b2d_joint.d.ts +1 -1
  124. package/generated/versions/defold-1.13.1/b2d_shape.d.ts +1 -1
  125. package/generated/versions/defold-1.13.1/buffer.d.ts +8 -8
  126. package/generated/versions/defold-1.13.1/camera.d.ts +1 -1
  127. package/generated/versions/defold-1.13.1/go.d.ts +117 -372
  128. package/generated/versions/defold-1.13.1/graphics.d.ts +2 -1
  129. package/generated/versions/defold-1.13.1/gui.d.ts +169 -548
  130. package/generated/versions/defold-1.13.1/http.d.ts +2 -2
  131. package/generated/versions/defold-1.13.1/image.d.ts +82 -2
  132. package/generated/versions/defold-1.13.1/index.d.ts +2 -0
  133. package/generated/versions/defold-1.13.1/label.d.ts +1 -1
  134. package/generated/versions/defold-1.13.1/liveupdate.d.ts +4 -0
  135. package/generated/versions/defold-1.13.1/material.d.ts +3 -1
  136. package/generated/versions/defold-1.13.1/model.d.ts +42 -10
  137. package/generated/versions/defold-1.13.1/particlefx.d.ts +23 -2
  138. package/generated/versions/defold-1.13.1/physics.d.ts +46 -2
  139. package/generated/versions/defold-1.13.1/render.d.ts +147 -9
  140. package/generated/versions/defold-1.13.1/resource.d.ts +50 -17
  141. package/generated/versions/defold-1.13.1/socket.d.ts +12 -12
  142. package/generated/versions/defold-1.13.1/sound.d.ts +1 -1
  143. package/generated/versions/defold-1.13.1/sprite.d.ts +59 -2
  144. package/generated/versions/defold-1.13.1/sys.d.ts +103 -8
  145. package/generated/versions/defold-1.13.1/tilemap.d.ts +1 -1
  146. package/generated/versions/defold-1.13.1/vmath.d.ts +0 -24
  147. package/generated/versions/defold-1.13.1/window.d.ts +3 -4
  148. package/generated/versions/defold-1.13.2/b2d.d.ts +39 -39
  149. package/generated/versions/defold-1.13.2/b2d_body.d.ts +11 -11
  150. package/generated/versions/defold-1.13.2/b2d_chain.d.ts +3 -3
  151. package/generated/versions/defold-1.13.2/b2d_fixture.d.ts +5 -5
  152. package/generated/versions/defold-1.13.2/b2d_joint.d.ts +29 -29
  153. package/generated/versions/defold-1.13.2/b2d_shape.d.ts +13 -13
  154. package/generated/versions/defold-1.13.2/b2d_world.d.ts +15 -15
  155. package/generated/versions/defold-1.13.2/buffer.d.ts +10 -11
  156. package/generated/versions/defold-1.13.2/bullet3d.d.ts +6 -6
  157. package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +10 -10
  158. package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +173 -71
  159. package/generated/versions/defold-1.13.2/bullet3d_rigid_body.d.ts +3 -3
  160. package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +11 -11
  161. package/generated/versions/defold-1.13.2/bullet3d_world.d.ts +20 -20
  162. package/generated/versions/defold-1.13.2/camera.d.ts +4 -4
  163. package/generated/versions/defold-1.13.2/collectionfactory.d.ts +2 -3
  164. package/generated/versions/defold-1.13.2/collectionproxy.d.ts +5 -5
  165. package/generated/versions/defold-1.13.2/compute.d.ts +5 -5
  166. package/generated/versions/defold-1.13.2/crash.d.ts +7 -7
  167. package/generated/versions/defold-1.13.2/editor-vm/http.d.ts +13 -13
  168. package/generated/versions/defold-1.13.2/editor-vm/image.d.ts +4 -4
  169. package/generated/versions/defold-1.13.2/editor-vm/json.d.ts +1 -1
  170. package/generated/versions/defold-1.13.2/editor-vm/tilemap_tiles.d.ts +9 -9
  171. package/generated/versions/defold-1.13.2/editor-vm/zip.d.ts +4 -4
  172. package/generated/versions/defold-1.13.2/editor.d.ts +183 -183
  173. package/generated/versions/defold-1.13.2/factory.d.ts +2 -3
  174. package/generated/versions/defold-1.13.2/font.d.ts +4 -4
  175. package/generated/versions/defold-1.13.2/go.d.ts +122 -230
  176. package/generated/versions/defold-1.13.2/graphics.d.ts +22 -24
  177. package/generated/versions/defold-1.13.2/gui.d.ts +186 -423
  178. package/generated/versions/defold-1.13.2/http.d.ts +3 -3
  179. package/generated/versions/defold-1.13.2/image.d.ts +63 -11
  180. package/generated/versions/defold-1.13.2/index.d.ts +2 -0
  181. package/generated/versions/defold-1.13.2/json.d.ts +4 -4
  182. package/generated/versions/defold-1.13.2/label.d.ts +5 -5
  183. package/generated/versions/defold-1.13.2/liveupdate.d.ts +7 -3
  184. package/generated/versions/defold-1.13.2/material.d.ts +49 -49
  185. package/generated/versions/defold-1.13.2/model.d.ts +46 -14
  186. package/generated/versions/defold-1.13.2/particlefx.d.ts +24 -5
  187. package/generated/versions/defold-1.13.2/physics.d.ts +64 -20
  188. package/generated/versions/defold-1.13.2/profiler.d.ts +3 -5
  189. package/generated/versions/defold-1.13.2/render.d.ts +161 -46
  190. package/generated/versions/defold-1.13.2/resource.d.ts +81 -61
  191. package/generated/versions/defold-1.13.2/socket.d.ts +18 -23
  192. package/generated/versions/defold-1.13.2/sound.d.ts +6 -6
  193. package/generated/versions/defold-1.13.2/sprite.d.ts +51 -3
  194. package/generated/versions/defold-1.13.2/sys.d.ts +87 -24
  195. package/generated/versions/defold-1.13.2/tilemap.d.ts +3 -3
  196. package/generated/versions/defold-1.13.2/timer.d.ts +3 -3
  197. package/generated/versions/defold-1.13.2/vmath.d.ts +0 -25
  198. package/generated/versions/defold-1.13.2/window.d.ts +8 -10
  199. package/generated/vmath.d.ts +0 -25
  200. package/generated/window.d.ts +8 -10
  201. package/identity-vocabulary.json +86 -34
  202. package/index.d.ts +2 -0
  203. package/package.json +3 -1
  204. package/scripts/generate-api-availability.ts +10 -24
  205. package/scripts/generate-api-signatures.ts +75 -14
  206. package/scripts/materialize-version.ts +48 -7
  207. package/scripts/regen.ts +214 -19
  208. package/scripts/shared-handle-methods.ts +3 -2
  209. package/scripts/signature-store-fs.ts +1 -0
  210. package/scripts/target-version.ts +26 -0
  211. package/src/api-doc.ts +34 -0
  212. package/src/api-identity.ts +32 -1
  213. package/src/component-properties.d.ts +96 -7
  214. package/src/core-types.ts +71 -28
  215. package/src/doc-corrections.ts +62 -5
  216. package/src/emit-dts.ts +1423 -401
  217. package/src/engine-globals.d.ts +5 -1
  218. package/src/engine-type-name.ts +33 -0
  219. package/src/go-overloads.d.ts +74 -19
  220. package/src/gui-overloads.d.ts +489 -0
  221. package/src/gui-texture-removal.d.ts +41 -0
  222. package/src/index.ts +3 -0
  223. package/src/lifecycle.ts +32 -23
  224. package/src/msg-overloads.d.ts +25 -13
  225. package/src/signature-store.ts +50 -0
  226. package/src/socket-types.d.ts +3 -3
  227. package/src/timers.d.ts +2 -1
  228. package/src/vmath-overloads.d.ts +26 -0
@@ -1,5 +1,5 @@
1
1
  /** @noSelfInFile */
2
- import type { Hash, Matrix4, Opaque, Quaternion, Url, Vector, Vector3, Vector4 } from "../../../src/core-types";
2
+ import type { Hash, Matrix4, Quaternion, Url, Vector, Vector3, Vector4 } from "../../../src/core-types";
3
3
 
4
4
  declare global {
5
5
  /**
@@ -7,7 +7,7 @@ declare global {
7
7
  */
8
8
  namespace go {
9
9
  export type Easing = typeof go.EASING_INBACK | typeof go.EASING_INBOUNCE | typeof go.EASING_INCIRC | typeof go.EASING_INCUBIC | typeof go.EASING_INELASTIC | typeof go.EASING_INEXPO | typeof go.EASING_INOUTBACK | typeof go.EASING_INOUTBOUNCE | typeof go.EASING_INOUTCIRC | typeof go.EASING_INOUTCUBIC | typeof go.EASING_INOUTELASTIC | typeof go.EASING_INOUTEXPO | typeof go.EASING_INOUTQUAD | typeof go.EASING_INOUTQUART | typeof go.EASING_INOUTQUINT | typeof go.EASING_INOUTSINE | typeof go.EASING_INQUAD | typeof go.EASING_INQUART | typeof go.EASING_INQUINT | typeof go.EASING_INSINE | typeof go.EASING_LINEAR | typeof go.EASING_OUTBACK | typeof go.EASING_OUTBOUNCE | typeof go.EASING_OUTCIRC | typeof go.EASING_OUTCUBIC | typeof go.EASING_OUTELASTIC | typeof go.EASING_OUTEXPO | typeof go.EASING_OUTINBACK | typeof go.EASING_OUTINBOUNCE | typeof go.EASING_OUTINCIRC | typeof go.EASING_OUTINCUBIC | typeof go.EASING_OUTINELASTIC | typeof go.EASING_OUTINEXPO | typeof go.EASING_OUTINQUAD | typeof go.EASING_OUTINQUART | typeof go.EASING_OUTINQUINT | typeof go.EASING_OUTINSINE | typeof go.EASING_OUTQUAD | typeof go.EASING_OUTQUART | typeof go.EASING_OUTQUINT | typeof go.EASING_OUTSINE;
10
- export type Playback = typeof go.PLAYBACK_ONCE_FORWARD | typeof go.PLAYBACK_ONCE_BACKWARD | typeof go.PLAYBACK_ONCE_PINGPONG | typeof go.PLAYBACK_LOOP_FORWARD | typeof go.PLAYBACK_LOOP_BACKWARD | typeof go.PLAYBACK_LOOP_PINGPONG;
10
+ export type Playback = typeof go.PLAYBACK_LOOP_BACKWARD | typeof go.PLAYBACK_LOOP_FORWARD | typeof go.PLAYBACK_LOOP_PINGPONG | typeof go.PLAYBACK_NONE | typeof go.PLAYBACK_ONCE_BACKWARD | typeof go.PLAYBACK_ONCE_FORWARD | typeof go.PLAYBACK_ONCE_PINGPONG;
11
11
  /**
12
12
  * in-back
13
13
  */
@@ -257,7 +257,65 @@ declare global {
257
257
  * go.animate("go", "position.y", go.PLAYBACK_LOOP_PINGPONG, 100, vec, 2.0);
258
258
  * ```
259
259
  */
260
- 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: unknown, property: unknown) => void): void;
260
+ 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;
261
+ /**
262
+ * This is only supported for numerical properties. If the node property is already being
263
+ * animated, that animation will be canceled and replaced by the new one.
264
+ * If a `complete_function` (lua function) is specified, that function will be called when the animation has completed.
265
+ * By starting a new animation in that function, several animations can be sequenced together. See the examples for more information.
266
+ * If you call `go.animate()` from a game object's `final()` function,
267
+ * any passed `complete_function` will be ignored and never called upon animation completion.
268
+ * See the properties guide for which properties can be animated and the animation guide for how
269
+ * them.
270
+ *
271
+ * @param url - url of the game object or component having the property
272
+ * @param property - id of the property to animate
273
+ * @param playback - playback mode of the animation
274
+ *
275
+ * - `go.PLAYBACK_ONCE_FORWARD`
276
+ * - `go.PLAYBACK_ONCE_BACKWARD`
277
+ * - `go.PLAYBACK_ONCE_PINGPONG`
278
+ * - `go.PLAYBACK_LOOP_FORWARD`
279
+ * - `go.PLAYBACK_LOOP_BACKWARD`
280
+ * - `go.PLAYBACK_LOOP_PINGPONG`
281
+ * @param to - target property value
282
+ * @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
283
+ * @param duration - duration of the animation in seconds
284
+ * @param delay - delay before the animation starts in seconds
285
+ * @param complete_function - optional function to call when the animation has completed
286
+ *
287
+ * `self`
288
+ *
289
+ * object The current object.
290
+ *
291
+ * `url`
292
+ *
293
+ * url The game object or component instance for which the property is animated.
294
+ *
295
+ * `property`
296
+ *
297
+ * hash The id of the animated property.
298
+ * @example
299
+ * Animate the position of a game object to x = 10 during 1 second, then y = 20 during 1 second:
300
+ * ```ts
301
+ * go.animate(go.get_id(), "position.x", go.PLAYBACK_ONCE_FORWARD, 10, go.EASING_LINEAR, 1, 0, () => {
302
+ * go.animate(go.get_id(), "position.y", go.PLAYBACK_ONCE_FORWARD, 20, go.EASING_LINEAR, 1);
303
+ * });
304
+ * ```
305
+ * @example
306
+ * Animate the y position of a game object using a crazy custom easing curve:
307
+ * ```ts
308
+ * const values = [
309
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
310
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
311
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
312
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
313
+ * ];
314
+ * const vec = vmath.vector(values);
315
+ * go.animate("go", "position.y", go.PLAYBACK_LOOP_PINGPONG, 100, vec, 2.0);
316
+ * ```
317
+ */
318
+ 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: unknown, property: unknown) => void): void;
261
319
  /**
262
320
  * By calling this function, all or specified stored property animations of the game object or component will be canceled.
263
321
  * See the properties guide for which properties can be animated and the animation guide for how to animate them.
@@ -316,7 +374,43 @@ declare global {
316
374
  * go.delete(ids, true);
317
375
  * ```
318
376
  */
319
- function _delete(id?: SceneGameObjectAddress | Hash | Url | (SceneGameObjectAddress | Hash | Url)[] | boolean, recursive?: boolean): void;
377
+ function _delete(id?: SceneGameObjectAddress | Hash | Url | (SceneGameObjectAddress | Hash | Url)[] | LuaPairsIterable<AnyNotNil, SceneGameObjectAddress | Hash | Url> | boolean): void;
378
+ /**
379
+ * Delete one or more game objects identified by id. Deletion is asynchronous meaning that
380
+ * the game object(s) are scheduled for deletion which will happen at the end of the current
381
+ * frame. Note that game objects scheduled for deletion will be counted against
382
+ * `max_instances` in "game.project" until they are actually removed.
383
+ * 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()`.
384
+ * 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()`.
385
+ *
386
+ * @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
387
+ * @param recursive - optional boolean, set to true to recursively delete child hiearchy in child to parent order
388
+ * @example
389
+ * This example demonstrates how to delete game objects
390
+ * ```ts
391
+ * // Delete the script's own game object.
392
+ * go.delete();
393
+ * // Delete a game object with the id "my_game_object".
394
+ * const id = go.get_id("my_game_object"); // retrieve the id of the game object to be deleted
395
+ * go.delete(id);
396
+ * // Delete a list of game objects.
397
+ * const ids = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
398
+ * go.delete(ids);
399
+ * ```
400
+ * @example
401
+ * This example demonstrates how to delete a game objects and their children (child to parent order)
402
+ * ```ts
403
+ * // Delete the script's own game object and its children.
404
+ * go.delete(true);
405
+ * // Delete a game object with the id "my_game_object" and its children.
406
+ * const id = go.get_id("my_game_object"); // retrieve the id of the game object to be deleted
407
+ * go.delete(id, true);
408
+ * // Delete a list of game objects and their children.
409
+ * const ids = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
410
+ * go.delete(ids, true);
411
+ * ```
412
+ */
413
+ function _delete(id: SceneGameObjectAddress | Hash | Url | (SceneGameObjectAddress | Hash | Url)[] | LuaPairsIterable<AnyNotNil, SceneGameObjectAddress | Hash | Url>, recursive: boolean): void;
320
414
  /**
321
415
  * This function can check for game objects in any collection by specifying
322
416
  * the collection name in the URL.
@@ -336,36 +430,29 @@ declare global {
336
430
  */
337
431
  export function exists(url: SceneGameObjectAddress | Hash | Url): boolean;
338
432
  /**
339
- * This is a callback-function, which is called by the engine when a script component is finalized (destroyed). It can
340
- * be used to e.g. take some last action, report the finalization to other game object instances, delete spawned objects
341
- * or release user input focus (see release_input_focus).
433
+ * Returns or constructs an instance identifier. The instance id is a hash
434
+ * of the absolute path to the instance.
342
435
  *
343
- * @param self - reference to the script state to be used for storing data
436
+ * - If `path` is specified, it can either be absolute or relative to the instance of the calling script.
437
+ * - If `path` is not specified, the id of the game object instance the script is attached to will be returned.
438
+ *
439
+ * @param path - path of the instance for which to return the id
440
+ * @returns instance id
344
441
  * @example
345
442
  * ```ts
346
- * export default defineScript({
347
- * init() {
348
- * return { some_value: 0 };
349
- * },
443
+ * // For the instance with path /my_sub_collection/my_instance, the following calls
444
+ * // are equivalent:
445
+ * const id = go.get_id(); // no path, defaults to the instance containing the calling script
446
+ * print(id); // => hash: [/my_sub_collection/my_instance]
350
447
  *
351
- * final(self) {
352
- * // report finalization
353
- * msg.post("my_friend_instance", "im_dead", { my_stats: self.some_value });
354
- * },
355
- * });
356
- * ```
357
- */
358
- export function final(self: Opaque<"userdata">): void;
359
- /**
360
- * This is a callback-function, which is called by the engine at fixed intervals to update the state of a script
361
- * component. The function will be called if 'Fixed Update Frequency' is enabled in the Engine section of game.project.
362
- * It can for instance be used to update game logic with the physics simulation if using a fixed timestep for the
363
- * physics (enabled by ticking 'Use Fixed Timestep' in the Physics section of game.project).
448
+ * const id2 = go.get_id("/my_sub_collection/my_instance"); // absolute path
449
+ * print(id2); // => hash: [/my_sub_collection/my_instance]
364
450
  *
365
- * @param self - reference to the script state to be used for storing data
366
- * @param dt - the time-step of the frame update
451
+ * const id3 = go.get_id("my_instance"); // relative path
452
+ * print(id3); // => hash: [/my_sub_collection/my_instance]
453
+ * ```
367
454
  */
368
- export function fixed_update(self: Opaque<"userdata">, dt: number): void;
455
+ export function get_id(): Hash;
369
456
  /**
370
457
  * Returns or constructs an instance identifier. The instance id is a hash
371
458
  * of the absolute path to the instance.
@@ -389,7 +476,7 @@ declare global {
389
476
  * print(id3); // => hash: [/my_sub_collection/my_instance]
390
477
  * ```
391
478
  */
392
- export function get_id(path?: string): Hash;
479
+ export function get_id(path: string): Hash;
393
480
  /**
394
481
  * Get the parent for a game object instance.
395
482
  *
@@ -572,325 +659,6 @@ declare global {
572
659
  * ```
573
660
  */
574
661
  export function get_world_transform(id?: SceneGameObjectAddress | Hash | Url): Matrix4;
575
- /**
576
- * This is a callback-function, which is called by the engine when a script component is initialized. It can be used
577
- * to set the initial state of the script.
578
- *
579
- * @param self - reference to the script state to be used for storing data
580
- * @example
581
- * ```ts
582
- * export default defineScript({
583
- * init() {
584
- * // set up useful data
585
- * return { my_value: 1 };
586
- * },
587
- * });
588
- * ```
589
- */
590
- export function init(self: Opaque<"userdata">): void;
591
- /**
592
- * This is a callback-function, which is called by the engine at the end of the frame to update the state of a script
593
- * component. Use it to make final adjustments to the game object instance.
594
- *
595
- * @param self - reference to the script state to be used for storing data
596
- * @param dt - the time-step of the frame update
597
- */
598
- export function late_update(self: Opaque<"userdata">, dt: number): void;
599
- /**
600
- * This is a callback-function, which is called by the engine when user input is sent to the game object instance of the script.
601
- * It can be used to take action on the input, e.g. move the instance according to the input.
602
- * For an instance to obtain user input, it must first acquire input focus
603
- * through the message `acquire_input_focus`.
604
- * Any instance that has obtained input will be put on top of an
605
- * input stack. Input is sent to all listeners on the stack until the
606
- * end of stack is reached, or a listener returns `true`
607
- * to signal that it wants input to be consumed.
608
- * See the documentation of acquire_input_focus for more
609
- * information.
610
- * The `action` parameter is a table containing data about the input mapped to the
611
- * `action_id`.
612
- * For mapped actions it specifies the value of the input and if it was just pressed or released.
613
- * Actions are mapped to input in an input_binding-file.
614
- * Mouse movement is specifically handled and uses `nil` as its `action_id`.
615
- * The `action` only contains positional parameters in this case, such as x and y of the pointer.
616
- * Here is a brief description of the available table fields:
617
- *
618
- * Field
619
- * Description
620
- *
621
- * `value`
622
- * The amount of input given by the user. This is usually 1 for buttons and 0-1 for analogue inputs. This is not present for mouse movement and text input.
623
- *
624
- * `pressed`
625
- * If the input was pressed this frame. This is not present for mouse movement and text input.
626
- *
627
- * `released`
628
- * If the input was released this frame. This is not present for mouse movement and text input.
629
- *
630
- * `repeated`
631
- * If the input was repeated this frame. This is similar to how a key on a keyboard is repeated when you hold it down. This is not present for mouse movement and text input.
632
- *
633
- * `x`
634
- * The x value of a pointer device, if present. This is not present for gamepad, key and text input.
635
- *
636
- * `y`
637
- * The y value of a pointer device, if present. This is not present for gamepad, key and text input.
638
- *
639
- * `screen_x`
640
- * The screen space x value of a pointer device, if present. This is not present for gamepad, key and text input.
641
- *
642
- * `screen_y`
643
- * The screen space y value of a pointer device, if present. This is not present for gamepad, key and text input.
644
- *
645
- * `dx`
646
- * The change in x value of a pointer device, if present. This is not present for gamepad, key and text input.
647
- *
648
- * `dy`
649
- * The change in y value of a pointer device, if present. This is not present for gamepad, key and text input.
650
- *
651
- * `screen_dx`
652
- * The change in screen space x value of a pointer device, if present. This is not present for gamepad, key and text input.
653
- *
654
- * `screen_dy`
655
- * The change in screen space y value of a pointer device, if present. This is not present for gamepad, key and text input.
656
- *
657
- * `gamepad`
658
- * The index of the gamepad device that provided the input. See table below about gamepad input.
659
- *
660
- * `touch`
661
- * List of touch input, one element per finger, if present. See table below about touch input
662
- *
663
- * `text`
664
- * Text input from a (virtual) keyboard or similar.
665
- *
666
- * `marked_text`
667
- * Sequence of entered symbols while entering a symbol combination, for example Japanese Kana.
668
- *
669
- * Gamepad specific fields:
670
- *
671
- * Field
672
- * Description
673
- *
674
- * `gamepad`
675
- * The index of the gamepad device that provided the input.
676
- *
677
- * `userid`
678
- * Id of the user associated with the controller. Usually only relevant on consoles.
679
- *
680
- * `gamepad_guid`
681
- * The guid of the gamepad controller. Only passed with "connected" action.
682
- *
683
- * `gamepad_guid_info`
684
- * Parsed guid info table. Only passed with "connected" action. See table below.
685
- *
686
- * `gamepad_unknown`
687
- * True if the input originated from an unknown/unmapped gamepad.
688
- *
689
- * `gamepad_name`
690
- * Name of the gamepad
691
- *
692
- * `gamepad_axis`
693
- * List of gamepad axis values. For raw gamepad input only.
694
- *
695
- * `gamepadhats`
696
- * List of gamepad hat values. For raw gamepad input only.
697
- *
698
- * `gamepad_buttons`
699
- * List of gamepad button values. For raw gamepad input only.
700
- *
701
- * Touch input table:
702
- *
703
- * Field
704
- * Description
705
- *
706
- * `id`
707
- * A number identifying the touch input during its duration.
708
- *
709
- * `pressed`
710
- * True if the finger was pressed this frame.
711
- *
712
- * `released`
713
- * True if the finger was released this frame.
714
- *
715
- * `tap_count`
716
- * Number of taps, one for single, two for double-tap, etc
717
- *
718
- * `x`
719
- * The x touch location.
720
- *
721
- * `y`
722
- * The y touch location.
723
- *
724
- * `dx`
725
- * The change in x value.
726
- *
727
- * `dy`
728
- * The change in y value.
729
- *
730
- * `acc_x`
731
- * Accelerometer x value (if present).
732
- *
733
- * `acc_y`
734
- * Accelerometer y value (if present).
735
- *
736
- * `acc_z`
737
- * Accelerometer z value (if present).
738
- *
739
- * Guid info table:
740
- * This info is only passed with a `connected` action.
741
- *
742
- * Field
743
- * Description
744
- *
745
- * `vendor`
746
- * USB vendor id. E.g. Nintendo 0x057e, Sony 0x054c, or Microsoft 0x045e
747
- *
748
- * `product`
749
- * USB product id
750
- *
751
- * `bus`
752
- * How device is communicating. E.g.0x0003 for USB devices and 0x0005 for Bluetooth devices.
753
- *
754
- * `crc`
755
- * SDL CRC16 signature, typically used when vendor and product ids are unavailable
756
- *
757
- * `version`
758
- * The device or firmware version
759
- *
760
- * @param self - reference to the script state to be used for storing data
761
- * @param action_id - id of the received input action, as mapped in the input_binding-file
762
- * @param action - a table containing the input data, see above for a description. **0️⃣ `gamepad` is 0-based; passed to Defold unchanged.**
763
- * @returns optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
764
- * @example
765
- * ```ts
766
- * // This example demonstrates how a game object instance can be moved as a response to user input.
767
- * export default defineScript({
768
- * init() {
769
- * // acquire input focus
770
- * msg.post(".", "acquire_input_focus");
771
- * return {
772
- * // maximum speed the instance can be moved
773
- * max_speed: 2,
774
- * // velocity of the instance, initially zero
775
- * velocity: vmath.vector3(),
776
- * };
777
- * },
778
- *
779
- * update(self, dt) {
780
- * // move the instance
781
- * go.set_position(go.get_position().add(self.velocity.mul(dt)));
782
- * },
783
- *
784
- * on_input(self, action_id, action) {
785
- * // check for movement input
786
- * if (action_id === hash("right")) {
787
- * if (action.released) {
788
- * // reset velocity if input was released
789
- * self.velocity = vmath.vector3();
790
- * } else {
791
- * // update velocity
792
- * self.velocity = vmath.vector3((action.value ?? 0) * self.max_speed, 0, 0);
793
- * }
794
- * }
795
- * },
796
- * });
797
- * ```
798
- */
799
- export function on_input(self: Opaque<"userdata">, action_id: Hash, action: { value?: number; pressed?: boolean; released?: boolean; repeated?: boolean; x?: number; y?: number; screen_x?: number; screen_y?: number; dx?: number; dy?: number; screen_dx?: number; screen_dy?: number; gamepad?: number; gamepad_axis?: Vector3; touch?: { id?: number; pressed?: boolean; released?: boolean; tap_count?: number; x?: number; y?: number; dx?: number; dy?: number; acc_x?: number; acc_y?: number; acc_z?: number }[]; text?: string }): boolean | undefined;
800
- /**
801
- * This is a callback-function, which is called by the engine whenever a message has been sent to the script component.
802
- * It can be used to take action on the message, e.g. send a response back to the sender of the message.
803
- * The `message` parameter is a table containing the message data. If the message is sent from the engine, the
804
- * documentation of the message specifies which data is supplied.
805
- *
806
- * @param self - reference to the script state to be used for storing data
807
- * @param message_id - id of the received message
808
- * @param message - a table containing the message data
809
- * @param sender - address of the sender
810
- * @example
811
- * This example demonstrates how a game object instance, called "a", can communicate with another instance, called "b". It
812
- * is assumed that both script components of the instances has id "script".
813
- * Script of instance "a":
814
- * ```ts
815
- * // This example demonstrates how a game object instance, called "a", can communicate with another instance, called "b". It
816
- * // is assumed that both script components of the instances has id "script".
817
- *
818
- * // a.script — Script of instance "a":
819
- * export default defineScript({
820
- * init() {
821
- * // let b know about some important data
822
- * msg.post("b#script", "my_data", { important_value: 1 });
823
- * },
824
- * });
825
- * ```
826
- * @example
827
- * Script of instance "b":
828
- * ```ts
829
- * // b.script — Script of instance "b":
830
- * export default defineScript({
831
- * init() {
832
- * // store the url of instance "a" for later use, by specifying undefined as socket we
833
- * // automatically use our own socket
834
- * return { a_url: msg.url(undefined, go.get_id("a"), "script"), important_value: 0 };
835
- * },
836
- *
837
- * on_message(self, message_id, message, sender) {
838
- * // check message and sender
839
- * if (message_id === hash("my_data") && sender === self.a_url && typeof message.important_value === "number") {
840
- * // use the data in some way
841
- * self.important_value = message.important_value;
842
- * }
843
- * },
844
- * });
845
- * ```
846
- */
847
- export function on_message(self: Opaque<"userdata">, message_id: Hash, message: Record<string | number, unknown>, sender: Url): void;
848
- /**
849
- * This is a callback-function, which is called by the engine when the script component is reloaded, e.g. from the editor.
850
- * It can be used for live development, e.g. to tweak constants or set up the state properly for the instance.
851
- *
852
- * @param self - reference to the script state to be used for storing data
853
- * @example
854
- * ```ts
855
- * // This example demonstrates how to tweak the speed of a game object instance that is moved on user input.
856
- * export default defineScript({
857
- * init() {
858
- * // acquire input focus
859
- * msg.post(".", "acquire_input_focus");
860
- * return {
861
- * // maximum speed the instance can be moved, this value is tweaked in the on_reload function below
862
- * max_speed: 2,
863
- * // velocity of the instance, initially zero
864
- * velocity: vmath.vector3(),
865
- * };
866
- * },
867
- *
868
- * update(self, dt) {
869
- * // move the instance
870
- * go.set_position(go.get_position().add(self.velocity.mul(dt)));
871
- * },
872
- *
873
- * on_input(self, action_id, action) {
874
- * // check for movement input
875
- * if (action_id === hash("right")) {
876
- * if (action.released) {
877
- * // reset velocity if input was released
878
- * self.velocity = vmath.vector3();
879
- * } else {
880
- * // update velocity
881
- * self.velocity = vmath.vector3((action.value ?? 0) * self.max_speed, 0, 0);
882
- * }
883
- * }
884
- * },
885
- *
886
- * on_reload(self) {
887
- * // edit this value and reload the script component
888
- * self.max_speed = 100;
889
- * },
890
- * });
891
- * ```
892
- */
893
- export function on_reload(self: Opaque<"userdata">): void;
894
662
  /**
895
663
  * Sets the parent for a game object instance. This means that the instance will exist in the geometrical space of its parent,
896
664
  * 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
@@ -1003,29 +771,6 @@ declare global {
1003
771
  * ```
1004
772
  */
1005
773
  export function set_scale_xy(scale: number | Vector3, id?: SceneGameObjectAddress | Hash | Url): void;
1006
- /**
1007
- * This is a callback-function, which is called by the engine every frame to update the state of a script component.
1008
- * It can be used to perform any kind of game related tasks, e.g. moving the game object instance.
1009
- *
1010
- * @param self - reference to the script state to be used for storing data
1011
- * @param dt - the time-step of the frame update
1012
- * @example
1013
- * ```ts
1014
- * // This example demonstrates how to move a game object instance through the script component:
1015
- * export default defineScript({
1016
- * init() {
1017
- * // set initial velocity to be 1 along world x-axis
1018
- * return { my_velocity: vmath.vector3(1, 0, 0) };
1019
- * },
1020
- *
1021
- * update(self, dt) {
1022
- * // move the game object instance
1023
- * go.set_position(go.get_position().add(self.my_velocity.mul(dt)));
1024
- * },
1025
- * });
1026
- * ```
1027
- */
1028
- export function update(self: Opaque<"userdata">, dt: number): void;
1029
774
  /**
1030
775
  * Recalculates and updates the cached world transform immediately for the target instance
1031
776
  * and its ancestors (parent chain up to the collection root). Descendants (children) are
@@ -1079,7 +824,7 @@ declare global {
1079
824
  */
1080
825
  export function world_to_local_transform(transformation: Matrix4, url?: SceneGameObjectAddress | Hash | Url): Matrix4;
1081
826
  export { _delete as delete };
1082
- export interface properties {
827
+ export interface Properties {
1083
828
  /**
1084
829
  * The rotation of the game object expressed in Euler angles.
1085
830
  * Euler angles are specified in degrees in the interval (-360, 360).
@@ -4,8 +4,9 @@ declare global {
4
4
  * Graphics functions and constants.
5
5
  */
6
6
  namespace graphics {
7
+ 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;
7
8
  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;
8
- 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;
9
+ type State = typeof graphics.STATE_ALPHA_TEST | typeof graphics.STATE_ALPHA_TEST_SUPPORTED | typeof graphics.STATE_BLEND | typeof graphics.STATE_CULL_FACE | typeof graphics.STATE_DEPTH_TEST | typeof graphics.STATE_POLYGON_OFFSET_FILL | typeof graphics.STATE_SCISSOR_TEST | typeof graphics.STATE_STENCIL_TEST;
9
10
  const BLEND_EQUATION_ADD: number & { readonly __brand: "graphics.BLEND_EQUATION_ADD" };
10
11
  const BLEND_EQUATION_MAX: number & { readonly __brand: "graphics.BLEND_EQUATION_MAX" };
11
12
  const BLEND_EQUATION_MIN: number & { readonly __brand: "graphics.BLEND_EQUATION_MIN" };