@defold-typescript/types 0.39.0 → 0.40.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 +117 -0
- package/api-signatures.json +262 -237
- package/examples/translations.json +81 -81
- package/generated/b2d_shape.d.ts +23 -1
- package/generated/buffer.d.ts +18 -15
- package/generated/camera.d.ts +2 -2
- package/generated/collectionfactory.d.ts +12 -10
- package/generated/collectionproxy.d.ts +1 -1
- package/generated/compute.d.ts +1 -1
- package/generated/go.d.ts +9 -5
- package/generated/graphics.d.ts +52 -0
- package/generated/gui.d.ts +53 -32
- package/generated/html5.d.ts +3 -1
- package/generated/http.d.ts +4 -2
- package/generated/image.d.ts +24 -15
- package/generated/kinds/gui-script.d.ts +1 -0
- package/generated/kinds/render-script.d.ts +1 -0
- package/generated/kinds/script.d.ts +1 -0
- package/generated/material.d.ts +1 -1
- package/generated/model.d.ts +32 -3
- package/generated/physics.d.ts +13 -11
- package/generated/profiler.d.ts +1 -1
- package/generated/render.d.ts +72 -15
- package/generated/resource.d.ts +100 -69
- package/generated/socket.d.ts +23 -13
- package/generated/sound.d.ts +3 -3
- package/generated/sprite.d.ts +9 -1
- package/generated/sys.d.ts +34 -23
- package/generated/versions/defold-1.12.4/buffer.d.ts +18 -15
- package/generated/versions/defold-1.12.4/camera.d.ts +2 -2
- package/generated/versions/defold-1.12.4/collectionfactory.d.ts +12 -10
- package/generated/versions/defold-1.12.4/go.d.ts +9 -5
- package/generated/versions/defold-1.12.4/gui.d.ts +47 -31
- package/generated/versions/defold-1.12.4/html5.d.ts +3 -1
- package/generated/versions/defold-1.12.4/http.d.ts +4 -2
- package/generated/versions/defold-1.12.4/image.d.ts +24 -15
- package/generated/versions/defold-1.12.4/index.d.ts +1 -0
- package/generated/versions/defold-1.12.4/model.d.ts +32 -3
- package/generated/versions/defold-1.12.4/physics.d.ts +13 -11
- package/generated/versions/defold-1.12.4/profiler.d.ts +1 -1
- package/generated/versions/defold-1.12.4/render.d.ts +72 -15
- package/generated/versions/defold-1.12.4/resource.d.ts +100 -69
- package/generated/versions/defold-1.12.4/socket.d.ts +23 -13
- package/generated/versions/defold-1.12.4/sound.d.ts +3 -3
- package/generated/versions/defold-1.12.4/sprite.d.ts +9 -1
- package/generated/versions/defold-1.12.4/sys.d.ts +34 -23
- package/generated/versions/defold-1.12.4/vmath.d.ts +5 -5
- package/generated/versions/defold-1.13.0/b2d_shape.d.ts +23 -1
- package/generated/versions/defold-1.13.0/buffer.d.ts +18 -15
- package/generated/versions/defold-1.13.0/camera.d.ts +2 -2
- package/generated/versions/defold-1.13.0/collectionfactory.d.ts +12 -10
- package/generated/versions/defold-1.13.0/compute.d.ts +1 -1
- package/generated/versions/defold-1.13.0/go.d.ts +9 -5
- package/generated/versions/defold-1.13.0/graphics.d.ts +48 -0
- package/generated/versions/defold-1.13.0/gui.d.ts +47 -31
- package/generated/versions/defold-1.13.0/html5.d.ts +3 -1
- package/generated/versions/defold-1.13.0/http.d.ts +4 -2
- package/generated/versions/defold-1.13.0/image.d.ts +24 -15
- package/generated/versions/defold-1.13.0/index.d.ts +1 -0
- package/generated/versions/defold-1.13.0/material.d.ts +1 -1
- package/generated/versions/defold-1.13.0/model.d.ts +32 -3
- package/generated/versions/defold-1.13.0/physics.d.ts +13 -11
- package/generated/versions/defold-1.13.0/profiler.d.ts +1 -1
- package/generated/versions/defold-1.13.0/render.d.ts +72 -15
- package/generated/versions/defold-1.13.0/resource.d.ts +100 -69
- package/generated/versions/defold-1.13.0/socket.d.ts +23 -13
- package/generated/versions/defold-1.13.0/sound.d.ts +3 -3
- package/generated/versions/defold-1.13.0/sprite.d.ts +9 -1
- package/generated/versions/defold-1.13.0/sys.d.ts +34 -23
- package/generated/versions/defold-1.13.0/vmath.d.ts +5 -5
- package/generated/vmath.d.ts +5 -5
- package/index.d.ts +1 -0
- package/package.json +1 -1
- package/scripts/generate-api-signatures.ts +2 -1
- package/scripts/prose-constants.ts +96 -0
- package/scripts/regen.ts +6 -2
- package/src/component-properties.d.ts +33 -0
- package/src/core-types.ts +4 -2
- package/src/custom-messages.d.ts +4 -3
- package/src/doc-comment.ts +35 -12
- package/src/emit-dts.ts +457 -47
- package/src/engine-globals.d.ts +2 -2
- package/src/go-overloads.d.ts +11 -10
- package/src/index.ts +4 -0
- package/src/param-correction-provenance.ts +67 -0
- package/src/render-overloads.d.ts +15 -0
- package/src/script-api.ts +3 -1
package/generated/b2d_shape.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ declare global {
|
|
|
47
47
|
* @returns true if contact events are enabled
|
|
48
48
|
*/
|
|
49
49
|
function are_contact_events_enabled(shape_id: Opaque<"b2Shape">): boolean;
|
|
50
|
+
function are_contact_events_enabled(body: Opaque<"b2Body">, shape_index: number): boolean;
|
|
50
51
|
/**
|
|
51
52
|
* Check if hit events are enabled for a shape.
|
|
52
53
|
*
|
|
@@ -54,6 +55,7 @@ declare global {
|
|
|
54
55
|
* @returns true if hit events are enabled
|
|
55
56
|
*/
|
|
56
57
|
function are_hit_events_enabled(shape_id: Opaque<"b2Shape">): boolean;
|
|
58
|
+
function are_hit_events_enabled(body: Opaque<"b2Body">, shape_index: number): boolean;
|
|
57
59
|
/**
|
|
58
60
|
* Check if pre-solve events are enabled for a shape.
|
|
59
61
|
*
|
|
@@ -61,6 +63,7 @@ declare global {
|
|
|
61
63
|
* @returns true if pre-solve events are enabled
|
|
62
64
|
*/
|
|
63
65
|
function are_pre_solve_events_enabled(shape_id: Opaque<"b2Shape">): boolean;
|
|
66
|
+
function are_pre_solve_events_enabled(body: Opaque<"b2Body">, shape_index: number): boolean;
|
|
64
67
|
/**
|
|
65
68
|
* Check if sensor events are enabled for a shape.
|
|
66
69
|
*
|
|
@@ -68,6 +71,7 @@ declare global {
|
|
|
68
71
|
* @returns true if sensor events are enabled
|
|
69
72
|
*/
|
|
70
73
|
function are_sensor_events_enabled(shape_id: Opaque<"b2Shape">): boolean;
|
|
74
|
+
function are_sensor_events_enabled(body: Opaque<"b2Body">, shape_index: number): boolean;
|
|
71
75
|
/**
|
|
72
76
|
* Enable or disable contact events for a shape.
|
|
73
77
|
*
|
|
@@ -75,6 +79,7 @@ declare global {
|
|
|
75
79
|
* @param enable - true to enable contact events
|
|
76
80
|
*/
|
|
77
81
|
function enable_contact_events(shape_id: Opaque<"b2Shape">, enable: boolean): void;
|
|
82
|
+
function enable_contact_events(body: Opaque<"b2Body">, shape_index: number, enable: boolean): void;
|
|
78
83
|
/**
|
|
79
84
|
* Enable or disable hit events for a shape.
|
|
80
85
|
*
|
|
@@ -82,6 +87,7 @@ declare global {
|
|
|
82
87
|
* @param enable - true to enable hit events
|
|
83
88
|
*/
|
|
84
89
|
function enable_hit_events(shape_id: Opaque<"b2Shape">, enable: boolean): void;
|
|
90
|
+
function enable_hit_events(body: Opaque<"b2Body">, shape_index: number, enable: boolean): void;
|
|
85
91
|
/**
|
|
86
92
|
* Enable or disable pre-solve events for a shape.
|
|
87
93
|
*
|
|
@@ -89,6 +95,7 @@ declare global {
|
|
|
89
95
|
* @param enable - true to enable pre-solve events
|
|
90
96
|
*/
|
|
91
97
|
function enable_pre_solve_events(shape_id: Opaque<"b2Shape">, enable: boolean): void;
|
|
98
|
+
function enable_pre_solve_events(body: Opaque<"b2Body">, shape_index: number, enable: boolean): void;
|
|
92
99
|
/**
|
|
93
100
|
* Enable or disable sensor events for a shape.
|
|
94
101
|
*
|
|
@@ -96,6 +103,7 @@ declare global {
|
|
|
96
103
|
* @param enable - true to enable sensor events
|
|
97
104
|
*/
|
|
98
105
|
function enable_sensor_events(shape_id: Opaque<"b2Shape">, enable: boolean): void;
|
|
106
|
+
function enable_sensor_events(body: Opaque<"b2Body">, shape_index: number, enable: boolean): void;
|
|
99
107
|
/**
|
|
100
108
|
* Get the body owning a shape.
|
|
101
109
|
*
|
|
@@ -103,6 +111,7 @@ declare global {
|
|
|
103
111
|
* @returns owning body
|
|
104
112
|
*/
|
|
105
113
|
function get_body(shape_id: Opaque<"b2Shape">): Opaque<"b2Body">;
|
|
114
|
+
function get_body(body: Opaque<"b2Body">, shape_index: number): Opaque<"b2Body">;
|
|
106
115
|
/**
|
|
107
116
|
* Get the closest point on a shape.
|
|
108
117
|
*
|
|
@@ -111,6 +120,7 @@ declare global {
|
|
|
111
120
|
* @returns closest world point on the shape
|
|
112
121
|
*/
|
|
113
122
|
function get_closest_point(shape_id: Opaque<"b2Shape">, target: Vector3): Vector3;
|
|
123
|
+
function get_closest_point(body: Opaque<"b2Body">, shape_index: number, target: Vector3): Vector3;
|
|
114
124
|
/**
|
|
115
125
|
* Get shape contact capacity.
|
|
116
126
|
*
|
|
@@ -118,6 +128,7 @@ declare global {
|
|
|
118
128
|
* @returns maximum contact data count
|
|
119
129
|
*/
|
|
120
130
|
function get_contact_capacity(shape_id: Opaque<"b2Shape">): number;
|
|
131
|
+
function get_contact_capacity(body: Opaque<"b2Body">, shape_index: number): number;
|
|
121
132
|
/**
|
|
122
133
|
* Get touching contact data for a shape.
|
|
123
134
|
*
|
|
@@ -125,6 +136,7 @@ declare global {
|
|
|
125
136
|
* @returns array of contact tables
|
|
126
137
|
*/
|
|
127
138
|
function get_contact_data(shape_id: Opaque<"b2Shape">): Record<string | number, unknown>;
|
|
139
|
+
function get_contact_data(body: Opaque<"b2Body">, shape_index: number): Record<string | number, unknown>;
|
|
128
140
|
/**
|
|
129
141
|
* Get mass data for a shape.
|
|
130
142
|
*
|
|
@@ -132,6 +144,7 @@ declare global {
|
|
|
132
144
|
* @returns table with `mass`, `center`, and `inertia`
|
|
133
145
|
*/
|
|
134
146
|
function get_mass_data(shape_id: Opaque<"b2Shape">): { mass: number; center: Vector3; inertia: number };
|
|
147
|
+
function get_mass_data(body: Opaque<"b2Body">, shape_index: number): { mass: number; center: Vector3; inertia: number };
|
|
135
148
|
/**
|
|
136
149
|
* Get shape material id.
|
|
137
150
|
*
|
|
@@ -139,6 +152,7 @@ declare global {
|
|
|
139
152
|
* @returns shape material id
|
|
140
153
|
*/
|
|
141
154
|
function get_material(shape_id: Opaque<"b2Shape">): number;
|
|
155
|
+
function get_material(body: Opaque<"b2Body">, shape_index: number): number;
|
|
142
156
|
/**
|
|
143
157
|
* Get sensor overlap capacity.
|
|
144
158
|
*
|
|
@@ -146,6 +160,7 @@ declare global {
|
|
|
146
160
|
* @returns maximum sensor overlap count
|
|
147
161
|
*/
|
|
148
162
|
function get_sensor_capacity(shape_id: Opaque<"b2Shape">): number;
|
|
163
|
+
function get_sensor_capacity(body: Opaque<"b2Body">, shape_index: number): number;
|
|
149
164
|
/**
|
|
150
165
|
* Get sensor overlaps.
|
|
151
166
|
*
|
|
@@ -153,6 +168,7 @@ declare global {
|
|
|
153
168
|
* @returns array of shape info tables
|
|
154
169
|
*/
|
|
155
170
|
function get_sensor_overlaps(shape_id: Opaque<"b2Shape">): { shape_id: number }[];
|
|
171
|
+
function get_sensor_overlaps(body: Opaque<"b2Body">, shape_index: number): { shape_id: number }[];
|
|
156
172
|
/**
|
|
157
173
|
* Get a shape's geometry.
|
|
158
174
|
*
|
|
@@ -160,6 +176,7 @@ declare global {
|
|
|
160
176
|
* @returns shape table with numeric `type` from `b2d.shape.SHAPE_TYPE_*`
|
|
161
177
|
*/
|
|
162
178
|
function get_shape(shape_id: Opaque<"b2Shape">): { type: number; radius?: number; center?: Vector3; v0?: Vector3; v1?: Vector3; v2?: Vector3; v3?: Vector3; vertices?: Vector3[]; hx?: number; hy?: number; angle?: number; loop?: boolean; prev_vertex?: Vector3; next_vertex?: Vector3 };
|
|
179
|
+
function get_shape(body: Opaque<"b2Body">, shape_index: number): { type: number; radius?: number; center?: Vector3; v0?: Vector3; v1?: Vector3; v2?: Vector3; v3?: Vector3; vertices?: Vector3[]; hx?: number; hy?: number; angle?: number; loop?: boolean; prev_vertex?: Vector3; next_vertex?: Vector3 };
|
|
163
180
|
/**
|
|
164
181
|
* Get the world owning a shape.
|
|
165
182
|
*
|
|
@@ -167,6 +184,7 @@ declare global {
|
|
|
167
184
|
* @returns owning world
|
|
168
185
|
*/
|
|
169
186
|
function get_world(shape_id: Opaque<"b2Shape">): Opaque<"b2World">;
|
|
187
|
+
function get_world(body: Opaque<"b2Body">, shape_index: number): Opaque<"b2World">;
|
|
170
188
|
/**
|
|
171
189
|
* Validate a shape handle.
|
|
172
190
|
*
|
|
@@ -174,6 +192,7 @@ declare global {
|
|
|
174
192
|
* @returns true if the shape handle still refers to a live Box2D shape
|
|
175
193
|
*/
|
|
176
194
|
function is_valid(shape_id: Opaque<"b2Shape">): boolean;
|
|
195
|
+
function is_valid(body: Opaque<"b2Body">, shape_index: number): boolean;
|
|
177
196
|
/**
|
|
178
197
|
* Ray cast a shape directly.
|
|
179
198
|
*
|
|
@@ -184,6 +203,7 @@ declare global {
|
|
|
184
203
|
* @returns hit table with `point`, `normal`, `fraction`, and `iterations`, or nil
|
|
185
204
|
*/
|
|
186
205
|
function ray_cast(shape_id: Opaque<"b2Shape">, origin: Vector3, translation: Vector3, max_fraction?: number): { point: Vector3; normal: Vector3; fraction: number; iterations: number };
|
|
206
|
+
function ray_cast(body: Opaque<"b2Body">, shape_index: number, origin: Vector3, translation: Vector3, max_fraction?: number): { point: Vector3; normal: Vector3; fraction: number; iterations: number };
|
|
187
207
|
/**
|
|
188
208
|
* Set shape material id.
|
|
189
209
|
*
|
|
@@ -191,6 +211,7 @@ declare global {
|
|
|
191
211
|
* @param material - shape material id
|
|
192
212
|
*/
|
|
193
213
|
function set_material(shape_id: Opaque<"b2Shape">, material: number): void;
|
|
214
|
+
function set_material(body: Opaque<"b2Body">, shape_index: number, material: number): void;
|
|
194
215
|
/**
|
|
195
216
|
* This updates the shape geometry using the same table format as
|
|
196
217
|
* `b2d.body.create_shape` and `b2d.shape.get_shape`. The body mass is not
|
|
@@ -210,7 +231,8 @@ declare global {
|
|
|
210
231
|
* }
|
|
211
232
|
* ```
|
|
212
233
|
*/
|
|
213
|
-
function set_shape(shape_id: Opaque<"b2Shape">, definition: { type?: number; radius?: number; center?: Vector3; v0?: Vector3; v1?: Vector3; v2?: Vector3; v3?: Vector3; vertices?: Vector3[]; hx?: number; hy?: number; angle?: number; loop?: boolean; prev_vertex?: Vector3; next_vertex?: Vector3 }, update_mass
|
|
234
|
+
function set_shape(shape_id: Opaque<"b2Shape">, definition: { type?: number; radius?: number; center?: Vector3; v0?: Vector3; v1?: Vector3; v2?: Vector3; v3?: Vector3; vertices?: Vector3[]; hx?: number; hy?: number; angle?: number; loop?: boolean; prev_vertex?: Vector3; next_vertex?: Vector3 }, update_mass?: boolean): void;
|
|
235
|
+
function set_shape(body: Opaque<"b2Body">, shape_index: number, definition: { type?: number; radius?: number; center?: Vector3; v0?: Vector3; v1?: Vector3; v2?: Vector3; v3?: Vector3; vertices?: Vector3[]; hx?: number; hy?: number; angle?: number; loop?: boolean; prev_vertex?: Vector3; next_vertex?: Vector3 }, update_mass?: boolean): void;
|
|
214
236
|
}
|
|
215
237
|
}
|
|
216
238
|
|
package/generated/buffer.d.ts
CHANGED
|
@@ -88,10 +88,10 @@ declare global {
|
|
|
88
88
|
* // copy entire stream
|
|
89
89
|
* const srcstream = buffer.get_stream(srcbuffer, hash("xyz"));
|
|
90
90
|
* const dststream = buffer.get_stream(dstbuffer, hash("xyz"));
|
|
91
|
-
* buffer.copy_stream(dststream, 0, srcstream, 0, srcstream.length);
|
|
91
|
+
* buffer.copy_stream(dststream, 0, srcstream, 0, srcstream.length());
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
|
-
function copy_stream(dst: Opaque<"bufferstream"> & { [index: number]: number }, dstoffset: number, src: Opaque<"bufferstream"> & { [index: number]: number }, srcoffset: number, count: number): void;
|
|
94
|
+
function copy_stream(dst: Opaque<"bufferstream"> & { [index: number]: number; length: LuaLengthMethod<number> }, dstoffset: number, src: Opaque<"bufferstream"> & { [index: number]: number; length: LuaLengthMethod<number> }, srcoffset: number, count: number): void;
|
|
95
95
|
/**
|
|
96
96
|
* Create a new data buffer containing a specified set of streams. A data buffer
|
|
97
97
|
* can contain one or more streams with typed data. This is useful for managing
|
|
@@ -111,24 +111,27 @@ declare global {
|
|
|
111
111
|
* ```ts
|
|
112
112
|
* // How to create and initialize a buffer
|
|
113
113
|
* export default defineScript({
|
|
114
|
-
* init(
|
|
114
|
+
* init() {
|
|
115
115
|
* const size = 128;
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
116
|
+
* const [width, height] = [size, size];
|
|
117
|
+
* const [r, g, b] = [0xff, 0x80, 0x10];
|
|
118
|
+
* const image = buffer.create(size * size, [{ name: hash("rgb"), type: buffer.VALUE_TYPE_UINT8, count: 3 }]);
|
|
119
|
+
* const imagestream = buffer.get_stream(image, hash("rgb"));
|
|
120
|
+
*
|
|
121
|
+
* for (let y = 0; y < height; y++) {
|
|
122
|
+
* for (let x = 0; x < width; x++) {
|
|
123
|
+
* const index = y * width * 3 + x * 3;
|
|
124
|
+
* imagestream[index + 0] = r;
|
|
125
|
+
* imagestream[index + 1] = g;
|
|
126
|
+
* imagestream[index + 2] = b;
|
|
125
127
|
* }
|
|
126
128
|
* }
|
|
129
|
+
* return { image, imagestream };
|
|
127
130
|
* },
|
|
128
131
|
* });
|
|
129
132
|
* ```
|
|
130
133
|
*/
|
|
131
|
-
function create(element_count: number, declaration: { name?: Hash | string; type?:
|
|
134
|
+
function create(element_count: number, declaration: { name?: Hash | string; type?: buffer.ValueType; count?: number }[]): Opaque<"buffer">;
|
|
132
135
|
/**
|
|
133
136
|
* Get a copy of all the bytes from a specified stream as a Lua string.
|
|
134
137
|
*
|
|
@@ -136,7 +139,7 @@ declare global {
|
|
|
136
139
|
* @param stream_name - the name of the stream
|
|
137
140
|
* @returns the buffer data as a Lua string
|
|
138
141
|
*/
|
|
139
|
-
function get_bytes(buffer: Opaque<"buffer">, stream_name: Hash): string;
|
|
142
|
+
function get_bytes(buffer: Opaque<"buffer">, stream_name: Hash | string): string;
|
|
140
143
|
/**
|
|
141
144
|
* Get a named metadata entry from a buffer along with its type.
|
|
142
145
|
*
|
|
@@ -160,7 +163,7 @@ declare global {
|
|
|
160
163
|
* @param stream_name - the stream name
|
|
161
164
|
* @returns the data stream
|
|
162
165
|
*/
|
|
163
|
-
function get_stream(buffer: Opaque<"buffer">, stream_name: Hash | string): Opaque<"bufferstream"> & { [index: number]: number };
|
|
166
|
+
function get_stream(buffer: Opaque<"buffer">, stream_name: Hash | string): Opaque<"bufferstream"> & { [index: number]: number; length: LuaLengthMethod<number> };
|
|
164
167
|
/**
|
|
165
168
|
* Creates or updates a metadata array entry on a buffer.
|
|
166
169
|
* The value type and count given when updating the entry should match those used when first creating it.
|
package/generated/camera.d.ts
CHANGED
|
@@ -137,7 +137,7 @@ declare global {
|
|
|
137
137
|
* export default defineScript({
|
|
138
138
|
* on_input(self, action_id, action) {
|
|
139
139
|
* if (action_id === hash("touch")) {
|
|
140
|
-
* if (action.pressed) {
|
|
140
|
+
* if (action.pressed && action.screen_x !== undefined && action.screen_y !== undefined) {
|
|
141
141
|
* const perspective_camera = msg.url("#perspective_camera");
|
|
142
142
|
* const random_z = math.random(
|
|
143
143
|
* camera.get_near_z(perspective_camera) + 0.01,
|
|
@@ -169,7 +169,7 @@ declare global {
|
|
|
169
169
|
* export default defineScript({
|
|
170
170
|
* on_input(self, action_id, action) {
|
|
171
171
|
* if (action_id === hash("touch")) {
|
|
172
|
-
* if (action.pressed) {
|
|
172
|
+
* if (action.pressed && action.screen_x !== undefined && action.screen_y !== undefined) {
|
|
173
173
|
* const world_position = camera.screen_xy_to_world(action.screen_x, action.screen_y);
|
|
174
174
|
* go.set_position(world_position, "/go1");
|
|
175
175
|
* }
|
|
@@ -46,18 +46,17 @@ declare global {
|
|
|
46
46
|
* ```ts
|
|
47
47
|
* // How to spawn a collection of game objects:
|
|
48
48
|
* export default defineScript({
|
|
49
|
-
* init(
|
|
49
|
+
* init() {
|
|
50
50
|
* // Spawn a small group of enemies.
|
|
51
51
|
* const pos = vmath.vector3(100, 12.5, 0);
|
|
52
52
|
* const rot = vmath.quat_rotation_z(Math.PI / 2);
|
|
53
53
|
* const scale = 0.5;
|
|
54
|
-
* const props =
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* };
|
|
54
|
+
* const props = new LuaMap<Hash, Record<string, unknown>>();
|
|
55
|
+
* props.set(hash("/enemy_leader"), { health: 1000.0 });
|
|
56
|
+
* props.set(hash("/enemy_1"), { health: 200.0 });
|
|
57
|
+
* props.set(hash("/enemy_2"), { health: 400.0, color: hash("green") });
|
|
59
58
|
*
|
|
60
|
-
*
|
|
59
|
+
* const enemy_ids = collectionfactory.create("#enemyfactory", pos, rot, props, scale);
|
|
61
60
|
* // enemy_ids now map to the spawned instance ids:
|
|
62
61
|
* //
|
|
63
62
|
* // pprint(self.enemy_ids)
|
|
@@ -70,8 +69,11 @@ declare global {
|
|
|
70
69
|
* // }
|
|
71
70
|
*
|
|
72
71
|
* // Send "attack" message to the leader. First look up its instance id.
|
|
73
|
-
* const leader_id =
|
|
74
|
-
*
|
|
72
|
+
* const leader_id = enemy_ids.get(hash("/enemy_leader"));
|
|
73
|
+
* if (leader_id !== undefined) {
|
|
74
|
+
* msg.post(leader_id, "attack");
|
|
75
|
+
* }
|
|
76
|
+
* return { enemy_ids };
|
|
75
77
|
* },
|
|
76
78
|
* });
|
|
77
79
|
*
|
|
@@ -81,7 +83,7 @@ declare global {
|
|
|
81
83
|
* }
|
|
82
84
|
* ```
|
|
83
85
|
*/
|
|
84
|
-
function create(url: string | Hash | Url, position?: Vector3, rotation?: Quaternion, properties?: Record<string | number, unknown
|
|
86
|
+
function create(url: string | Hash | Url, position?: Vector3, rotation?: Quaternion, properties?: LuaMap<Hash, Record<string | number, unknown>> | Record<string, Record<string | number, unknown>>, scale?: number | Vector3): LuaMap<Hash, Hash>;
|
|
85
87
|
/**
|
|
86
88
|
* This returns status of the collection factory.
|
|
87
89
|
* Calling this function when the factory is not marked as dynamic loading always returns COMP_COLLECTION_FACTORY_STATUS_LOADED.
|
|
@@ -62,7 +62,7 @@ declare global {
|
|
|
62
62
|
* });
|
|
63
63
|
* ```
|
|
64
64
|
*/
|
|
65
|
-
function load(url: string | Hash | Url, options: Record<string | number, unknown> | undefined, callback: (self: unknown, message_id:
|
|
65
|
+
function load(url: string | Hash | Url, options: Record<string | number, unknown> | undefined, callback: (self: unknown, message_id: Hash, message: Record<string | number, unknown>, sender: Url) => void): void;
|
|
66
66
|
/**
|
|
67
67
|
* The collection should be loaded by the collection proxy.
|
|
68
68
|
* Setting the collection to "nil" will revert it back to the original collection.
|
package/generated/compute.d.ts
CHANGED
|
@@ -299,7 +299,7 @@ declare global {
|
|
|
299
299
|
* compute.set_textures("/my_compute.computec", { my_texture: resource.texture() });
|
|
300
300
|
* ```
|
|
301
301
|
*/
|
|
302
|
-
function set_textures(path: Hash | string, textures: LuaMap<string, Hash>): void;
|
|
302
|
+
function set_textures(path: Hash | string, textures: LuaMap<string, Hash> | Record<string, Hash>): void;
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
|
package/generated/go.d.ts
CHANGED
|
@@ -321,7 +321,7 @@ declare global {
|
|
|
321
321
|
* go.delete(ids, true);
|
|
322
322
|
* ```
|
|
323
323
|
*/
|
|
324
|
-
function _delete(id?: SceneGameObjectAddress | Hash | Url | (SceneGameObjectAddress | Hash | Url)[], recursive?: boolean): void;
|
|
324
|
+
function _delete(id?: SceneGameObjectAddress | Hash | Url | (SceneGameObjectAddress | Hash | Url)[] | boolean, recursive?: boolean): void;
|
|
325
325
|
/**
|
|
326
326
|
* This function can check for game objects in any collection by specifying
|
|
327
327
|
* the collection name in the URL.
|
|
@@ -349,6 +349,10 @@ declare global {
|
|
|
349
349
|
* @example
|
|
350
350
|
* ```ts
|
|
351
351
|
* export default defineScript({
|
|
352
|
+
* init() {
|
|
353
|
+
* return { some_value: 0 };
|
|
354
|
+
* },
|
|
355
|
+
*
|
|
352
356
|
* final(self) {
|
|
353
357
|
* // report finalization
|
|
354
358
|
* msg.post("my_friend_instance", "im_dead", { my_stats: self.some_value });
|
|
@@ -791,7 +795,7 @@ declare global {
|
|
|
791
795
|
* self.velocity = vmath.vector3();
|
|
792
796
|
* } else {
|
|
793
797
|
* // update velocity
|
|
794
|
-
* self.velocity = vmath.vector3(action.value * self.max_speed, 0, 0);
|
|
798
|
+
* self.velocity = vmath.vector3((action.value ?? 0) * self.max_speed, 0, 0);
|
|
795
799
|
* }
|
|
796
800
|
* }
|
|
797
801
|
* },
|
|
@@ -833,12 +837,12 @@ declare global {
|
|
|
833
837
|
* init() {
|
|
834
838
|
* // store the url of instance "a" for later use, by specifying undefined as socket we
|
|
835
839
|
* // automatically use our own socket
|
|
836
|
-
* return { a_url: msg.url(undefined, go.get_id("a"), "script") };
|
|
840
|
+
* return { a_url: msg.url(undefined, go.get_id("a"), "script"), important_value: 0 };
|
|
837
841
|
* },
|
|
838
842
|
*
|
|
839
843
|
* on_message(self, message_id, message, sender) {
|
|
840
844
|
* // check message and sender
|
|
841
|
-
* if (message_id === hash("my_data") && sender === self.a_url) {
|
|
845
|
+
* if (message_id === hash("my_data") && sender === self.a_url && typeof message.important_value === "number") {
|
|
842
846
|
* // use the data in some way
|
|
843
847
|
* self.important_value = message.important_value;
|
|
844
848
|
* }
|
|
@@ -880,7 +884,7 @@ declare global {
|
|
|
880
884
|
* self.velocity = vmath.vector3();
|
|
881
885
|
* } else {
|
|
882
886
|
* // update velocity
|
|
883
|
-
* self.velocity = vmath.vector3(action.value * self.max_speed, 0, 0);
|
|
887
|
+
* self.velocity = vmath.vector3((action.value ?? 0) * self.max_speed, 0, 0);
|
|
884
888
|
* }
|
|
885
889
|
* }
|
|
886
890
|
* },
|
package/generated/graphics.d.ts
CHANGED
|
@@ -95,6 +95,58 @@ declare global {
|
|
|
95
95
|
const FACE_TYPE_BACK: number & { readonly __brand: "graphics.FACE_TYPE_BACK" };
|
|
96
96
|
const FACE_TYPE_FRONT: number & { readonly __brand: "graphics.FACE_TYPE_FRONT" };
|
|
97
97
|
const FACE_TYPE_FRONT_AND_BACK: number & { readonly __brand: "graphics.FACE_TYPE_FRONT_AND_BACK" };
|
|
98
|
+
/**
|
|
99
|
+
* Vertex attribute semantic type, for `material.set_vertex_attributes`.
|
|
100
|
+
*/
|
|
101
|
+
const SEMANTIC_TYPE_BONE_INDICES: number & { readonly __brand: "graphics.SEMANTIC_TYPE_BONE_INDICES" };
|
|
102
|
+
/**
|
|
103
|
+
* Vertex attribute semantic type, for `material.set_vertex_attributes`.
|
|
104
|
+
*/
|
|
105
|
+
const SEMANTIC_TYPE_BONE_WEIGHTS: number & { readonly __brand: "graphics.SEMANTIC_TYPE_BONE_WEIGHTS" };
|
|
106
|
+
/**
|
|
107
|
+
* Vertex attribute semantic type, for `material.set_vertex_attributes`.
|
|
108
|
+
*/
|
|
109
|
+
const SEMANTIC_TYPE_COLOR: number & { readonly __brand: "graphics.SEMANTIC_TYPE_COLOR" };
|
|
110
|
+
/**
|
|
111
|
+
* Vertex attribute semantic type, for `material.set_vertex_attributes`.
|
|
112
|
+
*/
|
|
113
|
+
const SEMANTIC_TYPE_MORPH_TARGET_WEIGHTS: number & { readonly __brand: "graphics.SEMANTIC_TYPE_MORPH_TARGET_WEIGHTS" };
|
|
114
|
+
/**
|
|
115
|
+
* Vertex attribute semantic type, for `material.set_vertex_attributes`.
|
|
116
|
+
*/
|
|
117
|
+
const SEMANTIC_TYPE_NONE: number & { readonly __brand: "graphics.SEMANTIC_TYPE_NONE" };
|
|
118
|
+
/**
|
|
119
|
+
* Vertex attribute semantic type, for `material.set_vertex_attributes`.
|
|
120
|
+
*/
|
|
121
|
+
const SEMANTIC_TYPE_NORMAL: number & { readonly __brand: "graphics.SEMANTIC_TYPE_NORMAL" };
|
|
122
|
+
/**
|
|
123
|
+
* Vertex attribute semantic type, for `material.set_vertex_attributes`.
|
|
124
|
+
*/
|
|
125
|
+
const SEMANTIC_TYPE_NORMAL_MATRIX: number & { readonly __brand: "graphics.SEMANTIC_TYPE_NORMAL_MATRIX" };
|
|
126
|
+
/**
|
|
127
|
+
* Vertex attribute semantic type, for `material.set_vertex_attributes`.
|
|
128
|
+
*/
|
|
129
|
+
const SEMANTIC_TYPE_PAGE_INDEX: number & { readonly __brand: "graphics.SEMANTIC_TYPE_PAGE_INDEX" };
|
|
130
|
+
/**
|
|
131
|
+
* Vertex attribute semantic type, for `material.set_vertex_attributes`.
|
|
132
|
+
*/
|
|
133
|
+
const SEMANTIC_TYPE_POSITION: number & { readonly __brand: "graphics.SEMANTIC_TYPE_POSITION" };
|
|
134
|
+
/**
|
|
135
|
+
* Vertex attribute semantic type, for `material.set_vertex_attributes`.
|
|
136
|
+
*/
|
|
137
|
+
const SEMANTIC_TYPE_TANGENT: number & { readonly __brand: "graphics.SEMANTIC_TYPE_TANGENT" };
|
|
138
|
+
/**
|
|
139
|
+
* Vertex attribute semantic type, for `material.set_vertex_attributes`.
|
|
140
|
+
*/
|
|
141
|
+
const SEMANTIC_TYPE_TEXCOORD: number & { readonly __brand: "graphics.SEMANTIC_TYPE_TEXCOORD" };
|
|
142
|
+
/**
|
|
143
|
+
* Vertex attribute semantic type, for `material.set_vertex_attributes`.
|
|
144
|
+
*/
|
|
145
|
+
const SEMANTIC_TYPE_TEXTURE_TRANSFORM_2D: number & { readonly __brand: "graphics.SEMANTIC_TYPE_TEXTURE_TRANSFORM_2D" };
|
|
146
|
+
/**
|
|
147
|
+
* Vertex attribute semantic type, for `material.set_vertex_attributes`.
|
|
148
|
+
*/
|
|
149
|
+
const SEMANTIC_TYPE_WORLD_MATRIX: number & { readonly __brand: "graphics.SEMANTIC_TYPE_WORLD_MATRIX" };
|
|
98
150
|
const STATE_ALPHA_TEST: number & { readonly __brand: "graphics.STATE_ALPHA_TEST" };
|
|
99
151
|
const STATE_ALPHA_TEST_SUPPORTED: number & { readonly __brand: "graphics.STATE_ALPHA_TEST_SUPPORTED" };
|
|
100
152
|
const STATE_BLEND: number & { readonly __brand: "graphics.STATE_BLEND" };
|
package/generated/gui.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
-
import type { Hash, Opaque, Quaternion, Url, Vector, Vector3, Vector4 } from "../src/core-types";
|
|
2
|
+
import type { Hash, Matrix4, Opaque, Quaternion, Url, Vector, Vector3, Vector4 } from "../src/core-types";
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
5
|
/**
|
|
@@ -622,15 +622,15 @@ declare global {
|
|
|
622
622
|
* const node = gui.get_node("my_node");
|
|
623
623
|
* // animate to new position
|
|
624
624
|
* const pos = vmath.vector3(100, 100, 0);
|
|
625
|
-
* gui.animate(node, "position", pos,
|
|
625
|
+
* gui.animate(node, "position", pos, gui.EASING_LINEAR, 2);
|
|
626
626
|
* // ...
|
|
627
627
|
* // cancel animation of the x component.
|
|
628
628
|
* gui.cancel_animations(node, "position.x");
|
|
629
629
|
*
|
|
630
630
|
* // Cancels all property animations on a node in a single call:
|
|
631
631
|
* // animate to new position and scale
|
|
632
|
-
* gui.animate(node, "position", vmath.vector3(100, 100, 0),
|
|
633
|
-
* gui.animate(node, "scale", vmath.vector3(0.5),
|
|
632
|
+
* gui.animate(node, "position", vmath.vector3(100, 100, 0), gui.EASING_LINEAR, 5);
|
|
633
|
+
* gui.animate(node, "scale", vmath.vector3(0.5), gui.EASING_LINEAR, 5);
|
|
634
634
|
* // ...
|
|
635
635
|
* // cancel positioning and scaling at once
|
|
636
636
|
* gui.cancel_animations(node);
|
|
@@ -711,6 +711,10 @@ declare global {
|
|
|
711
711
|
* @example
|
|
712
712
|
* ```ts
|
|
713
713
|
* export default defineScript({
|
|
714
|
+
* init() {
|
|
715
|
+
* return { some_value: 0 };
|
|
716
|
+
* },
|
|
717
|
+
*
|
|
714
718
|
* final(self) {
|
|
715
719
|
* // report finalization
|
|
716
720
|
* msg.post("my_friend_instance", "im_dead", { my_stats: self.some_value });
|
|
@@ -758,7 +762,7 @@ declare global {
|
|
|
758
762
|
* @param node - node to get the property for
|
|
759
763
|
* @param property - the property to retrieve
|
|
760
764
|
* @param options - optional options table (only applicable for material constants)
|
|
761
|
-
* - `index` number index into array property
|
|
765
|
+
* - `index` number zero-based index into array property; the transpiler emits Defold's 1-based index
|
|
762
766
|
* @example
|
|
763
767
|
* ```ts
|
|
764
768
|
* // Get properties on existing nodes:
|
|
@@ -1380,12 +1384,14 @@ declare global {
|
|
|
1380
1384
|
* const size = 4;
|
|
1381
1385
|
* const pos = vmath.vector3(200, 200, 0);
|
|
1382
1386
|
* const path = "/assets/images/logo_4x4.astc";
|
|
1383
|
-
* const
|
|
1384
|
-
*
|
|
1385
|
-
*
|
|
1386
|
-
*
|
|
1387
|
-
*
|
|
1388
|
-
*
|
|
1387
|
+
* const [data] = sys.load_resource(path);
|
|
1388
|
+
* if (data !== undefined) {
|
|
1389
|
+
* const n = gui.new_box_node(pos, vmath.vector3(size, size, 0));
|
|
1390
|
+
* // size is read from the .astc buffer
|
|
1391
|
+
* // flip is not supported
|
|
1392
|
+
* gui.new_texture(path, 0, 0, "astc", data, false);
|
|
1393
|
+
* gui.set_texture(n, path);
|
|
1394
|
+
* }
|
|
1389
1395
|
* ```
|
|
1390
1396
|
*/
|
|
1391
1397
|
function new_texture(texture_id: string | Hash, width: number, height: number, type: string | Opaque<"constant">, buffer: string, flip?: boolean): LuaMultiReturn<[boolean, number]>;
|
|
@@ -1530,6 +1536,10 @@ declare global {
|
|
|
1530
1536
|
* @example
|
|
1531
1537
|
* ```ts
|
|
1532
1538
|
* export default defineGuiScript({
|
|
1539
|
+
* init(): { my_value: number | undefined } {
|
|
1540
|
+
* return { my_value: undefined };
|
|
1541
|
+
* },
|
|
1542
|
+
*
|
|
1533
1543
|
* on_input(self, action_id, action) {
|
|
1534
1544
|
* // check for input
|
|
1535
1545
|
* if (action_id === hash("my_action")) {
|
|
@@ -1563,6 +1573,10 @@ declare global {
|
|
|
1563
1573
|
* @example
|
|
1564
1574
|
* ```ts
|
|
1565
1575
|
* export default defineGuiScript({
|
|
1576
|
+
* init() {
|
|
1577
|
+
* return { my_original_color: gui.get_color(gui.get_node("my_node")) };
|
|
1578
|
+
* },
|
|
1579
|
+
*
|
|
1566
1580
|
* on_reload(self) {
|
|
1567
1581
|
* // restore some color (or similar)
|
|
1568
1582
|
* gui.set_color(gui.get_node("my_node"), self.my_original_color);
|
|
@@ -1707,7 +1721,12 @@ declare global {
|
|
|
1707
1721
|
* },
|
|
1708
1722
|
*
|
|
1709
1723
|
* on_input(self, action_id, action) {
|
|
1710
|
-
* if (
|
|
1724
|
+
* if (
|
|
1725
|
+
* action_id === hash("touch") &&
|
|
1726
|
+
* action.pressed &&
|
|
1727
|
+
* action.screen_x !== undefined &&
|
|
1728
|
+
* action.screen_y !== undefined
|
|
1729
|
+
* ) {
|
|
1711
1730
|
* const screen_position = vmath.vector3(action.screen_x, action.screen_y, 0);
|
|
1712
1731
|
* const target_position = gui.screen_to_local(self.marker, screen_position);
|
|
1713
1732
|
* gui.animate(self.marker, gui.PROP_POSITION, target_position, gui.EASING_OUTQUAD, 0.2);
|
|
@@ -1765,13 +1784,13 @@ declare global {
|
|
|
1765
1784
|
* @param property - the property to set
|
|
1766
1785
|
* @param value - the property to set. `nil` is only supported for removing runtime texture mappings with `gui.set(msg.url(), "textures", nil, {key = ...})`.
|
|
1767
1786
|
* @param options - optional options table (only applicable for material constants)
|
|
1768
|
-
* - `index` number index into array property
|
|
1787
|
+
* - `index` number zero-based index into array property; the transpiler emits Defold's 1-based index
|
|
1769
1788
|
* - `key` hash name of internal property
|
|
1770
1789
|
* @example
|
|
1771
1790
|
* ```ts
|
|
1772
1791
|
* // Updates the position property on an existing node:
|
|
1773
1792
|
* const node = gui.get_node("my_box_node");
|
|
1774
|
-
* const node_position = gui.get(node, "position");
|
|
1793
|
+
* const node_position = gui.get(node, "position") as Vector3;
|
|
1775
1794
|
* gui.set(node, "position.x", node_position.x + 128);
|
|
1776
1795
|
*
|
|
1777
1796
|
* // Updates the rotation property on an existing node:
|
|
@@ -1788,23 +1807,23 @@ declare global {
|
|
|
1788
1807
|
* // matrix4 is also supported
|
|
1789
1808
|
* gui.set(node, "light_matrix", vmath.matrix4());
|
|
1790
1809
|
* // update a constant in an array at position 4. the array is specified in the shader as:
|
|
1791
|
-
* // uniform vec4 tint_array[4]; //
|
|
1792
|
-
* gui.set(node, "tint_array", vmath.vector4(1, 0, 0, 1), { index:
|
|
1810
|
+
* // uniform vec4 tint_array[4]; // TypeScript and the shader are both 0 based
|
|
1811
|
+
* gui.set(node, "tint_array", vmath.vector4(1, 0, 0, 1), { index: 3 });
|
|
1793
1812
|
* // update a matrix constant in an array at position 4. the array is specified in the shader as:
|
|
1794
1813
|
* // uniform mat4 light_matrix_array[4];
|
|
1795
|
-
* gui.set(node, "light_matrix_array", vmath.matrix4(), { index:
|
|
1814
|
+
* gui.set(node, "light_matrix_array", vmath.matrix4(), { index: 3 });
|
|
1796
1815
|
* // update a sub-element in a constant
|
|
1797
1816
|
* gui.set(node, "tint.x", 1);
|
|
1798
1817
|
* // update a sub-element in an array constant at position 4
|
|
1799
|
-
* gui.set(node, "tint_array.x", 1, { index:
|
|
1818
|
+
* gui.set(node, "tint_array.x", 1, { index: 3 });
|
|
1800
1819
|
*
|
|
1801
1820
|
* // Set a named property
|
|
1802
1821
|
* export default defineGuiScript({
|
|
1803
1822
|
* on_message(self, message_id, message) {
|
|
1804
|
-
* if (message_id === hash("set_font")) {
|
|
1823
|
+
* if (message_id === hash("set_font") && types.is_hash(message.font)) {
|
|
1805
1824
|
* gui.set(msg.url(), "fonts", message.font, { key: "my_font_name" });
|
|
1806
1825
|
* gui.set_font(gui.get_node("text"), "my_font_name");
|
|
1807
|
-
* } else if (message_id === hash("set_texture")) {
|
|
1826
|
+
* } else if (message_id === hash("set_texture") && types.is_hash(message.texture)) {
|
|
1808
1827
|
* gui.set(msg.url(), "textures", message.texture, { key: "my_texture" });
|
|
1809
1828
|
* gui.set_texture(gui.get_node("box"), "my_texture");
|
|
1810
1829
|
* gui.play_flipbook(gui.get_node("box"), "logo_256");
|
|
@@ -1823,7 +1842,7 @@ declare global {
|
|
|
1823
1842
|
* resource.release(atlas_id);
|
|
1824
1843
|
* ```
|
|
1825
1844
|
*/
|
|
1826
|
-
function set(node: Opaque<"node"> | Url, property: string | Hash | gui.Property, value?: number | Vector4 | Vector3 | Quaternion, options?: { index?: number; key?: Hash }): void;
|
|
1845
|
+
function set(node: Opaque<"node"> | Url, property: string | Hash | gui.Property, value?: number | Vector4 | Vector3 | Quaternion | Matrix4 | Hash, options?: { index?: number; key?: string | Hash }): void;
|
|
1827
1846
|
/**
|
|
1828
1847
|
* Sets the adjust mode on a node.
|
|
1829
1848
|
* The adjust mode defines how the node will adjust itself to screen
|
|
@@ -2129,7 +2148,7 @@ declare global {
|
|
|
2129
2148
|
* @param node - node to set the rotation for
|
|
2130
2149
|
* @param rotation - new rotation
|
|
2131
2150
|
*/
|
|
2132
|
-
function set_rotation(node: Opaque<"node">, rotation: Quaternion | Vector4): void;
|
|
2151
|
+
function set_rotation(node: Opaque<"node">, rotation: Quaternion | Vector4 | Vector3): void;
|
|
2133
2152
|
/**
|
|
2134
2153
|
* Sets how the safe area is applied to this gui scene.
|
|
2135
2154
|
*
|
|
@@ -2362,15 +2381,17 @@ declare global {
|
|
|
2362
2381
|
* // in a counting fashion. It is assumed that the gui component receives messages
|
|
2363
2382
|
* // from the game when a new score is to be shown.
|
|
2364
2383
|
* export default defineGuiScript({
|
|
2365
|
-
* init(
|
|
2366
|
-
*
|
|
2367
|
-
*
|
|
2368
|
-
*
|
|
2369
|
-
*
|
|
2370
|
-
*
|
|
2371
|
-
*
|
|
2372
|
-
*
|
|
2373
|
-
*
|
|
2384
|
+
* init() {
|
|
2385
|
+
* return {
|
|
2386
|
+
* // fetch the score text node for later use (assumes it is called "score")
|
|
2387
|
+
* score_node: gui.get_node("score"),
|
|
2388
|
+
* // keep track of the current score counted up so far
|
|
2389
|
+
* current_score: 0,
|
|
2390
|
+
* // keep track of the target score we should count up to
|
|
2391
|
+
* target_score: 0,
|
|
2392
|
+
* // how fast we will update the score, in score/second
|
|
2393
|
+
* score_update_speed: 1,
|
|
2394
|
+
* };
|
|
2374
2395
|
* },
|
|
2375
2396
|
*
|
|
2376
2397
|
* update(self, dt) {
|
|
@@ -2389,7 +2410,7 @@ declare global {
|
|
|
2389
2410
|
*
|
|
2390
2411
|
* on_message(self, message_id, message) {
|
|
2391
2412
|
* // check the message
|
|
2392
|
-
* if (message_id === hash("set_score")) {
|
|
2413
|
+
* if (message_id === hash("set_score") && typeof message.score === "number") {
|
|
2393
2414
|
* self.target_score = message.score;
|
|
2394
2415
|
* }
|
|
2395
2416
|
* },
|
package/generated/html5.d.ts
CHANGED
|
@@ -18,7 +18,9 @@ declare global {
|
|
|
18
18
|
* const res = html5.run("10 + 20"); // returns the string "30"
|
|
19
19
|
* print(res);
|
|
20
20
|
* const res_num = tonumber(res); // convert to number
|
|
21
|
-
*
|
|
21
|
+
* if (res_num !== undefined) {
|
|
22
|
+
* print(res_num - 20); // prints 10
|
|
23
|
+
* }
|
|
22
24
|
* ```
|
|
23
25
|
*/
|
|
24
26
|
function run(code: string): string;
|