Skip to content

Commit

Permalink
feat: complete red flag mode qualification
Browse files Browse the repository at this point in the history
  • Loading branch information
unRARed committed Feb 22, 2025
1 parent 0e63a69 commit 1b6870d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 8 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,23 @@ graph TD
GREEN_FLAG -- 50 laps all day --> LUX_MODE[/"Lap of Luxury Mode"/]
GREEN_FLAG -- grand prix sequence --> GP_MODE[/"Grand Prix Mode"/]
RANDOM1 -- fuel -->
PIT_CHECK{"Fuel, Oil or Tires need attention?"}
RANDOM1 -- tires --> PIT_CHECK
RANDOM1 -- oil --> PIT_CHECK
IS_NEED_PIT{"Fuel, Oil or Tires need attention?"}
RANDOM1 -- tires --> IS_NEED_PIT
RANDOM1 -- oil --> IS_NEED_PIT
RANDOM1 -- bad luck --> BALL_DRAINS((("Ball Drains")))
PIT_CHECK -- yes --> PIT
PIT_CHECK -- no --> GREEN_FLAG
IS_NEED_PIT -- yes --> PIT
IS_NEED_PIT -- no --> GREEN_FLAG
GL_MODE --> GL_MULTI("Grooveline Multiball")
LUX_MODE --> LUX_MULTI("Lap of Luxury Multiball")
GP_MODE --> GP_MULTI("Grand Prix Multiball")
GL_MULTI -- make 3 laps --> GL_MULTI_ADD_BALL("Add a Ball")
GL_MULTI -->
IS_RF_MODE_READY{"Red Flag Mode Ready?"}
LUX_MULTI --> IS_RF_MODE_READY
GP_MULTI --> IS_RF_MODE_READY
IS_RF_MODE_READY -- yes --> RF_MODE[/"Red Flag<br>(Wizard) Mode"/]
IS_RF_MODE_READY -- no --> GREEN_FLAG
RF_MODE --> RF_MULTI("Red Flag Multiball")
```

### Production Machine Setup
Expand Down
1 change: 1 addition & 0 deletions config/common.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#config_version=6

config:
- common/mpf.yaml
- common/assets.yaml
- common/ball_devices.yaml
- common/coils.yaml
Expand Down
3 changes: 2 additions & 1 deletion modes/red_flag/config/mode.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#config_version=6

mode:
# start_events:
start_events:
- sw_tag_hole_active{current_player.is_grooveline_completed > 0 and current_player.is_grand_prix_completed > 0 and current_player.is_luxury_completed > 0}
# TODO after logicblock_red_flag_counter_complete
stop_events:
- multiball_red_flag_ended
Expand Down
16 changes: 14 additions & 2 deletions tests/test_red_flag_mode.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import random
from tests.death_save_game_testing import DeathSaveGameTesting

class TestRedFlagMode(DeathSaveGameTesting):
Expand Down Expand Up @@ -49,7 +50,6 @@ def test_qualification(self):
for i in range(2):
self._drain_one_ball()
self.advance_time_and_run(1)
#self.assertEqual(1, self.machine.playfield.balls)
self.assertModeNotRunning("grand_prix")
self.assertEqual(
1, self.machine.game.player.is_grand_prix_completed)
Expand All @@ -60,4 +60,16 @@ def test_qualification(self):
self.assertEqual(True, self.machine. \
counters["red_flag_counter"].check_complete())

# TODO: final sequence for mode start here
# With all 3 qualifying modes completed,
# the red flag mode is started by entering
# ANY ONE OF THE HOLES on the playfield, so
# we select a random one here
holes = ["s_grand_hole", "s_prix_hole", "s_podium_hole"]
self.assertModeNotRunning("red_flag")
self.hit_and_release_switch(random.choice(holes))

# The red flag mode is started
self.advance_time_and_run(1)
self.assertModeRunning("red_flag")
self.assertEqual(True,
self.machine.multiballs["red_flag"].enabled)
1 change: 1 addition & 0 deletions web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
'<style>' \
'h1,h2,h3,h4,h5,h6 { margin: 0.5rem; }' \
'p { margin: 0.5rem; }' \
'.mermaid { height: 60vw; }' \
'</style>'

app = Flask(__name__)
Expand Down

0 comments on commit 1b6870d

Please sign in to comment.