deposit toggle
This commit is contained in:
@@ -16,10 +16,21 @@ local SHIELD_SLOT = 2
|
|||||||
|
|
||||||
local config = Config.load('miloRemote', { })
|
local config = Config.load('miloRemote', { })
|
||||||
|
|
||||||
|
local depositMode = {
|
||||||
|
[ true ] = { text = '\25', textColor = colors.black, help = 'Deposit enabled' },
|
||||||
|
[ false ] = { text = '\215', textColor = colors.red, help = 'Deposit disabled' },
|
||||||
|
}
|
||||||
|
|
||||||
local page = UI.Page {
|
local page = UI.Page {
|
||||||
menuBar = UI.MenuBar {
|
menuBar = UI.MenuBar {
|
||||||
y = 1, height = 1,
|
y = 1, height = 1,
|
||||||
buttons = {
|
buttons = {
|
||||||
|
{
|
||||||
|
name = 'depositToggle',
|
||||||
|
text = '\215',
|
||||||
|
x = -15,
|
||||||
|
event = 'toggle_deposit'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text = 'Refresh',
|
text = 'Refresh',
|
||||||
x = -12,
|
x = -12,
|
||||||
@@ -40,7 +51,7 @@ local page = UI.Page {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
infoBar = UI.StatusBar {
|
infoBar = UI.StatusBar {
|
||||||
x = 1, ex = -13,
|
x = 1, ex = -16,
|
||||||
backgroundColor = colors.lightGray,
|
backgroundColor = colors.lightGray,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -274,6 +285,13 @@ function page:eventHandler(event)
|
|||||||
self.setup.form:setValues(config)
|
self.setup.form:setValues(config)
|
||||||
self.setup:show()
|
self.setup:show()
|
||||||
|
|
||||||
|
elseif event.type == 'toggle_deposit' then
|
||||||
|
config.deposit = not config.deposit
|
||||||
|
Util.merge(self.menuBar.depositToggle, depositMode[config.deposit])
|
||||||
|
self.menuBar:draw()
|
||||||
|
self:setStatus(depositMode[config.deposit].help)
|
||||||
|
Config.update('miloRemote', config)
|
||||||
|
|
||||||
elseif event.type == 'form_complete' then
|
elseif event.type == 'form_complete' then
|
||||||
Config.update('miloRemote', config)
|
Config.update('miloRemote', config)
|
||||||
self.setup:hide()
|
self.setup:hide()
|
||||||
@@ -362,6 +380,7 @@ end
|
|||||||
|
|
||||||
function page:enable()
|
function page:enable()
|
||||||
self:setFocus(self.statusBar.filter)
|
self:setFocus(self.statusBar.filter)
|
||||||
|
Util.merge(self.menuBar.depositToggle, depositMode[config.deposit])
|
||||||
UI.Page.enable(self)
|
UI.Page.enable(self)
|
||||||
if not config.server then
|
if not config.server then
|
||||||
self.setup:show()
|
self.setup:show()
|
||||||
@@ -390,6 +409,7 @@ end
|
|||||||
Event.addRoutine(function()
|
Event.addRoutine(function()
|
||||||
while true do
|
while true do
|
||||||
os.sleep(1.5)
|
os.sleep(1.5)
|
||||||
|
if config.deposit then
|
||||||
local neural = device.neuralInterface
|
local neural = device.neuralInterface
|
||||||
local inv = config.useShield and 'getEquipment' or 'getInventory'
|
local inv = config.useShield and 'getEquipment' or 'getInventory'
|
||||||
if not neural or not neural[inv] then
|
if not neural or not neural[inv] then
|
||||||
@@ -416,6 +436,7 @@ Event.addRoutine(function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
UI:setPage(page)
|
UI:setPage(page)
|
||||||
|
|||||||
Reference in New Issue
Block a user