Made restrictive mat filter work properly

Yeah, not sure what the heck I was doing there before.
develop
Putnam3145 2014-12-07 21:04:39 -08:00
parent 10fa55570e
commit 17772954cc
1 changed files with 11 additions and 5 deletions

@ -71,7 +71,7 @@ function getMatFilter(itemtype)
end end
function getRestrictiveMatFilter(itemType) function getRestrictiveMatFilter(itemType)
if not args.veryRestrictive then return nil else if not args.restrictive then return nil end
local itemTypes={ local itemTypes={
WEAPON=function(mat,parent,typ,idx) WEAPON=function(mat,parent,typ,idx)
return (mat.flags.ITEMS_WEAPON or mat.flags.ITEMS_WEAPON_RANGED) return (mat.flags.ITEMS_WEAPON or mat.flags.ITEMS_WEAPON_RANGED)
@ -82,15 +82,12 @@ function getRestrictiveMatFilter(itemType)
ARMOR=function(mat,parent,typ,idx) ARMOR=function(mat,parent,typ,idx)
return (mat.flags.ITEMS_ARMOR) return (mat.flags.ITEMS_ARMOR)
end, end,
SHOES,SHIELD,HELM,GLOVES=ARMOR,ARMOR,ARMOR,ARMOR,
INSTRUMENT=function(mat,parent,typ,idx) INSTRUMENT=function(mat,parent,typ,idx)
return (mat.flags.ITEMS_HARD) return (mat.flags.ITEMS_HARD)
end, end,
GOBLET,FLASK,TOY,RING,CROWN,SCEPTER,FIGURINE,TOOL=INSTRUMENT,INSTRUMENT,INSTRUMENT,INSTRUMENT,INSTRUMENT,INSTRUMENT,INSTRUMENT,
AMULET=function(mat,parent,typ,idx) AMULET=function(mat,parent,typ,idx)
return (mat.flags.ITEMS_SOFT or mat.flags.ITEMS_HARD) return (mat.flags.ITEMS_SOFT or mat.flags.ITEMS_HARD)
end, end,
EARRING,BRACELET=AMULET,AMULET,
ROCK=function(mat,parent,typ,idx) ROCK=function(mat,parent,typ,idx)
return (mat.flags.IS_STONE) return (mat.flags.IS_STONE)
end, end,
@ -100,8 +97,17 @@ function getRestrictiveMatFilter(itemType)
end end
} }
return itemTypes[df.item_type[itemType]] for k,v in ipairs({'GOBLET','FLASK','TOY','RING','CROWN','SCEPTER','FIGURINE','TOOL'}) do
itemTypes[v]=itemTypes.INSTRUMENT
end
for k,v in ipairs({'SHOES','SHIELD','HELM','GLOVES'}) do
itemTypes[v]=itemTypes.ARMOR
end end
for k,v in ipairs({'EARRING','BRACELET'}) do
itemTypes[v]=itemTypes.AMULET
end
itemTypes.BOULDER=itemTypes.ROCK
return itemTypes[df.item_type[itemType]]
end end
function createItem(mat,itemType,quality,creator,description) function createItem(mat,itemType,quality,creator,description)