-- Takes `PILLAR_VARIANT_NAME` as an input parameter. -- We take an 8x8x16 template of a pillar, and generate all 4 states from it. use_script("uniformMaterials.lua"); local variants = { stone = { design = "stone", material = uniform_materials.stone, }, ringwoodite = { design = "stone", material = uniform_materials.ringwoodite, }, basalt = { design = "polishedStone", material = uniform_materials.basalt, }, marble = { design = "polishedStone", material = uniform_materials.marble, }, limestone = { design = "polishedStone", material = uniform_materials.limestone, }, granite = { design = "polishedStone", material = uniform_materials.granite, }, emerald = { design = "polishedStone", material = uniform_materials.emerald, }, }; local variant = variants[PILLAR_VARIANT_NAME]; local templ = vsp_from_assets("templates/pillars/" .. variant.design .. ".vsp"); local states = { pillar = { top = 4, bottom = 4, }, pillarBottomend = { top = 4, bottom = 0, }, pillarTopend = { top = 0, bottom = 4, }, pillarTopendBottomend = { top = 0, bottom = 0, } } for state_name, offsets in pairs(states) do local maps = {}; for key in pairs(variant.material) do maps[key .. "map"] = vsp_new(8, 8, 8); end for x = 0, 7 do for y = 0, 7 do for z = 0, 7 do local voxel; if z < 4 then -- Bottom part voxel = vsp_get_voxel(templ, x, y, z + offsets.bottom); else -- Top part voxel = vsp_get_voxel(templ, x, y, 16 - 8 + z - offsets.top); end if voxel == WHITE then for key, value in pairs(variant.material) do vsp_set_voxel(maps[key .. "map"], x, y, z, value); end end end end end export_frame(state_name, maps); end