@defold-typescript/types 0.8.3 → 0.9.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/README.md +1 -1
- package/api-targets.json +18 -0
- package/generated/b2d_body.d.ts +348 -0
- package/generated/buffer.d.ts +3 -0
- package/generated/camera.d.ts +236 -1
- package/generated/collectionfactory.d.ts +4 -0
- package/generated/factory.d.ts +4 -0
- package/generated/font.d.ts +81 -0
- package/generated/go.d.ts +53 -0
- package/generated/gui.d.ts +264 -49
- package/generated/html5.d.ts +17 -13
- package/generated/http.d.ts +16 -0
- package/generated/image.d.ts +24 -0
- package/generated/json.d.ts +2 -0
- package/generated/kinds/gui-script.d.ts +3 -0
- package/generated/kinds/render-script.d.ts +3 -0
- package/generated/kinds/script.d.ts +3 -0
- package/generated/model.d.ts +14 -0
- package/generated/msg.d.ts +17 -11
- package/generated/particlefx.d.ts +6 -0
- package/generated/physics.d.ts +32 -0
- package/generated/profiler.d.ts +14 -0
- package/generated/render.d.ts +109 -0
- package/generated/resource.d.ts +223 -0
- package/generated/socket.d.ts +4 -0
- package/generated/sound.d.ts +6 -0
- package/generated/sprite.d.ts +5 -0
- package/generated/sys.d.ts +136 -0
- package/generated/tilemap.d.ts +2 -0
- package/generated/timer.d.ts +3 -0
- package/generated/vmath.d.ts +109 -93
- package/generated/window.d.ts +24 -1
- package/index.d.ts +8 -0
- package/package.json +1 -1
- package/scripts/fidelity-baseline.json +18 -2
- package/scripts/regen.ts +5 -0
- package/scripts/signature-store-io.ts +18 -0
- package/scripts/sync-api-docs.ts +208 -12
- package/src/core-types.ts +4 -2
- package/src/doc-comment.ts +42 -5
- package/src/emit-dts.ts +20 -1
- package/src/engine-globals.d.ts +2 -0
- package/src/example-store.ts +11 -7
- package/src/index.ts +18 -1
- package/src/msg-overloads.d.ts +3 -0
- package/src/signature-store.ts +20 -0
- package/src/window-event-guard.d.ts +52 -0
package/generated/html5.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
declare global {
|
|
3
3
|
/**
|
|
4
4
|
* HTML5 platform specific functions.
|
|
5
|
+
*
|
|
5
6
|
* [icon:html5] The following functions are only available on HTML5 builds, the `html5.*` Lua namespace will not be available on other platforms.
|
|
6
7
|
*/
|
|
7
8
|
namespace html5 {
|
|
@@ -13,11 +14,11 @@ declare global {
|
|
|
13
14
|
* @param code - Javascript code to run
|
|
14
15
|
* @returns result as string
|
|
15
16
|
* @example
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* print(res)
|
|
19
|
-
*
|
|
20
|
-
* print(res_num - 20)
|
|
17
|
+
* ```ts
|
|
18
|
+
* const res = html5.run("10 + 20"); // returns the string "30"
|
|
19
|
+
* print(res);
|
|
20
|
+
* const res_num = tonumber(res); // convert to number
|
|
21
|
+
* print(res_num - 20); // prints 10
|
|
21
22
|
* ```
|
|
22
23
|
*/
|
|
23
24
|
function run(code: string): string;
|
|
@@ -28,18 +29,21 @@ declare global {
|
|
|
28
29
|
* or start playing sounds the first time the callback is invoked.
|
|
29
30
|
*
|
|
30
31
|
* @param callback - The interaction callback. Pass an empty function or `nil` if you no longer wish to receive callbacks.
|
|
32
|
+
*
|
|
31
33
|
* `self`
|
|
32
34
|
* object The calling script
|
|
33
35
|
* @example
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
36
|
+
* ```ts
|
|
37
|
+
* function on_interaction(self) {
|
|
38
|
+
* print("on_interaction called");
|
|
39
|
+
* html5.set_interaction_listener(undefined);
|
|
40
|
+
* }
|
|
39
41
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
42
|
+
* export default defineScript({
|
|
43
|
+
* init() {
|
|
44
|
+
* html5.set_interaction_listener(on_interaction);
|
|
45
|
+
* },
|
|
46
|
+
* });
|
|
43
47
|
* ```
|
|
44
48
|
*/
|
|
45
49
|
function set_interaction_listener(callback?: (self: unknown) => void): void;
|
package/generated/http.d.ts
CHANGED
|
@@ -11,29 +11,45 @@ declare global {
|
|
|
11
11
|
* @param url - target url
|
|
12
12
|
* @param method - HTTP/HTTPS method, e.g. "GET", "PUT", "POST" etc.
|
|
13
13
|
* @param callback - response callback function
|
|
14
|
+
*
|
|
14
15
|
* `self`
|
|
15
16
|
* object The script instance
|
|
16
17
|
* `id`
|
|
17
18
|
* hash Internal message identifier. Do not use!
|
|
18
19
|
* `response`
|
|
19
20
|
* table The response data. Contains the fields:
|
|
21
|
+
*
|
|
20
22
|
* - number `status`: the status of the response
|
|
23
|
+
*
|
|
21
24
|
* - string `response`: the response data (if not saved on disc)
|
|
25
|
+
*
|
|
22
26
|
* - table `headers`: all the returned headers (if status is 200 or 206)
|
|
27
|
+
*
|
|
23
28
|
* - string `path`: the stored path (if saved to disc)
|
|
29
|
+
*
|
|
24
30
|
* - string `error`: if any unforeseen errors occurred (e.g. file I/O)
|
|
31
|
+
*
|
|
25
32
|
* - number `bytes_received`: the amount of bytes received/sent for a request, only if option `report_progress` is true
|
|
33
|
+
*
|
|
26
34
|
* - number `bytes_total`: the total amount of bytes for a request, only if option `report_progress` is true
|
|
35
|
+
*
|
|
27
36
|
* - number `range_start`: the start offset into the requested file
|
|
37
|
+
*
|
|
28
38
|
* - number `range_end`: the end offset into the requested file (inclusive)
|
|
39
|
+
*
|
|
29
40
|
* - number `document_size`: the full size of the requested file
|
|
30
41
|
* @param headers - optional table with custom headers
|
|
31
42
|
* @param post_data - optional data to send
|
|
32
43
|
* @param options - optional table with request parameters. Supported entries:
|
|
44
|
+
*
|
|
33
45
|
* - number `timeout`: timeout in seconds
|
|
46
|
+
*
|
|
34
47
|
* - string `path`: path on disc where to download the file. Only overwrites the path if status is 200. Path should be absolute
|
|
48
|
+
*
|
|
35
49
|
* - boolean `ignore_cache`: don't return cached data if we get a 304. Not available in HTML5 build
|
|
50
|
+
*
|
|
36
51
|
* - boolean `chunked_transfer`: use chunked transfer encoding for https requests larger than 16kb. Defaults to true. Not available in HTML5 build
|
|
52
|
+
*
|
|
37
53
|
* - boolean `report_progress`: when it is true, the amount of bytes sent and/or received for a request will be passed into the callback function
|
|
38
54
|
* @example
|
|
39
55
|
* ```ts
|
package/generated/image.d.ts
CHANGED
|
@@ -27,11 +27,17 @@ declare global {
|
|
|
27
27
|
*
|
|
28
28
|
* @param buffer - .astc file data buffer
|
|
29
29
|
* @returns header or `nil` if buffer is not a valid .astc. The header has these fields:
|
|
30
|
+
*
|
|
30
31
|
* - number `width`: image width
|
|
32
|
+
*
|
|
31
33
|
* - number `height`: image height
|
|
34
|
+
*
|
|
32
35
|
* - number `depth`: image depth
|
|
36
|
+
*
|
|
33
37
|
* - number `block_size_x`: block size x
|
|
38
|
+
*
|
|
34
39
|
* - number `block_size_y`: block size y
|
|
40
|
+
*
|
|
35
41
|
* - number `block_size_z`: block size z
|
|
36
42
|
* @example
|
|
37
43
|
* ```ts
|
|
@@ -47,18 +53,27 @@ declare global {
|
|
|
47
53
|
*
|
|
48
54
|
* @param buffer - image data buffer
|
|
49
55
|
* @param options - An optional table containing parameters for loading the image. Supported entries:
|
|
56
|
+
*
|
|
50
57
|
* `premultiply_alpha`
|
|
51
58
|
* boolean True if alpha should be premultiplied into the color components. Defaults to `false`.
|
|
52
59
|
* `flip_vertically`
|
|
53
60
|
* boolean True if the image contents should be flipped vertically. Defaults to `false`.
|
|
54
61
|
* @returns object or `nil` if loading fails. The object is a table with the following fields:
|
|
62
|
+
*
|
|
55
63
|
* - number `width`: image width
|
|
64
|
+
*
|
|
56
65
|
* - number `height`: image height
|
|
66
|
+
*
|
|
57
67
|
* - constant `type`: image type
|
|
68
|
+
*
|
|
58
69
|
* - `image.TYPE_RGB`
|
|
70
|
+
*
|
|
59
71
|
* - `image.TYPE_RGBA`
|
|
72
|
+
*
|
|
60
73
|
* - `image.TYPE_LUMINANCE`
|
|
74
|
+
*
|
|
61
75
|
* - `image.TYPE_LUMINANCE_ALPHA`
|
|
76
|
+
*
|
|
62
77
|
* - string `buffer`: the raw image data
|
|
63
78
|
* @example
|
|
64
79
|
* ```ts
|
|
@@ -76,18 +91,27 @@ declare global {
|
|
|
76
91
|
*
|
|
77
92
|
* @param buffer - image data buffer
|
|
78
93
|
* @param options - An optional table containing parameters for loading the image. Supported entries:
|
|
94
|
+
*
|
|
79
95
|
* `premultiply_alpha`
|
|
80
96
|
* boolean True if alpha should be premultiplied into the color components. Defaults to `false`.
|
|
81
97
|
* `flip_vertically`
|
|
82
98
|
* boolean True if the image contents should be flipped vertically. Defaults to `false`.
|
|
83
99
|
* @returns object or `nil` if loading fails. The object is a table with the following fields:
|
|
100
|
+
*
|
|
84
101
|
* - number `width`: image width
|
|
102
|
+
*
|
|
85
103
|
* - number `height`: image height
|
|
104
|
+
*
|
|
86
105
|
* - constant `type`: image type
|
|
106
|
+
*
|
|
87
107
|
* - `image.TYPE_RGB`
|
|
108
|
+
*
|
|
88
109
|
* - `image.TYPE_RGBA`
|
|
110
|
+
*
|
|
89
111
|
* - `image.TYPE_LUMINANCE`
|
|
112
|
+
*
|
|
90
113
|
* - `image.TYPE_LUMINANCE_ALPHA`
|
|
114
|
+
*
|
|
91
115
|
* - buffer `buffer`: the script buffer that holds the decompressed image data. See buffer.create how to use the buffer.
|
|
92
116
|
* @example
|
|
93
117
|
* ```ts
|
package/generated/json.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ declare global {
|
|
|
14
14
|
*
|
|
15
15
|
* @param json - json data
|
|
16
16
|
* @param options - table with decode options
|
|
17
|
+
*
|
|
17
18
|
* - boolean `decode_null_as_userdata`: wether to decode a JSON null value as json.null or nil (default is nil)
|
|
18
19
|
* @returns decoded json
|
|
19
20
|
* @example
|
|
@@ -47,6 +48,7 @@ declare global {
|
|
|
47
48
|
*
|
|
48
49
|
* @param tbl - lua table to encode
|
|
49
50
|
* @param options - table with encode options
|
|
51
|
+
*
|
|
50
52
|
* - string `encode_empty_table_as_object`: wether to encode an empty table as an JSON object or array (default is object)
|
|
51
53
|
* @returns encoded json
|
|
52
54
|
* @example
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/// <reference types="lua-types/5.1" />
|
|
2
2
|
/// <reference types="lua-types/special/jit-only" />
|
|
3
3
|
import "../b2d";
|
|
4
|
+
import "../b2d_body";
|
|
4
5
|
import "../buffer";
|
|
5
6
|
import "../camera";
|
|
6
7
|
import "../collectionfactory";
|
|
7
8
|
import "../collectionproxy";
|
|
8
9
|
import "../crash";
|
|
9
10
|
import "../factory";
|
|
11
|
+
import "../font";
|
|
10
12
|
import "../go";
|
|
11
13
|
import "../graphics";
|
|
12
14
|
import "../html5";
|
|
@@ -39,6 +41,7 @@ import "../../src/engine-globals";
|
|
|
39
41
|
import "../../src/go-overloads";
|
|
40
42
|
import "../../src/message-guard";
|
|
41
43
|
import "../../src/msg-overloads";
|
|
44
|
+
import "../../src/window-event-guard";
|
|
42
45
|
import "../builtin-messages";
|
|
43
46
|
import "../gui";
|
|
44
47
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/// <reference types="lua-types/5.1" />
|
|
2
2
|
/// <reference types="lua-types/special/jit-only" />
|
|
3
3
|
import "../b2d";
|
|
4
|
+
import "../b2d_body";
|
|
4
5
|
import "../buffer";
|
|
5
6
|
import "../camera";
|
|
6
7
|
import "../collectionfactory";
|
|
7
8
|
import "../collectionproxy";
|
|
8
9
|
import "../crash";
|
|
9
10
|
import "../factory";
|
|
11
|
+
import "../font";
|
|
10
12
|
import "../go";
|
|
11
13
|
import "../graphics";
|
|
12
14
|
import "../html5";
|
|
@@ -39,6 +41,7 @@ import "../../src/engine-globals";
|
|
|
39
41
|
import "../../src/go-overloads";
|
|
40
42
|
import "../../src/message-guard";
|
|
41
43
|
import "../../src/msg-overloads";
|
|
44
|
+
import "../../src/window-event-guard";
|
|
42
45
|
import "../builtin-messages";
|
|
43
46
|
import "../render";
|
|
44
47
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/// <reference types="lua-types/5.1" />
|
|
2
2
|
/// <reference types="lua-types/special/jit-only" />
|
|
3
3
|
import "../b2d";
|
|
4
|
+
import "../b2d_body";
|
|
4
5
|
import "../buffer";
|
|
5
6
|
import "../camera";
|
|
6
7
|
import "../collectionfactory";
|
|
7
8
|
import "../collectionproxy";
|
|
8
9
|
import "../crash";
|
|
9
10
|
import "../factory";
|
|
11
|
+
import "../font";
|
|
10
12
|
import "../go";
|
|
11
13
|
import "../graphics";
|
|
12
14
|
import "../html5";
|
|
@@ -39,6 +41,7 @@ import "../../src/engine-globals";
|
|
|
39
41
|
import "../../src/go-overloads";
|
|
40
42
|
import "../../src/message-guard";
|
|
41
43
|
import "../../src/msg-overloads";
|
|
44
|
+
import "../../src/window-event-guard";
|
|
42
45
|
import "../builtin-messages";
|
|
43
46
|
|
|
44
47
|
export { defineScript } from "../../src/lifecycle";
|
package/generated/model.d.ts
CHANGED
|
@@ -88,21 +88,31 @@ declare global {
|
|
|
88
88
|
* The callback is not called (or message sent) if the animation is
|
|
89
89
|
* cancelled with model.cancel. The callback is called (or message sent) only for
|
|
90
90
|
* animations that play with the following playback modes:
|
|
91
|
+
*
|
|
91
92
|
* - `go.PLAYBACK_ONCE_FORWARD`
|
|
93
|
+
*
|
|
92
94
|
* - `go.PLAYBACK_ONCE_BACKWARD`
|
|
95
|
+
*
|
|
93
96
|
* - `go.PLAYBACK_ONCE_PINGPONG`
|
|
94
97
|
*
|
|
95
98
|
* @param url - the model for which to play the animation
|
|
96
99
|
* @param anim_id - id of the animation to play
|
|
97
100
|
* @param playback - playback mode of the animation
|
|
101
|
+
*
|
|
98
102
|
* - `go.PLAYBACK_ONCE_FORWARD`
|
|
103
|
+
*
|
|
99
104
|
* - `go.PLAYBACK_ONCE_BACKWARD`
|
|
105
|
+
*
|
|
100
106
|
* - `go.PLAYBACK_ONCE_PINGPONG`
|
|
107
|
+
*
|
|
101
108
|
* - `go.PLAYBACK_LOOP_FORWARD`
|
|
109
|
+
*
|
|
102
110
|
* - `go.PLAYBACK_LOOP_BACKWARD`
|
|
111
|
+
*
|
|
103
112
|
* - `go.PLAYBACK_LOOP_PINGPONG`
|
|
104
113
|
* @param play_properties - optional table with properties
|
|
105
114
|
* Play properties table:
|
|
115
|
+
*
|
|
106
116
|
* `blend_duration`
|
|
107
117
|
* number Duration of a linear blend between the current and new animation.
|
|
108
118
|
* `offset`
|
|
@@ -110,14 +120,18 @@ declare global {
|
|
|
110
120
|
* `playback_rate`
|
|
111
121
|
* number The rate with which the animation will be played. Must be positive.
|
|
112
122
|
* @param complete_function - function to call when the animation has completed.
|
|
123
|
+
*
|
|
113
124
|
* `self`
|
|
114
125
|
* object The current object.
|
|
115
126
|
* `message_id`
|
|
116
127
|
* hash The name of the completion message, `"model_animation_done"`.
|
|
117
128
|
* `message`
|
|
118
129
|
* table Information about the completion:
|
|
130
|
+
*
|
|
119
131
|
* - hash `animation_id` - the animation that was completed.
|
|
132
|
+
*
|
|
120
133
|
* - constant `playback` - the playback mode for the animation.
|
|
134
|
+
*
|
|
121
135
|
* `sender`
|
|
122
136
|
* url The invoker of the callback: the model component.
|
|
123
137
|
* @example
|
package/generated/msg.d.ts
CHANGED
|
@@ -12,35 +12,41 @@ declare global {
|
|
|
12
12
|
*
|
|
13
13
|
* @returns a new URL
|
|
14
14
|
* @example
|
|
15
|
-
* ```
|
|
16
|
-
* Create a new URL which will address the current script:
|
|
17
|
-
*
|
|
18
|
-
* print(my_url)
|
|
15
|
+
* ```ts
|
|
16
|
+
* // Create a new URL which will address the current script:
|
|
17
|
+
* const my_url = msg.url();
|
|
18
|
+
* print(my_url); // => url: [current_collection:/my_instance#my_component]
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
21
|
function url(): Url;
|
|
22
22
|
/**
|
|
23
23
|
* The format of the string must be `[socket:][path][#fragment]`, which is similar to a HTTP URL.
|
|
24
24
|
* When addressing instances:
|
|
25
|
+
*
|
|
25
26
|
* - `socket` is the name of a valid world (a collection)
|
|
27
|
+
*
|
|
26
28
|
* - `path` is the id of the instance, which can either be relative the instance of the calling script or global
|
|
29
|
+
*
|
|
27
30
|
* - `fragment` would be the id of the desired component
|
|
31
|
+
*
|
|
28
32
|
* In addition, the following shorthands are available:
|
|
33
|
+
*
|
|
29
34
|
* - `"."` the current game object
|
|
35
|
+
*
|
|
30
36
|
* - `"#"` the current component
|
|
31
37
|
*
|
|
32
38
|
* @param urlstring - string to create the url from
|
|
33
39
|
* @returns a new URL
|
|
34
40
|
* @example
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* print(my_url)
|
|
41
|
+
* ```ts
|
|
42
|
+
* const my_url = msg.url("#my_component");
|
|
43
|
+
* print(my_url); // => url: [current_collection:/my_instance#my_component]
|
|
38
44
|
*
|
|
39
|
-
*
|
|
40
|
-
* print(
|
|
45
|
+
* const my_collection_url = msg.url("my_collection:/my_sub_collection/my_instance#my_component");
|
|
46
|
+
* print(my_collection_url); // => url: [my_collection:/my_sub_collection/my_instance#my_component]
|
|
41
47
|
*
|
|
42
|
-
*
|
|
43
|
-
* print(
|
|
48
|
+
* const my_socket_url = msg.url("my_socket:");
|
|
49
|
+
* print(my_socket_url); // => url: [my_collection:]
|
|
44
50
|
* ```
|
|
45
51
|
*/
|
|
46
52
|
function url(urlstring: string): Url;
|
|
@@ -31,6 +31,7 @@ declare global {
|
|
|
31
31
|
*
|
|
32
32
|
* @param url - the particle fx that should start playing.
|
|
33
33
|
* @param emitter_state_function - optional callback function that will be called when an emitter attached to this particlefx changes state.
|
|
34
|
+
*
|
|
34
35
|
* `self`
|
|
35
36
|
* object The current object
|
|
36
37
|
* `id`
|
|
@@ -39,9 +40,13 @@ declare global {
|
|
|
39
40
|
* hash The id of the emitter
|
|
40
41
|
* `state`
|
|
41
42
|
* constant the new state of the emitter:
|
|
43
|
+
*
|
|
42
44
|
* - `particlefx.EMITTER_STATE_SLEEPING`
|
|
45
|
+
*
|
|
43
46
|
* - `particlefx.EMITTER_STATE_PRESPAWN`
|
|
47
|
+
*
|
|
44
48
|
* - `particlefx.EMITTER_STATE_SPAWNING`
|
|
49
|
+
*
|
|
45
50
|
* - `particlefx.EMITTER_STATE_POSTSPAWN`
|
|
46
51
|
* @example
|
|
47
52
|
* ```ts
|
|
@@ -121,6 +126,7 @@ declare global {
|
|
|
121
126
|
*
|
|
122
127
|
* @param url - the particle fx that should stop playing
|
|
123
128
|
* @param options - Options when stopping the particle fx. Supported options:
|
|
129
|
+
*
|
|
124
130
|
* - boolean `clear`: instantly clear spawned particles
|
|
125
131
|
* @example
|
|
126
132
|
* ```ts
|
package/generated/physics.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ declare global {
|
|
|
84
84
|
*
|
|
85
85
|
* @param url - the collision object to return the group of.
|
|
86
86
|
* @returns hash value of the group.
|
|
87
|
+
*
|
|
87
88
|
* `local function check_is_enemy()
|
|
88
89
|
* local group = physics.get_group("#collisionobject")
|
|
89
90
|
* return group == hash("enemy")
|
|
@@ -99,6 +100,7 @@ declare global {
|
|
|
99
100
|
* @param collisionobject - collision object where the joint exist
|
|
100
101
|
* @param joint_id - id of the joint
|
|
101
102
|
* @returns properties table. See the joint types for what fields are available, the only field available for all types is:
|
|
103
|
+
*
|
|
102
104
|
* - boolean `collide_connected`: Set this flag to true if the attached bodies should collide.
|
|
103
105
|
*/
|
|
104
106
|
function get_joint_properties(collisionobject: string | Hash | Url, joint_id: string | Hash): { collide_connected: boolean };
|
|
@@ -129,6 +131,7 @@ declare global {
|
|
|
129
131
|
* @param url - the collision object to check the mask of.
|
|
130
132
|
* @param group - the name of the group to check for.
|
|
131
133
|
* @returns boolean value of the maskbit. 'true' if present, 'false' otherwise.
|
|
134
|
+
*
|
|
132
135
|
* `local function is_invincible()
|
|
133
136
|
* -- check if the collisionobject would collide with the "bullet" group
|
|
134
137
|
* local invincible = physics.get_maskbit("#collisionobject", "bullet")
|
|
@@ -143,24 +146,36 @@ declare global {
|
|
|
143
146
|
* @param url - the collision object.
|
|
144
147
|
* @param shape - the name of the shape to get data for.
|
|
145
148
|
* @returns A table containing meta data about the physics shape
|
|
149
|
+
*
|
|
146
150
|
* `type`
|
|
147
151
|
* number The shape type. Supported values:
|
|
152
|
+
*
|
|
148
153
|
* - `physics.SHAPE_TYPE_SPHERE`
|
|
154
|
+
*
|
|
149
155
|
* - `physics.SHAPE_TYPE_BOX`
|
|
156
|
+
*
|
|
150
157
|
* - `physics.SHAPE_TYPE_CAPSULE` *Only supported for 3D physics*
|
|
158
|
+
*
|
|
151
159
|
* - `physics.SHAPE_TYPE_HULL`
|
|
160
|
+
*
|
|
152
161
|
* The returned table contains different fields depending on which type the shape is.
|
|
153
162
|
* If the shape is a sphere:
|
|
163
|
+
*
|
|
154
164
|
* `diameter`
|
|
155
165
|
* number the diameter of the sphere shape
|
|
166
|
+
*
|
|
156
167
|
* If the shape is a box:
|
|
168
|
+
*
|
|
157
169
|
* `dimensions`
|
|
158
170
|
* vector3 a `vmath.vector3` of the box dimensions
|
|
171
|
+
*
|
|
159
172
|
* If the shape is a capsule:
|
|
173
|
+
*
|
|
160
174
|
* `diameter`
|
|
161
175
|
* number the diameter of the capsule poles
|
|
162
176
|
* `height`
|
|
163
177
|
* number the height of the capsule
|
|
178
|
+
*
|
|
164
179
|
* `local function get_shape_meta()
|
|
165
180
|
* local sphere = physics.get_shape("#collisionobject", "my_sphere_shape")
|
|
166
181
|
* -- returns a table with sphere.diameter
|
|
@@ -181,6 +196,7 @@ declare global {
|
|
|
181
196
|
* @param to - the world position of the end of the ray
|
|
182
197
|
* @param groups - a lua table containing the hashed groups for which to test collisions against
|
|
183
198
|
* @param options - a lua table containing options for the raycast.
|
|
199
|
+
*
|
|
184
200
|
* `all`
|
|
185
201
|
* boolean Set to `true` to return all ray cast hits. If `false`, it will only return the closest hit.
|
|
186
202
|
* @returns It returns a list. If missed it returns `nil`. See ray_cast_response for details on the returned values.
|
|
@@ -213,8 +229,11 @@ declare global {
|
|
|
213
229
|
* Which collision objects to hit is filtered by their collision groups and can be configured
|
|
214
230
|
* through `groups`.
|
|
215
231
|
* The actual ray cast will be performed during the physics-update.
|
|
232
|
+
*
|
|
216
233
|
* - If an object is hit, the result will be reported via a ray_cast_response message.
|
|
234
|
+
*
|
|
217
235
|
* - If there is no object hit, the result will be reported via a ray_cast_missed message.
|
|
236
|
+
*
|
|
218
237
|
* NOTE: Ray casts will ignore collision objects that contain the starting point of the ray. This is a limitation in Box2D.
|
|
219
238
|
*
|
|
220
239
|
* @param from - the world position of the start of the ray
|
|
@@ -250,15 +269,22 @@ declare global {
|
|
|
250
269
|
* Only one physics world event listener can be set at a time.
|
|
251
270
|
*
|
|
252
271
|
* @param callback - A callback that receives an information about all the physics interactions in this physics world.
|
|
272
|
+
*
|
|
253
273
|
* `self`
|
|
254
274
|
* object The calling script
|
|
255
275
|
* `event`
|
|
256
276
|
* constant The type of event. Can be one of these messages:
|
|
277
|
+
*
|
|
257
278
|
* - contact_point_event
|
|
279
|
+
*
|
|
258
280
|
* - collision_event
|
|
281
|
+
*
|
|
259
282
|
* - trigger_event
|
|
283
|
+
*
|
|
260
284
|
* - ray_cast_response
|
|
285
|
+
*
|
|
261
286
|
* - ray_cast_missed
|
|
287
|
+
*
|
|
262
288
|
* `data`
|
|
263
289
|
* table The callback value data is a table that contains event-related data. See the documentation for details on the messages.
|
|
264
290
|
* @example
|
|
@@ -368,6 +394,7 @@ declare global {
|
|
|
368
394
|
*
|
|
369
395
|
* @param url - the collision object affected.
|
|
370
396
|
* @param group - the new group name to be assigned.
|
|
397
|
+
*
|
|
371
398
|
* `local function change_collision_group()
|
|
372
399
|
* physics.set_group("#collisionobject", "enemy")
|
|
373
400
|
* end
|
|
@@ -407,6 +434,7 @@ declare global {
|
|
|
407
434
|
* @param url - the collision object to change the mask of.
|
|
408
435
|
* @param group - the name of the group (maskbit) to modify in the mask.
|
|
409
436
|
* @param maskbit - boolean value of the new maskbit. 'true' to enable, 'false' to disable.
|
|
437
|
+
*
|
|
410
438
|
* `local function make_invincible()
|
|
411
439
|
* -- no longer collide with the "bullet" group
|
|
412
440
|
* physics.set_maskbit("#collisionobject", "bullet", false)
|
|
@@ -423,6 +451,7 @@ declare global {
|
|
|
423
451
|
* @param shape - the name of the shape to get data for.
|
|
424
452
|
* @param table - the shape data to update the shape with.
|
|
425
453
|
* See physics.get_shape for a detailed description of each field in the data table.
|
|
454
|
+
*
|
|
426
455
|
* `local function set_shape_data()
|
|
427
456
|
* -- set capsule shape data
|
|
428
457
|
* local data = {}
|
|
@@ -430,11 +459,13 @@ declare global {
|
|
|
430
459
|
* data.diameter = 10
|
|
431
460
|
* data.height = 20
|
|
432
461
|
* physics.set_shape("#collisionobject", "my_capsule_shape", data)
|
|
462
|
+
*
|
|
433
463
|
* -- set sphere shape data
|
|
434
464
|
* data = {}
|
|
435
465
|
* data.type = physics.SHAPE_TYPE_SPHERE
|
|
436
466
|
* data.diameter = 10
|
|
437
467
|
* physics.set_shape("#collisionobject", "my_sphere_shape", data)
|
|
468
|
+
*
|
|
438
469
|
* -- set box shape data
|
|
439
470
|
* data = {}
|
|
440
471
|
* data.type = physics.SHAPE_TYPE_BOX
|
|
@@ -477,6 +508,7 @@ declare global {
|
|
|
477
508
|
* efficiency reasons. This function wakes them up.
|
|
478
509
|
*
|
|
479
510
|
* @param url - the collision object to wake.
|
|
511
|
+
*
|
|
480
512
|
* `function on_input(self, action_id, action)
|
|
481
513
|
* if action_id == hash("test") and action.pressed then
|
|
482
514
|
* physics.wakeup("#collisionobject")
|
package/generated/profiler.d.ts
CHANGED
|
@@ -82,15 +82,20 @@ declare global {
|
|
|
82
82
|
* Get the amount of memory used (resident/working set) by the application in bytes, as reported by the OS.
|
|
83
83
|
* This function is not available on HTML5.
|
|
84
84
|
* The values are gathered from internal OS functions which correspond to the following;
|
|
85
|
+
*
|
|
85
86
|
* OS
|
|
86
87
|
* Value
|
|
88
|
+
*
|
|
87
89
|
* iOS
|
|
88
90
|
* MacOS
|
|
91
|
+
*
|
|
89
92
|
* Android
|
|
90
93
|
* Linux
|
|
91
94
|
* Resident memory
|
|
95
|
+
*
|
|
92
96
|
* Windows
|
|
93
97
|
* Working set
|
|
98
|
+
*
|
|
94
99
|
* HTML5
|
|
95
100
|
* Not available
|
|
96
101
|
*
|
|
@@ -148,10 +153,15 @@ declare global {
|
|
|
148
153
|
* Set the on-screen profile mode - run, pause, record or show peak frame
|
|
149
154
|
*
|
|
150
155
|
* @param mode - the mode to set the ui profiler in
|
|
156
|
+
*
|
|
151
157
|
* - `profiler.MODE_RUN` This is default mode that continously shows the last frame
|
|
158
|
+
*
|
|
152
159
|
* - `profiler.MODE_PAUSE` Pauses on the currently displayed frame
|
|
160
|
+
*
|
|
153
161
|
* - `profiler.MODE_SHOW_PEAK_FRAME` Pauses on the currently displayed frame but shows a new frame if that frame is slower
|
|
162
|
+
*
|
|
154
163
|
* - `profiler.MODE_RECORD` Records all incoming frames to the recording buffer
|
|
164
|
+
*
|
|
155
165
|
* To stop recording, switch to a different mode such as `MODE_PAUSE` or `MODE_RUN`.
|
|
156
166
|
* You can also use the `view_recorded_frame` function to display a recorded frame. Doing so stops the recording as well.
|
|
157
167
|
* Every time you switch to recording mode the recording buffer is cleared.
|
|
@@ -171,7 +181,9 @@ declare global {
|
|
|
171
181
|
* Set the on-screen profile view mode - minimized or expanded
|
|
172
182
|
*
|
|
173
183
|
* @param mode - the view mode to set the ui profiler in
|
|
184
|
+
*
|
|
174
185
|
* - `profiler.VIEW_MODE_FULL` The default mode which displays all the ui profiler details
|
|
186
|
+
*
|
|
175
187
|
* - `profiler.VIEW_MODE_MINIMIZED` Minimized mode which only shows the top header (fps counters and ui profiler mode)
|
|
176
188
|
* @example
|
|
177
189
|
* ```ts
|
|
@@ -205,7 +217,9 @@ declare global {
|
|
|
205
217
|
* The frame to show can either be an absolute frame or a relative frame to the current frame.
|
|
206
218
|
*
|
|
207
219
|
* @param frame_index - a table where you specify one of the following parameters:
|
|
220
|
+
*
|
|
208
221
|
* - `distance` The offset from the currently displayed frame (this is truncated between zero and the number of recorded frames)
|
|
222
|
+
*
|
|
209
223
|
* - `frame` The frame index in the recording buffer (1 is first recorded frame)
|
|
210
224
|
* @example
|
|
211
225
|
* ```ts
|