@defold-typescript/types 0.49.0 → 0.50.1
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 +696 -624
- package/api-signatures.json +6799 -160
- package/api-targets.json +393 -2
- package/examples/translations.json +12 -0
- package/generated/b2d.d.ts +15 -0
- package/generated/bullet3d.d.ts +16 -0
- package/generated/font.d.ts +7 -3
- package/generated/graphics.d.ts +7 -0
- package/generated/gui.d.ts +5 -4
- package/generated/label.d.ts +3 -3
- package/generated/render.d.ts +16 -1
- package/generated/versions/defold-1.13.2/b2d.d.ts +709 -0
- package/generated/versions/defold-1.13.2/b2d_body.d.ts +593 -0
- package/generated/versions/defold-1.13.2/b2d_chain.d.ts +105 -0
- package/generated/versions/defold-1.13.2/b2d_fixture.d.ts +175 -0
- package/generated/versions/defold-1.13.2/b2d_joint.d.ts +1301 -0
- package/generated/versions/defold-1.13.2/b2d_shape.d.ts +423 -0
- package/generated/versions/defold-1.13.2/b2d_world.d.ts +308 -0
- package/generated/versions/defold-1.13.2/buffer.d.ts +192 -0
- package/generated/versions/defold-1.13.2/bullet3d.d.ts +91 -0
- package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +433 -0
- package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +818 -0
- package/generated/versions/defold-1.13.2/bullet3d_rigid_body.d.ts +429 -0
- package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +123 -0
- package/generated/versions/defold-1.13.2/bullet3d_world.d.ts +492 -0
- package/generated/versions/defold-1.13.2/camera.d.ts +300 -0
- package/generated/versions/defold-1.13.2/collectionfactory.d.ts +148 -0
- package/generated/versions/defold-1.13.2/collectionproxy.d.ts +109 -0
- package/generated/versions/defold-1.13.2/compute.d.ts +107 -0
- package/generated/versions/defold-1.13.2/crash.d.ts +157 -0
- package/generated/versions/defold-1.13.2/editor-vm/http.d.ts +139 -0
- package/generated/versions/defold-1.13.2/editor-vm/image.d.ts +48 -0
- package/generated/versions/defold-1.13.2/editor-vm/json.d.ts +21 -0
- package/generated/versions/defold-1.13.2/editor-vm/localization.d.ts +42 -0
- package/generated/versions/defold-1.13.2/editor-vm/tilemap_tiles.d.ts +126 -0
- package/generated/versions/defold-1.13.2/editor-vm/zip.d.ts +38 -0
- package/generated/versions/defold-1.13.2/editor-vm/zlib.d.ts +24 -0
- package/generated/versions/defold-1.13.2/editor.d.ts +2177 -0
- package/generated/versions/defold-1.13.2/factory.d.ts +121 -0
- package/generated/versions/defold-1.13.2/font.d.ts +123 -0
- package/generated/versions/defold-1.13.2/go.d.ts +1166 -0
- package/generated/versions/defold-1.13.2/graphics.d.ts +613 -0
- package/generated/versions/defold-1.13.2/gui.d.ts +2212 -0
- package/generated/versions/defold-1.13.2/html5.d.ts +55 -0
- package/generated/versions/defold-1.13.2/http.d.ts +83 -0
- package/generated/versions/defold-1.13.2/image.d.ts +181 -0
- package/generated/versions/defold-1.13.2/index.d.ts +63 -0
- package/generated/versions/defold-1.13.2/json.d.ts +94 -0
- package/generated/versions/defold-1.13.2/kinds/editor-script.d.ts +14 -0
- package/generated/versions/defold-1.13.2/label.d.ts +164 -0
- package/generated/versions/defold-1.13.2/liveupdate.d.ts +143 -0
- package/generated/versions/defold-1.13.2/material.d.ts +490 -0
- package/generated/versions/defold-1.13.2/model.d.ts +287 -0
- package/generated/versions/defold-1.13.2/msg.d.ts +10 -0
- package/generated/versions/defold-1.13.2/particlefx.d.ts +155 -0
- package/generated/versions/defold-1.13.2/physics.d.ts +789 -0
- package/generated/versions/defold-1.13.2/profiler.d.ts +228 -0
- package/generated/versions/defold-1.13.2/render.d.ts +1153 -0
- package/generated/versions/defold-1.13.2/resource.d.ts +1628 -0
- package/generated/versions/defold-1.13.2/socket.d.ts +797 -0
- package/generated/versions/defold-1.13.2/sound.d.ts +323 -0
- package/generated/versions/defold-1.13.2/sprite.d.ts +179 -0
- package/generated/versions/defold-1.13.2/sys.d.ts +754 -0
- package/generated/versions/defold-1.13.2/tilemap.d.ts +206 -0
- package/generated/versions/defold-1.13.2/timer.d.ts +136 -0
- package/generated/versions/defold-1.13.2/types.d.ts +61 -0
- package/generated/versions/defold-1.13.2/vmath.d.ts +775 -0
- package/generated/versions/defold-1.13.2/window.d.ts +196 -0
- package/generated/versions/defold-1.13.2/zlib.d.ts +41 -0
- package/identity-vocabulary.json +1 -0
- package/package.json +2 -2
- package/scripts/import-defold-release.ts +3 -31
- package/scripts/materialize-version.ts +13 -7
- package/scripts/regen.ts +63 -29
- package/scripts/sync-api-docs.ts +31 -2
- package/src/emit-dts.ts +25 -3
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import type { Hash, Url, Vector3 } from "../../../src/core-types";
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Model API documentation
|
|
7
|
+
*/
|
|
8
|
+
namespace model {
|
|
9
|
+
/**
|
|
10
|
+
* Axis-aligned bounding box
|
|
11
|
+
*/
|
|
12
|
+
interface aabb {
|
|
13
|
+
/**
|
|
14
|
+
* minimum local-space bounds
|
|
15
|
+
*/
|
|
16
|
+
min: Vector3;
|
|
17
|
+
/**
|
|
18
|
+
* maximum local-space bounds
|
|
19
|
+
*/
|
|
20
|
+
max: Vector3;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Model animation playback properties
|
|
24
|
+
*/
|
|
25
|
+
interface play_properties {
|
|
26
|
+
/**
|
|
27
|
+
* duration of a linear blend from the current animation
|
|
28
|
+
*/
|
|
29
|
+
blend_duration?: number;
|
|
30
|
+
/**
|
|
31
|
+
* normalized initial animation cursor
|
|
32
|
+
*/
|
|
33
|
+
offset?: number;
|
|
34
|
+
/**
|
|
35
|
+
* positive animation playback rate
|
|
36
|
+
*/
|
|
37
|
+
playback_rate?: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Cancels all animation on a model component.
|
|
41
|
+
*
|
|
42
|
+
* @param url - the model for which to cancel the animation
|
|
43
|
+
*/
|
|
44
|
+
function cancel(url: string | Hash | Url): void;
|
|
45
|
+
/**
|
|
46
|
+
* Get AABB of the whole model in local coordinate space.
|
|
47
|
+
*
|
|
48
|
+
* @param url - the model
|
|
49
|
+
* @returns model bounds; an empty model returns zero vectors
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* model.get_aabb("#model"); // => { min = vmath.vector3(-2.5, -3.0, 0), max = vmath.vector3(1.5, 5.5, 0) }
|
|
53
|
+
* model.get_aabb("#empty"); // => { min = vmath.vector3(0, 0, 0), max = vmath.vector3(0, 0, 0) }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
function get_aabb(url: string | Hash | Url): model.aabb;
|
|
57
|
+
/**
|
|
58
|
+
* Returns a table of numbers with one entry per morph target on the first mesh of the model that has morph targets.
|
|
59
|
+
* Values reflect the rig state at call time (after animation, and any active script override from model.set_blend_weights).
|
|
60
|
+
*
|
|
61
|
+
* @param url - the model component
|
|
62
|
+
* @returns array of weight values, or empty table if the model has no morph targets
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* const w = model.get_blend_weights("#model");
|
|
66
|
+
* w.forEach((weight, i) => {
|
|
67
|
+
* print(i + 1, weight);
|
|
68
|
+
* });
|
|
69
|
+
* // change the data in the table and then set the weights again
|
|
70
|
+
* w[0] = 0.75;
|
|
71
|
+
* w[1] = 0.25;
|
|
72
|
+
* model.set_blend_weights("#model", w);
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
function get_blend_weights(url: string | Hash | Url): number[];
|
|
76
|
+
/**
|
|
77
|
+
* Gets the id of the game object that corresponds to a model skeleton bone.
|
|
78
|
+
* The returned game object can be used for parenting and transform queries.
|
|
79
|
+
* This function has complexity `O(n)`, where `n` is the number of bones in the model skeleton.
|
|
80
|
+
* Game objects corresponding to a model skeleton bone can not be individually deleted.
|
|
81
|
+
*
|
|
82
|
+
* @param url - the model to query
|
|
83
|
+
* @param bone_id - id of the corresponding bone
|
|
84
|
+
* @returns id of the game object
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* // The following examples assume that the model component has id "model".
|
|
88
|
+
* // How to parent the game object of the calling script to the "right_hand" bone
|
|
89
|
+
* // of the model in a player game object:
|
|
90
|
+
* export default defineScript({
|
|
91
|
+
* init(self) {
|
|
92
|
+
* const parent = model.get_go("player#model", "right_hand");
|
|
93
|
+
* msg.post(".", "set_parent", { parent_id: parent });
|
|
94
|
+
* },
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
function get_go(url: string | Hash | Url, bone_id: string | Hash): Hash;
|
|
99
|
+
/**
|
|
100
|
+
* Get AABB of all meshes.
|
|
101
|
+
*
|
|
102
|
+
* @param url - the model
|
|
103
|
+
* @returns mesh bounds keyed by mesh identifier
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* model.get_mesh_aabb("#model"); // => { hash("Sword") = { min = vmath.vector3(-0.5, -0.5, 0), max = vmath.vector3(0.5, 0.5, 0) }, hash("Shield") = { min = vmath.vector3(-0.5, -0.5, -0.5), max = vmath.vector3(0.5, 0.5, 0.5) } }
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
function get_mesh_aabb(url: string | Hash | Url): LuaTable<Hash, model.aabb>;
|
|
110
|
+
/**
|
|
111
|
+
* Get the enabled state of a mesh
|
|
112
|
+
*
|
|
113
|
+
* @param url - the model
|
|
114
|
+
* @param mesh_id - the id of the mesh
|
|
115
|
+
* @returns true if the mesh is visible, false otherwise
|
|
116
|
+
* @example
|
|
117
|
+
* ```ts
|
|
118
|
+
* // shared weapon data, e.g. required from your own module
|
|
119
|
+
* const game = { data: { weapons: { Sword: { damage: 10 } } } };
|
|
120
|
+
*
|
|
121
|
+
* export default defineScript({
|
|
122
|
+
* init() {
|
|
123
|
+
* if (model.get_mesh_enabled("#model", "Sword")) {
|
|
124
|
+
* // set properties specific for the sword
|
|
125
|
+
* return { weapon_properties: game.data.weapons["Sword"] };
|
|
126
|
+
* }
|
|
127
|
+
* return { weapon_properties: undefined };
|
|
128
|
+
* },
|
|
129
|
+
* });
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
function get_mesh_enabled(url: string | Hash | Url, mesh_id: string | Hash): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Plays an animation on a model component with specified playback
|
|
135
|
+
* mode and parameters.
|
|
136
|
+
* An optional completion callback function can be provided that will be called when
|
|
137
|
+
* the animation has completed playing. If no function is provided,
|
|
138
|
+
* a model_animation_done message is sent to the script that started the animation.
|
|
139
|
+
* The callback is not called (or message sent) if the animation is
|
|
140
|
+
* cancelled with model.cancel. The callback is called (or message sent) only for
|
|
141
|
+
* animations that play with the following playback modes:
|
|
142
|
+
*
|
|
143
|
+
* - `go.PLAYBACK_ONCE_FORWARD`
|
|
144
|
+
* - `go.PLAYBACK_ONCE_BACKWARD`
|
|
145
|
+
* - `go.PLAYBACK_ONCE_PINGPONG`
|
|
146
|
+
*
|
|
147
|
+
* @param url - the model for which to play the animation
|
|
148
|
+
* @param anim_id - id of the animation to play
|
|
149
|
+
* @param playback - playback mode of the animation
|
|
150
|
+
* @param play_properties - optional playback properties
|
|
151
|
+
* @param complete_function - function to call when the animation has completed.
|
|
152
|
+
*
|
|
153
|
+
* `self`
|
|
154
|
+
* script_instance The current script instance.
|
|
155
|
+
* `message_id`
|
|
156
|
+
* hash The name of the completion message, `"model_animation_done"`.
|
|
157
|
+
* `message`
|
|
158
|
+
* message.model.model_animation_done Information about the completion.
|
|
159
|
+
* `sender`
|
|
160
|
+
* url The invoker of the callback: the model component.
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* // The following examples assume that the model has id "model".
|
|
164
|
+
* // How to play the "jump" animation followed by the "run" animation:
|
|
165
|
+
* const url = msg.url("#model");
|
|
166
|
+
*
|
|
167
|
+
* function anim_done(self: unknown, message_id: unknown, message: unknown, sender: unknown) {
|
|
168
|
+
* if (message_id === hash("model_animation_done")) {
|
|
169
|
+
* const { animation_id } = message as { animation_id: Hash };
|
|
170
|
+
* if (animation_id === hash("jump")) {
|
|
171
|
+
* // open animation done, chain with "run"
|
|
172
|
+
* const properties = { blend_duration: 0.2 };
|
|
173
|
+
* model.play_anim(url, "run", go.PLAYBACK_LOOP_FORWARD, properties, anim_done);
|
|
174
|
+
* }
|
|
175
|
+
* }
|
|
176
|
+
* }
|
|
177
|
+
*
|
|
178
|
+
* export default defineScript({
|
|
179
|
+
* init(self) {
|
|
180
|
+
* const play_properties = { blend_duration: 0.1 };
|
|
181
|
+
* // first blend during 0.1 sec into the jump, then during 0.2 s into the run animation
|
|
182
|
+
* model.play_anim(url, "jump", go.PLAYBACK_ONCE_FORWARD, play_properties, anim_done);
|
|
183
|
+
* },
|
|
184
|
+
* });
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
function play_anim(url: string | Hash | Url, anim_id: string | Hash, playback: go.PLAYBACK, play_properties?: model.play_properties, complete_function?: (self: unknown, message_id: Hash, message: BuiltinMessages["model_animation_done"], sender: Url) => void): void;
|
|
188
|
+
/**
|
|
189
|
+
* Resets a shader constant for a model component.
|
|
190
|
+
* The constant must be defined in the material assigned to the model.
|
|
191
|
+
* Resetting a constant through this function implies that the value defined in the material will be used.
|
|
192
|
+
* Which model to reset a constant for is identified by the URL.
|
|
193
|
+
*
|
|
194
|
+
* @param url - the model that should have a constant reset.
|
|
195
|
+
* @param constant - name of the constant.
|
|
196
|
+
* @example
|
|
197
|
+
* ```ts
|
|
198
|
+
* model.reset_constant("#model", "tint");
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
function reset_constant(url: string | Hash | Url, constant: string | Hash): void;
|
|
202
|
+
/**
|
|
203
|
+
* Copies numeric values from `weights` into each morph target slot for every mesh on the model that has morph targets.
|
|
204
|
+
* At most as many weights are applied as each mesh has morph targets; extra entries in the table are ignored.
|
|
205
|
+
* Missing weights leave the tail zero-filled for meshes with more targets than entries.
|
|
206
|
+
* The override is re-applied every frame after animations run, until cleared by omitting `weights` or passing `nil`.
|
|
207
|
+
* To reset the weights, use `model.set_blend_weights(url)` or `model.set_blend_weights(url, nil)`.
|
|
208
|
+
*
|
|
209
|
+
* @param url - the model component
|
|
210
|
+
* @param weights - array of weight values (1-based indices). Omit or pass `nil` to clear the override and return morphs to animation only
|
|
211
|
+
* @example
|
|
212
|
+
* ```ts
|
|
213
|
+
* // set the weights for the first 4 morph targets
|
|
214
|
+
* model.set_blend_weights("#model", [0, 1, 0.5, 0]);
|
|
215
|
+
* // clear the override, animation will continue if the weights are driven by an animation
|
|
216
|
+
* model.set_blend_weights("#model"); // clear script override
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
function set_blend_weights(url: string | Hash | Url, weights?: number[]): void;
|
|
220
|
+
/**
|
|
221
|
+
* Enable or disable visibility of a mesh
|
|
222
|
+
*
|
|
223
|
+
* @param url - the model
|
|
224
|
+
* @param mesh_id - the id of the mesh
|
|
225
|
+
* @param enabled - true if the mesh should be visible, false if it should be hideen
|
|
226
|
+
* @example
|
|
227
|
+
* ```ts
|
|
228
|
+
* export default defineScript({
|
|
229
|
+
* init(self) {
|
|
230
|
+
* model.set_mesh_enabled("#model", "Sword", false); // hide the sword
|
|
231
|
+
* model.set_mesh_enabled("#model", "Axe", true); // show the axe
|
|
232
|
+
* },
|
|
233
|
+
* });
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
function set_mesh_enabled(url: string | Hash | Url, mesh_id: string | Hash, enabled: boolean): void;
|
|
237
|
+
interface properties {
|
|
238
|
+
/**
|
|
239
|
+
* The current animation set on the component. The type of the property is hash.
|
|
240
|
+
*/
|
|
241
|
+
animation: Hash;
|
|
242
|
+
/**
|
|
243
|
+
* The normalized animation cursor. The type of the property is number.
|
|
244
|
+
* Please note that model events may not fire as expected when the cursor is manipulated directly.
|
|
245
|
+
*/
|
|
246
|
+
cursor: number;
|
|
247
|
+
/**
|
|
248
|
+
* The animation playback rate. A multiplier to the animation playback rate. The type of the property is number.
|
|
249
|
+
*/
|
|
250
|
+
playback_rate: number;
|
|
251
|
+
/**
|
|
252
|
+
* The texture hash id of the model. Used for getting/setting model texture for unit 0-7
|
|
253
|
+
*/
|
|
254
|
+
texture0: Hash;
|
|
255
|
+
/**
|
|
256
|
+
* The texture hash id of the model. Used for getting/setting model texture for unit 0-7
|
|
257
|
+
*/
|
|
258
|
+
texture1: Hash;
|
|
259
|
+
/**
|
|
260
|
+
* The texture hash id of the model. Used for getting/setting model texture for unit 0-7
|
|
261
|
+
*/
|
|
262
|
+
texture2: Hash;
|
|
263
|
+
/**
|
|
264
|
+
* The texture hash id of the model. Used for getting/setting model texture for unit 0-7
|
|
265
|
+
*/
|
|
266
|
+
texture3: Hash;
|
|
267
|
+
/**
|
|
268
|
+
* The texture hash id of the model. Used for getting/setting model texture for unit 0-7
|
|
269
|
+
*/
|
|
270
|
+
texture4: Hash;
|
|
271
|
+
/**
|
|
272
|
+
* The texture hash id of the model. Used for getting/setting model texture for unit 0-7
|
|
273
|
+
*/
|
|
274
|
+
texture5: Hash;
|
|
275
|
+
/**
|
|
276
|
+
* The texture hash id of the model. Used for getting/setting model texture for unit 0-7
|
|
277
|
+
*/
|
|
278
|
+
texture6: Hash;
|
|
279
|
+
/**
|
|
280
|
+
* The texture hash id of the model. Used for getting/setting model texture for unit 0-7
|
|
281
|
+
*/
|
|
282
|
+
texture7: Hash;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export {};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import type { Hash, Matrix4, Url, Vector4 } from "../../../src/core-types";
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Functions and properties for controlling particle effect component playback and
|
|
7
|
+
* shader constants.
|
|
8
|
+
*/
|
|
9
|
+
namespace particlefx {
|
|
10
|
+
/**
|
|
11
|
+
* Options used when stopping particle effects.
|
|
12
|
+
*/
|
|
13
|
+
interface stop_options {
|
|
14
|
+
/**
|
|
15
|
+
* Instantly clear spawned particles.
|
|
16
|
+
*/
|
|
17
|
+
clear?: boolean;
|
|
18
|
+
}
|
|
19
|
+
type EMITTER_STATE = typeof particlefx.EMITTER_STATE_POSTSPAWN | typeof particlefx.EMITTER_STATE_PRESPAWN | typeof particlefx.EMITTER_STATE_SLEEPING | typeof particlefx.EMITTER_STATE_SPAWNING;
|
|
20
|
+
/**
|
|
21
|
+
* postspawn state The emitter is not spawning any particles, but has particles that are still alive.
|
|
22
|
+
*/
|
|
23
|
+
const EMITTER_STATE_POSTSPAWN: number & { readonly __brand: "particlefx.EMITTER_STATE_POSTSPAWN" };
|
|
24
|
+
/**
|
|
25
|
+
* prespawn state The emitter will be in this state when it has been started but before spawning any particles. Normally the emitter is in this state for a short time, depending on if a start delay has been set for this emitter or not.
|
|
26
|
+
*/
|
|
27
|
+
const EMITTER_STATE_PRESPAWN: number & { readonly __brand: "particlefx.EMITTER_STATE_PRESPAWN" };
|
|
28
|
+
/**
|
|
29
|
+
* sleeping state The emitter does not have any living particles and will not spawn any particles in this state.
|
|
30
|
+
*/
|
|
31
|
+
const EMITTER_STATE_SLEEPING: number & { readonly __brand: "particlefx.EMITTER_STATE_SLEEPING" };
|
|
32
|
+
/**
|
|
33
|
+
* spawning state The emitter is spawning particles.
|
|
34
|
+
*/
|
|
35
|
+
const EMITTER_STATE_SPAWNING: number & { readonly __brand: "particlefx.EMITTER_STATE_SPAWNING" };
|
|
36
|
+
/**
|
|
37
|
+
* Starts playing a particle FX component.
|
|
38
|
+
* Particle FX started this way need to be manually stopped through `particlefx.stop()`.
|
|
39
|
+
* Which particle FX to play is identified by the URL.
|
|
40
|
+
* A particle FX will continue to emit particles even if the game object the particle FX component belonged to is deleted. You can call `particlefx.stop()` to stop it from emitting more particles.
|
|
41
|
+
*
|
|
42
|
+
* @param url - the particle fx that should start playing.
|
|
43
|
+
* @param emitter_state_function - optional callback function that will be called when an emitter attached to this particlefx changes state.
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* // How to play a particle fx when a game object is created.
|
|
47
|
+
* // The callback receives the hash of the path to the particlefx, the hash of the id
|
|
48
|
+
* // of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_.
|
|
49
|
+
* export default defineScript({
|
|
50
|
+
* init(self) {
|
|
51
|
+
* particlefx.play("#particlefx", (self, id, emitter, state) => {
|
|
52
|
+
* if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
|
|
53
|
+
* // exhaust is done spawning particles...
|
|
54
|
+
* }
|
|
55
|
+
* });
|
|
56
|
+
* },
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
function play(url: string | Hash | Url, emitter_state_function?: (self: unknown, id: Hash, emitter: Hash, state: particlefx.EMITTER_STATE) => void): void;
|
|
61
|
+
/**
|
|
62
|
+
* Resets a shader constant for a particle FX component emitter.
|
|
63
|
+
* The constant must be defined in the material assigned to the emitter.
|
|
64
|
+
* Resetting a constant through this function implies that the value defined in the material will be used.
|
|
65
|
+
* Which particle FX to reset a constant for is identified by the URL.
|
|
66
|
+
*
|
|
67
|
+
* @param url - the particle FX that should have a constant reset
|
|
68
|
+
* @param emitter - the id of the emitter
|
|
69
|
+
* @param constant - the name of the constant
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* // The following examples assume that the particle FX has id "particlefx", it
|
|
73
|
+
* // contains an emitter with the id "emitter" and that the default-material in
|
|
74
|
+
* // builtins is used, which defines the constant "tint".
|
|
75
|
+
* // If you assign a custom material to the sprite, you can reset the constants
|
|
76
|
+
* // defined there in the same manner.
|
|
77
|
+
* // How to reset the tinting of particles from an emitter:
|
|
78
|
+
* export default defineScript({
|
|
79
|
+
* init(self) {
|
|
80
|
+
* particlefx.reset_constant("#particlefx", "emitter", "tint");
|
|
81
|
+
* },
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
function reset_constant(url: string | Hash | Url, emitter: string | Hash, constant: string | Hash): void;
|
|
86
|
+
/**
|
|
87
|
+
* Sets a shader constant for a particle FX component emitter.
|
|
88
|
+
* The constant must be defined in the material assigned to the emitter.
|
|
89
|
+
* Setting a constant through this function will override the value set for that constant in the material.
|
|
90
|
+
* The value will be overridden until particlefx.reset_constant is called.
|
|
91
|
+
* Which particle FX to set a constant for is identified by the URL.
|
|
92
|
+
*
|
|
93
|
+
* @param url - the particle FX that should have a constant set
|
|
94
|
+
* @param emitter - the id of the emitter
|
|
95
|
+
* @param constant - the name of the constant
|
|
96
|
+
* @param value - the value of the constant
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* // The following examples assume that the particle FX has id "particlefx", it
|
|
100
|
+
* // contains an emitter with the id "emitter" and that the default-material in
|
|
101
|
+
* // builtins is used, which defines the constant "tint".
|
|
102
|
+
* // If you assign a custom material to the sprite, you can reset the constants
|
|
103
|
+
* // defined there in the same manner.
|
|
104
|
+
* // How to tint particles from an emitter red:
|
|
105
|
+
* export default defineScript({
|
|
106
|
+
* init(self) {
|
|
107
|
+
* particlefx.set_constant("#particlefx", "emitter", "tint", vmath.vector4(1, 0, 0, 1));
|
|
108
|
+
* },
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
function set_constant(url: string | Hash | Url, emitter: string | Hash, constant: string | Hash, value: Vector4 | Matrix4): void;
|
|
113
|
+
/**
|
|
114
|
+
* Stops a particle FX component from playing.
|
|
115
|
+
* Stopping a particle FX does not remove already spawned particles.
|
|
116
|
+
* Which particle FX to stop is identified by the URL.
|
|
117
|
+
*
|
|
118
|
+
* @param url - the particle fx that should stop playing
|
|
119
|
+
* @param options - options used when stopping the particle fx
|
|
120
|
+
* @example
|
|
121
|
+
* ```ts
|
|
122
|
+
* // How to stop a particle fx when a game object is deleted and immediately also
|
|
123
|
+
* // clear any spawned particles:
|
|
124
|
+
* export default defineScript({
|
|
125
|
+
* final(self) {
|
|
126
|
+
* particlefx.stop("#particlefx", { clear: true });
|
|
127
|
+
* },
|
|
128
|
+
* });
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
function stop(url: string | Hash | Url, options?: particlefx.stop_options): void;
|
|
132
|
+
interface properties {
|
|
133
|
+
/**
|
|
134
|
+
* The animation used during rendering by an emitter in a particle FX component.
|
|
135
|
+
* The property type is a hash and refers to a valid animation in an atlas or a tile source resource.
|
|
136
|
+
* If the animation isn't found, and error will be thrown.
|
|
137
|
+
*/
|
|
138
|
+
animation: Hash;
|
|
139
|
+
/**
|
|
140
|
+
* The image used during rendering by an emitter in a particle FX component.
|
|
141
|
+
* The property type is a hash and refers to an image resource (atlas or tile source).
|
|
142
|
+
* Note: When setting the image, if the currently playing animation of the emitter
|
|
143
|
+
* isn't found in the new image, the animation will be set to the first animation found.
|
|
144
|
+
*/
|
|
145
|
+
image: Hash;
|
|
146
|
+
/**
|
|
147
|
+
* The material used during rendering by an emitter in a particle FX component.
|
|
148
|
+
* The property type is a hash and refers to a material resource.
|
|
149
|
+
*/
|
|
150
|
+
material: Hash;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export {};
|