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