Skip to content

Commit

Permalink
Merge pull request #1851 from avanwinkle/timer-event-order-pollution
Browse files Browse the repository at this point in the history
Timer event order pollution
  • Loading branch information
avanwinkle authored Oct 29, 2024
2 parents 172b5d9 + 8b1c3c1 commit 6441ddb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions .prospector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pylint:
disable:
- pointless-string-statement # pointless statement, which is how our event docstrings are seen
- too-few-public-methods
- too-many-positional-arguments # many methods have many positional args
- unsubscriptable-object # broken on python 3.9
# The following linter rules are disabled to make a refactor managable in chunks
- consider-using-f-string # temporarily disabling due to the 900+ instances to be replaced
Expand Down
2 changes: 1 addition & 1 deletion mpf/devices/timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def can_exist_outside_of_game(self):
def _setup_control_events(self, event_list):
self.debug_log("Setting up control events")

kwargs = {}
for entry in event_list:
kwargs = {}
if entry['action'] in ('add', 'subtract', 'jump', 'pause', 'set_tick_interval'):
handler = getattr(self, entry['action'])
kwargs = {'timer_value': entry['value']}
Expand Down
1 change: 1 addition & 0 deletions mpf/modes/service/code/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ def _generate_light_chains(self): # pylint: disable=too-many-locals
return

items.sort(key=lambda x: x.chain)
return items

async def _volume_menu(self, platform=None):
position = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ timers:
tick_interval: 1s
start_running: no
control_events:
# Keep this event before the reset event to catch
# a regression about the order of timer events
- event: jump_timer_up
action: jump
value: 5
- event: start_timer_up
action: start
- event: reset_timer_up
Expand All @@ -59,9 +64,6 @@ timers:
action: stop
- event: restart_timer_up
action: restart
- event: jump_timer_up
action: jump
value: 5
- event: jump_over_max_timer_up
action: jump
value: 20
Expand Down

0 comments on commit 6441ddb

Please sign in to comment.