fix DoAfter DistanceThreshold (#39276)

This commit is contained in:
slarticodefast
2025-08-06 16:35:31 +02:00
committed by GitHub
parent ca18576625
commit c4016b97c5
2 changed files with 1 additions and 11 deletions

View File

@@ -122,7 +122,7 @@ public sealed partial class DoAfterArgs
/// Threshold for distance user from the used OR target entities. /// Threshold for distance user from the used OR target entities.
/// </summary> /// </summary>
[DataField] [DataField]
public float? DistanceThreshold; public float? DistanceThreshold = 1.5f;
/// <summary> /// <summary>
/// Whether damage will cancel the DoAfter. See also <see cref="DamageThreshold"/>. /// Whether damage will cancel the DoAfter. See also <see cref="DamageThreshold"/>.

View File

@@ -192,11 +192,6 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
if (!_interaction.InRangeUnobstructed(args.User, args.Target.Value, args.DistanceThreshold.Value)) if (!_interaction.InRangeUnobstructed(args.User, args.Target.Value, args.DistanceThreshold.Value))
return true; return true;
} }
else
{
if (!_interaction.InRangeUnobstructed(args.User, args.Target.Value))
return true;
}
} }
// Whether the distance between the tool and the user has grown too much. // Whether the distance between the tool and the user has grown too much.
@@ -209,11 +204,6 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
args.DistanceThreshold.Value)) args.DistanceThreshold.Value))
return true; return true;
} }
else
{
if (!_interaction.InRangeUnobstructed(args.User,args.Used.Value))
return true;
}
} }
if (args.AttemptFrequency == AttemptFrequency.EveryTick && !TryAttemptEvent(doAfter)) if (args.AttemptFrequency == AttemptFrequency.EveryTick && !TryAttemptEvent(doAfter))