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

feat(plugins): Add playerView option to plugin API (close #671) #857

Merged
merged 6 commits into from
Dec 5, 2020

Conversation

delucis
Copy link
Member

@delucis delucis commented Dec 4, 2020

Closes #671

This PR adds a playerView option to the plugin API allowing plugins to filter their data before it is returned to clients in the same way a game’s playerView option can filter G.

It also adds a playerView that hides PRNG state from clients to the random plugin and a way for users to set a custom playerView for the player plugin.

@delucis delucis merged commit 8f8d30e into master Dec 5, 2020
@delucis delucis deleted the delucis/feat/plugin-player-view branch December 5, 2020 20:35
delucis added a commit that referenced this pull request Jan 5, 2021
Fixes #870

Prior to the current plugin system, the randomness API set a default 
seed '0' if it didn’t receive one from game state (i.e. when it was run 
on a multiplayer client and the randomness state was redacted). When the 
new plugin system was built, this fallback value was removed, but that 
didn’t cause errors because the PRNG seed and state were no longer 
redacted. After #857 (released in v0.42.2) reintroduced redacted state 
for plugins, the plugin broke for multiplayer clients that no longer had 
access to plugin state.

This commit reinstates the default seed (the result of which is 
discarded in any case) and adds a test for running the plugin with 
redacted state to catch a similar error in any future refactoring.

See 4b1c135 for details of the 
randomness API before the current implementation.
delucis added a commit that referenced this pull request Jan 5, 2021
Fixes #870

Prior to the current plugin system, the randomness API set a default 
seed '0' if it didn’t receive one from game state (i.e. when it was run 
on a multiplayer client and the randomness state was redacted). When the 
new plugin system was built, this fallback value was removed, but that 
didn’t cause errors because the PRNG seed and state were no longer 
redacted. After #857 (released in v0.42.2) reintroduced redacted state 
for plugins, the plugin broke for multiplayer clients that no longer had 
access to plugin state.

This commit reinstates the default seed (the result of which is 
discarded in any case) and adds a test for running the plugin with 
redacted state to catch a similar error in any future refactoring.

See 4b1c135 for details of the 
randomness API before the current implementation.
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.

Add playerView option to plugin API
1 participant