LabAPI icon indicating copy to clipboard operation
LabAPI copied to clipboard

[BUG]: AdminToyWaypoint.SqrDistanceTo cannot utilize negative priority

Open Someone-193 opened this issue 1 year ago • 1 comments

Before You Report

  • [x] I have searched for existing reports of this bug, and this bug report is unique.

Version

1.1.3

Description

In mentioned method, Priority is squared, thus the sign of Priority is irrelevant

To Reproduce

Try to create a waypoint that your client doesn't want to use by setting high negative priority, then still get caught by the waypoint.

Expected Behavior

sign of priority should make waypoint more or less favorable, not just 0 -> infinity more favorable

Additional Information

Here's a fix based off copied decompiled code:

public override float SqrDistanceTo(Vector3 pos) { if (this.IsStatic) return (pos - this._transform.position).sqrMagnitude - this.Priority * this.Priority * Mathf.Sign(this.Priority); Vector3 point = this._transform.InverseTransformPoint(pos); return !AdminToyWaypoint.DefaultBounds.Contains(point) ? float.MaxValue : point.sqrMagnitude - this.Priority * this.Priority * Mathf.Sign(this.Priority); }

(All I did was add "* Mathf.Sign")

Someone-193 avatar Oct 03 '25 01:10 Someone-193

This bug has been fixed in Game version: 14.2.6 LabApi Version: 1.1.6. If you encounter the bug again please reopen this issue!

SlejmUr avatar Mar 26 '26 09:03 SlejmUr