Skip to content

Commit f5379cf

Browse files
committed
update to 1.2.191
1 parent 11cb3d0 commit f5379cf

32 files changed

Lines changed: 4593 additions & 2537 deletions

DefoldDocs/api/collision_object.lua

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ function physics.destroy_joint(collisionobject, joint_id) end
3636
---@return vector3 gravity vector of collection
3737
function physics.get_gravity() end
3838

39+
---Returns the group name of a collision object as a hash.
40+
---@param url string|hash|url the collision object to return the group of.
41+
---@return hash hash value of the group. function checkIsEnemy() local grp = physics.get_group("#collisionobject") assert( grp == hash("enemy") ) end
42+
function physics.get_group(url) end
43+
3944
---Get a table for properties for a connected joint. The joint has to be created before
4045
---properties can be retrieved.
4146
---Note: Currently only supported in 2D physics.
@@ -60,6 +65,13 @@ function physics.get_joint_reaction_force(collisionobject, joint_id) end
6065
---@return float the reaction torque on bodyB in N*m.
6166
function physics.get_joint_reaction_torque(collisionobject, joint_id) end
6267

68+
---Returns true if the specified group is set in the mask of a collision
69+
---object, false otherwise.
70+
---@param url string|hash|url the collision object to check the mask of.
71+
---@param group string the name of the group to check for.
72+
---@return boolean boolean value of the maskbit. 'true' if present, 'false' otherwise. function checkCollideWithUser() -- to check if the collisionobject would collide with "user" group local hits_user = physics.get_maskbit("#collisionobject","user") return hits_user end
73+
function physics.get_maskbit(url, group) end
74+
6375
---Ray casts are used to test for intersections against collision objects in the physics world.
6476
---Collision objects of types kinematic, dynamic and static are tested against. Trigger objects
6577
---do not intersect with ray casts.
@@ -95,6 +107,13 @@ function physics.raycast_async(from, to, groups, request_id) end
95107
---@param gravity vector3 the new gravity vector
96108
function physics.set_gravity(gravity) end
97109

110+
---Updates the group property of a collision object to the specified
111+
---string value. The group name should exist i.e. have been used in
112+
---a collision object in the editor.
113+
---@param url string|hash|url the collision object affected.
114+
---@param group string the new group name to be assigned. function changeCollisionGroup() physics.set_group("#collisionobject", "enemy") end
115+
function physics.set_group(url, group) end
116+
98117
---Flips the collision shapes horizontally for a collision object
99118
---@param url string|hash|url the collision object that should flip its shapes
100119
---@param flip boolean true if the collision object should flip its shapes, false if not
@@ -108,6 +127,12 @@ function physics.set_hflip(url, flip) end
108127
---@param properties table joint specific properties table Note: The collide_connected field cannot be updated/changed after a connection has been made.
109128
function physics.set_joint_properties(collisionobject, joint_id, properties) end
110129

130+
---Sets or clears the masking of a group (maskbit) in a collision object.
131+
---@param url string|hash|url the collision object to change the mask of.
132+
---@param group string the name of the group (maskbit) to modify in the mask.
133+
---@param type bool boolean value of the new maskbit. 'true' to enable, 'false' to disable. function makeUserAlly() -- no longer collide with the "user" group physics.set_maskbit("#collisionobject","user",false) end
134+
function physics.set_maskbit(url, group, type) end
135+
111136
---Flips the collision shapes vertically for a collision object
112137
---@param url string|hash|url the collision object that should flip its shapes
113138
---@param flip boolean true if the collision object should flip its shapes, false if not

