Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40fa421f89 |
+11
-14
@@ -209,7 +209,6 @@ function MonitorWindow:onLoad()
|
||||
globalControl = ctrl
|
||||
else
|
||||
print(string.format('Failed to initialize global control: %s', tostring(ctrl)))
|
||||
print('Falling back to always-on control.')
|
||||
event.pull('key_up')
|
||||
end
|
||||
end
|
||||
@@ -229,7 +228,6 @@ function MonitorWindow:onLoad()
|
||||
end
|
||||
self.reactors = reactors
|
||||
|
||||
-- Register emergency shutdown with App, so crashes shut down all reactors
|
||||
self.app.crashHandler = function(err)
|
||||
self:emergencyShutdown(err)
|
||||
end
|
||||
@@ -266,7 +264,6 @@ function MonitorWindow:emergencyShutdown(err)
|
||||
self.running = false
|
||||
for _, reactor in ipairs(self.reactors) do
|
||||
reactor:stop()
|
||||
-- Force-disable redstone output, best-effort
|
||||
pcall(function() reactor.i.control:disable() end)
|
||||
end
|
||||
end
|
||||
@@ -328,7 +325,9 @@ local function configSave()
|
||||
end
|
||||
|
||||
local function instantiateControl(cfg, rc)
|
||||
if cfg.mode == 'adapter' then
|
||||
if not cfg or cfg.mode == 'none' then
|
||||
return reactorControl.Adapter:new(rc)
|
||||
elseif cfg.mode == 'adapter' then
|
||||
return reactorControl.Adapter:new(rc)
|
||||
elseif cfg.mode == 'vanilla' then
|
||||
return reactorControl.Vanilla:new(cfg)
|
||||
@@ -957,7 +956,7 @@ function ReactorChamber:checkProfile()
|
||||
|
||||
for i = 1, self.activeProfile.count do
|
||||
local profileItem = layout[i]
|
||||
local reactorItem = reactorItems[i]
|
||||
local reactorItem = reactorItems[i - 1]
|
||||
|
||||
if not reactorItem then
|
||||
self.error = _T('profile_count_mismatch')
|
||||
@@ -1013,11 +1012,11 @@ function ReactorChamber:applyProfile()
|
||||
|
||||
local function insertIntoReactor(index, name)
|
||||
debugLog(string.format('insert %s to reactor slot #%d', name, index))
|
||||
coroutine.yield()
|
||||
local items = tp.getAllStacks(tp.itemIn).getAll()
|
||||
coroutine.yield()
|
||||
for i = 1, #items do
|
||||
local item = items[i]
|
||||
if item and item.name == name then
|
||||
local item = items[i - 1]
|
||||
if item.name == name then
|
||||
local count = tp.transferItem(tp.itemIn, tp.itemReactor, 1, i, index)
|
||||
coroutine.yield()
|
||||
if count > 0 then
|
||||
@@ -1046,15 +1045,14 @@ function ReactorChamber:applyProfile()
|
||||
end
|
||||
debugLog(string.format('rc: apply for slot #%d', i))
|
||||
local profileItem = layout[i]
|
||||
local reactorItem = reactorItems[i]
|
||||
local reactorItem = reactorItems[i - 1]
|
||||
|
||||
if not reactorItem then
|
||||
debugLog('reactorItem not exist!')
|
||||
self.error = _T('profile_count_mismatch')
|
||||
-- profile misconfigured, disable reactor and stop
|
||||
self.state = _T('reactor_state_error'):format(self.error)
|
||||
self.running = false
|
||||
self.i.control:disable()
|
||||
self.state = _T('reactor_state_error'):format(self.error)
|
||||
if self.delegate then
|
||||
self.delegate:onReactorUpdate(self)
|
||||
end
|
||||
@@ -2039,10 +2037,9 @@ function App:start(window)
|
||||
term.clear()
|
||||
print('===== FATAL ERROR =====')
|
||||
print(tostring(err))
|
||||
print('All reactors have been emergency-shut down.')
|
||||
print('Press any key to exit...')
|
||||
local event = palRequire('event')
|
||||
event.pull('key_up')
|
||||
local ev = palRequire('event')
|
||||
ev.pull('key_up')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user