@defold-typescript/types 0.40.0 → 0.42.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 (224) hide show
  1. package/api-availability.json +3963 -772
  2. package/api-migrations.json +27 -0
  3. package/api-signatures.json +18069 -10240
  4. package/api-targets.json +448 -11
  5. package/examples/translations.json +560 -89
  6. package/fixtures/messages_doc.json +96 -0
  7. package/generated/b2d.d.ts +680 -4
  8. package/generated/b2d_body.d.ts +29 -103
  9. package/generated/b2d_chain.d.ts +5 -6
  10. package/generated/b2d_fixture.d.ts +34 -38
  11. package/generated/b2d_joint.d.ts +503 -25
  12. package/generated/b2d_shape.d.ts +183 -20
  13. package/generated/b2d_world.d.ts +57 -63
  14. package/generated/buffer.d.ts +16 -15
  15. package/generated/builtin-messages.d.ts +7 -1
  16. package/generated/bullet3d.d.ts +91 -0
  17. package/generated/bullet3d_collision_object.d.ts +433 -0
  18. package/generated/bullet3d_constraint.d.ts +818 -0
  19. package/generated/bullet3d_rigid_body.d.ts +429 -0
  20. package/generated/bullet3d_shape.d.ts +123 -0
  21. package/generated/bullet3d_world.d.ts +492 -0
  22. package/generated/camera.d.ts +29 -32
  23. package/generated/collectionfactory.d.ts +15 -18
  24. package/generated/collectionproxy.d.ts +22 -6
  25. package/generated/compute.d.ts +12 -238
  26. package/generated/crash.d.ts +24 -10
  27. package/generated/editor-vm/http.d.ts +90 -7
  28. package/generated/editor-vm/image.d.ts +7 -7
  29. package/generated/editor-vm/json.d.ts +11 -0
  30. package/generated/editor-vm/localization.d.ts +7 -7
  31. package/generated/editor-vm/tilemap_tiles.d.ts +56 -10
  32. package/generated/editor-vm/zip.d.ts +28 -0
  33. package/generated/editor.d.ts +1496 -430
  34. package/generated/factory.d.ts +21 -25
  35. package/generated/font.d.ts +64 -22
  36. package/generated/go.d.ts +235 -182
  37. package/generated/graphics.d.ts +335 -97
  38. package/generated/gui.d.ts +240 -471
  39. package/generated/html5.d.ts +2 -2
  40. package/generated/http.d.ts +28 -35
  41. package/generated/image.d.ts +105 -72
  42. package/generated/json.d.ts +34 -16
  43. package/generated/kinds/gui-script.d.ts +7 -0
  44. package/generated/kinds/render-script.d.ts +7 -0
  45. package/generated/kinds/script.d.ts +7 -0
  46. package/generated/label.d.ts +77 -7
  47. package/generated/liveupdate.d.ts +13 -10
  48. package/generated/material.d.ts +312 -360
  49. package/generated/model.d.ts +40 -39
  50. package/generated/particlefx.d.ts +19 -28
  51. package/generated/physics.d.ts +365 -133
  52. package/generated/profiler.d.ts +13 -23
  53. package/generated/render.d.ts +237 -297
  54. package/generated/resource.d.ts +664 -583
  55. package/generated/socket.d.ts +120 -133
  56. package/generated/sound.d.ts +62 -31
  57. package/generated/sprite.d.ts +31 -17
  58. package/generated/sys.d.ts +234 -190
  59. package/generated/tilemap.d.ts +21 -16
  60. package/generated/timer.d.ts +34 -21
  61. package/generated/versions/defold-1.12.4/b2d_body.d.ts +0 -7
  62. package/generated/versions/defold-1.12.4/buffer.d.ts +1 -3
  63. package/generated/versions/defold-1.12.4/camera.d.ts +21 -21
  64. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +9 -9
  65. package/generated/versions/defold-1.12.4/collectionproxy.d.ts +2 -2
  66. package/generated/versions/defold-1.12.4/crash.d.ts +2 -2
  67. package/generated/versions/defold-1.12.4/factory.d.ts +15 -16
  68. package/generated/versions/defold-1.12.4/go.d.ts +6 -12
  69. package/generated/versions/defold-1.12.4/gui.d.ts +77 -175
  70. package/generated/versions/defold-1.12.4/html5.d.ts +1 -1
  71. package/generated/versions/defold-1.12.4/http.d.ts +0 -13
  72. package/generated/versions/defold-1.12.4/image.d.ts +16 -33
  73. package/generated/versions/defold-1.12.4/index.d.ts +1 -0
  74. package/generated/versions/defold-1.12.4/json.d.ts +10 -6
  75. package/generated/versions/defold-1.12.4/label.d.ts +2 -3
  76. package/generated/versions/defold-1.12.4/liveupdate.d.ts +5 -3
  77. package/generated/versions/defold-1.12.4/model.d.ts +2 -10
  78. package/generated/versions/defold-1.12.4/particlefx.d.ts +2 -5
  79. package/generated/versions/defold-1.12.4/physics.d.ts +69 -67
  80. package/generated/versions/defold-1.12.4/profiler.d.ts +2 -5
  81. package/generated/versions/defold-1.12.4/render.d.ts +99 -128
  82. package/generated/versions/defold-1.12.4/resource.d.ts +120 -148
  83. package/generated/versions/defold-1.12.4/socket.d.ts +34 -60
  84. package/generated/versions/defold-1.12.4/sound.d.ts +8 -8
  85. package/generated/versions/defold-1.12.4/sprite.d.ts +15 -5
  86. package/generated/versions/defold-1.12.4/sys.d.ts +37 -71
  87. package/generated/versions/defold-1.12.4/tilemap.d.ts +18 -11
  88. package/generated/versions/defold-1.12.4/timer.d.ts +5 -3
  89. package/generated/versions/defold-1.12.4/vmath.d.ts +0 -21
  90. package/generated/versions/defold-1.12.4/window.d.ts +1 -16
  91. package/generated/versions/defold-1.13.0/b2d_body.d.ts +10 -55
  92. package/generated/versions/defold-1.13.0/b2d_fixture.d.ts +25 -25
  93. package/generated/versions/defold-1.13.0/b2d_shape.d.ts +169 -8
  94. package/generated/versions/defold-1.13.0/b2d_world.d.ts +16 -10
  95. package/generated/versions/defold-1.13.0/buffer.d.ts +1 -3
  96. package/generated/versions/defold-1.13.0/camera.d.ts +25 -25
  97. package/generated/versions/defold-1.13.0/collectionfactory.d.ts +9 -9
  98. package/generated/versions/defold-1.13.0/collectionproxy.d.ts +2 -2
  99. package/generated/versions/defold-1.13.0/compute.d.ts +0 -69
  100. package/generated/versions/defold-1.13.0/crash.d.ts +2 -2
  101. package/generated/versions/defold-1.13.0/editor-vm/tilemap_tiles.d.ts +3 -3
  102. package/generated/versions/defold-1.13.0/editor.d.ts +34 -24
  103. package/generated/versions/defold-1.13.0/factory.d.ts +15 -16
  104. package/generated/versions/defold-1.13.0/go.d.ts +6 -12
  105. package/generated/versions/defold-1.13.0/graphics.d.ts +73 -37
  106. package/generated/versions/defold-1.13.0/gui.d.ts +77 -175
  107. package/generated/versions/defold-1.13.0/html5.d.ts +1 -1
  108. package/generated/versions/defold-1.13.0/http.d.ts +0 -13
  109. package/generated/versions/defold-1.13.0/image.d.ts +16 -33
  110. package/generated/versions/defold-1.13.0/index.d.ts +1 -0
  111. package/generated/versions/defold-1.13.0/json.d.ts +10 -6
  112. package/generated/versions/defold-1.13.0/label.d.ts +2 -3
  113. package/generated/versions/defold-1.13.0/liveupdate.d.ts +7 -5
  114. package/generated/versions/defold-1.13.0/material.d.ts +68 -106
  115. package/generated/versions/defold-1.13.0/model.d.ts +2 -10
  116. package/generated/versions/defold-1.13.0/particlefx.d.ts +2 -5
  117. package/generated/versions/defold-1.13.0/physics.d.ts +69 -67
  118. package/generated/versions/defold-1.13.0/profiler.d.ts +2 -5
  119. package/generated/versions/defold-1.13.0/render.d.ts +99 -128
  120. package/generated/versions/defold-1.13.0/resource.d.ts +126 -150
  121. package/generated/versions/defold-1.13.0/socket.d.ts +34 -60
  122. package/generated/versions/defold-1.13.0/sound.d.ts +8 -8
  123. package/generated/versions/defold-1.13.0/sprite.d.ts +15 -5
  124. package/generated/versions/defold-1.13.0/sys.d.ts +37 -71
  125. package/generated/versions/defold-1.13.0/tilemap.d.ts +18 -11
  126. package/generated/versions/defold-1.13.0/timer.d.ts +5 -3
  127. package/generated/versions/defold-1.13.0/vmath.d.ts +0 -21
  128. package/generated/versions/defold-1.13.0/window.d.ts +1 -16
  129. package/generated/versions/defold-1.13.1/b2d.d.ts +33 -0
  130. package/generated/versions/defold-1.13.1/b2d_body.d.ts +636 -0
  131. package/generated/versions/defold-1.13.1/b2d_chain.d.ts +106 -0
  132. package/generated/versions/defold-1.13.1/b2d_fixture.d.ts +157 -0
  133. package/generated/versions/defold-1.13.1/b2d_joint.d.ts +823 -0
  134. package/generated/versions/defold-1.13.1/b2d_shape.d.ts +400 -0
  135. package/generated/versions/defold-1.13.1/b2d_world.d.ts +320 -0
  136. package/generated/versions/defold-1.13.1/buffer.d.ts +189 -0
  137. package/generated/versions/defold-1.13.1/camera.d.ts +303 -0
  138. package/generated/versions/defold-1.13.1/collectionfactory.d.ts +151 -0
  139. package/generated/versions/defold-1.13.1/collectionproxy.d.ts +93 -0
  140. package/generated/versions/defold-1.13.1/compute.d.ts +237 -0
  141. package/generated/versions/defold-1.13.1/crash.d.ts +143 -0
  142. package/generated/versions/defold-1.13.1/editor-vm/http.d.ts +56 -0
  143. package/generated/versions/defold-1.13.1/editor-vm/image.d.ts +48 -0
  144. package/generated/versions/defold-1.13.1/editor-vm/json.d.ts +10 -0
  145. package/generated/versions/defold-1.13.1/editor-vm/localization.d.ts +42 -0
  146. package/generated/versions/defold-1.13.1/editor-vm/tilemap_tiles.d.ts +80 -0
  147. package/generated/versions/defold-1.13.1/editor-vm/zip.d.ts +10 -0
  148. package/generated/versions/defold-1.13.1/editor-vm/zlib.d.ts +24 -0
  149. package/generated/versions/defold-1.13.1/editor.d.ts +1121 -0
  150. package/generated/versions/defold-1.13.1/factory.d.ts +124 -0
  151. package/generated/versions/defold-1.13.1/font.d.ts +81 -0
  152. package/generated/versions/defold-1.13.1/go.d.ts +1107 -0
  153. package/generated/versions/defold-1.13.1/graphics.d.ts +411 -0
  154. package/generated/versions/defold-1.13.1/gui.d.ts +2353 -0
  155. package/generated/versions/defold-1.13.1/html5.d.ts +55 -0
  156. package/generated/versions/defold-1.13.1/http.d.ts +77 -0
  157. package/generated/versions/defold-1.13.1/image.d.ts +131 -0
  158. package/generated/versions/defold-1.13.1/index.d.ts +57 -0
  159. package/generated/versions/defold-1.13.1/json.d.ts +80 -0
  160. package/generated/versions/defold-1.13.1/kinds/editor-script.d.ts +14 -0
  161. package/generated/versions/defold-1.13.1/label.d.ts +93 -0
  162. package/generated/versions/defold-1.13.1/liveupdate.d.ts +142 -0
  163. package/generated/versions/defold-1.13.1/material.d.ts +408 -0
  164. package/generated/versions/defold-1.13.1/model.d.ts +272 -0
  165. package/generated/versions/defold-1.13.1/msg.d.ts +10 -0
  166. package/generated/versions/defold-1.13.1/particlefx.d.ts +163 -0
  167. package/generated/versions/defold-1.13.1/physics.d.ts +559 -0
  168. package/generated/versions/defold-1.13.1/profiler.d.ts +235 -0
  169. package/generated/versions/defold-1.13.1/render.d.ts +1190 -0
  170. package/generated/versions/defold-1.13.1/resource.d.ts +1523 -0
  171. package/generated/versions/defold-1.13.1/socket.d.ts +784 -0
  172. package/generated/versions/defold-1.13.1/sound.d.ts +292 -0
  173. package/generated/versions/defold-1.13.1/sprite.d.ts +175 -0
  174. package/generated/versions/defold-1.13.1/sys.d.ts +678 -0
  175. package/generated/versions/defold-1.13.1/tilemap.d.ts +208 -0
  176. package/generated/versions/defold-1.13.1/timer.d.ts +125 -0
  177. package/generated/versions/defold-1.13.1/types.d.ts +61 -0
  178. package/generated/versions/defold-1.13.1/vmath.d.ts +774 -0
  179. package/generated/versions/defold-1.13.1/window.d.ts +183 -0
  180. package/generated/versions/defold-1.13.1/zlib.d.ts +41 -0
  181. package/generated/vmath.d.ts +1 -21
  182. package/generated/window.d.ts +71 -71
  183. package/identity-vocabulary.json +561 -0
  184. package/index.d.ts +7 -0
  185. package/package.json +18 -2
  186. package/scripts/example-store-io.ts +12 -1
  187. package/scripts/extension-goldens.ts +1 -0
  188. package/scripts/fidelity-baseline.json +146 -46
  189. package/scripts/generate-api-availability.ts +90 -12
  190. package/scripts/generate-api-signatures.ts +12 -2
  191. package/scripts/import-defold-release.ts +106 -26
  192. package/scripts/prose-constants.ts +77 -16
  193. package/scripts/regen.ts +391 -77
  194. package/scripts/shared-handle-methods.ts +53 -0
  195. package/scripts/signature-store-fs.ts +1 -0
  196. package/scripts/sync-api-docs.ts +48 -10
  197. package/src/api-availability.ts +0 -0
  198. package/src/api-doc.ts +201 -3
  199. package/src/api-identity.ts +252 -0
  200. package/src/core-types.ts +26 -3
  201. package/src/correction-pins.ts +49 -0
  202. package/src/doc-comment.ts +104 -11
  203. package/src/doc-corrections.ts +108 -0
  204. package/src/editor-vm-globals.d.ts +5 -2
  205. package/src/emit-dts.ts +2064 -281
  206. package/src/emit-messages.ts +52 -0
  207. package/src/example-store.ts +125 -14
  208. package/src/field-correction-coverage.ts +204 -0
  209. package/src/fnv1a.ts +16 -0
  210. package/src/go-overloads.d.ts +25 -6
  211. package/src/index-base-table.ts +145 -0
  212. package/src/index-slot-classifications.ts +588 -0
  213. package/src/index.ts +38 -5
  214. package/src/library-index-slot-classifications.ts +332 -0
  215. package/src/lifecycle.ts +61 -199
  216. package/src/luals-type-expr.ts +354 -0
  217. package/src/msg-overloads.d.ts +0 -1
  218. package/src/param-correction-provenance.ts +8 -11
  219. package/src/render-overloads.d.ts +0 -15
  220. package/src/return-correction-provenance.ts +58 -16
  221. package/src/sys-overloads.d.ts +48 -0
  222. package/src/vmath-overloads.d.ts +27 -1
  223. package/src/window-event-guard.d.ts +6 -9
  224. package/url-parameters.json +1 -2
