@defold-typescript/types 0.49.0 → 0.50.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 (76) hide show
  1. package/api-availability.json +696 -624
  2. package/api-signatures.json +6799 -160
  3. package/api-targets.json +393 -2
  4. package/examples/translations.json +12 -0
  5. package/generated/b2d.d.ts +15 -0
  6. package/generated/bullet3d.d.ts +16 -0
  7. package/generated/font.d.ts +7 -3
  8. package/generated/graphics.d.ts +7 -0
  9. package/generated/gui.d.ts +5 -4
  10. package/generated/label.d.ts +3 -3
  11. package/generated/render.d.ts +16 -1
  12. package/generated/versions/defold-1.13.2/b2d.d.ts +709 -0
  13. package/generated/versions/defold-1.13.2/b2d_body.d.ts +593 -0
  14. package/generated/versions/defold-1.13.2/b2d_chain.d.ts +105 -0
  15. package/generated/versions/defold-1.13.2/b2d_fixture.d.ts +175 -0
  16. package/generated/versions/defold-1.13.2/b2d_joint.d.ts +1301 -0
  17. package/generated/versions/defold-1.13.2/b2d_shape.d.ts +423 -0
  18. package/generated/versions/defold-1.13.2/b2d_world.d.ts +308 -0
  19. package/generated/versions/defold-1.13.2/buffer.d.ts +192 -0
  20. package/generated/versions/defold-1.13.2/bullet3d.d.ts +91 -0
  21. package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +433 -0
  22. package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +818 -0
  23. package/generated/versions/defold-1.13.2/bullet3d_rigid_body.d.ts +429 -0
  24. package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +123 -0
  25. package/generated/versions/defold-1.13.2/bullet3d_world.d.ts +492 -0
  26. package/generated/versions/defold-1.13.2/camera.d.ts +300 -0
  27. package/generated/versions/defold-1.13.2/collectionfactory.d.ts +148 -0
  28. package/generated/versions/defold-1.13.2/collectionproxy.d.ts +109 -0
  29. package/generated/versions/defold-1.13.2/compute.d.ts +107 -0
  30. package/generated/versions/defold-1.13.2/crash.d.ts +157 -0
  31. package/generated/versions/defold-1.13.2/editor-vm/http.d.ts +139 -0
  32. package/generated/versions/defold-1.13.2/editor-vm/image.d.ts +48 -0
  33. package/generated/versions/defold-1.13.2/editor-vm/json.d.ts +21 -0
  34. package/generated/versions/defold-1.13.2/editor-vm/localization.d.ts +42 -0
  35. package/generated/versions/defold-1.13.2/editor-vm/tilemap_tiles.d.ts +126 -0
  36. package/generated/versions/defold-1.13.2/editor-vm/zip.d.ts +38 -0
  37. package/generated/versions/defold-1.13.2/editor-vm/zlib.d.ts +24 -0
  38. package/generated/versions/defold-1.13.2/editor.d.ts +2177 -0
  39. package/generated/versions/defold-1.13.2/factory.d.ts +121 -0
  40. package/generated/versions/defold-1.13.2/font.d.ts +123 -0
  41. package/generated/versions/defold-1.13.2/go.d.ts +1166 -0
  42. package/generated/versions/defold-1.13.2/graphics.d.ts +613 -0
  43. package/generated/versions/defold-1.13.2/gui.d.ts +2212 -0
  44. package/generated/versions/defold-1.13.2/html5.d.ts +55 -0
  45. package/generated/versions/defold-1.13.2/http.d.ts +83 -0
  46. package/generated/versions/defold-1.13.2/image.d.ts +181 -0
  47. package/generated/versions/defold-1.13.2/index.d.ts +63 -0
  48. package/generated/versions/defold-1.13.2/json.d.ts +94 -0
  49. package/generated/versions/defold-1.13.2/kinds/editor-script.d.ts +14 -0
  50. package/generated/versions/defold-1.13.2/label.d.ts +164 -0
  51. package/generated/versions/defold-1.13.2/liveupdate.d.ts +143 -0
  52. package/generated/versions/defold-1.13.2/material.d.ts +490 -0
  53. package/generated/versions/defold-1.13.2/model.d.ts +287 -0
  54. package/generated/versions/defold-1.13.2/msg.d.ts +10 -0
  55. package/generated/versions/defold-1.13.2/particlefx.d.ts +155 -0
  56. package/generated/versions/defold-1.13.2/physics.d.ts +789 -0
  57. package/generated/versions/defold-1.13.2/profiler.d.ts +228 -0
  58. package/generated/versions/defold-1.13.2/render.d.ts +1153 -0
  59. package/generated/versions/defold-1.13.2/resource.d.ts +1628 -0
  60. package/generated/versions/defold-1.13.2/socket.d.ts +797 -0
  61. package/generated/versions/defold-1.13.2/sound.d.ts +323 -0
  62. package/generated/versions/defold-1.13.2/sprite.d.ts +179 -0
  63. package/generated/versions/defold-1.13.2/sys.d.ts +754 -0
  64. package/generated/versions/defold-1.13.2/tilemap.d.ts +206 -0
  65. package/generated/versions/defold-1.13.2/timer.d.ts +136 -0
  66. package/generated/versions/defold-1.13.2/types.d.ts +61 -0
  67. package/generated/versions/defold-1.13.2/vmath.d.ts +775 -0
  68. package/generated/versions/defold-1.13.2/window.d.ts +196 -0
  69. package/generated/versions/defold-1.13.2/zlib.d.ts +41 -0
  70. package/identity-vocabulary.json +1 -0
  71. package/package.json +2 -2
  72. package/scripts/import-defold-release.ts +3 -31
  73. package/scripts/materialize-version.ts +13 -7
  74. package/scripts/regen.ts +63 -29
  75. package/scripts/sync-api-docs.ts +31 -2
  76. package/src/emit-dts.ts +25 -3
