@ts-defold/types 1.2.78 → 1.2.79
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/index.d.ts +26 -14
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/// <reference types="lua-types/5.1" />
|
|
4
4
|
/// <reference types="lua-types/special/jit-only" />
|
|
5
5
|
|
|
6
|
-
// DEFOLD. stable version 1.12.
|
|
6
|
+
// DEFOLD. stable version 1.12.2 (e43be333aa7a4fc319ab62adc8d405c8e98bf92f)
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* All ids in the engine are represented as hashes, so a string needs to be hashed
|
|
@@ -1603,6 +1603,7 @@ export function fixed_update(this: LuaUserdata, dt: number): void;
|
|
|
1603
1603
|
* @param options optional options table
|
|
1604
1604
|
- index number index into array property (1 based)
|
|
1605
1605
|
- key hash name of internal property
|
|
1606
|
+
- keys table array of internal component resources identified by key (e.g. a particle fx emitter, see examples below)
|
|
1606
1607
|
* @example Get a property "speed" from a script "player", the property must be declared in the player-script:
|
|
1607
1608
|
```lua
|
|
1608
1609
|
go.property("speed", 50)
|
|
@@ -1629,18 +1630,21 @@ Getting all values in a material property array as a table
|
|
|
1629
1630
|
-- get all vector4's in the constant array
|
|
1630
1631
|
go.get(url, "example")
|
|
1631
1632
|
-- result: { vector4, vector4, ... }
|
|
1632
|
-
|
|
1633
1633
|
-- get all elements of the vector4's from an array
|
|
1634
1634
|
go.get(url, "example.x")
|
|
1635
1635
|
-- result: { number1, number2, ... }
|
|
1636
1636
|
```Get a named property
|
|
1637
|
-
|
|
1638
1637
|
```lua
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1638
|
+
lua
|
|
1639
|
+
-- get the resource of a certain gui font
|
|
1640
|
+
local font_hash = go.get("#gui", "fonts", {key = "system_font_BIG"})```Get a property from a sub-component, using the "keys" options table
|
|
1641
|
+
```lua
|
|
1642
|
+
lua
|
|
1643
|
+
-- Addressing the first level of a component:
|
|
1644
|
+
go.get("#particlefx", "material", { keys = { "cone_emitter" } })```Get a property into a deeper sub-hierarchy (if the component supports it).
|
|
1645
|
+
```lua
|
|
1646
|
+
-- Note: There is currently no component that supports this, but a custom component could.
|
|
1647
|
+
go.get("#my_component", "some_property", { keys = { "root", "child_node" } })
|
|
1644
1648
|
*/
|
|
1645
1649
|
export function get(url: string | hash | url, property: string | hash, options?: object): unknown;
|
|
1646
1650
|
/**
|
|
@@ -2173,6 +2177,7 @@ export function property(name: string, value: number | hash | url | vmath.vector
|
|
|
2173
2177
|
* @param options optional options table
|
|
2174
2178
|
- index integer index into array property (1 based)
|
|
2175
2179
|
- key hash name of internal property
|
|
2180
|
+
- keys table array of internal component resources identified by key (e.g. a particle fx emitter, see examples below)
|
|
2176
2181
|
* @example Set a property "speed" of a script "player", the property must be declared in the player-script:
|
|
2177
2182
|
```lua
|
|
2178
2183
|
go.property("speed", 50)
|
|
@@ -2196,18 +2201,25 @@ go.set(url, "example.x", 7, {index=1})
|
|
|
2196
2201
|
|
|
2197
2202
|
Set a material property array by a table of vector4
|
|
2198
2203
|
```lua
|
|
2204
|
+
lua
|
|
2199
2205
|
-- set the first two vector4's in the array
|
|
2200
2206
|
-- if the array has more than two elements in the array they will not be set
|
|
2201
|
-
go.set(url, "example", { vmath.vector4(1,1,1,1), vmath.vector4(2,2,2,2) })
|
|
2202
|
-
```Set a named property
|
|
2203
|
-
|
|
2207
|
+
go.set(url, "example", { vmath.vector4(1,1,1,1), vmath.vector4(2,2,2,2) })```Set a named property
|
|
2204
2208
|
```lua
|
|
2205
2209
|
go.property("big_font", resource.font())
|
|
2206
|
-
|
|
2207
2210
|
function init(self)
|
|
2208
2211
|
go.set("#gui", "fonts", self.big_font, {key = "system_font_BIG"})
|
|
2209
2212
|
end
|
|
2210
|
-
```
|
|
2213
|
+
```Set a property on a sub-component, using the "keys" options table
|
|
2214
|
+
```lua
|
|
2215
|
+
lua
|
|
2216
|
+
go.property("my_material", resource.material)
|
|
2217
|
+
function init(self)
|
|
2218
|
+
go.set("#particlefx", "material", self.my_material, { keys = { "cone_emitter" } })
|
|
2219
|
+
end```Set a property in a deeper sub-hierarchy (if the component supports it).
|
|
2220
|
+
```lua
|
|
2221
|
+
-- Note: There is currently no component that supports this, but a custom component could.
|
|
2222
|
+
go.set("#my_component", "some_property", some_value, { keys = { "root", "child_node" } })
|
|
2211
2223
|
*/
|
|
2212
2224
|
export function set(url: string | hash | url, property: string | hash, value: number | boolean | hash | url | vmath.vector3 | vmath.vector4 | vmath.quaternion | any, options?: object): void;
|
|
2213
2225
|
/**
|
|
@@ -3056,7 +3068,7 @@ export const TYPE_TEXT: number;
|
|
|
3056
3068
|
* This starts an animation of a node property according to the specified parameters.
|
|
3057
3069
|
If the node property is already being animated, that animation will be canceled and
|
|
3058
3070
|
replaced by the new one. Note however that several different node properties
|
|
3059
|
-
can be animated simultaneously. Use `gui.
|
|
3071
|
+
can be animated simultaneously. Use `gui.cancel_animations` to stop the animation
|
|
3060
3072
|
before it has completed.
|
|
3061
3073
|
Composite properties of type vector3, vector4 or quaternion
|
|
3062
3074
|
also expose their sub-components (x, y, z and w).
|