mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 10:51:55 -04:00
Fixed computers crashing when mods cause computers to pause (context.pause(...)
) in a direct callback (@Callback(direct = true)
).
This commit is contained in:
parent
39704f9532
commit
4b4885b65c
@ -787,17 +787,27 @@ class Machine(val owner: Owner, constructor: Constructor[_ <: Architecture]) ext
|
|||||||
switchTo(Machine.State.Stopping)
|
switchTo(Machine.State.Stopping)
|
||||||
}
|
}
|
||||||
case result: ExecutionResult.Error =>
|
case result: ExecutionResult.Error =>
|
||||||
if (result.message != null) {
|
crash(Option(result.message).getOrElse("unknown error"))
|
||||||
crash(result.message)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
crash("unknown error")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
case Machine.State.Paused =>
|
case Machine.State.Paused =>
|
||||||
state.pop() // Paused
|
state.pop() // Paused
|
||||||
state.pop() // Running, no switchTo to avoid new future.
|
state.pop() // Running, no switchTo to avoid new future.
|
||||||
state.push(Machine.State.Yielded)
|
result match {
|
||||||
|
case result: ExecutionResult.Sleep =>
|
||||||
|
remainIdle = result.ticks
|
||||||
|
state.push(Machine.State.Sleeping)
|
||||||
|
case result: ExecutionResult.SynchronizedCall =>
|
||||||
|
state.push(Machine.State.SynchronizedCall)
|
||||||
|
case result: ExecutionResult.Shutdown =>
|
||||||
|
if (result.reboot) {
|
||||||
|
state.push(Machine.State.Restarting)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
state.push(Machine.State.Stopping)
|
||||||
|
}
|
||||||
|
case result: ExecutionResult.Error =>
|
||||||
|
crash(Option(result.message).getOrElse("unknown error"))
|
||||||
|
}
|
||||||
state.push(Machine.State.Paused)
|
state.push(Machine.State.Paused)
|
||||||
case Machine.State.Stopping => // Nothing to do, we'll die anyway.
|
case Machine.State.Stopping => // Nothing to do, we'll die anyway.
|
||||||
case _ => throw new AssertionError("Invalid state in executor post-processing.")
|
case _ => throw new AssertionError("Invalid state in executor post-processing.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user