Skip to content

Commit

Permalink
feat: configure virtual platform a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
unRARed committed Nov 29, 2024
1 parent 4c7b4a2 commit 9e8e147
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bin/test
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

python -m unittest
python -m unittest -v
5 changes: 4 additions & 1 deletion config/common/ball_devices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ ball_devices:
ball_switches:
- s_trough1
- s_trough2
- s_trough3
eject_coil: c_trough_eject
eject_targets: bd_shooter_lane
eject_timeouts: 3s
eject_coil_jam_pulse: 15ms

bd_shooter_lane:
ball_switches: s_shooter_lane
mechanical_eject: True
# eject_coil: c_plunger_lane
eject_coil: c_plunger_lane
4 changes: 4 additions & 0 deletions config/common/coils.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ coils:
number: 0-2
default_pulse_ms: 40
default_hold_power: 0.1
c_plunger_lane:
number: 0-3
default_pulse_ms: 40
default_hold_power: 0.1
3 changes: 3 additions & 0 deletions config/common/modes.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
#config_version=6

modes:
- base
1 change: 1 addition & 0 deletions config/common/playfields.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

playfields:
playfield:
tags: default
default_source_device: bd_shooter_lane
1 change: 1 addition & 0 deletions config/development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

config:
- common.yaml
- development/virtual_platform.yaml
20 changes: 20 additions & 0 deletions config/development/virtual_platform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#config_version=6

keyboard:
1:
switch: s_trough1
toggle: true
2:
switch: s_trough2
toggle: true
3:
switch: s_trough3
toggle: true
s:
switch: s_start

# So a dev/test game starts with balls in the trough
virtual_platform_start_active_switches:
- s_trough1
- s_trough2
- s_trough3
13 changes: 13 additions & 0 deletions modes/base/config/base.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#config_version=6

mode:
start_events: ball_starting
priority: 100

ball_saves:
ball_start_ball_save:
active_time: "+10s"
hurry_up_time: 6s
timer_start_events: s_shooter_lane_inactive
auto_launch: true
balls_to_save: 1
25 changes: 18 additions & 7 deletions tests/test_general.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
"""Tests General/Base Functionality"""

import os
from mpf.tests.MpfTestCase import MagicMock
from mpf.tests.MpfFakeGameTestCase import MpfFakeGameTestCase
from mpf.tests.MpfGameTestCase import MpfGameTestCase
from mpf.tests.MpfMachineTestCase import MpfMachineTestCase
from mpfmc.tests.FullMpfMachineTestCase import FullMachineTestCase


class TestGeneral(MpfMachineTestCase):

Expand All @@ -21,5 +15,22 @@ def get_machine_path(self):
os.pardir,os.pardir
))

def test_start(self):
def test_game_start(self):
self.__machine_boots
self.__game_begins

def __machine_boots(self):
self.assertEqual(3,
self.machine.ball_devices.bd_trough.balls)
self.assertModeRunning('attract')
self.assertModeNotRunning('base')

def __game_begins(self):
self.hit_and_release_switch("s_start")
self.advance_time_and_run(1)
self.assertEqual(2,
self.machine.ball_devices.bd_trough.balls)
self.assertEqual(1,
self.machine.ball_devices.bd_shooter_lane.balls)
self.assertModeNotRunning('attract')
self.assertModeRunning('base')

0 comments on commit 9e8e147

Please sign in to comment.