Previously we used PlayingSessionStateCallback in opportunistic mode, treating it largely as an extra event that could cancel ongoing things.
This worked well but was prone to issues. While starting farming before event arrival was rather impossible, starting GamesPlayedWhileIdle was, as the only guardian against that was that 2s delay which was added exactly for this purpose. Nothiing guarantees that such delay is sufficient, as the event might be delayed for one reason or another.
Let's rewrite this based on assumption that we always get the event fired. This way:
- If initial farming signal fires too soon, it'll be aborted as playing is unavailable - but it'll still set ShouldResumeFarming
- CheckOccupationStatus() is now effectively fired always at least once per bot login
- Cards farmer module is triggered afterwards and either we'll start farming if we arrived second, or have playing state available if arrived first
- If cards farmer module is permanently paused during occupation check, but playing is not otherwise blocked, we can move straight to games played while idle, like before in OnLoggedOn()
This should improve bulletproofing against race conditions between login and playing session state, as the remaining in code 2s delay in reset games needs to account only for shared library lock now, which is far less common, and with new steam family concept - maybe even entirely unnecessary.
The side effect is that obviously we depend on that state to be transmitted now, but it's not like we don't depend on other events such as license list, so if it ever stop being the case, we'll just rewrite back to original assumptions.