3D-рыбы, диковинки, экономика v3
This commit is contained in:
1 parent
087e9b0d9b
commit
3ad192d26e
161 files changed
+567804
-1184
No files matched your search
@@ -0,0 +1,70 @@
|
||||
-- Шаблоны рыб в ReplicatedStorage.FishModels (собирается tools/build-fish-models.js, запуск в Edit).
|
||||
-- Модель = id рыбы. Нос смотрит в +X (как у прежних рыб из шаров), центр тела — в начале координат.
|
||||
-- PrimaryPart «Root» — невидимый центр тела; группы Body / Tail / Fins / Eye (и Glow, если есть) сварены с ним,
|
||||
-- всё Anchored = false: GameModels.buildFish клонирует, масштабирует и ставит Anchored сам.
|
||||
local RS = game:GetService("ReplicatedStorage")
|
||||
local folder = RS:FindFirstChild("FishModels") or Instance.new("Folder")
|
||||
folder.Name = "FishModels"
|
||||
folder.Parent = RS
|
||||
local made = {}
|
||||
for id, build in pairs(BUILD) do
|
||||
local old = folder:FindFirstChild(id)
|
||||
if old then
|
||||
old:Destroy()
|
||||
end
|
||||
local m = build(workspace)
|
||||
m.Name = id
|
||||
-- нос из −Z в +X (поворот вокруг основания); центр тела Root — с нулевым поворотом,
|
||||
-- иначе buildFish (PivotTo(CFrame.new())) повернул бы рыбу обратно
|
||||
m:PivotTo(CFrame.Angles(0, -math.pi / 2, 0))
|
||||
local base = m.PrimaryPart
|
||||
local body = m:FindFirstChild("Body", true)
|
||||
local cf = (body and body:IsA("Model")) and body:GetBoundingBox() or m:GetBoundingBox()
|
||||
local root = Instance.new("Part")
|
||||
root.Name = "Root"
|
||||
root.Size = Vector3.new(0.2, 0.2, 0.2)
|
||||
root.Transparency = 1
|
||||
root.CanCollide, root.CanQuery, root.CanTouch, root.Massless = false, false, false, true
|
||||
root.CFrame = CFrame.new(cf.Position)
|
||||
root.Parent = m
|
||||
m.PrimaryPart = root
|
||||
if base then
|
||||
base:Destroy()
|
||||
end
|
||||
m:PivotTo(CFrame.new())
|
||||
for _, p in ipairs(m:GetDescendants()) do
|
||||
if p:IsA("BasePart") then
|
||||
p.CanCollide, p.CanQuery, p.CanTouch, p.CastShadow = false, false, false, false
|
||||
p.Massless = true
|
||||
if p ~= root then
|
||||
local w = Instance.new("WeldConstraint")
|
||||
w.Part0, w.Part1 = root, p
|
||||
w.Parent = p
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, p in ipairs(m:GetDescendants()) do
|
||||
if p:IsA("BasePart") then
|
||||
p.Anchored = false
|
||||
end
|
||||
end
|
||||
-- особые материалы (buildFish их не трогает): Glow — неон, лёд и бутылка — стекло, призрак — полупрозрачный
|
||||
for _, p in ipairs(m:GetDescendants()) do
|
||||
if p:IsA("BasePart") and p ~= root then
|
||||
local g = p.Parent.Name
|
||||
if g == "Glow" then
|
||||
p.Material = Enum.Material.Neon
|
||||
elseif (id == "FrozenCube" and g == "Ice") or (id == "BottleFish" and g == "Bottle") then
|
||||
p.Material = Enum.Material.Glass
|
||||
p.Transparency = 0.6
|
||||
elseif id == "Ghost" and (g == "Body" or g == "Fins" or g == "Tail") then
|
||||
p.Transparency = 0.4
|
||||
end
|
||||
end
|
||||
end
|
||||
m:SetAttribute("Length", m:GetExtentsSize().X)
|
||||
m.Parent = folder
|
||||
table.insert(made, id)
|
||||
end
|
||||
table.sort(made)
|
||||
return ("FishModels: %d (%s)"):format(#made, table.concat(made, ", "))
|
||||
Reference in new issue
Block a user