the-marenga / sf-api

Manage Shakes & Fidget characters via simple commands. Handles encryption, response parsing and everything else for you
MIT License
18 stars 3 forks source link

Why is OtherPlayers.other_players private? #39

Closed tiquis0290 closed 6 months ago

tiquis0290 commented 7 months ago

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 commented 7 months ago

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