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

Fix Issue #144 - Entity isSwimming function #171

Open
wants to merge 19 commits into
base: barony-next
Choose a base branch
from

Conversation

crkellen
Copy link
Contributor

@crkellen crkellen commented Aug 27, 2017

This is a fix for #144.
The issue was there wasn't a function to test whether or not a given Entity is swimming. There is 'isLevitating()' and 'isInvisible()' but until now, all swimming code had to be repeated everywhere.

This also goes along with pull request #142. It should be used as a replacement for #142, if it is accepted. It implements the swimming checks added/modified in #142 with the new method added in this PR.

Additionally, this also has the fix for #143.

Copy link
Contributor

@lheckemann lheckemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this better, apart from all the redundant == true expressions. x == true is the same thing as x if it's a boolean! Likewise, !x is nicer than x == false.

@crkellen
Copy link
Contributor Author

crkellen commented Sep 27, 2017 via email

@lheckemann
Copy link
Contributor

This only really makes sense when the choice of variable names is poor — isSwimming should obviously be a boolean or a function returning a boolean (which are easy to distinguish) and I can't really see what else swimming / !swimming would be either.

@lheckemann
Copy link
Contributor

IOW, if (swimming) ("if swimming") and if (!swimming) ("if not swimming") are a lot more readable than if (swimming == true) ("if swimming is true") and if (swimming == false) ("if swimming is false").

@crkellen
Copy link
Contributor Author

I suppose another reason was to make everything explicit. Most of the warnings Barony has right now is due to implicit conversions and such, and in general, making everything explicit is how I prefer to program.

However, after further reading (I had previously done reading on this subject prior to implementing any conditional checks like this, and sided with explicit), I do believe that if the variables are well named, it should be fine. I'll update now.

Added comments and renamed function to "IsSwimming()"
@addictgamer
Copy link
Collaborator

I do believe that if the variables are well named, it should be fine.

Sadly, this is an issue. Well-named variables should be preferred over the alternatives.

@crkellen
Copy link
Contributor Author

crkellen commented Oct 20, 2017 via email

@crkellen
Copy link
Contributor Author

Yes, the issues were already handled. If you have any additional concerns, please let me know.

WALLOFJUSTICE added a commit that referenced this pull request Sep 1, 2023
Merge pull request #774 from WALLOFJUSTICE/dev-23-aug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants