@defold-typescript/types 0.39.0 → 0.41.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 (227) hide show
  1. package/api-availability.json +4024 -716
  2. package/api-migrations.json +27 -0
  3. package/api-signatures.json +18118 -10264
  4. package/api-targets.json +448 -11
  5. package/examples/translations.json +619 -148
  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 +199 -14
  13. package/generated/b2d_world.d.ts +57 -63
  14. package/generated/buffer.d.ts +33 -29
  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 +31 -34
  23. package/generated/collectionfactory.d.ts +26 -27
  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 +243 -186
  37. package/generated/graphics.d.ts +374 -84
  38. package/generated/gui.d.ts +282 -492
  39. package/generated/html5.d.ts +5 -3
  40. package/generated/http.d.ts +31 -36
  41. package/generated/image.d.ts +127 -85
  42. package/generated/json.d.ts +34 -16
  43. package/generated/kinds/gui-script.d.ts +8 -0
  44. package/generated/kinds/render-script.d.ts +8 -0
  45. package/generated/kinds/script.d.ts +8 -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 +72 -42
  50. package/generated/particlefx.d.ts +19 -28
  51. package/generated/physics.d.ts +378 -144
  52. package/generated/profiler.d.ts +14 -24
  53. package/generated/render.d.ts +294 -297
  54. package/generated/resource.d.ts +753 -641
  55. package/generated/socket.d.ts +131 -134
  56. package/generated/sound.d.ts +65 -34
  57. package/generated/sprite.d.ts +39 -17
  58. package/generated/sys.d.ts +237 -182
  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 +18 -17
  63. package/generated/versions/defold-1.12.4/camera.d.ts +23 -23
  64. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +21 -19
  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 +15 -17
  69. package/generated/versions/defold-1.12.4/gui.d.ts +111 -193
  70. package/generated/versions/defold-1.12.4/html5.d.ts +4 -2
  71. package/generated/versions/defold-1.12.4/http.d.ts +4 -15
  72. package/generated/versions/defold-1.12.4/image.d.ts +38 -46
  73. package/generated/versions/defold-1.12.4/index.d.ts +2 -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 +34 -13
  78. package/generated/versions/defold-1.12.4/particlefx.d.ts +2 -5
  79. package/generated/versions/defold-1.12.4/physics.d.ts +82 -78
  80. package/generated/versions/defold-1.12.4/profiler.d.ts +3 -6
  81. package/generated/versions/defold-1.12.4/render.d.ts +160 -132
  82. package/generated/versions/defold-1.12.4/resource.d.ts +212 -209
  83. package/generated/versions/defold-1.12.4/socket.d.ts +45 -61
  84. package/generated/versions/defold-1.12.4/sound.d.ts +11 -11
  85. package/generated/versions/defold-1.12.4/sprite.d.ts +24 -6
  86. package/generated/versions/defold-1.12.4/sys.d.ts +45 -68
  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 +5 -26
  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 +188 -5
  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 +18 -17
  96. package/generated/versions/defold-1.13.0/camera.d.ts +27 -27
  97. package/generated/versions/defold-1.13.0/collectionfactory.d.ts +21 -19
  98. package/generated/versions/defold-1.13.0/collectionproxy.d.ts +2 -2
  99. package/generated/versions/defold-1.13.0/compute.d.ts +1 -70
  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 +15 -17
  105. package/generated/versions/defold-1.13.0/graphics.d.ts +121 -37
  106. package/generated/versions/defold-1.13.0/gui.d.ts +111 -193
  107. package/generated/versions/defold-1.13.0/html5.d.ts +4 -2
  108. package/generated/versions/defold-1.13.0/http.d.ts +4 -15
  109. package/generated/versions/defold-1.13.0/image.d.ts +38 -46
  110. package/generated/versions/defold-1.13.0/index.d.ts +2 -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 +69 -107
  115. package/generated/versions/defold-1.13.0/model.d.ts +34 -13
  116. package/generated/versions/defold-1.13.0/particlefx.d.ts +2 -5
  117. package/generated/versions/defold-1.13.0/physics.d.ts +82 -78
  118. package/generated/versions/defold-1.13.0/profiler.d.ts +3 -6
  119. package/generated/versions/defold-1.13.0/render.d.ts +160 -132
  120. package/generated/versions/defold-1.13.0/resource.d.ts +217 -210
  121. package/generated/versions/defold-1.13.0/socket.d.ts +45 -61
  122. package/generated/versions/defold-1.13.0/sound.d.ts +11 -11
  123. package/generated/versions/defold-1.13.0/sprite.d.ts +24 -6
  124. package/generated/versions/defold-1.13.0/sys.d.ts +45 -68
  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 +5 -26
  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 +6 -26
  182. package/generated/window.d.ts +71 -71
  183. package/identity-vocabulary.json +561 -0
  184. package/index.d.ts +8 -0
  185. package/package.json +13 -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 +14 -3
  191. package/scripts/import-defold-release.ts +85 -24
  192. package/scripts/prose-constants.ts +157 -0
  193. package/scripts/regen.ts +396 -78
  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 +16 -5
  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/component-properties.d.ts +33 -0
  201. package/src/core-types.ts +28 -3
  202. package/src/correction-pins.ts +49 -0
  203. package/src/custom-messages.d.ts +4 -3
  204. package/src/doc-comment.ts +139 -23
  205. package/src/doc-corrections.ts +108 -0
  206. package/src/editor-vm-globals.d.ts +5 -2
  207. package/src/emit-dts.ts +2474 -281
  208. package/src/emit-messages.ts +52 -0
  209. package/src/engine-globals.d.ts +2 -2
  210. package/src/example-store.ts +125 -14
  211. package/src/field-correction-coverage.ts +204 -0
  212. package/src/fnv1a.ts +16 -0
  213. package/src/go-overloads.d.ts +33 -13
  214. package/src/index-base-table.ts +145 -0
  215. package/src/index-slot-classifications.ts +588 -0
  216. package/src/index.ts +39 -2
  217. package/src/library-index-slot-classifications.ts +332 -0
  218. package/src/lifecycle.ts +61 -199
  219. package/src/luals-type-expr.ts +354 -0
  220. package/src/msg-overloads.d.ts +0 -1
  221. package/src/param-correction-provenance.ts +64 -0
  222. package/src/return-correction-provenance.ts +58 -16
  223. package/src/script-api.ts +3 -1
  224. package/src/sys-overloads.d.ts +48 -0
  225. package/src/vmath-overloads.d.ts +27 -1
  226. package/src/window-event-guard.d.ts +6 -9
  227. package/url-parameters.json +1 -2
