Skip to content

Conversation

@FengchiW
Copy link
Contributor

Previously, for the case where the distance between the observer and target is zero the function will crash with a Division by Zero Error. This error can happen if someone designs a chasing enemy that ends up at the players location. I added a check will return True indicating there is line of sight in such a case.

Perhaps this should instead be a configurable option?

Additionally, the Line of Sight function did not ensure that we have a positive non-zero value for the check resolution. I added a check that will raise a value error in such a case.

Previously, for the case where the `distance` between the `observer` and `target` is zero the function will crash with a Division by Zero Error.
This error can happen if someone designs a chasing enemy that ends up at the players location.
I added a check will return True indicating there is line of sight in such a case.

Perhaps this should instead be a configurable option?

Additionally, the Line of Sight function did not ensure that we have a positive non-zero value for the check resolution.
I added a check that will raise a value error in such a case.

Also added unit test for the same position for LOS
@FengchiW
Copy link
Contributor Author

Fixes #1934

@eruvanos eruvanos merged commit 12761ce into pythonarcade:development Nov 29, 2023
FengchiW added a commit to FengchiW/arcade that referenced this pull request Nov 30, 2023
@FengchiW
Copy link
Contributor Author

FengchiW commented Nov 30, 2023

@eruvanos I made a big mistake I was testing whether or position being the same should be equivalent. In the end, I decided that it should look like my unit test was written for it but it brought my commit for False in instead. I made a PR to revert this one and another PR that corrects this error.

my local tests didn't catch this because locally I had the correct result set and I somehow didn't catch what was pushed up before I opened the PR.

my apologies.

@eruvanos
Copy link
Member

eruvanos commented Jan 8, 2024

@FengchiW So is there something to do? Any open PullRequest or is it already all done?

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

Successfully merging this pull request may close these issues.

2 participants