119 lines
7.9 KiB
Lua
119 lines
7.9 KiB
Lua
-- decor_flowerpot: модель из Blockbench (decor_flowerpot.bbmodel), собранная из Part.
|
||
-- СГЕНЕРИРОВАНО tools/bbmodel-to-luau.js — руками не править: правьте модель в Blockbench и генерируйте заново.
|
||
-- Возвращает функцию build(parent): Model с подмоделями по группам Blockbench; рыба — в подмоделях Fish.
|
||
-- PrimaryPart — невидимое основание в точке (0, 0, 0) модели (низ по центру), фасад смотрит в −Z.
|
||
|
||
-- { группа, имя, размер X Y Z, центр X Y Z, точка поворота X Y Z, поворот X Y Z (рад, порядок ZYX), цвет R G B }
|
||
local CUBES = {
|
||
{ "Pot", "Tub", 1.029, 0.9, 1.029, 0, 0.45, 0, 0, 0, 0, 0, 0, 0, 160, 104, 62 },
|
||
{ "Pot", "TubR", 1.029, 0.9, 1.029, 0, 0.45, 0, 0, 0, 0, 0, 0.785, 0, 138, 88, 52 },
|
||
{ "Pot", "TubLip", 1.162, 0.1, 1.162, 0, 0.95, 0, 0, 0, 0, 0, 0, 0, 92, 58, 36 },
|
||
{ "Pot", "TubLipR", 1.162, 0.1, 1.162, 0, 0.95, 0, 0, 0, 0, 0, 0.785, 0, 92, 58, 36 },
|
||
{ "Pot", "Band", 1.096, 0.1, 1.096, 0, 0.17, 0, 0, 0, 0, 0, 0, 0, 62, 62, 68 },
|
||
{ "Pot", "BandR", 1.096, 0.1, 1.096, 0, 0.17, 0, 0, 0, 0, 0, 0.785, 0, 62, 62, 68 },
|
||
{ "Pot", "Band", 1.096, 0.1, 1.096, 0, 0.67, 0, 0, 0, 0, 0, 0, 0, 62, 62, 68 },
|
||
{ "Pot", "BandR", 1.096, 0.1, 1.096, 0, 0.67, 0, 0, 0, 0, 0, 0.785, 0, 62, 62, 68 },
|
||
{ "Pot", "Soil", 0.93, 0.05, 0.93, 0, 1, 0, 0, 0, 0, 0, 0, 0, 74, 52, 36 },
|
||
{ "Pot", "SoilR", 0.93, 0.05, 0.93, 0, 1, 0, 0, 0, 0, 0, 0.785, 0, 74, 52, 36 },
|
||
{ "Bush", "Leaves_0", 0.697, 0.75, 0.697, 0, 1.375, 0, 0, 0, 0, 0, 0, 0, 76, 140, 62 },
|
||
{ "Bush", "Leaves_0R", 0.697, 0.75, 0.697, 0, 1.375, 0, 0, 0, 0, 0, 0.785, 0, 56, 110, 48 },
|
||
{ "Bush", "Leaves_1", 0.498, 0.55, 0.498, -0.25, 1.275, -0.2, 0, 0, 0, 0, 0, 0, 56, 110, 48 },
|
||
{ "Bush", "Leaves_1R", 0.498, 0.55, 0.498, -0.25, 1.275, -0.2, -0.25, 0, -0.2, 0, 0.785, 0, 76, 140, 62 },
|
||
{ "Bush", "Leaves_2", 0.498, 0.6, 0.498, 0.25, 1.3, 0.22, 0, 0, 0, 0, 0, 0, 76, 140, 62 },
|
||
{ "Bush", "Leaves_2R", 0.498, 0.6, 0.498, 0.25, 1.3, 0.22, 0.25, 0, 0.22, 0, 0.785, 0, 56, 110, 48 },
|
||
{ "Bush", "Leaves_3", 0.432, 0.45, 0.432, 0.22, 1.225, -0.25, 0, 0, 0, 0, 0, 0, 56, 110, 48 },
|
||
{ "Bush", "Leaves_3R", 0.432, 0.45, 0.432, 0.22, 1.225, -0.25, 0.22, 0, -0.25, 0, 0.785, 0, 76, 140, 62 },
|
||
{ "Bush", "Leaves_4", 0.448, 0.5, 0.448, -0.25, 1.25, 0.25, 0, 0, 0, 0, 0, 0, 76, 140, 62 },
|
||
{ "Bush", "Leaves_4R", 0.448, 0.5, 0.448, -0.25, 1.25, 0.25, -0.25, 0, 0.25, 0, 0.785, 0, 56, 110, 48 },
|
||
{ "Bush", "Stem_0", 0.06, 0.32, 0.06, -0.32, 1.46, -0.32, 0, 0, 0, 0, 0, 0, 56, 110, 48 },
|
||
{ "Bush", "LeafA_0", 0.2, 0.07, 0.08, -0.22, 1.479, -0.32, -0.32, 1.444, -0.32, 0, 0, 0.524, 76, 140, 62 },
|
||
{ "Bush", "LeafB_0", 0.18, 0.07, 0.08, -0.41, 1.599, -0.32, -0.32, 1.564, -0.32, 0, 0, -0.524, 76, 140, 62 },
|
||
{ "Bush", "Bud_0", 0.12, 0.12, 0.12, -0.32, 1.68, -0.32, 0, 0, 0, 0, 0, 0, 242, 202, 76 },
|
||
{ "Bush", "Petal_0", 0.13, 0.11, 0.13, -0.21, 1.665, -0.32, 0, 0, 0, 0, 0, 0, 204, 64, 60 },
|
||
{ "Bush", "Petal_0", 0.13, 0.11, 0.13, -0.43, 1.665, -0.32, 0, 0, 0, 0, 0, 0, 204, 64, 60 },
|
||
{ "Bush", "Petal_0", 0.13, 0.11, 0.13, -0.32, 1.665, -0.21, 0, 0, 0, 0, 0, 0, 204, 64, 60 },
|
||
{ "Bush", "Petal_0", 0.13, 0.11, 0.13, -0.32, 1.665, -0.43, 0, 0, 0, 0, 0, 0, 204, 64, 60 },
|
||
{ "Bush", "Stem_1", 0.06, 0.48, 0.06, 0.1, 1.54, -0.4, 0, 0, 0, 0, 0, 0, 56, 110, 48 },
|
||
{ "Bush", "LeafA_1", 0.2, 0.07, 0.08, 0.2, 1.551, -0.4, 0.1, 1.516, -0.4, 0, 0, 0.524, 76, 140, 62 },
|
||
{ "Bush", "LeafB_1", 0.18, 0.07, 0.08, 0.01, 1.671, -0.4, 0.1, 1.636, -0.4, 0, 0, -0.524, 76, 140, 62 },
|
||
{ "Bush", "Bud_1", 0.12, 0.12, 0.12, 0.1, 1.84, -0.4, 0, 0, 0, 0, 0, 0, 236, 136, 52 },
|
||
{ "Bush", "Petal_1", 0.13, 0.11, 0.13, 0.21, 1.825, -0.4, 0, 0, 0, 0, 0, 0, 242, 202, 76 },
|
||
{ "Bush", "Petal_1", 0.13, 0.11, 0.13, -0.01, 1.825, -0.4, 0, 0, 0, 0, 0, 0, 242, 202, 76 },
|
||
{ "Bush", "Petal_1", 0.13, 0.11, 0.13, 0.1, 1.825, -0.29, 0, 0, 0, 0, 0, 0, 242, 202, 76 },
|
||
{ "Bush", "Petal_1", 0.13, 0.11, 0.13, 0.1, 1.825, -0.51, 0, 0, 0, 0, 0, 0, 242, 202, 76 },
|
||
{ "Bush", "Stem_2", 0.06, 0.36, 0.06, 0.36, 1.48, -0.1, 0, 0, 0, 0, 0, 0, 56, 110, 48 },
|
||
{ "Bush", "LeafA_2", 0.2, 0.07, 0.08, 0.46, 1.497, -0.1, 0.36, 1.462, -0.1, 0, 0, 0.524, 76, 140, 62 },
|
||
{ "Bush", "LeafB_2", 0.18, 0.07, 0.08, 0.27, 1.617, -0.1, 0.36, 1.582, -0.1, 0, 0, -0.524, 76, 140, 62 },
|
||
{ "Bush", "Bud_2", 0.12, 0.12, 0.12, 0.36, 1.72, -0.1, 0, 0, 0, 0, 0, 0, 242, 202, 76 },
|
||
{ "Bush", "Petal_2", 0.13, 0.11, 0.13, 0.47, 1.705, -0.1, 0, 0, 0, 0, 0, 0, 172, 108, 210 },
|
||
{ "Bush", "Petal_2", 0.13, 0.11, 0.13, 0.25, 1.705, -0.1, 0, 0, 0, 0, 0, 0, 172, 108, 210 },
|
||
{ "Bush", "Petal_2", 0.13, 0.11, 0.13, 0.36, 1.705, 0.01, 0, 0, 0, 0, 0, 0, 172, 108, 210 },
|
||
{ "Bush", "Petal_2", 0.13, 0.11, 0.13, 0.36, 1.705, -0.21, 0, 0, 0, 0, 0, 0, 172, 108, 210 },
|
||
{ "Bush", "Stem_3", 0.06, 0.6, 0.06, -0.12, 1.6, 0.12, 0, 0, 0, 0, 0, 0, 56, 110, 48 },
|
||
{ "Bush", "LeafA_3", 0.2, 0.07, 0.08, -0.02, 1.605, 0.12, -0.12, 1.57, 0.12, 0, 0, 0.524, 76, 140, 62 },
|
||
{ "Bush", "LeafB_3", 0.18, 0.07, 0.08, -0.21, 1.725, 0.12, -0.12, 1.69, 0.12, 0, 0, -0.524, 76, 140, 62 },
|
||
{ "Bush", "Bud_3", 0.12, 0.12, 0.12, -0.12, 1.96, 0.12, 0, 0, 0, 0, 0, 0, 242, 202, 76 },
|
||
{ "Bush", "Petal_3", 0.13, 0.11, 0.13, -0.01, 1.945, 0.12, 0, 0, 0, 0, 0, 0, 244, 240, 230 },
|
||
{ "Bush", "Petal_3", 0.13, 0.11, 0.13, -0.23, 1.945, 0.12, 0, 0, 0, 0, 0, 0, 244, 240, 230 },
|
||
{ "Bush", "Petal_3", 0.13, 0.11, 0.13, -0.12, 1.945, 0.23, 0, 0, 0, 0, 0, 0, 244, 240, 230 },
|
||
{ "Bush", "Petal_3", 0.13, 0.11, 0.13, -0.12, 1.945, 0.01, 0, 0, 0, 0, 0, 0, 244, 240, 230 },
|
||
{ "Bush", "Stem_4", 0.06, 0.4, 0.06, 0.3, 1.5, 0.32, 0, 0, 0, 0, 0, 0, 56, 110, 48 },
|
||
{ "Bush", "LeafA_4", 0.2, 0.07, 0.08, 0.4, 1.515, 0.32, 0.3, 1.48, 0.32, 0, 0, 0.524, 76, 140, 62 },
|
||
{ "Bush", "LeafB_4", 0.18, 0.07, 0.08, 0.21, 1.635, 0.32, 0.3, 1.6, 0.32, 0, 0, -0.524, 76, 140, 62 },
|
||
{ "Bush", "Bud_4", 0.12, 0.12, 0.12, 0.3, 1.76, 0.32, 0, 0, 0, 0, 0, 0, 242, 202, 76 },
|
||
{ "Bush", "Petal_4", 0.13, 0.11, 0.13, 0.41, 1.745, 0.32, 0, 0, 0, 0, 0, 0, 204, 64, 60 },
|
||
{ "Bush", "Petal_4", 0.13, 0.11, 0.13, 0.19, 1.745, 0.32, 0, 0, 0, 0, 0, 0, 204, 64, 60 },
|
||
{ "Bush", "Petal_4", 0.13, 0.11, 0.13, 0.3, 1.745, 0.43, 0, 0, 0, 0, 0, 0, 204, 64, 60 },
|
||
{ "Bush", "Petal_4", 0.13, 0.11, 0.13, 0.3, 1.745, 0.21, 0, 0, 0, 0, 0, 0, 204, 64, 60 },
|
||
}
|
||
|
||
return function(parent)
|
||
local model = Instance.new("Model")
|
||
model.Name = "decor_flowerpot"
|
||
local base = Instance.new("Part")
|
||
base.Name = "Base"
|
||
base.Size = Vector3.new(1, 0.1, 1)
|
||
base.CFrame = CFrame.new(0, 0.05, 0)
|
||
base.Transparency = 1
|
||
base.Anchored = true
|
||
base.CanCollide = false
|
||
base.CanQuery = false
|
||
base.CanTouch = false
|
||
base.Parent = model
|
||
model.PrimaryPart = base
|
||
local groups = {}
|
||
local function sub(name, parentModel)
|
||
local key = (parentModel and parentModel.Name .. "/" or "") .. name
|
||
if not groups[key] then
|
||
local g = Instance.new("Model")
|
||
g.Name = name
|
||
g.Parent = parentModel or model
|
||
groups[key] = g
|
||
end
|
||
return groups[key]
|
||
end
|
||
for _, c in ipairs(CUBES) do
|
||
local g = sub(c[1])
|
||
if c[2]:find("Fish") or c[1]:find("Fish") then
|
||
g = sub("Fish", g)
|
||
end
|
||
local rot = CFrame.Angles(0, 0, c[14]) * CFrame.Angles(0, c[13], 0) * CFrame.Angles(c[12], 0, 0)
|
||
local origin = Vector3.new(c[9], c[10], c[11])
|
||
local center = Vector3.new(c[6], c[7], c[8])
|
||
local p = Instance.new("Part")
|
||
p.Name = c[2]
|
||
p.Anchored = true
|
||
p.Size = Vector3.new(c[3], c[4], c[5])
|
||
p.CFrame = CFrame.new(origin) * rot * CFrame.new(center - origin)
|
||
p.Color = Color3.fromRGB(c[15], c[16], c[17])
|
||
p.Material = c[2]:find("Glow") and Enum.Material.Neon or Enum.Material.SmoothPlastic
|
||
p.TopSurface, p.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth
|
||
-- мелкие и висящие детали не мешают ходить
|
||
p.CanCollide = math.min(p.Size.X, p.Size.Y, p.Size.Z) >= 0.3 and math.max(p.Size.X, p.Size.Y, p.Size.Z) >= 1
|
||
p.CastShadow = p.Size.Magnitude > 0.6
|
||
p.Parent = g
|
||
end
|
||
model.Parent = parent
|
||
return model
|
||
end
|