@ts-defold/types 1.2.6 → 1.2.10

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.d.ts +151 -9
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Defold Types
2
- <a href="https://discord.gg/eukcq5m"><img alt="Chat with us!" src="https://img.shields.io/discord/766898804896038942.svg?colorB=7581dc&logo=discord&logoColor=white"></a>
3
2
  <a href="https://www.npmjs.com/package/@ts-defold/type-gen"><img alt="npm install" src="https://img.shields.io/npm/dt/@ts-defold/types?color=%23CA0000&label=npm&logo=npm"></a>
3
+ <a href="https://discord.gg/eukcq5m"><img alt="Chat with us!" src="https://img.shields.io/discord/766898804896038942.svg?colorB=7581dc&logo=discord&logoColor=white"></a>
4
4
  > TypeScript definitions for [Defold](https://defold.com/)
5
5
 
6
6
  ## Installation
package/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  /// <reference types="lua-types/5.1" />
3
3
  /// <reference types="typescript-to-lua/language-extensions" />
4
4
 
5
- // DEFOLD. stable version 1.2.189 (8894457f85514465165401c664f5ba79a7730804)
5
+ // DEFOLD. stable version 1.2.192 (84a9c89dfd5a2c3818c01e7c6777169272d9390b)
6
6
  // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
7
7
 
8
8
 
@@ -742,9 +742,12 @@ The id of the animated property.
742
742
  * gets a named property of the specified game object or component
743
743
  * @param url url of the game object or component having the property
744
744
  * @param property id of the property to retrieve
745
+ * @param options (optional) options table
746
+ index into array property (1 based)
747
+ name of internal property
745
748
  * @return value the value of the specified property
746
749
  */
747
- export function get(url: string | hash | url, property: string | hash): any
750
+ export function get(url: string | hash | url, property: string | hash, options?: any): any
748
751
 
749
752
  /**
750
753
  * Returns or constructs an instance identifier. The instance id is a hash
@@ -848,8 +851,11 @@ The id of the animated property.
848
851
  * @param url url of the game object or component having the property
849
852
  * @param property id of the property to set
850
853
  * @param value the value to set
854
+ * @param options (optional) options table
855
+ index into array property (1 based)
856
+ name of internal property
851
857
  */
852
- export function set(url: string | hash | url, property: string | hash, value: any): void
858
+ export function set(url: string | hash | url, property: string | hash, value: any, options?: any): void
853
859
 
854
860
  /**
855
861
  * Sets the parent for a game object instance. This means that the instance will exist in the geometrical space of its parent,
@@ -930,6 +936,12 @@ The id of the animated property.
930
936
  declare namespace gui {
931
937
 
932
938
 
939
+ /**
940
+ * The fonts used in the gui. The type of the property is hash.
941
+ * Key must be specified in options table.
942
+ */
943
+ export let fonts: any
944
+
933
945
  /**
934
946
  * fit adjust mode
935
947
  */
@@ -1523,6 +1535,12 @@ with a custom curve. See the animation guide for more information.
1523
1535
  */
1524
1536
  export function get_adjust_mode(node: node): any
1525
1537
 
1538
+ /**
1539
+ * gets the node alpha
1540
+ * @param node node from which to get alpha
1541
+ */
1542
+ export function get_alpha(node: node): void
1543
+
1526
1544
  /**
1527
1545
  * Returns the blend mode of a node.
1528
1546
  * Blend mode defines how the node will be blended with the background.
@@ -2139,6 +2157,13 @@ The rate with which the animation will be played. Must be positive
2139
2157
  */
2140
2158
  export function set_adjust_mode(node: node, adjust_mode: any): void
2141
2159
 
2160
+ /**
2161
+ * sets the node alpha
2162
+ * @param node node for which to set alpha
2163
+ * @param alpha 0..1 alpha color
2164
+ */
2165
+ export function set_alpha(node: node, alpha: number): void
2166
+
2142
2167
  /**
2143
2168
  * Set the blend mode of a node.
2144
2169
  * Blend mode defines how the node will be blended with the background.
@@ -2324,7 +2349,7 @@ The rate with which the animation will be played. Must be positive
2324
2349
  * @param parent parent node to set
2325
2350
  * @param keep_scene_transform optional flag to make the scene position being perserved
2326
2351
  */
2327
- export function set_parent(node: node, parent: node, keep_scene_transform: boolean): void
2352
+ export function set_parent(node: node, parent: node, keep_scene_transform?: boolean): void
2328
2353
 
2329
2354
  /**
2330
2355
  * Set the paricle fx for a gui node
@@ -2563,6 +2588,12 @@ The rate with which the animation will be played. Must be positive
2563
2588
 
2564
2589
 
2565
2590
 
2591
+ /**
2592
+ * The textures used in the gui. The type of the property is hash.
2593
+ * Key must be specified in options table.
2594
+ */
2595
+ export let textures: any
2596
+
2566
2597
 
2567
2598
  }