DefoldDocs/api/game_object.lua

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ go.PLAYBACK_ONCE_PINGPONG = nil
112112
---By starting a new animation in that function, several animations can be sequenced together. See the examples for more information.
113113
--- If you call go.animate() from a game object's final() function,
114114
---any passed complete_function will be ignored and never called upon animation completion.
115-
---See the properties guide <> for which properties can be animated and the animation guide <> for how to animate them.
115+
---See the properties guide <> for which properties can be animated and the animation guide <> for how
116+
---them.
116117
---@param url string|hash|url url of the game object or component having the property
117118
---@param property string|hash id of the property to animate
118119
---@param playback constant playback mode of the animation
@@ -126,7 +127,7 @@ function go.animate(url, property, playback, to, easing, duration, delay, comple
126127
---By calling this function, all stored animations of the given property will be canceled.
127128
---See the properties guide <> for which properties can be animated and the animation guide <> for how to animate them.
128129
---@param url string|hash|url url of the game object or component having the property
129-
---@param property string|hash ide of the property to animate
130+
---@param property string|hash id of the property to cancel
130131
function go.cancel_animations(url, property) end
131132

132133
---Delete one or more game objects identified by id. Deletion is asynchronous meaning that
@@ -142,8 +143,9 @@ function go.delete(id, recursive) end
142143
---gets a named property of the specified game object or component
143144
---@param url string|hash|url url of the game object or component having the property
144145
---@param property string|hash id of the property to retrieve
146+
---@param options table (optional) options table - index integer index into array property (1 based) - key hash name of internal property
145147
---@return any the value of the specified property
146-
function go.get(url, property) end
148+
function go.get(url, property, options) end
147149

148150
---Returns or constructs an instance identifier. The instance id is a hash
149151
---of the absolute path to the instance.
@@ -223,7 +225,8 @@ function go.property(name, value) end
223225
---@param url string|hash|url url of the game object or component having the property
224226
---@param property string|hash id of the property to set
225227
---@param value any the value to set
226-
function go.set(url, property, value) end
228+
---@param options table (optional) options table - index integer index into array property (1 based) - key hash name of internal property
229+
function go.set(url, property, value, options) end
227230

228231
---Sets the parent for a game object instance. This means that the instance will exist in the geometrical space of its parent,
229232
---like a basic transformation hierarchy or scene graph. If no parent is specified, the instance will be detached from any parent and exist in world

DefoldDocs/api/gui.lua

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ function gui.delete_texture(texture) end
258258
---@return constant the current adjust mode
259259
function gui.get_adjust_mode(node) end
260260

261+
---gets the node alpha
262+
---@param node node node from which to get alpha
263+
function gui.get_alpha(node) end
264+
261265
---Returns the blend mode of a node.
262266
---Blend mode defines how the node will be blended with the background.
263267
---@param node node node from which to get the blend mode
@@ -316,6 +320,11 @@ function gui.get_flipbook_playback_rate(node) end
316320
---@return hash font id
317321
function gui.get_font(node) end
318322

323+
---This is only useful for text nodes. The font must be mapped to the gui scene in the gui editor.
324+
---@param font_name hash|string font of which to get the path hash
325+
---@return hash path hash to resource
326+
function gui.get_font_resource(font_name) end
327+
319328
---Returns the scene height.
320329
---@return number scene height
321330
function gui.get_height() end
@@ -488,21 +497,6 @@ function gui.get_spine_skin(node) end
488497
---@return string text value
489498
function gui.get_text(node) end
490499

491-
---Get text metrics given the provided font, text and parameters.
492-
---@param font string|hash font id
493-
---@param text string text to measure
494-
---@param width number max-width. Use for line-breaks (default=FLT_MAX)
495-
---@param line_break boolean true to break lines accordingly to width (default=false)
496-
---@param leading number scale value for line spacing (default=1)
497-
---@param tracking number scale value for letter spacing (default=0)
498-
---@return table a table with the following fields:
499-
function gui.get_text_metrics(font, text, width, line_break, leading, tracking) end
500-
501-
---Get the text metrics from a text node.
502-
---@param node node text node to measure text from
503-
---@return table a table with the following fields:
504-
function gui.get_text_metrics_from_node(node) end
505-
506500
---Returns the texture of a node.
507501
---This is currently only useful for box or pie nodes.
508502
---The texture must be mapped to the gui scene in the gui editor.
@@ -639,6 +633,11 @@ function gui.reset_nodes() end
639633
---@param adjust_mode constant adjust mode to set
640634
function gui.set_adjust_mode(node, adjust_mode) end
641635

636+
---sets the node alpha
637+
---@param node node node for which to set alpha
638+
---@param alpha number 0..1 alpha color
639+
function gui.set_alpha(node, alpha) end
640+
642641
---Set the blend mode of a node.
643642
---Blend mode defines how the node will be blended with the background.
644643
---@param node node node to set blend mode for

DefoldDocs/api/label.lua

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ label = {}
77
---@return string the label text
88
function label.get_text(url) end
99

10-
---Gets the text metrics from a label component
11-
---@param url string|hash|url the label to get the (unscaled) metrics from
12-
---@return table a table with the following fields:
13-
function label.get_text_metrics(url) end
14-
1510
---Sets the text of a label component
1611
--- This method uses the message passing that means the value will be set after dispatch messages step.
1712
---More information is available in the Application Lifecycle manual <>.

DefoldDocs/api/resource.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ function resource.get_buffer(path) end
7171
---@return number reference to the Manifest that is currently loaded
7272
function resource.get_current_manifest() end
7373

74+
---Gets the text metrics from a font
75+
---@param url hash the font to get the (unscaled) metrics from
76+
---@param text string text to measure
77+
---@param options table A table containing parameters for the text. Supported entries:
78+
---@return table a table with the following fields:
79+
function resource.get_text_metrics(url, text, options) end
80+
7481
---Is any liveupdate data mounted and currently in use?
7582
---This can be used to determine if a new manifest or zip file should be downloaded.
7683
---@return bool true if a liveupdate archive (any format) has been loaded

DefoldDocs/api/sound.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ function sound.pause(url, pause) end
8989
---@param url string|hash|url the sound that should play
9090
---@param play_properties table
9191
---@param complete_function function(self, message_id, message, sender)) function to call when the sound has finished playing.
92+
---@return number The identifier for the sound voice
9293
function sound.play(url, play_properties, complete_function) end
9394

