Module:Inventory slot/Aliases: Difference between revisions

No edit summary
Fix copper stuff
Line 395: Line 395:
['Candle'] = { 'Candle', 'White Candle', 'Light Gray Candle', 'Gray Candle', 'Black Candle', 'Brown Candle', 'Red Candle', 'Orange Candle', 'Yellow Candle',
['Candle'] = { 'Candle', 'White Candle', 'Light Gray Candle', 'Gray Candle', 'Black Candle', 'Brown Candle', 'Red Candle', 'Orange Candle', 'Yellow Candle',
'Lime Candle', 'Green Candle', 'Cyan Candle', 'Light Blue Candle', 'Blue Candle', 'Purple Candle', 'Magenta Candle', 'Pink Candle',  },
'Lime Candle', 'Green Candle', 'Cyan Candle', 'Light Blue Candle', 'Blue Candle', 'Purple Candle', 'Magenta Candle', 'Pink Candle',  },
['Copper Block'] = { 'Copper Block', 'Exposed Copper Block', 'Weathered Copper Block', 'Oxidized Copper Block', 'Waxed Copper Block', 'Waxed Exposed Copper Block', 'Waxed Weathered Copper Block' },
['Cut Copper'] = { 'Cut Copper', 'Exposed Cut Copper', 'Weathered Cut Copper', 'Oxidized Cut Copper', 'Waxed Cut Copper', 'Waxed Exposed Cut Copper', 'Waxed Weathered Cut Copper' },
['Cut Copper Stairs'] = { 'Cut Copper Stairs', 'Exposed Cut Copper Stairs', 'Weathered Cut Copper Stairs', 'Oxidized Cut Copper Stairs', 'Waxed Cut Copper Stairs',
'Waxed Exposed Cut Copper Stairs', 'Waxed Weathered Cut Copper Stairs' },
['Cut Copper Slab'] = { 'Cut Copper Slab', 'Exposed Cut Copper Slab', 'Weathered Cut Copper Slab', 'Oxidized Cut Copper Slab', 'Waxed Cut Copper Slab', 'Waxed Exposed Cut Copper Slab',
'Waxed Weathered Cut Copper Slab' },
}
}
table.insert( itemVariants['Dye'], 1, 'White Dye' )
table.insert( itemVariants['Dye'], 1, 'White Dye' )
for aliasName, aliasItems in pairs( itemVariants ) do
aliases['Any ' .. aliasName] = aliasItems
aliases['Matching ' .. aliasName] = aliasItems
end
-- Copper --
-- Copper --
local copperstuff = {
local copperstuff = {
['Matching (Weathered) Copper Block'] = {'Copper Block', 'Lightly Weathered Copper Block', 'Semi-Weathered Copper Block', 'Weathered Copper BlocK'},
'Block of Copper',
['Matching (Weathered) Cut Copper'] = {'Cut Copper', 'Lightly Weathered Cut Copper', 'Semi-Weathered Cut Copper', 'Weathered Cut Copper'},
'Cut Copper',
['Matching Waxed (Weathered) Copper Block'] = {'Waxed Copper Block', 'Waxed Lightly Weathered Copper Block', 'Waxed Semi-Weathered Copper Block'},
'Cut Copper Stairs',
['Matching Waxed (Weathered) Cut Copper'] = {'Waxed Cut Copper', 'Waxed Lightly Weathered Cut Copper', 'Waxed Semi-Weathered Cut Copper'},
'Cut Copper Slab',
'Chiseled Copper',
'Copper Grate',
'Copper Bulb',
'Copper Door',
'Copper Trapdoor',
}
}
local function map(tbl, f)
local coppervariants = { '', 'Exposed ', 'Weathered ', 'Oxidized ' }
    local t = {}
for _, copper in ipairs( copperstuff ) do
    for k,v in pairs(tbl) do
itemVariants['Unwaxed ' .. copper] = {}
        t[k] = f(v)
itemVariants['Waxed ' .. copper] = {}
    end
for _, coppervariant in ipairs( coppervariants ) do
    return t
local name = coppervariant .. copper
if copper == 'Block of Copper' and coppervariant ~= '' then
name = coppervariant .. 'Copper'
end
table.insert( itemVariants['Unwaxed ' .. copper], name )
table.insert( itemVariants['Waxed ' .. copper], 'Waxed ' .. name )
end
itemVariants[copper] = {}
for _, copperitem in ipairs( itemVariants['Unwaxed ' .. copper] ) do
table.insert( itemVariants[copper], copperitem )
end
for _, copperitem in ipairs( itemVariants['Waxed ' .. copper] ) do
table.insert( itemVariants[copper], copperitem )
end
end
end
for k, v in pairs(copperstuff) do
 
aliases[k] = v
for aliasName, aliasItems in pairs( itemVariants ) do
local k1 = k:gsub(' Block$', '')
aliases['Any ' .. aliasName] = aliasItems
local v1 = map(v, function(s) return s:gsub(' Block$', '') end)
aliases['Matching ' .. aliasName] = aliasItems
aliases[k1 .. 'Slab'] = map(v1, function(s) return s .. 'Slab' end)
aliases[k1 .. 'Stairs'] = map(v1, function(s) return s .. 'Stairs' end)
end
end