2568
2599
  // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
@@ -2685,6 +2716,18 @@ See each joint type for possible properties field. The one field that is accepte
2685
2716
  */
2686
2717
  export function get_gravity(): vmath.vector3
2687
2718
 
2719
+ /**
2720
+ * Returns the group name of a collision object as a hash.
2721
+ * @param url the collision object to return the group of.
2722
+ * @return hash value of the group.
2723
+ local function check_is_enemy()
2724
+ local group = physics.get_group(&quot;#collisionobject&quot;)
2725
+ return group == hash(&quot;enemy&quot;)
2726
+ end
2727
+
2728
+ */
2729
+ export function get_group(url: string | hash | url): hash
2730
+
2688
2731
  /**
2689
2732
  * Get a table for properties for a connected joint. The joint has to be created before
2690
2733
  * properties can be retrieved.
@@ -2718,6 +2761,21 @@ See each joint type for possible properties field. The one field that is accepte
2718
2761
  */
2719
2762
  export function get_joint_reaction_torque(collisionobject: string | hash | url, joint_id: string | hash): any
2720
2763
 
2764
+ /**
2765
+ * Returns true if the specified group is set in the mask of a collision
2766
+ * object, false otherwise.
2767
+ * @param url the collision object to check the mask of.
2768
+ * @param group the name of the group to check for.
2769
+ * @return boolean value of the maskbit. 'true' if present, 'false' otherwise.
2770
+ local function is_invincible()
2771
+ -- check if the collisionobject would collide with the &quot;bullet&quot; group
2772
+ local invincible = physics.get_maskbit(&quot;#collisionobject&quot;, &quot;bullet&quot;)
2773
+ return invincible
2774
+ end
2775
+
2776
+ */
2777
+ export function get_maskbit(url: string | hash | url, group: string): boolean
2778
+
2721
2779
  /**
2722
2780
  * Ray casts are used to test for intersections against collision objects in the physics world.
2723
2781
  * Collision objects of types kinematic, dynamic and static are tested against. Trigger objects
@@ -2762,6 +2820,19 @@ Set to `true` to return all ray cast hits. If `false`, it will only return the c
2762
2820
  */
2763
2821
  export function set_gravity(gravity: vmath.vector3): void
2764
2822
 
2823
+ /**
2824
+ * Updates the group property of a collision object to the specified
2825
+ * string value. The group name should exist i.e. have been used in
2826
+ * a collision object in the editor.
2827
+ * @param url the collision object affected.
2828
+ * @param group the new group name to be assigned.
2829
+ local function change_collision_group()
2830
+ physics.set_group(&quot;#collisionobject&quot;, &quot;enemy&quot;)
2831
+ end
2832
+
2833
+ */
2834
+ export function set_group(url: string | hash | url, group: string): void
2835
+
2765
2836
  /**
2766
2837
  * Flips the collision shapes horizontally for a collision object
2767
2838
  * @param url the collision object that should flip its shapes
@@ -2780,6 +2851,19 @@ Note: The `collide_connected` field cannot be updated/changed after a connection
2780
2851
  */
