Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@event_handler(5)
def event_hit(self, **kwargs):
"""Handle hit control event."""
success = self.hit()
if not success:
return None
if self.profile.config['block']:
min_priority = kwargs.get("_min_priority", {"all": 0})
min_shots = min_priority.get("shot", 0)
min_priority["shot"] = self.mode.priority if self.mode.priority > min_shots else min_shots
return {"_min_priority": min_priority}
return None
@event_handler(5)
def hit(self, **kwargs):
"""Advance the currently-active shot profile.
Note that the shot must be enabled in order for this hit to be
processed.
"""
# mark the playfield active no matter what
self.config['playfield'].mark_playfield_active_from_device_action()
if not self.enabled or not self.player:
return None
# Stop if there is an active delay but no sequence
if self.active_delays:
return None
@event_handler(6)
def event_rotate_right(self, reverse=False, **kwargs):
"""Event handler for rotate_right event."""
del kwargs
self.rotate_right(reverse)
@event_handler(3)
def event_pulse(self, pulse_ms: int = None, pulse_power: float = None, max_wait_ms: int = None, **kwargs) -> None:
"""Event handler for pulse control events."""
del kwargs
self.pulse(pulse_ms, pulse_power, max_wait_ms)
@event_handler(4)
def event_rotate(self, direction=None, **kwargs):
"""Handle rotate control event."""
del kwargs
self.rotate(direction)
@event_handler(3)
def event_pulse(self, pulse_ms, **kwargs):
"""Handle pulse control event."""
del kwargs
self.pulse(pulse_ms)
@event_handler(9)
def event_release_one_if_full(self, **kwargs):
"""Event handler for release_one_if_full event."""
del kwargs
self.release_one_if_full()
@event_handler(10)
def event_disable(self, **kwargs):
"""Handle disable control event.
To prevent multiple rules at the same time we prioritize disable > enable.
"""
del kwargs
self.disable()
@event_handler(2)
def event_enable(self, **kwargs):
"""Event handler for enable event."""
del kwargs
self.enable()
@event_handler(1)
def event_reset(self, **kwargs):
"""Event handler for reset event."""
del kwargs
self.reset()