|
|
@ -64,9 +64,11 @@ function get_job_item(btype, subtype, custom, index)
|
|
|
|
return obj
|
|
|
|
return obj
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local texpos_base = -1
|
|
|
|
local reset_counts_flag = false
|
|
|
|
local reset_counts_flag = false
|
|
|
|
local reset_inspector_flag = false
|
|
|
|
local reset_inspector_flag = false
|
|
|
|
function reset_counts()
|
|
|
|
function signal_reset()
|
|
|
|
|
|
|
|
texpos_base = dfhack.textures.getControlPanelTexposStart()
|
|
|
|
reset_counts_flag = true
|
|
|
|
reset_counts_flag = true
|
|
|
|
reset_inspector_flag = true
|
|
|
|
reset_inspector_flag = true
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -168,12 +170,22 @@ function ItemLine:init()
|
|
|
|
self.visible = function() return #get_cur_filters() >= self.idx end
|
|
|
|
self.visible = function() return #get_cur_filters() >= self.idx end
|
|
|
|
self:addviews{
|
|
|
|
self:addviews{
|
|
|
|
widgets.Label{
|
|
|
|
widgets.Label{
|
|
|
|
frame={t=0, l=0},
|
|
|
|
frame={t=0, l=23},
|
|
|
|
text={{text=function() return self:get_item_line_text() end}},
|
|
|
|
text={
|
|
|
|
|
|
|
|
{tile=2600},
|
|
|
|
|
|
|
|
{gap=6, tile=2602},
|
|
|
|
|
|
|
|
{tile=2600},
|
|
|
|
|
|
|
|
{gap=1, tile=2602},
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
widgets.Label{
|
|
|
|
widgets.Label{
|
|
|
|
frame={t=0, l=22},
|
|
|
|
frame={t=0, l=0},
|
|
|
|
text='[filter][x]',
|
|
|
|
text={
|
|
|
|
|
|
|
|
{width=21, text=function() return self:get_item_line_text() end},
|
|
|
|
|
|
|
|
{gap=3, text='filter'},
|
|
|
|
|
|
|
|
{gap=2, text='x'},
|
|
|
|
|
|
|
|
{gap=3, text=function() return self.note end},
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -231,14 +243,13 @@ function ItemLine:get_item_line_text()
|
|
|
|
local quantity = get_quantity(filter)
|
|
|
|
local quantity = get_quantity(filter)
|
|
|
|
|
|
|
|
|
|
|
|
self.desc = self.desc or get_desc(filter)
|
|
|
|
self.desc = self.desc or get_desc(filter)
|
|
|
|
local line = ('%d %s%s'):format(quantity, self.desc, quantity == 1 and '' or 's')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.available = self.available or countAvailableItems(uibs.building_type,
|
|
|
|
self.available = self.available or countAvailableItems(uibs.building_type,
|
|
|
|
uibs.building_subtype, uibs.custom_type, idx - 1)
|
|
|
|
uibs.building_subtype, uibs.custom_type, idx - 1)
|
|
|
|
local note = self.available >= quantity and
|
|
|
|
self.note = self.available >= quantity and
|
|
|
|
'Can build now' or 'Will wait for item'
|
|
|
|
'Can build now' or 'Will build later'
|
|
|
|
|
|
|
|
|
|
|
|
return ('%-21s%s%s'):format(line:sub(1,21), (' '):rep(14), note)
|
|
|
|
return ('%d %s%s'):format(quantity, self.desc, quantity == 1 and '' or 's')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function ItemLine:reduce_quantity()
|
|
|
|
function ItemLine:reduce_quantity()
|
|
|
|