1
0
mirror of https://github.com/LDDestroier/CC/ synced 2024-11-13 05:20:00 +00:00

Doesn't resume off-screen inactive coroutines

This commit is contained in:
LDDestroier 2019-04-26 01:35:46 -04:00 committed by GitHub
parent a9cc18ca5a
commit 904449d831
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -822,6 +822,8 @@ local main = function()
config.timesRan = config.timesRan + 1 config.timesRan = config.timesRan + 1
saveConfig() saveConfig()
local previousTerm
while isRunning do while isRunning do
gridWidth, gridHeight, gridMinX, gridMinY = getMapSize() gridWidth, gridHeight, gridMinX, gridMinY = getMapSize()
local evt = {os.pullEventRaw()} local evt = {os.pullEventRaw()}
@ -967,8 +969,8 @@ local main = function()
for x = gridMinX, gridWidth do for x = gridMinX, gridWidth do
if instances[y][x] then if instances[y][x] then
if justStarted or (not inputEvt[evt[1]]) or (x == focus[1] and y == focus[2]) then if justStarted or ((not inputEvt[evt[1]]) and instances[y][x].active or (x == focus[1] and y == focus[2])) then
local previousTerm = term.redirect(instances[y][x].window.handle) previousTerm = term.redirect(instances[y][x].window.handle)
coroutine.resume(instances[y][x].co, table.unpack(evt)) coroutine.resume(instances[y][x].co, table.unpack(evt))
term.redirect(previousTerm) term.redirect(previousTerm)
end end