Files
2026-11-09 22:37:44 +05:00

78 lines
4.2 KiB
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- fish_koi: модель из Blockbench (fish_koi.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 = {
{ "Body", "Fish_Snout", 0.16, 0.16, 0.128, 0, 0, -0.736, 0, 0, 0, 0, 0, 0, 246, 244, 238 },
{ "Body", "Fish_Head", 0.224, 0.384, 0.288, 0, 0, -0.528, 0, 0, 0, 0, 0, 0, 246, 244, 238 },
{ "Body", "Fish_Body", 0.256, 0.512, 0.576, 0, 0, -0.096, 0, 0, 0, 0, 0, 0, 246, 244, 238 },
{ "Body", "Fish_Belly", 0.272, 0.16, 0.576, 0, -0.192, -0.16, 0, 0, 0, 0, 0, 0, 246, 244, 238 },
{ "Body", "Fish_Rear", 0.208, 0.32, 0.288, 0, 0, 0.336, 0, 0, 0, 0, 0, 0, 246, 244, 238 },
{ "Body", "Fish_Stalk", 0.144, 0.144, 0.128, 0, 0, 0.544, 0, 0, 0, 0, 0, 0, 246, 244, 238 },
{ "Body", "Fish_Dorsal", 0.096, 0.16, 0.352, 0, 0.304, -0.048, 0, 0, 0, 0, 0, 0, 250, 220, 200 },
{ "Body", "Fish_Gill", 0.272, 0.352, 0.05, 0, 0, -0.376, 0, 0, 0, 0, 0, 0, 250, 220, 200 },
{ "Tail", "Fish_TailA", 0.096, 0.144, 0.416, 0, 0, 0.784, 0, 0, 0.592, 0.611, 0, 0, 250, 220, 200 },
{ "Tail", "Fish_TailB", 0.096, 0.144, 0.416, 0, 0, 0.784, 0, 0, 0.592, -0.611, 0, 0, 250, 220, 200 },
{ "Body", "Fish_Eye", 0.05, 0.08, 0.08, 0.12, 0.072, -0.576, 0, 0, 0, 0, 0, 0, 24, 24, 30 },
{ "Body", "Fish_Eye", 0.05, 0.08, 0.08, -0.12, 0.072, -0.576, 0, 0, 0, 0, 0, 0, 24, 24, 30 },
{ "Body", "Fish_PatchA", 0.05, 0.208, 0.32, -0.13, 0.104, -0.352, 0, 0, 0, 0, 0, 0, 240, 104, 40 },
{ "Body", "Fish_PatchB", 0.05, 0.208, 0.288, -0.12, 0.072, 0.176, 0, 0, 0, 0, 0, 0, 240, 104, 40 },
{ "Body", "Fish_Spot", 0.05, 0.08, 0.08, -0.13, 0.12, -0.088, 0, 0, 0, 0, 0, 0, 24, 24, 30 },
{ "Body", "Fish_PatchA", 0.05, 0.208, 0.32, 0.13, 0.104, -0.352, 0, 0, 0, 0, 0, 0, 240, 104, 40 },
{ "Body", "Fish_PatchB", 0.05, 0.208, 0.288, 0.12, 0.072, 0.176, 0, 0, 0, 0, 0, 0, 240, 104, 40 },
{ "Body", "Fish_Spot", 0.05, 0.08, 0.08, 0.13, 0.12, -0.088, 0, 0, 0, 0, 0, 0, 24, 24, 30 },
{ "Body", "Fish_HeadPatch", 0.192, 0.05, 0.224, 0, 0.188, -0.528, 0, 0, 0, 0, 0, 0, 240, 104, 40 },
}
return function(parent)
local model = Instance.new("Model")
model.Name = "fish_koi"
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