9495
---Set gain on all active playing voices of a sound.

DefoldDocs/api/spine.lua

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2,67 +2,6 @@
22
---Spine model API documentation
33
---@class spine
44
spine = {}
5-
---Cancels all running animations on a specified spine model component.
6-
---@param url string|hash|url the spine model for which to cancel the animation
7-
function spine.cancel(url) end
8-
9-
---Returns the id of the game object that corresponds to a specified skeleton bone.
10-
---The returned game object can be used for parenting and transform queries.
11-
---This function has complexity O(n), where n is the number of bones in the spine model skeleton.
12-
---Game objects corresponding to a spine model skeleton bone can not be individually deleted.
13-
---@param url string|hash|url the spine model to query
14-
---@param bone_id string|hash id of the corresponding bone
15-
---@return hash id of the game object
16-
function spine.get_go(url, bone_id) end
17-
18-
---Plays a specified animation on a spine model component with specified playback
19-
---mode and parameters.
20-
---An optional completion callback function can be provided that will be called when
21-
---the animation has completed playing. If no function is provided,
22-
---a spine_animation_done <> message is sent to the script that started the animation.
23-
--- The callback is not called (or message sent) if the animation is
24-
---cancelled with spine.cancel <>. The callback is called (or message sent) only for
25-
---animations that play with the following playback modes:
26-
---
27-
---
28-
--- * go.PLAYBACK_ONCE_FORWARD
29-
---
30-
--- * go.PLAYBACK_ONCE_BACKWARD
31-
---
32-
--- * go.PLAYBACK_ONCE_PINGPONG
33-
---@param url string|hash|url the spine model for which to play the animation
34-
---@param anim_id string|hash id of the animation to play
35-
---@param playback constant playback mode of the animation
36-
---@param play_properties table optional table with properties:
37-
---@param complete_function function(self, message_id, message, sender)) function to call when the animation has completed.
38-
function spine.play_anim(url, anim_id, playback, play_properties, complete_function) end
39-
40-
---Resets any previously set IK target of a spine model, the position will be reset
41-
---to the original position from the spine scene.
42-
---@param url string|hash|url the spine model containing the object
43-
---@param ik_constraint_id string|hash id of the corresponding IK constraint object
44-
function spine.reset_ik_target(url, ik_constraint_id) end
45-
46-
---Sets a game object as target position of an inverse kinematic (IK) object. As the
47-
---target game object's position is updated, the constraint object is updated with the
48-
---new position.
49-
---@param url string|hash|url the spine model containing the object
50-
---@param ik_constraint_id string|hash id of the corresponding IK constraint object
51-
---@param target_url string|hash|url target game object
52-
function spine.set_ik_target(url, ik_constraint_id, target_url) end
53-
54-
---Sets a static (vector3) target position of an inverse kinematic (IK) object.
55-
---@param url string|hash|url the spine model containing the object
56-
---@param ik_constraint_id string|hash id of the corresponding IK constraint object
57-
---@param position vector3 target position
58-
function spine.set_ik_target_position(url, ik_constraint_id, position) end
59-
60-
---Sets the spine skin on a spine model.
61-
---@param url string|hash|url the spine model for which to set skin
62-
---@param spine_skin string|hash spine skin id
63-
---@param spine_slot string|hash optional slot id to only change a specific slot
64-
function spine.set_skin(url, spine_skin, spine_slot) end
65-
665

