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