Mostly whitespace changes.

develop
Warmist 2015-09-09 22:30:00 +03:00
parent 72b7a19425
commit 96e6582417
1 changed files with 20 additions and 28 deletions

@ -54,13 +54,13 @@ prevJob={key="CUSTOM_SHIFT_R",desc="Previous job in the list"},
continue={key="A_WAIT",desc="Continue job if available"},
down_alt1={key="CUSTOM_CTRL_D",desc="Use job down"},
down_alt2={key="CURSOR_DOWN_Z_AUX",desc="Use job down"},
up_alt1={key="CUSTOM_CTRL_E",desc="Use job up"},
up_alt1={key="CUSTOM_CTRL_E",desc="Use job up"},
up_alt2={key="CURSOR_UP_Z_AUX",desc="Use job up"},
use_same={key="A_MOVE_SAME_SQUARE",desc="Use job at the tile you are standing"},
workshop={key="CHANGETAB",desc="Show building menu"},
}
-- building filters
build_filter={
build_filter={
forbid_all=false, --this forbits all except the "allow"
allow={"MetalSmithsForge"}, --ignored if forbit_all=false
forbid={} --ignored if forbit_all==true
@ -109,7 +109,7 @@ function deon_filter(name,type_id,subtype_id,custom_id, parent)
else
return not hasValue(race_filter.forbid,name)
end
else
else
if build_filter.forbid_all then
return hasValue(build_filter.allow,name)
else
@ -185,14 +185,13 @@ function advGlobalPos()
return math.floor(map.region_x+adv.pos.x/48), math.floor(map.region_y+adv.pos.y/48)
end
function inSite()
local tx,ty=advGlobalPos()
--print(tx,ty)
for k,v in pairs(df.global.world.world_data.sites) do
local tp={v.pos.x,v.pos.y}
if tx>=tp[1]*16+v.rgn_min_x and tx<=tp[1]*16+v.rgn_max_x and
ty>=tp[2]*16+v.rgn_min_y and ty<=tp[2]*16+v.rgn_max_y then
--print(k)
return v
end
end
@ -499,19 +498,19 @@ function chooseBuildingWidthHeightDir(args) --TODO nicer selection dialog
if myneeds==nil then return end
if args.width==nil and myneeds.w then
--args.width=3
dialog.showInputPrompt("Building size:", "Input building width:", nil, "1",
dialog.showInputPrompt("Building size:", "Input building width:", nil, "1",
function(txt) args.width=tonumber(txt);BuildingChosen(args) end)
return true
end
if args.height==nil and myneeds.h then
--args.height=4
dialog.showInputPrompt("Building size:", "Input building height:", nil, "1",
dialog.showInputPrompt("Building size:", "Input building height:", nil, "1",
function(txt) args.height=tonumber(txt);BuildingChosen(args) end)
return true
end
if args.direction==nil and myneeds.d then
--args.direction=0--?
dialog.showInputPrompt("Building size:", "Input building direction:", nil, "0",
dialog.showInputPrompt("Building size:", "Input building direction:", nil, "0",
function(txt) args.direction=tonumber(txt);BuildingChosen(args) end)
return true
end
@ -521,7 +520,7 @@ end
CheckAndFinishBuilding=nil
function BuildingChosen(inp_args,type_id,subtype_id,custom_id)
local args=inp_args or {}
args.type=type_id or args.type
args.subtype=subtype_id or args.subtype
args.custom=custom_id or args.custom_id
@ -531,9 +530,8 @@ function BuildingChosen(inp_args,type_id,subtype_id,custom_id)
last_building.type=args.type
last_building.subtype=args.subtype
last_building.custom=args.custom
if chooseBuildingWidthHeightDir(args) then
return
end
--if settings.build_by_items then
@ -564,7 +562,6 @@ function isSuitableItem(job_item,item)
--todo butcher test
if job_item.item_type~=-1 then
if item:getType()~= job_item.item_type then
return false, "type"
elseif job_item.item_subtype~=-1 then
if item:getSubtype()~=job_item.item_subtype then
@ -572,7 +569,7 @@ function isSuitableItem(job_item,item)
end
end
end
if job_item.mat_type~=-1 then
if item:getActualMaterial()~= job_item.mat_type then --unless we would want to make hist-fig specific reactions
return false, "material"
@ -774,10 +771,9 @@ function find_suitable_items(job,items,job_items)
local used_item_id={}
for job_id, trg_job_item in ipairs(job_items) do
item_suitability[job_id]={}
for _,cur_item in pairs(items) do
if not used_item_id[cur_item.id] then
local item_suitable,msg=isSuitableItem(trg_job_item,cur_item)
if item_suitable or settings.build_by_items then
table.insert(item_suitability[job_id],cur_item)
@ -825,7 +821,6 @@ function AssignJobItems(args)
else
print("Failed job, i'm confused...")
end
--end)
return false,"Selecting items"
else
@ -851,7 +846,7 @@ CheckAndFinishBuilding=function (args,bld)
break
end
end
if args.job~=nil then
args.pre_actions={AssignJobItems}
else
@ -887,7 +882,7 @@ end
function CancelJob(unit)
local c_job=unit.job.current_job
if c_job then
unit.job.current_job =nil --todo add real cancelation
unit.job.current_job =nil --todo add real cancelation
for k,v in pairs(c_job.general_refs) do
if df.general_ref_unit_workerst:is_instance(v) then
v:delete()
@ -898,7 +893,7 @@ function CancelJob(unit)
end
end
function ContinueJob(unit)
local c_job=unit.job.current_job
local c_job=unit.job.current_job
--no job to continue
if not c_job then return end
--reset suspends...
@ -1037,7 +1032,7 @@ actions={
{"DetailWall" ,df.job_type.DetailWall,{IsWall,IsHardMaterial}},
{"DetailFloor" ,df.job_type.DetailFloor,{IsFloor,IsHardMaterial,SameSquare}},
{"CarveTrack" ,df.job_type.CarveTrack,{IsFloor,IsHardMaterial}
,{SetCarveDir}},
,{SetCarveDir}},
{"Dig" ,df.job_type.Dig,{MakePredicateWieldsItem(df.job_skill.MINING),IsWall}},
{"CarveUpwardStaircase" ,df.job_type.CarveUpwardStaircase,{MakePredicateWieldsItem(df.job_skill.MINING),IsWall}},
{"CarveDownwardStaircase",df.job_type.CarveDownwardStaircase,{MakePredicateWieldsItem(df.job_skill.MINING)}},
@ -1059,7 +1054,6 @@ actions={
{"Clean" ,df.job_type.Clean,{}},
{"GatherWebs" ,df.job_type.CollectWebs,{--[[HasWeb]]},{SetWebRef}},
{"Link Buildings" ,LinkBuilding,{IsBuilding}},
}
for id,action in pairs(actions) do
@ -1104,7 +1098,6 @@ function usetool:init(args)
text={{key=keybinds.prevJob.key},{gap=1,text=self:callback("getModeName")},{gap=1,key=keybinds.nextJob.key},
}
},
wid.Label{
view_id="shopLabel",
@ -1113,7 +1106,7 @@ function usetool:init(args)
text={
{id="text1",gap=1,key=keybinds.workshop.key,key_sep="()", text="Workshop menu",pen=dfhack.pen.parse{fg=COLOR_YELLOW,bg=0}},{id="clutter"}}
},
wid.Label{
view_id="siteLabel",
frame = {t=1,xalign=-1,yalign=0},
@ -1180,7 +1173,7 @@ function onWorkShopJobChosen(args,idx,choice)
end
function siegeWeaponActionChosen(args,actionid)
local building=args.building
if actionid==1 then --Tunr
if actionid==1 then --Turn
building.facing=(args.building.facing+1)%4
return
elseif actionid==2 then --Load
@ -1219,7 +1212,6 @@ function putItemToBuilding(building,item)
end
end
function usetool:openPutWindow(building)
local adv=df.global.world.units.active[0]
local items=EnumItems{pos=adv.pos,unit=adv,
inv={[df.unit_inventory_item.T_mode.Hauled]=true,--[df.unit_inventory_item.T_mode.Worn]=true,
@ -1320,7 +1312,7 @@ function usetool:armCleanTrap(building)
LoadStoneTrap,
LoadWeaponTrap,
]]
if building.trap_type==df.trap_type.Lever then
if building.trap_type==df.trap_type.Lever then
--link
return
end
@ -1609,7 +1601,7 @@ function usetool:onInput(keys)
if keys[keybinds.workshop.key] then
self.mode.input(self,self.building)
end
self:fieldInput(keys)
self:fieldInput(keys)
else
self:fieldInput(keys)
end