676

687

DefoldDocs/api/system.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ sys.NETWORK_CONNECTED = nil
99
sys.NETWORK_CONNECTED_CELLULAR = nil
1010
---no network connection found
1111
sys.NETWORK_DISCONNECTED = nil
12+
---deserializes buffer into a lua table
13+
---@param buffer string buffer to deserialize from
14+
---@return table lua table with deserialized data
15+
function sys.deserialize(buffer) end
16+
1217
---Terminates the game application and reports the specified code to the OS.
1318
---@param code number exit code to report to the OS, 0 means clean exit
1419
function sys.exit(code) end
@@ -114,6 +119,12 @@ function sys.reboot(arg1, arg2, arg3, arg4, arg5, arg6) end
114119
---@return boolean a boolean indicating if the table could be saved or not
115120
function sys.save(filename, table) end
116121

122+
---The buffer can later deserialized by sys.deserialize.
123+
---This method has all the same limitations as sys.save.
124+
---@param table table lua table to serialize
125+
---@return string serialized data buffer
126+
function sys.serialize(table) end
127+
117128
---Sets the host that is used to check for network connectivity against.
118129
---@param host string hostname to check against
119130
function sys.set_connectivity_host(host) end

DefoldDocs/api/tilemap.lua

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
---Functions and messages used to manipulate tile map components.
33
---@class tilemap
44
tilemap = {}
5+
---flip tile horizontally
6+
tilemap.H_FLIP = nil
7+
---rotate tile 180 degrees clockwise
8+
tilemap.ROTATE_180 = nil
9+
---rotate tile 270 degrees clockwise
10+
tilemap.ROTATE_270 = nil
11+
---rotate tile 90 degrees clockwise
12+
tilemap.ROTATE_90 = nil
13+
---flip tile vertically
14+
tilemap.V_FLIP = nil
515
---Get the bounds for a tile map. This function returns multiple values:
616
---The lower left corner index x and y coordinates (1-indexed),
717
---the tile map width and the tile map height.
@@ -45,14 +55,16 @@ function tilemap.get_tile(url, layer, x, y) end
4555
---The coordinates must be within the bounds of the tile map as it were created.
4656
---That is, it is not possible to extend the size of a tile map by setting tiles outside the edges.
4757
---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.
58+
---Transform bitmask is arithmetic sum of one or both FLIP constants (tilemap.H_FLIP, tilemap.V_FLIP) and/or one of ROTATION constants
59+
---(tilemap.ROTATE_90, tilemap.ROTATE_180, tilemap.ROTATE_270).
60+
---Flip always applies before rotation (clockwise).
4861
---@param url string|hash|url the tile map
4962
---@param layer string|hash name of the layer for the tile
5063
---@param x number x-coordinate of the tile
5164
---@param y number y-coordinate of the tile
5265
---@param tile number index of new tile to set. 0 resets the cell
53-
---@param h_flipped boolean optional if the tile should be horizontally flipped
54-
---@param v_flipped boolean optional i the tile should be vertically flipped
55-
function tilemap.set_tile(url, layer, x, y, tile, h_flipped, v_flipped) end
66+
---@param transform_bitmask number optional flip and/or rotation should be applied to the tile
67+
function tilemap.set_tile(url, layer, x, y, tile, transform_bitmask) end
5668

5769
---Sets the visibility of the tilemap layer
5870
---@param url string|hash|url the tile map

DefoldDocs/api/timer.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ function timer.cancel(handle) end
2525
---@return hash handle identifier for the create timer, returns timer.INVALID_TIMER_HANDLE if the timer can not be created
2626
function timer.delay(delay, _repeat, callback) end
2727

28+
---Manual triggering a callback for a timer.
29+
---@param handle hash the timer handle returned by timer.delay()
30+
---@return boolean if the timer was active, false if the timer is already cancelled / complete
31+
function timer.trigger(handle) end
32+
2833

2934

3035

0 commit comments

Comments
 (0)