mirror of
https://github.com/LDDestroier/CC/
synced 2025-06-22 11:44:06 +00:00
Update workspace.lua
This commit is contained in:
parent
26dcaa960b
commit
068093201a
@ -943,17 +943,26 @@ local main = function()
|
|||||||
os.clock = function()
|
os.clock = function()
|
||||||
return oldOSreplace.clock() + instances[y][x].clockMod
|
return oldOSreplace.clock() + instances[y][x].clockMod
|
||||||
end
|
end
|
||||||
|
os.queueEvent = function(evt, ...)
|
||||||
|
if instances[y][x].paused then
|
||||||
|
instances[y][x].extraEvents[#instances[y][x].extraEvents + 1] = {evt, ...}
|
||||||
|
else
|
||||||
|
oldOSreplace.queueEvent(evt, ...)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- timer for instance timers and window scrolling
|
-- timer for instance timers and window scrolling
|
||||||
tID = os.startTimer(0.05)
|
tID = os.startTimer(0.05)
|
||||||
|
|
||||||
-- if true, timer events won't be accepted by instances (unless it's an extraEvent)
|
-- if true, timer events won't be accepted by instances (unless it's an extraEvent)
|
||||||
local banTimerEvent
|
local banTimerEvent, evt
|
||||||
|
|
||||||
while isRunning do
|
while isRunning do
|
||||||
gridWidth, gridHeight, gridMinX, gridMinY = getMapSize()
|
gridWidth, gridHeight, gridMinX, gridMinY = getMapSize()
|
||||||
local evt = {os.pullEventRaw()}
|
|
||||||
|
evt = {os.pullEventRaw()}
|
||||||
|
|
||||||
enteringCommand = false
|
enteringCommand = false
|
||||||
if evt[1] == "key" then
|
if evt[1] == "key" then
|
||||||
keysDown[evt[2]] = true
|
keysDown[evt[2]] = true
|
||||||
@ -1112,11 +1121,20 @@ local main = function()
|
|||||||
oldOSreplace.startTimer = os.startTimer
|
oldOSreplace.startTimer = os.startTimer
|
||||||
oldOSreplace.cancelTimer = os.cancelTimer
|
oldOSreplace.cancelTimer = os.cancelTimer
|
||||||
oldOSreplace.clock = os.clock
|
oldOSreplace.clock = os.clock
|
||||||
|
oldOSreplace.queueEvent = os.queueEvent
|
||||||
|
|
||||||
for y = gridMinY, gridHeight do
|
for y = gridMinY, gridHeight do
|
||||||
if instances[y] then
|
if instances[y] then
|
||||||
for x = gridMinX, gridWidth do
|
for x = gridMinX, gridWidth do
|
||||||
if instances[y][x] then
|
if instances[y][x] then
|
||||||
|
|
||||||
|
if justStarted or (checkIfCanRun(evt, x, y) and not (banTimerEvent and evt[1] == "timer")) then
|
||||||
|
previousTerm = term.redirect(instances[y][x].window.handle)
|
||||||
|
setInstanceSpecificFunctions(x, y)
|
||||||
|
cSuccess, instances[y][x].eventFilter = coroutine.resume(instances[y][x].co, table.unpack(evt))
|
||||||
|
term.redirect(previousTerm)
|
||||||
|
end
|
||||||
|
|
||||||
if #instances[y][x].extraEvents ~= 0 then
|
if #instances[y][x].extraEvents ~= 0 then
|
||||||
for i = 1, #instances[y][x].extraEvents do
|
for i = 1, #instances[y][x].extraEvents do
|
||||||
if checkIfCanRun(instances[y][x].extraEvents[i], x, y) then
|
if checkIfCanRun(instances[y][x].extraEvents[i], x, y) then
|
||||||
@ -1131,13 +1149,6 @@ local main = function()
|
|||||||
instances[y][x].extraEvents = {}
|
instances[y][x].extraEvents = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
if justStarted or (checkIfCanRun(evt, x, y) and not (banTimerEvent and evt[1] == "timer")) then
|
|
||||||
previousTerm = term.redirect(instances[y][x].window.handle)
|
|
||||||
setInstanceSpecificFunctions(x, y)
|
|
||||||
cSuccess, instances[y][x].eventFilter = coroutine.resume(instances[y][x].co, table.unpack(evt))
|
|
||||||
term.redirect(previousTerm)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1146,6 +1157,8 @@ local main = function()
|
|||||||
os.startTimer = oldOSreplace.startTimer
|
os.startTimer = oldOSreplace.startTimer
|
||||||
os.cancelTimer = oldOSreplace.cancelTimer
|
os.cancelTimer = oldOSreplace.cancelTimer
|
||||||
os.clock = oldOSreplace.clock
|
os.clock = oldOSreplace.clock
|
||||||
|
os.queueEvent = oldOSreplace.queueEvent
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
lddterm.selectedWindow = instances[focus[2]][focus[1]].window.layer
|
lddterm.selectedWindow = instances[focus[2]][focus[1]].window.layer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user