Warning

This documentation is for an unreleased version of MPF!

This is the developer documentation for MPF 0.51, which is the “dev” (next) release of MPF that is a work-in-progress. Use the “Read the Docs” link in the lower left corner to view the developer docs for the version of MPF you’re using.

self.machine.shot_groups.*

class mpf.devices.shot_group.ShotGroup(machine, name)

Bases: mpf.core.mode_device.ModeDevice

Represents a group of shots in a pinball machine by grouping together multiple Shot class devices.

This is used so you get get “group-level” functionality, like shot rotation, shot group completion, etc. This would be used for a group of rollover lanes, a bank of standups, etc.

Accessing shot_groups in code

The device collection which contains the shot_groups in your machine is available via self.machine.shot_groups. For example, to access one called “foo”, you would use self.machine.shot_groups.foo. You can also access shot_groups in dictionary form, e.g. self.machine.shot_groups['foo'].

You can also get devices by tag or hardware number. See the DeviceCollection documentation for details.

Methods & Attributes

Shot_groups have the following methods & attributes available. Note that methods & attributes inherited from base classes are not included here.

disable(**kwargs)

Disable all member shots.

Parameters:kwargs – passed to member shots
disable_rotation(**kwargs)

Disable shot rotation.

If disabled, rotation events do not actually rotate the shots.

enable(**kwargs)

Enable all member shots.

Parameters:kwargs – passed to member shots
enable_rotation(**kwargs)

Enable shot rotation.

If disabled, rotation events do not actually rotate the shots.

raise_config_error(msg, error_no, *, context=None)

Raise a ConfigFileError exception.

reset(**kwargs)

Reset all member shots.

Parameters:kwargs – passed to member shots
restart(**kwargs)

Restart all member shots.

rotate(direction=None, **kwargs)

Rotate (or “shift”) the state of all the shots in this group.

This is used for things like lane change, where hitting the flipper button shifts all the states of the shots in the group to the left or right.

This method actually transfers the current state of each shot profile to the left or the right, and the shot on the end rolls over to the taret on the other end.

Parameters:
  • direction – String that specifies whether the rotation direction is to the left or right. Values are ‘right’ or ‘left’. Default of None will cause the shot group to rotate in the direction as specified by the rotation_pattern.
  • states – A string of a state or a list of strings that represent the targets that will be selected to rotate. If None (default), then all targets will be included.
  • exclude_states – A string of a state or a list of strings that controls whether any targets will not be rotated. (Any targets with an active profile in one of these states will not be included in the rotation. Default is None which means all targets will be rotated)
  • kwargs – unused

Note that this shot group must, and rotation_events for this shot group, must both be enabled for the rotation events to work.

rotate_left(mode=None, **kwargs)

Rotate the state of the shots to the left.

This method is the same as calling rotate(‘left’)

Parameters:kwargs – unused
rotate_right(mode=None, **kwargs)

Rotate the state of the shots to the right.

This method is the same as calling rotate(‘right’)

Parameters:kwargs – unused