|
|
@ -11,6 +11,9 @@ keybinding. (e.g. ``keybinding set Ctrl-T gui/advfort``). Possible arguments:
|
|
|
|
:-a, --nodfassign: uses different method to assign items.
|
|
|
|
:-a, --nodfassign: uses different method to assign items.
|
|
|
|
:-i, --inventory: checks inventory for possible items to use in the job.
|
|
|
|
:-i, --inventory: checks inventory for possible items to use in the job.
|
|
|
|
:-c, --cheat: relaxes item requirements for buildings (e.g. walls from bones). Implies -a
|
|
|
|
:-c, --cheat: relaxes item requirements for buildings (e.g. walls from bones). Implies -a
|
|
|
|
|
|
|
|
:-u, --unsafe: ignores dangerous conditions.
|
|
|
|
|
|
|
|
:-s, --safe: only allow building and etc. only if in site
|
|
|
|
|
|
|
|
:-q, --quick: quick item select mode
|
|
|
|
:job: selects that job (e.g. Dig or FellTree)
|
|
|
|
:job: selects that job (e.g. Dig or FellTree)
|
|
|
|
|
|
|
|
|
|
|
|
An example of player digging in adventure mode:
|
|
|
|
An example of player digging in adventure mode:
|
|
|
@ -22,8 +25,12 @@ An example of player digging in adventure mode:
|
|
|
|
=end]]
|
|
|
|
=end]]
|
|
|
|
|
|
|
|
|
|
|
|
--[==[
|
|
|
|
--[==[
|
|
|
|
version: 0.044
|
|
|
|
version: 0.05
|
|
|
|
changelog:
|
|
|
|
changelog:
|
|
|
|
|
|
|
|
*0.05
|
|
|
|
|
|
|
|
- fixed some reactions not showing. Now there are duplicated reactions :/
|
|
|
|
|
|
|
|
- fixed brewing accepting too many items instead of barrel
|
|
|
|
|
|
|
|
- fixed tallow making to accept fat
|
|
|
|
*0.044
|
|
|
|
*0.044
|
|
|
|
- added output to clear_jobs of number of cleared jobs
|
|
|
|
- added output to clear_jobs of number of cleared jobs
|
|
|
|
- another failed attempt at gather plants fix
|
|
|
|
- another failed attempt at gather plants fix
|
|
|
@ -663,7 +670,7 @@ function RemoveBuilding(args)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function isSuitableItem(job_item,item)
|
|
|
|
function isSuitableItem(job_item,item)
|
|
|
|
--todo butcher test
|
|
|
|
|
|
|
|
if job_item.item_type~=-1 then
|
|
|
|
if job_item.item_type~=-1 then
|
|
|
|
if item:getType()~= job_item.item_type then
|
|
|
|
if item:getType()~= job_item.item_type then
|
|
|
|
return false, "type"
|
|
|
|
return false, "type"
|
|
|
@ -696,29 +703,31 @@ function isSuitableItem(job_item,item)
|
|
|
|
return false,"already cooked"
|
|
|
|
return false,"already cooked"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if type(job_item) ~= "table" and not matinfo:matches(job_item) then
|
|
|
|
if job_item.has_material_reaction_product~="" then
|
|
|
|
--[[
|
|
|
|
local ok=false
|
|
|
|
local true_flags={}
|
|
|
|
for k,v in pairs(matinfo.material.reaction_product.id) do
|
|
|
|
for k,v in pairs(job_item.flags1) do
|
|
|
|
if v.value==job_item.has_material_reaction_product then
|
|
|
|
if v then
|
|
|
|
ok=true
|
|
|
|
table.insert(true_flags,k)
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for k,v in pairs(job_item.flags2) do
|
|
|
|
if not ok then
|
|
|
|
if v then
|
|
|
|
return false, "no material reaction product"
|
|
|
|
table.insert(true_flags,k)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for k,v in pairs(job_item.flags3) do
|
|
|
|
if job_item.reaction_class~="" then
|
|
|
|
if v then
|
|
|
|
local ok=false
|
|
|
|
table.insert(true_flags,k)
|
|
|
|
for k,v in pairs(matinfo.material.reaction_class) do
|
|
|
|
|
|
|
|
if v.value==job_item.reaction_class then
|
|
|
|
|
|
|
|
ok=true
|
|
|
|
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for k,v in pairs(true_flags) do
|
|
|
|
if not ok then
|
|
|
|
print(v)
|
|
|
|
return false, "no material reaction class"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
--]]
|
|
|
|
end
|
|
|
|
|
|
|
|
if type(job_item) ~= "table" and not matinfo:matches(job_item) then
|
|
|
|
return false,"matinfo"
|
|
|
|
return false,"matinfo"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
-- some bonus checks:
|
|
|
|
-- some bonus checks:
|
|
|
@ -732,6 +741,7 @@ function isSuitableItem(job_item,item)
|
|
|
|
return false,"metal ore"
|
|
|
|
return false,"metal ore"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if job_item.min_dimension~=-1 then
|
|
|
|
if job_item.min_dimension~=-1 then
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
-- if #job_item.contains~=0 then
|
|
|
|
-- if #job_item.contains~=0 then
|
|
|
|
-- end
|
|
|
|
-- end
|
|
|
@ -740,30 +750,35 @@ function isSuitableItem(job_item,item)
|
|
|
|
return false,"tool use"
|
|
|
|
return false,"tool use"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if job_item.has_material_reaction_product~="" then
|
|
|
|
|
|
|
|
local ok=false
|
|
|
|
if job_item.flags3.food_storage and not item:isFoodStorage() then
|
|
|
|
for k,v in pairs(matinfo.material.reaction_product.id) do
|
|
|
|
return false,"not food storage"
|
|
|
|
if v.value==job_item.has_material_reaction_product then
|
|
|
|
|
|
|
|
ok=true
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if job_item.flags1.empty and dfhack.items.getGeneralRef(item,df.general_ref_type.CONTAINS_ITEM) then
|
|
|
|
|
|
|
|
return false,"not empty"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if not ok then
|
|
|
|
--[[
|
|
|
|
return false, "no material reaction product"
|
|
|
|
local true_flags={}
|
|
|
|
|
|
|
|
for k,v in pairs(job_item.flags1) do
|
|
|
|
|
|
|
|
if v then
|
|
|
|
|
|
|
|
table.insert(true_flags,k.." f1")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if job_item.reaction_class~="" then
|
|
|
|
for k,v in pairs(job_item.flags2) do
|
|
|
|
local ok=false
|
|
|
|
if v then
|
|
|
|
for k,v in pairs(matinfo.material.reaction_class) do
|
|
|
|
table.insert(true_flags,k.." f2")
|
|
|
|
if v.value==job_item.reaction_class then
|
|
|
|
|
|
|
|
ok=true
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if not ok then
|
|
|
|
for k,v in pairs(job_item.flags3) do
|
|
|
|
return false, "no material reaction class"
|
|
|
|
if v then
|
|
|
|
|
|
|
|
table.insert(true_flags,k.." f3")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
for k,v in pairs(true_flags) do
|
|
|
|
|
|
|
|
print(v)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--]]
|
|
|
|
return true
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
function getItemsUncollected(job)
|
|
|
|
function getItemsUncollected(job)
|
|
|
@ -1396,45 +1411,48 @@ function usetool:openShopWindowButtoned(building,no_reset)
|
|
|
|
for k,v in pairs(wui.material_category) do
|
|
|
|
for k,v in pairs(wui.material_category) do
|
|
|
|
wui.material_category[k]=false
|
|
|
|
wui.material_category[k]=false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
--]]
|
|
|
|
|
|
|
|
--[[building:fillSidebarMenu()
|
|
|
|
|
|
|
|
if #wui.choices_all>0 then
|
|
|
|
|
|
|
|
wui.choices_all[#wui.choices_all-1]:click()
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--]]
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
building:fillSidebarMenu()
|
|
|
|
building:fillSidebarMenu()
|
|
|
|
|
|
|
|
|
|
|
|
local list={}
|
|
|
|
local list={}
|
|
|
|
|
|
|
|
local names_already_in={}
|
|
|
|
for id,choice in pairs(wui.choices_visible) do
|
|
|
|
for id,choice in pairs(wui.choices_visible) do
|
|
|
|
table.insert(list,{text=utils.call_with_string(choice,"getLabel"),button=choice})
|
|
|
|
local label=string.lower(utils.call_with_string(choice,"getLabel"))
|
|
|
|
|
|
|
|
table.insert(list,{text=label,button=choice,is_button=true})
|
|
|
|
|
|
|
|
names_already_in[label]=true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if #list ==0 and not no_reset then
|
|
|
|
--add fallback list if for some reason df does not make the buttons
|
|
|
|
print("Fallback")
|
|
|
|
|
|
|
|
self:openShopWindow(building)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
--qerror("No jobs for this workshop")
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
dialog.showListPrompt("Workshop job choice", "Choose what to make",COLOR_WHITE,list,self:callback("onWorkShopButtonClicked",building)
|
|
|
|
|
|
|
|
,nil, nil,true)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
function usetool:openShopWindow(building)
|
|
|
|
|
|
|
|
local adv=df.global.world.units.active[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local filter_pile=workshopJobs.getJobs(building:getType(),building:getSubtype(),building:getCustomType())
|
|
|
|
local filter_pile=workshopJobs.getJobs(building:getType(),building:getSubtype(),building:getCustomType())
|
|
|
|
if filter_pile then
|
|
|
|
local adv=df.global.world.units.active[0]
|
|
|
|
local state={unit=adv,from_pos={x=adv.pos.x,y=adv.pos.y, z=adv.pos.z},building=building
|
|
|
|
local state={unit=adv,from_pos={x=adv.pos.x,y=adv.pos.y, z=adv.pos.z},building=building
|
|
|
|
,screen=self,bld=building,common=filter_pile.common}
|
|
|
|
,screen=self,bld=building}
|
|
|
|
choices={}
|
|
|
|
if filter_pile and not no_reset then
|
|
|
|
for k,v in pairs(filter_pile) do
|
|
|
|
local count=0
|
|
|
|
table.insert(choices,{job_id=0,text=v.name:lower(),filter=v})
|
|
|
|
state.common=filter_pile.common
|
|
|
|
end
|
|
|
|
for i,v in ipairs(filter_pile) do
|
|
|
|
dialog.showListPrompt("Workshop job choice", "Choose what to make",COLOR_WHITE,choices,dfhack.curry(onWorkShopJobChosen,state)
|
|
|
|
local label=v.name:lower()
|
|
|
|
,nil, nil,true)
|
|
|
|
if not names_already_in[label] then
|
|
|
|
|
|
|
|
table.insert(list,{job_id=0,text=label,filter=v})
|
|
|
|
|
|
|
|
count=count+1
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
print("Added:",count," non-button jobs")
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
if #list==0 then
|
|
|
|
|
|
|
|
qerror("no jobs for this shop")
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
dialog.showListPrompt("Workshop job choice", "Choose what to make",
|
|
|
|
|
|
|
|
COLOR_WHITE,list,
|
|
|
|
|
|
|
|
function (index,choice)
|
|
|
|
|
|
|
|
if choice.is_button then
|
|
|
|
|
|
|
|
self:onWorkShopButtonClicked(building,index,choice)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
qerror("No jobs for this workshop")
|
|
|
|
onWorkShopJobChosen(state,index,choice)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
,nil, nil,true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function track_stop_configure(bld) --TODO: dedicated widget with nice interface and current setting display
|
|
|
|
function track_stop_configure(bld) --TODO: dedicated widget with nice interface and current setting display
|
|
|
|
local dump_choices={
|
|
|
|
local dump_choices={
|
|
|
|
{text="no dumping"},
|
|
|
|
{text="no dumping"},
|
|
|
|