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