Commit e515573
authored
fix(random): handle redacted state on multiplayer clients (#885)
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.1 parent 8f85fb0 commit e515573
2 files changed
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
126 | 145 | | |
127 | 146 | | |
128 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
0 commit comments