Files
Fishing/install/2_GameModels_ReplicatedStorage.rbxmx
T
2026-11-04 22:37:21 +03:00

563 lines
25 KiB
Plaintext
Raw 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.
<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">
<Item class="ModuleScript" referent="RBX1"><Properties><string name="Name">GameModels</string><ProtectedString name="Source"><![CDATA[-- GameModels (ModuleScript) -> ReplicatedStorage
-- Строит 3D-модели из деталей: удочки, сумки, рыбу, поплавок.
-- Используется сервером (инструмент, витрины, рыба в руках) и клиентом (иконки).
local Config = require(script.Parent:WaitForChild("FishConfig"))
local M = {}
local V = Vector3.new
local SP, NEON, METAL, GLASS = Enum.Material.SmoothPlastic, Enum.Material.Neon, Enum.Material.Metal, Enum.Material.Glass
---------------------------------------------------------------- помощники
local function newPart(parent, props, class)
local p = Instance.new(class or "Part")
if props.Shape then
p.Shape = props.Shape
end
p.Anchored = false
p.CanCollide = false
p.CanQuery = false
p.CanTouch = false
p.Massless = true
p.TopSurface = Enum.SurfaceType.Smooth
p.BottomSurface = Enum.SurfaceType.Smooth
p.Material = SP
for k, v in pairs(props) do
if k ~= "Shape" then
p[k] = v
end
end
p.Parent = parent
return p
end
local function cyl(parent, a, b, dia, props)
props = props or {}
props.Shape = Enum.PartType.Cylinder
props.Size = V(math.max(0.02, (b - a).Magnitude), dia, dia)
props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0)
return newPart(parent, props)
end
local function ball(parent, pos, dia, props)
props = props or {}
props.Shape = Enum.PartType.Ball
props.Size = V(dia, dia, dia)
props.CFrame = CFrame.new(pos)
return newPart(parent, props)
end
local function oval(parent, size, cf, props)
props = props or {}
props.Size = size
props.CFrame = cf
local p = newPart(parent, props)
local mesh = Instance.new("SpecialMesh")
mesh.MeshType = Enum.MeshType.Sphere
mesh.Parent = p
return p
end
local function block(parent, size, cf, props)
props = props or {}
props.Size = size
props.CFrame = cf
return newPart(parent, props)
end
local function wedge(parent, size, cf, props)
props = props or {}
props.Size = size
props.CFrame = cf
return newPart(parent, props, "WedgePart")
end
local function finish(model, root, anchored)
for _, p in ipairs(model:GetDescendants()) do
if p:IsA("BasePart") and p ~= root then
local w = Instance.new("Weld")
w.Part0 = root
w.Part1 = p
w.C0 = root.CFrame:Inverse() * p.CFrame
w.Parent = p
p.Anchored = anchored and true or false
end
end
root.Anchored = anchored and true or false
model.PrimaryPart = root
return model
end
local function lighten(c, t)
return c:Lerp(Color3.new(1, 1, 1), t)
end
local function darken(c, t)
return c:Lerp(Color3.new(0, 0, 0), t)
end
local function C(r, g, b)
return Color3.fromRGB(r, g, b)
end
local function sparkles(parent, color, rate)
local att = Instance.new("Attachment")
att.Parent = parent
local pe = Instance.new("ParticleEmitter")
pe.Texture = "rbxasset://textures/particles/sparkles_main.dds"
pe.Rate = rate or 6
pe.Lifetime = NumberRange.new(0.6, 1.0)
pe.Speed = NumberRange.new(0.5, 1)
pe.Size = NumberSequence.new(0.25, 0)
pe.LightEmission = 1
pe.Color = ColorSequence.new(color)
pe.Parent = att
return pe
end
---------------------------------------------------------------- удочки
-- Рука в (0,0,0), удочка смотрит в -Z почти прямо, кончик слегка провисает вниз (-Y).
local STYLES = {
wood = { blank = C(125, 90, 60), mat = Enum.Material.Wood, grip = C(80, 55, 35), gripMat = Enum.Material.Fabric, wrap = C(175, 175, 175), reel = C(95, 95, 100) },
bamboo = { blank = C(215, 190, 105), mat = Enum.Material.Wood, grip = C(120, 90, 50), gripMat = Enum.Material.Fabric, wrap = C(70, 120, 60), reel = C(85, 85, 90), nodes = C(150, 120, 60) },
glass = { blank = C(60, 130, 215), mat = SP, grip = C(35, 35, 40), gripMat = Enum.Material.Fabric, wrap = C(240, 240, 245), reel = C(60, 60, 70) },
carbon = { blank = C(30, 30, 35), mat = SP, grip = C(195, 155, 105), gripMat = Enum.Material.Sand, wrap = C(220, 50, 50), reel = C(45, 45, 50) },
coral = { blank = C(255, 130, 110), blank2 = C(255, 225, 210), mat = SP, grip = C(40, 170, 170), gripMat = Enum.Material.Fabric, wrap = C(40, 200, 200), reel = C(240, 240, 235), gem = C(255, 120, 160) },
gold = { blank = C(255, 200, 50), mat = METAL, grip = C(120, 30, 30), gripMat = Enum.Material.Fabric, wrap = C(255, 255, 255), reel = C(230, 180, 50), gem = C(255, 40, 60), sparkle = C(255, 220, 90) },
frost = { blank = C(170, 225, 255), mat = GLASS, grip = C(230, 240, 250), gripMat = Enum.Material.Fabric, wrap = C(90, 170, 255), reel = C(200, 230, 250), gem = C(120, 240, 255), sparkle = C(170, 240, 255) },
legend = { blank = C(60, 25, 90), blank2 = C(110, 50, 170), mat = SP, grip = C(25, 20, 35), gripMat = Enum.Material.Fabric, wrap = C(255, 200, 60), wrapNeon = true, reel = C(40, 30, 60), gem = C(255, 90, 220), sparkle = C(255, 150, 240) },
}
function M.buildRod(rodId, upgradeLevel, anchored)
local rod = Config.Find(Config.Rods, rodId) or Config.Rods[1]
local st = STYLES[rod.style] or STYLES.wood
upgradeLevel = upgradeLevel or 0
local model = Instance.new("Model")
model.Name = rod.name
local handle = newPart(model, { Name = "Handle", Size = V(0.3, 0.3, 1.8), CFrame = CFrame.new(), Transparency = 1 })
local wrapMat = (st.wrapNeon or upgradeLevel >= 5) and NEON or METAL
local back = V(0, 0, 1)
-- торец и камень
ball(model, V(0, 0, 1.05), 0.42, { Color = st.reel, Material = METAL })
if st.gem then
ball(model, V(0, 0, 1.25), 0.26, { Color = st.gem, Material = NEON })
end
-- задняя рукоять: кольца (пробка/обмотка)
for i = 0, 6 do
local z0 = 1.0 - i * 0.185
cyl(model, V(0, 0, z0), V(0, 0, z0 - 0.185), i % 2 == 0 and 0.34 or 0.33, {
Color = i % 2 == 0 and st.grip or darken(st.grip, 0.12), Material = st.gripMat,
})
end
-- катушкодержатель
cyl(model, V(0, 0, -0.3), V(0, 0, -0.95), 0.27, { Color = st.reel, Material = METAL })
cyl(model, V(0, 0, -0.3), V(0, 0, -0.42), 0.32, { Color = st.wrap, Material = wrapMat })
cyl(model, V(0, 0, -0.83), V(0, 0, -0.95), 0.32, { Color = st.wrap, Material = wrapMat })
-- передняя рукоять
cyl(model, V(0, 0, -0.95), V(0, 0, -1.45), 0.29, { Color = st.grip, Material = st.gripMat })
cyl(model, V(0, 0, -1.45), V(0, 0, -1.55), 0.25, { Color = st.wrap, Material = wrapMat })
-- катушка (безынерционная): ножка, корпус, шпуля, дужка, ручка
block(model, V(0.1, 0.42, 0.22), CFrame.new(0, -0.3, -0.62), { Color = st.reel, Material = METAL })
oval(model, V(0.46, 0.5, 0.7), CFrame.new(0, -0.68, -0.58), { Color = st.reel, Material = METAL })
local spoolCF = CFrame.new(0, -0.68, -1.02) * CFrame.Angles(0, math.rad(90), 0)
newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(0.34, 0.44, 0.44), CFrame = spoolCF, Color = C(235, 235, 230), Material = SP })
newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(0.06, 0.5, 0.5), CFrame = spoolCF * CFrame.new(0.18, 0, 0), Color = st.wrap, Material = wrapMat })
local bail = {}
for i = 0, 6 do
local a = math.rad(200 + i * 23)
table.insert(bail, V(math.cos(a) * 0.3, -0.68 + math.sin(a) * 0.3, -1.2))
end
for i = 1, #bail - 1 do
cyl(model, bail[i], bail[i + 1], 0.04, { Color = C(200, 200, 205), Material = METAL })
end
cyl(model, V(0.24, -0.68, -0.58), V(0.5, -0.86, -0.58), 0.07, { Color = st.reel, Material = METAL })
ball(model, V(0.54, -0.9, -0.5), 0.19, { Color = st.grip, Material = SP })
-- бланк: 8 колен, почти прямой, к кончику плавно провисает; шары на стыках
local angles = { 0, -1, -2, -3, -5, -7, -9, -12 }
local lengths = { 1.2, 1.15, 1.1, 1.0, 0.95, 0.9, 0.85, 0.8 }
local p = V(0, 0, -1.55)
local lastSeg
for i = 1, #angles do
local a = math.rad(angles[i])
local d = V(0, math.sin(a), -math.cos(a))
local q = p + d * lengths[i]
local dia = 0.2 - (i - 1) * 0.019
local color = (st.blank2 and i % 2 == 0) and st.blank2 or st.blank
lastSeg = cyl(model, p, q, dia, { Color = color, Material = st.mat })
ball(model, q, dia * 0.97, { Color = color, Material = st.mat })
if st.nodes then
cyl(model, q - d * 0.04, q + d * 0.04, dia + 0.05, { Color = st.nodes, Material = Enum.Material.Wood })
end
-- полоски улучшений на первых коленах
if i <= 2 then
for s = 1, upgradeLevel do
if (s <= 3 and i == 1) or (s > 3 and i == 2) then
local t = 0.25 + ((s - 1) % 3) * 0.22
local c = p:Lerp(q, t)
cyl(model, c - d * 0.035, c + d * 0.035, dia + 0.045, { Color = C(255, 215, 80), Material = NEON })
end
end
end
-- пропускные кольца на чётных стыках
if i % 2 == 0 then
local n = V(0, d.Z, -d.Y) -- вниз, перпендикулярно бланку
local ringD = 0.24 - i * 0.017
cyl(model, q - d * 0.06, q + d * 0.06, dia + 0.05, { Color = st.wrap, Material = wrapMat })
cyl(model, q, q + n * 0.12, 0.035, { Color = C(200, 200, 205), Material = METAL })
local c = q + n * (0.12 + ringD / 2)
newPart(model, {
Shape = Enum.PartType.Cylinder, Size = V(0.03, ringD, ringD),
CFrame = CFrame.lookAt(c, c + d) * CFrame.Angles(0, math.rad(90), 0),
Color = C(205, 205, 210), Material = METAL,
})
end
p = q
end
ball(model, p, 0.09, { Color = st.wrap, Material = wrapMat })
local tip = Instance.new("Attachment")
tip.Name = "Tip"
tip.Position = p
tip.Parent = handle
local lineStart = Instance.new("Attachment")
lineStart.Name = "LineStart"
lineStart.Position = V(0, -0.68, -1.2)
lineStart.Parent = handle
local line = Instance.new("Beam")
line.Attachment0 = lineStart
line.Attachment1 = tip
line.Width0 = 0.025
line.Width1 = 0.02
line.FaceCamera = true
line.Color = ColorSequence.new(C(245, 245, 245))
line.Parent = handle
if upgradeLevel >= 3 or st.sparkle then
sparkles(lastSeg, st.sparkle or st.wrap, 6)
end
return finish(model, handle, anchored)
end
---------------------------------------------------------------- сумки на спину
-- Корень "Root" у спины; +Z = от спины назад.
local BAG_SIZES = {
Pouch = V(1.3, 1.3, 0.6),
Satchel = V(1.5, 1.5, 0.7),
Backpack = V(1.7, 2.0, 0.9),
BigNet = V(1.9, 2.2, 1.0),
Chest = V(2.0, 1.6, 1.2),
Magic = V(1.8, 2.2, 1.1),
}
function M.buildBag(bagId, anchored)
local bag = Config.Find(Config.Bags, bagId) or Config.Bags[1]
local s = BAG_SIZES[bag.id] or BAG_SIZES.Pouch
local model = Instance.new("Model")
model.Name = "BackBag"
local root = newPart(model, { Name = "Root", Size = V(0.2, 0.2, 0.2), CFrame = CFrame.new(), Transparency = 1 })
if bag.id == "Chest" then
block(model, V(s.X, s.Y * 0.7, s.Z), CFrame.new(0, -s.Y * 0.15, s.Z / 2), { Color = bag.color, Material = Enum.Material.WoodPlanks })
oval(model, V(s.X, s.Y * 0.6, s.Z), CFrame.new(0, s.Y * 0.2, s.Z / 2), { Color = darken(bag.color, 0.15), Material = Enum.Material.WoodPlanks })
for _, x in ipairs({ -s.X * 0.35, s.X * 0.35 }) do
block(model, V(0.15, s.Y * 1.02, s.Z + 0.06), CFrame.new(x, 0, s.Z / 2), { Color = C(200, 170, 70), Material = METAL })
end
block(model, V(0.35, 0.4, 0.1), CFrame.new(0, 0, s.Z + 0.05), { Color = C(230, 190, 70), Material = METAL })
sparkles(root, C(255, 220, 90), 3)
return finish(model, root, anchored)
end
oval(model, V(s.X, s.Y, s.Z * 1.1), CFrame.new(0, 0, s.Z / 2), { Color = bag.color, Material = Enum.Material.Fabric })
block(model, V(s.X * 0.95, s.Y * 0.3, s.Z * 0.9), CFrame.new(0, s.Y * 0.33, s.Z / 2), { Color = darken(bag.color, 0.25), Material = Enum.Material.Fabric })
block(model, V(s.X * 0.6, s.Y * 0.32, 0.16), CFrame.new(0, -s.Y * 0.15, s.Z + 0.04), { Color = darken(bag.color, 0.12), Material = Enum.Material.Fabric })
block(model, V(0.26, 0.2, 0.06), CFrame.new(0, s.Y * 0.2, s.Z * 0.98), { Color = C(230, 190, 70), Material = METAL })
for _, x in ipairs({ -1, 1 }) do
block(model, V(0.16, s.Y * 0.9, 0.06), CFrame.new(x * s.X * 0.3, 0, s.Z * 0.95), { Color = darken(bag.color, 0.35), Material = Enum.Material.Fabric })
end
if bag.id == "Backpack" or bag.id == "BigNet" then
newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(s.X + 0.1, 0.55, 0.55), CFrame = CFrame.new(0, s.Y / 2 + 0.15, s.Z / 2), Color = C(70, 120, 70), Material = Enum.Material.Fabric })
end
if bag.id == "BigNet" then
oval(model, V(0.15, 0.7, 0.5), CFrame.new(0.4, s.Y / 2 + 0.5, s.Z * 0.6) * CFrame.Angles(0, 0, math.rad(15)), { Color = C(255, 190, 50) })
end
if bag.id == "Magic" then
newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(0.05, 0.7, 0.7), CFrame = CFrame.new(0, -0.1, s.Z + 0.06) * CFrame.Angles(0, math.rad(90), 0), Color = C(255, 150, 255), Material = NEON })
sparkles(root, C(220, 150, 255), 5)
end
return finish(model, root, anchored)
end
---------------------------------------------------------------- рыба
-- Голова смотрит в +X, спина в +Y, бок к зрителю в +Z.
local function seededRng(id)
local n = 0
for i = 1, #id do
n += string.byte(id, i) * i
end
return Random.new(n)
end
-- полуширина эллипсоида (L,H,W) в точке x,y
local function halfWidth(L, H, W, x, y)
local k = 1 - (2 * x / L) ^ 2 - (2 * y / H) ^ 2
return k > 0 and (W / 2) * math.sqrt(k) or 0
end
local function addEyes(model, x, y, zHalf, size)
for _, sgn in ipairs({ -1, 1 }) do
ball(model, V(x, y, sgn * zHalf), size, { Color = C(250, 250, 250) })
ball(model, V(x + size * 0.12, y, sgn * (zHalf + size * 0.3)), size * 0.55, { Color = C(15, 15, 20) })
end
end
function M.buildFish(fishId, mutationId, scale, anchored)
local fish = Config.FindFish(fishId) or Config.Zones.World1.fish[1]
local s = (scale or 1) * fish.size
local c1, c2 = fish.color, fish.color2 or darken(fish.color, 0.3)
local mat = SP
local glow = fish.glow
if mutationId == "Golden" then
c1, c2, mat = C(255, 205, 60), C(230, 150, 30), METAL
elseif mutationId == "Shiny" then
c1, c2, glow = lighten(c1, 0.35), lighten(c2, 0.35), true
elseif mutationId == "Rainbow" then
c1, c2, glow = C(255, 120, 220), C(90, 230, 255), true
end
if fish.glass and not mutationId then
mat = GLASS
end
local finMat = glow and NEON or mat
local rng = seededRng(fish.id)
local model = Instance.new("Model")
model.Name = fish.name
local shape = fish.shape or "classic"
local root
if shape == "flat" then
-- камбала: плоская, «верх» смотрит на зрителя (+Z)
root = oval(model, V(2 * s, 1.3 * s, 0.22 * s), CFrame.new(), { Name = "Body", Color = c1, Material = mat })
oval(model, V(2.2 * s, 1.5 * s, 0.08 * s), CFrame.new(0, 0, -0.02 * s), { Color = darken(c1, 0.2), Material = finMat })
oval(model, V(0.45 * s, 0.6 * s, 0.06 * s), CFrame.new(-1.15 * s, 0, 0), { Color = darken(c1, 0.2), Material = finMat })
for i = 1, fish.spots or 0 do
local x, y = rng:NextNumber(-0.7, 0.7) * s, rng:NextNumber(-0.45, 0.45) * s
oval(model, V(0.14 * s, 0.14 * s, 0.05 * s), CFrame.new(x, y, 0.1 * s), { Color = c2 })
end
ball(model, V(0.62 * s, 0.14 * s, 0.11 * s), 0.16 * s, { Color = C(250, 250, 250) })
ball(model, V(0.5 * s, -0.05 * s, 0.11 * s), 0.16 * s, { Color = C(250, 250, 250) })
ball(model, V(0.62 * s, 0.14 * s, 0.17 * s), 0.08 * s, { Color = C(15, 15, 20) })
ball(model, V(0.5 * s, -0.05 * s, 0.17 * s), 0.08 * s, { Color = C(15, 15, 20) })
return finish(model, root, anchored)
end
if shape == "ray" then
root = block(model, V(1.5 * s, 1.5 * s, 0.14 * s), CFrame.Angles(0, 0, math.rad(45)), { Name = "Body", Color = c1, Material = mat })
oval(model, V(1.4 * s, 0.9 * s, 0.32 * s), CFrame.new(0.1 * s, 0, 0.02 * s), { Color = c1, Material = mat })
cyl(model, V(-0.9 * s, 0, 0), V(-2.4 * s, 0.1 * s, 0), 0.08 * s, { Color = darken(c1, 0.2), Material = mat })
for i = 1, fish.spots or 0 do
ball(model, V(rng:NextNumber(-0.6, 0.6) * s, rng:NextNumber(-0.6, 0.6) * s, 0.12 * s), 0.1 * s, { Color = c2 })
end
ball(model, V(0.45 * s, 0.22 * s, 0.14 * s), 0.14 * s, { Color = C(20, 20, 25) })
ball(model, V(0.45 * s, -0.22 * s, 0.14 * s), 0.14 * s, { Color = C(20, 20, 25) })
return finish(model, root, anchored)
end
if shape == "eel" then
local n, L = 10, 3.4 * s
local seg = L / n
local prev
for i = 0, n - 1 do
local x = L / 2 - i * seg
local y = math.sin(i * 0.8) * 0.22 * s
local d = (0.5 - i * 0.035) * s
local part = oval(model, V(seg * 1.7, d, d * 0.85), CFrame.new(x, y, 0), { Color = c1, Material = mat, Name = i == 0 and "Body" or "Seg" })
if i == 0 then
root = part
end
if i > 0 then
oval(model, V(seg * 1.4, d * 0.5, d * 0.2), CFrame.new(x, y + d * 0.45, 0), { Color = c2, Material = finMat })
if fish.spikes and i % 2 == 0 then
block(model, V(0.06 * s, d * 0.6, 0.06 * s), CFrame.new(x, y + d * 0.75, 0), { Color = c2, Material = NEON })
end
end
if fish.spots and i > 0 and i % 2 == 1 then
ball(model, V(x, y + d * 0.1, d * 0.4), d * 0.25, { Color = c2 })
end
prev = part
end
addEyes(model, L / 2 + seg * 0.3, 0.12 * s, 0.17 * s, 0.13 * s)
oval(model, V(0.1 * s, 0.08 * s, 0.3 * s), CFrame.new(L / 2 + seg * 0.75, -0.08 * s, 0), { Color = C(30, 20, 20) })
return finish(model, root, anchored)
end
if shape == "jelly" then
root = oval(model, V(1.6 * s, 1.1 * s, 1.6 * s), CFrame.new(0, 0.35 * s, 0), { Name = "Body", Color = c1, Material = GLASS, Transparency = 0.2 })
oval(model, V(0.8 * s, 0.5 * s, 0.8 * s), CFrame.new(0, 0.3 * s, 0), { Color = c2, Material = NEON })
oval(model, V(1.75 * s, 0.14 * s, 1.75 * s), CFrame.new(0, -0.15 * s, 0), { Color = c2, Material = finMat })
for i = 0, 7 do
local a = i / 8 * math.pi * 2
local base = V(math.cos(a) * 0.6 * s, -0.15 * s, math.sin(a) * 0.6 * s)
local p1 = base + V(math.sin(i) * 0.15 * s, -0.7 * s, 0)
local p2 = p1 + V(-math.sin(i) * 0.2 * s, -0.7 * s, math.cos(i) * 0.1 * s)
cyl(model, base, p1, 0.07 * s, { Color = c2, Material = NEON })
cyl(model, p1, p2, 0.05 * s, { Color = c1, Material = NEON })
end
return finish(model, root, anchored)
end
-- тело-эллипсоид для остальных форм
local L, H, W = 2 * s, 0.9 * s, 0.45 * s
if shape == "long" or shape == "sturgeon" then
L, H, W = 2.6 * s, 0.6 * s, 0.5 * s
elseif shape == "tall" then
L, H, W = 1.7 * s, 1.25 * s, 0.38 * s
elseif shape == "shark" then
L, H, W = 3 * s, 0.75 * s, 0.7 * s
elseif shape == "sword" then
L, H, W = 2.4 * s, 0.75 * s, 0.5 * s
elseif shape == "puffer" then
L, H, W = 1.4 * s, 1.3 * s, 1.3 * s
elseif shape == "angler" then
L, H, W = 1.6 * s, 1.3 * s, 1.1 * s
end
root = oval(model, V(L, H, W), CFrame.new(), { Name = "Body", Color = c1, Material = mat })
if shape ~= "puffer" and shape ~= "angler" then
oval(model, V(L * 0.82, H * 0.55, W * 1.03), CFrame.new(L * 0.03, -H * 0.2, 0), { Color = lighten(c1, 0.45), Material = mat })
end
-- хвост
if shape == "shark" then
oval(model, V(L * 0.25, H * 1.0, W * 0.12), CFrame.new(-L * 0.56, H * 0.32, 0) * CFrame.Angles(0, 0, math.rad(-35)), { Color = c1, Material = mat })
oval(model, V(L * 0.17, H * 0.6, W * 0.12), CFrame.new(-L * 0.54, -H * 0.22, 0) * CFrame.Angles(0, 0, math.rad(35)), { Color = c1, Material = mat })
else
local th = fish.bigTail and 0.95 or 0.62
oval(model, V(L * 0.22, H * 0.36, W * 0.5), CFrame.new(-L * 0.44, 0, 0), { Color = c1, Material = mat })
for _, sgn in ipairs({ 1, -1 }) do
oval(model, V(L * 0.28, H * th, W * 0.14), CFrame.new(-L * 0.58, sgn * H * 0.22, 0) * CFrame.Angles(0, 0, math.rad(-sgn * 32)), { Color = c2, Material = finMat })
end
end
-- спинной плавник
if shape == "shark" then
wedge(model, V(W * 0.14, H * 0.95, L * 0.2), CFrame.new(-L * 0.02, H * 0.78, 0) * CFrame.Angles(0, math.rad(-90), 0), { Color = c1, Material = mat })
elseif shape == "sword" then
oval(model, V(L * 0.5, H * 1.2, W * 0.1), CFrame.new(L * 0.05, H * 0.65, 0), { Color = c2, Material = finMat })
elseif shape ~= "puffer" then
local big = fish.bigFins and 1.8 or 1
oval(model, V(L * 0.42, H * 0.45 * big, W * 0.12), CFrame.new(-L * 0.06, H * 0.4 * (fish.bigFins and 1.3 or 1), 0), { Color = c2, Material = finMat })
oval(model, V(L * 0.22, H * 0.3 * big, W * 0.1), CFrame.new(-L * 0.2, -H * 0.42 * (fish.bigFins and 1.3 or 1), 0), { Color = c2, Material = finMat })
end
if fish.spikes and shape ~= "puffer" then
for i = 0, 4 do
local x = -L * 0.2 + i * L * 0.08
block(model, V(0.05 * s, H * 0.3, 0.05 * s), CFrame.new(x, H * 0.55, 0) * CFrame.Angles(0, 0, math.rad(-15)), { Color = darken(c2, 0.3) })
end
end
-- грудные плавники
for _, sgn in ipairs({ -1, 1 }) do
oval(model, V(L * 0.2, H * 0.14, W * 0.06), CFrame.new(L * 0.12, -H * 0.15, sgn * W * 0.48) * CFrame.Angles(0, math.rad(sgn * 25), math.rad(-20)), { Color = c2, Material = finMat })
end
-- узоры
if fish.stripes then
for i = 1, fish.stripes do
local x = -L * 0.3 + (i - 0.5) * (L * 0.6 / fish.stripes)
local hh = (H / 2) * math.sqrt(math.max(0, 1 - (2 * x / L) ^ 2))
local hw = (W / 2) * math.sqrt(math.max(0, 1 - (2 * x / L) ^ 2))
oval(model, V(L * 0.06, hh * 2.04, hw * 2.08), CFrame.new(x, 0, 0), { Color = c2, Material = mat })
end
end
if fish.spots then
for i = 1, fish.spots do
local x = rng:NextNumber(-0.35, 0.3) * L
local y = rng:NextNumber(-0.1, 0.35) * H
local z = halfWidth(L, H, W, x, y)
if z > 0 then
local sgn = (i % 2 == 0) and 1 or -1
ball(model, V(x, y, sgn * z * 0.96), 0.13 * s, { Color = c2 })
end
end
end
-- глаза и рот
local ex, ey = L * 0.32, H * 0.12
local ez = halfWidth(L, H, W, ex, ey)
local eyeSize = (shape == "puffer") and H * 0.3 or ((shape == "angler") and H * 0.14 or math.max(0.12 * s, H * 0.22))
addEyes(model, ex, ey, ez * 0.92, eyeSize)
if shape == "angler" then
oval(model, V(L * 0.12, H * 0.5, W * 0.85), CFrame.new(L * 0.46, -H * 0.12, 0), { Color = C(25, 15, 20) })
for i = -2, 2 do
wedge(model, V(0.05 * s, 0.16 * s, 0.06 * s), CFrame.new(L * 0.5, H * 0.08, i * W * 0.12) * CFrame.Angles(math.rad(180), 0, 0), { Color = C(250, 250, 240) })
end
local a, b, c = V(L * 0.3, H * 0.48, 0), V(L * 0.55, H * 0.95, 0), V(L * 0.78, H * 0.85, 0)
cyl(model, a, b, 0.05 * s, { Color = c1 })
cyl(model, b, c, 0.045 * s, { Color = c1 })
local lure = ball(model, c, 0.26 * s, { Color = c2, Material = NEON })
local light = Instance.new("PointLight")
light.Color = c2
light.Range = 8
light.Brightness = 2
light.Parent = lure
else
oval(model, V(L * 0.05, H * 0.12, W * 0.35), CFrame.new(L * 0.49, -H * 0.08, 0), { Color = C(40, 25, 25) })
end
if fish.teeth then
for i = -1, 1 do
wedge(model, V(0.05 * s, 0.12 * s, 0.05 * s), CFrame.new(L * 0.5, -H * 0.02, i * W * 0.12) * CFrame.Angles(math.rad(180), 0, 0), { Color = C(250, 250, 240) })
end
end
if fish.whiskers then
for _, sgn in ipairs({ -1, 1 }) do
cyl(model, V(L * 0.46, -H * 0.12, sgn * W * 0.15), V(L * 0.62, -H * 0.42, sgn * W * 0.45), 0.04 * s, { Color = c2 })
end
end
if shape == "sword" then
cyl(model, V(L * 0.45, 0, 0), V(L * 0.45 + L * 0.7, H * 0.03, 0), H * 0.08, { Color = c2, Material = mat })
elseif shape == "sturgeon" then
oval(model, V(L * 0.22, H * 0.45, W * 0.45), CFrame.new(L * 0.52, -H * 0.08, 0), { Color = c1, Material = mat })
for i = 0, 6 do
block(model, V(0.16 * s, 0.16 * s, 0.1 * s), CFrame.new(L * 0.3 - i * L * 0.11, H * 0.47, 0) * CFrame.Angles(0, 0, math.rad(45)), { Color = c2, Material = finMat })
end
for _, sgn in ipairs({ -1, 1 }) do
cyl(model, V(L * 0.55, -H * 0.25, sgn * W * 0.1), V(L * 0.6, -H * 0.55, sgn * W * 0.15), 0.035 * s, { Color = c2 })
end
elseif shape == "puffer" then
for i = 1, 30 do
local y = 1 - (i - 0.5) / 30 * 2
local r = math.sqrt(1 - y * y)
local th = i * 2.4
local dir = V(math.cos(th) * r, y, math.sin(th) * r)
local base = V(dir.X * L / 2, dir.Y * H / 2, dir.Z * W / 2)
cyl(model, base, base + dir * 0.28 * s, 0.05 * s, { Color = darken(c2, 0.1) })
end
end
if glow then
sparkles(root, c2, 4)
end
return finish(model, root, anchored)
end
---------------------------------------------------------------- поплавок
function M.buildBobber()
local model = Instance.new("Model")
model.Name = "Bobber"
local root = newPart(model, { Name = "Root", Shape = Enum.PartType.Ball, Size = V(0.7, 0.7, 0.7), CFrame = CFrame.new(), Color = C(255, 255, 255) })
newPart(model, { Shape = Enum.PartType.Ball, Size = V(0.72, 0.72, 0.72), CFrame = CFrame.new(0, 0.2, 0), Color = C(230, 40, 40) })
newPart(model, { Size = V(0.07, 0.6, 0.07), CFrame = CFrame.new(0, 0.75, 0), Color = C(230, 40, 40) })
finish(model, root, false)
root.Anchored = true
return model
end
return M
]]></ProtectedString></Properties></Item>
</roblox>