self.machine.shot_groups.*

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

Bases: mpf.core.mode_device.ModeDevice, mpf.core.system_wide_device.SystemWideDevice

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.

advance(steps=1, mode=None, force=False, **kwargs)

Advance the current active profile from every shot in the group one step forward.

check_for_complete(mode)

Check all the shots in this shot group.

If they are all in the same state, then a complete event is posted.

disable(mode=None, **kwargs)

Disable this shot group.

Also disables all the shots in this group.

disable_rotation(**kwargs)

Disable shot rotation.

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

enable(mode=None, profile=None, **kwargs)

Enable this shot group.

Also enables all the shots in this group.

enable_rotation(**kwargs)

Enable shot rotation.

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

enabled

Return true if enabled.

hit(mode, profile, state, **kwargs)

One of the member shots in this shot group was hit.

Parameters:
  • profile -- String name of the active profile of the shot that was hit.
  • mode -- unused
  • kwargs -- unused
remove_active_profile(mode, **kwargs)

Remove the current active profile from every shot in the group.

reset(mode=None, **kwargs)

Reset each of the shots in this group back to the initial state in whatever shot profile they have applied.

This is the same as calling each shot's reset() method one-by-one.

rotate(direction=None, states=None, exclude_states=None, mode=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