milo: unassign machine

This commit is contained in:
kepler155c@gmail.com
2019-05-07 07:14:30 -04:00
parent e61940a7aa
commit 8ea2598254
2 changed files with 13 additions and 7 deletions

View File

@@ -51,11 +51,15 @@ end
function machinesTab:eventHandler(event)
if event.type == 'grid_select' then
Craft.machineLookup[self.item.key] = event.selected.name
if event.selected.name == Craft.machineLookup[self.item.key] then
Craft.machineLookup[self.item.key] = nil
else
Craft.machineLookup[self.item.key] = event.selected.name
end
Util.writeTable(Craft.MACHINE_LOOKUP, Craft.machineLookup)
self.grid:draw()
self:emit({ type = 'info_message', message = 'Machine saved' })
self:emit({ type = 'info_message', message = 'Saved' })
return true
end