Skip to content

Commit 71aed46

Browse files
author
zacaj
committed
ball save when power off
1 parent 6831b18 commit 71aed46

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

init.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const argv = require('yargs').argv;
1818

1919
export let initialized = false;
2020

21+
// eslint-disable-next-line complexity
2122
export async function initMachine(mpu = true, gfx = false, game = false, trace = true, recording?: string, toPoint?: string) {
2223
try {
2324
initialized = false;
@@ -42,6 +43,10 @@ export async function initMachine(mpu = true, gfx = false, game = false, trace =
4243

4344
await machine.initOutputs();
4445
}
46+
47+
if (!MPU.isLive)
48+
machine.sDetect3.changeState(true, 'fake');
49+
4550
if (cpu) {
4651
fork(CPU.init(argv.cpuIp ?? argv.ip));
4752
}

modes/ball.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ export class Ball extends Mode {
8383
this.listen(onSwitchClose(machine.sOuthole), async () => {
8484
await stopSounds();
8585
await playSound('drop spin');
86-
if (machine.ballsLocked > 0) {
86+
if (machine.ballsLocked > 0 || !machine.sDetect3.state) {
8787
await this.saveBall();
8888
}
8989
});
9090

9191
this.listen(onSwitchClose(machine.sTroughFull), async () => {
92-
if (this.shootAgain || machine.out!.treeValues.ballSave) {
92+
if (this.shootAgain || machine.out!.treeValues.ballSave || !machine.sDetect3.state) {
9393
await this.saveBall();
9494
return;
9595
}

0 commit comments

Comments
 (0)