Why? I can't really think of why you'd want that. I mean, you could always have items only able to be made of the one material.
local function applySyndromesBasedOnItems(_uid,unit)
if itemsyndromedebug then print("Checking unit #" .. _uid+1) end
local transformation = false
for itemid,item_inv in ipairs(unit.inventory) do
local item = item_inv.item
if itemsyndromedebug then print("checking item #" .. itemid+1 .." on unit #" .. _uid+1) end
if getSyndrome(getMaterial(item)) then
if itemsyndromedebug then print("item has a syndrome, checking if item is valid for application...") end
local syndrome = getSyndrome(getMaterial(item))
local syndromeApplied
if syndromeIsTransformation(syndrome) then
unitInventory = rememberInventory(unit)
transformation = true
end
if syndromeIsDfHackSyndrome(syndrome) and creatureIsAffected(unit,syndrome) and itemIsInValidPosition(item_inv, syndrome) then
assignSyndrome(unit,syndrome.id)
syndromeApplied = true
end
end
if itemHasSyndrome(item) then
if itemsyndromedebug then print("Item itself has a syndrome, checking if item is in correct position and creature is affected") end
local syndrome = itemHasSyndrome(item)
if syndromeIsTransformation(syndrome) then
unitInventory = rememberInventory(unit)
transformation = true
end
if item_inv.mode~=0 and item_inv.mode~=7 and creatureIsAffected(unit,syndrome) then assignSyndrome(unit,syndrome.id) end --the mode thing is to avoid stuckins from doing
end
if itemsyndromecontaminants and item.contaminants then
if itemsyndromedebug then print("Item has contaminants. Checking for syndromes...") end
for _,contaminant in ipairs(item.contaminants) do
if itemsyndromedebug then print("Checking contaminant #" .. _ .. " on item #" .. itemid .. " on unit #" .. _uid ..".") end
if getSyndrome(getMaterial(contaminant)) then
local syndrome = getSyndrome(getMaterial(contaminant))
if syndromeIsTransformation(syndrome) then
unitInventory = rememberInventory(unit)
transformation =true
end
if syndromeIsDfHackSyndrome(syndrome) and creatureIsAffected(unit,syndrome) and itemIsInValidPosition(item_inv, syndrome) then assignSyndrome(unit,syndrome.id) end
end
end
end
end
if transformation then dfhack.timeout(2,"ticks",function() moveAllToInventory(unit,unitInventory) end) end
end
I don't wanna make this function any bigger, dang it!