i3/etc/compress.lua

228 lines
4.3 KiB
Lua
Raw Normal View History

2021-06-25 03:44:38 +02:00
local fmt, insert = string.format, table.insert
local wood_types = {
"acacia_wood", "aspen_wood", "junglewood", "pine_wood",
}
local material_tools = {
"bronze", "diamond", "mese", "stone", "wood",
}
local material_stairs = {
"acacia_wood", "aspen_wood", "brick", "bronzeblock", "cobble", "copperblock",
"desert_cobble", "desert_sandstone", "desert_sandstone_block", "desert_sandstone_brick",
"desert_stone", "desert_stone_block", "desert_stonebrick",
"glass", "goldblock", "ice", "junglewood", "mossycobble", "obsidian",
"obsidian_block", "obsidian_glass", "obsidianbrick", "pine_wood",
"sandstone", "sandstone_block", "sandstonebrick",
"silver_sandstone", "silver_sandstone_block", "silver_sandstone_brick",
"snowblock", "steelblock", "stone", "stone_block", "stonebrick",
"straw", "tinblock",
}
local colors = {
"black", "blue", "brown", "cyan", "dark_green", "dark_grey", "green",
"grey", "magenta", "orange", "pink", "red", "violet", "yellow",
}
local to_compress = {
["bucket:bucket_empty"] = {
replace = "empty",
by = {"lava", "river_water", "water"}
},
2021-06-25 17:20:15 +02:00
["butterflies:butterfly_white"] = {
replace = "white",
by = {"red", "violet"}
},
2021-06-25 03:44:38 +02:00
["default:wood"] = {
replace = "wood",
by = wood_types,
},
2021-06-25 17:20:15 +02:00
["default:tree"] = {
replace = "tree",
by = {"acacia_tree", "aspen_tree", "jungletree", "pine_tree"},
},
["default:grass_1"] = {
replace = "grass_1",
by = {"dry_grass_1", "junglegrass", "marram_grass_1", "fern_1"},
},
["carts:rail"] = {
replace = "rail",
by = {"brakerail", "powerrail"},
},
2021-06-25 03:44:38 +02:00
["default:sapling"] = {
replace = "sapling",
by = {
"acacia_bush_sapling",
"acacia_sapling",
"aspen_sapling",
"blueberry_bush_sapling",
"bush_sapling",
"emergent_jungle_sapling",
"junglesapling",
"pine_bush_sapling",
"pine_sapling"
}
},
["default:gold_lump"] = {
replace = "gold",
by = {"clay", "coal", "copper", "iron", "tin"}
},
2021-06-25 17:20:15 +02:00
["default:gold_ingot"] = {
replace = "gold_ingot",
by = {"bronze_ingot", "copper_ingot", "steel_ingot", "tin_ingot", "clay_brick"}
},
2021-06-25 03:44:38 +02:00
["default:leaves"] = {
replace = "leaves",
by = {
"acacia_bush_leaves",
"acacia_leaves",
"aspen_leaves",
"blueberry_bush_leaves",
"blueberry_bush_leaves_with_berries",
"bush_leaves",
"jungleleaves",
2021-06-25 17:20:15 +02:00
"pine_bush_needles",
"pine_needles",
2021-06-25 03:44:38 +02:00
},
},
["default:stone_with_diamond"] = {
replace = "diamond",
by = {"coal", "copper", "gold", "iron", "mese", "tin"},
},
["default:fence_wood"] = {
replace = "wood",
by = wood_types,
},
["default:fence_rail_wood"] = {
replace = "wood",
by = wood_types,
},
["default:mese_post_light"] = {
replace = "mese_post_light",
by = {
"mese_post_light_acacia",
"mese_post_light_aspen_wood",
"mese_post_light_junglewood",
"mese_post_light_pine_wood",
}
},
["doors:gate_wood_closed"] = {
replace = "wood",
by = wood_types,
},
["doors:door_wood"] = {
replace = "wood",
by = {"glass", "obsidian_glass", "steel"}
},
["flowers:geranium"] = {
replace = "geranium",
by = {
"chrysanthemum_green",
"dandelion_white",
"dandelion_yellow",
"rose",
"tulip",
"tulip_black",
"viola",
}
},
["wool:white"] = {
replace = "white",
by = colors
},
["dye:white"] = {
replace = "white",
by = colors
},
["default:axe_steel"] = {
replace = "steel",
by = material_tools
},
["default:pick_steel"] = {
replace = "steel",
by = material_tools
},
["default:shovel_steel"] = {
replace = "steel",
by = material_tools
},
["default:sword_steel"] = {
replace = "steel",
by = material_tools
},
2021-06-25 17:20:15 +02:00
["farming:hoe_steel"] = {
replace = "steel",
by = {"wood", "stone"}
},
2021-06-25 03:44:38 +02:00
["stairs:slab_wood"] = {
replace = "wood",
by = material_stairs
},
["stairs:stair_wood"] = {
replace = "wood",
by = material_stairs
},
["stairs:stair_inner_wood"] = {
replace = "wood",
by = material_stairs
},
["stairs:stair_outer_wood"] = {
replace = "wood",
by = material_stairs
},
2021-06-25 17:20:15 +02:00
["walls:cobble"] = {
replace = "cobble",
by = {"desertcobble", "mossycobble"}
},
2021-06-25 03:44:38 +02:00
}
local compressed = {}
for k, v in pairs(to_compress) do
compressed[k] = compressed[k] or {}
2021-06-25 17:20:15 +02:00
for _, str in ipairs(v.by) do
local it = k:gsub(v.replace, str)
2021-06-25 03:44:38 +02:00
insert(compressed[k], it)
end
end
local _compressed = {}
for _, v in pairs(compressed) do
for _, v2 in ipairs(v) do
_compressed[v2] = true
end
end
return compressed, _compressed