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