self.machine.diverters.*¶
-
class
mpf.devices.diverter.
Diverter
(*args, **kwargs)¶ Bases:
mpf.core.system_wide_device.SystemWideDevice
Represents a diverter in a pinball machine.
Args: Same as the Device parent class.
Accessing diverters in code
The device collection which contains the diverters in your machine is available via
self.machine.diverters
. For example, to access one called “foo”, you would useself.machine.diverters.foo
. You can also access diverters in dictionary form, e.g.self.machine.diverters['foo']
.You can also get devices by tag or hardware number. See the DeviceCollection documentation for details.
Methods & Attributes
Diverters have the following methods & attributes available. Note that methods & attributes inherited from base classes are not included here.
-
activate
(**kwargs)¶ Physically activate this diverter’s coil.
-
deactivate
(**kwargs)¶ Deactivate this diverter.
This method will disable the activation_coil, and (optionally) if it’s configured with a deactivation coil, it will pulse it.
-
disable
(auto=False, **kwargs)¶ Disable this diverter.
This method will remove the hardware rule if this diverter is activated via a hardware switch.
Parameters: - auto – Boolean value which is used to indicate whether this diverter disabled itself automatically. This is passed to the event which is posted.
- **kwargs – This is here because this disable method is called by whatever event the game programmer specifies in their machine configuration file, so we don’t know what event that might be or whether it has random kwargs attached to it.
-
enable
(auto=False, **kwargs)¶ Enable this diverter.
Parameters: - auto – Boolean value which is used to indicate whether this diverter enabled itself automatically. This is passed to the event which is posted.
- **kwargs – unused
If an ‘activation_switches’ is configured, then this method writes a hardware autofire rule to the pinball controller which fires the diverter coil when the switch is activated.
If no activation_switches is specified, then the diverter is activated immediately.
-
raise_config_error
(msg, error_no, *, context=None)¶ Raise a ConfigFileError exception.
-
reset
(**kwargs)¶ Reset and deactivate the diverter.
-
schedule_deactivation
()¶ Schedule a delay to deactivate this diverter.
-