Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use range option in findClosestByPath #121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RiftLurker
Copy link
Contributor

Fixes #120

@Josef37
Copy link

Josef37 commented Oct 6, 2022

@o4kapuk Is there a reason this still isn't merged?

@Josef37
Copy link

Josef37 commented Oct 6, 2022

Sorry for the rash question... 😅
I looked at the code and it seems that part would break:

engine/src/game/rooms.js

Lines 367 to 371 in 78d980e

objects.forEach(obj => {
if(lastPos.isNearTo(obj)) {
result = obj;
}
});

The current implementation checks if the final position of the path is near to a target which wouldn't work if that final position if further away...
Maybe inRangeTo would solve the problem, but then the result might not be distinct 🤔
I'll give it more thought later 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RoomPosition.findClosestByPath ignores range option - always uses range 1
3 participants