[3.x] Warn when using the dectime method

dectime has been removed in the master branch (what will be Godot 4.0)
This commit is contained in:
Aaron Franke 2021-07-30 17:04:30 -05:00
parent ed3742c4a7
commit a5543bc35e
No known key found for this signature in database
GPG Key ID: 40A1750B977E56BF
3 changed files with 3 additions and 0 deletions

View File

@ -91,6 +91,7 @@ int Math::range_step_decimals(double p_step) {
} }
double Math::dectime(double p_value, double p_amount, double p_step) { double Math::dectime(double p_value, double p_amount, double p_step) {
WARN_DEPRECATED_MSG("The `dectime()` function has been deprecated and will be removed in Godot 4.0. Use `move_toward()` instead.");
double sgn = p_value < 0 ? -1.0 : 1.0; double sgn = p_value < 0 ? -1.0 : 1.0;
double val = Math::abs(p_value); double val = Math::abs(p_value);
val -= p_amount * p_step; val -= p_amount * p_step;

View File

@ -224,6 +224,7 @@
<argument index="1" name="amount" type="float" /> <argument index="1" name="amount" type="float" />
<argument index="2" name="step" type="float" /> <argument index="2" name="step" type="float" />
<description> <description>
[b]Note:[/b] [code]dectime[/code] has been deprecated and will be removed in Godot 4.0, please use [method move_toward] instead.
Returns the result of [code]value[/code] decreased by [code]step[/code] * [code]amount[/code]. Returns the result of [code]value[/code] decreased by [code]step[/code] * [code]amount[/code].
[codeblock] [codeblock]
a = dectime(60, 10, 0.1)) # a is 59.0 a = dectime(60, 10, 0.1)) # a is 59.0

View File

@ -78,6 +78,7 @@ namespace Godot
/// </param> /// </param>
/// <param name="step">Times the <paramref name="value"/> will be decreased by <paramref name="amount"/></param> /// <param name="step">Times the <paramref name="value"/> will be decreased by <paramref name="amount"/></param>
/// <returns>The decreased value.</returns> /// <returns>The decreased value.</returns>
[Obsolete("DecTime has been deprecated and will be removed in Godot 4.0, use Mathf.MoveToward instead.")]
public static real_t DecTime(real_t value, real_t amount, real_t step) public static real_t DecTime(real_t value, real_t amount, real_t step)
{ {
real_t sgn = Mathf.Sign(value); real_t sgn = Mathf.Sign(value);