@@ -0,0 +1,1166 @@
1
+ /** @noSelfInFile */
2
+ import type { Hash, Matrix4, Quaternion, Url, Vector, Vector3, Vector4 } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Game object API documentation
7
+ */
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
+ }
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;
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;
30
+ /**
31
+ * in-back
32
+ */
33
+ export const EASING_INBACK: number & { readonly __brand: "go.EASING_INBACK" };
34
+ /**
35
+ * in-bounce
36
+ */
37
+ export const EASING_INBOUNCE: number & { readonly __brand: "go.EASING_INBOUNCE" };
38
+ /**
39
+ * in-circlic
40
+ */
41
+ export const EASING_INCIRC: number & { readonly __brand: "go.EASING_INCIRC" };
42
+ /**
43
+ * in-cubic
44
+ */
45
+ export const EASING_INCUBIC: number & { readonly __brand: "go.EASING_INCUBIC" };
46
+ /**
47
+ * in-elastic
48
+ */
49
+ export const EASING_INELASTIC: number & { readonly __brand: "go.EASING_INELASTIC" };
50
+ /**
51
+ * in-exponential
52
+ */
53
+ export const EASING_INEXPO: number & { readonly __brand: "go.EASING_INEXPO" };
54
+ /**
55
+ * in-out-back
56
+ */
57
+ export const EASING_INOUTBACK: number & { readonly __brand: "go.EASING_INOUTBACK" };
58
+ /**
59
+ * in-out-bounce
60
+ */
61
+ export const EASING_INOUTBOUNCE: number & { readonly __brand: "go.EASING_INOUTBOUNCE" };
62
+ /**
63
+ * in-out-circlic
64
+ */
65
+ export const EASING_INOUTCIRC: number & { readonly __brand: "go.EASING_INOUTCIRC" };
66
+ /**
67
+ * in-out-cubic
68
+ */
69
+ export const EASING_INOUTCUBIC: number & { readonly __brand: "go.EASING_INOUTCUBIC" };
70
+ /**
71
+ * in-out-elastic
72
+ */
73
+ export const EASING_INOUTELASTIC: number & { readonly __brand: "go.EASING_INOUTELASTIC" };
74
+ /**
75
+ * in-out-exponential
76
+ */
77
+ export const EASING_INOUTEXPO: number & { readonly __brand: "go.EASING_INOUTEXPO" };
78
+ /**
79
+ * in-out-quadratic
80
+ */
81
+ export const EASING_INOUTQUAD: number & { readonly __brand: "go.EASING_INOUTQUAD" };
82
+ /**
83
+ * in-out-quartic
84
+ */
85
+ export const EASING_INOUTQUART: number & { readonly __brand: "go.EASING_INOUTQUART" };
86
+ /**
87
+ * in-out-quintic
88
+ */
89
+ export const EASING_INOUTQUINT: number & { readonly __brand: "go.EASING_INOUTQUINT" };
90
+ /**
91
+ * in-out-sine
92
+ */
93
+ export const EASING_INOUTSINE: number & { readonly __brand: "go.EASING_INOUTSINE" };
94
+ /**
95
+ * in-quadratic
96
+ */
97
+ export const EASING_INQUAD: number & { readonly __brand: "go.EASING_INQUAD" };
98
+ /**
99
+ * in-quartic
100
+ */
101
+ export const EASING_INQUART: number & { readonly __brand: "go.EASING_INQUART" };
102
+ /**
103
+ * in-quintic
104
+ */
105
+ export const EASING_INQUINT: number & { readonly __brand: "go.EASING_INQUINT" };
106
+ /**
107
+ * in-sine
108
+ */
109
+ export const EASING_INSINE: number & { readonly __brand: "go.EASING_INSINE" };
110
+ /**
111
+ * linear interpolation
112
+ */
113
+ export const EASING_LINEAR: number & { readonly __brand: "go.EASING_LINEAR" };
114
+ /**
115
+ * out-back
116
+ */
117
+ export const EASING_OUTBACK: number & { readonly __brand: "go.EASING_OUTBACK" };
118
+ /**
119
+ * out-bounce
120
+ */
121
+ export const EASING_OUTBOUNCE: number & { readonly __brand: "go.EASING_OUTBOUNCE" };
122
+ /**
123
+ * out-circlic
124
+ */
125
+ export const EASING_OUTCIRC: number & { readonly __brand: "go.EASING_OUTCIRC" };
126
+ /**
127
+ * out-cubic
128
+ */
129
+ export const EASING_OUTCUBIC: number & { readonly __brand: "go.EASING_OUTCUBIC" };
130
+ /**
131
+ * out-elastic
132
+ */
133
+ export const EASING_OUTELASTIC: number & { readonly __brand: "go.EASING_OUTELASTIC" };
134
+ /**
135
+ * out-exponential
136
+ */
137
+ export const EASING_OUTEXPO: number & { readonly __brand: "go.EASING_OUTEXPO" };
138
+ /**
139
+ * out-in-back
140
+ */
141
+ export const EASING_OUTINBACK: number & { readonly __brand: "go.EASING_OUTINBACK" };
142
+ /**
143
+ * out-in-bounce
144
+ */
145
+ export const EASING_OUTINBOUNCE: number & { readonly __brand: "go.EASING_OUTINBOUNCE" };
146
+ /**
147
+ * out-in-circlic
148
+ */
149
+ export const EASING_OUTINCIRC: number & { readonly __brand: "go.EASING_OUTINCIRC" };
150
+ /**
151
+ * out-in-cubic
152
+ */
153
+ export const EASING_OUTINCUBIC: number & { readonly __brand: "go.EASING_OUTINCUBIC" };
154
+ /**
155
+ * out-in-elastic
156
+ */
157
+ export const EASING_OUTINELASTIC: number & { readonly __brand: "go.EASING_OUTINELASTIC" };
158
+ /**
159
+ * out-in-exponential
160
+ */
161
+ export const EASING_OUTINEXPO: number & { readonly __brand: "go.EASING_OUTINEXPO" };
162
+ /**
163
+ * out-in-quadratic
164
+ */
165
+ export const EASING_OUTINQUAD: number & { readonly __brand: "go.EASING_OUTINQUAD" };
166
+ /**
167
+ * out-in-quartic
168
+ */
169
+ export const EASING_OUTINQUART: number & { readonly __brand: "go.EASING_OUTINQUART" };
170
+ /**
171
+ * out-in-quintic
172
+ */
173
+ export const EASING_OUTINQUINT: number & { readonly __brand: "go.EASING_OUTINQUINT" };
174
+ /**
175
+ * out-in-sine
176
+ */
177
+ export const EASING_OUTINSINE: number & { readonly __brand: "go.EASING_OUTINSINE" };
178
+ /**
179
+ * out-quadratic
180
+ */
181
+ export const EASING_OUTQUAD: number & { readonly __brand: "go.EASING_OUTQUAD" };
182
+ /**
183
+ * out-quartic
184
+ */
185
+ export const EASING_OUTQUART: number & { readonly __brand: "go.EASING_OUTQUART" };
186
+ /**
187
+ * out-quintic
188
+ */
189
+ export const EASING_OUTQUINT: number & { readonly __brand: "go.EASING_OUTQUINT" };
190
+ /**
191
+ * out-sine
192
+ */
193
+ export const EASING_OUTSINE: number & { readonly __brand: "go.EASING_OUTSINE" };
194
+ /**
195
+ * loop backward
196
+ */
197
+ export const PLAYBACK_LOOP_BACKWARD: number & { readonly __brand: "go.PLAYBACK_LOOP_BACKWARD" };
198
+ /**
199
+ * loop forward
200
+ */
201
+ export const PLAYBACK_LOOP_FORWARD: number & { readonly __brand: "go.PLAYBACK_LOOP_FORWARD" };
202
+ /**
203
+ * ping pong loop
204
+ */
205
+ export const PLAYBACK_LOOP_PINGPONG: number & { readonly __brand: "go.PLAYBACK_LOOP_PINGPONG" };
206
+ /**
207
+ * no playback
208
+ */
209
+ export const PLAYBACK_NONE: number & { readonly __brand: "go.PLAYBACK_NONE" };
210
+ /**
211
+ * once backward
212
+ */
213
+ export const PLAYBACK_ONCE_BACKWARD: number & { readonly __brand: "go.PLAYBACK_ONCE_BACKWARD" };
214
+ /**
215
+ * once forward
216
+ */
217
+ export const PLAYBACK_ONCE_FORWARD: number & { readonly __brand: "go.PLAYBACK_ONCE_FORWARD" };
218
+ /**
219
+ * once ping pong
220
+ */
221
+ export const PLAYBACK_ONCE_PINGPONG: number & { readonly __brand: "go.PLAYBACK_ONCE_PINGPONG" };
222
+ /**
223
+ * This is only supported for numerical properties. If the node property is already being
224
+ * animated, that animation will be canceled and replaced by the new one.
225
+ * If a `complete_function` (lua function) is specified, that function will be called when the animation has completed.
226
+ * By starting a new animation in that function, several animations can be sequenced together. See the examples for more information.
227
+ * If you call `go.animate()` from a game object's `final()` function,
228
+ * any passed `complete_function` will be ignored and never called upon animation completion.
229
+ * See the properties guide for which properties can be animated and the animation guide for how
230
+ * them.
231
+ *
232
+ * @param url - url of the game object or component having the property
233
+ * @param property - id of the property to animate
234
+ * @param playback - playback mode of the animation
235
+ *
236
+ * - `go.PLAYBACK_ONCE_FORWARD`
237
+ * - `go.PLAYBACK_ONCE_BACKWARD`
238
+ * - `go.PLAYBACK_ONCE_PINGPONG`
239
+ * - `go.PLAYBACK_LOOP_FORWARD`
240
+ * - `go.PLAYBACK_LOOP_BACKWARD`
241
+ * - `go.PLAYBACK_LOOP_PINGPONG`
242
+ * @param to - target property value
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
244
+ * @param duration - duration of the animation in seconds
245
+ * @param delay - delay before the animation starts in seconds
246
+ * @param complete_function - optional function to call when the animation has completed
247
+ *
248
+ * `self`
249
+ *
250
+ * script_instance The current script instance.
251
+ *
252
+ * `url`
253
+ *
254
+ * url The game object or component instance for which the property is animated.
255
+ *
256
+ * `property`
257
+ *
258
+ * hash The id of the animated property.
259
+ * @example
260
+ * Animate the position of a game object to x = 10 during 1 second, then y = 20 during 1 second:
261
+ * ```ts
262
+ * go.animate(go.get_id(), "position.x", go.PLAYBACK_ONCE_FORWARD, 10, go.EASING_LINEAR, 1, 0, () => {
263
+ * go.animate(go.get_id(), "position.y", go.PLAYBACK_ONCE_FORWARD, 20, go.EASING_LINEAR, 1);
264
+ * });
265
+ * ```
266
+ * @example
267
+ * Animate the y position of a game object using a crazy custom easing curve:
268
+ * ```ts
269
+ * const values = [
270
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
271
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
272
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
273
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
274
+ * ];
275
+ * const vec = vmath.vector(values);
276
+ * go.animate("go", "position.y", go.PLAYBACK_LOOP_PINGPONG, 100, vec, 2.0);
277
+ * ```
278
+ */
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;
280
+ /**
281
+ * By calling this function, all or specified stored property animations of the game object or component will be canceled.
282
+ * See the properties guide for which properties can be animated and the animation guide for how to animate them.
283
+ *
284
+ * @param url - url of the game object or component
285
+ * @param property - optional id of the property to cancel
286
+ * @example
287
+ * Cancel the animation of the position of a game object:
288
+ * ```ts
289
+ * go.cancel_animations(go.get_id(), "position");
290
+ * ```
291
+ * @example
292
+ * Cancel all property animations of the current game object:
293
+ * ```ts
294
+ * go.cancel_animations(".");
295
+ * ```
296
+ * @example
297
+ * Cancel all property animations of the sprite component of the current game object:
298
+ * ```ts
299
+ * go.cancel_animations("#sprite");
300
+ * ```
301
+ */
302
+ export function cancel_animations(url?: SceneAddress | Hash | Url, property?: string | Hash): void;
303
+ /**
304
+ * Delete one or more game objects identified by id. Deletion is asynchronous meaning that
305
+ * the game object(s) are scheduled for deletion which will happen at the end of the current
306
+ * frame. Note that game objects scheduled for deletion will be counted against
307
+ * `max_instances` in "game.project" until they are actually removed.
308
+ * 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()`.
309
+ * 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()`.
310
+ *
311
+ * @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
312
+ * @param recursive - optional boolean, set to true to recursively delete child hiearchy in child to parent order
313
+ * @example
314
+ * This example demonstrates how to delete game objects
315
+ * ```ts
316
+ * // Delete the script's own game object.
317
+ * go.delete();
318
+ * // Delete a game object with the id "my_game_object".
319
+ * const id = go.get_id("my_game_object"); // retrieve the id of the game object to be deleted
320
+ * go.delete(id);
321
+ * // Delete a list of game objects.
322
+ * const ids = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
323
+ * go.delete(ids);
324
+ * ```
325
+ * @example
326
+ * This example demonstrates how to delete a game objects and their children (child to parent order)
327
+ * ```ts
328
+ * // Delete the script's own game object and its children.
329
+ * go.delete(true);
330
+ * // Delete a game object with the id "my_game_object" and its children.
331
+ * const id = go.get_id("my_game_object"); // retrieve the id of the game object to be deleted
332
+ * go.delete(id, true);
333
+ * // Delete a list of game objects and their children.
334
+ * const ids = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
335
+ * go.delete(ids, true);
336
+ * ```
337
+ */
338
+ function _delete(id?: SceneGameObjectAddress | Hash | Url | (string | Hash | Url)[] | boolean, recursive?: boolean): void;
339
+ /**
340
+ * This function can check for game objects in any collection by specifying
341
+ * the collection name in the URL.
342
+ *
343
+ * @param url - url of the game object to check
344
+ * @returns true if the game object exists
345
+ * @example
346
+ * Check if game object "my_game_object" exists in the current collection
347
+ * ```ts
348
+ * go.exists("/my_game_object");
349
+ * ```
350
+ * @example
351
+ * Check if game object exists in another collection
352
+ * ```ts
353
+ * go.exists("other_collection:/my_game_object");
354
+ * ```
355
+ */
356
+ export function exists(url: SceneGameObjectAddress | Hash | Url): boolean;
357
+ /**
358
+ * This is a callback-function, which is called by the engine when a script component is finalized (destroyed). It can
359
+ * be used to e.g. take some last action, report the finalization to other game object instances, delete spawned objects
360
+ * or release user input focus (see release_input_focus).
361
+ *
362
+ * @param self - script instance used for storing state
363
+ * @example
364
+ * ```ts
365
+ * export default defineScript({
366
+ * init() {
367
+ * return { some_value: 0 };
368
+ * },
369
+ *
370
+ * final(self) {
371
+ * // report finalization
372
+ * msg.post("my_friend_instance", "im_dead", { my_stats: self.some_value });
373
+ * },
374
+ * });
375
+ * ```
376
+ */
377
+ export function final(self: unknown): void;
378
+ /**
379
+ * This is a callback-function, which is called by the engine at fixed intervals to update the state of a script
380
+ * component. The function will be called if 'Fixed Update Frequency' is enabled in the Engine section of game.project.
381
+ * It can for instance be used to update game logic with the physics simulation if using a fixed timestep for the
382
+ * physics (enabled by ticking 'Use Fixed Timestep' in the Physics section of game.project).
383
+ *
384
+ * @param self - script instance used for storing state
385
+ * @param dt - the time-step of the frame update
386
+ */
387
+ export function fixed_update(self: unknown, dt: number): void;
388
+ /**
389
+ * Returns or constructs an instance identifier. The instance id is a hash
390
+ * of the absolute path to the instance.
391
+ *
392
+ * - If `path` is specified, it can either be absolute or relative to the instance of the calling script.
393
+ * - If `path` is not specified, the id of the game object instance the script is attached to will be returned.
394
+ *
395
+ * @param path - path of the instance for which to return the id
396
+ * @returns instance id
397
+ * @example
398
+ * ```ts
399
+ * // For the instance with path /my_sub_collection/my_instance, the following calls
400
+ * // are equivalent:
401
+ * const id = go.get_id(); // no path, defaults to the instance containing the calling script
402
+ * print(id); // => hash: [/my_sub_collection/my_instance]
403
+ *
404
+ * const id2 = go.get_id("/my_sub_collection/my_instance"); // absolute path
405
+ * print(id2); // => hash: [/my_sub_collection/my_instance]
406
+ *
407
+ * const id3 = go.get_id("my_instance"); // relative path
408
+ * print(id3); // => hash: [/my_sub_collection/my_instance]
409
+ * ```
410
+ */
411
+ export function get_id(path?: string): Hash;
412
+ /**
413
+ * Get the parent for a game object instance.
414
+ *
415
+ * @param id - optional id of the game object instance to get parent for, defaults to the instance containing the calling script
416
+ * @returns parent instance or `nil`
417
+ * @example
418
+ * Get parent of the instance containing the calling script:
419
+ * ```ts
420
+ * const parent_id = go.get_parent();
421
+ * ```
422
+ * @example
423
+ * Get parent of the instance with id "x":
424
+ * ```ts
425
+ * const parent_id = go.get_parent("x");
426
+ * ```
427
+ */
428
+ export function get_parent(id?: SceneGameObjectAddress | Hash | Url): Hash | undefined;
429
+ /**
430
+ * The position is relative the parent (if any). Use go.get_world_position to retrieve the global world position.
431
+ *
432
+ * @param id - optional id of the game object instance to get the position for, by default the instance of the calling script
433
+ * @returns instance position
434
+ * @example
435
+ * Get the position of the game object instance the script is attached to:
436
+ * ```ts
437
+ * const p = go.get_position();
438
+ * ```
439
+ * @example
440
+ * Get the position of another game object instance "my_gameobject":
441
+ * ```ts
442
+ * const pos = go.get_position("my_gameobject");
443
+ * ```
444
+ */
445
+ export function get_position(id?: SceneGameObjectAddress | Hash | Url): Vector3;
446
+ /**
447
+ * The rotation is relative to the parent (if any). Use go.get_world_rotation to retrieve the global world rotation.
448
+ *
449
+ * @param id - optional id of the game object instance to get the rotation for, by default the instance of the calling script
450
+ * @returns instance rotation
451
+ * @example
452
+ * Get the rotation of the game object instance the script is attached to:
453
+ * ```ts
454
+ * const r = go.get_rotation();
455
+ * ```
456
+ * @example
457
+ * Get the rotation of another game object instance with id "x":
458
+ * ```ts
459
+ * const r = go.get_rotation("x");
460
+ * ```
461
+ */
462
+ export function get_rotation(id?: SceneGameObjectAddress | Hash | Url): Quaternion;
463
+ /**
464
+ * The scale is relative the parent (if any). Use go.get_world_scale to retrieve the global world 3D scale factor.
465
+ *
466
+ * @param id - optional id of the game object instance to get the scale for, by default the instance of the calling script
467
+ * @returns instance scale factor
468
+ * @example
469
+ * Get the scale of the game object instance the script is attached to:
470
+ * ```ts
471
+ * const s = go.get_scale();
472
+ * ```
473
+ * @example
474
+ * Get the scale of another game object instance with id "x":
475
+ * ```ts
476
+ * const s = go.get_scale("x");
477
+ * ```
478
+ */
479
+ export function get_scale(id?: SceneGameObjectAddress | Hash | Url): Vector3;
480
+ /**
481
+ * The uniform scale is relative the parent (if any). If the underlying scale vector is non-uniform the min element of the vector is returned as the uniform scale factor.
482
+ *
483
+ * @param id - optional id of the game object instance to get the uniform scale for, by default the instance of the calling script
484
+ * @returns uniform instance scale factor
485
+ * @example
486
+ * Get the scale of the game object instance the script is attached to:
487
+ * ```ts
488
+ * const s = go.get_scale_uniform();
489
+ * ```
490
+ * @example
491
+ * Get the uniform scale of another game object instance with id "x":
492
+ * ```ts
493
+ * const s = go.get_scale_uniform("x");
494
+ * ```
495
+ */
496
+ export function get_scale_uniform(id?: SceneGameObjectAddress | Hash | Url): number;
497
+ /**
498
+ * The function will return the world position calculated at the end of the previous frame.
499
+ * To recalculate it within the current frame, use go.update_world_transform on the instance before calling this.
500
+ * Use go.get_position to retrieve the position relative to the parent.
501
+ *
502
+ * @param id - optional id of the game object instance to get the world position for, by default the instance of the calling script
503
+ * @returns instance world position
504
+ * @example
505
+ * Get the world position of the game object instance the script is attached to:
506
+ * ```ts
507
+ * const p = go.get_world_position();
508
+ * ```
509
+ * @example
510
+ * Get the world position of another game object instance with id "x":
511
+ * ```ts
512
+ * // Relative addressing by id — no socket prefix:
513
+ * const p = go.get_world_position("x");
514
+ * ```
515
+ */
516
+ export function get_world_position(id?: SceneGameObjectAddress | Hash | Url): Vector3;
517
+ /**
518
+ * The function will return the world rotation calculated at the end of the previous frame.
519
+ * To recalculate it within the current frame, use go.update_world_transform on the instance before calling this.
520
+ * Use go.get_rotation to retrieve the rotation relative to the parent.
521
+ *
522
+ * @param id - optional id of the game object instance to get the world rotation for, by default the instance of the calling script
523
+ * @returns instance world rotation
524
+ * @example
525
+ * Get the world rotation of the game object instance the script is attached to:
526
+ * ```ts
527
+ * const r = go.get_world_rotation();
528
+ * ```
529
+ * @example
530
+ * Get the world rotation of another game object instance with id "x":
531
+ * ```ts
532
+ * const r = go.get_world_rotation("x");
533
+ * ```
534
+ */
535
+ export function get_world_rotation(id?: SceneGameObjectAddress | Hash | Url): Quaternion;
536
+ /**
537
+ * The function will return the world 3D scale factor calculated at the end of the previous frame.
538
+ * To recalculate it within the current frame, use go.update_world_transform on the instance before calling this.
539
+ * Use go.get_scale to retrieve the 3D scale factor relative to the parent.
540
+ * This vector is derived by decomposing the transformation matrix and should be used with care.
541
+ * For most cases it should be fine to use go.get_world_scale_uniform instead.
542
+ *
543
+ * @param id - optional id of the game object instance to get the world scale for, by default the instance of the calling script
544
+ * @returns instance world 3D scale factor
545
+ * @example
546
+ * Get the world 3D scale of the game object instance the script is attached to:
547
+ * ```ts
548
+ * const s = go.get_world_scale();
549
+ * ```
550
+ * @example
551
+ * Get the world scale of another game object instance "x":
552
+ * ```ts
553
+ * const s = go.get_world_scale("x");
554
+ * ```
555
+ */
556
+ export function get_world_scale(id?: SceneGameObjectAddress | Hash | Url): Vector3;
557
+ /**
558
+ * The function will return the world scale factor calculated at the end of the previous frame.
559
+ * To recalculate it within the current frame, use go.update_world_transform on the instance before calling this.
560
+ * Use go.get_scale_uniform to retrieve the scale factor relative to the parent.
561
+ *
562
+ * @param id - optional id of the game object instance to get the world scale for, by default the instance of the calling script
563
+ * @returns instance world scale factor
564
+ * @example
565
+ * Get the world scale of the game object instance the script is attached to:
566
+ * ```ts
567
+ * const s = go.get_world_scale_uniform();
568
+ * ```
569
+ * @example
570
+ * Get the world scale of another game object instance with id "x":
571
+ * ```ts
572
+ * const s = go.get_world_scale_uniform("x");
573
+ * ```
574
+ */
575
+ export function get_world_scale_uniform(id?: SceneGameObjectAddress | Hash | Url): number;
576
+ /**
577
+ * The function will return the world transform matrix calculated at the end of the previous frame.
578
+ * To recalculate it within the current frame, use go.update_world_transform on the instance before calling this.
579
+ *
580
+ * @param id - optional id of the game object instance to get the world transform for, by default the instance of the calling script
581
+ * @returns instance world transform
582
+ * @example
583
+ * Get the world transform of the game object instance the script is attached to:
584
+ * ```ts
585
+ * const m = go.get_world_transform();
586
+ * ```
587
+ * @example
588
+ * Get the world transform of another game object instance with id "x":
589
+ * ```ts
590
+ * const m = go.get_world_transform("x");
591
+ * ```
592
+ */
593
+ export function get_world_transform(id?: SceneGameObjectAddress | Hash | Url): Matrix4;
594
+ /**
595
+ * This is a callback-function, which is called by the engine when a script component is initialized. It can be used
596
+ * to set the initial state of the script.
597
+ *
598
+ * @param self - script instance used for storing state
599
+ * @example
600
+ * ```ts
601
+ * export default defineScript({
602
+ * init() {
603
+ * // set up useful data
604
+ * return { my_value: 1 };
605
+ * },
606
+ * });
607
+ * ```
608
+ */
609
+ export function init(self: unknown): void;
610
+ /**
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
612
+ * component. Use it to make final adjustments to the game object instance.
613
+ *
614
+ * @param self - script instance used for storing state
615
+ * @param dt - the time-step of the frame update
616
+ */
617
+ export function late_update(self: unknown, dt: number): void;
618
+ /**
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.
620
+ * It can be used to take action on the input, e.g. move the instance according to the input.
621
+ * For an instance to obtain user input, it must first acquire input focus
622
+ * through the message `acquire_input_focus`.
623
+ * Any instance that has obtained input will be put on top of an
624
+ * input stack. Input is sent to all listeners on the stack until the
625
+ * end of stack is reached, or a listener returns `true`
626
+ * to signal that it wants input to be consumed.
627
+ * See the documentation of acquire_input_focus for more
628
+ * information.
629
+ *
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.**
633
+ * @returns optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
634
+ * @example
635
+ * ```ts
636
+ * // This example demonstrates how a game object instance can be moved as a response to user input.
637
+ * export default defineScript({
638
+ * init() {
639
+ * // acquire input focus
640
+ * msg.post(".", "acquire_input_focus");
641
+ * return {
642
+ * // maximum speed the instance can be moved
643
+ * max_speed: 2,
644
+ * // velocity of the instance, initially zero
645
+ * velocity: vmath.vector3(),
646
+ * };
647
+ * },
648
+ *
649
+ * update(self, dt) {
650
+ * // move the instance
651
+ * go.set_position(go.get_position().add(self.velocity.mul(dt)));
652
+ * },
653
+ *
654
+ * on_input(self, action_id, action) {
655
+ * // check for movement input
656
+ * if (action_id === hash("right")) {
657
+ * if (action.released) {
658
+ * // reset velocity if input was released
659
+ * self.velocity = vmath.vector3();
660
+ * } else {
661
+ * // update velocity
662
+ * self.velocity = vmath.vector3((action.value ?? 0) * self.max_speed, 0, 0);
663
+ * }
664
+ * }
665
+ * },
666
+ * });
667
+ * ```
668
+ */
669
+ export function on_input(self: unknown, action_id: Hash | undefined, action: go.on_input.action): boolean | undefined;
670
+ /**
671
+ * This is a callback-function, which is called by the engine whenever a message has been sent to the script component.
672
+ * It can be used to take action on the message, e.g. send a response back to the sender of the message.
673
+ * The `message` parameter is a table containing the message data. If the message is sent from the engine, the
674
+ * documentation of the message specifies which data is supplied.
675
+ *
676
+ * @param self - script instance used for storing state
677
+ * @param message_id - id of the received message
678
+ * @param message - a table containing the message data
679
+ * @param sender - address of the sender
680
+ * @example
681
+ * This example demonstrates how a game object instance, called "a", can communicate with another instance, called "b". It
682
+ * is assumed that both script components of the instances has id "script".
683
+ * Script of instance "a":
684
+ * ```ts
685
+ * // This example demonstrates how a game object instance, called "a", can communicate with another instance, called "b". It
686
+ * // is assumed that both script components of the instances has id "script".
687
+ *
688
+ * // a.script — Script of instance "a":
689
+ * export default defineScript({
690
+ * init() {
691
+ * // let b know about some important data
692
+ * msg.post("b#script", "my_data", { important_value: 1 });
693
+ * },
694
+ * });
695
+ * ```
696
+ * @example
697
+ * Script of instance "b":
698
+ * ```ts
699
+ * // b.script — Script of instance "b":
700
+ * export default defineScript({
701
+ * init() {
702
+ * // store the url of instance "a" for later use, by specifying undefined as socket we
703
+ * // automatically use our own socket
704
+ * return { a_url: msg.url(undefined, go.get_id("a"), "script"), important_value: 0 };
705
+ * },
706
+ *
707
+ * on_message(self, message_id, message, sender) {
708
+ * // check message and sender
709
+ * if (message_id === hash("my_data") && sender === self.a_url && typeof message.important_value === "number") {
710
+ * // use the data in some way
711
+ * self.important_value = message.important_value;
712
+ * }
713
+ * },
714
+ * });
715
+ * ```
716
+ */
717
+ export function on_message(self: unknown, message_id: Hash, message: LuaMap<AnyNotNil, unknown> | Record<string, unknown>, sender: Url): void;
718
+ /**
719
+ * This is a callback-function, which is called by the engine when the script component is reloaded, e.g. from the editor.
720
+ * It can be used for live development, e.g. to tweak constants or set up the state properly for the instance.
721
+ *
722
+ * @param self - script instance used for storing state
723
+ * @example
724
+ * ```ts
725
+ * // This example demonstrates how to tweak the speed of a game object instance that is moved on user input.
726
+ * export default defineScript({
727
+ * init() {
728
+ * // acquire input focus
729
+ * msg.post(".", "acquire_input_focus");
730
+ * return {
731
+ * // maximum speed the instance can be moved, this value is tweaked in the on_reload function below
732
+ * max_speed: 2,
733
+ * // velocity of the instance, initially zero
734
+ * velocity: vmath.vector3(),
735
+ * };
736
+ * },
737
+ *
738
+ * update(self, dt) {
739
+ * // move the instance
740
+ * go.set_position(go.get_position().add(self.velocity.mul(dt)));
741
+ * },
742
+ *
743
+ * on_input(self, action_id, action) {
744
+ * // check for movement input
745
+ * if (action_id === hash("right")) {
746
+ * if (action.released) {
747
+ * // reset velocity if input was released
748
+ * self.velocity = vmath.vector3();
749
+ * } else {
750
+ * // update velocity
751
+ * self.velocity = vmath.vector3((action.value ?? 0) * self.max_speed, 0, 0);
752
+ * }
753
+ * }
754
+ * },
755
+ *
756
+ * on_reload(self) {
757
+ * // edit this value and reload the script component
758
+ * self.max_speed = 100;
759
+ * },
760
+ * });
761
+ * ```
762
+ */
763
+ export function on_reload(self: unknown): void;
764
+ /**
765
+ * Sets the parent for a game object instance. This means that the instance will exist in the geometrical space of its parent,
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
767
+ * space.
768
+ * This function will generate a `set_parent` message. It is not until the message has been processed that the change actually takes effect. This
769
+ * typically happens later in the same frame or the beginning of the next frame. Refer to the manual to learn how messages are processed by the
770
+ * engine.
771
+ *
772
+ * @param id - optional id of the game object instance to set parent for, defaults to the instance containing the calling script
773
+ * @param parent_id - optional id of the new parent game object, defaults to detaching game object from its parent
774
+ * @param keep_world_transform - optional boolean, set to true to maintain the world transform when changing spaces. Defaults to false.
775
+ * @example
776
+ * Attach myself to another instance "my_parent":
777
+ * ```ts
778
+ * go.set_parent(go.get_id(), go.get_id("my_parent"));
779
+ * ```
780
+ * @example
781
+ * Attach an instance "my_instance" to another instance "my_parent":
782
+ * ```ts
783
+ * go.set_parent(go.get_id("my_instance"), go.get_id("my_parent"));
784
+ * ```
785
+ * @example
786
+ * Detach an instance "my_instance" from its parent (if any):
787
+ * ```ts
788
+ * go.set_parent(go.get_id("my_instance"));
789
+ * ```
790
+ */
791
+ export function set_parent(id?: SceneGameObjectAddress | Hash | Url, parent_id?: SceneGameObjectAddress | Hash | Url, keep_world_transform?: boolean): void;
792
+ /**
793
+ * The position is relative to the parent (if any). The global world position cannot be manually set.
794
+ *
795
+ * @param position - position to set
796
+ * @param id - optional id of the game object instance to set the position for, by default the instance of the calling script
797
+ * @example
798
+ * Set the position of the game object instance the script is attached to:
799
+ * ```ts
800
+ * // `p` is the desired position (a Vector3).
801
+ * const p = vmath.vector3();
802
+ * go.set_position(p);
803
+ * ```
804
+ * @example
805
+ * Set the position of another game object instance with id "x":
806
+ * ```ts
807
+ * // `p` is the desired position (a Vector3).
808
+ * const p = vmath.vector3();
809
+ *
810
+ * // Relative addressing by id — no socket prefix:
811
+ * go.set_position(p, "x");
812
+ * ```
813
+ */
814
+ export function set_position(position: Vector3, id?: SceneGameObjectAddress | Hash | Url): void;
815
+ /**
816
+ * The rotation is relative to the parent (if any). The global world rotation cannot be manually set.
817
+ *
818
+ * @param rotation - rotation to set
819
+ * @param id - optional id of the game object instance to get the rotation for, by default the instance of the calling script
820
+ * @example
821
+ * Set the rotation of the game object instance the script is attached to:
822
+ * ```ts
823
+ * // `r` is the desired rotation (a Quaternion).
824
+ * const r = vmath.quat();
825
+ * go.set_rotation(r);
826
+ * ```
827
+ * @example
828
+ * Set the rotation of another game object instance with id "x":
829
+ * ```ts
830
+ * // `r` is the desired rotation (a Quaternion).
831
+ * const r = vmath.quat();
832
+ * go.set_rotation(r, "x");
833
+ * ```
834
+ */
835
+ export function set_rotation(rotation: Quaternion, id?: SceneGameObjectAddress | Hash | Url): void;
836
+ /**
837
+ * The scale factor is relative to the parent (if any). The global world scale factor cannot be manually set.
838
+ * See manual to know how physics affected when setting scale from this function.
839
+ *
840
+ * @param scale - vector or uniform scale factor, must be greater than 0
841
+ * @param id - optional id of the game object instance to get the scale for, by default the instance of the calling script
842
+ * @example
843
+ * Set the scale of the game object instance the script is attached to:
844
+ * ```ts
845
+ * const s = vmath.vector3(2.0, 1.0, 1.0);
846
+ * go.set_scale(s);
847
+ * ```
848
+ * @example
849
+ * Set the scale of another game object instance with id "obj_id":
850
+ * ```ts
851
+ * const s = 1.2;
852
+ * go.set_scale(s, "obj_id");
853
+ * ```
854
+ */
855
+ export function set_scale(scale: number | Vector3, id?: SceneGameObjectAddress | Hash | Url): void;
856
+ /**
857
+ * The scale factor is relative to the parent (if any). The global world scale factor cannot be manually set.
858
+ * See manual to know how physics affected when setting scale from this function.
859
+ *
860
+ * @param scale - vector or uniform scale factor, must be greater than 0
861
+ * @param id - optional id of the game object instance to get the scale for, by default the instance of the calling script
862
+ * @example
863
+ * Set the scale of the game object instance the script is attached to:
864
+ * ```ts
865
+ * const s = vmath.vector3(2.0, 1.0, 5.0);
866
+ * go.set_scale_xy(s); // z will not be set here, only x and y
867
+ * ```
868
+ * @example
869
+ * Set the scale of another game object instance with id "obj_id":
870
+ * ```ts
871
+ * const s = 1.2;
872
+ * go.set_scale_xy(s, "obj_id"); // z will not be set here, only x and y
873
+ * ```
874
+ */
875
+ export function set_scale_xy(scale: number | Vector3, id?: SceneGameObjectAddress | Hash | Url): void;
876
+ /**
877
+ * This is a callback-function, which is called by the engine every frame to update the state of a script component.
878
+ * It can be used to perform any kind of game related tasks, e.g. moving the game object instance.
879
+ *
880
+ * @param self - script instance used for storing state
881
+ * @param dt - the time-step of the frame update
882
+ * @example
883
+ * ```ts
884
+ * // This example demonstrates how to move a game object instance through the script component:
885
+ * export default defineScript({
886
+ * init() {
887
+ * // set initial velocity to be 1 along world x-axis
888
+ * return { my_velocity: vmath.vector3(1, 0, 0) };
889
+ * },
890
+ *
891
+ * update(self, dt) {
892
+ * // move the game object instance
893
+ * go.set_position(go.get_position().add(self.my_velocity.mul(dt)));
894
+ * },
895
+ * });
896
+ * ```
897
+ */
898
+ export function update(self: unknown, dt: number): void;
899
+ /**
900
+ * Recalculates and updates the cached world transform immediately for the target instance
901
+ * and its ancestors (parent chain up to the collection root). Descendants (children) are
902
+ * not updated by this function.
903
+ * If no id is provided, the instance of the calling script is used.
904
+ * Use this after changing local transform mid-frame when you need the
905
+ * new world transform right away (e.g. before end-of-frame updates). Note that child
906
+ * instances will still have last-frame world transforms until the regular update.
907
+ *
908
+ * @param id - optional id of the game object instance to update
909
+ * @example
910
+ * Update this game object's world transform:
911
+ * ```ts
912
+ * go.update_world_transform();
913
+ * ```
914
+ * @example
915
+ * Update another game object's world transform:
916
+ * ```ts
917
+ * go.update_world_transform("/other");
918
+ * ```
919
+ */
920
+ export function update_world_transform(id?: SceneGameObjectAddress | Hash | Url): void;
921
+ /**
922
+ * The function uses world transformation calculated at the end of previous frame.
923
+ *
924
+ * @param position - position which need to be converted
925
+ * @param url - url of the game object which coordinate system convert to
926
+ * @returns converted position
927
+ * @example
928
+ * ```ts
929
+ * // Convert position of "test" game object into coordinate space of "child" object.
930
+ * const test_pos = go.get_world_position("/test");
931
+ * const child_pos = go.get_world_position("/child");
932
+ * const new_position = go.world_to_local_position(test_pos, "/child");
933
+ * ```
934
+ */
935
+ export function world_to_local_position(position: Vector3, url?: SceneGameObjectAddress | Hash | Url): Vector3;
936
+ /**
937
+ * The function uses world transformation calculated at the end of previous frame.
938
+ *
939
+ * @param transformation - transformation which need to be converted
940
+ * @param url - url of the game object which coordinate system convert to
941
+ * @returns converted transformation
942
+ * @example
943
+ * ```ts
944
+ * // Convert transform of "test" game object into coordinate space of "child" object.
945
+ * const test_transform = go.get_world_transform("/test");
946
+ * const child_transform = go.get_world_transform("/child");
947
+ * const result_transform = go.world_to_local_transform(test_transform, "/child");
948
+ * ```
949
+ */
950
+ export function world_to_local_transform(transformation: Matrix4, url?: SceneGameObjectAddress | Hash | Url): Matrix4;
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
+ }
1141
+ export interface properties {
1142
+ /**
1143
+ * The rotation of the game object expressed in Euler angles.
1144
+ * Euler angles are specified in degrees in the interval (-360, 360).
1145
+ * The type of the property is vector3.
1146
+ */
1147
+ euler: Vector3;
1148
+ /**
1149
+ * The position of the game object.
1150
+ * The type of the property is vector3.
1151
+ */
1152
+ position: Vector3;
1153
+ /**
1154
+ * The rotation of the game object.
1155
+ * The type of the property is quaternion.
1156
+ */
1157
+ rotation: Quaternion;
1158
+ /**
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.
1160
+ */
1161
+ scale: number | Vector3;
1162
+ }
1163
+ }
1164
+ }
1165
+
1166
+ export {};