@@ -22,7 +22,7 @@ declare global {
22
22
  * - `"arm64-macos"`
23
23
  * - `"x86_64-linux"`
24
24
  */
25
- const platform: unknown;
25
+ const platform: "x86_64-win32" | "x86_64-macos" | "arm64-macos" | "x86_64-linux";
26
26
  /**
27
27
  * A string, version name of Defold
28
28
  */
@@ -34,22 +34,26 @@ declare global {
34
34
  * @param options - table of command line options for bob, without the leading dashes (`--`). You can use snake_case instead of kebab-case for option keys. Only long option names are supported (i.e. `output`, not `o`). Supported value types are strings, integers and booleans. If an option takes no arguments, use a boolean (i.e. `true`). If an option may be repeated, you can use an array of values.
35
35
  * @param commands - bob commands, e.g. `"resolve"` or `"build"`
36
36
  * @example
37
+ * Print help in the console:
37
38
  * ```ts
38
- * // Print help in the console:
39
39
  * editor.bob({ help: true });
40
- *
41
- * // Bundle the game for the host platform:
40
+ * ```
41
+ * @example
42
+ * Bundle the game for the host platform:
43
+ * ```ts
42
44
  * const opts = { archive: true, platform: editor.platform };
43
45
  * editor.bob(opts, "distclean", "resolve", "build", "bundle");
44
- *
45
- * // Using snake_cased and repeated options:
46
- * const bundleOpts = {
46
+ * ```
47
+ * @example
48
+ * Using snake_cased and repeated options:
49
+ * ```ts
50
+ * const opts = {
47
51
  * archive: true,
48
52
  * platform: editor.platform,
49
53
  * build_server: "https://build.my-company.com",
50
54
  * settings: ["test.ini", "headless.ini"],
51
55
  * };
52
- * editor.bob(bundleOpts, "distclean", "resolve", "build");
56
+ * editor.bob(opts, "distclean", "resolve", "build");
53
57
  * ```
54
58
  */
55
59
  function bob(options?: Record<string | number, unknown>, ...commands: string[]): void;
@@ -111,15 +115,19 @@ declare global {
111
115
  *
112
116
  * @param resources - ] Array of resource paths (strings starting with `/`) or resource definitions, lua tables with the following keys:`1 string`required, resource path (starting with `/`)`2 string`optional, created resource content
113
117
  * @example
118
+ * Create a single resource from template:
114
119
  * ```ts
115
- * // Create a single resource from template:
116
120
  * editor.create_resources(["/npc.go"]);
117
- *
118
- * // Create multiple resources:
121
+ * ```
122
+ * @example
123
+ * Create multiple resources:
124
+ * ```ts
119
125
  * editor.create_resources(["/npc.go", "/levels/1.collection", "/levels/2.collection"]);
120
- *
121
- * // Create a resource with custom content:
122
- * editor.create_resources([["/npc.script", "go.property('hp', 100)"]]);
126
+ * ```
127
+ * @example
128
+ * Create a resource with custom content:
129
+ * ```ts
130
+ * editor.create_resources([{ 1: "/npc.script", 2: "go.property('hp', 100)" }]);
123
131
  * ```
124
132
  */
125
133
  function create_resources(resources: unknown): void;
@@ -144,20 +152,22 @@ declare global {
144
152
  * @param options - Optional options table. Supported entries:
145
153
  * - boolean `reload_resources`: make the editor reload the resources from disk after the command is executed, default `true`
146
154
  * - string `out`: standard output mode, either:
147
- * - `"pipe"`: the output is piped to the editor console (this is the default behavior).
148
- * - `"capture"`: capture and return the output to the editor script with trailing newlines trimmed.
149
- * - `"discard"`: the output is discarded completely.
155
+ * - `"pipe"`: the output is piped to the editor console (this is the default behavior).
156
+ * - `"capture"`: capture and return the output to the editor script with trailing newlines trimmed.
157
+ * - `"discard"`: the output is discarded completely.
150
158
  * - string `err`: standard error output mode, either:
151
- * - `"pipe"`: the error output is piped to the editor console (this is the default behavior).
152
- * - `"stdout"`: the error output is redirected to the standard output of the process.
153
- * - `"discard"`: the error output is discarded completely.
159
+ * - `"pipe"`: the error output is piped to the editor console (this is the default behavior).
160
+ * - `"stdout"`: the error output is redirected to the standard output of the process.
161
+ * - `"discard"`: the error output is discarded completely.
154
162
  * @returns If `out` option is set to `"capture"`, returns the output as string with trimmed trailing newlines. Otherwise, returns `nil`.
155
163
  * @example
164
+ * Make a directory with spaces in it:
156
165
  * ```ts
157
- * // Make a directory with spaces in it:
158
166
  * editor.execute("mkdir", "new dir");
159
- *
160
- * // Read the git status:
167
+ * ```
168
+ * @example
169
+ * Read the git status:
170
+ * ```ts
161
171
  * const status = editor.execute("git", "status", "--porcelain", {
162
172
  * reload_resources: false,
163
173
  * out: "capture",
@@ -840,7 +850,7 @@ declare global {
840
850
  *
841
851
  * const counterButton = editor.ui.component((props) => {
842
852
  * const [count, setCount] = editor.ui.use_state((props as { count: unknown }).count);
843
- * const onPressed = editor.ui.use_memo(makeListener, setCount);
853
+ * const onPressed = editor.ui.use_memo(makeListener, setCount) as () => void;
844
854
  * return editor.ui.button({
845
855
  * text: tostring(count),
846
856
  * on_pressed: onPressed,
@@ -35,8 +35,8 @@ declare global {
35
35
  * @param scale - the scale of the new game object (must be greater than 0), the scale of the game object containing the factory is used by default, or if the value is `nil`
36
36
  * @returns the global id of the spawned game object
37
37
  * @example
38
+ * How to create a new game object:
38
39
  * ```ts
39
- * // How to create a new game object:
40
40
  * export default defineScript({
41
41
  * init(self) {
42
42
  * // create a new game object and provide property values
@@ -45,16 +45,17 @@ declare global {
45
45
  * msg.post(created, "hello");
46
46
  * },
47
47
  * });
48
+ * ```
49
+ * @example
50
+ * And then let the new game object have a script attached:
51
+ * ```ts
52
+ * go.property("my_value", 0);
48
53
  *
49
- * // And then let the new game object have a script attached, in its own file:
50
- * //
51
- * // go.property("my_value", 0);
52
- * //
53
- * // export default defineScript({
54
- * // init(self) {
55
- * // // do something with self.my_value which is now one
56
- * // },
57
- * // });
54
+ * export default defineScript({
55
+ * init(self) {
56
+ * // do something with self.my_value which is now one
57
+ * },
58
+ * });
58
59
  * ```
59
60
  */
60
61
  function create(url: string | Hash | Url, position?: Vector3, rotation?: Quaternion, properties?: Record<string | number, unknown>, scale?: number | Vector3): Hash;
@@ -67,12 +68,10 @@ declare global {
67
68
  * @returns status of the factory component
68
69
  *
69
70
  * - `factory.STATUS_UNLOADED`
70
- *
71
71
  * - `factory.STATUS_LOADING`
72
- *
73
72
  * - `factory.STATUS_LOADED`
74
73
  */
75
- function get_status(url?: string | Hash | Url): factory.Status;
74
+ function get_status(url: string | Hash | Url): factory.Status;
76
75
  /**
77
76
  * Resources are referenced by the factory component until the existing (parent) collection is destroyed or factory.unload is called.
78
77
  * Calling this function when the factory is not marked as dynamic loading does nothing.
@@ -92,7 +91,7 @@ declare global {
92
91
  * factory.load("#factory", (self, url, result) => {});
93
92
  * ```
94
93
  */
95
- function load(url?: string | Hash | Url, complete_function?: (self: unknown, url: unknown, result: unknown) => void): void;
94
+ function load(url: string | Hash | Url, complete_function: (self: unknown, url: unknown, result: unknown) => void): void;
96
95
  /**
97
96
  * Changes the prototype for the factory.
98
97
  *
@@ -106,7 +105,7 @@ declare global {
106
105
  * const id = factory.create("#factory", go.get_world_position(), vmath.quat());
107
106
  * ```
108
107
  */
109
- function set_prototype(url?: string | Hash | Url, prototype?: string): void;
108
+ function set_prototype(url: string | Hash | Url, prototype: string | undefined): void;
110
109
  /**
111
110
  * This decreases the reference count for each resource loaded with factory.load. If reference is zero, the resource is destroyed.
112
111
  * Calling this function when the factory is not marked as dynamic loading does nothing.
@@ -118,7 +117,7 @@ declare global {
118
117
  * factory.unload("#factory");
119
118
  * ```
120
119
  */
121
- function unload(url?: string | Hash | Url): void;
120
+ function unload(url: string | Hash | Url): void;
122
121
  }
123
122
  }
124
123
 
@@ -215,15 +215,10 @@ declare global {
215
215
  * @param playback - playback mode of the animation
216
216
  *
217
217
  * - `go.PLAYBACK_ONCE_FORWARD`
218
- *
219
218
  * - `go.PLAYBACK_ONCE_BACKWARD`
220
- *
221
219
  * - `go.PLAYBACK_ONCE_PINGPONG`
222
- *
223
220
  * - `go.PLAYBACK_LOOP_FORWARD`
224
- *
225
221
  * - `go.PLAYBACK_LOOP_BACKWARD`
226
- *
227
222
  * - `go.PLAYBACK_LOOP_PINGPONG`
228
223
  * @param to - target property value
229
224
  * @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
@@ -285,7 +280,7 @@ declare global {
285
280
  * go.cancel_animations("#sprite");
286
281
  * ```
287
282
  */
288
- export function cancel_animations(url: SceneAddress | Hash | Url, property?: string | Hash): void;
283
+ export function cancel_animations(url?: SceneAddress | Hash | Url, property?: string | Hash): void;
289
284
  /**
290
285
  * Delete one or more game objects identified by id. Deletion is asynchronous meaning that
291
286
  * the game object(s) are scheduled for deletion which will happen at the end of the current
@@ -321,7 +316,7 @@ declare global {
321
316
  * go.delete(ids, true);
322
317
  * ```
323
318
  */
324
- function _delete(id?: SceneGameObjectAddress | Hash | Url | (SceneGameObjectAddress | Hash | Url)[], recursive?: boolean): void;
319
+ function _delete(id?: SceneGameObjectAddress | Hash | Url | (SceneGameObjectAddress | Hash | Url)[] | boolean, recursive?: boolean): void;
325
320
  /**
326
321
  * This function can check for game objects in any collection by specifying
327
322
  * the collection name in the URL.
@@ -349,6 +344,10 @@ declare global {
349
344
  * @example
350
345
  * ```ts
351
346
  * export default defineScript({
347
+ * init() {
348
+ * return { some_value: 0 };
349
+ * },
350
+ *
352
351
  * final(self) {
353
352
  * // report finalization
354
353
  * msg.post("my_friend_instance", "im_dead", { my_stats: self.some_value });
@@ -372,7 +371,6 @@ declare global {
372
371
  * of the absolute path to the instance.
373
372
  *
374
373
  * - If `path` is specified, it can either be absolute or relative to the instance of the calling script.
375
- *
376
374
  * - If `path` is not specified, the id of the game object instance the script is attached to will be returned.
377
375
  *
378
376
  * @param path - path of the instance for which to return the id
@@ -761,7 +759,7 @@ declare global {
761
759
  *
762
760
  * @param self - reference to the script state to be used for storing data
763
761
  * @param action_id - id of the received input action, as mapped in the input_binding-file
764
- * @param action - a table containing the input data, see above for a description
762
+ * @param action - a table containing the input data, see above for a description. **0️⃣ `gamepad` is 0-based; passed to Defold unchanged.**
765
763
  * @returns optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
766
764
  * @example
767
765
  * ```ts
@@ -791,7 +789,7 @@ declare global {
791
789
  * self.velocity = vmath.vector3();
792
790
  * } else {
793
791
  * // update velocity
794
- * self.velocity = vmath.vector3(action.value * self.max_speed, 0, 0);
792
+ * self.velocity = vmath.vector3((action.value ?? 0) * self.max_speed, 0, 0);
795
793
  * }
796
794
  * }
797
795
  * },
@@ -833,12 +831,12 @@ declare global {
833
831
  * init() {
834
832
  * // store the url of instance "a" for later use, by specifying undefined as socket we
835
833
  * // automatically use our own socket
836
- * return { a_url: msg.url(undefined, go.get_id("a"), "script") };
834
+ * return { a_url: msg.url(undefined, go.get_id("a"), "script"), important_value: 0 };
837
835
  * },
838
836
  *
839
837
  * on_message(self, message_id, message, sender) {
840
838
  * // check message and sender
841
- * if (message_id === hash("my_data") && sender === self.a_url) {
839
+ * if (message_id === hash("my_data") && sender === self.a_url && typeof message.important_value === "number") {
842
840
  * // use the data in some way
843
841
  * self.important_value = message.important_value;
844
842
  * }
@@ -880,7 +878,7 @@ declare global {
880
878
  * self.velocity = vmath.vector3();
881
879
  * } else {
882
880
  * // update velocity
883
- * self.velocity = vmath.vector3(action.value * self.max_speed, 0, 0);
881
+ * self.velocity = vmath.vector3((action.value ?? 0) * self.max_speed, 0, 0);
884
882
  * }
885
883
  * }
886
884
  * },
@@ -1064,7 +1062,7 @@ declare global {
1064
1062
  * const new_position = go.world_to_local_position(test_pos, "/child");
1065
1063
  * ```
1066
1064
  */
1067
- export function world_to_local_position(position: Vector3, url: SceneGameObjectAddress | Hash | Url): Vector3;
1065
+ export function world_to_local_position(position: Vector3, url?: SceneGameObjectAddress | Hash | Url): Vector3;
1068
1066
  /**
1069
1067
  * The function uses world transformation calculated at the end of previous frame.
1070
1068
  *
@@ -1079,7 +1077,7 @@ declare global {
1079
1077
  * const result_transform = go.world_to_local_transform(test_transform, "/child");
1080
1078
  * ```
1081
1079
  */
1082
- export function world_to_local_transform(transformation: Matrix4, url: SceneGameObjectAddress | Hash | Url): Matrix4;
1080
+ export function world_to_local_transform(transformation: Matrix4, url?: SceneGameObjectAddress | Hash | Url): Matrix4;
1083
1081
  export { _delete as delete };
1084
1082
  export interface properties {
1085
1083
  /**
@@ -1099,9 +1097,9 @@ declare global {
1099
1097
  */
1100
1098
  rotation: Quaternion;
1101
1099
  /**
1102
- * The uniform scale of the game object. The type of the property is number.
1100
+ * 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.
1103
1101
  */
1104
- scale: number;
1102
+ scale: number | Vector3;
1105
1103
  }
1106
1104
  }
1107
1105
  }
@@ -92,9 +92,97 @@ declare global {
92
92
  * Context feature flag indicating support for vertical sync (vsync).
93
93
  */
94
94
  const CONTEXT_FEATURE_VSYNC: number & { readonly __brand: "graphics.CONTEXT_FEATURE_VSYNC" };
95
+ /**
96
+ * Vertex attribute coordinate space, for `material.set_vertex_attributes`.
97
+ */
98
+ const COORDINATE_SPACE_DEFAULT: number & { readonly __brand: "graphics.COORDINATE_SPACE_DEFAULT" };
99
+ /**
100
+ * Vertex attribute coordinate space, for `material.set_vertex_attributes`.
101
+ */
102
+ const COORDINATE_SPACE_LOCAL: number & { readonly __brand: "graphics.COORDINATE_SPACE_LOCAL" };
103
+ /**
104
+ * Vertex attribute coordinate space, for `material.set_vertex_attributes`.
105
+ */
106
+ const COORDINATE_SPACE_WORLD: number & { readonly __brand: "graphics.COORDINATE_SPACE_WORLD" };
107
+ /**
108
+ * Vertex attribute data type, for `material.set_vertex_attributes`.
109
+ */
110
+ const DATA_TYPE_BYTE: number & { readonly __brand: "graphics.DATA_TYPE_BYTE" };
111
+ /**
112
+ * Vertex attribute data type, for `material.set_vertex_attributes`.
113
+ */
114
+ const DATA_TYPE_FLOAT: number & { readonly __brand: "graphics.DATA_TYPE_FLOAT" };
115
+ /**
116
+ * Vertex attribute data type, for `material.set_vertex_attributes`.
117
+ */
118
+ const DATA_TYPE_INT: number & { readonly __brand: "graphics.DATA_TYPE_INT" };
119
+ /**
120
+ * Vertex attribute data type, for `material.set_vertex_attributes`.
121
+ */
122
+ const DATA_TYPE_SHORT: number & { readonly __brand: "graphics.DATA_TYPE_SHORT" };
123
+ /**
124
+ * Vertex attribute data type, for `material.set_vertex_attributes`.
125
+ */
126
+ const DATA_TYPE_UNSIGNED_BYTE: number & { readonly __brand: "graphics.DATA_TYPE_UNSIGNED_BYTE" };
127
+ /**
128
+ * Vertex attribute data type, for `material.set_vertex_attributes`.
129
+ */
130
+ const DATA_TYPE_UNSIGNED_INT: number & { readonly __brand: "graphics.DATA_TYPE_UNSIGNED_INT" };
131
+ /**
132
+ * Vertex attribute data type, for `material.set_vertex_attributes`.
133
+ */
134
+ const DATA_TYPE_UNSIGNED_SHORT: number & { readonly __brand: "graphics.DATA_TYPE_UNSIGNED_SHORT" };
95
135
  const FACE_TYPE_BACK: number & { readonly __brand: "graphics.FACE_TYPE_BACK" };
96
136
  const FACE_TYPE_FRONT: number & { readonly __brand: "graphics.FACE_TYPE_FRONT" };
97
137
  const FACE_TYPE_FRONT_AND_BACK: number & { readonly __brand: "graphics.FACE_TYPE_FRONT_AND_BACK" };
138
+ /**
139
+ * Vertex attribute semantic type, for `material.set_vertex_attributes`.
140
+ */
141
+ const SEMANTIC_TYPE_BONE_INDICES: number & { readonly __brand: "graphics.SEMANTIC_TYPE_BONE_INDICES" };
142
+ /**
143
+ * Vertex attribute semantic type, for `material.set_vertex_attributes`.
144
+ */
145
+ const SEMANTIC_TYPE_BONE_WEIGHTS: number & { readonly __brand: "graphics.SEMANTIC_TYPE_BONE_WEIGHTS" };
146
+ /**
147
+ * Vertex attribute semantic type, for `material.set_vertex_attributes`.
148
+ */
149
+ const SEMANTIC_TYPE_COLOR: number & { readonly __brand: "graphics.SEMANTIC_TYPE_COLOR" };
150
+ /**
151
+ * Vertex attribute semantic type, for `material.set_vertex_attributes`.
152
+ */
153
+ const SEMANTIC_TYPE_NONE: number & { readonly __brand: "graphics.SEMANTIC_TYPE_NONE" };
154
+ /**
155
+ * Vertex attribute semantic type, for `material.set_vertex_attributes`.
156
+ */
157
+ const SEMANTIC_TYPE_NORMAL: number & { readonly __brand: "graphics.SEMANTIC_TYPE_NORMAL" };
158
+ /**
159
+ * Vertex attribute semantic type, for `material.set_vertex_attributes`.
160
+ */
161
+ const SEMANTIC_TYPE_NORMAL_MATRIX: number & { readonly __brand: "graphics.SEMANTIC_TYPE_NORMAL_MATRIX" };
162
+ /**
163
+ * Vertex attribute semantic type, for `material.set_vertex_attributes`.
164
+ */
165
+ const SEMANTIC_TYPE_PAGE_INDEX: number & { readonly __brand: "graphics.SEMANTIC_TYPE_PAGE_INDEX" };
166
+ /**
167
+ * Vertex attribute semantic type, for `material.set_vertex_attributes`.
168
+ */
169
+ const SEMANTIC_TYPE_POSITION: number & { readonly __brand: "graphics.SEMANTIC_TYPE_POSITION" };
170
+ /**
171
+ * Vertex attribute semantic type, for `material.set_vertex_attributes`.
172
+ */
173
+ const SEMANTIC_TYPE_TANGENT: number & { readonly __brand: "graphics.SEMANTIC_TYPE_TANGENT" };
174
+ /**
175
+ * Vertex attribute semantic type, for `material.set_vertex_attributes`.
176
+ */
177
+ const SEMANTIC_TYPE_TEXCOORD: number & { readonly __brand: "graphics.SEMANTIC_TYPE_TEXCOORD" };
178
+ /**
179
+ * Vertex attribute semantic type, for `material.set_vertex_attributes`.
180
+ */
181
+ const SEMANTIC_TYPE_TEXTURE_TRANSFORM_2D: number & { readonly __brand: "graphics.SEMANTIC_TYPE_TEXTURE_TRANSFORM_2D" };
182
+ /**
183
+ * Vertex attribute semantic type, for `material.set_vertex_attributes`.
184
+ */
185
+ const SEMANTIC_TYPE_WORLD_MATRIX: number & { readonly __brand: "graphics.SEMANTIC_TYPE_WORLD_MATRIX" };
98
186
  const STATE_ALPHA_TEST: number & { readonly __brand: "graphics.STATE_ALPHA_TEST" };
99
187
  const STATE_ALPHA_TEST_SUPPORTED: number & { readonly __brand: "graphics.STATE_ALPHA_TEST_SUPPORTED" };
100
188
  const STATE_BLEND: number & { readonly __brand: "graphics.STATE_BLEND" };
@@ -271,44 +359,40 @@ declare global {
271
359
  * optional context features supported by the backend.
272
360
  *
273
361
  * @returns table with the following fields:
274
- * `family` string adapter family name (e.g. "opengl", "vulkan")
275
- * `version_major` number adapter API major version (e.g. 1 for Vulkan 1.4)
276
- * `version_minor` number adapter API minor version (e.g. 4 for Vulkan 1.4)
277
- * `limits` table hardware/driver limits:
278
- *
279
- * ``max_texture_size_2d` [type:number] max 2D texture dimension in texels
280
- * `max_texture_size_3d` [type:number] max 3D (volume) texture dimension in texels
281
- * `max_texture_size_cube` [type:number] max cube map face dimension in texels
282
- * `max_texture_array_layers` [type:number] max layers in an array texture
283
- * `max_framebuffer_width` [type:number] max framebuffer width in pixels
284
- * `max_framebuffer_height` [type:number] max framebuffer height in pixels
285
- * `max_color_attachments` [type:number] max simultaneous color attachments
286
- * `max_samplers_per_stage` [type:number] max texture samplers per shader stage
287
- * `max_textures_per_stage` [type:number] max sampled textures per shader stage
288
- * `max_vertex_attributes` [type:number] max vertex attributes
289
- * `max_vertex_buffers` [type:number] max vertex buffer bindings
290
- * `max_compute_workgroup_size_x` [type:number] max compute workgroup size (X)
291
- * `max_compute_workgroup_size_y` [type:number] max compute workgroup size (Y)
292
- * `max_compute_workgroup_size_z` [type:number] max compute workgroup size (Z)
293
- * `max_compute_workgroup_invocations` [type:number] max invocations per compute workgroup
294
- * `max_compute_shared_memory_size` [type:number] max shared memory per compute workgroup (bytes)
295
- * `max_uniform_buffer_range` [type:number] max bindable uniform buffer range (bytes)
296
- * `max_storage_buffer_range` [type:number] max bindable storage buffer range (bytes)
297
- * `
298
- *
299
- * `extensions` table array of driver-reported extension name strings
300
- * `features` table array of supported context feature ids:
301
362
  *
302
- * ``graphics.CONTEXT_FEATURE_MULTI_TARGET_RENDERING` multi-target rendering
303
- * `graphics.CONTEXT_FEATURE_TEXTURE_ARRAY` texture arrays
304
- * `graphics.CONTEXT_FEATURE_COMPUTE_SHADER` compute shaders
305
- * `graphics.CONTEXT_FEATURE_STORAGE_BUFFER` storage buffers
306
- * `graphics.CONTEXT_FEATURE_VSYNC` vertical sync
307
- * `graphics.CONTEXT_FEATURE_INSTANCING` hardware instancing
308
- * `graphics.CONTEXT_FEATURE_3D_TEXTURES` 3D (volume) textures
309
- * `graphics.CONTEXT_FEATURE_ASTC_ARRAY_TEXTURES` ASTC compressed 2D array textures
310
- * `graphics.CONTEXT_FEATURE_BLEND_EQUATION_MIN_MAX` min/max blend equations
311
- * `
363
+ * - `family` string adapter family name (e.g. "opengl", "vulkan")
364
+ * - `version_major` number adapter API major version (e.g. 1 for Vulkan 1.4)
365
+ * - `version_minor` number adapter API minor version (e.g. 4 for Vulkan 1.4)
366
+ * - `limits` table hardware/driver limits:
367
+ * - `max_texture_size_2d` number max 2D texture dimension in texels
368
+ * - `max_texture_size_3d` number max 3D (volume) texture dimension in texels
369
+ * - `max_texture_size_cube` number max cube map face dimension in texels
370
+ * - `max_texture_array_layers` number max layers in an array texture
371
+ * - `max_framebuffer_width` number max framebuffer width in pixels
372
+ * - `max_framebuffer_height` number max framebuffer height in pixels
373
+ * - `max_color_attachments` number max simultaneous color attachments
374
+ * - `max_samplers_per_stage` number max texture samplers per shader stage
375
+ * - `max_textures_per_stage` number max sampled textures per shader stage
376
+ * - `max_vertex_attributes` number max vertex attributes
377
+ * - `max_vertex_buffers` number max vertex buffer bindings
378
+ * - `max_compute_workgroup_size_x` number max compute workgroup size (X)
379
+ * - `max_compute_workgroup_size_y` number max compute workgroup size (Y)
380
+ * - `max_compute_workgroup_size_z` number max compute workgroup size (Z)
381
+ * - `max_compute_workgroup_invocations` number max invocations per compute workgroup
382
+ * - `max_compute_shared_memory_size` number max shared memory per compute workgroup (bytes)
383
+ * - `max_uniform_buffer_range` number max bindable uniform buffer range (bytes)
384
+ * - `max_storage_buffer_range` number max bindable storage buffer range (bytes)
385
+ * - `extensions` table array of driver-reported extension name strings
386
+ * - `features` table array of supported context feature ids:
387
+ * - `graphics.CONTEXT_FEATURE_MULTI_TARGET_RENDERING` multi-target rendering
388
+ * - `graphics.CONTEXT_FEATURE_TEXTURE_ARRAY` texture arrays
389
+ * - `graphics.CONTEXT_FEATURE_COMPUTE_SHADER` compute shaders
390
+ * - `graphics.CONTEXT_FEATURE_STORAGE_BUFFER` storage buffers
391
+ * - `graphics.CONTEXT_FEATURE_VSYNC` vertical sync
392
+ * - `graphics.CONTEXT_FEATURE_INSTANCING` hardware instancing
393
+ * - `graphics.CONTEXT_FEATURE_3D_TEXTURES` 3D (volume) textures
394
+ * - `graphics.CONTEXT_FEATURE_ASTC_ARRAY_TEXTURES` ASTC compressed 2D array textures
395
+ * - `graphics.CONTEXT_FEATURE_BLEND_EQUATION_MIN_MAX` min/max blend equations
312
396
  */
313
397
  function get_adapter_info(): { family: string; version_major: number; version_minor: number; limits: { max_texture_size_2d: number; max_texture_size_3d: number; max_texture_size_cube: number; max_texture_array_layers: number; max_framebuffer_width: number; max_framebuffer_height: number; max_color_attachments: number; max_samplers_per_stage: number; max_textures_per_stage: number; max_vertex_attributes: number; max_vertex_buffers: number; max_compute_workgroup_size_x: number; max_compute_workgroup_size_y: number; max_compute_workgroup_size_z: number; max_compute_workgroup_invocations: number; max_compute_shared_memory_size: number; max_uniform_buffer_range: number; max_storage_buffer_range: number }; extensions: string[]; features: number[] };
314
398
  /**