diff options
Diffstat (limited to 'doc/classes/@GlobalScope.xml')
-rw-r--r-- | doc/classes/@GlobalScope.xml | 136 |
1 files changed, 89 insertions, 47 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index d4680d1836..5d45947a19 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -23,7 +23,7 @@ Returns the absolute value of float parameter [code]x[/code] (i.e. positive value). [codeblock] # a is 1.2 - a = absf(-1.2) + var a = absf(-1.2) [/codeblock] </description> </method> @@ -34,7 +34,7 @@ Returns the absolute value of int parameter [code]x[/code] (i.e. positive value). [codeblock] # a is 1 - a = absi(-1) + var a = absi(-1) [/codeblock] </description> </method> @@ -45,7 +45,7 @@ Returns the arc cosine of [code]x[/code] in radians. Use to get the angle of cosine [code]x[/code]. [code]x[/code] must be between [code]-1.0[/code] and [code]1.0[/code] (inclusive), otherwise, [method acos] will return [constant @GDScript.NAN]. [codeblock] # c is 0.523599 or 30 degrees if converted with rad2deg(c) - c = acos(0.866025) + var c = acos(0.866025) [/codeblock] </description> </method> @@ -56,7 +56,7 @@ Returns the arc sine of [code]x[/code] in radians. Use to get the angle of sine [code]x[/code]. [code]x[/code] must be between [code]-1.0[/code] and [code]1.0[/code] (inclusive), otherwise, [method asin] will return [constant @GDScript.NAN]. [codeblock] # s is 0.523599 or 30 degrees if converted with rad2deg(s) - s = asin(0.5) + var s = asin(0.5) [/codeblock] </description> </method> @@ -64,11 +64,12 @@ <return type="float" /> <argument index="0" name="x" type="float" /> <description> - Returns the arc tangent of [code]x[/code] in radians. Use it to get the angle from an angle's tangent in trigonometry: [code]atan(tan(angle)) == angle[/code]. + Returns the arc tangent of [code]x[/code] in radians. Use it to get the angle from an angle's tangent in trigonometry. The method cannot know in which quadrant the angle should fall. See [method atan2] if you have both [code]y[/code] and [code]x[/code]. [codeblock] - a = atan(0.5) # a is 0.463648 + var a = atan(0.5) # a is 0.463648 [/codeblock] + If [code]x[/code] is between [code]-PI / 2[/code] and [code]PI / 2[/code] (inclusive), [code]atan(tan(x))[/code] is equal to [code]x[/code]. </description> </method> <method name="atan2"> @@ -79,7 +80,7 @@ Returns the arc tangent of [code]y/x[/code] in radians. Use to get the angle of tangent [code]y/x[/code]. To compute the value, the method takes into account the sign of both arguments in order to determine the quadrant. Important note: The Y coordinate comes first, by convention. [codeblock] - a = atan2(0, -1) # a is 3.141593 + var a = atan2(0, -1) # a is 3.141593 [/codeblock] </description> </method> @@ -99,22 +100,14 @@ [b]Warning:[/b] Deserialized object can contain code which gets executed. Do not use this option if the serialized object comes from untrusted sources to avoid potential security threats (remote code execution). </description> </method> - <method name="cartesian2polar"> - <return type="Vector2" /> - <argument index="0" name="x" type="float" /> - <argument index="1" name="y" type="float" /> - <description> - Converts a 2D point expressed in the cartesian coordinate system (X and Y axis) to the polar coordinate system (a distance from the origin and an angle). - </description> - </method> <method name="ceil"> <return type="float" /> <argument index="0" name="x" type="float" /> <description> Rounds [code]x[/code] upward (towards positive infinity), returning the smallest whole number that is not less than [code]x[/code]. [codeblock] - i = ceil(1.45) # i is 2 - i = ceil(1.001) # i is 2 + var i = ceil(1.45) # i is 2.0 + i = ceil(1.001) # i is 2.0 [/codeblock] See also [method floor], [method round], and [method snapped]. </description> @@ -135,9 +128,9 @@ <description> Clamps the float [code]value[/code] and returns a value not less than [code]min[/code] and not more than [code]max[/code]. [codeblock] - speed = 42.1 + var speed = 42.1 # a is 20.0 - a = clampf(speed, 1.0, 20.0) + var a = clampf(speed, 1.0, 20.0) speed = -10.0 # a is -1.0 @@ -153,9 +146,9 @@ <description> Clamps the integer [code]value[/code] and returns a value not less than [code]min[/code] and not more than [code]max[/code]. [codeblock] - speed = 42 + var speed = 42 # a is 20 - a = clampi(speed, 1, 20) + var a = clampi(speed, 1, 20) speed = -10 # a is -1 @@ -169,9 +162,9 @@ <description> Returns the cosine of angle [code]angle_rad[/code] in radians. [codeblock] - # Prints 1 then -1 - print(cos(PI * 2)) - print(cos(PI)) + cos(PI * 2) # Returns 1.0 + cos(PI) # Returns -1.0 + cos(deg2rad(90)) # Returns 0.0 [/codeblock] </description> </method> @@ -200,7 +193,7 @@ Converts an angle expressed in degrees to radians. [codeblock] # r is 3.141593 - r = deg2rad(180) + var r = deg2rad(180) [/codeblock] </description> </method> @@ -209,7 +202,18 @@ <argument index="0" name="x" type="float" /> <argument index="1" name="curve" type="float" /> <description> - Easing function, based on exponent. The curve values are: 0 is constant, 1 is linear, 0 to 1 is ease-in, 1+ is ease out. Negative values are in-out/out in. + Returns an "eased" value of [code]x[/code] based on an easing function defined with [code]curve[/code]. This easing function is based on an exponent. The [code]curve[/code] can be any floating-point number, with specific values leading to the following behaviors: + [codeblock] + - Lower than -1.0 (exclusive): Ease in-out + - 1.0: Linear + - Between -1.0 and 0.0 (exclusive): Ease out-in + - 0.0: Constant + - Between 0.0 to 1.0 (exclusive): Ease in + - 1.0: Linear + - Greater than 1.0 (exclusive): Ease out + [/codeblock] + [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/ease_cheatsheet.png]ease() curve values cheatsheet[/url] + See also [method smoothstep]. If you need to perform more advanced transitions, use [Tween] or [AnimationPlayer]. </description> </method> <method name="error_string"> @@ -227,7 +231,7 @@ [b]e[/b] has an approximate value of 2.71828, and can be obtained with [code]exp(1)[/code]. For exponents to other bases use the method [method pow]. [codeblock] - a = exp(2) # Approximately 7.39 + var a = exp(2) # Approximately 7.39 [/codeblock] </description> </method> @@ -238,7 +242,7 @@ Rounds [code]x[/code] downward (towards negative infinity), returning the largest whole number that is not more than [code]x[/code]. [codeblock] # a is 2.0 - a = floor(2.99) + var a = floor(2.99) # a is -3.0 a = floor(-2.99) [/codeblock] @@ -521,14 +525,6 @@ [b]Warning:[/b] Due to the way it is implemented, this function returns [code]0[/code] rather than [code]1[/code] for non-positive values of [code]value[/code] (in reality, 1 is the smallest integer power of 2). </description> </method> - <method name="polar2cartesian"> - <return type="Vector2" /> - <argument index="0" name="r" type="float" /> - <argument index="1" name="th" type="float" /> - <description> - Converts a 2D point expressed in the polar coordinate system (a distance from the origin [code]r[/code] and an angle [code]th[/code]) to the cartesian coordinate system (X and Y axis). - </description> - </method> <method name="posmod"> <return type="int" /> <argument index="0" name="x" type="int" /> @@ -566,12 +562,17 @@ <description> Converts one or more arguments of any type to string in the best way possible and prints them to the console. [codeblock] - a = [1, 2, 3] + var a = [1, 2, 3] print("a", "b", a) # Prints ab[1, 2, 3] [/codeblock] [b]Note:[/b] Consider using [method push_error] and [method push_warning] to print error and warning messages instead of [method print]. This distinguishes them from print messages used for debugging purposes, while also displaying a stack trace when an error or warning is printed. </description> </method> + <method name="print_verbose" qualifiers="vararg"> + <description> + If verbose mode is enabled ([method OS.is_stdout_verbose] returning [code]true[/code]), converts one or more arguments of any type to string in the best way possible and prints them to the console. + </description> + </method> <method name="printerr" qualifiers="vararg"> <description> Prints one or more arguments to strings in the best way possible to standard error line. @@ -711,6 +712,19 @@ <description> </description> </method> + <method name="rid_allocate_id"> + <return type="int" /> + <description> + Allocate a unique ID which can be used by the implementation to construct a RID. This is used mainly from native extensions to implement servers. + </description> + </method> + <method name="rid_from_int64"> + <return type="RID" /> + <argument index="0" name="base" type="int" /> + <description> + Create a RID from an int64. This is used mainly from native extensions to build servers. + </description> + </method> <method name="round"> <return type="float" /> <argument index="0" name="x" type="float" /> @@ -727,7 +741,7 @@ <description> Sets seed for the random number generator. [codeblock] - my_seed = "Godot Rocks" + var my_seed = "Godot Rocks" seed(my_seed.hash()) [/codeblock] </description> @@ -768,7 +782,8 @@ <description> Returns the sine of angle [code]angle_rad[/code] in radians. [codeblock] - sin(0.523599) # Returns 0.5 + sin(0.523599) # Returns 0.5 + sin(deg2rad(90)) # Returns 1.0 [/codeblock] </description> </method> @@ -778,7 +793,7 @@ <description> Returns the hyperbolic sine of [code]x[/code]. [codeblock] - a = log(2.0) # Returns 0.693147 + var a = log(2.0) # Returns 0.693147 sinh(a) # Returns 0.75 [/codeblock] </description> @@ -798,6 +813,8 @@ smoothstep(0, 2, 1.0) # Returns 0.5 smoothstep(0, 2, 2.0) # Returns 1.0 [/codeblock] + Compared to [method ease] with a curve value of [code]-1.6521[/code], [method smoothstep] returns the smoothest possible curve with no sudden changes in the derivative. If you need to perform more advanced transitions, use [Tween] or [AnimationPlayer]. + [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/smoothstep_ease_comparison.png]Comparison between smoothstep() and ease(x, -1.6521) return values[/url] </description> </method> <method name="snapped"> @@ -831,7 +848,7 @@ Returns the position of the first non-zero digit, after the decimal point. Note that the maximum return value is 10, which is a design decision in the implementation. [codeblock] # n is 0 - n = step_decimals(5) + var n = step_decimals(5) # n is 4 n = step_decimals(1.0005) # n is 9 @@ -851,8 +868,8 @@ <description> Converts a formatted string that was returned by [method var2str] to the original value. [codeblock] - a = '{ "a": 1, "b": 2 }' - b = str2var(a) + var a = '{ "a": 1, "b": 2 }' + var b = str2var(a) print(b["a"]) # Prints 1 [/codeblock] </description> @@ -873,7 +890,7 @@ <description> Returns the hyperbolic tangent of [code]x[/code]. [codeblock] - a = log(2.0) # Returns 0.693147 + var a = log(2.0) # Returns 0.693147 tanh(a) # Returns 0.6 [/codeblock] </description> @@ -1072,8 +1089,8 @@ <member name="TranslationServer" type="TranslationServer" setter="" getter=""> The [TranslationServer] singleton. </member> - <member name="VisualScriptEditor" type="VisualScriptEditor" setter="" getter=""> - The [VisualScriptEditor] singleton. + <member name="VisualScriptCustomNodes" type="VisualScriptCustomNodes" setter="" getter=""> + The [VisualScriptCustomNodes] singleton. </member> <member name="XRServer" type="XRServer" setter="" getter=""> The [XRServer] singleton. @@ -2351,9 +2368,11 @@ </constant> <constant name="PROPERTY_HINT_INT_IS_OBJECTID" value="38" enum="PropertyHint"> </constant> + <constant name="PROPERTY_HINT_INT_IS_POINTER" value="40" enum="PropertyHint"> + </constant> <constant name="PROPERTY_HINT_ARRAY_TYPE" value="39" enum="PropertyHint"> </constant> - <constant name="PROPERTY_HINT_MAX" value="40" enum="PropertyHint"> + <constant name="PROPERTY_HINT_MAX" value="41" enum="PropertyHint"> </constant> <constant name="PROPERTY_USAGE_NONE" value="0" enum="PropertyUsageFlags"> </constant> @@ -2426,6 +2445,8 @@ </constant> <constant name="PROPERTY_USAGE_EDITOR_BASIC_SETTING" value="268435456" enum="PropertyUsageFlags"> </constant> + <constant name="PROPERTY_USAGE_ARRAY" value="1073741824" enum="PropertyUsageFlags"> + </constant> <constant name="PROPERTY_USAGE_DEFAULT" value="7" enum="PropertyUsageFlags"> Default usage (storage, editor and network). </constant> @@ -2458,9 +2479,30 @@ </constant> <constant name="METHOD_FLAG_STATIC" value="256" enum="MethodFlags"> </constant> + <constant name="METHOD_FLAG_OBJECT_CORE" value="512" enum="MethodFlags"> + Used internally. Allows to not dump core virtuals such as [code]_notification[/code] to the JSON API. + </constant> <constant name="METHOD_FLAGS_DEFAULT" value="1" enum="MethodFlags"> Default method flags. </constant> + <constant name="RPC_MODE_DISABLED" value="0" enum="RPCMode"> + Used with [method Node.rpc_config] to disable a method or property for all RPC calls, making it unavailable. Default for all methods. + </constant> + <constant name="RPC_MODE_ANY_PEER" value="1" enum="RPCMode"> + Used with [method Node.rpc_config] to set a method to be callable remotely by any peer. Analogous to the [code]@rpc(any)[/code] annotation. Calls are accepted from all remote peers, no matter if they are node's authority or not. + </constant> + <constant name="RPC_MODE_AUTH" value="2" enum="RPCMode"> + Used with [method Node.rpc_config] to set a method to be callable remotely only by the current multiplayer authority (which is the server by default). Analogous to the [code]@rpc(auth)[/code] annotation. See [method Node.set_multiplayer_authority]. + </constant> + <constant name="TRANSFER_MODE_UNRELIABLE" value="0" enum="TransferMode"> + Packets are not acknowledged, no resend attempts are made for lost packets. Packets may arrive in any order. Potentially faster than [constant TRANSFER_MODE_UNRELIABLE_ORDERED]. Use for non-critical data, and always consider whether the order matters. + </constant> + <constant name="TRANSFER_MODE_UNRELIABLE_ORDERED" value="1" enum="TransferMode"> + Packets are not acknowledged, no resend attempts are made for lost packets. Packets are received in the order they were sent in. Potentially faster than [constant TRANSFER_MODE_RELIABLE]. Use for non-critical data or data that would be outdated if received late due to resend attempt(s) anyway, for example movement and positional data. + </constant> + <constant name="TRANSFER_MODE_RELIABLE" value="2" enum="TransferMode"> + Packets must be received and resend attempts should be made until the packets are acknowledged. Packets must be received in the order they were sent in. Most reliable transfer mode, but potentially the slowest due to the overhead. Use for critical data that must be transmitted and arrive in order, for example an ability being triggered or a chat message. Consider carefully if the information really is critical, and use sparingly. + </constant> <constant name="TYPE_NIL" value="0" enum="Variant.Type"> Variable is [code]null[/code]. </constant> |