Skip to content

[BUG]: AdminToyWaypoint.SqrDistanceTo cannot utilize negative priority #288

@Someone-193

Description

@Someone-193

Before You Report

  • 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")

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingimportedImported to internal git

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions