-
Notifications
You must be signed in to change notification settings - Fork 143
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
Block tilt warnings once game has tilted #1529
Conversation
Thanks! I guess we should also add a regression test for your case so we won't break it in the future. |
Yeah a regression test would be a good idea I think. I'm not sure what's involved or how to go about that though. Also the build is currently failing on Python 3.5 with "SystemError: Parent module 'setuptools' not loaded, cannot perform relative import". I'm not sure what I need to do to fix that. |
Don't worry about the tests. That looks spurious and I will take care. Tilt tests are here: https://github.com/missionpinball/mpf/blob/dev/mpf/tests/test_Tilt.py. You could extend that if you want. Those can be run using:"python3 -m unittest mpf.tests.test_Tilt". |
Seems like a known bug: pypa/setuptools#2352. Hope this gets fixed upstream. |
I added an test for this but I cannot reproduce the issue you describe. Seems like the warnings are counted for the correct player. It counts higher as the limit but it does not count anything for the next player. Please have a look at the test. |
The scenario I encountered was with a single player game. To outline the steps (assuming tilt warnings set to 3):
I should have kept my log file to make it easier to see. In the log I could see the tilt warnings get reset to 0 via an event, but additional warnings could be activated before the ball drains, which then carried forward for that same player on the next ball. |
Can you turn that case into a test? Just copy my test and adjust it accordingly. |
I just played with your test. To me it looks like the problem still exists even with your changes. I removed the reset of tilt_warnings in the test because that is not what happens in reality and it will then instantly tilt on the next ball. Try this test:
I guess the real problem is that |
The tilt_warnings value does get reset by an event around the time the "ball_will_end" event triggers. EventManager : Event: ======'tilt'====== Args={} However, if I remove my change, then any further activity on the tilt switch will start increasing this value again before the ball drains. This value then carries across for the player to their next ball. Also, if you have event listeners looking at tilt_warning events, these will pick up the extra events. A way around that would be to use conditional checks there to ignore them if the game has tilted. But the underlying issue is the tilt_warnings value will continue to increase after it's reset without my change. Another option for fixing could be to reset the tilt_warnings value once the ball is in the trough or at the beginning of a ball if people want the extra warnings. |
Where does that happen? Try my test from above where I removed the line which did that in the test. This is what I am seeing:
|
@enteryourinitials are you still on this? Or do you want me to change the tilt code? I got an idea what to change. Your change definitely improves the situation. However, I think one more change is needed to fix your problem highlighted in your test. |
Any further tilt warnings that were triggered once the game tilted would affect the tilt warning count for the players next ball. This change will not trigger any further warnings once the game is in a tilted state and ensure their tilt warning count is at zero when the next ball begins.
Sorry that it took me so long. I changed the test to use the default tilt configuration and rebased it to |
Any further tilt warnings that were triggered once the game tilted would affect the tilt warning count for the players next ball. This change will not trigger any further warnings once the game is in a tilted state and ensure their tilt warning count is at zero when the next ball begins.