self.machine.shots.*

class mpf.devices.shot.Shot(machine, name)

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

A device which represents a generic shot.

Accessing shots in code

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

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

Methods & Attributes

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

active_sequences = None

List of tuples -- (id, current_position_index, next_switch)

add_profile(profile_dict)

Add a profile to shot.

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

Advance a shot profile forward.

If this profile is at the last step and configured to loop, it will roll over to the first step. If this profile is at the last step and not configured to loop, this method has no effect.

deregister_group(group)

Deregister a group.

Notify this shot that it is no longer part of this group. Note this is called by :class:ShotGroup. If you want to manually remove a shot from a group, do it from there.

disable(mode=None, **kwargs)

Disable this shot.

If the shot is not enabled, hits to it will not be processed.

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

Enable shot.

enabled

Return true if enabled.

get_profile_by_key(key, value)

Return profile for a key value pair.

hit(mode='default#$%', _wf=None, **kwargs)

Advance the currently-active shot profile.

Parameters:
  • mode -- (Optional) The mode instance that was hit. If this is not specified, this hit is registered via the highest-priority mode that this shot is active it. A value of None represents the base machine config (e.g. no Mode). The crazy default string it so this method can differentiate between no mode specified (where it uses the highest one) and a value of "None" which is the base machine-wide config.
  • _wf -- (Internal use only) A list of remaining modes from the enable table of the original hit. Used to waterfall hits (which is where hits are cascaded down to this shot in lower priority modes if blocking is not set.

Note that the shot must be enabled in order for this hit to be processed.

jump(mode, state, show_step=1, force=True)

Jump to a certain state in the active shot profile.

Parameters:
  • state -- int of the state number you want to jump to. Note that states are zero-based, so the first state is 0.
  • show_step -- The step number that the associated light script should start playing at. Useful with rotations so this shot can pick up right where it left off. Default is 1 (the first step in the show)
monitor_enabled = False

Class attribute which specifies whether any monitors have been registered to track shots.

player_turn_start(player, **kwargs)

Update the player reference to the current player and to apply the default machine-wide shot profile.

Called by the shot profile manager when a player's turn starts.

player_turn_stop()

Remove the profiles from the shot and remove the player reference.

Called by the shot profile manager when the player's turn ends.

register_group(group)

Register a group.

Notify this shot that it has been added to a group, meaning it will update this group of its state changes. Note this is called by :class:ShotGroup. If you want to manually add a shot to a group, do it from there.

remove_active_profile(mode='default#$%', **kwargs)

Remove the active profile.

remove_profile_by_mode(mode)

Remove profile for mode.

reset(mode=None, **kwargs)

Reset the shot profile for the passed mode back to the first state (State 0) and reset all sequences.

update_current_state_name(mode)

Update current state name.

update_profile(profile=None, enable=None, mode=None)

Update profile.