package org.squiddev.cctweaks.lua.patch;

import dan200.computercraft.core.computer.Computer;
import dan200.computercraft.core.computer.IComputerEnvironment;
import dan200.computercraft.core.lua.ILuaMachine;
import dan200.computercraft.core.terminal.Terminal;
import org.squiddev.patcher.visitors.MergeVisitor;

public class Computer_Patch extends Computer {
	@MergeVisitor.Stub
	private State m_state;

	@MergeVisitor.Stub
	private ILuaMachine m_machine;

	@MergeVisitor.Stub
	public Computer_Patch(IComputerEnvironment environment, Terminal terminal, int id) {
		super(environment, terminal, id);
	}

	public void abort(boolean hard) {
		synchronized (this) {
			if (m_state != State.Off && m_machine != null) {
				if (hard) {
					m_machine.hardAbort("Too long without yielding");
				} else {
					m_machine.softAbort("Too long without yielding");
				}
			}

		}
	}

	public boolean isMostlyOn() {
		synchronized (this) {
			return m_state != State.Off && m_machine != null;
		}
	}

	@MergeVisitor.Stub
	private enum State {
		Off,
		Starting,
		Running,
		Stopping,
	}
}

@@ -446,24 +446,80 @@
 m_machine;%0A%0A
+%09@MergeVisitor.Stub%0A%09private boolean m_startRequested;%0A%0A
 %09@MergeVisit
@@ -996,44 +996,43 @@
 _sta
-te != State.Off && m_machine != null
+rtRequested %7C%7C m_state != State.Off
 ;%0A%09%09

Make isMostlyOn more lenient