@@ -6,7 +6,7 @@ gui/advfort
66===========
77This script allows to perform jobs in adventure mode. For more complete help
88press :kbd:`?` while script is running. It's most comfortable to use this as a
9- keybinding. (e.g. ``keybinding set Ctrl-T gui/advfort`` ). Possible arguments:
9+ keybinding (see below for the default binding ). Possible arguments:
1010
1111:-a, --nodfassign: uses different method to assign items.
1212:-i, --inventory: checks inventory for possible items to use in the job.
@@ -718,7 +718,7 @@ function isSuitableItem(job_item,item)
718718 print(v)
719719 end
720720 --]]
721-
721+
722722 return false ," matinfo"
723723 end
724724 -- some bonus checks:
@@ -914,7 +914,7 @@ function AssignJobItems(args)
914914 -- first find items that you want to use for the job
915915 local job = args .job
916916 local its = EnumItems_with_settings (args )
917-
917+
918918 local item_suitability ,item_counts = find_suitable_items (job ,its )
919919 --[[ while(#job.items>0) do --clear old job items
920920 job.items[#job.items-1]:delete()
@@ -923,7 +923,7 @@ function AssignJobItems(args)
923923
924924 if settings .gui_item_select and # job .job_items > 0 then
925925 local item_dialog = require (' hack.scripts.gui.advfort_items' )
926-
926+
927927 if settings .quick then -- TODO not so nice hack. instead of rewriting logic for job item filling i'm using one in gui dialog...
928928 local item_editor = item_dialog .jobitemEditor {
929929 job = job ,
@@ -1060,7 +1060,7 @@ function fake_linking(lever,building,slots)
10601060 end
10611061 item2 .general_refs :insert (" #" ,{new = df .general_ref_building_triggerst ,building_id = lever .id })
10621062 item1 .general_refs :insert (" #" ,{new = df .general_ref_building_triggertargetst ,building_id = building .id })
1063-
1063+
10641064 lever .linked_mechanisms :insert (" #" ,item2 )
10651065 -- fixes...
10661066 if building :getType ()== df .building_type .Door then
@@ -1143,7 +1143,7 @@ function PlantGatherFix(args)
11431143 local pos = args .pos
11441144 --[[ args.job.flags[17]=false --??
11451145
1146-
1146+
11471147 local block=dfhack.maps.getTileBlock(pos)
11481148 local ev=get_design_block_ev(block)
11491149 if ev==nil then
@@ -1218,7 +1218,7 @@ function usetool:update_site()
12181218 self .current_site = site
12191219 local site_label = self .subviews .siteLabel
12201220 if site then
1221-
1221+
12221222 site_label :itemById (" site" ).text = dfhack .TranslateName (site .name )
12231223 else
12241224 if settings .safe then
@@ -1404,7 +1404,7 @@ function usetool:openShopWindowButtoned(building,no_reset)
14041404 --]]
14051405 end
14061406 building :fillSidebarMenu ()
1407-
1407+
14081408 local list = {}
14091409 for id ,choice in pairs (wui .choices_visible ) do
14101410 table.insert (list ,{text = utils .call_with_string (choice ," getLabel" ),button = choice })
@@ -1420,7 +1420,7 @@ function usetool:openShopWindowButtoned(building,no_reset)
14201420end
14211421function usetool :openShopWindow (building )
14221422 local adv = df .global .world .units .active [0 ]
1423-
1423+
14241424 local filter_pile = workshopJobs .getJobs (building :getType (),building :getSubtype (),building :getCustomType ())
14251425 if filter_pile then
14261426 local state = {unit = adv ,from_pos = {x = adv .pos .x ,y = adv .pos .y , z = adv .pos .z },building = building
@@ -1522,7 +1522,7 @@ function usetool:hiveActions(building)
15221522 -- CollectHiveProducts,
15231523end
15241524function usetool :operatePump (building )
1525-
1525+
15261526 local adv = df .global .world .units .active [0 ]
15271527 makeJob {unit = adv ,post_actions = {AssignBuildingRef },pos = adv .pos ,from_pos = adv .pos ,job_type = df .job_type .OperatePump ,screen = self }
15281528end
@@ -1537,7 +1537,7 @@ function usetool:farmPlot(building)
15371537 end
15381538 end
15391539 -- check if there tile is without plantseeds,add job
1540-
1540+
15411541 local args = {unit = adv ,pos = adv .pos ,from_pos = adv .pos ,screen = self }
15421542 if do_harvest then
15431543 args .job_type = df .job_type .HarvestPlants
@@ -1702,7 +1702,7 @@ function usetool:fieldInput(keys)
17021702 break
17031703 end
17041704 end
1705-
1705+
17061706 -- First check site
17071707 local ok ,msg = self :siteCheck () -- TODO: some jobs might be possible without a site?
17081708 if not ok then
@@ -1717,17 +1717,17 @@ function usetool:fieldInput(keys)
17171717 end
17181718 end
17191719 end
1720-
1720+
17211721 if not failed then
17221722 local ok ,msg
17231723 if type (cur_mode [2 ])== " function" then
17241724 ok ,msg = cur_mode [2 ](state )
17251725 else
17261726 makeJob (state )
17271727 -- (adv,moddedpos(adv.pos,MOVEMENT_KEYS[code]),cur_mode[2],adv.pos,cur_mode[4])
1728-
1728+
17291729 end
1730-
1730+
17311731 if code == " SELECT" then
17321732 self :sendInputToParent (" LEAVESCREEN" )
17331733 end
@@ -1741,15 +1741,15 @@ function usetool:fieldInput(keys)
17411741 end
17421742 end
17431743 end
1744-
1744+
17451745end
17461746
17471747function usetool :onInput (keys )
17481748
17491749 self :update_site ()
17501750
17511751 local adv = df .global .world .units .active [0 ]
1752-
1752+
17531753 if keys .LEAVESCREEN then
17541754 if df .global .cursor .x ~=- 30000 then -- if not poiting at anything
17551755 self :sendInputToParent (" LEAVESCREEN" ) -- leave poiting
@@ -1782,7 +1782,7 @@ function usetool:onInput(keys)
17821782 self :fieldInput (keys )
17831783 end
17841784 end
1785-
1785+
17861786end
17871787function usetool :cancel_wait ()
17881788 self .long_wait_timer = nil
0 commit comments