Files
opus-apps/milo/plugins/item/infoTab.lua
kepler155c 4576969739 Ui enhancements 2.0 (#29)
* canvas overhaul

* editor 2.0

* more tweaks

* more editor work

* completions + refactor

* cleanup + editor additions

* cleanup + undo overhaul

* editor recent/peripherals/redo + cleanup

* editor path issues

* cleanup

* changes for deprecated ui methods - recolor milo - make turtle scripts run again - mob rancher improvements

* can now use named colors
2020-04-21 22:40:47 -06:00

47 lines
984 B
Lua

local Ansi = require('opus.ansi')
local UI = require('opus.ui')
local infoTab = UI.Tab {
tabTitle = 'Info',
index = 4,
textArea = UI.TextArea {
x = 2, ex = -2, y = 2, ey = -2,
},
}
function infoTab:setItem(item)
self.item = item
end
function infoTab:draw()
local item = self.item
local value =
string.format('%s%s%s\n%s\n',
Ansi.orange, item.displayName, Ansi.reset,
item.name)
if item.nbtHash then
value = value .. item.nbtHash .. '\n'
end
value = value .. string.format('\n%sCount:%s %s',
Ansi.yellow, Ansi.reset, item.count)
value = value .. string.format('\n%sDamage:%s %s',
Ansi.yellow, Ansi.reset, item.damage)
if item.maxDamage and item.maxDamage > 0 then
value = value .. string.format(' (max: %s)', item.maxDamage)
end
if item.maxCount then
value = value .. string.format('\n%sStack Size: %s%s',
Ansi.yellow, Ansi.reset, item.maxCount)
end
self.textArea.value = value
UI.Tab.draw(self)
end
return { itemTab = infoTab }