Merge pull request #51086 from aaronfranke/3.x-warn-dectime

This commit is contained in:
Rémi Verschelde 2021-10-05 12:06:03 +02:00 committed by GitHub
commit db0370cab5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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) {
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 val = Math::abs(p_value);
val -= p_amount * p_step;

View file

@ -224,6 +224,7 @@
<argument index="1" name="amount" type="float" />
<argument index="2" name="step" type="float" />
<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].
[codeblock]
a = dectime(60, 10, 0.1)) # a is 59.0

View file

@ -78,6 +78,7 @@ namespace Godot
/// </param>
/// <param name="step">Times the <paramref name="value"/> will be decreased by <paramref name="amount"/></param>
/// <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)
{
real_t sgn = Mathf.Sign(value);