|
|
|
@ -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
|
|
|
|
@ -533,7 +532,6 @@ function BuildingChosen(inp_args,type_id,subtype_id,custom_id)
|
|
|
|
|
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
|
|
|
|
@ -777,7 +774,6 @@ function find_suitable_items(job,items,job_items)
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
@ -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
|
|
|
|
@ -1105,7 +1099,6 @@ function usetool:init(args)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wid.Label{
|
|
|
|
|
view_id="shopLabel",
|
|
|
|
|
frame = {l=35,xalign=0,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,
|
|
|
|
|