How to use the mpf.core.events.event_handler function in mpf

To help you get started, we’ve selected a few mpf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github missionpinball / mpf / mpf / devices / shot.py View on Github external
    @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
github missionpinball / mpf / mpf / devices / shot.py View on Github external
    @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
github missionpinball / mpf / mpf / devices / achievement_group.py View on Github external
    @event_handler(6)
    def event_rotate_right(self, reverse=False, **kwargs):
        """Event handler for rotate_right event."""
        del kwargs
        self.rotate_right(reverse)
github missionpinball / mpf / mpf / devices / driver.py View on Github external
    @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)
github missionpinball / mpf / mpf / devices / shot_group.py View on Github external
    @event_handler(4)
    def event_rotate(self, direction=None, **kwargs):
        """Handle rotate control event."""
        del kwargs
        self.rotate(direction)
github missionpinball / mpf / mpf / devices / digital_output.py View on Github external
    @event_handler(3)
    def event_pulse(self, pulse_ms, **kwargs):
        """Handle pulse control event."""
        del kwargs
        self.pulse(pulse_ms)
github missionpinball / mpf / mpf / devices / ball_lock.py View on Github external
    @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()
github missionpinball / mpf / mpf / devices / autofire.py View on Github external
    @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()
github missionpinball / mpf / mpf / devices / dual_wound_coil.py View on Github external
    @event_handler(2)
    def event_enable(self, **kwargs):
        """Event handler for enable event."""
        del kwargs
        self.enable()
github missionpinball / mpf / mpf / devices / stepper.py View on Github external
    @event_handler(1)
    def event_reset(self, **kwargs):
        """Event handler for reset event."""
        del kwargs
        self.reset()