package/generated/go.d.ts CHANGED
@@ -1,13 +1,32 @@
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
  /**
6
6
  * Game object API documentation
7
7
  */
8
8
  namespace go {
9
+ /**
10
+ * Options for accessing indexed or internal component properties with go.get and go.set.
11
+ */
12
+ export interface property_options {
13
+ /**
14
+ * Index into an array property, starting at one.
15
+ */
16
+ index?: number;
17
+ /**
18
+ * Name of an internal property.
19
+ */
20
+ key?: Hash;
21
+ /**
22
+ * Internal component resources identified by key, such as particle FX emitters.
23
+ */
24
+ keys?: Hash[];
25
+ }
9
26
  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
27
  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;
28
+ 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;
29
+ 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
30
  /**
12
31
  * in-back
13
32
  */
@@ -215,15 +234,10 @@ declare global {
215
234
  * @param playback - playback mode of the animation
216
235
  *
217
236
  * - `go.PLAYBACK_ONCE_FORWARD`
218
- *
219
237
  * - `go.PLAYBACK_ONCE_BACKWARD`
220
- *
221
238
  * - `go.PLAYBACK_ONCE_PINGPONG`
222
- *
223
239
  * - `go.PLAYBACK_LOOP_FORWARD`
224
- *
225
240
  * - `go.PLAYBACK_LOOP_BACKWARD`
226
- *
227
241
  * - `go.PLAYBACK_LOOP_PINGPONG`
228
242
  * @param to - target property value
229
243
  * @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
@@ -233,7 +247,7 @@ declare global {
233
247
  *
234
248
  * `self`
235
249
  *
236
- * object The current object.
250
+ * script_instance The current script instance.
237
251
  *
238
252
  * `url`
239
253
  *
@@ -262,7 +276,7 @@ declare global {
262
276
  * go.animate("go", "position.y", go.PLAYBACK_LOOP_PINGPONG, 100, vec, 2.0);
263
277
  * ```
264
278
  */
265
- 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;
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, delay?: number, complete_function?: (self: unknown, url: Url, property: Hash) => void): void;
266
280
  /**
267
281
  * By calling this function, all or specified stored property animations of the game object or component will be canceled.
268
282
  * See the properties guide for which properties can be animated and the animation guide for how to animate them.
@@ -285,7 +299,7 @@ declare global {
285
299
  * go.cancel_animations("#sprite");
286
300
  * ```
287
301
  */
288
- export function cancel_animations(url: SceneAddress | Hash | Url, property?: string | Hash): void;
302
+ export function cancel_animations(url?: SceneAddress | Hash | Url, property?: string | Hash): void;
289
303
  /**
290
304
  * Delete one or more game objects identified by id. Deletion is asynchronous meaning that
291
305
  * the game object(s) are scheduled for deletion which will happen at the end of the current
@@ -321,7 +335,7 @@ declare global {
321
335
  * go.delete(ids, true);
322
336
  * ```
323
337
  */
324
- function _delete(id?: SceneGameObjectAddress | Hash | Url | (SceneGameObjectAddress | Hash | Url)[] | boolean, recursive?: boolean): void;
338
+ function _delete(id?: SceneGameObjectAddress | Hash | Url | (string | Hash | Url)[] | boolean, recursive?: boolean): void;
325
339
  /**
326
340
  * This function can check for game objects in any collection by specifying
327
341
  * the collection name in the URL.
@@ -345,7 +359,7 @@ declare global {
345
359
  * be used to e.g. take some last action, report the finalization to other game object instances, delete spawned objects
346
360
  * or release user input focus (see release_input_focus).
347
361
  *
348
- * @param self - reference to the script state to be used for storing data
362
+ * @param self - script instance used for storing state
349
363
  * @example
350
364
  * ```ts
351
365
  * export default defineScript({
@@ -360,23 +374,22 @@ declare global {
360
374
  * });
361
375
  * ```
362
376
  */
363
- export function final(self: Opaque<"userdata">): void;
377
+ export function final(self: unknown): void;
364
378
  /**
365
379
  * This is a callback-function, which is called by the engine at fixed intervals to update the state of a script
366
380
  * component. The function will be called if 'Fixed Update Frequency' is enabled in the Engine section of game.project.
367
381
  * It can for instance be used to update game logic with the physics simulation if using a fixed timestep for the
368
382
  * physics (enabled by ticking 'Use Fixed Timestep' in the Physics section of game.project).
369
383
  *
370
- * @param self - reference to the script state to be used for storing data
384
+ * @param self - script instance used for storing state
371
385
  * @param dt - the time-step of the frame update
372
386
  */
373
- export function fixed_update(self: Opaque<"userdata">, dt: number): void;
387
+ export function fixed_update(self: unknown, dt: number): void;
374
388
  /**
375
389
  * Returns or constructs an instance identifier. The instance id is a hash
376
390
  * of the absolute path to the instance.
377
391
  *
378
392
  * - If `path` is specified, it can either be absolute or relative to the instance of the calling script.
379
- *
380
393
  * - If `path` is not specified, the id of the game object instance the script is attached to will be returned.
381
394
  *
382
395
  * @param path - path of the instance for which to return the id
@@ -582,7 +595,7 @@ declare global {
582
595
  * This is a callback-function, which is called by the engine when a script component is initialized. It can be used
583
596
  * to set the initial state of the script.
584
597
  *
585
- * @param self - reference to the script state to be used for storing data
598
+ * @param self - script instance used for storing state
586
599
  * @example
587
600
  * ```ts
588
601
  * export default defineScript({
@@ -593,15 +606,15 @@ declare global {
593
606
  * });
594
607
  * ```
595
608
  */
596
- export function init(self: Opaque<"userdata">): void;
609
+ export function init(self: unknown): void;
597
610
  /**
598
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
599
612
  * component. Use it to make final adjustments to the game object instance.
600
613
  *
601
- * @param self - reference to the script state to be used for storing data
614
+ * @param self - script instance used for storing state
602
615
  * @param dt - the time-step of the frame update
603
616
  */
604
- export function late_update(self: Opaque<"userdata">, dt: number): void;
617
+ export function late_update(self: unknown, dt: number): void;
605
618
  /**
606
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.
607
620
  * It can be used to take action on the input, e.g. move the instance according to the input.
@@ -613,159 +626,10 @@ declare global {
613
626
  * to signal that it wants input to be consumed.
614
627
  * See the documentation of acquire_input_focus for more
615
628
  * information.
616
- * The `action` parameter is a table containing data about the input mapped to the
617
- * `action_id`.
618
- * For mapped actions it specifies the value of the input and if it was just pressed or released.
619
- * Actions are mapped to input in an input_binding-file.
620
- * Mouse movement is specifically handled and uses `nil` as its `action_id`.
621
- * The `action` only contains positional parameters in this case, such as x and y of the pointer.
622
- * Here is a brief description of the available table fields:
623
- *
624
- * Field
625
- * Description
626
- *
627
- * `value`
628
- * 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.
629
- *
630
- * `pressed`
631
- * If the input was pressed this frame. This is not present for mouse movement and text input.
632
- *
633
- * `released`
634
- * If the input was released this frame. This is not present for mouse movement and text input.
635
- *
636
- * `repeated`
637
- * 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.
638
- *
639
- * `x`
640
- * The x value of a pointer device, if present. This is not present for gamepad, key and text input.
641
- *
642
- * `y`
643
- * The y value of a pointer device, if present. This is not present for gamepad, key and text input.
644
- *
645
- * `screen_x`
646
- * The screen space x value of a pointer device, if present. This is not present for gamepad, key and text input.
647
- *
648
- * `screen_y`
649
- * The screen space y value of a pointer device, if present. This is not present for gamepad, key and text input.
650
- *
651
- * `dx`
652
- * The change in x value of a pointer device, if present. This is not present for gamepad, key and text input.
653
- *
654
- * `dy`
655
- * The change in y value of a pointer device, if present. This is not present for gamepad, key and text input.
656
- *
657
- * `screen_dx`
658
- * The change in screen space x value of a pointer device, if present. This is not present for gamepad, key and text input.
659
- *
660
- * `screen_dy`
661
- * The change in screen space y value of a pointer device, if present. This is not present for gamepad, key and text input.
662
- *
663
- * `gamepad`
664
- * The index of the gamepad device that provided the input. See table below about gamepad input.
665
- *
666
- * `touch`
667
- * List of touch input, one element per finger, if present. See table below about touch input
668
- *
669
- * `text`
670
- * Text input from a (virtual) keyboard or similar.
671
- *
672
- * `marked_text`
673
- * Sequence of entered symbols while entering a symbol combination, for example Japanese Kana.
674
- *
675
- * Gamepad specific fields:
676
- *
677
- * Field
678
- * Description
679
- *
680
- * `gamepad`
681
- * The index of the gamepad device that provided the input.
682
629
  *
683
- * `userid`
684
- * Id of the user associated with the controller. Usually only relevant on consoles.
685
- *
686
- * `gamepad_guid`
687
- * The guid of the gamepad controller. Only passed with "connected" action.
688
- *
689
- * `gamepad_guid_info`
690
- * Parsed guid info table. Only passed with "connected" action. See table below.
691
- *
692
- * `gamepad_unknown`
693
- * True if the input originated from an unknown/unmapped gamepad.
694
- *
695
- * `gamepad_name`
696
- * Name of the gamepad
697
- *
698
- * `gamepad_axis`
699
- * List of gamepad axis values. For raw gamepad input only.
700
- *
701
- * `gamepadhats`
702
- * List of gamepad hat values. For raw gamepad input only.
703
- *
704
- * `gamepad_buttons`
705
- * List of gamepad button values. For raw gamepad input only.
706
- *
707
- * Touch input table:
708
- *
709
- * Field
710
- * Description
711
- *
712
- * `id`
713
- * A number identifying the touch input during its duration.
714
- *
715
- * `pressed`
716
- * True if the finger was pressed this frame.
717
- *
718
- * `released`
719
- * True if the finger was released this frame.
720
- *
721
- * `tap_count`
722
- * Number of taps, one for single, two for double-tap, etc
723
- *
724
- * `x`
725
- * The x touch location.
726
- *
727
- * `y`
728
- * The y touch location.
729
- *
730
- * `dx`
731
- * The change in x value.
732
- *
733
- * `dy`
734
- * The change in y value.
735
- *
736
- * `acc_x`
737
- * Accelerometer x value (if present).
738
- *
739
- * `acc_y`
740
- * Accelerometer y value (if present).
741
- *
742
- * `acc_z`
743
- * Accelerometer z value (if present).
744
- *
745
- * Guid info table:
746
- * This info is only passed with a `connected` action.
747
- *
748
- * Field
749
- * Description
750
- *
751
- * `vendor`
752
- * USB vendor id. E.g. Nintendo 0x057e, Sony 0x054c, or Microsoft 0x045e
753
- *
754
- * `product`
755
- * USB product id
756
- *
757
- * `bus`
758
- * How device is communicating. E.g.0x0003 for USB devices and 0x0005 for Bluetooth devices.
759
- *
760
- * `crc`
761
- * SDL CRC16 signature, typically used when vendor and product ids are unavailable
762
- *
763
- * `version`
764
- * The device or firmware version
765
- *
766
- * @param self - reference to the script state to be used for storing data
767
- * @param action_id - id of the received input action, as mapped in the input_binding-file
768
- * @param action - a table containing the input data, see above for a description
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.**
769
633
  * @returns optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
770
634
  * @example
771
635
  * ```ts
@@ -802,14 +666,14 @@ declare global {
802
666
  * });
803
667
  * ```
804
668
  */
805
- 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;
669
+ export function on_input(self: unknown, action_id: Hash | undefined, action: go.on_input.action): boolean | undefined;
806
670
  /**
807
671
  * This is a callback-function, which is called by the engine whenever a message has been sent to the script component.
808
672
  * It can be used to take action on the message, e.g. send a response back to the sender of the message.
809
673
  * The `message` parameter is a table containing the message data. If the message is sent from the engine, the
810
674
  * documentation of the message specifies which data is supplied.
811
675
  *
812
- * @param self - reference to the script state to be used for storing data
676
+ * @param self - script instance used for storing state
813
677
  * @param message_id - id of the received message
814
678
  * @param message - a table containing the message data
815
679
  * @param sender - address of the sender
@@ -850,12 +714,12 @@ declare global {
850
714
  * });
851
715
  * ```
852
716
  */
853
- export function on_message(self: Opaque<"userdata">, message_id: Hash, message: Record<string | number, unknown>, sender: Url): void;
717
+ export function on_message(self: unknown, message_id: Hash, message: LuaMap<AnyNotNil, unknown> | Record<string, unknown>, sender: Url): void;
854
718
  /**
855
719
  * This is a callback-function, which is called by the engine when the script component is reloaded, e.g. from the editor.
856
720
  * It can be used for live development, e.g. to tweak constants or set up the state properly for the instance.
857
721
  *
858
- * @param self - reference to the script state to be used for storing data
722
+ * @param self - script instance used for storing state
859
723
  * @example
860
724
  * ```ts
861
725
  * // This example demonstrates how to tweak the speed of a game object instance that is moved on user input.
@@ -896,7 +760,7 @@ declare global {
896
760
  * });
897
761
  * ```
898
762
  */
899
- export function on_reload(self: Opaque<"userdata">): void;
763
+ export function on_reload(self: unknown): void;
900
764
  /**
901
765
  * Sets the parent for a game object instance. This means that the instance will exist in the geometrical space of its parent,
902
766
  * 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
@@ -1013,7 +877,7 @@ declare global {
1013
877
  * This is a callback-function, which is called by the engine every frame to update the state of a script component.
1014
878
  * It can be used to perform any kind of game related tasks, e.g. moving the game object instance.
1015
879
  *
1016
- * @param self - reference to the script state to be used for storing data
880
+ * @param self - script instance used for storing state
1017
881
  * @param dt - the time-step of the frame update
1018
882
  * @example
1019
883
  * ```ts
@@ -1031,7 +895,7 @@ declare global {
1031
895
  * });
1032
896
  * ```
1033
897
  */
1034
- export function update(self: Opaque<"userdata">, dt: number): void;
898
+ export function update(self: unknown, dt: number): void;
1035
899
  /**
1036
900
  * Recalculates and updates the cached world transform immediately for the target instance
1037
901
  * and its ancestors (parent chain up to the collection root). Descendants (children) are
@@ -1068,7 +932,7 @@ declare global {
1068
932
  * const new_position = go.world_to_local_position(test_pos, "/child");
1069
933
  * ```
1070
934
  */
1071
- export function world_to_local_position(position: Vector3, url: SceneGameObjectAddress | Hash | Url): Vector3;
935
+ export function world_to_local_position(position: Vector3, url?: SceneGameObjectAddress | Hash | Url): Vector3;
1072
936
  /**
1073
937
  * The function uses world transformation calculated at the end of previous frame.
1074
938
  *
@@ -1083,8 +947,197 @@ declare global {
1083
947
  * const result_transform = go.world_to_local_transform(test_transform, "/child");
1084
948
  * ```
1085
949
  */
1086
- export function world_to_local_transform(transformation: Matrix4, url: SceneGameObjectAddress | Hash | Url): Matrix4;
950
+ export function world_to_local_transform(transformation: Matrix4, url?: SceneGameObjectAddress | Hash | Url): Matrix4;
1087
951
  export { _delete as delete };
952
+ export namespace on_input {
953
+ /**
954
+ * Data supplied to the global `on_input` lifecycle function.
955
+ */
956
+ interface action {
957
+ /**
958
+ * Amount of input, usually 1 for buttons or between 0 and 1 for analogue input; absent for pointer movement and text input.
959
+ */
960
+ value?: number;
961
+ /**
962
+ * Whether the input was pressed this frame; absent for pointer movement and text input.
963
+ */
964
+ pressed?: boolean;
965
+ /**
966
+ * Whether the input was released this frame; absent for pointer movement and text input.
967
+ */
968
+ released?: boolean;
969
+ /**
970
+ * Whether the input was repeated this frame; absent for pointer movement and text input.
971
+ */
972
+ repeated?: boolean;
973
+ /**
974
+ * Pointer x-coordinate; absent for gamepad, key, and text input.
975
+ */
976
+ x?: number;
977
+ /**
978
+ * Pointer y-coordinate; absent for gamepad, key, and text input.
979
+ */
980
+ y?: number;
981
+ /**
982
+ * Pointer x-coordinate in screen space; absent for gamepad, key, and text input.
983
+ */
984
+ screen_x?: number;
985
+ /**
986
+ * Pointer y-coordinate in screen space; absent for gamepad, key, and text input.
987
+ */
988
+ screen_y?: number;
989
+ /**
990
+ * Change in the pointer x-coordinate; absent for gamepad, key, and text input.
991
+ */
992
+ dx?: number;
993
+ /**
994
+ * Change in the pointer y-coordinate; absent for gamepad, key, and text input.
995
+ */
996
+ dy?: number;
997
+ /**
998
+ * Change in the pointer x-coordinate in screen space; absent for gamepad, key, and text input.
999
+ */
1000
+ screen_dx?: number;
1001
+ /**
1002
+ * Change in the pointer y-coordinate in screen space; absent for gamepad, key, and text input.
1003
+ */
1004
+ screen_dy?: number;
1005
+ /**
1006
+ * Accelerometer x value, when present.
1007
+ */
1008
+ acc_x?: number;
1009
+ /**
1010
+ * Accelerometer y value, when present.
1011
+ */
1012
+ acc_y?: number;
1013
+ /**
1014
+ * Accelerometer z value, when present.
1015
+ */
1016
+ acc_z?: number;
1017
+ /**
1018
+ * Index of the gamepad that provided the input.
1019
+ */
1020
+ gamepad?: number;
1021
+ /**
1022
+ * Id of the user associated with the controller.
1023
+ */
1024
+ userid?: number;
1025
+ /**
1026
+ * SDL-compatible guid, supplied with a gamepad-connected action.
1027
+ */
1028
+ gamepad_guid?: string;
1029
+ /**
1030
+ * Parsed guid information, supplied with a gamepad-connected action.
1031
+ */
1032
+ gamepad_guid_info?: go.on_input.gamepad_guid_info;
1033
+ /**
1034
+ * Whether the input originated from an unknown or unmapped gamepad.
1035
+ */
1036
+ gamepad_unknown?: boolean;
1037
+ /**
1038
+ * Name of a connected gamepad.
1039
+ */
1040
+ gamepad_name?: string;
1041
+ /**
1042
+ * Axis values, supplied only for raw gamepad input.
1043
+ */
1044
+ gamepad_axis?: number[];
1045
+ /**
1046
+ * Hat values, supplied only for raw gamepad input.
1047
+ */
1048
+ gamepad_hats?: number[];
1049
+ /**
1050
+ * Button values, supplied only for raw gamepad input.
1051
+ */
1052
+ gamepad_buttons?: number[];
1053
+ /**
1054
+ * Touch inputs, one entry per finger.
1055
+ */
1056
+ touch?: go.on_input.touch[];
1057
+ /**
1058
+ * Text entered by a text action, or the current sequence for marked-text composition such as Japanese Kana.
1059
+ */
1060
+ text?: string;
1061
+ }
1062
+ /**
1063
+ * Parsed fields from a connected gamepad guid.
1064
+ */
1065
+ interface gamepad_guid_info {
1066
+ /**
1067
+ * USB vendor id.
1068
+ */
1069
+ vendor: number;
1070
+ /**
1071
+ * USB product id.
1072
+ */
1073
+ product: number;
1074
+ /**
1075
+ * Bus used to communicate with the device.
1076
+ */
1077
+ bus: number;
1078
+ /**
1079
+ * SDL CRC16 signature.
1080
+ */
1081
+ crc: number;
1082
+ /**
1083
+ * Device or firmware version.
1084
+ */
1085
+ version: number;
1086
+ }
1087
+ /**
1088
+ * One touch entry in on_input.action.
1089
+ */
1090
+ interface touch {
1091
+ /**
1092
+ * Identifier for the touch during its lifetime.
1093
+ */
1094
+ id: number;
1095
+ /**
1096
+ * Whether the finger was pressed this frame.
1097
+ */
1098
+ pressed: boolean;
1099
+ /**
1100
+ * Whether the finger was released this frame.
1101
+ */
1102
+ released: boolean;
1103
+ /**
1104
+ * Number of taps, such as one for a single tap and two for a double tap.
1105
+ */
1106
+ tap_count: number;
1107
+ /**
1108
+ * Touch x-coordinate.
1109
+ */
1110
+ x: number;
1111
+ /**
1112
+ * Touch y-coordinate.
1113
+ */
1114
+ y: number;
1115
+ /**
1116
+ * Touch x-coordinate in screen space.
1117
+ */
1118
+ screen_x: number;
1119
+ /**
1120
+ * Touch y-coordinate in screen space.
1121
+ */
1122
+ screen_y: number;
1123
+ /**
1124
+ * Change in the touch x-coordinate.
1125
+ */
1126
+ dx: number;
1127
+ /**
1128
+ * Change in the touch y-coordinate.
1129
+ */
1130
+ dy: number;
1131
+ /**
1132
+ * Change in the touch x-coordinate in screen space.
1133
+ */
1134
+ screen_dx: number;
1135
+ /**
1136
+ * Change in the touch y-coordinate in screen space.
1137
+ */
1138
+ screen_dy: number;
1139
+ }
1140
+ }
1088
1141
  export interface properties {
1089
1142
  /**
1090
1143
  * The rotation of the game object expressed in Euler angles.
@@ -1103,9 +1156,9 @@ declare global {
1103
1156
  */
1104
1157
  rotation: Quaternion;
1105
1158
  /**
1106
- * The uniform scale of the game object. The type of the property is number.
1159
+ * The scale of the game object. `go.get` returns a vector3; `go.set` and `go.animate` also take a number, which sets a uniform scale.
1107
1160
  */
1108
- scale: number;
1161
+ scale: number | Vector3;
1109
1162
  }
1110
1163
  }
1111
1164
  }