2781
2852
  export function set_joint_properties(collisionobject: string | hash | url, joint_id: string | hash, properties: any): void
2782
2853
 
2854
+ /**
2855
+ * Sets or clears the masking of a group (maskbit) in a collision object.
2856
+ * @param url the collision object to change the mask of.
2857
+ * @param group the name of the group (maskbit) to modify in the mask.
2858
+ * @param maskbit boolean value of the new maskbit. 'true' to enable, 'false' to disable.
2859
+ local function make_invincible()
2860
+ -- no longer collide with the &quot;bullet&quot; group
2861
+ physics.set_maskbit(&quot;#collisionobject&quot;, &quot;bullet&quot;, false)
2862
+ end
2863
+
2864
+ */
2865
+ export function set_maskbit(url: string | hash | url, group: string, maskbit: boolean): void
2866
+
2783
2867
  /**
2784
2868
  * Flips the collision shapes vertically for a collision object
2785
2869
  * @param url the collision object that should flip its shapes
@@ -3925,6 +4009,7 @@ declare namespace resource {
3925
4009
  /**
3926
4010
  * Gets the text metrics from a font
3927
4011
  * @param url the font to get the (unscaled) metrics from
4012
+ * @param text text to measure
3928
4013
  * @param options A table containing parameters for the text. Supported entries:
3929
4014
 
3930
4015
  `width`
@@ -3944,7 +4029,7 @@ If the calculation should consider line breaks (default false)
3944
4029
  - max_descent
3945
4030
 
3946
4031
  */
3947
- export function get_text_metrics(url: hash, options: any): any
4032
+ export function get_text_metrics(url: hash, text: string, options?: any): any
3948
4033
 
3949
4034
  /**
3950
4035
  * Is any liveupdate data mounted and currently in use?
@@ -4306,7 +4391,7 @@ Only available on iOS and Android.
4306
4391
  `manufacturer`
4307
4392
  Only available on iOS and Android.
4308
4393
  `system_name`
4309
- The system OS name: "Darwin", "Linux", "Windows", "HTML5", "Android" or "iPhone OS"
4394
+ The system name: "Darwin", "Linux", "Windows", "HTML5", "Android" or "iPhone OS"
4310
4395
  `system_version`
4311
4396
  The system OS version.
4312
4397
  `api_version`
@@ -4888,6 +4973,13 @@ The elapsed time - on first trigger it is time since timer.delay call, otherwise
4888
4973
  */
4889
4974
  export function delay(delay: number, repeat: boolean, callback: any): hash
4890
4975
 
4976
+ /**
4977
+ * Manual triggering a callback for a timer.
4978
+ * @param handle the timer handle returned by timer.delay()
4979
+ * @return true if the timer was active, false if the timer is already cancelled / complete
4980
+ */
4981
+ export function trigger(handle: hash): boolean
4982
+
4891
4983
  }
4892
4984
  // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
4893
4985
 
