beginning of textures

develop
Myk Taylor 2023-02-16 21:17:55 -08:00
parent b3198c88a0
commit e92a54deaa
No known key found for this signature in database
2 changed files with 22 additions and 11 deletions

@ -220,7 +220,7 @@ static void do_cycle(color_ostream &out) {
cycle_requested = false;
buildingplan_cycle(out, tasks, planned_buildings);
call_buildingplan_lua(&out, "reset_counts");
call_buildingplan_lua(&out, "signal_reset");
}
DFhackCExport command_result plugin_onupdate(color_ostream &out) {
@ -428,7 +428,7 @@ static bool setSetting(color_ostream &out, string name, bool value) {
}
validate_config(out, true);
call_buildingplan_lua(&out, "reset_counts");
call_buildingplan_lua(&out, "signal_reset");
return true;
}

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