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

Why is OtherPlayers.other_players private? #39

Closed
tiquis0290 opened this issue Mar 28, 2024 · 1 comment · Fixed by #56
Closed

Why is OtherPlayers.other_players private? #39

tiquis0290 opened this issue Mar 28, 2024 · 1 comment · Fixed by #56

Comments

@tiquis0290
Copy link

Probably iam missing something, but when i used ViewPlayer command i didn't find a way to look at his stats etc. unless i forked library and made OtherPlayers.other_players public in src/gamestate/social.rs
Is it necessary to have this as private, or is there another intented way to do what iam doing?

@the-marenga
Copy link
Owner

I guess I should explain this in the documentation better for the next release. To quote my last answer from some time ago:

[...] you can use the ViewPlayer command with the player_id, or the username. As a result, there also has to be a way to get the fetched result from the gamestate with the player_id and the username. Both of these ways are provides with the lookup_name() and lookup_pid() methods on OtherPlayers. If the underlying fields were public, you could easily create situations, where the lookup is no longer in sync with the vec, that contains the players and thus return you the wrong result when calling the lookup methods

@the-marenga the-marenga linked a pull request Apr 20, 2024 that will close this issue
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 a pull request may close this issue.

2 participants