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

Allow the user to know when the creep can't complete the path. #5

Open
dyc3 opened this issue Oct 3, 2020 · 2 comments
Open

Allow the user to know when the creep can't complete the path. #5

dyc3 opened this issue Oct 3, 2020 · 2 comments

Comments

@dyc3
Copy link

dyc3 commented Oct 3, 2020

Currently, when the traveler is unable to find a complete path to the destination, it shows the path in red. I think it would be useful to be able to get this information via travelTo's return value, or a separate method that we could add to the creep's prototype.

@SystemParadox
Copy link

You already can. The returned path has incomplete: true if the path was incomplete.

@SystemParadox
Copy link

SystemParadox commented Oct 13, 2020

Oh, except you have to access it in a bit of a roundabout way, by passing an object as the returnData option that traveller will then update with extra information about the path:

let returnData = {};
creep.travelTo(..., { returnData });
if (returnData.pathfinderReturn.incomplete) {
    // ...
}

It would be nicer if the incomplete property was at least available as returnData.incomplete.

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

No branches or pull requests

2 participants