@@ -5394,6 +5486,24 @@ declare namespace camera {
5394
5486
  */
5395
5487
  export type acquire_camera_focus = "acquire_camera_focus"
5396
5488
 
5489
+ /**
5490
+ * Camera frustum far plane.
5491
+ * The type of the property is float.
5492
+ */
5493
+ export let far_z: any
5494
+
5495
+ /**
5496
+ * Vertical field of view of the camera.
5497
+ * The type of the property is float.
5498
+ */
5499
+ export let fov: any
5500
+
5501
+ /**
5502
+ * Camera frustum near plane.
5503
+ * The type of the property is float.
5504
+ */
5505
+ export let near_z: any
5506
+
5397
5507
  /**
5398
5508
  *
5399
5509
  * Post this message to a camera-component to deactivate it. The camera is then removed from the active cameras.
@@ -6173,6 +6283,11 @@ declare namespace spine {
6173
6283
 
6174
6284
  declare namespace sprite {
6175
6285
 
6286
+ /**
6287
+ * hash.
6288
+ */
6289
+ export let animation: any
6290
+
6176
6291
  /**
6177
6292
  * This message is sent to the sender of a `play_animation` message when the
6178
6293
  * animation has completed.
@@ -6293,6 +6408,31 @@ declare namespace tilemap {
6293
6408
  */
6294
6409
  export let tile_source: any
6295
6410
 
6411
+ /**
6412
+ * flip tile horizontally
6413
+ */
6414
+ export let H_FLIP: any
6415
+
6416
+ /**
6417
+ * rotate tile 180 degrees clockwise
6418
+ */
6419
+ export let ROTATE_180: any
6420
+
6421
+ /**
6422
+ * rotate tile 270 degrees clockwise
6423
+ */
6424
+ export let ROTATE_270: any
6425
+
6426
+ /**
6427
+ * rotate tile 90 degrees clockwise
6428
+ */
6429
+ export let ROTATE_90: any
6430
+
6431
+ /**
6432
+ * flip tile vertically
6433
+ */
6434
+ export let V_FLIP: any
6435
+
6296
6436
  /**
6297
6437
  * Get the bounds for a tile map. This function returns multiple values:
6298
6438
  * The lower left corner index x and y coordinates (1-indexed),
@@ -6341,15 +6481,17 @@ declare namespace tilemap {
6341
6481
  * The coordinates must be within the bounds of the tile map as it were created.
6342
6482
  * That is, it is not possible to extend the size of a tile map by setting tiles outside the edges.
6343
6483
  * To clear a tile, set the tile to number 0. Which tile map and layer to manipulate is identified by the URL and the layer name parameters.
6484
+ * Transform bitmask is arithmetic sum of one or both FLIP constants (`tilemap.H_FLIP`, `tilemap.V_FLIP`) and/or one of ROTATION constants
6485
+ * (`tilemap.ROTATE_90`, `tilemap.ROTATE_180`, `tilemap.ROTATE_270`).
6486
+ * Flip always applies before rotation (clockwise).
6344
6487
  * @param url the tile map
6345
6488
  * @param layer name of the layer for the tile
6346
6489
  * @param x x-coordinate of the tile
6347
6490
  * @param y y-coordinate of the tile
6348
6491
  * @param tile index of new tile to set. 0 resets the cell
6349
- * @param h_flipped optional if the tile should be horizontally flipped
6350
- * @param v_flipped optional i the tile should be vertically flipped
6492
+ * @param transform_bitmask optional flip and/or rotation should be applied to the tile
6351
6493
  */
6352
- export function set_tile(url: string | hash | url, layer: string | hash, x: number, y: number, tile: number, h_flipped?: boolean, v_flipped?: boolean): void
6494
+ export function set_tile(url: string | hash | url, layer: string | hash, x: number, y: number, tile: number, transform_bitmask?: number): void
6353
6495
 
6354
6496
  /**
6355
6497
  * Sets the visibility of the tilemap layer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-defold/types",
3
- "version": "1.2.6",
3
+ "version": "1.2.10",
4
4
  "description": "TypeScript definitions for Defold",
5
5
  "repository": "github:ts-defold/types",
6
6
  "keywords": [
@@ -27,7 +27,7 @@
27
27
  "lua-types": "^2.10.1"
28
28
  },
29
29
  "devDependencies": {
30
- "@ts-defold/type-gen": "^0.5.0",
30
+ "@ts-defold/type-gen": "^0.5.2",
31
31
  "typescript": "4.3.4",
32
32
  "typescript-to-lua": "^1.0.1"
33
33
  },