9081 lines
392 KiB
Lua
9081 lines
392 KiB
Lua
-- Обновляет скрипты игры. Карту (Workspace.FishingMap) НЕ трогает.
|
||
local function put(class, name, parent, src)
|
||
local s = parent:FindFirstChild(name)
|
||
if s and s.ClassName ~= class then s:Destroy() s = nil end
|
||
if not s then s = Instance.new(class) s.Name = name s.Parent = parent end
|
||
s.Source = src
|
||
print('OK', parent.Name .. '/' .. name)
|
||
end
|
||
put('ModuleScript', 'FishConfig', game.ReplicatedStorage, [=====[-- FishConfig (ModuleScript) -> ReplicatedStorage
|
||
-- Все настройки игры. Меняй цифры здесь, чтобы настроить баланс.
|
||
|
||
local Config = {}
|
||
|
||
Config.GameName = "Клёвое место"
|
||
|
||
---------------------------------------------------------------- миры
|
||
-- center = центр мира на карте; mult = множитель наград коллекции
|
||
Config.Worlds = {
|
||
{
|
||
id = "World1", name = "Тихое озеро", icon = "🌊", level = 1, mult = 1,
|
||
center = Vector3.new(0, 0, 1500), color = Color3.fromRGB(60, 200, 255),
|
||
desc = "Спокойное лесное озеро. Отличное место, чтобы начать.",
|
||
clock = 16.2,
|
||
waterY = 0,
|
||
lakes = { { 0, -15, 62 }, { -42, 8, 34 }, { 44, 2, 36 }, { 0, 22, 30 }, { 48, -50, 22 } }, -- { x, z, радиус } от центра
|
||
-- внешний вид только этого мира (применяет клиент при входе, при выходе возвращает как было)
|
||
tint = Color3.fromRGB(255, 247, 236),
|
||
-- свет и эффекты: свойства Lighting и его эффектов; чего здесь нет, остаётся как в MapBuilder
|
||
look = {
|
||
lighting = {
|
||
Brightness = 2.6, ExposureCompensation = -0.15,
|
||
Ambient = Color3.fromRGB(62, 66, 84), OutdoorAmbient = Color3.fromRGB(105, 112, 132),
|
||
ColorShift_Top = Color3.fromRGB(255, 232, 196),
|
||
EnvironmentDiffuseScale = 0.6, EnvironmentSpecularScale = 0.8,
|
||
},
|
||
-- дымка вдали: Density — сколько тумана, Haze — насколько он плотный у горизонта
|
||
atmosphere = {
|
||
Density = 0.38, Offset = 0.1, Haze = 1.2, Glare = 0.15,
|
||
Color = Color3.fromRGB(188, 204, 224), Decay = Color3.fromRGB(196, 176, 160),
|
||
},
|
||
color = { Saturation = 0.28, Contrast = 0.2, Brightness = -0.02 },
|
||
bloom = { Intensity = 0.45, Size = 28, Threshold = 1.2 },
|
||
sunRays = { Intensity = 0.06, Spread = 0.6 },
|
||
-- лёгкое размытие дальнего плана
|
||
dof = { Enabled = true, FarIntensity = 0.2, FocusDistance = 60, InFocusRadius = 120, NearIntensity = 0 },
|
||
},
|
||
-- земля мира залита материалом Snow (ровный, без травинок), дорожки — Salt; здесь они перекрашиваются
|
||
terrainColors = {
|
||
Snow = Color3.fromRGB(127, 163, 63), Salt = Color3.fromRGB(191, 155, 105),
|
||
Rock = Color3.fromRGB(132, 139, 155), Slate = Color3.fromRGB(132, 139, 155),
|
||
Mud = Color3.fromRGB(78, 110, 92), Sand = Color3.fromRGB(205, 190, 140),
|
||
},
|
||
},
|
||
{
|
||
id = "World2", name = "Тропический остров", icon = "🏝", level = 8, mult = 4,
|
||
center = Vector3.new(1500, 0, 0), color = Color3.fromRGB(255, 190, 70),
|
||
desc = "Бирюзовое море, пальмы и яркая рифовая рыба.",
|
||
clock = 13,
|
||
waterY = 0,
|
||
sea = 119, -- всё дальше этого радиуса от центра — море
|
||
},
|
||
{
|
||
id = "World3", name = "Ледяной фьорд", icon = "❄", level = 18, mult = 12,
|
||
center = Vector3.new(-1500, 0, 0), color = Color3.fromRGB(150, 220, 255),
|
||
desc = "Рыбалка в лунках среди льдов и северного сияния.",
|
||
clock = 18.3,
|
||
waterY = 1,
|
||
lakes = { { 0, 0, 70 }, { -55, 30, 45 }, { 55, -25, 50 }, { 5, -70, 40 } }, -- подо льдом
|
||
holes = {
|
||
{ 0, 40 }, { -22, 18 }, { 22, 12 }, { 0, -12 }, { -30, -30 }, { 30, 40 }, { -60, 35 },
|
||
{ -45, 15 }, { 55, -25 }, { 75, -5 }, { 40, -50 }, { 5, -75 }, { -15, -60 }, { 25, -80 },
|
||
},
|
||
holeRadius = 6,
|
||
-- цвета террейна общие на весь плейс, а в нём сохранены цвета «Тихого озера» (зелёный Snow) —
|
||
-- поэтому снег фьорда задаём явно
|
||
terrainColors = { Snow = Color3.fromRGB(205, 212, 228) },
|
||
},
|
||
{
|
||
id = "World4", name = "Вулкан", icon = "🌋", level = 30, mult = 30, soon = true,
|
||
center = Vector3.new(0, 0, -1500), color = Color3.fromRGB(255, 90, 40),
|
||
desc = "Рыбалка в лаве. Скоро!",
|
||
},
|
||
}
|
||
Config.WorldRadius = 260
|
||
|
||
-- экран загрузки: при входе в игру и при каждом телепорте игрок уже стоит на месте, сцена прогружается
|
||
-- и свет локации ставится под ним; картинку видно только после этого (секунды — минимум показа)
|
||
Config.Loading = {
|
||
firstJoin = 3,
|
||
teleport = 2.5,
|
||
}
|
||
|
||
-- лобби: те же поля внешнего вида, что у миров (clock, tint, look, terrainColors); клиент применяет их вне миров
|
||
Config.Lobby = {
|
||
id = "Lobby",
|
||
clock = 16.3, -- предвечернее солнце: тени длиннее, свет теплее
|
||
tint = Color3.fromRGB(255, 242, 228),
|
||
look = {
|
||
lighting = {
|
||
Brightness = 2.0, ExposureCompensation = -0.3,
|
||
Ambient = Color3.fromRGB(64, 60, 72), OutdoorAmbient = Color3.fromRGB(120, 114, 124),
|
||
ColorShift_Top = Color3.fromRGB(255, 224, 186),
|
||
EnvironmentDiffuseScale = 0.5, EnvironmentSpecularScale = 0.5,
|
||
GlobalShadows = true,
|
||
},
|
||
-- тёплая дымка: дальние холмы за скалами тонут в ней
|
||
atmosphere = {
|
||
Density = 0.4, Offset = 0.18, Haze = 1.6, Glare = 0.25,
|
||
Color = Color3.fromRGB(222, 212, 204), Decay = Color3.fromRGB(186, 160, 150),
|
||
},
|
||
color = { Saturation = 0.18, Contrast = 0.14, Brightness = -0.04 },
|
||
bloom = { Intensity = 0.3, Size = 24, Threshold = 1.8 },
|
||
sunRays = { Intensity = 0.05, Spread = 0.7 },
|
||
dof = { Enabled = true, FarIntensity = 0.18, FocusDistance = 55, InFocusRadius = 95, NearIntensity = 0 },
|
||
-- мягкий тонмаппинг вместо Retro: светлая плитка и вывески не выгорают в белое
|
||
grading = { TonemapperPreset = Enum.TonemapperPreset.Default },
|
||
},
|
||
terrainColors = {
|
||
Grass = Color3.fromRGB(104, 150, 72), Ground = Color3.fromRGB(120, 98, 74), Rock = Color3.fromRGB(140, 126, 130),
|
||
},
|
||
}
|
||
|
||
function Config.WorldAt(pos)
|
||
for _, w in ipairs(Config.Worlds) do
|
||
if not w.soon then
|
||
local d = Vector3.new(pos.X - w.center.X, 0, pos.Z - w.center.Z).Magnitude
|
||
if d < Config.WorldRadius then
|
||
return w
|
||
end
|
||
end
|
||
end
|
||
return nil
|
||
end
|
||
|
||
-- куда бросать из этой точки (единичный вектор по горизонтали): к центру ближайшего озера или лунки,
|
||
-- а если ближе море — от центра острова к морю
|
||
function Config.CastDirection(world, pos)
|
||
if not world then
|
||
return nil
|
||
end
|
||
local x, z = pos.X - world.center.X, pos.Z - world.center.Z
|
||
local best, bestGap
|
||
local function consider(dir, gap)
|
||
if dir.Magnitude > 0.1 and (not bestGap or gap < bestGap) then
|
||
best, bestGap = dir.Unit, gap
|
||
end
|
||
end
|
||
if world.holes then
|
||
for _, h in ipairs(world.holes) do
|
||
consider(Vector3.new(h[1] - x, 0, h[2] - z), math.sqrt((h[1] - x) ^ 2 + (h[2] - z) ^ 2) - (world.holeRadius or 6))
|
||
end
|
||
end
|
||
for _, l in ipairs(world.lakes or {}) do
|
||
if not world.holes then -- в Мире 3 озёра подо льдом, бросаем только в лунки
|
||
consider(Vector3.new(l[1] - x, 0, l[2] - z), math.sqrt((l[1] - x) ^ 2 + (l[2] - z) ^ 2) - l[3])
|
||
end
|
||
end
|
||
if world.sea then
|
||
consider(Vector3.new(x, 0, z), world.sea - math.sqrt(x * x + z * z))
|
||
end
|
||
return best
|
||
end
|
||
|
||
-- расстояние по горизонтали от точки до ближайшей воды (0 — над водой: на причале или в воде)
|
||
function Config.WaterGap(world, pos)
|
||
if not world then
|
||
return math.huge
|
||
end
|
||
local x, z = pos.X - world.center.X, pos.Z - world.center.Z
|
||
local gap = math.huge
|
||
if world.holes then
|
||
for _, h in ipairs(world.holes) do
|
||
gap = math.min(gap, math.sqrt((h[1] - x) ^ 2 + (h[2] - z) ^ 2) - (world.holeRadius or 6))
|
||
end
|
||
else
|
||
for _, l in ipairs(world.lakes or {}) do
|
||
gap = math.min(gap, math.sqrt((l[1] - x) ^ 2 + (l[2] - z) ^ 2) - l[3])
|
||
end
|
||
end
|
||
if world.sea then
|
||
gap = math.min(gap, world.sea - math.sqrt(x * x + z * z))
|
||
end
|
||
return math.max(0, gap)
|
||
end
|
||
|
||
-- можно ли закидывать отсюда (pos — центр персонажа): стоим на берегу или платформе
|
||
-- и до воды не дальше Config.CastReach. Возвращает true или текст подсказки.
|
||
-- humanoid можно не передавать (на сервере его состояние ненадёжно) — тогда проверяем только по высоте.
|
||
function Config.CanCastFrom(world, pos, humanoid)
|
||
if not world then
|
||
return "🌍 Тут нет рыбы"
|
||
end
|
||
local inWater = pos.Y < (world.waterY or 0) + 2 -- у плывущего персонажа центр почти на уровне воды
|
||
if humanoid then
|
||
inWater = inWater or humanoid:GetState() == Enum.HumanoidStateType.Swimming or humanoid.FloorMaterial == Enum.Material.Water
|
||
end
|
||
if inWater then
|
||
return "🏊 Выйди из воды"
|
||
end
|
||
if humanoid and humanoid.FloorMaterial == Enum.Material.Air then
|
||
return "Встань на землю"
|
||
end
|
||
if Config.WaterGap(world, pos) > Config.CastReach then
|
||
return "🌊 Подойди к воде"
|
||
end
|
||
return true
|
||
end
|
||
|
||
-- есть ли вода в этой точке мира (озеро, море или лунка)
|
||
function Config.IsWater(world, pos)
|
||
if not world then
|
||
return false
|
||
end
|
||
local x, z = pos.X - world.center.X, pos.Z - world.center.Z
|
||
if world.holes then
|
||
local r = world.holeRadius or 6
|
||
for _, h in ipairs(world.holes) do
|
||
if (x - h[1]) ^ 2 + (z - h[2]) ^ 2 <= r * r then
|
||
return true
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
if world.sea and math.sqrt(x * x + z * z) >= world.sea then
|
||
return true
|
||
end
|
||
for _, l in ipairs(world.lakes or {}) do
|
||
if (x - l[1]) ^ 2 + (z - l[2]) ^ 2 <= (l[3] - 1) ^ 2 then
|
||
return true
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
---------------------------------------------------------------- редкости
|
||
Config.Rarities = {
|
||
Common = { name = "Обычная", rank = 1, weight = 55, color = Color3.fromRGB(215, 220, 225) },
|
||
Uncommon = { name = "Необычная", rank = 2, weight = 27, color = Color3.fromRGB(95, 225, 115) },
|
||
Rare = { name = "Редкая", rank = 3, weight = 11, color = Color3.fromRGB(70, 160, 255) },
|
||
Epic = { name = "Эпическая", rank = 4, weight = 4.5, color = Color3.fromRGB(185, 90, 255) },
|
||
Legendary = { name = "Легендарная", rank = 5, weight = 1.2, color = Color3.fromRGB(255, 185, 35) },
|
||
Mythic = { name = "Мифическая", rank = 6, weight = 0.25, color = Color3.fromRGB(255, 80, 150) },
|
||
}
|
||
Config.RarityOrder = { "Common", "Uncommon", "Rare", "Epic", "Legendary", "Mythic" }
|
||
|
||
---------------------------------------------------------------- мутации
|
||
Config.Mutations = {
|
||
{ id = "Rainbow", name = "Радужная", chance = 0.002, mult = 10, color = Color3.fromRGB(255, 120, 230) },
|
||
{ id = "Golden", name = "Золотая", chance = 0.010, mult = 5, color = Color3.fromRGB(255, 205, 60) },
|
||
{ id = "Shiny", name = "Блестящая", chance = 0.040, mult = 2, color = Color3.fromRGB(170, 240, 255) },
|
||
}
|
||
|
||
---------------------------------------------------------------- рыба
|
||
-- shape: classic, long, tall, flat, ray, puffer, shark, eel, sword, angler, jelly, sturgeon
|
||
-- color2 = второй цвет (плавники/узор); stripes/spots/whiskers/spikes/glow — украшения модели
|
||
local function F(t)
|
||
return t
|
||
end
|
||
|
||
Config.Zones = {
|
||
World1 = {
|
||
fish = {
|
||
F({ id = "Karas", name = "Карась", rarity = "Common", price = 5, xp = 8, minW = 0.2, maxW = 1.2, size = 1.0, shape = "tall", color = Color3.fromRGB(205, 170, 75), color2 = Color3.fromRGB(170, 120, 50) }),
|
||
F({ id = "Plotva", name = "Плотва", rarity = "Common", price = 6, xp = 8, minW = 0.1, maxW = 0.8, size = 0.9, shape = "classic", color = Color3.fromRGB(195, 200, 210), color2 = Color3.fromRGB(220, 80, 60) }),
|
||
F({ id = "Ersh", name = "Ёрш", rarity = "Common", price = 7, xp = 9, minW = 0.1, maxW = 0.4, size = 0.8, shape = "classic", color = Color3.fromRGB(135, 125, 75), color2 = Color3.fromRGB(95, 85, 50), spikes = true, spots = 6 }),
|
||
F({ id = "Okun", name = "Окунь", rarity = "Uncommon", price = 15, xp = 18, minW = 0.3, maxW = 1.5, size = 1.0, shape = "classic", color = Color3.fromRGB(150, 180, 70), color2 = Color3.fromRGB(230, 90, 40), stripes = 5, spikes = true }),
|
||
F({ id = "Lesh", name = "Лещ", rarity = "Uncommon", price = 18, xp = 20, minW = 0.5, maxW = 3.0, size = 1.2, shape = "tall", color = Color3.fromRGB(175, 145, 95), color2 = Color3.fromRGB(120, 95, 60) }),
|
||
F({ id = "Lin", name = "Линь", rarity = "Uncommon", price = 20, xp = 22, minW = 0.4, maxW = 2.5, size = 1.1, shape = "classic", color = Color3.fromRGB(95, 125, 55), color2 = Color3.fromRGB(60, 85, 35) }),
|
||
F({ id = "Shuka", name = "Щука", rarity = "Rare", price = 45, xp = 45, minW = 1.0, maxW = 8.0, size = 1.5, shape = "long", color = Color3.fromRGB(110, 140, 85), color2 = Color3.fromRGB(200, 210, 150), spots = 12 }),
|
||
F({ id = "Sudak", name = "Судак", rarity = "Rare", price = 50, xp = 48, minW = 1.0, maxW = 6.0, size = 1.4, shape = "long", color = Color3.fromRGB(165, 165, 135), color2 = Color3.fromRGB(80, 80, 70), stripes = 6, spikes = true }),
|
||
F({ id = "Som", name = "Сом", rarity = "Epic", price = 130, xp = 110, minW = 5.0, maxW = 40, size = 2.0, shape = "long", color = Color3.fromRGB(75, 75, 90), color2 = Color3.fromRGB(180, 175, 160), whiskers = true }),
|
||
F({ id = "Koi", name = "Карп кои", rarity = "Epic", price = 150, xp = 120, minW = 2.0, maxW = 9.0, size = 1.4, shape = "classic", color = Color3.fromRGB(250, 245, 240), color2 = Color3.fromRGB(240, 110, 40), spots = 7, whiskers = true }),
|
||
F({ id = "Gold", name = "Золотая рыбка", rarity = "Legendary", price = 500, xp = 350, minW = 0.1, maxW = 0.5, size = 0.9, shape = "classic", color = Color3.fromRGB(255, 195, 40), color2 = Color3.fromRGB(255, 120, 30), glow = true, bigTail = true }),
|
||
F({ id = "Crystal", name = "Хрустальный осётр", rarity = "Mythic", price = 2000, xp = 900, minW = 10, maxW = 60, size = 2.0, shape = "sturgeon", color = Color3.fromRGB(150, 230, 255), color2 = Color3.fromRGB(230, 250, 255), glow = true, glass = true }),
|
||
},
|
||
},
|
||
World2 = {
|
||
fish = {
|
||
F({ id = "Clown", name = "Рыба-клоун", rarity = "Common", price = 18, xp = 18, minW = 0.1, maxW = 0.4, size = 0.8, shape = "classic", color = Color3.fromRGB(255, 120, 30), color2 = Color3.fromRGB(255, 255, 255), stripes = 3 }),
|
||
F({ id = "Sergeant", name = "Рыба-сержант", rarity = "Common", price = 20, xp = 18, minW = 0.2, maxW = 0.9, size = 0.9, shape = "tall", color = Color3.fromRGB(240, 230, 110), color2 = Color3.fromRGB(40, 40, 45), stripes = 5 }),
|
||
F({ id = "Mullet", name = "Барабулька", rarity = "Common", price = 22, xp = 20, minW = 0.1, maxW = 0.6, size = 0.9, shape = "classic", color = Color3.fromRGB(235, 110, 100), color2 = Color3.fromRGB(255, 220, 120), whiskers = true }),
|
||
F({ id = "Angel", name = "Рыба-ангел", rarity = "Uncommon", price = 45, xp = 40, minW = 0.3, maxW = 1.5, size = 1.0, shape = "tall", color = Color3.fromRGB(60, 120, 230), color2 = Color3.fromRGB(255, 220, 40), stripes = 4, bigFins = true }),
|
||
F({ id = "Puffer", name = "Иглобрюх", rarity = "Uncommon", price = 50, xp = 42, minW = 0.3, maxW = 2.0, size = 1.0, shape = "puffer", color = Color3.fromRGB(230, 205, 140), color2 = Color3.fromRGB(110, 90, 60), spots = 10 }),
|
||
F({ id = "Parrot", name = "Рыба-попугай", rarity = "Uncommon", price = 55, xp = 45, minW = 1.0, maxW = 5.0, size = 1.2, shape = "classic", color = Color3.fromRGB(60, 210, 190), color2 = Color3.fromRGB(240, 90, 180), spots = 5 }),
|
||
F({ id = "Ray", name = "Скат", rarity = "Rare", price = 120, xp = 90, minW = 3.0, maxW = 25, size = 1.6, shape = "ray", color = Color3.fromRGB(110, 115, 140), color2 = Color3.fromRGB(230, 230, 240), spots = 14 }),
|
||
F({ id = "Barracuda", name = "Барракуда", rarity = "Rare", price = 130, xp = 95, minW = 2.0, maxW = 20, size = 1.7, shape = "long", color = Color3.fromRGB(175, 185, 200), color2 = Color3.fromRGB(60, 70, 85), stripes = 8 }),
|
||
F({ id = "Swordfish", name = "Рыба-меч", rarity = "Epic", price = 350, xp = 220, minW = 30, maxW = 200, size = 2.0, shape = "sword", color = Color3.fromRGB(55, 75, 130), color2 = Color3.fromRGB(200, 210, 230) }),
|
||
F({ id = "Moray", name = "Мурена", rarity = "Epic", price = 320, xp = 210, minW = 2.0, maxW = 15, size = 1.8, shape = "eel", color = Color3.fromRGB(80, 140, 60), color2 = Color3.fromRGB(230, 220, 90), spots = 12 }),
|
||
F({ id = "Shark", name = "Рифовая акула", rarity = "Legendary", price = 1200, xp = 700, minW = 40, maxW = 180, size = 2.4, shape = "shark", color = Color3.fromRGB(110, 125, 145), color2 = Color3.fromRGB(235, 235, 240) }),
|
||
F({ id = "SunJelly", name = "Солнечная медуза", rarity = "Mythic", price = 5000, xp = 2000, minW = 1.0, maxW = 8.0, size = 1.8, shape = "jelly", color = Color3.fromRGB(255, 200, 80), color2 = Color3.fromRGB(255, 120, 200), glow = true, glass = true }),
|
||
},
|
||
},
|
||
World3 = {
|
||
fish = {
|
||
F({ id = "Cod", name = "Треска", rarity = "Common", price = 55, xp = 40, minW = 1.0, maxW = 10, size = 1.2, shape = "classic", color = Color3.fromRGB(150, 150, 110), color2 = Color3.fromRGB(230, 225, 200), spots = 14, whiskers = true }),
|
||
F({ id = "Herring", name = "Сельдь", rarity = "Common", price = 50, xp = 38, minW = 0.2, maxW = 0.8, size = 0.9, shape = "long", color = Color3.fromRGB(150, 175, 205), color2 = Color3.fromRGB(70, 100, 140) }),
|
||
F({ id = "Capelin", name = "Мойва", rarity = "Common", price = 48, xp = 36, minW = 0.05, maxW = 0.2, size = 0.7, shape = "classic", color = Color3.fromRGB(170, 200, 190), color2 = Color3.fromRGB(80, 120, 110) }),
|
||
F({ id = "Flounder", name = "Камбала", rarity = "Uncommon", price = 140, xp = 90, minW = 0.5, maxW = 4.0, size = 1.2, shape = "flat", color = Color3.fromRGB(150, 125, 90), color2 = Color3.fromRGB(230, 120, 60), spots = 10 }),
|
||
F({ id = "Redfish", name = "Морской окунь", rarity = "Uncommon", price = 150, xp = 92, minW = 0.5, maxW = 5.0, size = 1.1, shape = "classic", color = Color3.fromRGB(225, 70, 60), color2 = Color3.fromRGB(255, 160, 120), spikes = true }),
|
||
F({ id = "Char", name = "Арктический голец", rarity = "Uncommon", price = 160, xp = 95, minW = 0.5, maxW = 6.0, size = 1.2, shape = "long", color = Color3.fromRGB(120, 130, 150), color2 = Color3.fromRGB(255, 130, 150), spots = 12 }),
|
||
F({ id = "Halibut", name = "Палтус", rarity = "Rare", price = 380, xp = 200, minW = 5.0, maxW = 90, size = 1.9, shape = "flat", color = Color3.fromRGB(90, 95, 80), color2 = Color3.fromRGB(150, 150, 130), spots = 16 }),
|
||
F({ id = "Wolffish", name = "Морской волк", rarity = "Rare", price = 400, xp = 210, minW = 3.0, maxW = 20, size = 1.7, shape = "long", color = Color3.fromRGB(110, 120, 140), color2 = Color3.fromRGB(60, 65, 80), stripes = 7, teeth = true }),
|
||
F({ id = "Angler", name = "Удильщик", rarity = "Epic", price = 1100, xp = 500, minW = 5.0, maxW = 50, size = 1.6, shape = "angler", color = Color3.fromRGB(60, 50, 70), color2 = Color3.fromRGB(120, 255, 230), glow = true }),
|
||
F({ id = "IceEel", name = "Ледяная мурена", rarity = "Epic", price = 1000, xp = 480, minW = 3.0, maxW = 25, size = 1.9, shape = "eel", color = Color3.fromRGB(150, 210, 245), color2 = Color3.fromRGB(240, 250, 255), glass = true }),
|
||
F({ id = "Greenland", name = "Полярная акула", rarity = "Legendary", price = 3500, xp = 1500, minW = 200, maxW = 900, size = 2.6, shape = "shark", color = Color3.fromRGB(80, 90, 100), color2 = Color3.fromRGB(160, 170, 180) }),
|
||
F({ id = "Leviathan", name = "Ледяной левиафан", rarity = "Mythic", price = 15000, xp = 4000, minW = 500, maxW = 3000, size = 2.4, shape = "eel", color = Color3.fromRGB(110, 230, 255), color2 = Color3.fromRGB(200, 120, 255), glow = true, spikes = true }),
|
||
},
|
||
},
|
||
}
|
||
|
||
---------------------------------------------------------------- удочки
|
||
-- luck = бонус удачи, speed = множитель ожидания клёва (меньше = быстрее), zone = ширина зелёной зоны
|
||
Config.Rods = {
|
||
{ id = "Basic", name = "Старая удочка", price = 0, level = 1, luck = 0.00, speed = 1.00, zone = 0.22, upgradeCost = 40, style = "wood" },
|
||
{ id = "Bamboo", name = "Бамбуковая удочка", price = 150, level = 3, luck = 0.15, speed = 0.88, zone = 0.25, upgradeCost = 120, style = "bamboo" },
|
||
{ id = "Fiberglass", name = "Стеклопластиковая", price = 600, level = 5, luck = 0.30, speed = 0.78, zone = 0.27, upgradeCost = 300, style = "glass" },
|
||
{ id = "Carbon", name = "Карбоновая удочка", price = 1800, level = 8, luck = 0.55, speed = 0.68, zone = 0.29, upgradeCost = 700, style = "carbon" },
|
||
{ id = "Coral", name = "Коралловая удочка", price = 4500, level = 10, luck = 0.80, speed = 0.62, zone = 0.31, upgradeCost = 1300, style = "coral" },
|
||
{ id = "Golden", name = "Золотая удочка", price = 9000, level = 13, luck = 1.00, speed = 0.56, zone = 0.33, upgradeCost = 2200, style = "gold" },
|
||
{ id = "Frost", name = "Ледяная удочка", price = 25000, level = 18, luck = 1.40, speed = 0.50, zone = 0.35, upgradeCost = 5000, style = "frost" },
|
||
{ id = "Legend", name = "Удочка Легенды", price = 75000, level = 25, luck = 2.00, speed = 0.42, zone = 0.38, upgradeCost = 12000, style = "legend" },
|
||
}
|
||
|
||
Config.RodUpgrade = { maxLevel = 5, luckPerLevel = 0.08, zonePerLevel = 0.012, speedPerLevel = 0.96 }
|
||
function Config.UpgradeCost(rod, currentLevel)
|
||
return math.floor(rod.upgradeCost * (currentLevel + 1) ^ 1.5)
|
||
end
|
||
|
||
---------------------------------------------------------------- сумки
|
||
Config.Bags = {
|
||
{ id = "Pouch", name = "Холщовая сумка", price = 0, level = 1, capacity = 12, color = Color3.fromRGB(170, 140, 95) },
|
||
{ id = "Satchel", name = "Сумка рыбака", price = 150, level = 2, capacity = 25, color = Color3.fromRGB(110, 140, 80) },
|
||
{ id = "Backpack", name = "Туристический рюкзак", price = 700, level = 4, capacity = 45, color = Color3.fromRGB(60, 110, 180) },
|
||
{ id = "BigNet", name = "Огромный садок", price = 2500, level = 7, capacity = 80, color = Color3.fromRGB(200, 80, 50) },
|
||
{ id = "Chest", name = "Сундук за спиной", price = 9000, level = 12, capacity = 140, color = Color3.fromRGB(140, 90, 50) },
|
||
{ id = "Magic", name = "Магический мешок", price = 30000, level = 20, capacity = 250, color = Color3.fromRGB(120, 60, 200) },
|
||
}
|
||
|
||
---------------------------------------------------------------- удача
|
||
Config.LuckPerPlayerLevel = 0.02 -- +2% за уровень игрока
|
||
Config.MasteryLuck = 0.10 -- +10% навсегда за полностью собранный мир
|
||
Config.Potions = {
|
||
{ id = "Luck1", name = "Зелье удачи", price = 120, bonus = 0.5, duration = 300, color = Color3.fromRGB(90, 230, 120) },
|
||
{ id = "Luck2", name = "Большое зелье удачи", price = 450, bonus = 1.0, duration = 600, color = Color3.fromRGB(255, 200, 60), level = 5 },
|
||
{ id = "Luck3", name = "Эликсир фортуны", price = 2500, bonus = 2.0, duration = 600, color = Color3.fromRGB(200, 120, 255), level = 12 },
|
||
}
|
||
|
||
---------------------------------------------------------------- коллекция
|
||
-- награда за то, что поймал ВСЕ виды одной редкости в мире (умножается на mult мира)
|
||
Config.CollectionRewards = {
|
||
Common = { coins = 50, xp = 40 },
|
||
Uncommon = { coins = 120, xp = 100 },
|
||
Rare = { coins = 300, xp = 250 },
|
||
Epic = { coins = 800, xp = 600 },
|
||
Legendary = { coins = 2000, xp = 1500 },
|
||
Mythic = { coins = 6000, xp = 4000 },
|
||
}
|
||
Config.MasteryCoins = 5000 -- за весь мир (тоже умножается на mult)
|
||
|
||
---------------------------------------------------------------- цепочки заданий
|
||
-- короткие задания идут по очереди: награда сразу, следующее появляется мгновенно.
|
||
-- после последнего шага — бонус цепочки и следующая цепочка; каждый новый круг цели растут
|
||
-- coins/xp = награда за 1 единицу цели (умножается на цель и уровень игрока);
|
||
-- max — потолок цели, byLevel — цель растёт с уровнем игрока;
|
||
-- forms — слово после числа для 1 / 2–4 / 5+ (подставляется вместо второго %s)
|
||
local FISH, TIMES = { "рыбу", "рыбы", "рыб" }, { "раз", "раза", "раз" }
|
||
Config.QuestKinds = {
|
||
catch = { text = "Поймай %d %s", forms = FISH, coins = 5, xp = 4 },
|
||
uncommon = { text = "Поймай %d %s «Необычная» или реже", forms = FISH, coins = 18, xp = 14 },
|
||
rare = { text = "Поймай %d %s «Редкая» или реже", forms = FISH, coins = 60, xp = 50 },
|
||
perfect = { text = "Подсеки %d %s без промаха", forms = TIMES, coins = 10, xp = 8 },
|
||
perfectCast = { text = "Забрось в зелёную зону %d %s", forms = TIMES, coins = 8, xp = 6 },
|
||
combo = { text = "Набери серию из %d рыб", coins = 12, xp = 10, max = 15 },
|
||
sell = { text = "Продай %d %s", forms = FISH, coins = 3, xp = 3 },
|
||
earn = { text = "Заработай %d 💰 на продаже", coins = 0.25, xp = 0.2, byLevel = true },
|
||
buy = { text = "Купи что-нибудь в магазине", coins = 40, xp = 30, max = 1 },
|
||
boss = { text = "Нанеси боссу %d урона", coins = 15, xp = 12 },
|
||
}
|
||
Config.QuestChains = {
|
||
{ name = "🎣 Утренний клёв", steps = { { "catch", 3 }, { "perfectCast", 2 }, { "sell", 3 }, { "catch", 5 }, { "uncommon", 1 } } },
|
||
{ name = "🔥 Без промаха", steps = { { "perfect", 3 }, { "combo", 3 }, { "catch", 6 }, { "earn", 80 }, { "combo", 5 } } },
|
||
{ name = "💎 Охота за редкостью", steps = { { "uncommon", 3 }, { "perfectCast", 3 }, { "rare", 1 }, { "sell", 8 }, { "buy", 1 } } },
|
||
{ name = "🏆 Мастер озера", steps = { { "combo", 6 }, { "catch", 10 }, { "perfect", 6 }, { "rare", 2 }, { "earn", 300 } } },
|
||
}
|
||
Config.QuestTierGrowth = 0.5 -- каждый следующий круг цепочек: цели ×(1 + 0.5 · номер круга)
|
||
Config.ChainBonus = { coins = 120, xp = 100, potion = "Luck1" } -- за всю цепочку (растёт с уровнем и кругом)
|
||
|
||
---------------------------------------------------------------- серия улова
|
||
-- каждая рыба подряд без срыва: +10% к цене и опыту следующей, до ×2;
|
||
-- срыв, ушедшая рыба или timeout секунд без улова — серия сгорает
|
||
Config.Combo = { step = 0.1, max = 2.0, timeout = 90 }
|
||
|
||
---------------------------------------------------------------- босс озера
|
||
-- раз в interval секунд в мир, где больше всего игроков, приплывает босс. Его ловят всем сервером:
|
||
-- каждая пойманная там рыба наносит урон = ранг редкости (+1 за подсечку без промаха).
|
||
-- Если за duration секунд урона хватило — награда всем, кто помог (× mult мира, минимум 40% за малый вклад)
|
||
Config.Boss = {
|
||
firstDelay = 240, interval = 600, duration = 180,
|
||
hpPerPlayer = 12,
|
||
reward = { coins = 300, xp = 250, potion = "Luck1" },
|
||
worlds = {
|
||
World1 = { name = "Сом-великан", fish = "Som", mutation = "Golden", scale = 5 },
|
||
World2 = { name = "Королевская акула", fish = "Shark", mutation = "Golden", scale = 3 },
|
||
World3 = { name = "Ледяной левиафан", fish = "Leviathan", mutation = "Rainbow", scale = 2.5 },
|
||
},
|
||
}
|
||
|
||
-- ежедневная награда (7 дней по кругу), монеты растут с уровнем
|
||
Config.DailyRewards = {
|
||
{ coins = 100 },
|
||
{ coins = 200 },
|
||
{ coins = 300, potion = "Luck1" },
|
||
{ coins = 450 },
|
||
{ coins = 600, potion = "Luck1" },
|
||
{ coins = 800 },
|
||
{ coins = 1500, potion = "Luck2" },
|
||
}
|
||
|
||
---------------------------------------------------------------- события на сервере
|
||
Config.Events = {
|
||
{ id = "Bite", name = "⚡ Клёвый час", desc = "Рыба клюёт в 2 раза быстрее", duration = 180, speed = 0.5 },
|
||
{ id = "Luck", name = "🍀 Удачный ветер", desc = "Удача +50% для всех", duration = 180, luck = 0.5 },
|
||
{ id = "Stars", name = "🌟 Звездопад", desc = "Мутации в 3 раза чаще", duration = 180, mutation = 3 },
|
||
{ id = "Fair", name = "💰 Рыбная ярмарка", desc = "Рыба продаётся на 50% дороже", duration = 180, sell = 1.5 },
|
||
}
|
||
Config.EventFirstDelay = 120
|
||
Config.EventGapMin = 420
|
||
Config.EventGapMax = 720
|
||
|
||
---------------------------------------------------------------- время суток
|
||
-- одни сутки длятся length секунд реального времени; время общее для всего сервера
|
||
Config.DayNight = {
|
||
enabled = true,
|
||
length = 1200, -- 20 минут на сутки
|
||
startClock = 9, -- во сколько начинается день при запуске сервера
|
||
nightLuck = 0.10, -- ночью удача +10%
|
||
}
|
||
|
||
-- время на часах в момент serverTime (workspace:GetServerTimeNow()), dayStart — атрибут workspace "DayStart"
|
||
function Config.ClockAt(serverTime, dayStart)
|
||
local d = Config.DayNight
|
||
return (d.startClock + (serverTime - (dayStart or serverTime)) / d.length * 24) % 24
|
||
end
|
||
|
||
-- 0 днём, 1 глубокой ночью, плавно на рассвете и закате
|
||
function Config.Nightness(clock)
|
||
if clock >= 7 and clock <= 17.5 then
|
||
return 0
|
||
elseif clock > 17.5 and clock < 20 then
|
||
return (clock - 17.5) / 2.5
|
||
elseif clock >= 5 and clock < 7 then
|
||
return 1 - (clock - 5) / 2
|
||
end
|
||
return 1
|
||
end
|
||
|
||
function Config.IsNight(clock)
|
||
return Config.Nightness(clock) >= 0.5
|
||
end
|
||
|
||
---------------------------------------------------------------- погода
|
||
-- меняется на всём сервере; weight — как часто выпадает, duration — сколько длится (секунды)
|
||
-- luck / speed / mutation — бонусы к рыбалке, пока погода держится
|
||
-- names — как погода называется в отдельных мирах (во фьорде вместо дождя снег)
|
||
Config.Weathers = {
|
||
{ id = "Clear", name = "Ясно", icon = "☀", weight = 40, duration = { 240, 420 } },
|
||
{ id = "Cloudy", name = "Пасмурно", icon = "☁", weight = 25, duration = { 180, 360 }, luck = 0.05, desc = "Удача +5%" },
|
||
{ id = "Rain", name = "Дождь", icon = "🌧", weight = 20, duration = { 150, 300 }, speed = 0.85, desc = "Клюёт на 15% быстрее",
|
||
names = { World3 = "Снегопад" } },
|
||
{ id = "Storm", name = "Гроза", icon = "⛈", weight = 8, duration = { 120, 240 }, luck = 0.25, speed = 0.9, desc = "Удача +25%",
|
||
names = { World3 = "Метель" } },
|
||
{ id = "Fog", name = "Туман", icon = "🌫", weight = 7, duration = { 150, 300 }, mutation = 1.5, desc = "Мутации ×1.5" },
|
||
}
|
||
|
||
function Config.WeatherById(id)
|
||
for _, w in ipairs(Config.Weathers) do
|
||
if w.id == id then
|
||
return w
|
||
end
|
||
end
|
||
return Config.Weathers[1]
|
||
end
|
||
|
||
---------------------------------------------------------------- звуки
|
||
-- ID из Creator Store: эффекты — Pro Sound Effects (официальная библиотека Roblox),
|
||
-- музыка — APM и DistroKid (лицензированы для Roblox). volume — громкость, pitch — разброс высоты
|
||
local function S(id, volume, extra)
|
||
local t = extra or {}
|
||
t.id = "rbxassetid://" .. id
|
||
t.volume = volume
|
||
return t
|
||
end
|
||
Config.Sounds = {
|
||
-- музыка
|
||
musicLobby = S(137023744071437, 0.35), -- The Ancient Lutes | Medieval Tavern Music
|
||
musicLobby2 = S(116079409060113, 0.35), -- The Lute Lament | Medieval Tavern Music
|
||
musicLake = S(1838853377, 0.3), -- Harp Fantasy
|
||
musicLake2 = S(86472274853159, 0.3), -- Calm Fantasy Atmosphere
|
||
musicNight = S(140195397978848, 0.3), -- Moonlit Meadow Whisper
|
||
-- окружение (петли)
|
||
birdsLake = S(9112877174, 0.35), -- Squam Lake 1
|
||
birdsPark = S(9113444360, 0.25), -- Birds Park 2
|
||
birdsJungle = S(9114892930, 0.3), -- Jungle Birds Ambience 3
|
||
crickets = S(9112764573, 0.3), -- Crickets Night 3
|
||
lakeWater = S(9116203162, 0.25), -- Lake Lap Water Movement 2
|
||
wind = S(9113286782, 0.18), -- Barstow Wind Light Blustery Low Howl 1
|
||
rainLight = S(9112852668, 0.45), -- Rain Continuous Drizzle 1
|
||
rainHeavy = S(9112853287, 0.55), -- Rain Heavy 1
|
||
fire = S(9112780193, 0.6, { roll = 30 }), -- Fireplace Constant Burning Flame 1 (слышно у костра)
|
||
thunder = { "rbxassetid://9116282875", "rbxassetid://9116282646", "rbxassetid://9116282791", "rbxassetid://9116282544" },
|
||
-- рыбалка
|
||
cast = S(9120718279, 0.5, { pitch = { 0.9, 1.1 } }), -- Whoosh Fast Swish By 1
|
||
bite = S(9112751536, 0.7, { pitch = { 0.9, 1.15 } }), -- Bubble Bloop High Pitched Cute 1
|
||
reel = S(9114454019, 0.4), -- Fishing Reel 4 (петля, пока тянешь)
|
||
catchSplash = S(9119293555, 0.6), -- Small Splash Shallow Water
|
||
catch = S(9126073001, 0.5), -- Bell Tone Ding
|
||
fanfare = S(1836473422, 0.45), -- Victory Fanfare Sting (редкая рыба)
|
||
sparkle = S(9114369623, 0.5), -- Fairy Dust 1 (мутация)
|
||
escape = S(9117944976, 0.5), -- Puddle Splash 2 (сорвалась)
|
||
-- интерфейс
|
||
click = S(15675032796, 0.5), -- Roblox_UI_Small_Click
|
||
open = S(9117231552, 0.45), -- Paper Scroll Unroll Handle 4
|
||
coins = S(9113849306, 0.6), -- Coins Or Keys Jingle 1
|
||
levelUp = S(1840525342, 0.5), -- Harp Glissando (A)
|
||
quest = S(9126073318, 0.5), -- Bell Tone Ding 2
|
||
}
|
||
Config.DefaultVolume = { music = 0.6, sfx = 0.8 }
|
||
|
||
---------------------------------------------------------------- донат (Robux)
|
||
-- ВАЖНО: впиши сюда ID своих пропусков и товаров с create.roblox.com.
|
||
-- Пока id = 0, кнопка покупки покажет подсказку, что товар не настроен.
|
||
Config.GamePasses = {
|
||
{ key = "VIP", id = 0, robux = 199, icon = "👑", name = "VIP", desc = "+25% удачи и монет, корона над головой" },
|
||
{ key = "DoubleCoins", id = 0, robux = 299, icon = "💰", name = "x2 Монеты", desc = "Вся рыба продаётся в 2 раза дороже" },
|
||
{ key = "LuckyCharm", id = 0, robux = 349, icon = "🍀", name = "Талисман удачи", desc = "+50% удачи навсегда" },
|
||
{ key = "BigBag", id = 0, robux = 149, icon = "🎒", name = "Бездонная сумка", desc = "+100 мест в любой сумке" },
|
||
}
|
||
Config.Products = {
|
||
{ key = "Coins1", id = 0, robux = 49, icon = "🪙", name = "Мешок монет", desc = "+1 000 монет (больше с уровнем)", coins = 1000 },
|
||
{ key = "Coins2", id = 0, robux = 199, icon = "💰", name = "Сундук монет", desc = "+5 000 монет (больше с уровнем)", coins = 5000 },
|
||
{ key = "Coins3", id = 0, robux = 599, icon = "🏆", name = "Гора золота", desc = "+20 000 монет (больше с уровнем)", coins = 20000 },
|
||
{ key = "Luck", id = 0, robux = 99, icon = "🧪", name = "Супер-зелье удачи", desc = "+200% удачи на 15 минут", boost = 2.0, duration = 900 },
|
||
}
|
||
|
||
---------------------------------------------------------------- рыбалка
|
||
Config.BiteTimeMin = 3
|
||
Config.BiteTimeMax = 7
|
||
Config.BiteTimeout = 12
|
||
Config.MaxMisses = 2
|
||
-- заброс: держишь ЛКМ — сила ездит 0 → 1 → 0 → …; от силы в момент отпускания зависит дальность
|
||
Config.CastChargeTime = 1.3 -- секунд на проход шкалы в одну сторону
|
||
Config.CastMinDist, Config.CastMaxDist = 6, 28
|
||
Config.CastReach = 7 -- закидывать можно не дальше ~2 м (7 studs) от воды
|
||
Config.CastPerfect = { 0.72, 0.86 } -- зелёная зона шкалы
|
||
Config.CastPerfectLuck = 1.2 -- множитель удачи за попадание в зелёную зону
|
||
|
||
-- обучение: линия-подсказка ведёт по шагам 0 → 1 → 2 → 3, на 4 обучение пройдено
|
||
-- 0 — табличка «Как играть», 1 — портал в Мир 1, 2 — причал (поймать рыбу), 3 — скупка (продать)
|
||
Config.TutorialDone = 4
|
||
function Config.HitsNeeded(rank)
|
||
return math.ceil(rank / 2)
|
||
end
|
||
function Config.XPForLevel(level)
|
||
return 60 + level * 60
|
||
end
|
||
|
||
---------------------------------------------------------------- помощники
|
||
function Config.Find(list, id)
|
||
for _, item in ipairs(list) do
|
||
if item.id == id or item.key == id then
|
||
return item
|
||
end
|
||
end
|
||
return nil
|
||
end
|
||
|
||
function Config.FindFish(fishId)
|
||
for zoneId, zone in pairs(Config.Zones) do
|
||
for _, f in ipairs(zone.fish) do
|
||
if f.id == fishId then
|
||
return f, zoneId
|
||
end
|
||
end
|
||
end
|
||
return nil
|
||
end
|
||
|
||
function Config.RodStats(rodId, upgradeLevel)
|
||
local rod = Config.Find(Config.Rods, rodId) or Config.Rods[1]
|
||
local u = Config.RodUpgrade
|
||
upgradeLevel = upgradeLevel or 0
|
||
return {
|
||
luck = rod.luck + u.luckPerLevel * upgradeLevel,
|
||
speed = rod.speed * (u.speedPerLevel ^ upgradeLevel),
|
||
zone = rod.zone + u.zonePerLevel * upgradeLevel,
|
||
}
|
||
end
|
||
|
||
return Config
|
||
]=====])
|
||
put('ModuleScript', 'GameModels', game.ReplicatedStorage, [=====[-- 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 = { 6, 9, 12, 16, 20, 25, 30, 36 }
|
||
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
|
||
]=====])
|
||
put('Script', 'GameServer', game.ServerScriptService, [=====[-- GameServer (Script) -> ServerScriptService
|
||
-- Логика игры: данные, удача, рыбалка с анимацией, сумка, магазин, улучшения,
|
||
-- коллекция с наградами, задания, ежедневная награда, события, миры, донат.
|
||
|
||
local Players = game:GetService("Players")
|
||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||
local DataStoreService = game:GetService("DataStoreService")
|
||
local ProximityPromptService = game:GetService("ProximityPromptService")
|
||
local TweenService = game:GetService("TweenService")
|
||
local RunService = game:GetService("RunService")
|
||
local MarketplaceService = game:GetService("MarketplaceService")
|
||
local Debris = game:GetService("Debris")
|
||
|
||
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||
local Models = require(ReplicatedStorage:WaitForChild("GameModels"))
|
||
|
||
local remote = ReplicatedStorage:FindFirstChild("GameEvent") or Instance.new("RemoteEvent")
|
||
remote.Name = "GameEvent"
|
||
remote.Parent = ReplicatedStorage
|
||
|
||
local rng = Random.new()
|
||
local GOLD = Color3.fromRGB(255, 220, 80)
|
||
local RED = Color3.fromRGB(255, 120, 120)
|
||
local GREEN = Color3.fromRGB(120, 255, 140)
|
||
local SPLASH_SOUND = "rbxasset://sounds/impact_water.mp3"
|
||
|
||
---------------------------------------------------------------- данные
|
||
|
||
local store = nil
|
||
pcall(function()
|
||
store = DataStoreService:GetDataStore("FishingGame_v2")
|
||
end)
|
||
|
||
local profiles = {}
|
||
local loadedOk = {}
|
||
local passes = {}
|
||
|
||
local function defaultData()
|
||
return {
|
||
coins = 0, level = 1, xp = 0,
|
||
rod = "Basic", rods = { Basic = true }, rodLevels = {},
|
||
bag = "Pouch", bags = { Pouch = true },
|
||
items = {}, discovered = {}, claimed = {},
|
||
chain = { index = 1, step = 1, progress = 0, tier = 0 }, daily = { last = 0, streak = 0 },
|
||
boostUntil = 0, boostBonus = 0,
|
||
totalCaught = 0, nextUid = 1, receipts = {},
|
||
settings = { music = Config.DefaultVolume.music, sfx = Config.DefaultVolume.sfx },
|
||
}
|
||
end
|
||
|
||
local function loadData(player)
|
||
local data = defaultData()
|
||
if not store then
|
||
return data, false
|
||
end
|
||
local ok, saved = pcall(function()
|
||
return store:GetAsync("player_" .. player.UserId)
|
||
end)
|
||
if not ok then
|
||
warn("Не удалось загрузить данные " .. player.Name .. ": " .. tostring(saved))
|
||
return data, false
|
||
end
|
||
if type(saved) == "table" then
|
||
for k, v in pairs(saved) do
|
||
data[k] = v
|
||
end
|
||
end
|
||
return data, true
|
||
end
|
||
|
||
local function saveData(player)
|
||
local data = profiles[player]
|
||
if not store or not data or not loadedOk[player] then
|
||
return
|
||
end
|
||
local ok, err = pcall(function()
|
||
store:SetAsync("player_" .. player.UserId, data)
|
||
end)
|
||
if not ok then
|
||
warn("Не удалось сохранить данные " .. player.Name .. ": " .. tostring(err))
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- пропуска и события
|
||
|
||
local function hasPass(player, key)
|
||
return passes[player] ~= nil and passes[player][key] == true
|
||
end
|
||
|
||
local function loadPasses(player)
|
||
passes[player] = {}
|
||
for _, gp in ipairs(Config.GamePasses) do
|
||
if gp.id and gp.id > 0 then
|
||
local ok, owns = pcall(function()
|
||
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, gp.id)
|
||
end)
|
||
if ok and owns then
|
||
passes[player][gp.key] = true
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
local currentEvent = nil
|
||
local function ev(field, default)
|
||
return (currentEvent and currentEvent[field]) or default
|
||
end
|
||
|
||
-- погода и время суток (их ведёт WeatherServer через атрибуты workspace)
|
||
local function weather()
|
||
return Config.WeatherById(workspace:GetAttribute("Weather"))
|
||
end
|
||
local function isNight()
|
||
if not Config.DayNight.enabled then
|
||
return false
|
||
end
|
||
return Config.IsNight(Config.ClockAt(workspace:GetServerTimeNow(), workspace:GetAttribute("DayStart")))
|
||
end
|
||
|
||
---------------------------------------------------------------- расчёты
|
||
|
||
local function rodLevel(data, rodId)
|
||
return data.rodLevels[rodId or data.rod] or 0
|
||
end
|
||
|
||
local function boostActive(data)
|
||
return data.boostUntil > os.time() and data.boostBonus or 0
|
||
end
|
||
|
||
local function masteryCount(data)
|
||
local n = 0
|
||
for key in pairs(data.claimed) do
|
||
if string.find(key, ":Master", 1, true) then
|
||
n += 1
|
||
end
|
||
end
|
||
return n
|
||
end
|
||
|
||
local function totalLuck(player, data)
|
||
local stats = Config.RodStats(data.rod, rodLevel(data))
|
||
local l = 1 + stats.luck + (data.level - 1) * Config.LuckPerPlayerLevel + boostActive(data) + masteryCount(data) * Config.MasteryLuck
|
||
if hasPass(player, "VIP") then
|
||
l += 0.25
|
||
end
|
||
if hasPass(player, "LuckyCharm") then
|
||
l += 0.5
|
||
end
|
||
return l + ev("luck", 0) + (weather().luck or 0) + (isNight() and Config.DayNight.nightLuck or 0)
|
||
end
|
||
|
||
local function bagCapacity(player, data)
|
||
local bag = Config.Find(Config.Bags, data.bag) or Config.Bags[1]
|
||
return bag.capacity + (hasPass(player, "BigBag") and 100 or 0)
|
||
end
|
||
|
||
local function sellMult(player)
|
||
local m = ev("sell", 1)
|
||
if hasPass(player, "VIP") then
|
||
m *= 1.25
|
||
end
|
||
if hasPass(player, "DoubleCoins") then
|
||
m *= 2
|
||
end
|
||
return m
|
||
end
|
||
|
||
local function notify(player, text, color)
|
||
remote:FireClient(player, "Notify", text, color or Color3.new(1, 1, 1))
|
||
end
|
||
|
||
local function today()
|
||
return math.floor(os.time() / 86400)
|
||
end
|
||
|
||
local function sendInventory(player)
|
||
local data = profiles[player]
|
||
if data then
|
||
remote:FireClient(player, "Inventory", data.items, data.discovered, data.claimed)
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- цепочки заданий
|
||
|
||
local function levelMult(data)
|
||
return 1 + (data.level - 1) * 0.25
|
||
end
|
||
|
||
local function currentChain(data)
|
||
local c = data.chain
|
||
local chain = Config.QuestChains[(c.index - 1) % #Config.QuestChains + 1]
|
||
return chain, chain.steps[c.step]
|
||
end
|
||
|
||
local function stepGoal(data, step)
|
||
local kind = Config.QuestKinds[step[1]]
|
||
local g = step[2] * (1 + Config.QuestTierGrowth * data.chain.tier)
|
||
if kind.byLevel then
|
||
g *= levelMult(data)
|
||
end
|
||
g = math.ceil(g)
|
||
return kind.max and math.min(g, kind.max) or g
|
||
end
|
||
|
||
local function stepReward(data, step, goal)
|
||
local kind = Config.QuestKinds[step[1]]
|
||
local m = levelMult(data)
|
||
return math.max(10, math.floor(kind.coins * goal * m)), math.max(10, math.floor(kind.xp * goal * m))
|
||
end
|
||
|
||
local function chainBonus(data)
|
||
local b = Config.ChainBonus
|
||
local m = levelMult(data) * (1 + Config.QuestTierGrowth * data.chain.tier)
|
||
return math.floor(b.coins * m), math.floor(b.xp * m), b.potion and Config.Find(Config.Potions, b.potion)
|
||
end
|
||
|
||
local function sendQuests(player)
|
||
local data = profiles[player]
|
||
if not data then
|
||
return
|
||
end
|
||
local chain = currentChain(data)
|
||
local steps = {}
|
||
for i, st in ipairs(chain.steps) do
|
||
local goal = stepGoal(data, st)
|
||
local coins, xp = stepReward(data, st, goal)
|
||
steps[i] = { kind = st[1], goal = goal, coins = coins, xp = xp }
|
||
end
|
||
local bCoins, bXp, potion = chainBonus(data)
|
||
local t = today()
|
||
remote:FireClient(player, "Quests", {
|
||
name = chain.name, round = data.chain.tier + 1, step = data.chain.step, progress = data.chain.progress,
|
||
steps = steps, bonus = { coins = bCoins, xp = bXp, potion = potion and potion.name },
|
||
}, {
|
||
available = data.daily.last < t,
|
||
streak = data.daily.streak,
|
||
nextStreak = (data.daily.last == t - 1) and (data.daily.streak % 7 + 1) or ((data.daily.last < t) and 1 or data.daily.streak),
|
||
})
|
||
end
|
||
|
||
local function updateStats(player)
|
||
local data = profiles[player]
|
||
if not data then
|
||
return
|
||
end
|
||
local bagValue = 0
|
||
for _, item in ipairs(data.items) do
|
||
bagValue += item.value
|
||
end
|
||
local owned, lv, bags, ps = {}, {}, {}, {}
|
||
for id in pairs(data.rods) do
|
||
table.insert(owned, id)
|
||
table.insert(lv, id .. ":" .. rodLevel(data, id))
|
||
end
|
||
for id in pairs(data.bags) do
|
||
table.insert(bags, id)
|
||
end
|
||
for key in pairs(passes[player] or {}) do
|
||
table.insert(ps, key)
|
||
end
|
||
|
||
player:SetAttribute("Coins", data.coins)
|
||
player:SetAttribute("Level", data.level)
|
||
player:SetAttribute("XP", data.xp)
|
||
player:SetAttribute("XPNeed", Config.XPForLevel(data.level))
|
||
player:SetAttribute("Rod", data.rod)
|
||
player:SetAttribute("RodLevel", rodLevel(data))
|
||
player:SetAttribute("RodLevels", table.concat(lv, ","))
|
||
player:SetAttribute("OwnedRods", table.concat(owned, ","))
|
||
player:SetAttribute("Bag", data.bag)
|
||
player:SetAttribute("OwnedBags", table.concat(bags, ","))
|
||
player:SetAttribute("BagCount", #data.items)
|
||
player:SetAttribute("BagCap", bagCapacity(player, data))
|
||
player:SetAttribute("BagValue", math.floor(bagValue * sellMult(player)))
|
||
player:SetAttribute("Luck", math.floor(totalLuck(player, data) * 100 + 0.5))
|
||
player:SetAttribute("BoostBonus", boostActive(data))
|
||
player:SetAttribute("BoostLeft", math.max(0, data.boostUntil - os.time()))
|
||
player:SetAttribute("TotalCaught", data.totalCaught)
|
||
-- шаг обучения (линия-подсказка); у старых игроков без поля, уже ловивших рыбу, обучение пройдено
|
||
player:SetAttribute("Tutorial", data.tutorial or (data.totalCaught > 0 and Config.TutorialDone or 0))
|
||
player:SetAttribute("Mastery", masteryCount(data))
|
||
player:SetAttribute("Passes", table.concat(ps, ","))
|
||
|
||
local ls = player:FindFirstChild("leaderstats")
|
||
if ls then
|
||
ls["Монеты"].Value = data.coins
|
||
ls["Уровень"].Value = data.level
|
||
ls["Улов"].Value = data.totalCaught
|
||
end
|
||
end
|
||
|
||
local function addXp(player, data, amount)
|
||
data.xp += amount
|
||
local leveled = false
|
||
while data.xp >= Config.XPForLevel(data.level) do
|
||
data.xp -= Config.XPForLevel(data.level)
|
||
data.level += 1
|
||
leveled = true
|
||
end
|
||
if leveled then
|
||
notify(player, "⭐ Уровень " .. data.level .. "!", GOLD)
|
||
for _, w in ipairs(Config.Worlds) do
|
||
if w.level == data.level and not w.soon then
|
||
notify(player, "🌍 Открыт: " .. w.icon .. " " .. w.name, w.color)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
local function applyPotion(data, bonus, duration)
|
||
data.boostBonus = math.max(boostActive(data), bonus)
|
||
data.boostUntil = math.max(os.time(), data.boostUntil) + duration
|
||
end
|
||
|
||
---------------------------------------------------------------- задания: прогресс цепочки
|
||
|
||
-- у старых сохранений вместо цепочки были три случайных задания
|
||
local function ensureChain(data)
|
||
if type(data.chain) ~= "table" then
|
||
data.chain = { index = 1, step = 1, progress = 0, tier = 0 }
|
||
end
|
||
data.quests = nil
|
||
end
|
||
|
||
-- absolute = true: amount — текущее значение (серия), а не прибавка
|
||
local function questProgress(player, kind, amount, absolute)
|
||
local data = profiles[player]
|
||
if not data then
|
||
return
|
||
end
|
||
local chain, step = currentChain(data)
|
||
if step[1] ~= kind then
|
||
return
|
||
end
|
||
local c = data.chain
|
||
c.progress = absolute and math.max(c.progress, amount) or c.progress + amount
|
||
local goal = stepGoal(data, step)
|
||
if c.progress >= goal then
|
||
-- награда сразу, следующий шаг тоже сразу
|
||
local coins, xp = stepReward(data, step, goal)
|
||
data.coins += coins
|
||
addXp(player, data, xp)
|
||
remote:FireClient(player, "QuestDone", kind, goal, coins, xp)
|
||
c.step += 1
|
||
c.progress = 0
|
||
if c.step > #chain.steps then
|
||
local bCoins, bXp, potion = chainBonus(data)
|
||
data.coins += bCoins
|
||
addXp(player, data, bXp)
|
||
if potion then
|
||
applyPotion(data, potion.bonus, potion.duration)
|
||
end
|
||
remote:FireClient(player, "ChainDone", chain.name, bCoins, bXp, potion and potion.name)
|
||
c.index += 1
|
||
c.step = 1
|
||
if (c.index - 1) % #Config.QuestChains == 0 then
|
||
c.tier += 1
|
||
end
|
||
end
|
||
updateStats(player)
|
||
end
|
||
sendQuests(player)
|
||
end
|
||
|
||
local function claimDaily(player)
|
||
local data = profiles[player]
|
||
if not data then
|
||
return
|
||
end
|
||
local t = today()
|
||
if data.daily.last >= t then
|
||
notify(player, "🎁 Приходи завтра", Color3.fromRGB(255, 200, 120))
|
||
return
|
||
end
|
||
local streak = (data.daily.last == t - 1) and (data.daily.streak % 7 + 1) or 1
|
||
local r = Config.DailyRewards[streak]
|
||
local coins = math.floor(r.coins * (1 + (data.level - 1) * 0.2))
|
||
data.coins += coins
|
||
local extra = ""
|
||
if r.potion then
|
||
local p = Config.Find(Config.Potions, r.potion)
|
||
if p then
|
||
applyPotion(data, p.bonus, p.duration)
|
||
extra = " + " .. p.name
|
||
end
|
||
end
|
||
data.daily = { last = t, streak = streak }
|
||
updateStats(player)
|
||
sendQuests(player)
|
||
notify(player, ("🎁 День %d: +%d 💰%s"):format(streak, coins, extra), GOLD)
|
||
end
|
||
|
||
---------------------------------------------------------------- коллекция
|
||
|
||
local function claimCollection(player, worldId, rarity)
|
||
local data = profiles[player]
|
||
local world = data and Config.Find(Config.Worlds, worldId)
|
||
local zone = world and Config.Zones[worldId]
|
||
if not zone or type(rarity) ~= "string" then
|
||
return
|
||
end
|
||
local key = worldId .. ":" .. rarity
|
||
if data.claimed[key] then
|
||
return
|
||
end
|
||
for _, f in ipairs(zone.fish) do
|
||
if (rarity == "Master" or f.rarity == rarity) and not data.discovered[f.id] then
|
||
notify(player, "Сначала поймай всех", RED)
|
||
return
|
||
end
|
||
end
|
||
data.claimed[key] = true
|
||
if rarity == "Master" then
|
||
local coins = Config.MasteryCoins * world.mult
|
||
data.coins += coins
|
||
notify(player, ("🏆 «%s» собран! +%d 💰"):format(world.name, coins), GOLD)
|
||
else
|
||
local r = Config.CollectionRewards[rarity]
|
||
if not r then
|
||
return
|
||
end
|
||
data.coins += r.coins * world.mult
|
||
addXp(player, data, r.xp * world.mult)
|
||
notify(player, ("📖 +%d 💰 +%d XP"):format(r.coins * world.mult, r.xp * world.mult), GREEN)
|
||
end
|
||
updateStats(player)
|
||
sendInventory(player)
|
||
end
|
||
|
||
---------------------------------------------------------------- удочка, сумка, VIP на персонаже
|
||
|
||
local REST_ANGLE = 30
|
||
local function gripCF(angle)
|
||
return (CFrame.Angles(math.rad(angle), 0, 0) * CFrame.new(0, 0, -0.3)):Inverse()
|
||
end
|
||
local function tweenGrip(tool, angle, t)
|
||
if not tool or not tool.Parent then
|
||
return nil
|
||
end
|
||
local tw = TweenService:Create(tool, TweenInfo.new(t, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), { Grip = gripCF(angle) })
|
||
tw:Play()
|
||
return tw
|
||
end
|
||
local function gripSequence(tool, steps)
|
||
task.spawn(function()
|
||
for _, s in ipairs(steps) do
|
||
local tw = tweenGrip(tool, s[1], s[2])
|
||
if not tw then
|
||
return
|
||
end
|
||
tw.Completed:Wait()
|
||
end
|
||
end)
|
||
end
|
||
|
||
local function findRodTool(player)
|
||
for _, container in ipairs({ player.Character, player:FindFirstChild("Backpack") }) do
|
||
if container then
|
||
for _, child in ipairs(container:GetChildren()) do
|
||
if child:IsA("Tool") and child:GetAttribute("IsRod") then
|
||
return child
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return nil
|
||
end
|
||
|
||
local function giveRodTool(player)
|
||
local data = profiles[player]
|
||
local backpack = player:FindFirstChild("Backpack")
|
||
if not data or not backpack then
|
||
return
|
||
end
|
||
local old = findRodTool(player)
|
||
local wasEquipped = old ~= nil and old.Parent == player.Character
|
||
if old then
|
||
old:Destroy()
|
||
end
|
||
local rod = Config.Find(Config.Rods, data.rod) or Config.Rods[1]
|
||
local lvl = rodLevel(data)
|
||
local model = Models.buildRod(rod.id, lvl, false)
|
||
local tool = Instance.new("Tool")
|
||
tool.Name = rod.name .. (lvl > 0 and (" +" .. lvl) or "")
|
||
tool.ToolTip = "Кликни у воды, чтобы закинуть"
|
||
tool.CanBeDropped = false
|
||
tool.Grip = gripCF(REST_ANGLE)
|
||
tool:SetAttribute("IsRod", true)
|
||
for _, child in ipairs(model:GetChildren()) do
|
||
child.Parent = tool
|
||
end
|
||
model:Destroy()
|
||
tool.Parent = backpack
|
||
if wasEquipped then
|
||
local hum = player.Character and player.Character:FindFirstChildOfClass("Humanoid")
|
||
if hum then
|
||
hum:EquipTool(tool)
|
||
end
|
||
end
|
||
end
|
||
|
||
local function attachBag(player)
|
||
local data = profiles[player]
|
||
local char = player.Character
|
||
if not data or not char then
|
||
return
|
||
end
|
||
local old = char:FindFirstChild("BackBag")
|
||
if old then
|
||
old:Destroy()
|
||
end
|
||
local torso = char:FindFirstChild("UpperTorso") or char:FindFirstChild("Torso")
|
||
if not torso then
|
||
return
|
||
end
|
||
local bag = Models.buildBag(data.bag, false)
|
||
local offset = CFrame.new(0, 0.1, torso.Size.Z / 2)
|
||
bag:PivotTo(torso.CFrame * offset)
|
||
local w = Instance.new("Weld")
|
||
w.Part0 = torso
|
||
w.Part1 = bag.PrimaryPart
|
||
w.C0 = offset
|
||
w.Parent = bag.PrimaryPart
|
||
bag.Parent = char
|
||
end
|
||
|
||
local function vipTag(player)
|
||
local head = player.Character and player.Character:FindFirstChild("Head")
|
||
if not head or not hasPass(player, "VIP") or head:FindFirstChild("VipTag") then
|
||
return
|
||
end
|
||
local bb = Instance.new("BillboardGui")
|
||
bb.Name = "VipTag"
|
||
bb.Size = UDim2.fromOffset(120, 30)
|
||
bb.StudsOffset = Vector3.new(0, 2.6, 0)
|
||
bb.MaxDistance = 80
|
||
bb.Parent = head
|
||
local t = Instance.new("TextLabel")
|
||
t.Size = UDim2.fromScale(1, 1)
|
||
t.BackgroundTransparency = 1
|
||
t.Font = Enum.Font.FredokaOne
|
||
t.TextScaled = true
|
||
t.TextColor3 = Color3.fromRGB(255, 210, 60)
|
||
t.TextStrokeTransparency = 0.2
|
||
t.Text = "👑 VIP"
|
||
t.Parent = bb
|
||
end
|
||
|
||
---------------------------------------------------------------- эффекты
|
||
|
||
local function playSound(parent, id, volume)
|
||
local snd = Instance.new("Sound")
|
||
snd.SoundId = id
|
||
snd.Volume = volume or 0.6
|
||
snd.Parent = parent
|
||
snd:Play()
|
||
Debris:AddItem(snd, 3)
|
||
end
|
||
|
||
local function splash(part, count)
|
||
local att = Instance.new("Attachment")
|
||
att.Parent = part
|
||
local pe = Instance.new("ParticleEmitter")
|
||
pe.Color = ColorSequence.new(Color3.fromRGB(220, 240, 255))
|
||
pe.Transparency = NumberSequence.new(0.2, 1)
|
||
pe.Size = NumberSequence.new(0.4, 0.1)
|
||
pe.Lifetime = NumberRange.new(0.4, 0.7)
|
||
pe.Speed = NumberRange.new(6, 10)
|
||
pe.SpreadAngle = Vector2.new(40, 40)
|
||
pe.Acceleration = Vector3.new(0, -35, 0)
|
||
pe.Enabled = false
|
||
pe.Parent = att
|
||
pe:Emit(count or 20)
|
||
Debris:AddItem(att, 2)
|
||
end
|
||
|
||
-- рыба вылетает из воды, летит к игроку и показывается над головой
|
||
-- шлейф за летящим предметом — эффект быстрого движения (ширина — расстояние между точками крепления)
|
||
local TRAIL_COLOR = Color3.fromRGB(215, 245, 255)
|
||
local function addTrail(part, width)
|
||
local a0 = Instance.new("Attachment")
|
||
a0.Position = Vector3.new(0, width / 2, 0)
|
||
a0.Parent = part
|
||
local a1 = Instance.new("Attachment")
|
||
a1.Position = Vector3.new(0, -width / 2, 0)
|
||
a1.Parent = part
|
||
local trail = Instance.new("Trail")
|
||
trail.Attachment0, trail.Attachment1 = a0, a1
|
||
trail.FaceCamera = true
|
||
trail.Lifetime = 0.35
|
||
trail.MinLength = 0.05
|
||
trail.LightEmission = 0.7
|
||
trail.Color = ColorSequence.new(TRAIL_COLOR)
|
||
trail.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.1), NumberSequenceKeypoint.new(1, 1) })
|
||
trail.WidthScale = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(1, 0) })
|
||
trail.Parent = part
|
||
return trail
|
||
end
|
||
|
||
local function showFishFlight(player, fish, fromPos)
|
||
local head = player.Character and player.Character:FindFirstChild("Head")
|
||
if not head then
|
||
return
|
||
end
|
||
local model = Models.buildFish(fish.id, fish.mutation, 0.9, true)
|
||
model:PivotTo(CFrame.new(fromPos))
|
||
model.Parent = workspace
|
||
-- шлейф на отдельной невидимой детали: рыба крутится, а шлейф должен оставаться ровным
|
||
local carrier = Instance.new("Part")
|
||
carrier.Anchored, carrier.CanCollide, carrier.CanQuery, carrier.CanTouch = true, false, false, false
|
||
carrier.Transparency = 1
|
||
carrier.Size = Vector3.new(0.2, 0.2, 0.2)
|
||
carrier.CFrame = CFrame.new(fromPos)
|
||
carrier.Parent = model
|
||
local trail = addTrail(carrier, 1.8)
|
||
task.spawn(function()
|
||
local t0, dur = os.clock(), 0.55
|
||
while head.Parent do
|
||
local a = math.min(1, (os.clock() - t0) / dur)
|
||
local target = head.Position + Vector3.new(0, 2.8, 0)
|
||
local p = fromPos:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * 8, 0)
|
||
model:PivotTo(CFrame.new(p) * CFrame.Angles(0, 0, a * math.pi * 2))
|
||
carrier.CFrame = CFrame.new(p)
|
||
if a >= 1 then
|
||
break
|
||
end
|
||
RunService.Heartbeat:Wait()
|
||
end
|
||
trail.Enabled = false
|
||
local t1 = os.clock()
|
||
while head.Parent and os.clock() - t1 < 1.8 do
|
||
model:PivotTo(CFrame.new(head.Position + Vector3.new(0, 2.8, 0)) * CFrame.Angles(0, os.clock() * 3, math.rad(-15)))
|
||
RunService.Heartbeat:Wait()
|
||
end
|
||
model:Destroy()
|
||
end)
|
||
end
|
||
|
||
---------------------------------------------------------------- рыбалка
|
||
|
||
local fishing = {}
|
||
|
||
-- серия улова (на время игры, не сохраняется)
|
||
local combo, comboUntil = {}, {}
|
||
local function setCombo(player, n)
|
||
combo[player] = n
|
||
comboUntil[player] = n > 0 and os.time() + Config.Combo.timeout or nil
|
||
player:SetAttribute("Combo", n)
|
||
player:SetAttribute("ComboEnds", n > 0 and workspace:GetServerTimeNow() + Config.Combo.timeout or nil)
|
||
end
|
||
local function breakCombo(player)
|
||
if (combo[player] or 0) >= 2 then
|
||
remote:FireClient(player, "ComboLost", combo[player])
|
||
end
|
||
setCombo(player, 0)
|
||
end
|
||
|
||
-- босс озера: { world, def, hp, max, dmg = { [player] = урон } }
|
||
local boss = nil
|
||
local function bossHit(player, world, dmg)
|
||
if not boss or boss.hp <= 0 or not world or world.id ~= boss.world.id then
|
||
return
|
||
end
|
||
boss.hp = math.max(0, boss.hp - dmg)
|
||
boss.dmg[player] = (boss.dmg[player] or 0) + dmg
|
||
workspace:SetAttribute("BossHP", boss.hp)
|
||
remote:FireClient(player, "BossHit", dmg)
|
||
questProgress(player, "boss", dmg)
|
||
end
|
||
|
||
-- ищем воду по карте мира из FishConfig (не зависит от террейна) в сторону центра ближайшего озера:
|
||
-- сначала на дальности, которую задала сила заброса, потом всё дальше от неё
|
||
local function findWater(hrp, world, power)
|
||
local look = Config.CastDirection(world, hrp.Position)
|
||
if not look then
|
||
look = hrp.CFrame.LookVector * Vector3.new(1, 0, 1)
|
||
look = look.Magnitude > 0.01 and look.Unit or Vector3.new(0, 0, -1)
|
||
end
|
||
local want = Config.CastMinDist + (Config.CastMaxDist - Config.CastMinDist) * power
|
||
for off = 0, 26, 2 do
|
||
for _, d in ipairs({ want - off, want + off }) do
|
||
if d >= 4 and d <= Config.CastMaxDist + 2 then
|
||
local p = hrp.Position + look * d
|
||
if Config.IsWater(world, p) then
|
||
return Vector3.new(p.X, world.waterY or 0, p.Z), d
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return nil
|
||
end
|
||
|
||
-- вытягивание пустого поплавка: быстро летит к кончику удочки со шлейфом и исчезает
|
||
local function reelBobber(bobber, tool)
|
||
local root = bobber and bobber.PrimaryPart
|
||
local tip = tool and tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip")
|
||
if not root or not tip then
|
||
if bobber then
|
||
bobber:Destroy()
|
||
end
|
||
return
|
||
end
|
||
local trail = bobber:FindFirstChildWhichIsA("Trail", true)
|
||
if trail then
|
||
trail.Enabled = true
|
||
else
|
||
addTrail(root, 1.2)
|
||
end
|
||
local from = root.Position
|
||
task.spawn(function()
|
||
local t0, dur = os.clock(), 0.3
|
||
while bobber.Parent and tip.Parent do
|
||
local a = math.min(1, (os.clock() - t0) / dur)
|
||
bobber:PivotTo(CFrame.new(from:Lerp(tip.WorldPosition, a) + Vector3.new(0, math.sin(a * math.pi) * 2.5, 0)))
|
||
if a >= 1 then
|
||
break
|
||
end
|
||
RunService.Heartbeat:Wait()
|
||
end
|
||
bobber:Destroy()
|
||
end)
|
||
end
|
||
|
||
local function stopFishing(player, tellClient)
|
||
local s = fishing[player]
|
||
if not s then
|
||
return
|
||
end
|
||
fishing[player] = nil
|
||
if s.tween then
|
||
s.tween:Cancel()
|
||
end
|
||
if s.bobber then
|
||
if s.stage == "casting" then
|
||
s.bobber:Destroy() -- ещё летит: его двигает flyBobber
|
||
else
|
||
reelBobber(s.bobber, s.tool)
|
||
end
|
||
end
|
||
if s.tool then
|
||
tweenGrip(s.tool, REST_ANGLE, 0.3)
|
||
end
|
||
if tellClient then
|
||
remote:FireClient(player, "Cancel")
|
||
end
|
||
end
|
||
|
||
local function rollFish(player, data, worldId, luckMult)
|
||
local zone = Config.Zones[worldId]
|
||
if not zone then
|
||
return nil
|
||
end
|
||
local luck = totalLuck(player, data) * (luckMult or 1)
|
||
local bonus = luck - 1
|
||
local weights, total = {}, 0
|
||
for i, f in ipairs(zone.fish) do
|
||
local r = Config.Rarities[f.rarity]
|
||
local w = r.weight * math.max(0.2, 1 + bonus * (r.rank - 1))
|
||
if r.rank == 1 then
|
||
w = r.weight / math.max(1, luck)
|
||
end
|
||
weights[i] = w
|
||
total += w
|
||
end
|
||
local roll = rng:NextNumber() * total
|
||
local chosen = zone.fish[1]
|
||
for i, f in ipairs(zone.fish) do
|
||
roll -= weights[i]
|
||
if roll <= 0 then
|
||
chosen = f
|
||
break
|
||
end
|
||
end
|
||
local mutation = nil
|
||
for _, m in ipairs(Config.Mutations) do
|
||
if rng:NextNumber() < m.chance * luck * ev("mutation", 1) * (weather().mutation or 1) then
|
||
mutation = m
|
||
break
|
||
end
|
||
end
|
||
local wf = rng:NextNumber() ^ 2.2
|
||
local weight = chosen.minW + (chosen.maxW - chosen.minW) * wf
|
||
return {
|
||
id = chosen.id,
|
||
name = chosen.name,
|
||
rarity = chosen.rarity,
|
||
weight = math.floor(weight * 100) / 100,
|
||
value = math.floor(chosen.price * (0.75 + 0.9 * wf) * (mutation and mutation.mult or 1) + 0.5),
|
||
xp = chosen.xp * (mutation and 2 or 1),
|
||
mutation = mutation and mutation.id or nil,
|
||
world = worldId,
|
||
}
|
||
end
|
||
|
||
local function flyBobber(s, tool, target, dur, arc)
|
||
local tip = tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip")
|
||
local start = tip and tip.WorldPosition or (target + Vector3.new(0, 6, 0))
|
||
local bobber = Models.buildBobber()
|
||
bobber:PivotTo(CFrame.new(start))
|
||
bobber.Parent = workspace
|
||
s.bobber = bobber
|
||
local trail = addTrail(bobber.PrimaryPart, 1.2)
|
||
if tip then
|
||
local a1 = Instance.new("Attachment")
|
||
a1.Position = Vector3.new(0, 0.9, 0)
|
||
a1.Parent = bobber.PrimaryPart
|
||
local line = Instance.new("Beam")
|
||
line.Attachment0 = tip
|
||
line.Attachment1 = a1
|
||
line.Width0 = 0.035
|
||
line.Width1 = 0.035
|
||
line.FaceCamera = true
|
||
line.Color = ColorSequence.new(Color3.fromRGB(245, 245, 245))
|
||
line.Parent = bobber
|
||
end
|
||
local t0 = os.clock()
|
||
while bobber.Parent do
|
||
local a = math.min(1, (os.clock() - t0) / dur)
|
||
bobber:PivotTo(CFrame.new(start:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * arc, 0)))
|
||
if a >= 1 then
|
||
break
|
||
end
|
||
RunService.Heartbeat:Wait()
|
||
end
|
||
trail.Enabled = false -- на воде поплавок качается, шлейф уже не нужен
|
||
if bobber.Parent then
|
||
splash(bobber.PrimaryPart, 18)
|
||
playSound(bobber.PrimaryPart, SPLASH_SOUND, 0.5)
|
||
end
|
||
end
|
||
|
||
local function onCast(player, power)
|
||
power = math.clamp(tonumber(power) or 0.6, 0, 1)
|
||
local data = profiles[player]
|
||
if not data then
|
||
return
|
||
end
|
||
if fishing[player] then
|
||
stopFishing(player, true)
|
||
return
|
||
end
|
||
local char = player.Character
|
||
local hrp = char and char:FindFirstChild("HumanoidRootPart")
|
||
local tool = char and char:FindFirstChildOfClass("Tool")
|
||
if not hrp or not tool or not tool:GetAttribute("IsRod") then
|
||
remote:FireClient(player, "CastFail")
|
||
return
|
||
end
|
||
local world = Config.WorldAt(hrp.Position)
|
||
local can = Config.CanCastFrom(world, hrp.Position)
|
||
if can ~= true then
|
||
remote:FireClient(player, "CastFail")
|
||
notify(player, can, Color3.fromRGB(255, 200, 120))
|
||
return
|
||
end
|
||
local target, dist = findWater(hrp, world, power)
|
||
if not target then
|
||
remote:FireClient(player, "CastFail")
|
||
notify(player, "🌊 Подойди к воде", Color3.fromRGB(255, 200, 120))
|
||
return
|
||
end
|
||
if #data.items >= bagCapacity(player, data) then
|
||
remote:FireClient(player, "CastFail")
|
||
notify(player, "🎒 Сумка полна!", RED)
|
||
return
|
||
end
|
||
|
||
local stats = Config.RodStats(data.rod, rodLevel(data))
|
||
local perfect = power >= Config.CastPerfect[1] and power <= Config.CastPerfect[2]
|
||
local fish = rollFish(player, data, world.id, perfect and Config.CastPerfectLuck or 1)
|
||
if not fish then
|
||
remote:FireClient(player, "CastFail")
|
||
return
|
||
end
|
||
local s = { stage = "casting", fish = fish, tool = tool, perfect = perfect }
|
||
fishing[player] = s
|
||
-- замах игрок уже сделал, пока держал кнопку (у себя на клиенте); здесь только бросок вперёд
|
||
local throw = { windup = 0.15, flight = 0.35 + dist * 0.018, arc = 2 + dist * 0.3, perfect = perfect }
|
||
local splashAt = target + Vector3.new(0, 0.15, 0)
|
||
remote:FireClient(player, "Cast", splashAt, throw) -- клиенту для камеры
|
||
|
||
task.spawn(function()
|
||
local tw = tweenGrip(tool, 8, throw.windup)
|
||
if tw then
|
||
tw.Completed:Wait()
|
||
end
|
||
if fishing[player] ~= s then
|
||
return
|
||
end
|
||
flyBobber(s, tool, splashAt, throw.flight, throw.arc)
|
||
tweenGrip(tool, REST_ANGLE - 5, 0.4)
|
||
if fishing[player] ~= s then
|
||
if s.bobber then
|
||
s.bobber:Destroy()
|
||
end
|
||
return
|
||
end
|
||
s.stage = "waiting"
|
||
|
||
local waitTime = rng:NextNumber(Config.BiteTimeMin, Config.BiteTimeMax) * stats.speed * ev("speed", 1) * (weather().speed or 1)
|
||
task.wait(waitTime)
|
||
if fishing[player] ~= s then
|
||
return
|
||
end
|
||
s.stage = "bite"
|
||
s.biteAt = os.clock()
|
||
if s.bobber and s.bobber.PrimaryPart then
|
||
local root = s.bobber.PrimaryPart
|
||
splash(root, 25)
|
||
playSound(root, SPLASH_SOUND, 0.35)
|
||
s.tween = TweenService:Create(root, TweenInfo.new(0.18, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, -1, true), {
|
||
CFrame = root.CFrame - Vector3.new(0, 0.55, 0),
|
||
})
|
||
s.tween:Play()
|
||
end
|
||
-- удочка дёргается, пока идёт вываживание
|
||
task.spawn(function()
|
||
local up = true
|
||
while fishing[player] == s and s.stage == "bite" do
|
||
tweenGrip(tool, up and 38 or 18, 0.12)
|
||
up = not up
|
||
task.wait(0.13)
|
||
end
|
||
end)
|
||
local rank = Config.Rarities[fish.rarity].rank
|
||
remote:FireClient(player, "Bite", {
|
||
speed = 0.55 + 0.22 * (rank - 1),
|
||
zoneWidth = math.max(0.07, stats.zone - 0.02 * (rank - 1)),
|
||
hits = Config.HitsNeeded(rank),
|
||
misses = Config.MaxMisses,
|
||
timeout = Config.BiteTimeout,
|
||
})
|
||
task.wait(Config.BiteTimeout + 0.5)
|
||
if fishing[player] == s and s.stage == "bite" then
|
||
stopFishing(player, false)
|
||
remote:FireClient(player, "Escaped")
|
||
notify(player, "🐟 Рыба ушла", RED)
|
||
breakCombo(player)
|
||
end
|
||
end)
|
||
end
|
||
|
||
local function onCatch(player, success, misses)
|
||
local s = fishing[player]
|
||
local data = profiles[player]
|
||
if not s or not data or s.stage ~= "bite" then
|
||
return
|
||
end
|
||
local fromPos = s.bobber and s.bobber.PrimaryPart and s.bobber.PrimaryPart.Position
|
||
s.stage = "done"
|
||
local tool = s.tool
|
||
fishing[player] = nil
|
||
if s.tween then
|
||
s.tween:Cancel()
|
||
end
|
||
local failed = success ~= true or os.clock() - s.biteAt > Config.BiteTimeout + 1
|
||
if failed then
|
||
reelBobber(s.bobber, tool)
|
||
elseif s.bobber then
|
||
s.bobber:Destroy() -- вместо поплавка к игроку летит рыба
|
||
end
|
||
|
||
if failed then
|
||
gripSequence(tool, { { REST_ANGLE, 0.3 } })
|
||
remote:FireClient(player, "Escaped")
|
||
notify(player, "🐟 Сорвалась!", RED)
|
||
breakCombo(player)
|
||
return
|
||
end
|
||
gripSequence(tool, { { 85, 0.15 }, { REST_ANGLE, 0.45 } })
|
||
|
||
-- серия: каждая рыба подряд дороже и даёт больше опыта
|
||
local fish = s.fish
|
||
local streak = combo[player] or 0
|
||
local comboMult = math.min(Config.Combo.max, 1 + Config.Combo.step * streak)
|
||
fish.value = math.floor(fish.value * comboMult + 0.5)
|
||
fish.xp = math.floor(fish.xp * comboMult + 0.5)
|
||
setCombo(player, streak + 1)
|
||
table.insert(data.items, {
|
||
uid = data.nextUid, id = fish.id, name = fish.name, rarity = fish.rarity,
|
||
weight = fish.weight, value = fish.value, mutation = fish.mutation,
|
||
})
|
||
data.nextUid += 1
|
||
data.totalCaught += 1
|
||
|
||
local rec = data.discovered[fish.id]
|
||
local isNew, isRecord = rec == nil, false
|
||
if not rec then
|
||
rec = { count = 0, best = 0 }
|
||
data.discovered[fish.id] = rec
|
||
end
|
||
rec.count += 1
|
||
if fish.weight > rec.best then
|
||
isRecord = not isNew
|
||
rec.best = fish.weight
|
||
end
|
||
|
||
addXp(player, data, fish.xp * (isNew and 2 or 1))
|
||
updateStats(player)
|
||
sendInventory(player)
|
||
if fromPos then
|
||
showFishFlight(player, fish, fromPos)
|
||
end
|
||
remote:FireClient(player, "Caught", fish, { new = isNew, record = isRecord, combo = comboMult, streak = streak + 1 })
|
||
|
||
local rank = Config.Rarities[fish.rarity].rank
|
||
questProgress(player, "catch", 1)
|
||
if rank >= 2 then
|
||
questProgress(player, "uncommon", 1)
|
||
end
|
||
if rank >= 3 then
|
||
questProgress(player, "rare", 1)
|
||
end
|
||
if misses == 0 then
|
||
questProgress(player, "perfect", 1)
|
||
end
|
||
if s.perfect then
|
||
questProgress(player, "perfectCast", 1)
|
||
end
|
||
questProgress(player, "combo", streak + 1, true)
|
||
|
||
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||
bossHit(player, hrp and Config.WorldAt(hrp.Position), rank + (misses == 0 and 1 or 0))
|
||
end
|
||
|
||
---------------------------------------------------------------- скупка
|
||
|
||
local sellPoints = nil
|
||
local function nearSeller(player)
|
||
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||
if not hrp then
|
||
return false
|
||
end
|
||
if not sellPoints then
|
||
sellPoints = {}
|
||
local map = workspace:FindFirstChild("FishingMap")
|
||
if map then
|
||
for _, d in ipairs(map:GetDescendants()) do
|
||
if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then
|
||
table.insert(sellPoints, d.Parent)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
for _, p in ipairs(sellPoints) do
|
||
if (p.Position - hrp.Position).Magnitude < 28 then
|
||
return true
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
local function sellItems(player, filterUid)
|
||
local data = profiles[player]
|
||
if not data then
|
||
return
|
||
end
|
||
local mult = sellMult(player)
|
||
local total, count, keep = 0, 0, {}
|
||
for _, item in ipairs(data.items) do
|
||
if filterUid == nil or item.uid == filterUid then
|
||
total += math.floor(item.value * mult)
|
||
count += 1
|
||
else
|
||
table.insert(keep, item)
|
||
end
|
||
end
|
||
if count == 0 then
|
||
if filterUid == nil then
|
||
notify(player, "🎒 Сумка пуста", Color3.fromRGB(255, 200, 120))
|
||
end
|
||
return
|
||
end
|
||
data.items = keep
|
||
data.coins += total
|
||
updateStats(player)
|
||
sendInventory(player)
|
||
remote:FireClient(player, "Sold", total, count)
|
||
questProgress(player, "sell", count)
|
||
questProgress(player, "earn", total)
|
||
end
|
||
|
||
---------------------------------------------------------------- магазин
|
||
|
||
local function buy(player, kind, id)
|
||
local data = profiles[player]
|
||
if not data or type(id) ~= "string" then
|
||
return
|
||
end
|
||
if kind == "Upgrade" then
|
||
local rod = Config.Find(Config.Rods, id)
|
||
if not rod or not data.rods[id] then
|
||
return
|
||
end
|
||
local lvl = rodLevel(data, id)
|
||
if lvl >= Config.RodUpgrade.maxLevel then
|
||
notify(player, "★★★★★ Максимум", GOLD)
|
||
return
|
||
end
|
||
local cost = Config.UpgradeCost(rod, lvl)
|
||
if data.coins < cost then
|
||
notify(player, "Нужно " .. cost .. " 💰", RED)
|
||
return
|
||
end
|
||
data.coins -= cost
|
||
data.rodLevels[id] = lvl + 1
|
||
if data.rod == id then
|
||
stopFishing(player, true)
|
||
giveRodTool(player)
|
||
end
|
||
updateStats(player)
|
||
notify(player, ("✨ %s улучшена до +%d!"):format(rod.name, lvl + 1), GOLD)
|
||
questProgress(player, "buy", 1)
|
||
return
|
||
end
|
||
if kind == "Potion" then
|
||
local potion = Config.Find(Config.Potions, id)
|
||
if not potion then
|
||
return
|
||
end
|
||
if potion.level and data.level < potion.level then
|
||
notify(player, "🔒 Нужен ур. " .. potion.level, RED)
|
||
return
|
||
end
|
||
if data.coins < potion.price then
|
||
notify(player, "Нужно " .. potion.price .. " 💰", RED)
|
||
return
|
||
end
|
||
data.coins -= potion.price
|
||
applyPotion(data, potion.bonus, potion.duration)
|
||
updateStats(player)
|
||
notify(player, ("🍀 +%d%% удачи, %d мин"):format(potion.bonus * 100, potion.duration / 60), GREEN)
|
||
questProgress(player, "buy", 1)
|
||
return
|
||
end
|
||
local list, owned
|
||
if kind == "Rod" then
|
||
list, owned = Config.Rods, data.rods
|
||
elseif kind == "Bag" then
|
||
list, owned = Config.Bags, data.bags
|
||
else
|
||
return
|
||
end
|
||
local item = Config.Find(list, id)
|
||
if not item then
|
||
return
|
||
end
|
||
local bought = false
|
||
if not owned[id] then
|
||
if data.level < item.level then
|
||
notify(player, "🔒 Нужен ур. " .. item.level, RED)
|
||
return
|
||
end
|
||
if data.coins < item.price then
|
||
notify(player, "Нужно " .. item.price .. " 💰", RED)
|
||
return
|
||
end
|
||
data.coins -= item.price
|
||
owned[id] = true
|
||
bought = true
|
||
notify(player, "✅ " .. item.name, GREEN)
|
||
end
|
||
if kind == "Rod" then
|
||
data.rod = id
|
||
stopFishing(player, true)
|
||
giveRodTool(player)
|
||
else
|
||
data.bag = id
|
||
attachBag(player)
|
||
end
|
||
updateStats(player)
|
||
if bought then
|
||
questProgress(player, "buy", 1)
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- телепорт
|
||
|
||
local TELEPORT_FADE = 0.3 -- сколько клиент затемняет экран перед переносом
|
||
local teleporting = {}
|
||
Players.PlayerRemoving:Connect(function(p)
|
||
teleporting[p] = nil
|
||
end)
|
||
|
||
local function teleportTo(player, worldId)
|
||
local data = profiles[player]
|
||
local char = player.Character
|
||
if not data or not char or type(worldId) ~= "string" then
|
||
return
|
||
end
|
||
local markerName
|
||
if worldId == "Lobby" then
|
||
markerName = "LobbySpawn"
|
||
else
|
||
local world = Config.Find(Config.Worlds, worldId)
|
||
if not world then
|
||
return
|
||
end
|
||
if world.soon then
|
||
notify(player, world.icon .. " " .. world.name .. " — скоро!", world.color)
|
||
return
|
||
end
|
||
if data.level < world.level then
|
||
notify(player, ("🔒 %s: ур. %d"):format(world.name, world.level), RED)
|
||
return
|
||
end
|
||
markerName = world.id .. "Spawn"
|
||
end
|
||
local map = workspace:FindFirstChild("FishingMap")
|
||
local m = map and map:FindFirstChild(markerName, true) -- маркеры могут лежать в папках уровня (World1Map)
|
||
if m and not teleporting[player] then
|
||
-- клиент затемняет экран, переносим уже в темноте: свет новой локации ставится до того, как её видно
|
||
teleporting[player] = true
|
||
stopFishing(player, true)
|
||
remote:FireClient(player, "TeleportFade", worldId, TELEPORT_FADE)
|
||
task.wait(TELEPORT_FADE)
|
||
teleporting[player] = nil
|
||
char = player.Character
|
||
if char and char.Parent then
|
||
char:PivotTo(m.CFrame + Vector3.new(0, 3, 0))
|
||
end
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- подсказки NPC
|
||
|
||
local TIPS = {
|
||
World1 = {
|
||
"Рыба клюёт быстрее с хорошей удочкой. Улучшай её в магазине!",
|
||
"Говорят, в этом озере живёт хрустальный осётр… Мифическая рыба!",
|
||
"Собери всех рыб одной редкости — получишь награду в коллекции (клавиша C).",
|
||
"Чем реже рыба, тем быстрее бегает метка. Нужна точность!",
|
||
},
|
||
World2 = {
|
||
"Скаты любят мелководье, а акулы — глубину за причалом.",
|
||
"Солнечная медуза светится по ночам… Если поймаешь — ты легенда!",
|
||
"Блестящая рыба стоит вдвое дороже, золотая — в пять раз, радужная — в десять!",
|
||
},
|
||
World3 = {
|
||
"Ищи лунки во льду — только там можно рыбачить.",
|
||
"Ледяной левиафан… Я видел его тень подо льдом. Один раз.",
|
||
"Удильщик светится в темноте. Смотри внимательно!",
|
||
},
|
||
}
|
||
|
||
local function talk(player)
|
||
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||
local world = hrp and Config.WorldAt(hrp.Position)
|
||
local list = TIPS[world and world.id or "World1"] or TIPS.World1
|
||
notify(player, "💬 «" .. list[rng:NextInteger(1, #list)] .. "»", Color3.fromRGB(255, 235, 190))
|
||
end
|
||
|
||
ProximityPromptService.PromptTriggered:Connect(function(prompt, player)
|
||
local action = prompt:GetAttribute("Action")
|
||
if action == "Shop" then
|
||
remote:FireClient(player, "OpenShop")
|
||
elseif action == "Sell" then
|
||
sellItems(player, nil)
|
||
elseif action == "Portal" then
|
||
teleportTo(player, prompt:GetAttribute("World"))
|
||
elseif action == "Talk" then
|
||
talk(player)
|
||
elseif action == "Daily" then
|
||
claimDaily(player)
|
||
remote:FireClient(player, "OpenQuests")
|
||
elseif action == "RobuxPasses" then
|
||
remote:FireClient(player, "OpenRobux", "passes")
|
||
elseif action == "RobuxProducts" then
|
||
remote:FireClient(player, "OpenRobux", "products")
|
||
end
|
||
end)
|
||
|
||
---------------------------------------------------------------- события от клиента
|
||
|
||
remote.OnServerEvent:Connect(function(player, action, a, b)
|
||
if action == "Cast" then
|
||
onCast(player, a)
|
||
elseif action == "Tutorial" then
|
||
-- шаги обучения идут только вперёд
|
||
local data = profiles[player]
|
||
local step = math.floor(tonumber(a) or 0)
|
||
if data and step > (player:GetAttribute("Tutorial") or 0) and step <= Config.TutorialDone then
|
||
data.tutorial = step
|
||
player:SetAttribute("Tutorial", step)
|
||
end
|
||
elseif action == "Catch" then
|
||
onCatch(player, a, b)
|
||
elseif action == "Cancel" then
|
||
stopFishing(player, false)
|
||
elseif action == "Buy" then
|
||
buy(player, a, b)
|
||
elseif action == "SellOne" then
|
||
if type(a) ~= "number" then
|
||
return
|
||
end
|
||
if nearSeller(player) then
|
||
sellItems(player, a)
|
||
else
|
||
notify(player, "💰 Только у скупщика", Color3.fromRGB(255, 200, 120))
|
||
end
|
||
elseif action == "SellAll" then
|
||
if nearSeller(player) then
|
||
sellItems(player, nil)
|
||
else
|
||
notify(player, "💰 Только у скупщика", Color3.fromRGB(255, 200, 120))
|
||
end
|
||
elseif action == "Teleport" then
|
||
teleportTo(player, a)
|
||
elseif action == "ClaimCollection" then
|
||
claimCollection(player, a, b)
|
||
elseif action == "ClaimDaily" then
|
||
claimDaily(player)
|
||
elseif action == "RequestInventory" then
|
||
sendInventory(player)
|
||
sendQuests(player)
|
||
elseif action == "Settings" then
|
||
-- громкость музыки и эффектов (0..1), сохраняется вместе с прогрессом
|
||
local data = profiles[player]
|
||
local music, sfx = tonumber(a), tonumber(b)
|
||
if data and music and sfx then
|
||
data.settings = { music = math.clamp(music, 0, 1), sfx = math.clamp(sfx, 0, 1) }
|
||
player:SetAttribute("VolMusic", data.settings.music)
|
||
player:SetAttribute("VolSfx", data.settings.sfx)
|
||
end
|
||
end
|
||
end)
|
||
|
||
---------------------------------------------------------------- донат
|
||
|
||
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, purchased)
|
||
if not purchased then
|
||
return
|
||
end
|
||
for _, gp in ipairs(Config.GamePasses) do
|
||
if gp.id == passId then
|
||
passes[player] = passes[player] or {}
|
||
passes[player][gp.key] = true
|
||
notify(player, "✅ " .. gp.icon .. " " .. gp.name, GOLD)
|
||
if gp.key == "VIP" then
|
||
vipTag(player)
|
||
end
|
||
updateStats(player)
|
||
end
|
||
end
|
||
end)
|
||
|
||
MarketplaceService.ProcessReceipt = function(info)
|
||
local player = Players:GetPlayerByUserId(info.PlayerId)
|
||
local data = player and profiles[player]
|
||
if not data then
|
||
return Enum.ProductPurchaseDecision.NotProcessedYet
|
||
end
|
||
for _, id in ipairs(data.receipts) do
|
||
if id == info.PurchaseId then
|
||
return Enum.ProductPurchaseDecision.PurchaseGranted
|
||
end
|
||
end
|
||
local product
|
||
for _, p in ipairs(Config.Products) do
|
||
if p.id == info.ProductId then
|
||
product = p
|
||
end
|
||
end
|
||
if not product then
|
||
return Enum.ProductPurchaseDecision.NotProcessedYet
|
||
end
|
||
if product.coins then
|
||
local coins = math.floor(product.coins * (1 + (data.level - 1) * 0.15))
|
||
data.coins += coins
|
||
notify(player, ("Спасибо! +%d 💰"):format(coins), GOLD)
|
||
end
|
||
if product.boost then
|
||
applyPotion(data, product.boost, product.duration)
|
||
notify(player, ("🍀 +%d%% удачи, %d мин"):format(product.boost * 100, product.duration / 60), GOLD)
|
||
end
|
||
table.insert(data.receipts, info.PurchaseId)
|
||
if #data.receipts > 50 then
|
||
table.remove(data.receipts, 1)
|
||
end
|
||
updateStats(player)
|
||
saveData(player)
|
||
return Enum.ProductPurchaseDecision.PurchaseGranted
|
||
end
|
||
|
||
---------------------------------------------------------------- события на сервере
|
||
|
||
task.spawn(function()
|
||
task.wait(Config.EventFirstDelay)
|
||
while true do
|
||
currentEvent = Config.Events[rng:NextInteger(1, #Config.Events)]
|
||
workspace:SetAttribute("Event", currentEvent.id)
|
||
workspace:SetAttribute("EventEnds", workspace:GetServerTimeNow() + currentEvent.duration)
|
||
for _, p in ipairs(Players:GetPlayers()) do
|
||
notify(p, "🎉 " .. currentEvent.name, GOLD)
|
||
updateStats(p)
|
||
end
|
||
task.wait(currentEvent.duration)
|
||
currentEvent = nil
|
||
workspace:SetAttribute("Event", nil)
|
||
for _, p in ipairs(Players:GetPlayers()) do
|
||
updateStats(p)
|
||
end
|
||
task.wait(rng:NextInteger(Config.EventGapMin, Config.EventGapMax))
|
||
end
|
||
end)
|
||
|
||
---------------------------------------------------------------- босс озера
|
||
|
||
local function playerWorld(p)
|
||
local hrp = p.Character and p.Character:FindFirstChild("HumanoidRootPart")
|
||
return hrp and Config.WorldAt(hrp.Position)
|
||
end
|
||
|
||
local function setBossAttrs()
|
||
workspace:SetAttribute("BossWorld", boss and boss.world.id or nil)
|
||
workspace:SetAttribute("BossName", boss and boss.def.name or nil)
|
||
workspace:SetAttribute("BossHP", boss and boss.hp or nil)
|
||
workspace:SetAttribute("BossMax", boss and boss.max or nil)
|
||
workspace:SetAttribute("BossEnds", boss and boss.ends or nil)
|
||
end
|
||
|
||
local function finishBoss(won)
|
||
local b = boss
|
||
boss = nil
|
||
setBossAttrs()
|
||
local helpers, best, bestDmg = 0, nil, 0
|
||
for p, d in pairs(b.dmg) do
|
||
if p.Parent then
|
||
helpers += 1
|
||
if d > bestDmg then
|
||
best, bestDmg = p, d
|
||
end
|
||
end
|
||
end
|
||
if not won then
|
||
for _, p in ipairs(Players:GetPlayers()) do
|
||
remote:FireClient(p, "BossDone", false, b.def.name)
|
||
end
|
||
return
|
||
end
|
||
local R = Config.Boss.reward
|
||
local fair = b.max / math.max(1, helpers) -- «честная доля» урона на одного
|
||
local potion = R.potion and Config.Find(Config.Potions, R.potion)
|
||
for p, d in pairs(b.dmg) do
|
||
local data = p.Parent and profiles[p]
|
||
if data then
|
||
local share = 0.4 + 0.6 * math.min(1, d / fair)
|
||
local coins = math.floor(R.coins * b.world.mult * share * levelMult(data))
|
||
local xp = math.floor(R.xp * b.world.mult * share)
|
||
data.coins += coins
|
||
addXp(p, data, xp)
|
||
if potion then
|
||
applyPotion(data, potion.bonus, potion.duration)
|
||
end
|
||
updateStats(p)
|
||
remote:FireClient(p, "BossReward", coins, xp, potion and potion.name)
|
||
end
|
||
end
|
||
for _, p in ipairs(Players:GetPlayers()) do
|
||
remote:FireClient(p, "BossDone", true, b.def.name, best and best.DisplayName, bestDmg)
|
||
end
|
||
end
|
||
|
||
task.spawn(function()
|
||
task.wait(Config.Boss.firstDelay)
|
||
while true do
|
||
-- мир, где сейчас больше всего игроков
|
||
local counts = {}
|
||
for _, p in ipairs(Players:GetPlayers()) do
|
||
local w = playerWorld(p)
|
||
if w and Config.Boss.worlds[w.id] then
|
||
counts[w.id] = (counts[w.id] or 0) + 1
|
||
end
|
||
end
|
||
local bestId, n = nil, 0
|
||
for id, c in pairs(counts) do
|
||
if c > n then
|
||
bestId, n = id, c
|
||
end
|
||
end
|
||
if not bestId then
|
||
task.wait(30) -- никого нет в мирах: попробуем позже
|
||
else
|
||
local world = Config.Find(Config.Worlds, bestId)
|
||
local max = Config.Boss.hpPerPlayer * n
|
||
boss = {
|
||
world = world, def = Config.Boss.worlds[bestId], hp = max, max = max, dmg = {},
|
||
ends = workspace:GetServerTimeNow() + Config.Boss.duration,
|
||
}
|
||
setBossAttrs()
|
||
for _, p in ipairs(Players:GetPlayers()) do
|
||
remote:FireClient(p, "BossStart", boss.def.name, world.icon .. " " .. world.name)
|
||
end
|
||
local t0 = os.clock()
|
||
while boss and boss.hp > 0 and os.clock() - t0 < Config.Boss.duration do
|
||
task.wait(0.25)
|
||
end
|
||
if boss then
|
||
finishBoss(boss.hp <= 0)
|
||
end
|
||
task.wait(Config.Boss.interval)
|
||
end
|
||
end
|
||
end)
|
||
|
||
---------------------------------------------------------------- игроки
|
||
|
||
local function onPlayerAdded(player)
|
||
local ls = Instance.new("Folder")
|
||
ls.Name = "leaderstats"
|
||
ls.Parent = player
|
||
for _, name in ipairs({ "Монеты", "Уровень", "Улов" }) do
|
||
local v = Instance.new("IntValue")
|
||
v.Name = name
|
||
v.Parent = ls
|
||
end
|
||
|
||
local data, ok = loadData(player)
|
||
if not player.Parent then
|
||
return
|
||
end
|
||
loadPasses(player)
|
||
ensureChain(data)
|
||
profiles[player] = data
|
||
loadedOk[player] = ok
|
||
local settings = type(data.settings) == "table" and data.settings or {}
|
||
player:SetAttribute("VolMusic", tonumber(settings.music) or Config.DefaultVolume.music)
|
||
player:SetAttribute("VolSfx", tonumber(settings.sfx) or Config.DefaultVolume.sfx)
|
||
updateStats(player)
|
||
sendInventory(player)
|
||
sendQuests(player)
|
||
|
||
local function onCharacter()
|
||
stopFishing(player, false)
|
||
task.wait(0.3)
|
||
giveRodTool(player)
|
||
attachBag(player)
|
||
vipTag(player)
|
||
end
|
||
player.CharacterAdded:Connect(onCharacter)
|
||
if player.Character then
|
||
task.spawn(onCharacter)
|
||
end
|
||
end
|
||
|
||
Players.PlayerAdded:Connect(onPlayerAdded)
|
||
for _, p in ipairs(Players:GetPlayers()) do
|
||
task.spawn(onPlayerAdded, p)
|
||
end
|
||
|
||
Players.PlayerRemoving:Connect(function(player)
|
||
stopFishing(player, false)
|
||
combo[player], comboUntil[player] = nil, nil
|
||
saveData(player)
|
||
profiles[player] = nil
|
||
loadedOk[player] = nil
|
||
passes[player] = nil
|
||
end)
|
||
|
||
game:BindToClose(function()
|
||
for _, p in ipairs(Players:GetPlayers()) do
|
||
saveData(p)
|
||
end
|
||
end)
|
||
|
||
-- погода и ночь меняют удачу: пересчитываем её у всех, когда они меняются
|
||
local function refreshAllStats()
|
||
for _, p in ipairs(Players:GetPlayers()) do
|
||
updateStats(p)
|
||
end
|
||
end
|
||
workspace:GetAttributeChangedSignal("Weather"):Connect(refreshAllStats)
|
||
|
||
-- таймер зелий + автосохранение
|
||
task.spawn(function()
|
||
local t = 0
|
||
local wasNight = isNight()
|
||
while true do
|
||
task.wait(1)
|
||
t += 1
|
||
local night = isNight()
|
||
if night ~= wasNight then
|
||
wasNight = night
|
||
refreshAllStats()
|
||
end
|
||
for _, p in ipairs(Players:GetPlayers()) do
|
||
local data = profiles[p]
|
||
if data and data.boostUntil > os.time() - 2 then
|
||
updateStats(p)
|
||
end
|
||
-- серия сгорает, если долго нет улова (пока рыба на крючке — ждём)
|
||
if comboUntil[p] and os.time() > comboUntil[p] and not fishing[p] then
|
||
breakCombo(p)
|
||
end
|
||
end
|
||
if t % 60 == 0 then
|
||
for _, p in ipairs(Players:GetPlayers()) do
|
||
saveData(p)
|
||
end
|
||
end
|
||
end
|
||
end)
|
||
]=====])
|
||
put('Script', 'MapBuilder', game.ServerScriptService, [=====[-- MapBuilder (Script) -> ServerScriptService
|
||
-- При запуске игры: свет, точка появления в лобби, карта и NPC.
|
||
-- Карту (лобби и все миры) строит модуль WorldBuilder. Обычно она уже собрана в Studio и
|
||
-- сохранена в плейсе (Workspace.FishingMap) — тогда берём её как есть, правки руками сохраняются.
|
||
-- Если карты в плейсе нет, строим её здесь тем же модулем.
|
||
|
||
local Workspace = game:GetService("Workspace")
|
||
|
||
local WorldBuilder = require(script.Parent:WaitForChild("WorldBuilder"))
|
||
|
||
WorldBuilder.applyLighting()
|
||
|
||
---------------------------------------------------------------- точка появления в лобби
|
||
|
||
local spawn = Workspace:FindFirstChildOfClass("SpawnLocation")
|
||
if not spawn then
|
||
spawn = Instance.new("SpawnLocation")
|
||
spawn.Parent = Workspace
|
||
end
|
||
spawn.Anchored = true
|
||
spawn.Size = Vector3.new(8, 0.2, 8)
|
||
spawn.CFrame = CFrame.new(0, 1.15, 57)
|
||
spawn.Transparency = 1
|
||
spawn.Duration = 0
|
||
for _, d in ipairs(spawn:GetChildren()) do
|
||
if d:IsA("Decal") or d:IsA("Texture") then
|
||
d.Transparency = 1
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- карта
|
||
|
||
local map = Workspace:FindFirstChild("FishingMap") or WorldBuilder.build()
|
||
WorldBuilder.prepareRuntime(map)
|
||
]=====])
|
||
put('Script', 'WeatherServer', game.ServerScriptService, [=====[-- WeatherServer (Script) -> ServerScriptService
|
||
-- Общие для всего сервера время суток и погода. Ничего не рисует — только выставляет атрибуты workspace:
|
||
-- DayStart — серверное время начала суток (часы считает Config.ClockAt)
|
||
-- Weather — id погоды из Config.Weathers
|
||
-- WeatherEnds — когда сменится (workspace:GetServerTimeNow())
|
||
-- Небо, дождь, звуки и свет делает клиент (Ambience), бонусы к рыбалке учитывает GameServer.
|
||
|
||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||
|
||
local rng = Random.new()
|
||
|
||
if Config.DayNight.enabled then
|
||
workspace:SetAttribute("DayStart", workspace:GetServerTimeNow())
|
||
end
|
||
|
||
local function pickWeather(previous)
|
||
local total = 0
|
||
for _, w in ipairs(Config.Weathers) do
|
||
if w.id ~= previous then
|
||
total += w.weight
|
||
end
|
||
end
|
||
local roll = rng:NextNumber() * total
|
||
for _, w in ipairs(Config.Weathers) do
|
||
if w.id ~= previous then
|
||
roll -= w.weight
|
||
if roll <= 0 then
|
||
return w
|
||
end
|
||
end
|
||
end
|
||
return Config.Weathers[1]
|
||
end
|
||
|
||
task.spawn(function()
|
||
-- первая погода всегда ясная: новичок видит мир чистым
|
||
local current = Config.Weathers[1]
|
||
while true do
|
||
local duration = rng:NextInteger(current.duration[1], current.duration[2])
|
||
workspace:SetAttribute("Weather", current.id)
|
||
workspace:SetAttribute("WeatherEnds", workspace:GetServerTimeNow() + duration)
|
||
task.wait(duration)
|
||
current = pickWeather(current.id)
|
||
end
|
||
end)
|
||
]=====])
|
||
put('ModuleScript', 'World1Builder', game.ServerScriptService, [=====[-- World1Builder (ModuleScript) -> ServerScriptService
|
||
-- Генератор локации «Тихое озеро» (Мир 1). Им ОДИН РАЗ собирают уровень прямо в Roblox Studio,
|
||
-- в режиме редактирования, а дальше уровень правится руками как обычные детали и модели.
|
||
-- Команда для Command Bar (строка внизу Studio):
|
||
-- require(game.ServerScriptService.World1Builder:Clone()).bake()
|
||
-- bake() стирает старую папку Workspace.World1Map и террейн этого мира и строит всё заново.
|
||
-- Обычно уровень собирается вместе со всей картой: WorldBuilder.bake() (см. README).
|
||
-- Если папки World1Map в плейсе нет, WorldBuilder строит уровень этим же модулем.
|
||
--
|
||
-- Что нужно игре от уровня (не удаляйте и не переименовывайте):
|
||
-- маркеры World1Spawn, GuideFishSpot, GuideSell, World1NpcSeller, World1NpcGrandpa — невидимые
|
||
-- плитки; их можно двигать, NPC и точка появления встанут туда при запуске;
|
||
-- атрибут GuideTarget = "Pier" (модель MainDock) и "Sell" (модель BaitShop) — подсветка в обучении;
|
||
-- ProximityPrompt с атрибутом Action = "Sell" на прилавке и портал «В лобби» (Action = "Portal");
|
||
-- деталь World1Bestiary — доска «Кто водится в озере», текст на неё пишет MapBuilder при запуске.
|
||
-- Форма воды для заброса берётся из FishConfig (Worlds[1].lakes) — если меняете озеро руками,
|
||
-- поправьте там круги, иначе игра будет считать водой старые места.
|
||
|
||
local Workspace = game:GetService("Workspace")
|
||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||
|
||
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||
|
||
local V = Vector3.new
|
||
local terrain = Workspace.Terrain
|
||
local W1 = Config.Worlds[1]
|
||
local W = W1.center -- центр Мира 1
|
||
local GROUND_Y = 4 -- верх земли
|
||
local WATER_Y = W1.waterY -- поверхность воды
|
||
local LAKES = W1.lakes -- озеро из кругов { x, z, радиус } от W
|
||
|
||
-- холмы: { x, z, радиус, высота центра шара } — верх холма = высота центра + радиус
|
||
local HILLS = {
|
||
{ -78, -138, 62, -22 }, -- холм с вышкой
|
||
{ -175, -55, 58, -34 }, { 175, -165, 62, -30 }, { -175, 160, 52, -32 },
|
||
{ 180, 130, 48, -30 }, { 10, -225, 60, -34 }, { -60, 175, 45, -28 }, { 95, 190, 40, -26 },
|
||
}
|
||
-- тропинка на холм к вышке (точки от W)
|
||
local HILL_PATH = { { -22, -76 }, { -40, -92 }, { -28, -106 }, { -52, -114 }, { -44, -127 }, { -66, -131 } }
|
||
-- «трава» — материал Snow: у него нет травинок и почти нет рисунка, получается ровная мультяшная
|
||
-- поверхность. В зелёный (а дорожки из Salt — в коричневый) его красит клиент только в этом мире.
|
||
local GROUND_MAT, PATH_MAT = Enum.Material.Snow, Enum.Material.Salt
|
||
|
||
local Builder = {}
|
||
|
||
-- вода ниже WATER_Y и воздух над ней прямо по вокселям (Fill* с Air иногда оставляет песок над водой)
|
||
function Builder.carveLake(l)
|
||
local region = Region3.new(W + V(l[1] - l[3], WATER_Y - 12, l[2] - l[3]), W + V(l[1] + l[3], WATER_Y + 16, l[2] + l[3])):ExpandToGrid(4)
|
||
local mats, occ = terrain:ReadVoxels(region, 4)
|
||
local size = mats.Size
|
||
local corner = region.CFrame.Position - region.Size / 2
|
||
local center = W + V(l[1], 0, l[2])
|
||
for x = 1, size.X do
|
||
for y = 1, size.Y do
|
||
for z = 1, size.Z do
|
||
local c = corner + V(x - 0.5, y - 0.5, z - 0.5) * 4
|
||
if (V(c.X, 0, c.Z) - center).Magnitude <= l[3] then
|
||
local water = c.Y < WATER_Y
|
||
mats[x][y][z] = water and Enum.Material.Water or Enum.Material.Air
|
||
occ[x][y][z] = water and 1 or 0
|
||
end
|
||
end
|
||
end
|
||
end
|
||
terrain:WriteVoxels(region, 4, mats, occ)
|
||
end
|
||
|
||
-- высота земли с учётом холмов: считаем по формуле (лучи по только что залитому террейну ненадёжны)
|
||
local function hillY(x, z)
|
||
local y = GROUND_Y
|
||
for _, h in ipairs(HILLS) do
|
||
local d2 = (x - h[1]) ^ 2 + (z - h[2]) ^ 2
|
||
if d2 < h[3] ^ 2 then
|
||
y = math.max(y, h[4] + math.sqrt(h[3] ^ 2 - d2))
|
||
end
|
||
end
|
||
return y
|
||
end
|
||
|
||
local function inLake(x, z, extra)
|
||
for _, l in ipairs(LAKES) do
|
||
if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + (extra or 0) then
|
||
return true
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
---------------------------------------------------------------- террейн
|
||
local function buildTerrain()
|
||
terrain:FillBlock(CFrame.new(W + V(0, -10, 0)), V(500, 28, 500), GROUND_MAT)
|
||
for _, h in ipairs(HILLS) do
|
||
terrain:FillBall(W + V(h[1], h[4], h[2]), h[3], GROUND_MAT)
|
||
end
|
||
-- порядок важен: узкая песчаная кромка → выемка → ил → вода
|
||
for _, l in ipairs(LAKES) do
|
||
terrain:FillCylinder(CFrame.new(W + V(l[1], -10, l[2])), 28, l[3] + 3, Enum.Material.Sand)
|
||
end
|
||
for _, l in ipairs(LAKES) do
|
||
terrain:FillCylinder(CFrame.new(W + V(l[1], 11, l[2])), 18, l[3] + 2, Enum.Material.Air)
|
||
end
|
||
for _, l in ipairs(LAKES) do
|
||
terrain:FillCylinder(CFrame.new(W + V(l[1], 10, l[2])), 20, l[3] + 1, Enum.Material.Air)
|
||
end
|
||
for _, l in ipairs(LAKES) do
|
||
terrain:FillCylinder(CFrame.new(W + V(l[1], -18, l[2])), 12, l[3], Enum.Material.Mud)
|
||
end
|
||
for _, l in ipairs(LAKES) do
|
||
terrain:FillCylinder(CFrame.new(W + V(l[1], -6, l[2])), 12, l[3], Enum.Material.Water)
|
||
end
|
||
for _, l in ipairs(LAKES) do
|
||
Builder.carveLake(l)
|
||
end
|
||
-- земляные дорожки: меняем материал травы на материал дорожки, объём не меняется
|
||
local function dirtPath(points, width)
|
||
for i = 2, #points do
|
||
local a, b = points[i - 1], points[i]
|
||
local len = math.sqrt((b[1] - a[1]) ^ 2 + (b[2] - a[2]) ^ 2)
|
||
for s = 0, len, 2 do
|
||
local x, z = a[1] + (b[1] - a[1]) * s / len, a[2] + (b[2] - a[2]) * s / len
|
||
local half = V(width / 2, 3, width / 2)
|
||
local p = W + V(x, hillY(x, z), z)
|
||
terrain:ReplaceMaterial(Region3.new(p - half, p + half):ExpandToGrid(4), 4, GROUND_MAT, PATH_MAT)
|
||
end
|
||
end
|
||
end
|
||
dirtPath(HILL_PATH, 4)
|
||
dirtPath({ { 0, 84 }, { 0, 64 } }, 6) -- площадка у корня причала
|
||
dirtPath({ { 8, -84 }, { 8, -100 } }, 4) -- к домику у мостков
|
||
end
|
||
|
||
---------------------------------------------------------------- детали
|
||
-- parent — куда положить папку World1Map (Workspace при сборке в Studio, FishingMap при запуске игры)
|
||
-- makePortal — WorldBuilder.portalModel: ставит модель портала из шаблона (без него строится старое кольцо)
|
||
function Builder.build(parent, makePortal)
|
||
buildTerrain()
|
||
|
||
local rng = Random.new(7)
|
||
local map = Instance.new("Folder")
|
||
map.Name = "World1Map"
|
||
|
||
-------------------------------------------------- помощники
|
||
local function P(props)
|
||
local p = Instance.new("Part")
|
||
if props.Shape then
|
||
p.Shape = props.Shape
|
||
end
|
||
p.Anchored = true
|
||
p.TopSurface = Enum.SurfaceType.Smooth
|
||
p.BottomSurface = Enum.SurfaceType.Smooth
|
||
for k, v in pairs(props) do
|
||
if k ~= "Parent" and k ~= "Shape" then
|
||
p[k] = v
|
||
end
|
||
end
|
||
p.Parent = props.Parent or map
|
||
return p
|
||
end
|
||
local function vcyl(pos, h, d, props)
|
||
props.Shape = Enum.PartType.Cylinder
|
||
props.Size = V(h, d, d)
|
||
props.CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90))
|
||
return P(props)
|
||
end
|
||
local function ball(pos, d, props)
|
||
props.Shape = Enum.PartType.Ball
|
||
props.Size = V(d, d, d)
|
||
props.Position = pos
|
||
return P(props)
|
||
end
|
||
-- цилиндр между двумя точками (брёвна, балки, перила, вёсла)
|
||
local function rod(a, b, d, props)
|
||
props.Shape = Enum.PartType.Cylinder
|
||
props.Size = V(math.max(0.05, (b - a).Magnitude), d, d)
|
||
props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0)
|
||
return P(props)
|
||
end
|
||
local function surfaceText(part, face, text, color)
|
||
local sg = Instance.new("SurfaceGui")
|
||
sg.Face = face
|
||
sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
|
||
sg.PixelsPerStud = 40
|
||
sg.LightInfluence = 0
|
||
sg.Parent = part
|
||
local t = Instance.new("TextLabel")
|
||
t.Size = UDim2.fromScale(1, 1)
|
||
t.BackgroundTransparency = 1
|
||
t.Font = Enum.Font.FredokaOne
|
||
t.TextScaled = true
|
||
t.TextColor3 = color
|
||
t.TextStrokeTransparency = 1
|
||
t.Text = text
|
||
t.Parent = sg
|
||
end
|
||
local function prompt(target, actionText, objectText, action)
|
||
local pp = Instance.new("ProximityPrompt")
|
||
pp.ActionText = actionText
|
||
pp.ObjectText = objectText
|
||
pp.HoldDuration = 0
|
||
pp.MaxActivationDistance = 14
|
||
pp.RequiresLineOfSight = false
|
||
pp:SetAttribute("Action", action)
|
||
pp.Parent = target
|
||
return pp
|
||
end
|
||
local function marker(name, cf)
|
||
return P({ Name = name, Size = V(4, 1, 4), CFrame = cf, Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false })
|
||
end
|
||
|
||
local COL = {
|
||
plank = Color3.fromRGB(196, 140, 88), plankDark = Color3.fromRGB(160, 110, 68),
|
||
log = Color3.fromRGB(156, 102, 60), logDark = Color3.fromRGB(105, 70, 44),
|
||
rope = Color3.fromRGB(218, 184, 128), roof = Color3.fromRGB(62, 104, 78), stone = Color3.fromRGB(150, 146, 150),
|
||
rock = Color3.fromRGB(150, 146, 162), rockDark = Color3.fromRGB(112, 108, 128), moss = Color3.fromRGB(108, 152, 72),
|
||
pine = Color3.fromRGB(58, 126, 70), pineDark = Color3.fromRGB(30, 82, 52),
|
||
leaf = Color3.fromRGB(110, 170, 64), leafDark = Color3.fromRGB(72, 136, 56),
|
||
glow = Color3.fromRGB(255, 200, 120), awnA = Color3.fromRGB(46, 106, 72), awnB = Color3.fromRGB(242, 232, 204),
|
||
banner = Color3.fromRGB(40, 92, 62), metal = Color3.fromRGB(48, 44, 42), water = Color3.fromRGB(70, 200, 195),
|
||
}
|
||
local WOOD, PLANKS, SMOOTH = Enum.Material.Wood, Enum.Material.WoodPlanks, Enum.Material.SmoothPlastic
|
||
-- куб, повёрнутый вершиной вверх: три грани сходятся в острый пик (ёлки, горы, обломки скал)
|
||
local CUBE_UP = CFrame.Angles(math.rad(-35.264), 0, 0) * CFrame.Angles(0, 0, math.rad(45))
|
||
|
||
-- столб с кронштейном и висящим фонарём; facing — куда смотрит кронштейн
|
||
local function postLantern(base, facing, h)
|
||
h = h or 8
|
||
local top = base + V(0, h, 0)
|
||
vcyl(base + V(0, h / 2, 0), h, 0.8, { Color = COL.logDark, Material = WOOD })
|
||
rod(top - V(0, 0.3, 0), top + facing * 2.4 - V(0, 0.3, 0), 0.35, { Color = COL.logDark, Material = WOOD })
|
||
local hang = top + facing * 2 - V(0, 1.8, 0)
|
||
rod(hang + V(0, 0.9, 0), top + facing * 2 - V(0, 0.3, 0), 0.08, { Color = COL.metal, Material = Enum.Material.Metal, CanCollide = false })
|
||
P({ Size = V(1.2, 0.3, 1.2), Position = hang + V(0, 0.85, 0), Color = COL.metal, Material = Enum.Material.Metal, CanCollide = false })
|
||
local glass = P({ Size = V(0.9, 1.3, 0.9), Position = hang, Color = COL.glow, Material = Enum.Material.Neon, CanCollide = false, CastShadow = false })
|
||
P({ Size = V(1.2, 0.3, 1.2), Position = hang - V(0, 0.8, 0), Color = COL.metal, Material = Enum.Material.Metal, CanCollide = false })
|
||
local light = Instance.new("PointLight")
|
||
light.Range = 18
|
||
light.Brightness = 1.5
|
||
light.Color = COL.glow
|
||
light.Parent = glass
|
||
end
|
||
|
||
-- low-poly ёлка: ствол и ярусы-«ромбы» (кубы вершиной вверх), к верху меньше
|
||
local function pine(pos, h, tiers)
|
||
tiers = tiers or 3
|
||
vcyl(pos + V(0, h * 0.15, 0), h * 0.3, math.max(0.8, h * 0.07), { Color = COL.logDark, Material = WOOD, CastShadow = false })
|
||
local shade = rng:NextNumber(0, 0.3)
|
||
for i = 0, tiers - 1 do
|
||
local t = tiers > 1 and i / (tiers - 1) or 1
|
||
local s = h * (0.42 - 0.22 * t)
|
||
P({
|
||
Size = V(s, s, s),
|
||
CFrame = CFrame.new(pos + V(0, h * (0.34 + 0.48 * t), 0)) * CFrame.Angles(0, rng:NextNumber(0, 6.28), 0) * CUBE_UP,
|
||
Color = COL.pineDark:Lerp(COL.pine, 0.2 + 0.5 * t + shade), Material = SMOOTH, CanCollide = false,
|
||
})
|
||
end
|
||
end
|
||
|
||
-- круглое лиственное дерево
|
||
local function leafy(pos, s)
|
||
vcyl(pos + V(0, s * 0.4, 0), s * 0.8, s * 0.14, { Color = COL.log, Material = WOOD })
|
||
local c = COL.leafDark:Lerp(COL.leaf, rng:NextNumber(0.3, 1))
|
||
ball(pos + V(0, s * 1.05, 0), s * 0.95, { Color = c, Material = SMOOTH, CanCollide = false })
|
||
ball(pos + V(s * 0.38, s * 0.85, s * 0.1), s * 0.65, { Color = c:Lerp(COL.leaf, 0.3), Material = SMOOTH, CanCollide = false })
|
||
ball(pos + V(-s * 0.35, s * 0.9, -s * 0.2), s * 0.6, { Color = c:Lerp(COL.leafDark, 0.3), Material = SMOOTH, CanCollide = false })
|
||
end
|
||
|
||
-- угловатый low-poly камень
|
||
local function rock(pos, s, col)
|
||
return P({
|
||
Size = V(s, s * rng:NextNumber(0.55, 0.85), s * rng:NextNumber(0.7, 1)),
|
||
CFrame = CFrame.new(pos) * CFrame.Angles(rng:NextNumber(-0.4, 0.4), rng:NextNumber(0, 6.28), rng:NextNumber(-0.4, 0.4)),
|
||
Color = (col or COL.rock):Lerp(COL.rockDark, rng:NextNumber(0, 0.6)), Material = SMOOTH,
|
||
})
|
||
end
|
||
-- острый обломок скалы (куб вершиной вверх), наполовину утоплен
|
||
local function crag(pos, s)
|
||
return P({
|
||
Size = V(s, s, s),
|
||
CFrame = CFrame.new(pos) * CFrame.Angles(rng:NextNumber(-0.2, 0.2), rng:NextNumber(0, 6.28), rng:NextNumber(-0.2, 0.2)) * CUBE_UP,
|
||
Color = COL.rock:Lerp(COL.rockDark, rng:NextNumber(0, 0.6)), Material = SMOOTH,
|
||
})
|
||
end
|
||
|
||
-- рогоз: несколько стеблей с коричневыми «початками» и листья
|
||
local function cattails(pos)
|
||
for _ = 1, rng:NextInteger(3, 6) do
|
||
local p = pos + V(rng:NextNumber(-1.3, 1.3), 0, rng:NextNumber(-1.3, 1.3))
|
||
local top = p + V(rng:NextNumber(-0.4, 0.4), rng:NextNumber(3.5, 6), rng:NextNumber(-0.4, 0.4))
|
||
rod(p, top, 0.16, { Color = Color3.fromRGB(96, 140, 62), Material = SMOOTH, CanCollide = false, CastShadow = false })
|
||
local dir = (top - p).Unit
|
||
rod(top - dir * 2, top - dir * 0.6, 0.5, { Color = Color3.fromRGB(122, 74, 40), Material = SMOOTH, CanCollide = false, CastShadow = false })
|
||
end
|
||
for _ = 1, 3 do
|
||
P({
|
||
Size = V(0.35, rng:NextNumber(3, 4.5), 0.08),
|
||
CFrame = CFrame.new(pos + V(0, 1.6, 0)) * CFrame.Angles(0, rng:NextNumber(0, 6.28), rng:NextNumber(-0.35, 0.35)),
|
||
Color = Color3.fromRGB(110, 160, 70), Material = SMOOTH, CanCollide = false, CastShadow = false,
|
||
})
|
||
end
|
||
end
|
||
|
||
-- круглая свая с намотанным канатом; y0 — низ (под водой), top — верх сваи
|
||
local function ropePost(x, z, y0, top, d, parent)
|
||
d = d or 1.6
|
||
vcyl(W + V(x, (y0 + top) / 2, z), top - y0, d, { Color = COL.log, Material = WOOD, Parent = parent })
|
||
vcyl(W + V(x, top + 0.1, z), 0.2, d * 0.9, { Color = COL.plankDark, Material = WOOD, Parent = parent })
|
||
for i = 1, 3 do
|
||
vcyl(W + V(x, top - 0.5 - i * 0.38, z), 0.3, d + 0.25, { Color = COL.rope, Material = Enum.Material.Fabric, CanCollide = false, Parent = parent })
|
||
end
|
||
end
|
||
|
||
-- маленькие мостки: доски поперёк и сваи
|
||
local function smallDock(x, z0, z1, w, y)
|
||
local dir = z1 > z0 and 1 or -1
|
||
for z = z0, z1, dir * 1.6 do
|
||
P({ Size = V(w, 0.45, 1.45), Position = W + V(x, y - 0.22, z), Color = COL.plank:Lerp(COL.plankDark, rng:NextNumber(0, 0.6)), Material = PLANKS })
|
||
end
|
||
for z = z0 + dir * 2, z1, dir * 6 do
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
vcyl(W + V(x + s * (w / 2 - 0.3), y - 4, z), 8, 0.8, { Color = COL.logDark, Material = WOOD })
|
||
end
|
||
end
|
||
end
|
||
|
||
-- бревенчатый дом: стены из брёвен, двускатная зелёная крыша, тёплые окна, труба с дымом, крыльцо.
|
||
-- cf — центр пола на земле, сторона -Z (LookVector) — фасад с дверью
|
||
local function logCabin(name, cf, w, d, wallH)
|
||
local house = Instance.new("Model")
|
||
house.Name = name
|
||
house.Parent = map
|
||
local function part(props)
|
||
props.Parent = house
|
||
return P(props)
|
||
end
|
||
local LOG = 1.25
|
||
local rows = math.floor(wallH / LOG)
|
||
local wallTop = 1 + rows * LOG
|
||
local function at(x, y, z)
|
||
return (cf * CFrame.new(x, y, z)).Position
|
||
end
|
||
part({ Size = V(w + 1.5, 1, d + 1.5), CFrame = cf * CFrame.new(0, 0.5, 0), Color = COL.stone, Material = Enum.Material.Slate })
|
||
for r = 0, rows - 1 do
|
||
local y = 1 + LOG / 2 + r * LOG
|
||
local col = (r % 2 == 0) and COL.log or COL.log:Lerp(COL.logDark, 0.3)
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
rod(at(-w / 2 - 0.9, y, s * d / 2), at(w / 2 + 0.9, y, s * d / 2), LOG, { Color = col, Material = WOOD, Parent = house })
|
||
rod(at(s * w / 2, y, -d / 2 - 0.9), at(s * w / 2, y, d / 2 + 0.9), LOG, { Color = col, Material = WOOD, Parent = house })
|
||
end
|
||
end
|
||
-- фронтоны (по бокам) — брёвна всё короче к коньку
|
||
local a = math.rad(34)
|
||
local rise = (d / 2) * math.tan(a)
|
||
for k = 0, math.floor(rise / LOG) - 1 do
|
||
local y = wallTop + LOG / 2 + k * LOG
|
||
local half = (d / 2) * (1 - (k + 1) * LOG / rise)
|
||
if half > 0.6 then
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
rod(at(s * w / 2, y, -half), at(s * w / 2, y, half), LOG, { Color = COL.log:Lerp(COL.logDark, 0.15), Material = WOOD, Parent = house })
|
||
end
|
||
end
|
||
end
|
||
-- крыша: два ската, конёк вдоль X
|
||
local run = d / 2 + 1.6
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
part({ Size = V(w + 3, 0.7, run / math.cos(a)), CFrame = cf * CFrame.new(0, wallTop + run * math.tan(a) / 2 + 0.35, s * run / 2) * CFrame.Angles(s * a, 0, 0), Color = COL.roof, Material = SMOOTH })
|
||
end
|
||
part({ Size = V(w + 3.2, 0.6, 0.9), CFrame = cf * CFrame.new(0, wallTop + run * math.tan(a) + 0.2, 0), Color = COL.roof:Lerp(Color3.new(0, 0, 0), 0.25), Material = SMOOTH })
|
||
-- дверь и окна с тёплым светом
|
||
part({ Size = V(3, 5.2, 0.5), CFrame = cf * CFrame.new(0, 3.6, -d / 2 - 0.7), Color = COL.logDark, Material = PLANKS })
|
||
for i, wdw in ipairs({ { -w / 4, -d / 2 - 0.65, 0 }, { w / 4, -d / 2 - 0.65, 0 }, { -w / 2 - 0.65, 0, 90 }, { w / 2 + 0.65, 0, 90 } }) do
|
||
local wcf = cf * CFrame.new(wdw[1], 4.6, wdw[2]) * CFrame.Angles(0, math.rad(wdw[3]), 0)
|
||
part({ Size = V(3, 2.6, 0.4), CFrame = wcf, Color = COL.logDark, Material = WOOD })
|
||
local g = part({ Size = V(2.4, 2, 0.45), CFrame = wcf, Color = COL.glow, Material = Enum.Material.Neon, CastShadow = false })
|
||
part({ Size = V(0.2, 2, 0.5), CFrame = wcf, Color = COL.logDark, Material = WOOD })
|
||
if i == 1 then
|
||
local l = Instance.new("PointLight")
|
||
l.Range = 14
|
||
l.Brightness = 1
|
||
l.Color = COL.glow
|
||
l.Parent = g
|
||
end
|
||
end
|
||
-- крыльцо
|
||
part({ Size = V(w * 0.55, 0.6, 4), CFrame = cf * CFrame.new(0, 1.1, -d / 2 - 2.8), Color = COL.plank, Material = PLANKS })
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
vcyl(at(s * w * 0.25, 4.2, -d / 2 - 4.4), 6.2, 0.6, { Color = COL.log, Material = WOOD, Parent = house })
|
||
end
|
||
part({ Size = V(w * 0.62, 0.5, 4.8), CFrame = cf * CFrame.new(0, 7.3, -d / 2 - 2.6) * CFrame.Angles(-math.rad(14), 0, 0), Color = COL.roof, Material = SMOOTH })
|
||
-- труба с дымом
|
||
local ch = at(w / 2 - 2.2, 0, d / 4)
|
||
local chTop = wallTop + rise + 3
|
||
part({ Size = V(2.2, chTop, 2.2), Position = ch + V(0, chTop / 2, 0), Color = Color3.fromRGB(150, 110, 95), Material = Enum.Material.Brick })
|
||
local smokeAt = part({ Size = V(1, 1, 1), Position = ch + V(0, chTop + 0.5, 0), Transparency = 1, CanCollide = false, CanQuery = false })
|
||
local smoke = Instance.new("ParticleEmitter")
|
||
smoke.Texture = "rbxasset://textures/particles/smoke_main.dds"
|
||
smoke.Color = ColorSequence.new(Color3.fromRGB(235, 235, 235))
|
||
smoke.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1.5), NumberSequenceKeypoint.new(1, 6) })
|
||
smoke.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.4), NumberSequenceKeypoint.new(1, 1) })
|
||
smoke.Lifetime = NumberRange.new(4, 6)
|
||
smoke.Rate = 4
|
||
smoke.Speed = NumberRange.new(2, 3)
|
||
smoke.SpreadAngle = Vector2.new(10, 10)
|
||
smoke.Acceleration = V(1, 0.4, 0)
|
||
smoke.Parent = smokeAt
|
||
end
|
||
|
||
-------------------------------------------------- прибытие, причал, лавка
|
||
local DOCK = { z0 = 64, z1 = 36, w = 12 } -- от берега (z0) в воду (z1), по оси X = 0
|
||
local DECK_Y = GROUND_Y + 0.6 -- верх настила
|
||
local spawnAt = W + V(0, DECK_Y, 60)
|
||
marker("World1Spawn", CFrame.lookAt(spawnAt + V(0, 1, 0), spawnAt + V(0, 1, -10)))
|
||
marker("GuideFishSpot", CFrame.new(W + V(0, DECK_Y + 0.5, DOCK.z1 + 3)))
|
||
|
||
-- главный причал: доски поперёк, толстые сваи с канатом по краям, ящик для снастей
|
||
do
|
||
local dock = Instance.new("Model")
|
||
dock.Name = "MainDock"
|
||
dock:SetAttribute("GuideTarget", "Pier") -- подсвечивается на шаге обучения
|
||
dock.Parent = map
|
||
for z = DOCK.z1 + 0.8, DOCK.z0 - 0.8, 1.6 do
|
||
P({
|
||
Size = V(DOCK.w + rng:NextNumber(-0.3, 0.3), 0.5, 1.48), Position = W + V(0, DECK_Y - 0.25, z),
|
||
Color = COL.plank:Lerp(COL.plankDark, rng:NextNumber(0, 0.7)), Material = PLANKS, Parent = dock,
|
||
})
|
||
end
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
P({ Size = V(0.8, 0.8, DOCK.z0 - DOCK.z1), Position = W + V(s * (DOCK.w / 2 - 1), DECK_Y - 0.9, (DOCK.z0 + DOCK.z1) / 2), Color = COL.logDark, Material = WOOD, Parent = dock })
|
||
for z = DOCK.z1 + 1, DOCK.z0 - 2, 8 do
|
||
ropePost(s * (DOCK.w / 2 - 0.2), z, -6, DECK_Y + 2.4, 1.7, dock)
|
||
end
|
||
end
|
||
local tb = W + V(-3.4, DECK_Y, 46)
|
||
P({ Size = V(2.6, 1.3, 1.5), Position = tb + V(0, 0.65, 0), Color = Color3.fromRGB(120, 142, 124), Material = SMOOTH, Parent = dock })
|
||
P({ Size = V(2.7, 0.35, 1.6), Position = tb + V(0, 1.45, 0), Color = Color3.fromRGB(96, 116, 100), Material = SMOOTH, Parent = dock })
|
||
rod(tb + V(-0.7, 1.65, 0), tb + V(0.7, 1.65, 0), 0.18, { Color = COL.metal, Material = Enum.Material.Metal, Parent = dock })
|
||
P({ Size = V(0.35, 0.35, 0.1), Position = tb + V(0, 1.2, -0.8), Color = Color3.fromRGB(230, 190, 70), Material = Enum.Material.Metal, Parent = dock })
|
||
P({ Size = V(2, 2, 2), CFrame = CFrame.new(W + V(-4.2, DECK_Y + 1, 49.5)) * CFrame.Angles(0, 0.25, 0), Color = COL.plankDark, Material = PLANKS, Parent = dock })
|
||
end
|
||
|
||
-- лавка рыбака (скупка) слева от корня причала, прилавком к причалу: тент, вывеска, поплавки,
|
||
-- воблеры, бочки и ящики, фонарь на столбе. Продавца ставит MapBuilder на маркер World1NpcSeller.
|
||
do
|
||
local cf = CFrame.lookAt(W + V(-15, GROUND_Y, 60), W + V(0, GROUND_Y, 57))
|
||
local shop = Instance.new("Model")
|
||
shop.Name = "BaitShop"
|
||
shop:SetAttribute("GuideTarget", "Sell") -- подсвечивается на шаге обучения
|
||
shop.Parent = map
|
||
local function at(x, y, z)
|
||
return cf * CFrame.new(x, y, z)
|
||
end
|
||
local function part(props)
|
||
props.Parent = shop
|
||
return P(props)
|
||
end
|
||
part({ Size = V(14, 0.8, 10), CFrame = at(0, 0.4, 0), Color = COL.plankDark, Material = PLANKS })
|
||
part({ Size = V(14, 9, 0.8), CFrame = at(0, 5, 4.6), Color = COL.plank, Material = PLANKS })
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
part({ Size = V(0.8, 9, 10), CFrame = at(s * 6.6, 5, 0), Color = COL.plank, Material = PLANKS })
|
||
part({ Size = V(1.2, 10.4, 1.2), CFrame = at(s * 6.6, 5.2, -4.8), Color = COL.logDark, Material = WOOD })
|
||
end
|
||
part({ Size = V(15.5, 0.7, 11), CFrame = at(0, 10.4, 0), Color = COL.logDark, Material = PLANKS })
|
||
local counter = part({ Name = "Counter", Size = V(12, 3.4, 2.4), CFrame = at(0, 2.5, -3.6), Color = COL.plank, Material = PLANKS })
|
||
part({ Size = V(13, 0.4, 3), CFrame = at(0, 4.4, -3.6), Color = COL.logDark, Material = WOOD })
|
||
prompt(counter, "Продать всю рыбу", "Скупка", "Sell")
|
||
-- полосатый тент и фестончики
|
||
local n = 8
|
||
for i = 0, n - 1 do
|
||
local c = (i % 2 == 0) and COL.awnA or COL.awnB
|
||
local x = -7.5 + (i + 0.5) * 15 / n
|
||
part({ Size = V(15 / n + 0.02, 0.25, 5), CFrame = at(x, 9.7, -6.9) * CFrame.Angles(math.rad(-24), 0, 0), Color = c, Material = Enum.Material.Fabric })
|
||
part({ Shape = Enum.PartType.Cylinder, Size = V(0.25, 15 / n, 15 / n), CFrame = at(x, 8.7, -9.25) * CFrame.Angles(0, math.rad(90), 0), Color = c, Material = Enum.Material.Fabric, CanCollide = false })
|
||
end
|
||
-- вывеска над тентом
|
||
local sign = part({ Size = V(8, 3, 0.5), CFrame = at(0, 12.6, -4.9), Color = COL.plank, Material = PLANKS })
|
||
part({ Size = V(8.6, 3.6, 0.3), CFrame = at(0, 12.6, -4.6), Color = COL.logDark, Material = WOOD })
|
||
surfaceText(sign, Enum.NormalId.Front, "🐟 СКУПКА", Color3.fromRGB(60, 40, 25))
|
||
-- воблеры на задней стене
|
||
for i, c in ipairs({ Color3.fromRGB(90, 200, 80), Color3.fromRGB(245, 210, 60), Color3.fromRGB(245, 140, 50), Color3.fromRGB(70, 150, 230), Color3.fromRGB(230, 70, 70) }) do
|
||
local x = -4.4 + (i - 1) * 2.2
|
||
part({ Size = V(0.08, 1.4, 0.08), CFrame = at(x, 8.4, 4.05), Color = COL.metal, CanCollide = false })
|
||
part({ Size = V(0.55, 1.6, 0.5), CFrame = at(x, 7, 4.0), Color = c, Material = SMOOTH, CanCollide = false })
|
||
part({ Size = V(0.3, 0.5, 0.45), CFrame = at(x, 6, 4.0), Color = c:Lerp(Color3.new(1, 1, 1), 0.4), Material = SMOOTH, CanCollide = false })
|
||
end
|
||
-- поплавки и ящички на прилавке
|
||
for i = 0, 3 do
|
||
local p = at(-4.5 + i * 1.3, 5.05, -3.4).Position
|
||
ball(p, 0.9, { Color = Color3.fromRGB(225, 50, 45), Material = SMOOTH, Parent = shop, CanCollide = false })
|
||
ball(p + V(0, 0.55, 0), 0.6, { Color = Color3.fromRGB(250, 250, 250), Material = SMOOTH, Parent = shop, CanCollide = false })
|
||
end
|
||
part({ Size = V(2.2, 1, 1.4), CFrame = at(2.6, 5.1, -3.5), Color = Color3.fromRGB(120, 140, 125), Material = SMOOTH })
|
||
part({ Size = V(1.6, 0.8, 1.2), CFrame = at(4.8, 5, -3.4), Color = COL.plankDark, Material = PLANKS })
|
||
-- бочки и ящики сбоку
|
||
for i, off in ipairs({ { 8.6, -2.6 }, { 9.2, 0.6 } }) do
|
||
local p = at(off[1], 1.7, off[2]).Position
|
||
vcyl(p, 3.4, 2.8, { Color = COL.log, Material = WOOD, Parent = shop })
|
||
for _, dy in ipairs({ -1, 1 }) do
|
||
vcyl(p + V(0, dy, 0), 0.3, 2.95, { Color = COL.metal, Material = Enum.Material.Metal, Parent = shop, CanCollide = false })
|
||
end
|
||
if i == 2 then
|
||
part({ Size = V(2.2, 2.2, 2.2), CFrame = at(9, 4.5, 0.6) * CFrame.Angles(0, 0.3, 0), Color = COL.plankDark, Material = PLANKS })
|
||
end
|
||
end
|
||
part({ Size = V(2.6, 2.6, 2.6), CFrame = at(-9, 1.3, -1.5) * CFrame.Angles(0, 0.2, 0), Color = COL.plankDark, Material = PLANKS })
|
||
marker("World1NpcSeller", at(0, 3.9, 1.6))
|
||
marker("GuideSell", cf * CFrame.new(0, 0, -9))
|
||
postLantern(at(-7.8, 0, -6.2).Position, (cf.LookVector * V(1, 0, 1)).Unit, 9)
|
||
end
|
||
leafy(W + V(-27, GROUND_Y, 70), 13) -- большое дерево над лавкой, как на макете
|
||
postLantern(W + V(7.5, GROUND_Y, 66), V(-1, 0, 0), 8)
|
||
|
||
-- деревянная лодка с вёслами справа от причала у двух свай
|
||
do
|
||
local cf = CFrame.new(W + V(12.5, WATER_Y + 0.25, 46)) * CFrame.Angles(0, math.rad(12), 0)
|
||
local boat = Instance.new("Model")
|
||
boat.Name = "Rowboat"
|
||
boat.Parent = map
|
||
local hull, inner = Color3.fromRGB(150, 92, 52), Color3.fromRGB(196, 140, 88)
|
||
P({ Size = V(3.4, 0.4, 8.4), CFrame = cf, Color = inner, Material = PLANKS, Parent = boat })
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
P({ Size = V(0.4, 1.7, 8.6), CFrame = cf * CFrame.new(s * 1.95, 0.7, 0.2) * CFrame.Angles(0, 0, math.rad(-s * 14)), Color = hull, Material = WOOD, Parent = boat })
|
||
P({ Size = V(0.4, 1.7, 3), CFrame = cf * CFrame.new(s * 1.05, 0.8, -5) * CFrame.Angles(0, math.rad(s * 38), 0), Color = hull, Material = WOOD, Parent = boat })
|
||
P({ Size = V(0.5, 0.3, 8.6), CFrame = cf * CFrame.new(s * 2.2, 1.6, 0.2), Color = COL.logDark, Material = WOOD, Parent = boat })
|
||
local a = (cf * CFrame.new(s * 1.6, 1.4, 0.2)).Position
|
||
local b = (cf * CFrame.new(s * 5.2, -0.1, 1.4)).Position
|
||
rod(a, b, 0.22, { Color = COL.plank, Material = WOOD, CanCollide = false, Parent = boat })
|
||
P({ Size = V(0.15, 0.9, 1.9), CFrame = CFrame.lookAt(b, b + (b - a)) * CFrame.Angles(0, math.rad(90), 0), Color = COL.plank, Material = WOOD, CanCollide = false, Parent = boat })
|
||
end
|
||
P({ Size = V(4.4, 1.7, 0.4), CFrame = cf * CFrame.new(0, 0.7, 4.5), Color = hull, Material = WOOD, Parent = boat })
|
||
for _, z in ipairs({ -1.6, 1.8 }) do
|
||
P({ Size = V(3.8, 0.3, 1.1), CFrame = cf * CFrame.new(0, 1.1, z), Color = inner, Material = PLANKS, Parent = boat })
|
||
end
|
||
ropePost(9.8, 52, -6, 3.4, 1.4, boat)
|
||
ropePost(16, 40, -6, 2.8, 1.4, boat)
|
||
end
|
||
|
||
-- за спиной игрока: портал в лобби, место деда-рыбака, доска «Кто водится в озере»
|
||
do
|
||
local baseCF = CFrame.lookAt(W + V(15, GROUND_Y, 86), W + V(0, GROUND_Y, 62))
|
||
local color = Color3.fromRGB(255, 200, 80)
|
||
local portalModel = Instance.new("Model")
|
||
portalModel.Name = "PortalToLobby"
|
||
portalModel.Parent = map
|
||
local center = baseCF * CFrame.new(0, 10, 0)
|
||
local fancy = makePortal and makePortal(baseCF, color, "PortalModel_Lobby", portalModel)
|
||
local disc
|
||
if fancy then
|
||
-- модель из шаблона; невидимый якорь держит подсказку, подпись и искры
|
||
disc = P({
|
||
Name = "Portal_Lobby", Size = V(1, 1, 1), CFrame = center * CFrame.Angles(0, math.rad(90), 0),
|
||
Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false, Parent = portalModel,
|
||
})
|
||
else
|
||
P({ Size = V(17, 1, 9), CFrame = baseCF * CFrame.new(0, 0.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(95, 100, 115), Parent = portalModel })
|
||
P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130), Parent = portalModel })
|
||
local R, n = 7, 20
|
||
for i = 0, n - 1 do
|
||
local a = (i + 0.5) / n * math.pi * 2
|
||
P({ Size = V(2 * math.pi * R / n + 0.4, 1.7, 1.7), CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(80, 85, 100), Parent = portalModel })
|
||
if i % 2 == 0 then
|
||
P({ Size = V(0.6, 0.6, 1.9), CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R + 0.95, 0), Material = Enum.Material.Neon, Color = color, Parent = portalModel })
|
||
end
|
||
end
|
||
disc = P({
|
||
Name = "Portal_Lobby", Shape = Enum.PartType.Cylinder, Size = V(0.3, 2 * R - 1, 2 * R - 1), CFrame = center * CFrame.Angles(0, math.rad(90), 0),
|
||
Material = Enum.Material.Neon, Color = color, Transparency = 0.3, CanCollide = false, Parent = portalModel,
|
||
})
|
||
end
|
||
local pe = Instance.new("ParticleEmitter")
|
||
pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1))
|
||
pe.LightEmission = 1
|
||
pe.Rate = 25
|
||
pe.Lifetime = NumberRange.new(1, 1.8)
|
||
pe.Speed = NumberRange.new(0.5, 2)
|
||
pe.SpreadAngle = Vector2.new(180, 180)
|
||
pe.Size = NumberSequence.new(0.5, 0)
|
||
pe.Transparency = NumberSequence.new(0.2, 1)
|
||
pe.Parent = disc
|
||
local bb = Instance.new("BillboardGui")
|
||
bb.Size = UDim2.fromOffset(250, 64)
|
||
bb.StudsOffset = V(0, fancy and 7 or 10, 0)
|
||
bb.MaxDistance = 160
|
||
bb.LightInfluence = 0
|
||
bb.Parent = disc
|
||
local t = Instance.new("TextLabel")
|
||
t.Size = UDim2.fromScale(1, 1)
|
||
t.BackgroundTransparency = 1
|
||
t.Font = Enum.Font.FredokaOne
|
||
t.TextScaled = true
|
||
t.TextColor3 = color:Lerp(Color3.new(1, 1, 1), 0.4)
|
||
t.TextStrokeTransparency = 0.15
|
||
t.Text = "🏠 В лобби"
|
||
t.Parent = bb
|
||
prompt(disc, "Перейти", "🏠 В лобби", "Portal"):SetAttribute("World", "Lobby")
|
||
end
|
||
marker("World1NpcGrandpa", CFrame.lookAt(W + V(9, GROUND_Y + 3, 72), W + V(0, GROUND_Y + 3, 62)))
|
||
do
|
||
local cf = CFrame.lookAt(W + V(-12, GROUND_Y, 80), W + V(0, GROUND_Y, 62))
|
||
for _, x in ipairs({ -5.5, 5.5 }) do
|
||
P({ Size = V(0.8, 10, 0.8), CFrame = cf * CFrame.new(x, 5, 0.3), Material = WOOD, Color = COL.logDark })
|
||
end
|
||
P({ Name = "World1Bestiary", Size = V(12, 9, 0.5), CFrame = cf * CFrame.new(0, 6.5, 0), Material = PLANKS, Color = Color3.fromRGB(70, 48, 32) })
|
||
end
|
||
|
||
-------------------------------------------------- дальний берег: дом, холм с тропинкой и вышкой
|
||
logCabin("BigCabin", CFrame.lookAt(W + V(-58, GROUND_Y, -62), W + V(-20, GROUND_Y, 10)), 16, 12, 8)
|
||
postLantern(W + V(-44, GROUND_Y, -58), V(1, 0, 0), 8)
|
||
|
||
-- столб-вывеска с зелёным знаменем и белой рыбой у начала тропинки
|
||
do
|
||
local base = W + V(-17, GROUND_Y, -80)
|
||
vcyl(base + V(0, 6, 0), 12, 0.9, { Color = COL.logDark, Material = WOOD })
|
||
rod(base + V(0, 11.4, 0), base + V(3.6, 11.4, 0), 0.5, { Color = COL.logDark, Material = WOOD })
|
||
local flag = P({ Size = V(3, 5, 0.2), CFrame = CFrame.lookAt(base + V(2.2, 8.6, 0), base + V(2.2, 8.6, 10)), Color = COL.banner, Material = Enum.Material.Fabric, CanCollide = false })
|
||
surfaceText(flag, Enum.NormalId.Front, "🐟", Color3.new(1, 1, 1))
|
||
surfaceText(flag, Enum.NormalId.Back, "🐟", Color3.new(1, 1, 1))
|
||
end
|
||
|
||
-- забор вдоль тропинки и фонари
|
||
do
|
||
local posts = {}
|
||
for i = 2, #HILL_PATH do
|
||
local a, b = HILL_PATH[i - 1], HILL_PATH[i]
|
||
local dx, dz = b[1] - a[1], b[2] - a[2]
|
||
local len = math.sqrt(dx * dx + dz * dz)
|
||
local nx, nz = -dz / len, dx / len -- влево от направления
|
||
for s = 0, len - 0.1, 4.5 do
|
||
local x, z = a[1] + dx * s / len + nx * 3, a[2] + dz * s / len + nz * 3
|
||
table.insert(posts, W + V(x, hillY(x, z), z))
|
||
end
|
||
end
|
||
for i, p in ipairs(posts) do
|
||
vcyl(p + V(0, 1.3, 0), 3, 0.45, { Color = COL.log, Material = WOOD })
|
||
local q = posts[i + 1]
|
||
if q and (q - p).Magnitude < 8 then
|
||
for _, h in ipairs({ 1.2, 2.3 }) do
|
||
rod(p + V(0, h, 0), q + V(0, h, 0), 0.3, { Color = COL.log, Material = WOOD, CanCollide = false })
|
||
end
|
||
end
|
||
end
|
||
for _, i in ipairs({ 2, 4 }) do
|
||
local x, z = HILL_PATH[i][1] + 3, HILL_PATH[i][2]
|
||
postLantern(W + V(x, hillY(x, z), z), V(-1, 0, 0), 7)
|
||
end
|
||
end
|
||
|
||
-- смотровая вышка на вершине холма с зелёным флагом
|
||
do
|
||
local tower = Instance.new("Model")
|
||
tower.Name = "Watchtower"
|
||
tower.Parent = map
|
||
local c = W + V(-76, hillY(-76, -136) - 0.5, -136)
|
||
local H = 14
|
||
local function wood(props)
|
||
props.Parent = tower
|
||
return props
|
||
end
|
||
for _, sx in ipairs({ -1, 1 }) do
|
||
for _, sz in ipairs({ -1, 1 }) do
|
||
rod(c + V(sx * 4.2, 0, sz * 4.2), c + V(sx * 3.2, H, sz * 3.2), 1.1, wood({ Color = COL.log, Material = WOOD }))
|
||
end
|
||
end
|
||
for _, y in ipairs({ 4.5, 9 }) do
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
local k = 4.2 - y / H
|
||
rod(c + V(-k, y, s * k), c + V(k, y - 3, s * k), 0.4, wood({ Color = COL.logDark, Material = WOOD, CanCollide = false }))
|
||
rod(c + V(s * k, y, -k), c + V(s * k, y - 3, k), 0.4, wood({ Color = COL.logDark, Material = WOOD, CanCollide = false }))
|
||
end
|
||
end
|
||
P(wood({ Size = V(9, 0.6, 9), Position = c + V(0, H, 0), Color = COL.plank, Material = PLANKS }))
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
P(wood({ Size = V(9, 1.4, 0.3), Position = c + V(0, H + 1.2, s * 4.4), Color = COL.log, Material = WOOD }))
|
||
P(wood({ Size = V(0.3, 1.4, 9), Position = c + V(s * 4.4, H + 1.2, 0), Color = COL.log, Material = WOOD }))
|
||
end
|
||
for _, sx in ipairs({ -1, 1 }) do
|
||
for _, sz in ipairs({ -1, 1 }) do
|
||
vcyl(c + V(sx * 4.2, H + 2.6, sz * 4.2), 5.2, 0.4, wood({ Color = COL.log, Material = WOOD }))
|
||
end
|
||
end
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
P(wood({ Size = V(11, 0.5, 6.4), CFrame = CFrame.new(c + V(0, H + 6.2, s * 2.7)) * CFrame.Angles(s * math.rad(30), 0, 0), Color = COL.roof, Material = SMOOTH }))
|
||
end
|
||
vcyl(c + V(0, H + 10.5, 0), 7, 0.25, wood({ Color = COL.logDark, Material = WOOD }))
|
||
local flag = P(wood({ Size = V(4, 2.6, 0.15), CFrame = CFrame.new(c + V(2.1, H + 12.6, 0)), Color = COL.banner, Material = Enum.Material.Fabric, CanCollide = false }))
|
||
surfaceText(flag, Enum.NormalId.Front, "🐟", Color3.new(1, 1, 1))
|
||
surfaceText(flag, Enum.NormalId.Back, "🐟", Color3.new(1, 1, 1))
|
||
end
|
||
|
||
-------------------------------------------------- северо-восток: домик с мостками, скала, водопад, мост
|
||
logCabin("SmallCabin", CFrame.lookAt(W + V(8, GROUND_Y, -96), W + V(4, GROUND_Y, 0)), 11, 9, 7)
|
||
smallDock(8, -86, -68, 6, GROUND_Y + 0.4)
|
||
postLantern(W + V(10.6, GROUND_Y + 0.4, -70), V(-1, 0, 0), 6)
|
||
|
||
local CLIFF_FRONT = -66 -- передняя кромка скалы по Z
|
||
local RIVER_X, RIVER_W, LIP_Y = 48, 10, 35 -- русло реки над водопадом и высота уступа
|
||
local cliff = Instance.new("Model")
|
||
cliff.Name = "Cliff"
|
||
cliff.Parent = map
|
||
do
|
||
-- скала уступами: три ряда блоков всё выше к заднему плану; у русла — вровень с уступом водопада
|
||
local rows = { { CLIFF_FRONT, 14, 22 }, { CLIFF_FRONT - 18, 26, 34 }, { CLIFF_FRONT - 40, 38, 50 } } -- { кромка, мин. высота, макс. высота }
|
||
for ri, row in ipairs(rows) do
|
||
local x = 28
|
||
while x < 116 do
|
||
local w = rng:NextNumber(11, 16)
|
||
local cx = x + w / 2
|
||
if math.abs(cx - RIVER_X) > RIVER_W / 2 + w / 2 - 1 then
|
||
local h = rng:NextNumber(row[2], row[3])
|
||
if ri <= 2 and math.abs(cx - RIVER_X) < 16 then
|
||
h = LIP_Y + rng:NextNumber(-0.5, 1.5) -- берега реки вровень с уступом: на них стоит мост
|
||
end
|
||
local d = rng:NextNumber(18, 24)
|
||
local cf = CFrame.new(W + V(cx, h / 2, row[1] - d / 2)) * CFrame.Angles(rng:NextNumber(-0.06, 0.06), rng:NextNumber(-0.25, 0.25), rng:NextNumber(-0.06, 0.06))
|
||
P({ Size = V(w, h, d), CFrame = cf, Color = COL.rock:Lerp(COL.rockDark, rng:NextNumber(0, 0.5)), Material = SMOOTH, Parent = cliff })
|
||
P({ Size = V(w - 1, 1.2, d - 1), CFrame = cf * CFrame.new(0, h / 2 + 0.3, 0), Color = COL.moss:Lerp(COL.leaf, rng:NextNumber(0, 0.5)), Material = SMOOTH, Parent = cliff })
|
||
-- острые обломки на кромке и на гранях — чтобы скала не выглядела ровной стеной
|
||
for _ = 1, 2 do
|
||
local s = rng:NextNumber(5, 9)
|
||
local cr = crag((cf * CFrame.new(rng:NextNumber(-w / 2, w / 2), rng:NextNumber(-h / 2, h / 2 - 2), -d / 2 + s * 0.2)).Position, s)
|
||
cr.Parent = cliff
|
||
end
|
||
if rng:NextNumber() < 0.7 then
|
||
pine((cf * CFrame.new(rng:NextNumber(-w / 4, w / 4), h / 2 + 0.8, rng:NextNumber(-d / 4, d / 4))).Position, rng:NextNumber(12, 20), 3)
|
||
end
|
||
end
|
||
x += w - 0.5
|
||
end
|
||
end
|
||
for x = 30, 112, 9 do
|
||
local cr = crag(W + V(x + rng:NextNumber(-3, 3), 2, CLIFF_FRONT + rng:NextNumber(0, 3)), rng:NextNumber(6, 11))
|
||
cr.Parent = cliff
|
||
end
|
||
-- ложе реки и стена за водопадом, река наверху
|
||
P({ Size = V(RIVER_W + 4, LIP_Y, 70), Position = W + V(RIVER_X, LIP_Y / 2, CLIFF_FRONT - 35), Color = COL.rockDark, Material = SMOOTH, Parent = cliff })
|
||
P({ Size = V(RIVER_W, 0.8, 70), Position = W + V(RIVER_X, LIP_Y + 0.4, CLIFF_FRONT - 35), Color = COL.water, Material = Enum.Material.Glass, Transparency = 0.15, CanCollide = false, Parent = cliff })
|
||
for z = CLIFF_FRONT - 4, CLIFF_FRONT - 66, -7 do
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
rock(W + V(RIVER_X + s * (RIVER_W / 2 + 0.5), LIP_Y + 1, z + rng:NextNumber(-2, 2)), rng:NextNumber(2.5, 4.5)).Parent = cliff
|
||
end
|
||
end
|
||
end
|
||
|
||
-- водопад: полупрозрачная «простыня», бегущие вниз струи (Beam с текстурой), пена и туман внизу
|
||
do
|
||
local fall = Instance.new("Model")
|
||
fall.Name = "Waterfall"
|
||
fall.Parent = map
|
||
local zf = CLIFF_FRONT - 1.2
|
||
local sheet = P({
|
||
Size = V(RIVER_W - 1, LIP_Y + 0.8, 1), Position = W + V(RIVER_X, LIP_Y / 2, zf),
|
||
Color = Color3.fromRGB(170, 236, 240), Material = Enum.Material.Glass, Transparency = 0.25, CanCollide = false, CastShadow = false, Parent = fall,
|
||
})
|
||
for i = 0, 4 do
|
||
local x = -RIVER_W / 2 + 1.5 + i * (RIVER_W - 3) / 4
|
||
local a0 = Instance.new("Attachment")
|
||
a0.Position = V(x, LIP_Y / 2, -0.6)
|
||
a0.Parent = sheet
|
||
local a1 = Instance.new("Attachment")
|
||
a1.Position = V(x + rng:NextNumber(-0.5, 0.5), -LIP_Y / 2, -0.6)
|
||
a1.Parent = sheet
|
||
local b = Instance.new("Beam")
|
||
b.Attachment0, b.Attachment1 = a0, a1
|
||
b.Texture = "rbxasset://textures/particles/smoke_main.dds"
|
||
b.TextureMode = Enum.TextureMode.Wrap
|
||
b.TextureLength = 5
|
||
b.TextureSpeed = rng:NextNumber(1.6, 2.4)
|
||
b.Width0, b.Width1 = 2.6, 3.2
|
||
b.FaceCamera = true
|
||
b.LightEmission = 0.35
|
||
b.Color = ColorSequence.new(Color3.new(1, 1, 1))
|
||
b.Transparency = NumberSequence.new(0.25)
|
||
b.Parent = sheet
|
||
end
|
||
for _ = 1, 9 do
|
||
vcyl(W + V(RIVER_X + rng:NextNumber(-6, 6), WATER_Y + 0.2, zf + rng:NextNumber(0.5, 6)), 0.5, rng:NextNumber(3, 6), {
|
||
Color = Color3.fromRGB(240, 252, 252), Material = SMOOTH, Transparency = 0.15, CanCollide = false, CastShadow = false, Parent = fall,
|
||
})
|
||
end
|
||
local function mistAt(pos, size, rate, s0, s1)
|
||
local holder = P({ Size = size, Position = pos, Transparency = 1, CanCollide = false, CanQuery = false, Parent = fall })
|
||
local mist = Instance.new("ParticleEmitter")
|
||
mist.Texture = "rbxasset://textures/particles/smoke_main.dds"
|
||
mist.Color = ColorSequence.new(Color3.new(1, 1, 1))
|
||
mist.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0, s0), NumberSequenceKeypoint.new(1, s1) })
|
||
mist.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.45), NumberSequenceKeypoint.new(1, 1) })
|
||
mist.Lifetime = NumberRange.new(2, 3.5)
|
||
mist.Rate = rate
|
||
mist.Speed = NumberRange.new(2, 5)
|
||
mist.SpreadAngle = Vector2.new(70, 70)
|
||
mist.Parent = holder
|
||
end
|
||
mistAt(W + V(RIVER_X, WATER_Y + 1, zf + 2), V(RIVER_W, 1, 2), 14, 4, 11)
|
||
mistAt(W + V(RIVER_X, LIP_Y, zf), V(RIVER_W, 1, 1), 5, 2, 5)
|
||
end
|
||
|
||
-- арочный деревянный мост через реку над водопадом
|
||
do
|
||
local bridge = Instance.new("Model")
|
||
bridge.Name = "Bridge"
|
||
bridge.Parent = map
|
||
local z, x0, x1, y0, rise = CLIFF_FRONT - 22, RIVER_X - 11, RIVER_X + 11, LIP_Y + 1, 3.2
|
||
local N = 12
|
||
local function arc(t)
|
||
return W + V(x0 + (x1 - x0) * t, y0 + math.sin(t * math.pi) * rise, z)
|
||
end
|
||
for i = 0, N - 1 do
|
||
local a, b = arc(i / N), arc((i + 1) / N)
|
||
P({ Size = V((b - a).Magnitude + 0.1, 0.5, 5), CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0), Color = COL.plank:Lerp(COL.plankDark, (i % 2) * 0.4), Material = PLANKS, Parent = bridge })
|
||
end
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
local prev
|
||
for i = 0, N, 2 do
|
||
local p = arc(i / N) + V(0, 0, s * 2.3)
|
||
vcyl(p + V(0, 1.4, 0), 2.8, 0.4, { Color = COL.log, Material = WOOD, Parent = bridge })
|
||
if prev then
|
||
rod(prev + V(0, 2.6, 0), p + V(0, 2.6, 0), 0.32, { Color = COL.log, Material = WOOD, Parent = bridge })
|
||
end
|
||
prev = p
|
||
end
|
||
end
|
||
end
|
||
|
||
-------------------------------------------------- у воды: камни, рогоз, кувшинки
|
||
local function nearDock(x, z)
|
||
return math.abs(x) < 9 and z > 28 and z < 70
|
||
end
|
||
local function inCliff(x, z)
|
||
return x > 24 and x < 118 and z < -58 and z > -150
|
||
end
|
||
for _, l in ipairs(LAKES) do
|
||
for _ = 1, 9 do
|
||
local a = rng:NextNumber(0, math.pi * 2)
|
||
local r = l[3] + rng:NextNumber(-1, 2.5)
|
||
local x, z = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r
|
||
if not inLake(x, z, -4) and not nearDock(x, z) and not inCliff(x, z) then
|
||
rock(W + V(x, rng:NextNumber(0.5, 2.5), z), rng:NextNumber(2.5, 5.5))
|
||
end
|
||
end
|
||
for _ = 1, 5 do
|
||
local a = rng:NextNumber(0, math.pi * 2)
|
||
local r = l[3] + rng:NextNumber(-1.5, 0.5)
|
||
local x, z = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r
|
||
if not inLake(x, z, -3) and not nearDock(x, z) and not inCliff(x, z) then
|
||
cattails(W + V(x, WATER_Y - 0.5, z))
|
||
end
|
||
end
|
||
end
|
||
for _, p in ipairs({ { 11, 55 }, { 15, 52 }, { -9, 53 }, { 20, 47 } }) do -- рогоз в правом нижнем углу кадра
|
||
cattails(W + V(p[1], WATER_Y - 0.5, p[2]))
|
||
end
|
||
for _ = 1, 14 do -- кувшинки группами
|
||
local l = LAKES[rng:NextInteger(1, #LAKES)]
|
||
local a = rng:NextNumber(0, math.pi * 2)
|
||
local r = l[3] * rng:NextNumber(0.5, 0.88)
|
||
local cx, cz = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r
|
||
for _ = 1, rng:NextInteger(2, 5) do
|
||
local x, z = cx + rng:NextNumber(-3, 3), cz + rng:NextNumber(-3, 3)
|
||
if inLake(x, z, -2) and not nearDock(x, z) and not (x > 6 and x < 20 and z > 36 and z < 56) then
|
||
local size = rng:NextNumber(2, 3.4)
|
||
P({ Shape = Enum.PartType.Cylinder, Size = V(0.15, size, size), CFrame = CFrame.new(W + V(x, WATER_Y + 0.12, z)) * CFrame.Angles(0, 0, math.rad(90)), Color = Color3.fromRGB(78, 168, 70):Lerp(Color3.fromRGB(110, 190, 80), rng:NextNumber()), Material = SMOOTH, CanCollide = false, CastShadow = false })
|
||
if rng:NextNumber() < 0.35 then
|
||
ball(W + V(x + 0.3, WATER_Y + 0.45, z), 0.8, { Color = Color3.fromRGB(255, 150, 195), Material = SMOOTH, CanCollide = false, CastShadow = false })
|
||
ball(W + V(x + 0.3, WATER_Y + 0.75, z), 0.4, { Color = Color3.fromRGB(255, 235, 120), Material = SMOOTH, CanCollide = false, CastShadow = false })
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
-------------------------------------------------- лес, кусты, цветы
|
||
local function nearPath(x, z, dist)
|
||
for i = 2, #HILL_PATH do
|
||
local a, b = HILL_PATH[i - 1], HILL_PATH[i]
|
||
local abx, abz = b[1] - a[1], b[2] - a[2]
|
||
local t = math.clamp(((x - a[1]) * abx + (z - a[2]) * abz) / (abx * abx + abz * abz), 0, 1)
|
||
if (x - a[1] - abx * t) ^ 2 + (z - a[2] - abz * t) ^ 2 < dist * dist then
|
||
return true
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
local function freeSpot(x, z)
|
||
if math.abs(x) > 236 or math.abs(z) > 236 or inLake(x, z, 6) or inCliff(x, z) or nearPath(x, z, 6) then
|
||
return false
|
||
end
|
||
if x > -32 and x < 30 and z > 44 and z < 100 then -- прибытие, лавка, портал
|
||
return false
|
||
end
|
||
for _, c in ipairs({ { -58, -62, 16 }, { 8, -96, 13 }, { -76, -136, 11 }, { -17, -80, 5 } }) do
|
||
if (x - c[1]) ^ 2 + (z - c[2]) ^ 2 < c[3] * c[3] then
|
||
return false
|
||
end
|
||
end
|
||
return not (x > 2 and x < 14 and z > -100 and z < -64) -- мостки у домика
|
||
end
|
||
|
||
local placed = 0
|
||
for _ = 1, 700 do
|
||
if placed >= 210 then
|
||
break
|
||
end
|
||
local x, z = rng:NextNumber(-236, 236), rng:NextNumber(-236, 236)
|
||
-- за озером лес гуще, перед ним (за спиной игрока) реже
|
||
if (z < 0 or rng:NextNumber() < 0.45) and freeSpot(x, z) then
|
||
local far = math.max(math.abs(x), math.abs(z)) > 150
|
||
pine(W + V(x, hillY(x, z) - 0.3, z), far and rng:NextNumber(22, 32) or rng:NextNumber(15, 25), far and 2 or 3)
|
||
placed += 1
|
||
end
|
||
end
|
||
for _ = 1, 25 do -- лиственные деревья у берегов
|
||
local l = LAKES[rng:NextInteger(1, #LAKES)]
|
||
local a = rng:NextNumber(0, math.pi * 2)
|
||
local r = l[3] + rng:NextNumber(8, 18)
|
||
local x, z = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r
|
||
if freeSpot(x, z) then
|
||
leafy(W + V(x, hillY(x, z) - 0.3, z), rng:NextNumber(8, 12))
|
||
end
|
||
end
|
||
for _ = 1, 50 do -- кусты
|
||
local x, z = rng:NextNumber(-150, 150), rng:NextNumber(-150, 120)
|
||
if freeSpot(x, z) then
|
||
local y = hillY(x, z)
|
||
local c = COL.leafDark:Lerp(COL.leaf, rng:NextNumber())
|
||
for _ = 1, 3 do
|
||
ball(W + V(x + rng:NextNumber(-1.5, 1.5), y + 0.8, z + rng:NextNumber(-1.5, 1.5)), rng:NextNumber(2.5, 4), { Color = c, Material = SMOOTH, CanCollide = false })
|
||
end
|
||
end
|
||
end
|
||
for _ = 1, 80 do -- цветы
|
||
local x, z = rng:NextNumber(-120, 120), rng:NextNumber(-140, 110)
|
||
if freeSpot(x, z) or nearPath(x, z, 6) and not nearPath(x, z, 3) then
|
||
ball(W + V(x, hillY(x, z) + 0.4, z), 0.6, {
|
||
Color = ({ Color3.fromRGB(255, 120, 150), Color3.fromRGB(255, 230, 90), Color3.fromRGB(245, 245, 255), Color3.fromRGB(190, 140, 255) })[rng:NextInteger(1, 4)],
|
||
Material = SMOOTH, CanCollide = false, CastShadow = false,
|
||
})
|
||
end
|
||
end
|
||
-- отдельные детали (деревья, камни, кусты, фонари) — в папку Decor, чтобы в Explorer было видно
|
||
-- главное: модели и маркеры World1*/Guide*
|
||
local decor = Instance.new("Folder")
|
||
decor.Name = "Decor"
|
||
decor.Parent = map
|
||
for _, c in ipairs(map:GetChildren()) do
|
||
if c:IsA("BasePart") and not c.Name:match("^World1") and not c.Name:match("^Guide") then
|
||
c.Parent = decor
|
||
end
|
||
end
|
||
|
||
-------------------------------------------------- горизонт: горы и облака
|
||
do
|
||
local horizon = Instance.new("Folder")
|
||
horizon.Name = "Horizon"
|
||
horizon.Parent = map
|
||
-- гора — несколько острых пиков (кубы вершиной вверх) разного размера
|
||
local function mountain(a, dist, s)
|
||
local base = W + V(math.cos(a) * dist, 0, math.sin(a) * dist)
|
||
for k = 1, 3 do
|
||
local ss = k == 1 and s or s * rng:NextNumber(0.45, 0.7)
|
||
local off = k == 1 and V(0, 0, 0) or V(rng:NextNumber(-0.7, 0.7) * s, 0, rng:NextNumber(-0.4, 0.4) * s)
|
||
local apex = ss * rng:NextNumber(0.55, 0.75) -- высота пика над землёй
|
||
P({
|
||
Size = V(ss, ss, ss),
|
||
CFrame = CFrame.new(base + off + V(0, apex - ss * 0.866, 0)) * CFrame.Angles(rng:NextNumber(-0.1, 0.1), rng:NextNumber(0, 6.28), rng:NextNumber(-0.1, 0.1)) * CUBE_UP,
|
||
Color = Color3.fromRGB(152, 166, 190):Lerp(Color3.fromRGB(118, 134, 164), rng:NextNumber()), Material = SMOOTH,
|
||
CanCollide = false, CanQuery = false, CastShadow = false, Parent = horizon,
|
||
})
|
||
end
|
||
end
|
||
for i = 0, 13 do -- север (за озером) — крупнее и плотнее
|
||
mountain(math.rad(-160 + i * 10 + rng:NextNumber(-4, 4)), rng:NextNumber(340, 470), rng:NextNumber(130, 220))
|
||
end
|
||
for i = 0, 9 do -- остальные стороны
|
||
mountain(math.rad(20 + i * 16 + rng:NextNumber(-5, 5)), rng:NextNumber(360, 480), rng:NextNumber(100, 160))
|
||
end
|
||
for _ = 1, 9 do
|
||
local c = W + V(rng:NextNumber(-380, 380), rng:NextNumber(170, 230), rng:NextNumber(-420, 200))
|
||
for _ = 1, rng:NextInteger(4, 6) do
|
||
ball(c + V(rng:NextNumber(-30, 30), rng:NextNumber(-5, 8), rng:NextNumber(-12, 12)), rng:NextNumber(22, 42), {
|
||
Color = Color3.new(1, 1, 1), Material = SMOOTH, CanCollide = false, CanQuery = false, CastShadow = false, Parent = horizon,
|
||
})
|
||
end
|
||
end
|
||
end
|
||
|
||
-- невидимые стены по краю мира
|
||
for _, w in ipairs({
|
||
{ V(0, 0, 245), V(500, 120, 2) },
|
||
{ V(0, 0, -245), V(500, 120, 2) },
|
||
{ V(245, 0, 0), V(2, 120, 500) },
|
||
{ V(-245, 0, 0), V(2, 120, 500) },
|
||
}) do
|
||
P({ Name = "WorldWall", Size = w[2], Position = W + w[1] + V(0, 50, 0), Transparency = 1, CanQuery = false })
|
||
end
|
||
|
||
map.Parent = parent
|
||
return map
|
||
end
|
||
|
||
-- сборка в Studio: стирает старую папку и террейн мира, строит заново прямо в Workspace
|
||
function Builder.bake()
|
||
local old = Workspace:FindFirstChild("World1Map")
|
||
if old then
|
||
old:Destroy()
|
||
end
|
||
terrain:FillBlock(CFrame.new(W + V(0, 30, 0)), V(504, 120, 504), Enum.Material.Air)
|
||
local map = Builder.build(Workspace)
|
||
print(("✅ «Тихое озеро» собрано: Workspace.World1Map, деталей: %d. Сохраните плейс (Ctrl+S)."):format(#map:GetDescendants()))
|
||
return map
|
||
end
|
||
|
||
return Builder
|
||
]=====])
|
||
put('ModuleScript', 'WorldBuilder', game.ServerScriptService, [=====[-- WorldBuilder (ModuleScript) -> ServerScriptService
|
||
-- Строит всю карту: лобби и все миры (папка Workspace.FishingMap + террейн миров).
|
||
-- Карту собирают ОДИН РАЗ прямо в Roblox Studio, в режиме редактирования, и сохраняют плейс:
|
||
-- после этого всё видно в редакторе и правится руками как обычные детали и модели.
|
||
-- Команда для Command Bar (строка внизу Studio):
|
||
-- require(game.ServerScriptService.WorldBuilder:Clone()).bake()
|
||
-- bake() стирает Workspace.FishingMap и террейн миров и строит всё заново.
|
||
-- Если FishingMap в плейсе нет, MapBuilder при запуске игры строит карту этим же модулем.
|
||
--
|
||
-- Что нужно игре от карты (не удаляйте и не переименовывайте):
|
||
-- маркеры-плитки (*Spawn, Guide*, LobbySpawn) — их можно двигать;
|
||
-- детали NpcSpot / World1Npc* с атрибутом NpcName — на них при запуске встают NPC
|
||
-- (полупрозрачные фигуры в редакторе, в игре скрыты); внешность — в атрибутах детали;
|
||
-- доски с атрибутом Bestiary — текст «кто водится» пишется при запуске по FishConfig;
|
||
-- ProximityPrompt с атрибутом Action (Shop, Sell, Portal, Daily, Talk, ...).
|
||
|
||
local Workspace = game:GetService("Workspace")
|
||
local ServerStorage = game:GetService("ServerStorage")
|
||
local Lighting = game:GetService("Lighting")
|
||
local Players = game:GetService("Players")
|
||
local RunService = game:GetService("RunService")
|
||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||
local ServerScriptService = game:GetService("ServerScriptService")
|
||
|
||
-- в Command Bar require кэширует модули: берём копии, чтобы подхватывать свежие правки из Rojo
|
||
-- (копия на время загрузки лежит рядом с оригиналом — модули ищут соседей через script.Parent)
|
||
local function load(module)
|
||
if RunService:IsRunning() then
|
||
return require(module)
|
||
end
|
||
local copy = module:Clone()
|
||
copy.Parent = module.Parent
|
||
local ok, result = pcall(require, copy)
|
||
copy:Destroy()
|
||
if not ok then
|
||
error(result, 0)
|
||
end
|
||
return result
|
||
end
|
||
local Config = load(ReplicatedStorage:WaitForChild("FishConfig"))
|
||
local Models = load(ReplicatedStorage:WaitForChild("GameModels"))
|
||
local World1Builder = load(ServerScriptService:WaitForChild("World1Builder"))
|
||
|
||
local V = Vector3.new
|
||
local terrain = Workspace.Terrain
|
||
local GROUND_Y = 4 -- верх земли в мирах (запасная высота для groundY)
|
||
local FLOOR = 1 -- верх пола лобби
|
||
|
||
local Builder = {}
|
||
local map -- папка FishingMap, которую сейчас строим
|
||
local rng = Random.new(7)
|
||
|
||
---------------------------------------------------------------- свет и атмосфера
|
||
|
||
local function ensure(class, parent, props)
|
||
local obj = parent:FindFirstChildOfClass(class) or Instance.new(class)
|
||
for k, v in pairs(props) do
|
||
obj[k] = v
|
||
end
|
||
obj.Parent = parent
|
||
return obj
|
||
end
|
||
|
||
-- Базовый свет при запуске игры (совпадает со светом лобби). Под каждую локацию его меняет клиент
|
||
-- по полям look из FishConfig, пока игрок за экраном загрузки.
|
||
function Builder.applyLighting()
|
||
Lighting.ClockTime = 16.3
|
||
Lighting.Brightness = 2.0
|
||
Lighting.ExposureCompensation = -0.3
|
||
Lighting.Ambient = Color3.fromRGB(64, 60, 72)
|
||
Lighting.OutdoorAmbient = Color3.fromRGB(120, 114, 124)
|
||
Lighting.ColorShift_Top = Color3.fromRGB(255, 224, 186)
|
||
Lighting.EnvironmentDiffuseScale = 0.5
|
||
Lighting.EnvironmentSpecularScale = 0.5
|
||
Lighting.GlobalShadows = true
|
||
ensure("Atmosphere", Lighting, {
|
||
Density = 0.4, Offset = 0.18, Glare = 0.25, Haze = 1.6,
|
||
Color = Color3.fromRGB(222, 212, 204), Decay = Color3.fromRGB(186, 160, 150),
|
||
})
|
||
ensure("BloomEffect", Lighting, { Intensity = 0.3, Size = 24, Threshold = 1.8 })
|
||
ensure("ColorCorrectionEffect", Lighting, {
|
||
Saturation = 0.18, Contrast = 0.14, Brightness = -0.04, TintColor = Color3.fromRGB(255, 242, 228),
|
||
})
|
||
ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.7 })
|
||
-- размытие дальнего плана включают миры и лобби через look.dof
|
||
ensure("DepthOfFieldEffect", Lighting, { Enabled = false, FarIntensity = 0.18, FocusDistance = 55, InFocusRadius = 95, NearIntensity = 0 })
|
||
end
|
||
|
||
---------------------------------------------------------------- помощники
|
||
|
||
local function P(props)
|
||
local p = Instance.new("Part")
|
||
if props.Shape then
|
||
p.Shape = props.Shape
|
||
end
|
||
p.Anchored = true
|
||
p.TopSurface = Enum.SurfaceType.Smooth
|
||
p.BottomSurface = Enum.SurfaceType.Smooth
|
||
for k, v in pairs(props) do
|
||
if k ~= "Parent" and k ~= "Shape" then
|
||
p[k] = v
|
||
end
|
||
end
|
||
p.Parent = props.Parent or map
|
||
return p
|
||
end
|
||
|
||
local function vcyl(pos, h, d, props)
|
||
props.Shape = Enum.PartType.Cylinder
|
||
props.Size = V(h, d, d)
|
||
props.CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90))
|
||
return P(props)
|
||
end
|
||
|
||
local function ball(pos, d, props)
|
||
props.Shape = Enum.PartType.Ball
|
||
props.Size = V(d, d, d)
|
||
props.Position = pos
|
||
return P(props)
|
||
end
|
||
|
||
local function surfaceText(part, face, text, color, extra)
|
||
local sg = Instance.new("SurfaceGui")
|
||
sg.Face = face
|
||
sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
|
||
sg.PixelsPerStud = 40
|
||
sg.LightInfluence = 0
|
||
sg.Parent = part
|
||
local t = Instance.new("TextLabel")
|
||
t.Size = UDim2.fromScale(1, 1)
|
||
t.BackgroundTransparency = 1
|
||
t.Font = Enum.Font.FredokaOne
|
||
t.TextScaled = true
|
||
t.RichText = true
|
||
t.TextColor3 = color or Color3.new(1, 1, 1)
|
||
t.TextStrokeTransparency = 0.4
|
||
t.Text = text
|
||
t.Parent = sg
|
||
local pad = Instance.new("UIPadding")
|
||
pad.PaddingLeft = UDim.new(0.05, 0)
|
||
pad.PaddingRight = UDim.new(0.05, 0)
|
||
pad.PaddingTop = UDim.new(0.06, 0)
|
||
pad.PaddingBottom = UDim.new(0.06, 0)
|
||
pad.Parent = t
|
||
for k, v in pairs(extra or {}) do
|
||
t[k] = v
|
||
end
|
||
return t
|
||
end
|
||
|
||
local function billboard(target, text, color, offsetY, width)
|
||
local bb = Instance.new("BillboardGui")
|
||
bb.Size = UDim2.fromOffset(width or 300, 64)
|
||
bb.StudsOffset = V(0, offsetY or 5, 0)
|
||
bb.MaxDistance = 160
|
||
bb.LightInfluence = 0
|
||
bb.Parent = target
|
||
local t = Instance.new("TextLabel")
|
||
t.Size = UDim2.fromScale(1, 1)
|
||
t.BackgroundTransparency = 1
|
||
t.Font = Enum.Font.FredokaOne
|
||
t.TextScaled = true
|
||
t.TextColor3 = color or Color3.new(1, 1, 1)
|
||
t.TextStrokeTransparency = 0.15
|
||
t.Text = text
|
||
t.Parent = bb
|
||
return bb
|
||
end
|
||
|
||
local function prompt(target, actionText, objectText, action, dist)
|
||
local pp = Instance.new("ProximityPrompt")
|
||
pp.ActionText = actionText
|
||
pp.ObjectText = objectText
|
||
pp.HoldDuration = 0
|
||
pp.MaxActivationDistance = dist or 13
|
||
pp.RequiresLineOfSight = false
|
||
pp:SetAttribute("Action", action)
|
||
pp.Parent = target
|
||
return pp
|
||
end
|
||
|
||
local function marker(name, cf)
|
||
return P({ Name = name, Size = V(4, 1, 4), CFrame = cf, Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false })
|
||
end
|
||
|
||
local function lobbyCliffs()
|
||
local template = ServerStorage:FindFirstChild("FishingCliffTemplate")
|
||
if not template or not template:IsA("Model") then
|
||
warn("FishingCliffTemplate отсутствует; используем низкую изгородь лобби")
|
||
for deg = 0, 359, 7 do
|
||
local a = math.rad(deg)
|
||
local p = V(math.cos(a) * 82, FLOOR + 2, math.sin(a) * 82)
|
||
P({ Size = V(10.5, 4, 3), CFrame = CFrame.lookAt(p, V(0, p.Y, 0)), Material = Enum.Material.Grass, Color = Color3.fromRGB(60, 130, 55) })
|
||
end
|
||
return
|
||
end
|
||
|
||
local ring = Instance.new("Folder")
|
||
ring.Name = "LobbyCliffs"
|
||
ring.Parent = map
|
||
local count = 24
|
||
local tiers = {
|
||
{ name = "LobbyCliff", radius = 88, scale = 1.4, baseY = FLOOR },
|
||
{ name = "LobbyCliffUpper", radius = 104, scale = 2.2, baseY = FLOOR + 10 },
|
||
}
|
||
for _, tier in ipairs(tiers) do
|
||
for i = 1, count do
|
||
local angle = (i - 1) * 2 * math.pi / count
|
||
local radial = V(math.cos(angle), 0, math.sin(angle))
|
||
local center = V(radial.X * tier.radius, tier.baseY, radial.Z * tier.radius)
|
||
local model = template:Clone()
|
||
model.Name = string.format("%s_%02d", tier.name, i)
|
||
model:ScaleTo(tier.scale)
|
||
local facing = CFrame.lookAt(center, center + radial)
|
||
local rotation = facing - facing.Position
|
||
model:PivotTo(CFrame.new(center) * rotation)
|
||
local boxCF, boxSize = model:GetBoundingBox()
|
||
local targetBoxCenter = V(center.X, tier.baseY + boxSize.Y / 2, center.Z)
|
||
model:PivotTo(model:GetPivot() + (targetBoxCenter - boxCF.Position))
|
||
model.Parent = ring
|
||
end
|
||
end
|
||
end
|
||
|
||
local function rockTopPosition(cliffs, radial, desiredRadius, radiusOffsets)
|
||
local params = RaycastParams.new()
|
||
params.FilterType = Enum.RaycastFilterType.Include
|
||
params.FilterDescendantsInstances = { cliffs }
|
||
for _, offset in ipairs(radiusOffsets) do
|
||
local radius = desiredRadius + offset
|
||
local origin = V(radial.X * radius, 128, radial.Z * radius)
|
||
local hit = Workspace:Raycast(origin, V(0, -180, 0), params)
|
||
if hit then
|
||
return hit.Position
|
||
end
|
||
end
|
||
return V(radial.X * desiredRadius, FLOOR, radial.Z * desiredRadius)
|
||
end
|
||
|
||
local function placeModelOnRock(model, position, yaw)
|
||
local rotation = CFrame.Angles(0, yaw, 0)
|
||
model:PivotTo(CFrame.new(position) * rotation)
|
||
local boxCF, boxSize = model:GetBoundingBox()
|
||
local targetBoxCenter = V(position.X, position.Y + boxSize.Y / 2, position.Z)
|
||
model:PivotTo(model:GetPivot() + (targetBoxCenter - boxCF.Position))
|
||
end
|
||
|
||
local function lobbyTrees()
|
||
local templates = ServerStorage:FindFirstChild("LobbyTreeTemplates")
|
||
local cliffs = map:FindFirstChild("LobbyCliffs")
|
||
if not templates or not cliffs then
|
||
warn("LobbyTreeTemplates или LobbyCliffs отсутствует; деревья лобби пропущены")
|
||
return
|
||
end
|
||
local treeTypes = { "LargeCanopy", "Pine", "RoundCanopy" }
|
||
local treeScale = { LargeCanopy = 1, Pine = 1.25, RoundCanopy = 1.2 }
|
||
local folder = Instance.new("Folder")
|
||
folder.Name = "LobbyTrees"
|
||
folder.Parent = map
|
||
for layer = 1, 2 do
|
||
local baseRadius = layer == 1 and 84 or 96
|
||
local radiusOffsets = { 0, -2, 2, -4, 4, -6, 6 }
|
||
for i = 1, 18 do
|
||
local degrees = (i - 1) * 20 + 10 + (layer == 2 and 10 or 0)
|
||
local angle = math.rad(degrees)
|
||
local radial = V(math.cos(angle), 0, math.sin(angle))
|
||
local position = rockTopPosition(cliffs, radial, baseRadius, radiusOffsets)
|
||
local kind = treeTypes[(i + layer - 2) % #treeTypes + 1]
|
||
local template = templates:FindFirstChild(kind)
|
||
if template and template:IsA("Model") then
|
||
local model = template:Clone()
|
||
model.Name = string.format("LobbyTree_L%d_%02d_%s", layer, i, kind)
|
||
model:ScaleTo(treeScale[kind])
|
||
placeModelOnRock(model, position, math.rad((i * 47 + layer * 23) % 360))
|
||
for _, part in ipairs(model:GetDescendants()) do
|
||
if part:IsA("BasePart") then part.Anchored = true end
|
||
end
|
||
model.Parent = folder
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
local function lobbyRockPlants()
|
||
local templates = ServerStorage:FindFirstChild("LobbyRockPlantTemplates")
|
||
local cliffs = map:FindFirstChild("LobbyCliffs")
|
||
if not templates or not cliffs then
|
||
warn("LobbyRockPlantTemplates или LobbyCliffs отсутствует; растительность скал пропущена")
|
||
return
|
||
end
|
||
local folder = Instance.new("Folder")
|
||
folder.Name = "LobbyRockPlants"
|
||
folder.Parent = map
|
||
local clusterAngles = {
|
||
{ layer = 1, degrees = 45 }, { layer = 1, degrees = 135 },
|
||
{ layer = 1, degrees = 225 }, { layer = 1, degrees = 315 },
|
||
{ layer = 2, degrees = 0 }, { layer = 2, degrees = 90 },
|
||
{ layer = 2, degrees = 180 }, { layer = 2, degrees = 270 },
|
||
}
|
||
local tuftKinds = { "GrassTuft", "BladeGrass", "GrassTuft", "FlowerPatch", "GrassTuft", "WideGrass" }
|
||
local tuftScales = { GrassTuft = 1.15, BladeGrass = 1.45, FlowerPatch = 1.1, WideGrass = 0.55 }
|
||
local offsets = { { 0, 0 }, { -2.2, 0 }, { 2.2, 0 }, { 0, -2.2 }, { 0, 2.2 }, { 1.6, 1.6 } }
|
||
local rayParams = RaycastParams.new()
|
||
rayParams.FilterType = Enum.RaycastFilterType.Include
|
||
rayParams.FilterDescendantsInstances = { cliffs }
|
||
for clusterIndex, cluster in ipairs(clusterAngles) do
|
||
local baseRadius = cluster.layer == 1 and 84 or 96
|
||
local baseAngle = math.rad(cluster.degrees)
|
||
local radial = V(math.cos(baseAngle), 0, math.sin(baseAngle))
|
||
local tangent = V(-radial.Z, 0, radial.X)
|
||
local basePos = rockTopPosition(cliffs, radial, baseRadius, { 0, -2, 2, -4, 4, -6, 6 })
|
||
local bush = Instance.new("Model")
|
||
bush.Name = string.format("GrassBush_%02d_L%d", clusterIndex, cluster.layer)
|
||
for i, offset in ipairs(offsets) do
|
||
local xz = basePos + radial * offset[1] + tangent * offset[2]
|
||
local plantPos
|
||
for _, correction in ipairs({ 0, -2, 2, -4, 4 }) do
|
||
local candidate = xz + radial * correction
|
||
local hit = Workspace:Raycast(V(candidate.X, 128, candidate.Z), V(0, -180, 0), rayParams)
|
||
if hit then plantPos = hit.Position; break end
|
||
end
|
||
if plantPos then
|
||
local kind = tuftKinds[i]
|
||
local template = templates:FindFirstChild(kind)
|
||
if template and template:IsA("Model") then
|
||
local plant = template:Clone()
|
||
plant.Name = kind .. "_" .. i
|
||
plant:ScaleTo(tuftScales[kind])
|
||
placeModelOnRock(plant, plantPos, math.rad((clusterIndex * 37 + i * 53) % 360))
|
||
for _, part in ipairs(plant:GetDescendants()) do
|
||
if part:IsA("BasePart") then part.Anchored = true end
|
||
end
|
||
plant.Parent = bush
|
||
end
|
||
end
|
||
end
|
||
bush.Parent = folder
|
||
end
|
||
end
|
||
-- холмы и горы за скалами лобби (террейн), ельники на склонах и кольцо тумана за горами.
|
||
-- К горизонту холмы выше, чтобы из лобби было видно не пустоту, а гряду в дымке.
|
||
local function lobbyHillHeight(x, z)
|
||
local r = math.sqrt(x * x + z * z)
|
||
if r < 120 then
|
||
return nil
|
||
end
|
||
local t = math.clamp((r - 120) / 220, 0, 1)
|
||
local base = 22 + 90 * t ^ 0.85
|
||
local n = math.noise(x / 95, z / 95, 1.7) * 30 + math.noise(x / 38, z / 38, 5.1) * 9
|
||
local peak = math.max(0, math.noise(x / 150, z / 150, 9.3)) * 70 * t
|
||
local edge = math.clamp((r - 120) / 12, 0, 1)
|
||
return (base + n * (0.35 + 0.65 * t) + peak) * edge
|
||
end
|
||
|
||
local function lobbyHills()
|
||
local R, Y0, Y1, CH = 384, -8, 232, 64
|
||
for cx = -R, R - CH, CH do
|
||
for cz = -R, R - CH, CH do
|
||
-- чанк целиком внутри лобби пропускаем
|
||
local far = math.sqrt(math.max(cx * cx, (cx + CH) ^ 2) + math.max(cz * cz, (cz + CH) ^ 2))
|
||
if far >= 120 then
|
||
local region = Region3.new(V(cx, Y0, cz), V(cx + CH, Y1, cz + CH))
|
||
local nx, ny, nz = CH / 4, (Y1 - Y0) / 4, CH / 4
|
||
local mats, occs = {}, {}
|
||
for i = 1, nx do
|
||
mats[i], occs[i] = {}, {}
|
||
for j = 1, ny do
|
||
mats[i][j], occs[i][j] = {}, {}
|
||
end
|
||
for k = 1, nz do
|
||
local x, z = cx + (i - 0.5) * 4, cz + (k - 0.5) * 4
|
||
local h = (math.sqrt(x * x + z * z) <= R) and lobbyHillHeight(x, z) or nil
|
||
for j = 1, ny do
|
||
local yb = Y0 + (j - 1) * 4
|
||
local occ = h and math.clamp((h - yb) / 4, 0, 1) or 0
|
||
local m = Enum.Material.Air
|
||
if occ > 0 then
|
||
if yb > h - 6 then
|
||
m = h > 118 and Enum.Material.Rock or Enum.Material.Grass
|
||
else
|
||
m = Enum.Material.Ground
|
||
end
|
||
end
|
||
mats[i][j][k], occs[i][j][k] = m, occ
|
||
end
|
||
end
|
||
end
|
||
terrain:WriteVoxels(region, 4, mats, occs)
|
||
end
|
||
end
|
||
end
|
||
|
||
-- ельники пятнами на склонах
|
||
local pines = ServerStorage:FindFirstChild("OldPines")
|
||
local forest = Instance.new("Folder")
|
||
forest.Name = "LobbyHillForest"
|
||
forest.Parent = map
|
||
if pines and #pines:GetChildren() > 0 then
|
||
local templates = pines:GetChildren()
|
||
local frng = Random.new(1104)
|
||
local placed = {}
|
||
for _ = 1, 4000 do
|
||
if #placed >= 170 then break end
|
||
local a = frng:NextNumber(0, math.pi * 2)
|
||
local r = frng:NextNumber(132, 300)
|
||
local x, z = math.cos(a) * r, math.sin(a) * r
|
||
-- высоту берём из той же формулы: лучи по только что залитому террейну в редакторе ненадёжны
|
||
local h = lobbyHillHeight(x, z)
|
||
local slope = h and math.max(math.abs((lobbyHillHeight(x + 4, z) or h) - h), math.abs((lobbyHillHeight(x, z + 4) or h) - h)) / 4
|
||
if h and h <= 118 and slope < 0.8 and math.noise(x / 60, z / 60, 3.3) > -0.05 then
|
||
local ground = V(x, h, z)
|
||
local ok = true
|
||
for _, q in ipairs(placed) do
|
||
if (q - ground).Magnitude < 9 then ok = false break end
|
||
end
|
||
if ok then
|
||
local m = templates[frng:NextInteger(1, #templates)]:Clone()
|
||
for _, d in ipairs(m:GetDescendants()) do
|
||
if d:IsA("LuaSourceContainer") then
|
||
d:Destroy()
|
||
elseif d:IsA("BasePart") then
|
||
d.Anchored = true
|
||
d.CanCollide = false
|
||
d.CastShadow = false
|
||
end
|
||
end
|
||
m:ScaleTo(m:GetScale() * frng:NextNumber(0.8, 1.5))
|
||
m:PivotTo(CFrame.new(ground) * CFrame.Angles(0, frng:NextNumber(0, math.pi * 2), 0))
|
||
local bcf, bsz = m:GetBoundingBox()
|
||
m:PivotTo(m:GetPivot() + V(0, ground.Y - (bcf.Position.Y - bsz.Y / 2) - 1, 0))
|
||
m.Parent = forest
|
||
table.insert(placed, ground)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
-- туман за горами: медленные крупные клубы по двум кольцам
|
||
local haze = Instance.new("Folder")
|
||
haze.Name = "LobbyHaze"
|
||
haze.Parent = map
|
||
for ring, cfg in ipairs({ { r = 150, n = 28, y = 18, size = 45 }, { r = 250, n = 36, y = 40, size = 70 } }) do
|
||
for i = 1, cfg.n do
|
||
local a = (i - 1) / cfg.n * math.pi * 2
|
||
local x, z = math.cos(a) * cfg.r, math.sin(a) * cfg.r
|
||
local h = lobbyHillHeight(x, z) or 0
|
||
local anchor = Instance.new("Part")
|
||
anchor.Name = "HazeAnchor"
|
||
anchor.Anchored = true
|
||
anchor.CanCollide = false
|
||
anchor.CanQuery = false
|
||
anchor.CanTouch = false
|
||
anchor.Transparency = 1
|
||
anchor.Size = V(30, 4, 30)
|
||
anchor.CFrame = CFrame.new(x, h + cfg.y, z)
|
||
anchor.Parent = haze
|
||
local pe = Instance.new("ParticleEmitter")
|
||
pe.Texture = "rbxasset://textures/particles/smoke_main.dds"
|
||
pe.Color = ColorSequence.new(Color3.fromRGB(236, 228, 220))
|
||
pe.LightEmission = 0.15
|
||
pe.LightInfluence = 0.6
|
||
pe.Rate = ring == 1 and 0.5 or 0.35
|
||
pe.Lifetime = NumberRange.new(16, 22)
|
||
pe.Speed = NumberRange.new(0.3, 0.8)
|
||
pe.SpreadAngle = Vector2.new(60, 60)
|
||
pe.Rotation = NumberRange.new(0, 360)
|
||
pe.RotSpeed = NumberRange.new(-4, 4)
|
||
pe.Size = NumberSequence.new({
|
||
NumberSequenceKeypoint.new(0, cfg.size * 0.7),
|
||
NumberSequenceKeypoint.new(1, cfg.size * 1.2),
|
||
})
|
||
pe.Transparency = NumberSequence.new({
|
||
NumberSequenceKeypoint.new(0, 1),
|
||
NumberSequenceKeypoint.new(0.3, 0.8),
|
||
NumberSequenceKeypoint.new(0.7, 0.82),
|
||
NumberSequenceKeypoint.new(1, 1),
|
||
})
|
||
pe.Parent = anchor
|
||
end
|
||
end
|
||
end
|
||
|
||
-- высота земли: читаем воксели столбца (лучи по только что залитому террейну ненадёжны, особенно в редакторе)
|
||
local function groundY(x, z)
|
||
local region = Region3.new(V(x - 1, -128, z - 1), V(x + 1, 160, z + 1)):ExpandToGrid(4)
|
||
local ok, mats, occ = pcall(terrain.ReadVoxels, terrain, region, 4)
|
||
if ok then
|
||
local bottom = region.CFrame.Position.Y - region.Size.Y / 2
|
||
for y = mats.Size.Y, 1, -1 do
|
||
local m = mats[1][y][1]
|
||
if m ~= Enum.Material.Air and m ~= Enum.Material.Water then
|
||
return bottom + (y - 1 + occ[1][y][1]) * 4, m
|
||
end
|
||
end
|
||
end
|
||
return GROUND_Y
|
||
end
|
||
|
||
local function lamp(pos, color)
|
||
vcyl(pos + V(0, 4.5, 0), 9, 0.5, { Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal })
|
||
P({ Size = V(1.4, 0.3, 1.4), Position = pos + V(0, 9.1, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal })
|
||
local bulb = P({ Size = V(1, 1.4, 1), Position = pos + V(0, 9.95, 0), Material = Enum.Material.Neon, Color = color or Color3.fromRGB(255, 215, 150) })
|
||
P({ Size = V(1.5, 0.35, 1.5), Position = pos + V(0, 10.8, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal })
|
||
local light = Instance.new("PointLight")
|
||
light.Range = 16
|
||
light.Brightness = 1.2
|
||
light.Color = color or Color3.fromRGB(255, 210, 150)
|
||
light.Parent = bulb
|
||
end
|
||
|
||
local function tree(pos, kind)
|
||
if kind == "pine" then
|
||
local h = rng:NextNumber(8, 12)
|
||
vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(95, 65, 40), Material = Enum.Material.Wood })
|
||
for i = 0, 3 do
|
||
ball(pos + V(0, h * 0.4 + i * 2.8, 0), 10 - i * 2.2, { Color = Color3.fromRGB(35, 100 + i * 10, 55), Material = Enum.Material.Grass })
|
||
end
|
||
else
|
||
local birch = kind == "birch"
|
||
local h = rng:NextNumber(7, 10)
|
||
vcyl(pos + V(0, h / 2, 0), h, 1.5, {
|
||
Color = birch and Color3.fromRGB(225, 222, 210) or Color3.fromRGB(105, 72, 45),
|
||
Material = Enum.Material.Wood,
|
||
})
|
||
local leaf = birch and Color3.fromRGB(150, 195, 80) or Color3.fromRGB(65, rng:NextInteger(135, 165), 60)
|
||
local s = rng:NextNumber(9, 12)
|
||
ball(pos + V(0, h + s * 0.25, 0), s, { Color = leaf, Material = Enum.Material.Grass })
|
||
ball(pos + V(s * 0.35, h - 0.5, s * 0.1), s * 0.7, { Color = leaf, Material = Enum.Material.Grass })
|
||
ball(pos + V(-s * 0.3, h - 0.2, -s * 0.2), s * 0.65, { Color = leaf, Material = Enum.Material.Grass })
|
||
end
|
||
end
|
||
|
||
local function bush(pos)
|
||
local c = Color3.fromRGB(55, rng:NextInteger(120, 150), 55)
|
||
for i = 1, 3 do
|
||
ball(pos + V(rng:NextNumber(-1.5, 1.5), 1, rng:NextNumber(-1.5, 1.5)), rng:NextNumber(2.5, 4), { Color = c, Material = Enum.Material.Grass })
|
||
end
|
||
if rng:NextNumber() < 0.5 then
|
||
for i = 1, 4 do
|
||
ball(pos + V(rng:NextNumber(-1.8, 1.8), rng:NextNumber(1.5, 2.6), rng:NextNumber(-1.8, 1.8)), 0.5, {
|
||
Color = ({ Color3.fromRGB(255, 120, 150), Color3.fromRGB(255, 230, 90), Color3.fromRGB(240, 240, 255) })[rng:NextInteger(1, 3)],
|
||
CanCollide = false,
|
||
})
|
||
end
|
||
end
|
||
end
|
||
|
||
local function bench(cf)
|
||
local seat = Instance.new("Seat")
|
||
seat.Anchored = true
|
||
seat.Size = V(5, 0.4, 1.6)
|
||
seat.CFrame = cf * CFrame.new(0, 1.6, 0)
|
||
seat.Material = Enum.Material.WoodPlanks
|
||
seat.Color = Color3.fromRGB(150, 105, 65)
|
||
seat.TopSurface = Enum.SurfaceType.Smooth
|
||
seat.Parent = map
|
||
for _, x in ipairs({ -2.1, 2.1 }) do
|
||
P({ Size = V(0.4, 1.4, 1.4), CFrame = cf * CFrame.new(x, 0.7, 0), Color = Color3.fromRGB(50, 50, 55), Material = Enum.Material.Metal })
|
||
end
|
||
P({ Size = V(5, 1.3, 0.3), CFrame = cf * CFrame.new(0, 2.6, 0.75) * CFrame.Angles(math.rad(-10), 0, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 105, 65) })
|
||
end
|
||
|
||
-- место NPC: полупрозрачная фигура в редакторе; сам NPC встаёт сюда при запуске (prepareRuntime)
|
||
local function setNpc(part, name, colors, action, actionText)
|
||
part:SetAttribute("NpcName", name)
|
||
part:SetAttribute("SkinColor", colors.skin)
|
||
part:SetAttribute("ShirtColor", colors.shirt)
|
||
part:SetAttribute("PantsColor", colors.pants)
|
||
part:SetAttribute("HatColor", colors.hat)
|
||
part:SetAttribute("NpcAction", action)
|
||
part:SetAttribute("NpcActionText", actionText)
|
||
part.Size = V(2, 5, 1)
|
||
part.Color = colors.shirt
|
||
part.Transparency = 0.5
|
||
part.CanCollide = false
|
||
part.CanQuery = false
|
||
part.CanTouch = false
|
||
return part
|
||
end
|
||
|
||
local function npc(name, cf, colors, action, actionText)
|
||
return setNpc(P({ Name = "NpcSpot", CFrame = cf }), name, colors, action, actionText)
|
||
end
|
||
|
||
-- доска «кто водится»: атрибуты Bestiary (зона), BestiaryTitle, BestiaryHex; текст пишется заново при запуске
|
||
local function writeBestiary(board)
|
||
local old = board:FindFirstChild("BestiaryText")
|
||
if old then
|
||
old:Destroy()
|
||
end
|
||
local zone = Config.Zones[board:GetAttribute("Bestiary")]
|
||
if not zone then
|
||
return
|
||
end
|
||
local lines = { ("<font color=\"%s\">%s</font>"):format(board:GetAttribute("BestiaryHex") or "#FFFFFF", board:GetAttribute("BestiaryTitle") or "") }
|
||
for _, f in ipairs(zone.fish) do
|
||
local r = Config.Rarities[f.rarity]
|
||
table.insert(lines, ("<font color=\"#%s\">%s — %s</font>"):format(r.color:ToHex(), f.name, r.name))
|
||
end
|
||
surfaceText(board, Enum.NormalId.Front, table.concat(lines, "\n"), Color3.new(1, 1, 1)).Parent.Name = "BestiaryText"
|
||
end
|
||
|
||
local function setBestiary(board, zoneId, title, titleHex)
|
||
board:SetAttribute("Bestiary", zoneId)
|
||
board:SetAttribute("BestiaryTitle", title)
|
||
board:SetAttribute("BestiaryHex", titleHex)
|
||
writeBestiary(board)
|
||
end
|
||
|
||
-- Лавки в стиле low poly: без фотореалистичных текстур (доски, ткань), плоские цвета с разбросом оттенков.
|
||
-- Большие дощатые панели (стены, пол, крыша) режутся на отдельные доски, шарики-гирлянды становятся
|
||
-- ромбиками-флажками, неоновая рамка вывески — матовой золотой. frame — CFrame лавки (для флажков), может быть nil.
|
||
local LOWPOLY_FLAT = {
|
||
[Enum.Material.WoodPlanks] = true, [Enum.Material.Wood] = true, [Enum.Material.Fabric] = true,
|
||
[Enum.Material.Metal] = true, [Enum.Material.Brick] = true, [Enum.Material.Plastic] = true,
|
||
}
|
||
|
||
local function lowPolyShade(c, lrng, spread)
|
||
local k = 1 + lrng:NextNumber(-spread, spread)
|
||
return Color3.new(math.clamp(c.R * k, 0, 1), math.clamp(c.G * k, 0, 1), math.clamp(c.B * k, 0, 1))
|
||
end
|
||
|
||
local function lowPolyPlanks(p, lrng)
|
||
local s = p.Size
|
||
local dims = { s.X, s.Y, s.Z }
|
||
local thin = 1
|
||
for i = 2, 3 do
|
||
if dims[i] < dims[thin] then thin = i end
|
||
end
|
||
-- режем вдоль самой длинной горизонтальной оси (кроме тонкой): стены — вертикальные доски, пол — продольные
|
||
local axis = (thin ~= 1 and (thin == 3 or s.X >= s.Z)) and 1 or 3
|
||
local len = dims[axis]
|
||
local n = math.max(2, math.floor(len / 1.8 + 0.5))
|
||
local w = len / n
|
||
for i = 1, n do
|
||
local off = -len / 2 + w * (i - 0.5)
|
||
local depth = lrng:NextNumber(-0.06, 0.06)
|
||
local o = { 0, 0, 0 }
|
||
o[axis] = off
|
||
o[thin] = depth
|
||
local size = { s.X, s.Y, s.Z }
|
||
size[axis] = w
|
||
local plank = Instance.new("Part")
|
||
plank.Name = "Plank"
|
||
plank.Anchored = true
|
||
plank.TopSurface, plank.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth
|
||
plank.Material = Enum.Material.SmoothPlastic
|
||
plank.Size = V(size[1], size[2], size[3])
|
||
plank.CFrame = p.CFrame * CFrame.new(o[1], o[2], o[3])
|
||
plank.Color = lowPolyShade(p.Color, lrng, 0.09)
|
||
plank.CanCollide, plank.CastShadow, plank.CanQuery = p.CanCollide, p.CastShadow, p.CanQuery
|
||
plank.Parent = p.Parent
|
||
end
|
||
p:Destroy()
|
||
end
|
||
|
||
function Builder.lowPolyParts(parts, frame, seed)
|
||
local lrng = Random.new(seed or 5)
|
||
for _, p in ipairs(parts) do
|
||
if p:IsA("BasePart") and p.Parent and p.Transparency < 0.5 and not p.Name:find("Npc") then
|
||
local isBlock = p.ClassName == "Part" and p.Shape == Enum.PartType.Block
|
||
if p.Material == Enum.Material.Fabric and p.ClassName == "Part" and p.Shape == Enum.PartType.Ball and frame then
|
||
-- шарик гирлянды → ромбик-флажок, повёрнутый к покупателям
|
||
local d = p.Size.X
|
||
local flag = Instance.new("Part")
|
||
flag.Name = "Pennant"
|
||
flag.Anchored = true
|
||
flag.CanCollide = false
|
||
flag.Material = Enum.Material.SmoothPlastic
|
||
flag.Size = V(d * 1.15, d * 1.15, 0.25)
|
||
flag.CFrame = CFrame.new(p.Position) * (frame - frame.Position) * CFrame.Angles(0, 0, math.rad(45))
|
||
flag.Color = p.Color
|
||
flag.Parent = p.Parent
|
||
p:Destroy()
|
||
elseif p.Material == Enum.Material.Neon and math.max(p.Size.X, p.Size.Y, p.Size.Z) > 4 then
|
||
p.Material = Enum.Material.SmoothPlastic -- рамка вывески: без свечения
|
||
p.Color = Color3.fromRGB(214, 160, 70)
|
||
elseif p.Material == Enum.Material.WoodPlanks and isBlock and #p:GetChildren() == 0
|
||
and math.min(p.Size.X, p.Size.Y, p.Size.Z) <= 1.2 and math.max(p.Size.X, p.Size.Z) >= 4 then
|
||
lowPolyPlanks(p, lrng)
|
||
elseif LOWPOLY_FLAT[p.Material] then
|
||
p.Material = Enum.Material.SmoothPlastic
|
||
p.Color = lowPolyShade(p.Color, lrng, 0.06)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
-- детали лавки, построенной stall(cf): всё, что лежит в её габаритах прямо в папке parent
|
||
function Builder.stallParts(cf, parent)
|
||
local list = {}
|
||
for _, p in ipairs(parent:GetChildren()) do
|
||
if p:IsA("BasePart") then
|
||
local l = cf:PointToObjectSpace(p.Position)
|
||
if math.abs(l.X) <= 15.5 and l.Y >= -0.5 and l.Y <= 21 and l.Z >= -14.5 and l.Z <= 9.5 then
|
||
table.insert(list, p)
|
||
end
|
||
end
|
||
end
|
||
return list
|
||
end
|
||
|
||
-- лавка: cf стоит на полу, сторона -Z смотрит на покупателей
|
||
local function stall(cf, opt)
|
||
local function at(x, y, z)
|
||
return cf * CFrame.new(x, y, z)
|
||
end
|
||
local wall, dark = opt.wall, opt.wall:Lerp(Color3.new(0, 0, 0), 0.3)
|
||
|
||
P({ Size = V(24, 1, 17), CFrame = at(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 120, 80) })
|
||
P({ Size = V(24, 13, 1), CFrame = at(0, 7.5, 8), Material = Enum.Material.WoodPlanks, Color = wall })
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
P({ Size = V(1, 13, 17), CFrame = at(s * 11.5, 7.5, 0), Material = Enum.Material.WoodPlanks, Color = wall })
|
||
P({ Size = V(1.5, 14.5, 1.5), CFrame = at(s * 11.6, 7.25, -8.3), Material = Enum.Material.Wood, Color = dark })
|
||
end
|
||
P({ Size = V(26, 1, 19), CFrame = at(0, 14.5, 0), Material = Enum.Material.WoodPlanks, Color = dark })
|
||
-- полосатый навес
|
||
for i = 0, 7 do
|
||
P({
|
||
Size = V(3, 0.35, 6),
|
||
CFrame = at(-10.5 + i * 3, 13.1, -10.6) * CFrame.Angles(math.rad(-22), 0, 0),
|
||
Material = Enum.Material.Fabric,
|
||
Color = (i % 2 == 0) and opt.stripeA or opt.stripeB,
|
||
})
|
||
ball(at(-10.5 + i * 3, 11.9, -13.3).Position, 0.9, { Color = (i % 2 == 0) and opt.stripeA or opt.stripeB, Material = Enum.Material.Fabric })
|
||
end
|
||
-- прилавок
|
||
local counter = P({ Size = V(18, 4, 3), CFrame = at(0, 3, -4), Material = Enum.Material.WoodPlanks, Color = wall })
|
||
P({ Size = V(19, 0.5, 3.8), CFrame = at(0, 5.25, -4), Material = Enum.Material.Wood, Color = dark })
|
||
-- вывеска
|
||
local board = P({ Size = V(20, 4.5, 0.6), CFrame = at(0, 17.6, -9.2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 45, 30) })
|
||
P({ Size = V(20.8, 5.3, 0.3), CFrame = at(0, 17.6, -8.9), Material = Enum.Material.Neon, Color = opt.glow })
|
||
for _, x in ipairs({ -8, 8 }) do
|
||
P({ Size = V(0.6, 3, 0.6), CFrame = at(x, 15.5, -9.2), Material = Enum.Material.Wood, Color = dark })
|
||
end
|
||
surfaceText(board, Enum.NormalId.Front, opt.title, opt.titleColor)
|
||
-- фонарики
|
||
for _, x in ipairs({ -9.5, 9.5 }) do
|
||
local l = P({ Size = V(0.8, 1.1, 0.8), CFrame = at(x, 11.2, -9.4), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 210, 140) })
|
||
local light = Instance.new("PointLight")
|
||
light.Range = 14
|
||
light.Brightness = 1
|
||
light.Color = Color3.fromRGB(255, 210, 150)
|
||
light.Parent = l
|
||
end
|
||
-- бочки по бокам
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
vcyl(at(s * 14.5, 2.6, -5).Position, 3.2, 2.6, { Color = Color3.fromRGB(130, 85, 50), Material = Enum.Material.Wood })
|
||
vcyl(at(s * 14.5, 2.6, -5).Position, 0.3, 2.75, { Color = Color3.fromRGB(70, 70, 75), Material = Enum.Material.Metal })
|
||
end
|
||
|
||
prompt(counter, opt.promptText, opt.promptObject, opt.action, 14)
|
||
if opt.npcName then
|
||
npc(opt.npcName, at(0, 4, 1.5), opt.npcColors)
|
||
end
|
||
if opt.decor then
|
||
opt.decor(at)
|
||
end
|
||
Builder.lowPolyParts(Builder.stallParts(cf, map), cf, math.floor(cf.Position.X + cf.Position.Z))
|
||
return counter
|
||
end
|
||
|
||
-- Модель портала из ServerStorage.FishingPortalTemplate, перекрашенная в цвет мира и
|
||
-- поставленная основанием на baseCF. Без шаблона возвращает nil (тогда строится старое кольцо).
|
||
function Builder.portalModel(baseCF, color, name, parent)
|
||
local template = ServerStorage:FindFirstChild("FishingPortalTemplate")
|
||
if not (template and template:IsA("Model")) then
|
||
return nil
|
||
end
|
||
local model = template:Clone()
|
||
model.Name = name
|
||
for _, part in ipairs(model:GetDescendants()) do
|
||
if part:IsA("BasePart") then
|
||
local c = part.Color
|
||
local isGreen = c.G > c.R * 1.15 and c.G > c.B * 1.10 and c.G > 0.25
|
||
if part.Material == Enum.Material.Neon then
|
||
part.Color = color
|
||
elseif isGreen then
|
||
part.Color = color:Lerp(Color3.fromRGB(55, 65, 75), 0.30)
|
||
part.Material = Enum.Material.SmoothPlastic
|
||
end
|
||
elseif part:IsA("ParticleEmitter") then
|
||
part.Color = ColorSequence.new(color, Color3.new(1, 1, 1))
|
||
end
|
||
end
|
||
|
||
local pivot = template:GetPivot()
|
||
local boxCFrame, boxSize = template:GetBoundingBox()
|
||
local boxBottom = pivot:PointToObjectSpace(Vector3.new(
|
||
boxCFrame.Position.X,
|
||
boxCFrame.Position.Y - boxSize.Y / 2,
|
||
boxCFrame.Position.Z
|
||
)).Y
|
||
model:PivotTo(baseCF * CFrame.new(0, -boxBottom, 0))
|
||
model.Parent = parent
|
||
return model
|
||
end
|
||
|
||
local function portal(baseCF, title, color, worldId, locked)
|
||
-- Все порталы, и в лобби, и возвратные в мирах, используют модель автора из ServerStorage.
|
||
do
|
||
local model = Builder.portalModel(baseCF, color, "PortalModel_" .. worldId, map)
|
||
if model then
|
||
-- Этот невидимый якорь сохраняет ProximityPrompt и подпись мира.
|
||
local disc = P({
|
||
Name = "Portal_" .. worldId,
|
||
Size = V(1, 1, 1),
|
||
CFrame = baseCF * CFrame.new(0, 10, 0),
|
||
Transparency = 1,
|
||
CanCollide = false,
|
||
CanQuery = false,
|
||
CanTouch = false,
|
||
})
|
||
local pe = Instance.new("ParticleEmitter")
|
||
pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1))
|
||
pe.LightEmission = 1
|
||
pe.Rate = 25
|
||
pe.Lifetime = NumberRange.new(1, 1.8)
|
||
pe.Speed = NumberRange.new(0.5, 2)
|
||
pe.SpreadAngle = Vector2.new(180, 180)
|
||
pe.Size = NumberSequence.new(0.5, 0)
|
||
pe.Transparency = NumberSequence.new(0.2, 1)
|
||
pe.Parent = disc
|
||
billboard(disc, title, color:Lerp(Color3.new(1, 1, 1), 0.4), 7, 200)
|
||
if locked then
|
||
billboard(disc, "🔒", Color3.new(1, 1, 1), 0, 120)
|
||
end
|
||
local pp = prompt(disc, locked and "Посмотреть" or "Перейти", title, "Portal", 14)
|
||
pp:SetAttribute("World", worldId)
|
||
return disc
|
||
end
|
||
end
|
||
|
||
local center = baseCF * CFrame.new(0, 10, 0)
|
||
P({ Size = V(17, 1, 9), CFrame = baseCF * CFrame.new(0, 0.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(95, 100, 115) })
|
||
P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130) })
|
||
local R, n = 7, 20
|
||
for i = 0, n - 1 do
|
||
local a = (i + 0.5) / n * math.pi * 2
|
||
P({
|
||
Size = V(2 * math.pi * R / n + 0.4, 1.7, 1.7),
|
||
CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R, 0),
|
||
Material = Enum.Material.Slate,
|
||
Color = Color3.fromRGB(80, 85, 100),
|
||
})
|
||
if i % 2 == 0 then
|
||
P({
|
||
Size = V(0.6, 0.6, 1.9),
|
||
CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R + 0.95, 0),
|
||
Material = Enum.Material.Neon,
|
||
Color = color,
|
||
})
|
||
end
|
||
end
|
||
local disc = P({
|
||
Name = "Portal_" .. worldId,
|
||
Shape = Enum.PartType.Cylinder,
|
||
Size = V(0.3, 2 * R - 1, 2 * R - 1),
|
||
CFrame = center * CFrame.Angles(0, math.rad(90), 0),
|
||
Material = Enum.Material.Neon,
|
||
Color = color,
|
||
Transparency = 0.3,
|
||
CanCollide = false,
|
||
})
|
||
local pe = Instance.new("ParticleEmitter")
|
||
pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1))
|
||
pe.LightEmission = 1
|
||
pe.Rate = 25
|
||
pe.Lifetime = NumberRange.new(1, 1.8)
|
||
pe.Speed = NumberRange.new(0.5, 2)
|
||
pe.SpreadAngle = Vector2.new(180, 180)
|
||
pe.Size = NumberSequence.new(0.5, 0)
|
||
pe.Transparency = NumberSequence.new(0.2, 1)
|
||
pe.Parent = disc
|
||
billboard(disc, title, color:Lerp(Color3.new(1, 1, 1), 0.4), 10, 250)
|
||
if locked then
|
||
billboard(disc, "🔒", Color3.new(1, 1, 1), 0, 120)
|
||
end
|
||
local pp = prompt(disc, locked and "Посмотреть" or "Перейти", title, "Portal", 14)
|
||
pp:SetAttribute("World", worldId)
|
||
return disc
|
||
end
|
||
|
||
local function banner(pos, color, icon, text)
|
||
local look = CFrame.lookAt(pos, V(0, pos.Y, 0)) -- смотрит в центр лобби
|
||
vcyl(pos + V(0, 8, 0), 16, 0.7, { Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal })
|
||
ball(pos + V(0, 16.3, 0), 1.2, { Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal })
|
||
P({ Size = V(5.2, 0.4, 0.4), CFrame = look * CFrame.new(0, 15, -0.6), Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal })
|
||
local flag = P({ Size = V(4.6, 8, 0.25), CFrame = look * CFrame.new(0, 10.8, -0.6), Color = color, Material = Enum.Material.Fabric, CanCollide = false })
|
||
P({ Size = V(4.6, 0.5, 0.3), CFrame = look * CFrame.new(0, 6.6, -0.6), Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal })
|
||
local label = icon .. "\n" .. text
|
||
surfaceText(flag, Enum.NormalId.Front, label, Color3.new(1, 1, 1))
|
||
surfaceText(flag, Enum.NormalId.Back, label, Color3.new(1, 1, 1))
|
||
end
|
||
|
||
local function arch(cf, span, height, title, color)
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
P({ Size = V(4, height, 4), CFrame = cf * CFrame.new(s * span / 2, height / 2, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) })
|
||
P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, height + 0.6, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 195, 60) })
|
||
P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, 0.6, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(150, 145, 140) })
|
||
end
|
||
local beam = P({ Size = V(span + 6, 6, 2.5), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(60, 85, 140) })
|
||
P({ Size = V(span + 7, 7, 2), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.Neon, Color = color })
|
||
surfaceText(beam, Enum.NormalId.Front, title, Color3.fromRGB(255, 230, 120))
|
||
surfaceText(beam, Enum.NormalId.Back, title, Color3.fromRGB(255, 230, 120))
|
||
end
|
||
|
||
---------------------------------------------------------------- сборка карты
|
||
|
||
function Builder.build()
|
||
rng = Random.new(7)
|
||
map = Instance.new("Folder")
|
||
map.Name = "FishingMap"
|
||
local zonesFolder = Instance.new("Folder")
|
||
zonesFolder.Name = "FishingZones"
|
||
zonesFolder.Parent = map
|
||
local world1Prebuilt = Workspace:FindFirstChild("World1Map")
|
||
|
||
---------------------------------------------------------------- ЛОББИ
|
||
|
||
P({ Shape = Enum.PartType.Cylinder, Size = V(1, 170, 170), CFrame = CFrame.new(0, 0.5, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Cobblestone, Color = Color3.fromRGB(190, 180, 165) })
|
||
P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 74, 74), CFrame = CFrame.new(0, 0.52, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Marble, Color = Color3.fromRGB(232, 226, 214) })
|
||
P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 78, 78), CFrame = CFrame.new(0, 0.51, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.SmoothPlastic, Color = Color3.fromRGB(60, 120, 190) })
|
||
-- дорожки-лучи к лавкам и порталам
|
||
for _, a in ipairs({ 0, 90, 180, 270 }) do
|
||
local r = math.rad(a)
|
||
P({ Size = V(10, 1.0, 48), CFrame = CFrame.new(math.cos(r) * 60, 0.52, math.sin(r) * 60) * CFrame.Angles(0, -r + math.pi / 2, 0), Material = Enum.Material.Marble, Color = Color3.fromRGB(225, 218, 205) })
|
||
end
|
||
|
||
marker("LobbySpawn", CFrame.new(0, FLOOR + 2, 57)) -- на дорожке за табличкой «Как играть»: сначала она, дальше портал в Мир 1
|
||
|
||
-- фонтан со статуей золотой рыбы
|
||
vcyl(V(0, FLOOR + 1, 0), 2, 24, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) })
|
||
vcyl(V(0, FLOOR + 1.6, 0), 1.0, 21, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 })
|
||
vcyl(V(0, FLOOR + 4, 0), 6, 3, { Material = Enum.Material.Slate, Color = Color3.fromRGB(190, 185, 175) })
|
||
local bowl = vcyl(V(0, FLOOR + 7.3, 0), 1, 9, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) })
|
||
vcyl(V(0, FLOOR + 7.75, 0), 0.2, 8, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 })
|
||
do
|
||
local statue = Models.buildFish("Gold", "Golden", 3.2, true)
|
||
statue:PivotTo(CFrame.new(0, FLOOR + 12, 0) * CFrame.Angles(0, math.rad(30), math.rad(40)))
|
||
statue.Parent = map
|
||
local sp = Instance.new("ParticleEmitter")
|
||
sp.Texture = "rbxasset://textures/particles/sparkles_main.dds"
|
||
sp.Rate = 12
|
||
sp.LightEmission = 1
|
||
sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90))
|
||
sp.Size = NumberSequence.new(0.6, 0)
|
||
sp.Lifetime = NumberRange.new(1, 1.5)
|
||
sp.SpreadAngle = Vector2.new(180, 180)
|
||
sp.Speed = NumberRange.new(1, 2)
|
||
sp.Parent = statue.PrimaryPart
|
||
-- струи воды
|
||
local att = Instance.new("Attachment")
|
||
att.Position = V(0.6, 0, 0) -- у повёрнутого цилиндра ось X смотрит вверх
|
||
att.Orientation = V(0, 0, -90) -- направить струю вверх
|
||
att.Parent = bowl
|
||
local water = Instance.new("ParticleEmitter")
|
||
water.Color = ColorSequence.new(Color3.fromRGB(200, 235, 255))
|
||
water.Transparency = NumberSequence.new(0.3, 1)
|
||
water.Size = NumberSequence.new(0.6, 1.2)
|
||
water.Rate = 60
|
||
water.Lifetime = NumberRange.new(1.2, 1.5)
|
||
water.Speed = NumberRange.new(10, 12)
|
||
water.SpreadAngle = Vector2.new(25, 25)
|
||
water.Acceleration = V(0, -25, 0)
|
||
water.Parent = att
|
||
end
|
||
-- скамейки по внешнему краю площади, между порталами, лицом к фонтану
|
||
for _, deg in ipairs({ 45, 135, 225, 315 }) do
|
||
local a = math.rad(deg)
|
||
for _, side in ipairs({ -1, 1 }) do
|
||
local b = a + side * math.rad(9)
|
||
bench(CFrame.lookAt(V(math.cos(b) * 34, FLOOR, math.sin(b) * 34), V(0, FLOOR, 0)))
|
||
end
|
||
end
|
||
|
||
-- фонари по кругу (у спавна — за спиной игрока, чтобы не закрывали табличку и сундук)
|
||
for i = 0, 7 do
|
||
local deg = i * 45 + 22.5
|
||
if deg ~= 67.5 and deg ~= 112.5 then
|
||
local a = math.rad(deg)
|
||
lamp(V(math.cos(a) * 40, FLOOR, math.sin(a) * 40))
|
||
end
|
||
end
|
||
lamp(V(7, FLOOR, 48)) -- левый фонарь стоит за табличкой «Как играть»
|
||
|
||
-- клумбы с деревьями
|
||
for _, deg in ipairs({ 225, 315 }) do
|
||
local a = math.rad(deg)
|
||
local p = V(math.cos(a) * 58, FLOOR, math.sin(a) * 58)
|
||
vcyl(p + V(0, 1, 0), 2, 12, { Material = Enum.Material.Brick, Color = Color3.fromRGB(150, 95, 70) })
|
||
vcyl(p + V(0, 1.6, 0), 1.0, 11, { Material = Enum.Material.Grass, Color = Color3.fromRGB(70, 140, 60) })
|
||
tree(p + V(0, 2, 0), "round")
|
||
for j = 1, 5 do
|
||
local b = rng:NextNumber(0, math.pi * 2)
|
||
ball(p + V(math.cos(b) * 4, 2.4, math.sin(b) * 4), 0.8, { Color = ({ Color3.fromRGB(255, 110, 140), Color3.fromRGB(255, 220, 80), Color3.fromRGB(170, 120, 255) })[rng:NextInteger(1, 3)] })
|
||
end
|
||
end
|
||
|
||
-- баннеры
|
||
local bannerData = {
|
||
{ 15, Color3.fromRGB(40, 110, 200), "🎣", "Лови!" },
|
||
{ 70, Color3.fromRGB(240, 140, 40), "🐟", "Продавай" },
|
||
{ 110, Color3.fromRGB(40, 110, 200), "⭐", "Качайся" },
|
||
{ 165, Color3.fromRGB(240, 140, 40), "🍀", "Удача" },
|
||
{ 205, Color3.fromRGB(40, 110, 200), "🏆", "Рекорды" },
|
||
{ 335, Color3.fromRGB(240, 140, 40), "💎", "Мифика" },
|
||
}
|
||
for _, b in ipairs(bannerData) do
|
||
local a = math.rad(b[1])
|
||
banner(V(math.cos(a) * 74, FLOOR, math.sin(a) * 74), b[2], b[3], b[4])
|
||
end
|
||
|
||
-- высокий скальный контур закрывает горизонт и удерживает игроков в лобби
|
||
lobbyCliffs()
|
||
lobbyTrees()
|
||
lobbyRockPlants()
|
||
lobbyHills()
|
||
|
||
-- магазин (запад) и скупка (восток)
|
||
stall(CFrame.lookAt(V(-62, FLOOR, 0), V(0, FLOOR, 0)), {
|
||
title = "🎣 УДОЧКИ И СНАРЯЖЕНИЕ",
|
||
titleColor = Color3.fromRGB(255, 230, 120),
|
||
wall = Color3.fromRGB(185, 130, 85),
|
||
stripeA = Color3.fromRGB(215, 55, 55),
|
||
stripeB = Color3.fromRGB(245, 240, 230),
|
||
glow = Color3.fromRGB(255, 170, 60),
|
||
action = "Shop",
|
||
promptText = "Открыть магазин",
|
||
promptObject = "Магазин",
|
||
npcName = "Продавец Михалыч",
|
||
npcColors = { skin = Color3.fromRGB(234, 184, 146), shirt = Color3.fromRGB(200, 60, 50), pants = Color3.fromRGB(60, 70, 100), hat = Color3.fromRGB(90, 110, 60) },
|
||
decor = function(at)
|
||
-- витрина удочек на задней стене
|
||
for i, rod in ipairs(Config.Rods) do
|
||
local x = -8 + (i - 1) * 4
|
||
local m = Models.buildRod(rod.id, 0, true)
|
||
m:PivotTo(at(x, 3, 7) * CFrame.Angles(math.rad(80), 0, 0))
|
||
m.Parent = map
|
||
local plaque = P({ Size = V(3.6, 1.6, 0.2), CFrame = at(x, 11.7, 7.4), Material = Enum.Material.Wood, Color = Color3.fromRGB(60, 40, 25) })
|
||
surfaceText(plaque, Enum.NormalId.Front, rod.name .. "\n" .. (rod.price > 0 and (rod.price .. " 💰") or "бесплатно"), Color3.fromRGB(255, 235, 180))
|
||
end
|
||
end,
|
||
})
|
||
|
||
stall(CFrame.lookAt(V(62, FLOOR, 0), V(0, FLOOR, 0)), {
|
||
title = "💰 СКУПКА РЫБЫ",
|
||
titleColor = Color3.fromRGB(150, 255, 160),
|
||
wall = Color3.fromRGB(110, 150, 175),
|
||
stripeA = Color3.fromRGB(50, 150, 80),
|
||
stripeB = Color3.fromRGB(245, 240, 230),
|
||
glow = Color3.fromRGB(80, 230, 120),
|
||
action = "Sell",
|
||
promptText = "Продать всю рыбу",
|
||
promptObject = "Скупка",
|
||
npcName = "Скупщица Зина",
|
||
npcColors = { skin = Color3.fromRGB(240, 195, 160), shirt = Color3.fromRGB(60, 120, 170), pants = Color3.fromRGB(50, 50, 60), hat = Color3.fromRGB(230, 230, 230) },
|
||
decor = function(at)
|
||
-- лёд с рыбой на прилавке
|
||
P({ Size = V(10, 0.4, 3), CFrame = at(-3, 5.7, -4), Material = Enum.Material.Glass, Color = Color3.fromRGB(200, 235, 255), Transparency = 0.2 })
|
||
for i, id in ipairs({ "Karas", "Okun", "Shuka" }) do
|
||
local f = Models.buildFish(id, nil, 0.9, true)
|
||
f:PivotTo(at(-6.5 + i * 2.5, 6.2, -4) * CFrame.Angles(math.rad(90), 0, math.rad(90)))
|
||
f.Parent = map
|
||
end
|
||
-- весы
|
||
P({ Size = V(2, 0.5, 2), CFrame = at(6, 5.75, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) })
|
||
P({ Size = V(0.3, 1.4, 0.3), CFrame = at(6, 6.7, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) })
|
||
P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 2.4, 2.4), CFrame = at(6, 7.45, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(200, 200, 205) })
|
||
-- ящики с уловом
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
P({ Size = V(3, 2, 3), CFrame = at(s * 14.5, 2, 2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) })
|
||
local f = Models.buildFish(s < 0 and "Lesh" or "Sudak", nil, 0.7, true)
|
||
f:PivotTo(at(s * 14.5, 3.3, 2) * CFrame.Angles(math.rad(90), 0, 0))
|
||
f.Parent = map
|
||
end
|
||
end,
|
||
})
|
||
|
||
-- арка с названием
|
||
arch(CFrame.lookAt(V(0, FLOOR, -66), V(0, FLOOR, 0)), 84, 24, "🎣 " .. string.upper(Config.GameName) .. " 🎣", Color3.fromRGB(255, 190, 60))
|
||
|
||
-- порталы по кругу у фонтана, лицом наружу; первый (бесплатный) мир — прямо перед точкой появления
|
||
local PORTAL_R = 19
|
||
for i, w in ipairs(Config.Worlds) do
|
||
local title = w.icon .. " " .. w.name .. (w.level > 1 and (" (ур. " .. w.level .. ")") or "")
|
||
local a = math.rad(90 - (i - 1) * 90) -- 90° = сторона спавна (+Z)
|
||
local pos = V(math.cos(a) * PORTAL_R, FLOOR, math.sin(a) * PORTAL_R)
|
||
local disc = portal(CFrame.lookAt(pos, V(pos.X * 2, FLOOR, pos.Z * 2)), title, w.color, w.id, w.soon)
|
||
if i == 1 then
|
||
disc:SetAttribute("GuideTarget", "Portal")
|
||
marker("GuidePortal", CFrame.new(pos.X * 1.3, FLOOR, pos.Z * 1.3)) -- точка перед порталом для линии-подсказки
|
||
end
|
||
end
|
||
|
||
-- невидимая стена по кругу: из лобби не уйти
|
||
for deg = 0, 359, 5 do
|
||
local a = math.rad(deg)
|
||
local p = V(math.cos(a) * 86, 30, math.sin(a) * 86)
|
||
P({ Size = V(8, 60, 2), CFrame = CFrame.lookAt(p, V(0, 30, 0)), Transparency = 1, CanQuery = false })
|
||
end
|
||
|
||
-- донат-лавки
|
||
stall(CFrame.lookAt(V(41, FLOOR, 41), V(0, FLOOR, 0)), {
|
||
title = "💎 ПРЕМИУМ",
|
||
titleColor = Color3.fromRGB(255, 220, 120),
|
||
wall = Color3.fromRGB(120, 70, 170),
|
||
stripeA = Color3.fromRGB(255, 200, 60),
|
||
stripeB = Color3.fromRGB(150, 80, 210),
|
||
glow = Color3.fromRGB(255, 200, 60),
|
||
action = "RobuxPasses",
|
||
promptText = "Открыть",
|
||
promptObject = "Премиум-пропуска",
|
||
npcName = "Барон Злотов",
|
||
npcColors = { skin = Color3.fromRGB(230, 185, 150), shirt = Color3.fromRGB(110, 40, 140), pants = Color3.fromRGB(30, 30, 40), hat = Color3.fromRGB(255, 200, 60) },
|
||
decor = function(at)
|
||
-- сундук с самоцветами
|
||
P({ Size = V(4, 2, 2.5), CFrame = at(-5, 6.5, -4), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(120, 75, 40) })
|
||
P({ Size = V(4.2, 0.4, 2.7), CFrame = at(-5, 7.6, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) })
|
||
for i, c in ipairs({ Color3.fromRGB(255, 60, 90), Color3.fromRGB(80, 200, 255), Color3.fromRGB(120, 255, 120), Color3.fromRGB(200, 100, 255) }) do
|
||
P({ Size = V(0.7, 0.7, 0.7), CFrame = at(-6.5 + i * 0.75, 8.1, -4) * CFrame.Angles(0.6, i, 0.6), Material = Enum.Material.Neon, Color = c })
|
||
end
|
||
P({ Size = V(3, 4, 0.3), CFrame = at(5, 7.5, -4.8), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 200, 60) })
|
||
end,
|
||
})
|
||
stall(CFrame.lookAt(V(-41, FLOOR, 41), V(0, FLOOR, 0)), {
|
||
title = "🪙 СОКРОВИЩНИЦА",
|
||
titleColor = Color3.fromRGB(255, 235, 140),
|
||
wall = Color3.fromRGB(200, 160, 70),
|
||
stripeA = Color3.fromRGB(230, 180, 40),
|
||
stripeB = Color3.fromRGB(255, 250, 230),
|
||
glow = Color3.fromRGB(255, 220, 90),
|
||
action = "RobuxProducts",
|
||
promptText = "Открыть",
|
||
promptObject = "Наборы монет",
|
||
npcName = "Купчиха Злата",
|
||
npcColors = { skin = Color3.fromRGB(240, 200, 165), shirt = Color3.fromRGB(220, 170, 50), pants = Color3.fromRGB(90, 50, 30), hat = Color3.fromRGB(180, 40, 40) },
|
||
decor = function(at)
|
||
-- горки монет
|
||
for i = 0, 4 do
|
||
for j = 0, 3 - (i % 3) do
|
||
P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 0.9, 0.9), CFrame = at(-7 + i * 1.2, 5.6 + j * 0.2, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 205, 60) })
|
||
end
|
||
end
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
ball(at(s * 14.5, 2.2, 2).Position, 2.6, { Color = Color3.fromRGB(190, 160, 110), Material = Enum.Material.Fabric })
|
||
ball(at(s * 14.5, 3.5, 2).Position, 1.2, { Color = Color3.fromRGB(255, 205, 60), Material = Enum.Material.Metal })
|
||
end
|
||
end,
|
||
})
|
||
|
||
-- сундук с ежедневной наградой
|
||
do
|
||
local cf = CFrame.lookAt(V(14, FLOOR, 34), V(0, FLOOR, 50))
|
||
local base = P({ Size = V(5, 3, 3.2), CFrame = cf * CFrame.new(0, 1.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 90, 50) })
|
||
P({ Shape = Enum.PartType.Cylinder, Size = V(5, 3.2, 3.2), CFrame = cf * CFrame.new(0, 3, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 105, 60) })
|
||
for _, x in ipairs({ -1.8, 1.8 }) do
|
||
P({ Size = V(0.4, 4.9, 3.4), CFrame = cf * CFrame.new(x, 2.3, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) })
|
||
end
|
||
P({ Size = V(0.9, 1.1, 0.3), CFrame = cf * CFrame.new(0, 2.8, -1.7), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 220, 90) })
|
||
local sp = Instance.new("ParticleEmitter")
|
||
sp.Texture = "rbxasset://textures/particles/sparkles_main.dds"
|
||
sp.Rate = 8
|
||
sp.LightEmission = 1
|
||
sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90))
|
||
sp.Size = NumberSequence.new(0.5, 0)
|
||
sp.Parent = base
|
||
billboard(base, "🎁 Ежедневная награда", Color3.fromRGB(255, 220, 120), 5, 260)
|
||
prompt(base, "Забрать", "Сундук", "Daily", 12)
|
||
end
|
||
|
||
-- табличка «Как играть»
|
||
do
|
||
-- слева от дорожки за точкой появления, лицом к камере игрока; фонарь — за табличкой
|
||
local pos = V(-12, FLOOR, 48)
|
||
local cf = CFrame.lookAt(pos, V(0, FLOOR, 64))
|
||
lamp((cf * CFrame.new(0, 0, 2.5)).Position)
|
||
marker("GuideBoard", cf * CFrame.new(0, 0, -6)) -- перед табличкой, для линии-подсказки
|
||
for _, x in ipairs({ -6.5, 6.5 }) do
|
||
P({ Size = V(0.8, 9, 0.8), CFrame = cf * CFrame.new(x, 4.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) })
|
||
end
|
||
local board = P({ Size = V(14, 8, 0.5), CFrame = cf * CFrame.new(0, 6, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) })
|
||
board:SetAttribute("GuideTarget", "Board") -- подсвечивается на шаге обучения
|
||
surfaceText(board, Enum.NormalId.Front,
|
||
"<font color=\"#FFD866\">КАК ИГРАТЬ</font>\n1. Портал «Мир 1» или кнопка 🌍 Миры\n2. Удочка — клавиша 1, у воды зажми ЛКМ и отпусти\n3. Клюёт → кликай в зелёную зону\n4. 🎒 Сумка — B, 📜 Задания — Q\n5. Собирай коллекцию — получай награды!",
|
||
Color3.fromRGB(255, 245, 225), { TextXAlignment = Enum.TextXAlignment.Left })
|
||
end
|
||
|
||
---------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО
|
||
do
|
||
-- отдельно собранное раньше «Тихое озеро» (Workspace.World1Map) переносим в карту, иначе строим заново
|
||
local w1map = world1Prebuilt or World1Builder.build(map, Builder.portalModel)
|
||
w1map.Parent = map
|
||
local baitShop = not world1Prebuilt and w1map:FindFirstChild("BaitShop", true)
|
||
if baitShop then
|
||
Builder.lowPolyParts(baitShop:GetDescendants(), baitShop:GetPivot(), 11)
|
||
end
|
||
-- NPC встают на маркеры — их можно двигать в Studio
|
||
local seller = w1map:FindFirstChild("World1NpcSeller", true)
|
||
if seller and not seller:GetAttribute("NpcName") then
|
||
setNpc(seller, "Скупщик Гриша", {
|
||
skin = Color3.fromRGB(234, 190, 150), shirt = Color3.fromRGB(236, 228, 210),
|
||
pants = Color3.fromRGB(70, 110, 76), hat = Color3.fromRGB(226, 196, 122),
|
||
})
|
||
end
|
||
local grandpa = w1map:FindFirstChild("World1NpcGrandpa", true)
|
||
if grandpa and not grandpa:GetAttribute("NpcName") then
|
||
setNpc(grandpa, "Дед Петрович", {
|
||
skin = Color3.fromRGB(225, 175, 140), shirt = Color3.fromRGB(110, 120, 80), pants = Color3.fromRGB(70, 60, 45), hat = Color3.fromRGB(90, 110, 60),
|
||
}, "Talk", "Поговорить")
|
||
end
|
||
local board = w1map:FindFirstChild("World1Bestiary", true)
|
||
if board and not board:GetAttribute("Bestiary") then
|
||
setBestiary(board, "World1", "🐟 КТО ВОДИТСЯ В ОЗЕРЕ", "#9BE7FF")
|
||
end
|
||
end
|
||
|
||
-- причал (используется в Мире 2): настил и сваи; возвращает настил
|
||
local function pier(center, size)
|
||
local deck = P({ Size = size, Position = center, Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) })
|
||
local alongZ = size.Z > size.X
|
||
local len = alongZ and size.Z or size.X
|
||
local wid = alongZ and size.X or size.Z
|
||
for d = -len / 2 + 1, len / 2 - 1, 6 do
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
local off = alongZ and V(s * (wid / 2 - 0.4), 0, d) or V(d, 0, s * (wid / 2 - 0.4))
|
||
vcyl(center + off + V(0, -6, 0), 13, 0.9, { Color = Color3.fromRGB(100, 70, 45), Material = Enum.Material.Wood })
|
||
end
|
||
end
|
||
return deck
|
||
end
|
||
|
||
---------------------------------------------------------------- помощники для новых миров
|
||
|
||
local function cylA(a, b, d, props)
|
||
props.Shape = Enum.PartType.Cylinder
|
||
props.Size = V(math.max(0.05, (b - a).Magnitude), d, d)
|
||
props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0)
|
||
return P(props)
|
||
end
|
||
|
||
local function worldWalls(center)
|
||
for _, w in ipairs({
|
||
{ V(0, 0, 245), V(500, 160, 2) },
|
||
{ V(0, 0, -245), V(500, 160, 2) },
|
||
{ V(245, 0, 0), V(2, 160, 500) },
|
||
{ V(-245, 0, 0), V(2, 160, 500) },
|
||
}) do
|
||
P({ Size = w[2], Position = center + w[1] + V(0, 60, 0), Transparency = 1, CanQuery = false })
|
||
end
|
||
end
|
||
|
||
local function bestiary(pos, lookAt, worldId, title, titleHex)
|
||
local cf = CFrame.lookAt(pos, lookAt)
|
||
for _, x in ipairs({ -6, 6 }) do
|
||
P({ Size = V(0.8, 11, 0.8), CFrame = cf * CFrame.new(x, 5.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) })
|
||
end
|
||
local board = P({ Name = worldId .. "Bestiary", Size = V(13, 10, 0.5), CFrame = cf * CFrame.new(0, 7, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) })
|
||
setBestiary(board, worldId, title, titleHex)
|
||
end
|
||
|
||
local function campfire(c)
|
||
for i = 0, 7 do
|
||
local a = i / 8 * math.pi * 2
|
||
ball(c + V(math.cos(a) * 2.2, 0.3, math.sin(a) * 2.2), 1, { Color = Color3.fromRGB(120, 120, 125), Material = Enum.Material.Rock })
|
||
end
|
||
for i = 0, 2 do
|
||
P({ Shape = Enum.PartType.Cylinder, Size = V(3, 0.6, 0.6), CFrame = CFrame.new(c + V(0, 0.4, 0)) * CFrame.Angles(0, i * math.pi / 3, 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 35) })
|
||
end
|
||
local base = P({ Size = V(1, 1, 1), Position = c + V(0, 0.8, 0), Transparency = 1, CanCollide = false })
|
||
local fire = Instance.new("Fire")
|
||
fire.Size = 5
|
||
fire.Heat = 9
|
||
fire.Parent = base
|
||
local light = Instance.new("PointLight")
|
||
light.Color = Color3.fromRGB(255, 160, 80)
|
||
light.Range = 20
|
||
light.Brightness = 2
|
||
light.Parent = base
|
||
end
|
||
|
||
local function torch(pos)
|
||
cylA(pos, pos + V(0, 5, 0), 0.35, { Color = Color3.fromRGB(170, 130, 70), Material = Enum.Material.Wood })
|
||
local top = P({ Size = V(0.8, 0.8, 0.8), Position = pos + V(0, 5.3, 0), Color = Color3.fromRGB(90, 60, 30), Material = Enum.Material.Wood })
|
||
local fire = Instance.new("Fire")
|
||
fire.Size = 3
|
||
fire.Heat = 6
|
||
fire.Parent = top
|
||
local light = Instance.new("PointLight")
|
||
light.Color = Color3.fromRGB(255, 170, 90)
|
||
light.Range = 14
|
||
light.Parent = top
|
||
end
|
||
|
||
---------------------------------------------------------------- МИР 2: ТРОПИЧЕСКИЙ ОСТРОВ
|
||
|
||
do
|
||
local W2 = Config.Worlds[2].center
|
||
local leafColors = { Color3.fromRGB(60, 160, 60), Color3.fromRGB(85, 185, 70) }
|
||
|
||
-- море, мелководье уступами, песчаный пляж, зелёный остров, холм
|
||
terrain:FillBlock(CFrame.new(W2 + V(0, -34, 0)), V(520, 8, 520), Enum.Material.Sand)
|
||
terrain:FillBlock(CFrame.new(W2 + V(0, -15, 0)), V(520, 30, 520), Enum.Material.Water)
|
||
terrain:FillCylinder(CFrame.new(W2 + V(0, -17, 0)), 28, 140, Enum.Material.Sand)
|
||
terrain:FillCylinder(CFrame.new(W2 + V(0, -15, 0)), 32, 118, Enum.Material.Sand)
|
||
terrain:FillCylinder(CFrame.new(W2 + V(0, -14, 0)), 34, 106, Enum.Material.Sand)
|
||
terrain:FillCylinder(CFrame.new(W2 + V(0, -13.5, 0)), 35, 88, Enum.Material.Grass)
|
||
terrain:FillBall(W2 + V(20, -20, -30), 32, Enum.Material.Grass)
|
||
terrain:FillCylinder(CFrame.new(W2 + V(0, 2, 40)), 4, 14, Enum.Material.Sandstone)
|
||
|
||
local function palm(pos)
|
||
local h = rng:NextNumber(12, 18)
|
||
local a = rng:NextNumber(0, math.pi * 2)
|
||
local dir = V(math.cos(a), 0, math.sin(a))
|
||
local p = pos
|
||
for i = 1, 6 do
|
||
local t = i / 6
|
||
local q = pos + V(0, h * t, 0) + dir * (t * t * h * 0.3)
|
||
local d = 1.4 - t * 0.45
|
||
cylA(p, q, d, { Color = Color3.fromRGB(150, 115, 70), Material = Enum.Material.Wood })
|
||
ball(q, d, { Color = Color3.fromRGB(130, 100, 60), Material = Enum.Material.Wood })
|
||
p = q
|
||
end
|
||
for k = 0, 7 do
|
||
local b = k / 8 * math.pi * 2 + rng:NextNumber(-0.2, 0.2)
|
||
local ld = V(math.cos(b), 0, math.sin(b))
|
||
local mid = p + ld * 3.5 + V(0, 0.8, 0)
|
||
local tipP = p + ld * 7 + V(0, -2.2, 0)
|
||
for _, seg in ipairs({ { p, mid }, { mid, tipP } }) do
|
||
P({ Size = V(2, 0.15, (seg[2] - seg[1]).Magnitude), CFrame = CFrame.lookAt((seg[1] + seg[2]) / 2, seg[2]), Material = Enum.Material.Grass, Color = leafColors[k % 2 + 1], CanCollide = false })
|
||
end
|
||
end
|
||
for _ = 1, 3 do
|
||
ball(p + V(rng:NextNumber(-0.7, 0.7), -0.7, rng:NextNumber(-0.7, 0.7)), 0.9, { Color = Color3.fromRGB(110, 75, 40) })
|
||
end
|
||
end
|
||
|
||
local function tikiHut(pos, look)
|
||
local cf = CFrame.lookAt(pos, look)
|
||
P({ Size = V(12, 1, 12), CFrame = cf * CFrame.new(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 120, 75) })
|
||
for _, c in ipairs({ { -5, -5 }, { 5, -5 }, { -5, 5 }, { 5, 5 } }) do
|
||
vcyl((cf * CFrame.new(c[1], 4.5, c[2])).Position, 8, 0.8, { Color = Color3.fromRGB(200, 175, 100), Material = Enum.Material.Wood })
|
||
end
|
||
for i = 0, 4 do
|
||
vcyl((cf * CFrame.new(0, 8.8 + i * 1.2, 0)).Position, 1.4, 16 - i * 3.2, { Color = Color3.fromRGB(205, 170, 95), Material = Enum.Material.Grass })
|
||
end
|
||
local bar = P({ Size = V(7, 3, 1.5), CFrame = cf * CFrame.new(0, 2.5, -3), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 95, 55) })
|
||
billboard(bar, "🍹", Color3.new(1, 1, 1), 3, 60)
|
||
end
|
||
|
||
local function umbrella(pos, color)
|
||
cylA(pos, pos + V(0, 7, 0), 0.25, { Color = Color3.fromRGB(235, 235, 235), Material = Enum.Material.Metal })
|
||
vcyl(pos + V(0, 7, 0), 0.6, 9, { Color = color, Material = Enum.Material.Fabric })
|
||
vcyl(pos + V(0, 7.5, 0), 0.6, 4.5, { Color = Color3.new(1, 1, 1), Material = Enum.Material.Fabric })
|
||
P({ Size = V(2.2, 0.5, 6), CFrame = CFrame.new(pos + V(3.5, 0.6, 0)) * CFrame.Angles(0, rng:NextNumber(-0.5, 0.5), 0), Color = Color3.fromRGB(245, 245, 240), Material = Enum.Material.Fabric })
|
||
P({ Size = V(2.25, 0.52, 1.2), CFrame = CFrame.new(pos + V(3.5, 0.62, 1.5)), Color = color, Material = Enum.Material.Fabric })
|
||
end
|
||
|
||
local coralColors = { Color3.fromRGB(255, 110, 150), Color3.fromRGB(255, 150, 60), Color3.fromRGB(170, 90, 255), Color3.fromRGB(255, 220, 80), Color3.fromRGB(80, 220, 200) }
|
||
local function coral(pos)
|
||
local c = coralColors[rng:NextInteger(1, #coralColors)]
|
||
for _ = 1, rng:NextInteger(3, 5) do
|
||
local dir = V(rng:NextNumber(-0.5, 0.5), 1, rng:NextNumber(-0.5, 0.5)).Unit
|
||
local h = rng:NextNumber(1.5, 3.5)
|
||
cylA(pos, pos + dir * h, 0.45, { Color = c, CanCollide = false })
|
||
ball(pos + dir * h, 0.75, { Color = c:Lerp(Color3.new(1, 1, 1), 0.3), CanCollide = false })
|
||
end
|
||
end
|
||
|
||
local function starfish(pos)
|
||
local c = Color3.fromRGB(255, rng:NextInteger(90, 150), 60)
|
||
ball(pos, 0.7, { Color = c, CanCollide = false })
|
||
for k = 0, 4 do
|
||
local a = k / 5 * math.pi * 2
|
||
P({ Size = V(0.35, 0.2, 1.1), CFrame = CFrame.new(pos) * CFrame.Angles(0, a, 0) * CFrame.new(0, 0, -0.6), Color = c, CanCollide = false })
|
||
end
|
||
end
|
||
|
||
local spawn2 = W2 + V(0, 4, 40)
|
||
marker("World2Spawn", CFrame.lookAt(spawn2 + V(0, 1, 0), spawn2 + V(0, 1, -10)))
|
||
arch(CFrame.new(W2 + V(0, 4, 24)), 14, 11, "🏝 ТРОПИЧЕСКИЙ ОСТРОВ", Color3.fromRGB(255, 190, 70))
|
||
portal(CFrame.lookAt(W2 + V(-32, 4, 60), spawn2), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby")
|
||
stall(CFrame.lookAt(W2 + V(32, 4, 62), spawn2), {
|
||
title = "💰 СКУПКА",
|
||
titleColor = Color3.fromRGB(150, 255, 220),
|
||
wall = Color3.fromRGB(200, 170, 110),
|
||
stripeA = Color3.fromRGB(40, 180, 170),
|
||
stripeB = Color3.fromRGB(255, 250, 230),
|
||
glow = Color3.fromRGB(80, 230, 200),
|
||
action = "Sell",
|
||
promptText = "Продать всю рыбу",
|
||
promptObject = "Скупка",
|
||
npcName = "Скупщик Мигель",
|
||
npcColors = { skin = Color3.fromRGB(190, 140, 100), shirt = Color3.fromRGB(240, 120, 60), pants = Color3.fromRGB(240, 230, 200), hat = Color3.fromRGB(230, 210, 150) },
|
||
})
|
||
bestiary(W2 + V(-18, 4, 22), spawn2, "World2", "🐠 КТО ВОДИТСЯ У ОСТРОВА", "#FFD27A")
|
||
npc("Капитан Боря", CFrame.lookAt(W2 + V(10, 6, 100), W2 + V(0, 6, 120)), {
|
||
skin = Color3.fromRGB(225, 175, 140), shirt = Color3.fromRGB(240, 240, 240), pants = Color3.fromRGB(30, 40, 80), hat = Color3.fromRGB(30, 30, 60),
|
||
}, "Talk", "Поговорить")
|
||
|
||
pier(W2 + V(0, 3.2, 125), V(8, 0.6, 50))
|
||
pier(W2 + V(125, 3.2, -10), V(50, 0.6, 8))
|
||
for _, z in ipairs({ 105, 125, 145 }) do
|
||
torch(W2 + V(4.5, 3.5, z))
|
||
end
|
||
for _, x in ipairs({ 110, 140 }) do
|
||
torch(W2 + V(x, 3.5, -14.5))
|
||
end
|
||
tikiHut(W2 + V(-50, groundY(W2.X - 50, W2.Z - 20), -20), W2)
|
||
tikiHut(W2 + V(-20, groundY(W2.X - 20, W2.Z - 65), -65), W2)
|
||
campfire(W2 + V(-10, 4, 55))
|
||
for _, deg in ipairs({ 200, 222, 318, 340 }) do
|
||
local a = math.rad(deg)
|
||
local x, z = math.cos(a) * 99, math.sin(a) * 99
|
||
umbrella(W2 + V(x, groundY(W2.X + x, W2.Z + z), z), coralColors[rng:NextInteger(1, #coralColors)])
|
||
end
|
||
|
||
local function free2(x, z)
|
||
local r = math.sqrt(x * x + z * z)
|
||
if r > 100 then
|
||
return false
|
||
end
|
||
if (V(x, 0, z) - V(0, 0, 45)).Magnitude < 28 then
|
||
return false
|
||
end
|
||
for _, p in ipairs({ { 32, 62 }, { -32, 60 }, { -50, -20 }, { -20, -65 }, { -18, 22 }, { -10, 55 } }) do
|
||
if (V(x, 0, z) - V(p[1], 0, p[2])).Magnitude < 16 then
|
||
return false
|
||
end
|
||
end
|
||
return true
|
||
end
|
||
local count = 0
|
||
for _ = 1, 300 do
|
||
if count >= 40 then
|
||
break
|
||
end
|
||
local x, z = rng:NextNumber(-100, 100), rng:NextNumber(-100, 100)
|
||
if free2(x, z) then
|
||
palm(W2 + V(x, groundY(W2.X + x, W2.Z + z) - 0.5, z))
|
||
count += 1
|
||
end
|
||
end
|
||
for _ = 1, 35 do
|
||
local a = rng:NextNumber(0, math.pi * 2)
|
||
local r = rng:NextNumber(121, 138)
|
||
local x, z = math.cos(a) * r, math.sin(a) * r
|
||
if not (math.abs(x) < 8 and z > 0) and not (math.abs(z + 10) < 8 and x > 0) then
|
||
coral(W2 + V(x, groundY(W2.X + x, W2.Z + z) - 0.3, z))
|
||
end
|
||
end
|
||
for _ = 1, 12 do
|
||
local a = rng:NextNumber(0, math.pi * 2)
|
||
local r = rng:NextNumber(107, 115)
|
||
local x, z = math.cos(a) * r, math.sin(a) * r
|
||
starfish(W2 + V(x, groundY(W2.X + x, W2.Z + z) + 0.1, z))
|
||
end
|
||
worldWalls(W2)
|
||
end
|
||
|
||
---------------------------------------------------------------- МИР 3: ЛЕДЯНОЙ ФЬОРД
|
||
|
||
do
|
||
local W3 = Config.Worlds[3].center
|
||
local LAKES3 = Config.Worlds[3].lakes
|
||
local HOLES = Config.Worlds[3].holes
|
||
|
||
terrain:FillBlock(CFrame.new(W3 + V(0, -10, 0)), V(500, 28, 500), Enum.Material.Snow)
|
||
for i = 0, 13 do
|
||
local a = i / 14 * math.pi * 2
|
||
local r = rng:NextNumber(215, 235)
|
||
local rad = rng:NextNumber(50, 70)
|
||
local c = W3 + V(math.cos(a) * r, -15, math.sin(a) * r)
|
||
terrain:FillBall(c, rad, Enum.Material.Rock)
|
||
terrain:FillBall(c + V(0, rad * 0.35, 0), rad * 0.7, Enum.Material.Snow)
|
||
end
|
||
for _, l in ipairs(LAKES3) do
|
||
terrain:FillCylinder(CFrame.new(W3 + V(l[1], 16, l[2])), 30, l[3] + 4, Enum.Material.Air)
|
||
end
|
||
-- вода не вытесняет снег и лёд, поэтому место под неё сначала вырезаем воздухом
|
||
for _, l in ipairs(LAKES3) do
|
||
terrain:FillCylinder(CFrame.new(W3 + V(l[1], -19, l[2])), 10, l[3], Enum.Material.Mud)
|
||
terrain:FillCylinder(CFrame.new(W3 + V(l[1], -7, l[2])), 14, l[3], Enum.Material.Air)
|
||
terrain:FillCylinder(CFrame.new(W3 + V(l[1], -7, l[2])), 14, l[3], Enum.Material.Water)
|
||
end
|
||
for _, l in ipairs(LAKES3) do
|
||
terrain:FillCylinder(CFrame.new(W3 + V(l[1], -1, l[2])), 4, l[3], Enum.Material.Glacier)
|
||
end
|
||
-- лунки режем прямо по вокселям: тонкая заливка в 4 стада не перекрывает ячейку льда целиком
|
||
local holeR = Config.Worlds[3].holeRadius or 6
|
||
local waterY3 = Config.Worlds[3].waterY
|
||
for _, h in ipairs(HOLES) do
|
||
local c = W3 + V(h[1], 0, h[2])
|
||
local region = Region3.new(c + V(-holeR, -12, -holeR), c + V(holeR, 8, holeR)):ExpandToGrid(4)
|
||
local mats, occ = terrain:ReadVoxels(region, 4)
|
||
local corner = region.CFrame.Position - region.Size / 2
|
||
for x = 1, mats.Size.X do
|
||
for y = 1, mats.Size.Y do
|
||
for z = 1, mats.Size.Z do
|
||
local p = corner + V(x - 0.5, y - 0.5, z - 0.5) * 4
|
||
if (V(p.X, 0, p.Z) - V(c.X, 0, c.Z)).Magnitude <= holeR then
|
||
local water = p.Y < waterY3
|
||
mats[x][y][z] = water and Enum.Material.Water or Enum.Material.Air
|
||
occ[x][y][z] = water and 1 or 0
|
||
end
|
||
end
|
||
end
|
||
end
|
||
terrain:WriteVoxels(region, 4, mats, occ)
|
||
end
|
||
|
||
local function snowPine(pos)
|
||
local h = rng:NextNumber(8, 13)
|
||
vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(90, 62, 40), Material = Enum.Material.Wood })
|
||
for i = 0, 3 do
|
||
local s = 10 - i * 2.2
|
||
local y = h * 0.4 + i * 2.8
|
||
ball(pos + V(0, y, 0), s, { Color = Color3.fromRGB(35, 85 + i * 8, 60), Material = Enum.Material.Grass })
|
||
ball(pos + V(0, y + s * 0.3, 0), s * 0.75, { Color = Color3.fromRGB(240, 245, 255), Material = Enum.Material.Snow })
|
||
end
|
||
end
|
||
|
||
local function igloo(pos, look)
|
||
local cf = CFrame.lookAt(pos, look)
|
||
P({ Shape = Enum.PartType.Ball, Size = V(14, 14, 14), CFrame = cf, Material = Enum.Material.Snow, Color = Color3.fromRGB(240, 245, 255) })
|
||
P({ Shape = Enum.PartType.Cylinder, Size = V(5, 5, 5), CFrame = cf * CFrame.new(0, 1.2, -7) * CFrame.Angles(0, math.rad(90), 0), Material = Enum.Material.Snow, Color = Color3.fromRGB(235, 240, 250) })
|
||
P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 3.6, 3.6), CFrame = cf * CFrame.new(0, 1.2, -9.55) * CFrame.Angles(0, math.rad(90), 0), Color = Color3.fromRGB(20, 25, 35) })
|
||
end
|
||
|
||
local function tent(pos, look)
|
||
local cf = CFrame.lookAt(pos, look)
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
P({ Size = V(0.2, 5, 6), CFrame = cf * CFrame.new(s * 1.6, 2.2, 0) * CFrame.Angles(0, 0, math.rad(s * 35)), Material = Enum.Material.Fabric, Color = Color3.fromRGB(230, 110, 40) })
|
||
end
|
||
vcyl((cf * CFrame.new(0, 0.9, -4.5)).Position, 1.6, 1.4, { Color = Color3.fromRGB(110, 80, 50), Material = Enum.Material.Wood })
|
||
end
|
||
|
||
local function crystal(pos)
|
||
for _ = 1, 5 do
|
||
local h = rng:NextNumber(3, 8)
|
||
P({
|
||
Size = V(1.2, h, 1.2),
|
||
CFrame = CFrame.new(pos + V(rng:NextNumber(-2, 2), h / 2 - 0.5, rng:NextNumber(-2, 2))) * CFrame.Angles(rng:NextNumber(-0.4, 0.4), rng:NextNumber(0, 3), rng:NextNumber(-0.4, 0.4)),
|
||
Material = Enum.Material.Neon, Color = Color3.fromRGB(140, 230, 255), Transparency = 0.15,
|
||
})
|
||
end
|
||
end
|
||
|
||
local function snowman(pos)
|
||
ball(pos + V(0, 2, 0), 4, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow })
|
||
ball(pos + V(0, 5, 0), 3, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow })
|
||
ball(pos + V(0, 7.3, 0), 2.2, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow })
|
||
cylA(pos + V(0, 7.3, -1), pos + V(0, 7.2, -2), 0.3, { Color = Color3.fromRGB(255, 130, 30) })
|
||
for _, x in ipairs({ -0.4, 0.4 }) do
|
||
ball(pos + V(x, 7.7, -0.95), 0.3, { Color = Color3.fromRGB(20, 20, 20) })
|
||
end
|
||
vcyl(pos + V(0, 8.6, 0), 1.2, 1.4, { Color = Color3.fromRGB(30, 30, 35) })
|
||
vcyl(pos + V(0, 8.1, 0), 0.2, 2.2, { Color = Color3.fromRGB(30, 30, 35) })
|
||
end
|
||
|
||
-- лунки: льдинки по краю и флажки
|
||
for i, h in ipairs(HOLES) do
|
||
local c = W3 + V(h[1], 1.2, h[2])
|
||
for k = 0, 7 do
|
||
local a = k / 8 * math.pi * 2
|
||
P({ Size = V(1.2, 0.6, 1.2), CFrame = CFrame.new(c + V(math.cos(a) * 6.6, 0, math.sin(a) * 6.6)) * CFrame.Angles(0, a, 0.2), Material = Enum.Material.Ice, Color = Color3.fromRGB(200, 235, 255) })
|
||
end
|
||
if i % 3 == 1 then
|
||
cylA(c + V(6, -0.2, 6), c + V(6, 4, 6), 0.15, { Color = Color3.fromRGB(80, 60, 40) })
|
||
P({ Size = V(1.4, 0.9, 0.1), Position = c + V(6.75, 3.5, 6), Material = Enum.Material.Fabric, Color = Color3.fromRGB(220, 40, 40) })
|
||
end
|
||
if i % 4 == 0 then
|
||
tent(c + V(-9, -0.2, 0), c)
|
||
end
|
||
end
|
||
|
||
local spawn3 = W3 + V(0, 4, 120)
|
||
marker("World3Spawn", CFrame.lookAt(spawn3 + V(0, 1, 0), spawn3 + V(0, 1, -10)))
|
||
arch(CFrame.new(W3 + V(0, 4, 104)), 14, 11, "❄ ЛЕДЯНОЙ ФЬОРД", Color3.fromRGB(150, 220, 255))
|
||
portal(CFrame.lookAt(W3 + V(-32, 4, 140), spawn3), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby")
|
||
stall(CFrame.lookAt(W3 + V(32, 4, 138), spawn3), {
|
||
title = "💰 СКУПКА",
|
||
titleColor = Color3.fromRGB(180, 230, 255),
|
||
wall = Color3.fromRGB(120, 95, 75),
|
||
stripeA = Color3.fromRGB(60, 120, 200),
|
||
stripeB = Color3.fromRGB(245, 250, 255),
|
||
glow = Color3.fromRGB(140, 210, 255),
|
||
action = "Sell",
|
||
promptText = "Продать всю рыбу",
|
||
promptObject = "Скупка",
|
||
npcName = "Скупщица Нина",
|
||
npcColors = { skin = Color3.fromRGB(240, 205, 175), shirt = Color3.fromRGB(180, 40, 50), pants = Color3.fromRGB(40, 40, 60), hat = Color3.fromRGB(240, 240, 250) },
|
||
})
|
||
bestiary(W3 + V(-20, 4, 100), spawn3, "World3", "❄ КТО ВОДИТСЯ ПОДО ЛЬДОМ", "#BFEAFF")
|
||
npc("Полярник Саша", CFrame.lookAt(W3 + V(12, 7, 88), W3 + V(0, 7, 60)), {
|
||
skin = Color3.fromRGB(230, 190, 160), shirt = Color3.fromRGB(230, 120, 30), pants = Color3.fromRGB(50, 55, 70), hat = Color3.fromRGB(200, 40, 40),
|
||
}, "Talk", "Поговорить")
|
||
igloo(W3 + V(-45, 4, 95), W3 + V(0, 4, 110))
|
||
campfire(W3 + V(20, 4, 108))
|
||
snowman(W3 + V(42, 4, 100))
|
||
for _, p in ipairs({ { -85, -45 }, { 90, 30 }, { -25, -110 }, { 70, -90 }, { -95, 60 } }) do
|
||
crystal(W3 + V(p[1], groundY(W3.X + p[1], W3.Z + p[2]), p[2]))
|
||
end
|
||
|
||
local function free3(x, z)
|
||
for _, l in ipairs(LAKES3) do
|
||
if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + 12 then
|
||
return false
|
||
end
|
||
end
|
||
if (V(x, 0, z) - V(0, 0, 120)).Magnitude < 40 then
|
||
return false
|
||
end
|
||
if (V(x, 0, z) - V(-45, 0, 95)).Magnitude < 14 then
|
||
return false
|
||
end
|
||
return true
|
||
end
|
||
local count = 0
|
||
for _ = 1, 400 do
|
||
if count >= 80 then
|
||
break
|
||
end
|
||
local x, z = rng:NextNumber(-200, 200), rng:NextNumber(-200, 200)
|
||
if free3(x, z) then
|
||
snowPine(W3 + V(x, groundY(W3.X + x, W3.Z + z) - 0.5, z))
|
||
count += 1
|
||
end
|
||
end
|
||
|
||
-- северное сияние
|
||
for i = 0, 7 do
|
||
P({
|
||
Size = V(55, 26, 0.6),
|
||
CFrame = CFrame.new(W3 + V(-175 + i * 50, 150 + math.sin(i * 1.3) * 10, -150 + math.cos(i * 0.9) * 25)) * CFrame.Angles(math.rad(10), math.rad(i * 8 - 28), 0),
|
||
Material = Enum.Material.Neon,
|
||
Color = (i % 3 == 0) and Color3.fromRGB(170, 90, 255) or Color3.fromRGB(80, 255, 170),
|
||
Transparency = 0.6, CanCollide = false, CanQuery = false, CastShadow = false,
|
||
})
|
||
end
|
||
worldWalls(W3)
|
||
end
|
||
|
||
---------------------------------------------------------------- проверка воды
|
||
-- Если вода в террейне не создалась (бывает в некоторых плейсах/настройках),
|
||
-- ставим поверхность воды из деталей, чтобы озёра и море точно были видны.
|
||
|
||
local function terrainHasWater(pos)
|
||
local region = Region3.new(pos - V(2, 2, 2), pos + V(2, 2, 2)):ExpandToGrid(4)
|
||
local ok, mats = pcall(function()
|
||
return terrain:ReadVoxels(region, 4)
|
||
end)
|
||
if not ok then
|
||
return true
|
||
end
|
||
for _, plane in ipairs(mats) do
|
||
for _, column in ipairs(plane) do
|
||
for _, m in ipairs(column) do
|
||
if m == Enum.Material.Water then
|
||
return true
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
local function waterPlane(pos, diameter, color)
|
||
return P({
|
||
Name = "WaterSurface",
|
||
Shape = Enum.PartType.Cylinder,
|
||
Size = V(0.4, diameter, diameter),
|
||
CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)),
|
||
Color = color,
|
||
Material = Enum.Material.SmoothPlastic,
|
||
Reflectance = 0.08,
|
||
CanCollide = false,
|
||
CanQuery = false,
|
||
CanTouch = false,
|
||
CastShadow = false,
|
||
})
|
||
end
|
||
|
||
do
|
||
local w1, w2, w3 = Config.Worlds[1], Config.Worlds[2], Config.Worlds[3]
|
||
-- Мир 1: каждое озеро; нет воды — заливаем ещё раз, не помогло — поверхность из деталей.
|
||
-- Повторяем через несколько секунд на случай, если террейн перезаписал другой скрипт.
|
||
local planes = {}
|
||
-- материал вокселя (читаем воксели, а не лучом: физика террейна обновляется с задержкой)
|
||
local function voxelAt(pos)
|
||
local region = Region3.new(pos - V(1, 1, 1), pos + V(1, 1, 1)):ExpandToGrid(4)
|
||
local ok, mats = pcall(function()
|
||
return terrain:ReadVoxels(region, 4)
|
||
end)
|
||
return ok and mats[1] and mats[1][1] and mats[1][1][1] or nil
|
||
end
|
||
-- в центре озера: под поверхностью вода, над ней пусто
|
||
local function lakeState(l)
|
||
local c = w1.center + V(l[1], w1.waterY, l[2])
|
||
return voxelAt(c - V(0, 2, 0)), voxelAt(c + V(0, 2, 0))
|
||
end
|
||
local function lakeOk(below, above)
|
||
return below == nil or (below == Enum.Material.Water and above == Enum.Material.Air)
|
||
end
|
||
local function ensureLakeWater()
|
||
for i, l in ipairs(w1.lakes) do
|
||
local below, above = lakeState(l)
|
||
if not planes[i] and not lakeOk(below, above) then
|
||
warn(("[MapBuilder] Озеро %d Мира 1: под водой %s, над водой %s — заливаю заново"):format(i, tostring(below), tostring(above)))
|
||
World1Builder.carveLake(l)
|
||
below, above = lakeState(l)
|
||
if not lakeOk(below, above) then
|
||
warn(("[MapBuilder] Озеро %d Мира 1: всё ещё %s / %s — ставлю запасную поверхность воды"):format(i, tostring(below), tostring(above)))
|
||
planes[i] = waterPlane(w1.center + V(l[1], w1.waterY + 0.05, l[2]), l[3] * 2, Color3.fromRGB(30, 120, 150))
|
||
end
|
||
end
|
||
end
|
||
end
|
||
-- уровень, собранный и поправленный руками в Studio, не трогаем: озеро там могли поменять намеренно
|
||
if not world1Prebuilt then
|
||
ensureLakeWater()
|
||
if RunService:IsRunning() then
|
||
task.delay(5, ensureLakeWater)
|
||
end
|
||
end
|
||
if not terrainHasWater(w2.center + V(180, -4, 0)) then
|
||
warn("[MapBuilder] Вода в террейне Мира 2 не создалась — ставлю запасную поверхность воды")
|
||
waterPlane(w2.center + V(0, w2.waterY, 0), 500, Color3.fromRGB(40, 180, 190))
|
||
end
|
||
local h = w3.holes[1]
|
||
if not terrainHasWater(w3.center + V(h[1], -1, h[2])) then
|
||
warn("[MapBuilder] Вода в лунках Мира 3 не создалась — ставлю запасную поверхность воды")
|
||
for _, hole in ipairs(w3.holes) do
|
||
waterPlane(w3.center + V(hole[1], w3.waterY + 0.05, hole[2]), w3.holeRadius * 2, Color3.fromRGB(25, 75, 110))
|
||
end
|
||
end
|
||
end
|
||
|
||
map.Parent = Workspace
|
||
return map
|
||
end
|
||
|
||
---------------------------------------------------------------- сборка в Studio
|
||
|
||
function Builder.bake()
|
||
assert(not RunService:IsRunning(), "Собирайте карту в режиме редактирования, а не во время Play")
|
||
local old = Workspace:FindFirstChild("FishingMap")
|
||
if old then
|
||
-- «Тихое озеро» правят руками: переносим его в новую карту как есть (чтобы собрать заново — удалите World1Map)
|
||
local w1 = old:FindFirstChild("World1Map")
|
||
if w1 then
|
||
w1.Parent = Workspace
|
||
end
|
||
old:Destroy()
|
||
end
|
||
-- собранное раньше «Тихое озеро» (Workspace.World1Map) сохраняем вместе с его террейном
|
||
local keepWorld1 = Workspace:FindFirstChild("World1Map") ~= nil
|
||
for i = 1, 3 do
|
||
if i ~= 1 or not keepWorld1 then
|
||
terrain:FillBlock(CFrame.new(Config.Worlds[i].center + V(0, 30, 0)), V(680, 260, 680), Enum.Material.Air)
|
||
end
|
||
end
|
||
Builder.applyLighting()
|
||
local built = Builder.build()
|
||
print(("✅ Карта собрана: Workspace.FishingMap, деталей: %d. Сохраните плейс (Ctrl+S)."):format(#built:GetDescendants()))
|
||
return built
|
||
end
|
||
|
||
---------------------------------------------------------------- при запуске игры
|
||
|
||
local function spawnNpc(spot, parent)
|
||
local function color(name, default)
|
||
return spot:GetAttribute(name) or default
|
||
end
|
||
local name = spot:GetAttribute("NpcName")
|
||
local colors = {
|
||
skin = color("SkinColor", Color3.fromRGB(234, 184, 146)),
|
||
shirt = color("ShirtColor", Color3.fromRGB(200, 60, 50)),
|
||
pants = color("PantsColor", Color3.fromRGB(60, 70, 100)),
|
||
hat = color("HatColor", Color3.fromRGB(90, 110, 60)),
|
||
}
|
||
local ok, rig = pcall(function()
|
||
local d = Instance.new("HumanoidDescription")
|
||
d.HeadColor = colors.skin
|
||
d.LeftArmColor = colors.skin
|
||
d.RightArmColor = colors.skin
|
||
d.TorsoColor = colors.shirt
|
||
d.LeftLegColor = colors.pants
|
||
d.RightLegColor = colors.pants
|
||
return Players:CreateHumanoidModelFromDescription(d, Enum.HumanoidRigType.R15)
|
||
end)
|
||
if not ok or not rig then
|
||
warn("NPC не создан: " .. tostring(rig))
|
||
return nil
|
||
end
|
||
rig.Name = name
|
||
local hum = rig:FindFirstChildOfClass("Humanoid")
|
||
hum.DisplayName = name
|
||
hum.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
|
||
hum.NameDisplayDistance = 60
|
||
local root = rig:FindFirstChild("HumanoidRootPart")
|
||
root.Anchored = true
|
||
rig:PivotTo(spot.CFrame)
|
||
rig.Parent = parent
|
||
|
||
local head = rig:FindFirstChild("Head")
|
||
if head then
|
||
if not head:FindFirstChildOfClass("Decal") then
|
||
local face = Instance.new("Decal")
|
||
face.Name = "face"
|
||
face.Texture = "rbxasset://textures/face.png"
|
||
face.Parent = head
|
||
end
|
||
-- панама рыбака
|
||
local function hatPart(size, offset, shape)
|
||
local p = Instance.new("Part")
|
||
p.Shape = shape
|
||
p.Size = size
|
||
p.CanCollide = false
|
||
p.Massless = true
|
||
p.Color = colors.hat
|
||
p.Material = Enum.Material.Fabric
|
||
p.CFrame = head.CFrame * offset
|
||
local w = Instance.new("Weld")
|
||
w.Part0 = head
|
||
w.Part1 = p
|
||
w.C0 = head.CFrame:Inverse() * p.CFrame
|
||
w.Parent = p
|
||
p.Parent = rig
|
||
end
|
||
hatPart(V(0.15, 2.0, 2.0), CFrame.new(0, 0.55, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder)
|
||
hatPart(V(0.6, 1.35, 1.35), CFrame.new(0, 0.85, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder)
|
||
end
|
||
local action = spot:GetAttribute("NpcAction")
|
||
if action then
|
||
prompt(root, spot:GetAttribute("NpcActionText") or "Поговорить", name, action, 14)
|
||
end
|
||
return rig
|
||
end
|
||
|
||
-- NPC встают на свои детали-места, доски «кто водится» получают актуальный список рыб
|
||
function Builder.prepareRuntime(root)
|
||
local spots, boards = {}, {}
|
||
for _, d in ipairs(root:GetDescendants()) do
|
||
if d:IsA("BasePart") then
|
||
if d:GetAttribute("NpcName") then
|
||
table.insert(spots, d)
|
||
elseif d:GetAttribute("Bestiary") then
|
||
table.insert(boards, d)
|
||
end
|
||
end
|
||
end
|
||
for _, spot in ipairs(spots) do
|
||
spot.Transparency = 1
|
||
spawnNpc(spot, root)
|
||
end
|
||
for _, board in ipairs(boards) do
|
||
writeBestiary(board)
|
||
end
|
||
end
|
||
|
||
return Builder
|
||
]=====])
|
||
put('LocalScript', 'Ambience', game.StarterPlayer.StarterPlayerScripts, [=====[-- Ambience (LocalScript) -> StarterPlayer > StarterPlayerScripts
|
||
-- Атмосфера у этого игрока: время суток, ночной свет, тучи, дождь/снег, молнии, музыка и звуки окружения,
|
||
-- плашка «погода и время» на экране. Время и погоду задаёт сервер (WeatherServer) атрибутами workspace.
|
||
-- Свет локации (Config.Worlds[*].look) ставит FishingClient; здесь всё накладывается поверх:
|
||
-- свои эффекты цвета живут в камере, поэтому не мешают настройкам локаций.
|
||
|
||
local Players = game:GetService("Players")
|
||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||
local RunService = game:GetService("RunService")
|
||
local TweenService = game:GetService("TweenService")
|
||
local Lighting = game:GetService("Lighting")
|
||
|
||
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||
local Audio = require(script.Parent:WaitForChild("Audio"))
|
||
|
||
local player = Players.LocalPlayer
|
||
local terrain = workspace.Terrain
|
||
local rng = Random.new()
|
||
local WHITE = Color3.new(1, 1, 1)
|
||
|
||
local function new(class, props)
|
||
local o = Instance.new(class)
|
||
for k, v in pairs(props) do
|
||
if k ~= "Parent" then
|
||
o[k] = v
|
||
end
|
||
end
|
||
o.Parent = props.Parent
|
||
return o
|
||
end
|
||
|
||
local function clockNow()
|
||
return Config.ClockAt(workspace:GetServerTimeNow(), workspace:GetAttribute("DayStart"))
|
||
end
|
||
|
||
local function currentPlace()
|
||
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||
if not hrp then
|
||
return nil, "Lobby"
|
||
end
|
||
local w = Config.WorldAt(hrp.Position)
|
||
return w, w and w.id or "Lobby"
|
||
end
|
||
|
||
local function currentWeather()
|
||
return Config.WeatherById(workspace:GetAttribute("Weather"))
|
||
end
|
||
|
||
---------------------------------------------------------------- вид погоды
|
||
|
||
-- cc — поправка цвета поверх света локации; cover/density/cloud — облака; rain — частиц в секунду
|
||
local LOOK = {
|
||
Clear = { cover = 0.4, density = 0.45, cloud = Color3.fromRGB(255, 255, 255), rain = 0,
|
||
cc = { Brightness = 0, Saturation = 0, Contrast = 0, TintColor = WHITE } },
|
||
Cloudy = { cover = 0.78, density = 0.6, cloud = Color3.fromRGB(215, 218, 226), rain = 0,
|
||
cc = { Brightness = -0.03, Saturation = -0.1, Contrast = 0, TintColor = Color3.fromRGB(236, 239, 246) } },
|
||
Rain = { cover = 0.88, density = 0.75, cloud = Color3.fromRGB(165, 170, 182), rain = 350, rainSound = "rainLight",
|
||
cc = { Brightness = -0.06, Saturation = -0.18, Contrast = 0.02, TintColor = Color3.fromRGB(214, 224, 240) } },
|
||
Storm = { cover = 0.96, density = 0.9, cloud = Color3.fromRGB(105, 110, 124), rain = 900, rainSound = "rainHeavy", lightning = true,
|
||
cc = { Brightness = -0.12, Saturation = -0.3, Contrast = 0.06, TintColor = Color3.fromRGB(190, 200, 226) } },
|
||
Fog = { cover = 0.6, density = 0.5, cloud = Color3.fromRGB(232, 232, 238), rain = 0,
|
||
cc = { Brightness = 0.02, Saturation = -0.22, Contrast = -0.05, TintColor = Color3.fromRGB(234, 238, 242) } },
|
||
}
|
||
|
||
-- эффекты в камере: действуют только у этого игрока и не путаются с эффектами Lighting
|
||
local camera = workspace.CurrentCamera
|
||
local weatherCC = new("ColorCorrectionEffect", { Name = "WeatherCC", Parent = camera })
|
||
local nightCC = new("ColorCorrectionEffect", { Name = "NightCC", Parent = camera })
|
||
workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function()
|
||
camera = workspace.CurrentCamera
|
||
weatherCC.Parent = camera
|
||
nightCC.Parent = camera
|
||
end)
|
||
|
||
local clouds = terrain:FindFirstChildOfClass("Clouds") or new("Clouds", { Parent = terrain })
|
||
|
||
-- дождь (а во фьорде — снег) сыплется из невидимой плиты над камерой
|
||
local rainPart = new("Part", {
|
||
Name = "RainFX", Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false,
|
||
Transparency = 1, Size = Vector3.new(110, 1, 110), Parent = workspace,
|
||
})
|
||
local rain = new("ParticleEmitter", {
|
||
Texture = "rbxasset://textures/SelfView/whiteRect.png",
|
||
Rate = 0, Lifetime = NumberRange.new(1.1, 1.4), Speed = NumberRange.new(55, 70),
|
||
EmissionDirection = Enum.NormalId.Bottom, SpreadAngle = Vector2.new(4, 4),
|
||
Orientation = Enum.ParticleOrientation.VelocityParallel,
|
||
Size = NumberSequence.new(0.07), Squash = NumberSequence.new(2.5),
|
||
Color = ColorSequence.new(Color3.fromRGB(200, 215, 235)), Transparency = NumberSequence.new(0.45),
|
||
LightInfluence = 1,
|
||
Parent = rainPart,
|
||
})
|
||
|
||
local function rainStyle(snowy)
|
||
if snowy then
|
||
rain.Speed = NumberRange.new(6, 10)
|
||
rain.Lifetime = NumberRange.new(5, 7)
|
||
rain.Size = NumberSequence.new(0.22)
|
||
rain.Squash = NumberSequence.new(0)
|
||
rain.SpreadAngle = Vector2.new(25, 25)
|
||
rain.Orientation = Enum.ParticleOrientation.FacingCamera
|
||
rain.Color = ColorSequence.new(WHITE)
|
||
rain.Transparency = NumberSequence.new(0.1)
|
||
else
|
||
rain.Speed = NumberRange.new(55, 70)
|
||
rain.Lifetime = NumberRange.new(1.1, 1.4)
|
||
rain.Size = NumberSequence.new(0.07)
|
||
rain.Squash = NumberSequence.new(2.5)
|
||
rain.SpreadAngle = Vector2.new(4, 4)
|
||
rain.Orientation = Enum.ParticleOrientation.VelocityParallel
|
||
rain.Color = ColorSequence.new(Color3.fromRGB(200, 215, 235))
|
||
rain.Transparency = NumberSequence.new(0.45)
|
||
end
|
||
end
|
||
|
||
local appliedWeather, appliedPlace = nil, nil
|
||
local function applyWeather(instant)
|
||
local w = currentWeather()
|
||
local _, placeId = currentPlace()
|
||
if appliedWeather == w.id and appliedPlace == placeId and not instant then
|
||
return
|
||
end
|
||
appliedWeather, appliedPlace = w.id, placeId
|
||
local look = LOOK[w.id] or LOOK.Clear
|
||
local info = TweenInfo.new(instant and 0 or 6)
|
||
TweenService:Create(weatherCC, info, look.cc):Play()
|
||
TweenService:Create(clouds, info, { Cover = look.cover, Density = look.density }):Play() -- цвет туч ставит главный цикл (с учётом ночи)
|
||
local snowy = placeId == "World3"
|
||
rainStyle(snowy)
|
||
rain.Rate = snowy and look.rain * 0.35 or look.rain
|
||
end
|
||
|
||
---------------------------------------------------------------- молнии
|
||
|
||
task.spawn(function()
|
||
while true do
|
||
task.wait(rng:NextNumber(6, 16))
|
||
local w = currentWeather()
|
||
local _, placeId = currentPlace()
|
||
if LOOK[w.id] and LOOK[w.id].lightning and placeId ~= "World3" then
|
||
-- двойная вспышка, гром приходит чуть позже (молния далеко)
|
||
local base = weatherCC.Brightness
|
||
for _ = 1, 2 do
|
||
weatherCC.Brightness = base + 0.45
|
||
task.wait(0.06)
|
||
weatherCC.Brightness = base
|
||
task.wait(0.09)
|
||
end
|
||
local far = rng:NextNumber()
|
||
task.delay(0.2 + far * 1.4, function()
|
||
local list = Config.Sounds.thunder
|
||
Audio.playId(list[rng:NextInteger(1, #list)], 0.9 - far * 0.5, "ambient")
|
||
end)
|
||
end
|
||
end
|
||
end)
|
||
|
||
---------------------------------------------------------------- музыка
|
||
|
||
local tracks = {}
|
||
local function track(name)
|
||
if not tracks[name] then
|
||
tracks[name] = Audio.loop(name, "music")
|
||
end
|
||
return tracks[name]
|
||
end
|
||
|
||
local currentTrack = nil
|
||
local function musicFor(placeId, night)
|
||
if night and placeId ~= "World2" then
|
||
return "musicNight"
|
||
end
|
||
if placeId == "Lobby" then
|
||
return (math.floor(workspace:GetServerTimeNow() / 600) % 2 == 0) and "musicLobby" or "musicLobby2"
|
||
elseif placeId == "World1" then
|
||
return (math.floor(workspace:GetServerTimeNow() / 600) % 2 == 0) and "musicLake" or "musicLake2"
|
||
elseif placeId == "World3" then
|
||
return "musicNight"
|
||
end
|
||
return "musicLake2"
|
||
end
|
||
|
||
---------------------------------------------------------------- звуки окружения
|
||
|
||
local ambient = {}
|
||
for _, name in ipairs({ "birdsLake", "birdsPark", "birdsJungle", "crickets", "lakeWater", "wind", "rainLight", "rainHeavy" }) do
|
||
ambient[name] = Audio.loop(name, "ambient")
|
||
end
|
||
|
||
-- какие петли и насколько громко звучат сейчас
|
||
local function ambientMix(placeId, night, w)
|
||
local mix = {}
|
||
local day = not night
|
||
mix.birdsLake = (day and placeId == "World1") and 1 or 0
|
||
mix.birdsPark = (day and placeId == "Lobby") and 1 or 0
|
||
mix.birdsJungle = (day and placeId == "World2") and 1 or 0
|
||
mix.crickets = (night and placeId ~= "World3") and 1 or 0
|
||
mix.lakeWater = (placeId == "World1" or placeId == "World2") and 1 or 0
|
||
local wind = 1
|
||
if placeId == "World3" then
|
||
wind = 2.5
|
||
end
|
||
if w.id == "Storm" then
|
||
wind *= 2
|
||
end
|
||
mix.wind = wind
|
||
local wet = placeId ~= "World3"
|
||
mix.rainLight = (wet and w.id == "Rain") and 1 or 0
|
||
mix.rainHeavy = (wet and w.id == "Storm") and 1 or 0
|
||
-- в дождь птицы прячутся
|
||
if w.id == "Rain" or w.id == "Storm" then
|
||
mix.birdsLake, mix.birdsPark, mix.birdsJungle = 0, 0, 0
|
||
end
|
||
return mix
|
||
end
|
||
|
||
-- треск у каждого костра на карте (звук в самом костре: слышно только рядом)
|
||
task.spawn(function()
|
||
local map = workspace:WaitForChild("FishingMap", 60)
|
||
if not map then
|
||
return
|
||
end
|
||
task.wait(3)
|
||
local def = Config.Sounds.fire
|
||
for _, d in ipairs(map:GetDescendants()) do
|
||
if d:IsA("Fire") and d.Parent and d.Parent:IsA("BasePart") then
|
||
new("Sound", {
|
||
Name = "FireCrackle", SoundId = def.id, Volume = def.volume, Looped = true, Playing = true,
|
||
RollOffMode = Enum.RollOffMode.InverseTapered, RollOffMinDistance = 6, RollOffMaxDistance = def.roll or 30,
|
||
SoundGroup = Audio.groups.ambient, Parent = d.Parent,
|
||
})
|
||
end
|
||
end
|
||
end)
|
||
|
||
---------------------------------------------------------------- плашка «погода и время»
|
||
|
||
local hud = new("ScreenGui", { Name = "WeatherHud", ResetOnSpawn = false, IgnoreGuiInset = false, Parent = player:WaitForChild("PlayerGui") })
|
||
local pill = new("Frame", {
|
||
Size = UDim2.fromOffset(230, 46), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 74),
|
||
BackgroundColor3 = Color3.fromRGB(20, 22, 34), BackgroundTransparency = 0.2, Parent = hud,
|
||
})
|
||
new("UICorner", { CornerRadius = UDim.new(0, 12), Parent = pill })
|
||
local pillStroke = new("UIStroke", { Color = Color3.fromRGB(200, 160, 90), Thickness = 1.5, Transparency = 0.3, Parent = pill })
|
||
local line1 = new("TextLabel", {
|
||
Size = UDim2.new(1, -16, 0, 24), Position = UDim2.fromOffset(10, 2), BackgroundTransparency = 1,
|
||
Font = Enum.Font.FredokaOne, TextSize = 18, TextColor3 = WHITE, TextXAlignment = Enum.TextXAlignment.Left,
|
||
Text = "", Parent = pill,
|
||
})
|
||
local line2 = new("TextLabel", {
|
||
Size = UDim2.new(1, -16, 0, 16), Position = UDim2.fromOffset(10, 26), BackgroundTransparency = 1,
|
||
Font = Enum.Font.GothamMedium, TextSize = 12, TextColor3 = Color3.fromRGB(150, 230, 160), TextXAlignment = Enum.TextXAlignment.Left,
|
||
Text = "", Parent = pill,
|
||
})
|
||
-- на узком экране плашка меньше
|
||
local function fitPill()
|
||
local small = camera and camera.ViewportSize.X < 700
|
||
pill.Size = small and UDim2.fromOffset(170, 40) or UDim2.fromOffset(230, 46)
|
||
line1.TextSize = small and 15 or 18
|
||
line2.TextSize = small and 10 or 12
|
||
end
|
||
fitPill()
|
||
|
||
local function weatherName(w, placeId)
|
||
return (w.names and w.names[placeId]) or w.name
|
||
end
|
||
|
||
local lastShownWeather = nil
|
||
local function refreshPill(clock, night, w, placeId)
|
||
local h = math.floor(clock)
|
||
local m = math.floor((clock - h) * 60)
|
||
line1.Text = ("%s %s · %s %02d:%02d"):format(w.icon, weatherName(w, placeId), night and "🌙" or "☀", h, m)
|
||
local bonus = {}
|
||
if w.desc then
|
||
table.insert(bonus, w.desc)
|
||
end
|
||
if night then
|
||
table.insert(bonus, ("Ночь: удача +%d%%"):format(math.floor(Config.DayNight.nightLuck * 100 + 0.5)))
|
||
end
|
||
line2.Text = #bonus > 0 and table.concat(bonus, " · ") or "Спокойная погода"
|
||
if lastShownWeather ~= w.id then
|
||
-- погода сменилась: плашка вспыхивает
|
||
if lastShownWeather ~= nil then
|
||
pillStroke.Color = Color3.fromRGB(255, 220, 120)
|
||
pillStroke.Transparency = 0
|
||
TweenService:Create(pillStroke, TweenInfo.new(2.5), { Color = Color3.fromRGB(200, 160, 90), Transparency = 0.3 }):Play()
|
||
end
|
||
lastShownWeather = w.id
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- главный цикл
|
||
|
||
-- часы двигаются каждый кадр (плавно), остальное проверяется раз в полсекунды
|
||
RunService.RenderStepped:Connect(function()
|
||
if Config.DayNight.enabled then
|
||
Lighting.ClockTime = clockNow()
|
||
end
|
||
if camera then
|
||
rainPart.CFrame = CFrame.new(camera.CFrame.Position + Vector3.new(0, 35, 0))
|
||
end
|
||
end)
|
||
|
||
workspace:GetAttributeChangedSignal("Weather"):Connect(function()
|
||
applyWeather(false)
|
||
end)
|
||
applyWeather(true)
|
||
|
||
task.spawn(function()
|
||
while true do
|
||
local clock = clockNow()
|
||
local nightness = Config.DayNight.enabled and Config.Nightness(clock) or 0
|
||
local night = nightness >= 0.5
|
||
local w = currentWeather()
|
||
local _, placeId = currentPlace()
|
||
|
||
-- ночь: темнее, холоднее, менее насыщенно
|
||
nightCC.Brightness = -0.1 * nightness
|
||
nightCC.Saturation = -0.18 * nightness
|
||
nightCC.TintColor = WHITE:Lerp(Color3.fromRGB(165, 185, 255), nightness)
|
||
clouds.Color = (LOOK[w.id] or LOOK.Clear).cloud:Lerp(Color3.fromRGB(40, 45, 60), nightness * 0.8)
|
||
|
||
applyWeather(false) -- смена локации меняет дождь на снег и обратно
|
||
|
||
-- музыка: плавная смена трека, в грозу тише
|
||
local want = musicFor(placeId, night)
|
||
local duck = (w.id == "Storm") and 0.5 or 1
|
||
if currentTrack ~= want then
|
||
if currentTrack then
|
||
Audio.fade(track(currentTrack), 0, 3)
|
||
end
|
||
currentTrack = want
|
||
end
|
||
Audio.fade(track(want), duck, 3)
|
||
|
||
for name, factor in pairs(ambientMix(placeId, night, w)) do
|
||
Audio.fade(ambient[name], factor, 3)
|
||
end
|
||
|
||
fitPill()
|
||
refreshPill(clock, night, w, placeId)
|
||
task.wait(0.5)
|
||
end
|
||
end)
|
||
]=====])
|
||
put('ModuleScript', 'Audio', game.StarterPlayer.StarterPlayerScripts, [=====[-- Audio (ModuleScript) -> StarterPlayer > StarterPlayerScripts
|
||
-- Звуки у этого игрока. Три группы громкости: музыка, эффекты и окружение (окружение — по громкости эффектов).
|
||
-- Громкость берётся из атрибутов игрока VolMusic / VolSfx (их выставляет и сохраняет сервер).
|
||
-- Audio.play(name) — разовый звук из Config.Sounds
|
||
-- Audio.loop(name, group) — петля (молчит, пока не вызвать Audio.fade)
|
||
-- Audio.fade(sound, factor) — плавно к громкости «базовая × factor» (0 — тишина, звук ставится на паузу)
|
||
|
||
local Players = game:GetService("Players")
|
||
local SoundService = game:GetService("SoundService")
|
||
local TweenService = game:GetService("TweenService")
|
||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||
|
||
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||
local player = Players.LocalPlayer
|
||
local rng = Random.new()
|
||
|
||
local Audio = {}
|
||
|
||
local function group(name)
|
||
local g = SoundService:FindFirstChild(name)
|
||
if not g then
|
||
g = Instance.new("SoundGroup")
|
||
g.Name = name
|
||
g.Parent = SoundService
|
||
end
|
||
return g
|
||
end
|
||
Audio.groups = {
|
||
music = group("MusicGroup"),
|
||
sfx = group("SfxGroup"),
|
||
ambient = group("AmbientGroup"),
|
||
}
|
||
|
||
local function applyVolumes()
|
||
local music = player:GetAttribute("VolMusic") or Config.DefaultVolume.music
|
||
local sfx = player:GetAttribute("VolSfx") or Config.DefaultVolume.sfx
|
||
Audio.groups.music.Volume = music
|
||
Audio.groups.sfx.Volume = sfx
|
||
Audio.groups.ambient.Volume = sfx
|
||
end
|
||
applyVolumes()
|
||
player:GetAttributeChangedSignal("VolMusic"):Connect(applyVolumes)
|
||
player:GetAttributeChangedSignal("VolSfx"):Connect(applyVolumes)
|
||
|
||
function Audio.play(name, volumeMult)
|
||
local def = Config.Sounds[name]
|
||
if not def or not def.id then
|
||
return nil
|
||
end
|
||
local s = Instance.new("Sound")
|
||
s.SoundId = def.id
|
||
s.Volume = (def.volume or 0.5) * (volumeMult or 1)
|
||
if def.pitch then
|
||
s.PlaybackSpeed = rng:NextNumber(def.pitch[1], def.pitch[2])
|
||
end
|
||
s.SoundGroup = Audio.groups.sfx
|
||
s.Parent = SoundService
|
||
s:Play()
|
||
s.Ended:Connect(function()
|
||
s:Destroy()
|
||
end)
|
||
task.delay(30, function()
|
||
if s.Parent then
|
||
s:Destroy()
|
||
end
|
||
end)
|
||
return s
|
||
end
|
||
|
||
-- разовый звук по прямому id (например, случайный раскат грома из списка)
|
||
function Audio.playId(id, volume, groupName)
|
||
local s = Instance.new("Sound")
|
||
s.SoundId = id
|
||
s.Volume = volume or 0.5
|
||
s.SoundGroup = Audio.groups[groupName or "sfx"]
|
||
s.Parent = SoundService
|
||
s:Play()
|
||
s.Ended:Connect(function()
|
||
s:Destroy()
|
||
end)
|
||
return s
|
||
end
|
||
|
||
function Audio.loop(name, groupName)
|
||
local def = Config.Sounds[name]
|
||
if not def then
|
||
return nil
|
||
end
|
||
local s = Instance.new("Sound")
|
||
s.Name = name
|
||
s.SoundId = def.id
|
||
s.Looped = true
|
||
s.Volume = 0
|
||
s.SoundGroup = Audio.groups[groupName or "ambient"]
|
||
s:SetAttribute("BaseVolume", def.volume or 0.5)
|
||
s.Parent = SoundService
|
||
return s
|
||
end
|
||
|
||
local fades = {}
|
||
function Audio.fade(s, factor, time)
|
||
if not s then
|
||
return
|
||
end
|
||
local target = (s:GetAttribute("BaseVolume") or 0.5) * (factor or 0)
|
||
if fades[s] and fades[s].target == target then
|
||
return
|
||
end
|
||
if fades[s] then
|
||
fades[s].tween:Cancel()
|
||
end
|
||
if target > 0 and not s.IsPlaying then
|
||
s:Resume()
|
||
if not s.IsPlaying then
|
||
s:Play()
|
||
end
|
||
end
|
||
local tw = TweenService:Create(s, TweenInfo.new(time or 2), { Volume = target })
|
||
fades[s] = { tween = tw, target = target }
|
||
tw.Completed:Connect(function(state)
|
||
if state == Enum.PlaybackState.Completed and target <= 0.001 then
|
||
s:Pause()
|
||
end
|
||
end)
|
||
tw:Play()
|
||
end
|
||
|
||
return Audio
|
||
]=====])
|
||
put('LocalScript', 'FishingClient', game.StarterPlayer.StarterPlayerScripts, [=====[-- FishingClient (LocalScript) -> StarterPlayer > StarterPlayerScripts
|
||
-- Интерфейс: HUD, сумка, коллекция с наградами, миры, задания, ежедневная награда,
|
||
-- магазин, улучшения, удача, донат, событие, мини-игра, атмосфера миров.
|
||
|
||
local Players = game:GetService("Players")
|
||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||
local RunService = game:GetService("RunService")
|
||
local TweenService = game:GetService("TweenService")
|
||
local UserInputService = game:GetService("UserInputService")
|
||
local MarketplaceService = game:GetService("MarketplaceService")
|
||
local Lighting = game:GetService("Lighting")
|
||
|
||
local player = Players.LocalPlayer
|
||
local Config = require(ReplicatedStorage:WaitForChild("FishConfig"))
|
||
local Models = require(ReplicatedStorage:WaitForChild("GameModels"))
|
||
local Audio = require(script.Parent:WaitForChild("Audio"))
|
||
local remote = ReplicatedStorage:WaitForChild("GameEvent")
|
||
local reelSound = Audio.loop("reel", "sfx") -- трещотка катушки, пока идёт вываживание
|
||
|
||
---------------------------------------------------------------- стиль
|
||
|
||
local C = {
|
||
bg = Color3.fromRGB(18, 24, 40),
|
||
panel = Color3.fromRGB(30, 38, 62),
|
||
panel2 = Color3.fromRGB(44, 56, 90),
|
||
gold = Color3.fromRGB(255, 200, 70),
|
||
green = Color3.fromRGB(60, 190, 95),
|
||
blue = Color3.fromRGB(60, 135, 230),
|
||
red = Color3.fromRGB(215, 65, 65),
|
||
purple = Color3.fromRGB(150, 90, 220),
|
||
grey = Color3.fromRGB(75, 82, 102),
|
||
text = Color3.new(1, 1, 1),
|
||
muted = Color3.fromRGB(170, 180, 205),
|
||
line = Color3.fromRGB(90, 110, 165),
|
||
}
|
||
local TITLE = Enum.Font.FredokaOne
|
||
local BODY = Enum.Font.GothamBold
|
||
local BODY2 = Enum.Font.GothamMedium
|
||
local WHITE, BLACK = Color3.new(1, 1, 1), Color3.new(0, 0, 0)
|
||
local DING = "rbxasset://sounds/electronicpingshort.wav"
|
||
|
||
---------------------------------------------------------------- помощники UI
|
||
|
||
local function new(class, props, children)
|
||
local obj = Instance.new(class)
|
||
local parent
|
||
for k, v in pairs(props or {}) do
|
||
if k == "Parent" then
|
||
parent = v
|
||
else
|
||
obj[k] = v
|
||
end
|
||
end
|
||
for _, c in ipairs(children or {}) do
|
||
c.Parent = obj
|
||
end
|
||
if parent then
|
||
obj.Parent = parent
|
||
end
|
||
return obj
|
||
end
|
||
local function corner(r)
|
||
return new("UICorner", { CornerRadius = UDim.new(0, r or 10) })
|
||
end
|
||
local function stroke(color, th, tr)
|
||
return new("UIStroke", { Color = color, Thickness = th or 2, Transparency = tr or 0, ApplyStrokeMode = Enum.ApplyStrokeMode.Border })
|
||
end
|
||
local function gradient(a, b, rot)
|
||
return new("UIGradient", { Color = ColorSequence.new(a, b), Rotation = rot or 90 })
|
||
end
|
||
local function text(props)
|
||
local d = {
|
||
BackgroundTransparency = 1, Font = BODY, TextColor3 = C.text, TextSize = 16,
|
||
TextXAlignment = Enum.TextXAlignment.Left, TextYAlignment = Enum.TextYAlignment.Center,
|
||
}
|
||
for k, v in pairs(props) do
|
||
d[k] = v
|
||
end
|
||
return new("TextLabel", d)
|
||
end
|
||
local function btn(props, onClick)
|
||
local d = { AutoButtonColor = true, Font = TITLE, TextColor3 = C.text, TextSize = 18, BackgroundColor3 = C.blue, Text = "" }
|
||
for k, v in pairs(props) do
|
||
d[k] = v
|
||
end
|
||
local b = new("TextButton", d, { corner(10), new("UIGradient", { Color = ColorSequence.new(WHITE, Color3.fromRGB(195, 195, 195)), Rotation = 90 }) })
|
||
if onClick then
|
||
b.MouseButton1Click:Connect(function(...)
|
||
Audio.play("click")
|
||
onClick(...)
|
||
end)
|
||
end
|
||
return b
|
||
end
|
||
local function clear(container)
|
||
for _, c in ipairs(container:GetChildren()) do
|
||
if c:IsA("GuiObject") then
|
||
c:Destroy()
|
||
end
|
||
end
|
||
end
|
||
local function fmt(n)
|
||
local s = tostring(math.floor(n))
|
||
local out = s:reverse():gsub("(%d%d%d)", "%1 "):reverse()
|
||
return (out:gsub("^ ", ""))
|
||
end
|
||
local function stars(n)
|
||
return string.rep("★", n) .. string.rep("☆", Config.RodUpgrade.maxLevel - n)
|
||
end
|
||
local function hex(c)
|
||
return "#" .. c:ToHex()
|
||
end
|
||
local function timeStr(sec)
|
||
sec = math.max(0, math.floor(sec))
|
||
return ("%d:%02d"):format(math.floor(sec / 60), sec % 60)
|
||
end
|
||
local function attrSet(name)
|
||
local set = {}
|
||
for id in string.gmatch(player:GetAttribute(name) or "", "[^,]+") do
|
||
set[id] = true
|
||
end
|
||
return set
|
||
end
|
||
local function rodLevels()
|
||
local t = {}
|
||
for id, lv in string.gmatch(player:GetAttribute("RodLevels") or "", "([^,:]+):(%d+)") do
|
||
t[id] = tonumber(lv)
|
||
end
|
||
return t
|
||
end
|
||
local function playUiSound(id, vol)
|
||
local s = Instance.new("Sound")
|
||
s.SoundId = id
|
||
s.Volume = vol or 0.5
|
||
s.Parent = workspace.CurrentCamera
|
||
s:Play()
|
||
game:GetService("Debris"):AddItem(s, 3)
|
||
end
|
||
|
||
local function viewport(parent, model, dir, zoom)
|
||
local vf = new("ViewportFrame", {
|
||
Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1,
|
||
Ambient = Color3.fromRGB(175, 175, 185), LightColor = WHITE, LightDirection = Vector3.new(-0.4, -1, -0.6),
|
||
Parent = parent,
|
||
})
|
||
model.Parent = vf
|
||
local cf, size = model:GetBoundingBox()
|
||
local cam = Instance.new("Camera")
|
||
cam.FieldOfView = 30
|
||
local dist = (size.Magnitude / 2) / math.tan(math.rad(15)) * (zoom or 0.9)
|
||
cam.CFrame = CFrame.lookAt(cf.Position + dir.Unit * dist, cf.Position)
|
||
cam.Parent = vf
|
||
vf.CurrentCamera = cam
|
||
return vf
|
||
end
|
||
local FISH_VIEW = Vector3.new(0.12, 0.15, 1)
|
||
local ROD_VIEW = Vector3.new(1, 0.1, 0.05)
|
||
local BAG_VIEW = Vector3.new(0.6, 0.25, 1)
|
||
|
||
local function silhouette(model)
|
||
for _, p in ipairs(model:GetDescendants()) do
|
||
if p:IsA("BasePart") then
|
||
p.Color = Color3.fromRGB(10, 12, 20)
|
||
p.Material = Enum.Material.SmoothPlastic
|
||
elseif p:IsA("ParticleEmitter") or p:IsA("PointLight") then
|
||
p:Destroy()
|
||
end
|
||
end
|
||
return model
|
||
end
|
||
|
||
---------------------------------------------------------------- корень
|
||
|
||
local gui = new("ScreenGui", {
|
||
Name = "FishingUI", ResetOnSpawn = false, IgnoreGuiInset = false,
|
||
ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = player:WaitForChild("PlayerGui"),
|
||
})
|
||
|
||
---------------------------------------------------------------- HUD
|
||
|
||
local hud = new("Frame", {
|
||
Size = UDim2.fromOffset(290, 172), Position = UDim2.fromOffset(12, 10), BackgroundColor3 = WHITE, Parent = gui,
|
||
}, { corner(16), stroke(C.line, 2, 0.35), gradient(C.panel2, C.bg, 90),
|
||
new("UIPadding", { PaddingLeft = UDim.new(0, 14), PaddingRight = UDim.new(0, 14), PaddingTop = UDim.new(0, 10) }) })
|
||
local coinsText = text({ Size = UDim2.new(1, 0, 0, 32), Font = TITLE, TextSize = 30, TextColor3 = C.gold, Text = "💰 0", TextStrokeTransparency = 0.6, Parent = hud })
|
||
local lvlBadge = new("Frame", { Size = UDim2.fromOffset(36, 36), Position = UDim2.fromOffset(0, 38), BackgroundColor3 = WHITE, Parent = hud },
|
||
{ corner(18), gradient(Color3.fromRGB(255, 225, 110), Color3.fromRGB(235, 145, 30), 90), stroke(Color3.fromRGB(120, 70, 10), 2, 0.2) })
|
||
local lvlText = text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 19, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = Color3.fromRGB(70, 40, 0), Text = "1", Parent = lvlBadge })
|
||
local xpBack = new("Frame", { Size = UDim2.new(1, -46, 0, 18), Position = UDim2.fromOffset(46, 47), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = hud }, { corner(9) })
|
||
local xpFill = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = WHITE, Parent = xpBack }, { corner(9), gradient(Color3.fromRGB(110, 225, 255), Color3.fromRGB(60, 110, 255), 0) })
|
||
local xpText = text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 2, Text = "", TextStrokeTransparency = 0.5, Parent = xpBack })
|
||
local luckText = text({ Size = UDim2.new(1, 0, 0, 22), Position = UDim2.fromOffset(0, 82), TextSize = 16, RichText = true, TextColor3 = Color3.fromRGB(130, 255, 150), Text = "", Parent = hud })
|
||
local bagText = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 106), TextSize = 14, Font = BODY2, Text = "", Parent = hud })
|
||
local rodText = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 128), TextSize = 14, Font = BODY2, TextColor3 = C.muted, RichText = true, Text = "", Parent = hud })
|
||
|
||
-- баннер события (справа сверху)
|
||
local eventBanner = new("Frame", {
|
||
Size = UDim2.fromOffset(280, 58), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 10),
|
||
BackgroundColor3 = WHITE, Visible = false, Parent = gui,
|
||
}, { corner(14), stroke(C.gold, 2, 0.1), gradient(Color3.fromRGB(90, 60, 20), C.bg, 90) })
|
||
local eventTitle = text({ Size = UDim2.new(1, -20, 0, 26), Position = UDim2.fromOffset(12, 4), Font = TITLE, TextSize = 19, TextColor3 = C.gold, Text = "", Parent = eventBanner })
|
||
local eventDesc = text({ Size = UDim2.new(1, -20, 0, 20), Position = UDim2.fromOffset(12, 30), Font = BODY2, TextSize = 13, TextColor3 = C.text, Text = "", Parent = eventBanner })
|
||
|
||
-- кнопки слева
|
||
local side = new("Frame", {
|
||
Size = UDim2.fromOffset(70, 380), AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0, 12, 0.5, 60),
|
||
BackgroundTransparency = 1, Parent = gui,
|
||
}, { new("UIListLayout", { Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||
|
||
local sideDots = {}
|
||
local function sideButton(order, icon, label, key, color, onClick)
|
||
local b = btn({ Size = UDim2.fromOffset(68, 68), BackgroundColor3 = color, LayoutOrder = order, Parent = side }, onClick)
|
||
stroke(color:Lerp(BLACK, 0.45), 3).Parent = b
|
||
text({ Size = UDim2.new(1, 0, 0, 36), Position = UDim2.fromOffset(0, 3), TextSize = 28, TextXAlignment = Enum.TextXAlignment.Center, Text = icon, Parent = b })
|
||
text({ Size = UDim2.new(1, 0, 0, 18), Position = UDim2.fromOffset(0, 44), Font = TITLE, TextSize = 13, TextXAlignment = Enum.TextXAlignment.Center, Text = label, TextStrokeTransparency = 0.5, Parent = b })
|
||
if key and not UserInputService.TouchEnabled then
|
||
local tag = new("Frame", { Size = UDim2.fromOffset(20, 20), Position = UDim2.new(1, -14, 0, -6), BackgroundColor3 = C.bg, Parent = b }, { corner(6), stroke(C.gold, 1.5) })
|
||
text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, Text = key, Parent = tag })
|
||
end
|
||
local dot = new("Frame", { Size = UDim2.fromOffset(16, 16), Position = UDim2.new(0, -5, 0, -5), BackgroundColor3 = C.red, Visible = false, ZIndex = 3, Parent = b }, { corner(8), stroke(WHITE, 2) })
|
||
sideDots[label] = dot
|
||
return b
|
||
end
|
||
|
||
---------------------------------------------------------------- уведомления
|
||
-- мультяшный стиль подсказок: крупный круглый шрифт без обводки на мягкой «дымке» —
|
||
-- тёмная подложка, которая плавно растворяется к краям; появляются «пружинкой»
|
||
|
||
local SOFT_EDGES = NumberSequence.new({
|
||
NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.18, 0.62),
|
||
NumberSequenceKeypoint.new(0.82, 0.62), NumberSequenceKeypoint.new(1, 1),
|
||
})
|
||
-- жирный округлый шрифт с кириллицей (у FredokaOne кириллицы нет — Roblox подставляет тонкий шрифт)
|
||
local HINT_FONT = Font.new("rbxasset://fonts/families/Nunito.json", Enum.FontWeight.Heavy)
|
||
-- плашка-дымка (Frame) с текстом внутри; градиент только на плашке, на текст он не действует
|
||
local function softPlate(props, textProps)
|
||
local plate = new("Frame", props)
|
||
plate.BackgroundColor3 = BLACK
|
||
plate.BackgroundTransparency = 0
|
||
corner(30).Parent = plate
|
||
new("UIGradient", { Transparency = SOFT_EDGES, Parent = plate })
|
||
new("UIPadding", { PaddingLeft = UDim.new(0, 48), PaddingRight = UDim.new(0, 48), Parent = plate })
|
||
local d = { Size = UDim2.fromScale(0, 1), AutomaticSize = Enum.AutomaticSize.X, TextXAlignment = Enum.TextXAlignment.Center, Parent = plate }
|
||
for k, v in pairs(textProps) do
|
||
d[k] = v
|
||
end
|
||
local label = text(d)
|
||
label.FontFace = HINT_FONT
|
||
return plate, label
|
||
end
|
||
local function popIn(obj, from)
|
||
local sc = obj:FindFirstChildOfClass("UIScale") or new("UIScale", { Parent = obj })
|
||
sc.Scale = from or 0.4
|
||
TweenService:Create(sc, TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play()
|
||
end
|
||
local function wobble(obj, deg, period)
|
||
obj.Rotation = -deg
|
||
TweenService:Create(obj, TweenInfo.new(period, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true), { Rotation = deg }):Play()
|
||
end
|
||
|
||
-- уведомления — под подсказкой обучения, которая стоит в самом верху
|
||
local toasts = new("Frame", {
|
||
Size = UDim2.new(0, 900, 0, 200), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 84),
|
||
BackgroundTransparency = 1, Parent = gui,
|
||
}, { new("UIListLayout", { Padding = UDim.new(0, 6), HorizontalAlignment = Enum.HorizontalAlignment.Center, SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||
local toastOrder = 0
|
||
local toastTimers = {}
|
||
|
||
local function notify(msg, color)
|
||
-- такое же сообщение уже на экране — не дублируем, а продлеваем его
|
||
for _, c in ipairs(toasts:GetChildren()) do
|
||
if c:IsA("Frame") and c:GetAttribute("Msg") == msg then
|
||
toastTimers[c] = (toastTimers[c] or 0) + 1
|
||
local my = toastTimers[c]
|
||
task.delay(3.2, function()
|
||
if c.Parent and toastTimers[c] == my then
|
||
c:Destroy()
|
||
end
|
||
end)
|
||
return
|
||
end
|
||
end
|
||
toastOrder += 1
|
||
local items = {}
|
||
for _, c in ipairs(toasts:GetChildren()) do
|
||
if c:IsA("Frame") then
|
||
table.insert(items, c)
|
||
end
|
||
end
|
||
if #items >= 3 then
|
||
items[1]:Destroy()
|
||
end
|
||
local t, l = softPlate(
|
||
{ Size = UDim2.new(0, 0, 0, 54), AutomaticSize = Enum.AutomaticSize.X, LayoutOrder = toastOrder, Parent = toasts },
|
||
{ TextSize = 30, TextColor3 = color or WHITE, Text = msg }
|
||
)
|
||
popIn(t)
|
||
t:SetAttribute("Msg", msg)
|
||
toastTimers[t] = 0
|
||
task.delay(3.2, function()
|
||
if t.Parent and toastTimers[t] == 0 then
|
||
TweenService:Create(t, TweenInfo.new(0.4), { BackgroundTransparency = 1 }):Play()
|
||
TweenService:Create(l, TweenInfo.new(0.4), { TextTransparency = 1 }):Play()
|
||
task.wait(0.45)
|
||
t:Destroy()
|
||
end
|
||
end)
|
||
end
|
||
|
||
-- карточка пойманной рыбы
|
||
local catchCard = new("Frame", {
|
||
Size = UDim2.fromOffset(400, 128), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, -220),
|
||
BackgroundColor3 = WHITE, Visible = false, Parent = gui,
|
||
}, { corner(18) })
|
||
local catchStroke = stroke(WHITE, 3)
|
||
catchStroke.Parent = catchCard
|
||
local catchGrad = gradient(C.panel2, C.bg, 90)
|
||
catchGrad.Parent = catchCard
|
||
local catchView = new("Frame", { Size = UDim2.fromOffset(130, 108), Position = UDim2.fromOffset(10, 10), BackgroundColor3 = C.bg, BackgroundTransparency = 0.3, Parent = catchCard }, { corner(14) })
|
||
local catchHeader = text({ Size = UDim2.new(1, -160, 0, 20), Position = UDim2.fromOffset(152, 10), Font = TITLE, TextSize = 15, TextColor3 = C.muted, Text = "", Parent = catchCard })
|
||
local catchName = text({ Size = UDim2.new(1, -160, 0, 30), Position = UDim2.fromOffset(152, 30), Font = TITLE, TextSize = 26, Text = "", TextStrokeTransparency = 0.6, Parent = catchCard })
|
||
local catchInfo = text({ Size = UDim2.new(1, -160, 0, 20), Position = UDim2.fromOffset(152, 64), TextSize = 15, RichText = true, Text = "", Parent = catchCard })
|
||
local catchValue = text({ Size = UDim2.new(1, -160, 0, 26), Position = UDim2.fromOffset(152, 90), Font = TITLE, TextSize = 21, TextColor3 = C.gold, Text = "", Parent = catchCard })
|
||
local catchToken = 0
|
||
|
||
local function showCatch(fish, extra)
|
||
catchToken += 1
|
||
local my = catchToken
|
||
local r = Config.Rarities[fish.rarity]
|
||
local mut = fish.mutation and Config.Find(Config.Mutations, fish.mutation)
|
||
clear(catchView)
|
||
viewport(catchView, Models.buildFish(fish.id, fish.mutation, 1, true), FISH_VIEW, 0.75)
|
||
catchStroke.Color = mut and mut.color or r.color
|
||
catchGrad.Color = ColorSequence.new(r.color:Lerp(C.bg, 0.55), C.bg)
|
||
catchHeader.Text = extra and extra.new and "🆕 НОВЫЙ ВИД! Опыт x2" or (extra and extra.record and "🏆 НОВЫЙ РЕКОРД!" or "ПОЙМАНА РЫБА")
|
||
catchHeader.TextColor3 = (extra and (extra.new or extra.record)) and C.gold or C.muted
|
||
catchName.Text = fish.name
|
||
catchName.TextColor3 = r.color
|
||
catchInfo.Text = ("<font color=\"%s\">%s</font>%s · %.2f кг"):format(
|
||
hex(r.color), r.name, mut and (" · <font color=\"" .. hex(mut.color) .. "\">" .. mut.name .. " x" .. mut.mult .. "</font>") or "", fish.weight)
|
||
catchValue.Text = ("💰 %s ⭐ +%d XP%s"):format(fmt(fish.value), fish.xp * ((extra and extra.new) and 2 or 1),
|
||
(extra and extra.combo and extra.combo > 1.001) and (" 🔥 x%.1f"):format(extra.combo) or "")
|
||
catchCard.Visible = true
|
||
TweenService:Create(catchCard, TweenInfo.new(0.45, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Position = UDim2.new(0.5, 0, 0, 120) }):Play()
|
||
task.delay(3.4, function()
|
||
if my == catchToken then
|
||
local tw = TweenService:Create(catchCard, TweenInfo.new(0.35, Enum.EasingStyle.Quad, Enum.EasingDirection.In), { Position = UDim2.new(0.5, 0, 0, -220) })
|
||
tw:Play()
|
||
tw.Completed:Wait()
|
||
if my == catchToken then
|
||
catchCard.Visible = false
|
||
end
|
||
end
|
||
end)
|
||
end
|
||
|
||
local function floatText(msg, color)
|
||
local l = text({
|
||
Size = UDim2.fromOffset(400, 60), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.42),
|
||
Font = TITLE, TextSize = 46, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = color,
|
||
TextStrokeTransparency = 0.2, Text = msg, Parent = gui,
|
||
})
|
||
TweenService:Create(l, TweenInfo.new(1.4, Enum.EasingStyle.Quad), { Position = UDim2.fromScale(0.5, 0.3), TextTransparency = 1, TextStrokeTransparency = 1 }):Play()
|
||
task.delay(1.5, function()
|
||
l:Destroy()
|
||
end)
|
||
end
|
||
|
||
---------------------------------------------------------------- статус и мини-игра
|
||
|
||
-- вверху, на месте подсказки обучения (она во время рыбалки скрыта)
|
||
local statusLabel = softPlate(
|
||
{ Size = UDim2.fromOffset(0, 64), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 12), Visible = false, Parent = gui },
|
||
{ TextSize = 36, Text = "🎣 Ждём клёв…" }
|
||
)
|
||
wobble(statusLabel, 1.2, 1.4)
|
||
local mgFrame = new("Frame", {
|
||
Size = UDim2.fromOffset(480, 124), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -100),
|
||
BackgroundColor3 = WHITE, Visible = false, Parent = gui,
|
||
}, { corner(16), stroke(C.gold, 2.5, 0.1), gradient(C.panel2, C.bg, 90) })
|
||
text({
|
||
Size = UDim2.new(1, 0, 0, 30), Position = UDim2.fromOffset(0, 6), Font = TITLE, TextSize = 24,
|
||
TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, TextStrokeTransparency = 0.5,
|
||
Text = "❗ КЛЮЁТ! Кликай, когда метка в зелёной зоне", Parent = mgFrame,
|
||
})
|
||
local bar = new("Frame", { Size = UDim2.new(1, -30, 0, 36), Position = UDim2.fromOffset(15, 42), BackgroundColor3 = Color3.fromRGB(22, 28, 46), ClipsDescendants = true, Parent = mgFrame }, { corner(9), stroke(BLACK, 1.5, 0.4) })
|
||
local zoneF = new("Frame", { Size = UDim2.fromScale(0.25, 1), BackgroundColor3 = WHITE, BorderSizePixel = 0, Parent = bar }, { gradient(Color3.fromRGB(130, 245, 150), Color3.fromRGB(35, 165, 75), 90) })
|
||
local markerF = new("Frame", { Size = UDim2.new(0, 8, 1, 4), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0, 0.5), BackgroundColor3 = WHITE, ZIndex = 3, Parent = bar }, { corner(4), stroke(BLACK, 2) })
|
||
local pipsText = text({ Size = UDim2.new(0.5, -15, 0, 24), Position = UDim2.fromOffset(15, 84), Font = TITLE, TextSize = 19, RichText = true, Text = "", Parent = mgFrame })
|
||
local missText = text({ Size = UDim2.new(0.5, -15, 0, 24), Position = UDim2.new(0.5, 0, 0, 84), Font = TITLE, TextSize = 19, TextXAlignment = Enum.TextXAlignment.Right, RichText = true, Text = "", Parent = mgFrame })
|
||
local timeBar = new("Frame", { Size = UDim2.new(1, -30, 0, 5), Position = UDim2.fromOffset(15, 112), BackgroundColor3 = C.gold, BorderSizePixel = 0, Parent = mgFrame }, { corner(3) })
|
||
|
||
---------------------------------------------------------------- окна
|
||
|
||
local openWindow = nil
|
||
|
||
local function makeWindow(title, accent, tabs)
|
||
local w = { pages = {}, tabButtons = {}, current = nil }
|
||
local frame = new("Frame", {
|
||
Size = UDim2.fromScale(0.92, 0.82), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.53),
|
||
BackgroundColor3 = WHITE, Visible = false, Parent = gui,
|
||
}, { corner(20), stroke(accent, 3, 0.05), gradient(C.panel, C.bg, 90), new("UISizeConstraint", { MaxSize = Vector2.new(760, 540) }) })
|
||
local scale = new("UIScale", { Parent = frame })
|
||
local header = new("Frame", { Size = UDim2.new(1, 0, 0, 56), BackgroundColor3 = WHITE, Parent = frame }, { corner(20), gradient(accent, accent:Lerp(BLACK, 0.35), 90) })
|
||
new("Frame", { Size = UDim2.new(1, 0, 0, 20), Position = UDim2.new(0, 0, 1, -20), BackgroundColor3 = accent:Lerp(BLACK, 0.3), BorderSizePixel = 0, Parent = header })
|
||
text({ Size = UDim2.new(1, -80, 1, 0), Position = UDim2.fromOffset(20, 0), Font = TITLE, TextSize = 30, Text = title, TextStrokeTransparency = 0.5, ZIndex = 2, Parent = header })
|
||
btn({ Size = UDim2.fromOffset(42, 42), Position = UDim2.new(1, -52, 0, 7), BackgroundColor3 = C.red, Text = "✕", TextSize = 22, ZIndex = 3, Parent = header }, function()
|
||
w.close()
|
||
end)
|
||
local hasTabs = #tabs > 1
|
||
local tabBar = new("Frame", { Size = UDim2.new(1, -28, 0, 42), Position = UDim2.fromOffset(14, 66), BackgroundTransparency = 1, Visible = hasTabs, Parent = frame },
|
||
{ new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||
local top = hasTabs and 116 or 68
|
||
local body = new("Frame", { Size = UDim2.new(1, -28, 1, -(top + 12)), Position = UDim2.fromOffset(14, top), BackgroundTransparency = 1, Parent = frame })
|
||
w.frame = frame
|
||
|
||
function w.setTab(id)
|
||
w.current = id
|
||
for k, page in pairs(w.pages) do
|
||
page.Visible = (k == id)
|
||
end
|
||
for k, b in pairs(w.tabButtons) do
|
||
b.BackgroundColor3 = (k == id) and accent or C.panel2
|
||
end
|
||
if w.render then
|
||
w.render(id)
|
||
end
|
||
end
|
||
for i, t in ipairs(tabs) do
|
||
w.pages[t.id] = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, Visible = false, Parent = body })
|
||
w.tabButtons[t.id] = btn({ Size = UDim2.new(1 / #tabs, -8, 1, 0), Text = t.label, TextSize = 18, BackgroundColor3 = C.panel2, LayoutOrder = i, Parent = tabBar }, function()
|
||
w.setTab(t.id)
|
||
end)
|
||
end
|
||
function w.open(tab)
|
||
if openWindow and openWindow ~= w then
|
||
openWindow.close()
|
||
end
|
||
openWindow = w
|
||
if not frame.Visible then
|
||
Audio.play("open")
|
||
end
|
||
frame.Visible = true
|
||
scale.Scale = 0.85
|
||
TweenService:Create(scale, TweenInfo.new(0.25, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play()
|
||
w.setTab(tab or w.current or tabs[1].id)
|
||
end
|
||
function w.close()
|
||
frame.Visible = false
|
||
if openWindow == w then
|
||
openWindow = nil
|
||
end
|
||
end
|
||
function w.isOpen()
|
||
return frame.Visible
|
||
end
|
||
function w.toggle(tab)
|
||
if frame.Visible and (tab == nil or w.current == tab) then
|
||
w.close()
|
||
else
|
||
w.open(tab)
|
||
end
|
||
end
|
||
function w.refresh()
|
||
if frame.Visible and w.render then
|
||
w.render(w.current)
|
||
end
|
||
end
|
||
return w
|
||
end
|
||
|
||
local function scrollArea(parent, cell, topOffset)
|
||
local sf = new("ScrollingFrame", {
|
||
Size = UDim2.new(1, 0, 1, -(topOffset or 0)), Position = UDim2.fromOffset(0, topOffset or 0),
|
||
BackgroundTransparency = 1, BorderSizePixel = 0, ScrollBarThickness = 6, ScrollBarImageColor3 = C.muted,
|
||
AutomaticCanvasSize = Enum.AutomaticSize.Y, CanvasSize = UDim2.new(), Parent = parent,
|
||
}, { new("UIPadding", { PaddingRight = UDim.new(0, 10), PaddingTop = UDim.new(0, 4), PaddingLeft = UDim.new(0, 2), PaddingBottom = UDim.new(0, 8) }) })
|
||
if cell then
|
||
new("UIGridLayout", { CellSize = cell, CellPadding = UDim2.fromOffset(10, 10), SortOrder = Enum.SortOrder.LayoutOrder, Parent = sf })
|
||
else
|
||
new("UIListLayout", { Padding = UDim.new(0, 10), SortOrder = Enum.SortOrder.LayoutOrder, Parent = sf })
|
||
end
|
||
return sf
|
||
end
|
||
|
||
local function itemRow(parent, order, o)
|
||
local row = new("Frame", { Size = UDim2.new(1, -4, 0, 100), BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent },
|
||
{ corner(14), stroke(o.strokeColor or C.line, 2, o.strokeColor and 0 or 0.45), gradient(C.panel2, C.panel, 90) })
|
||
local view = new("Frame", { Size = UDim2.fromOffset(124, 84), Position = UDim2.fromOffset(8, 8), BackgroundColor3 = o.iconBg or C.bg, Parent = row }, { corner(10) })
|
||
if o.model then
|
||
viewport(view, o.model, o.dir, o.zoom)
|
||
elseif o.icon then
|
||
text({ Size = UDim2.fromScale(1, 1), TextSize = 48, TextXAlignment = Enum.TextXAlignment.Center, Text = o.icon, Parent = view })
|
||
end
|
||
text({ Size = UDim2.new(1, -300, 0, 28), Position = UDim2.fromOffset(144, 8), Font = TITLE, TextSize = 22, Text = o.title, TextColor3 = o.titleColor or C.text, RichText = true, TextTruncate = Enum.TextTruncate.AtEnd, Parent = row })
|
||
text({
|
||
Size = UDim2.new(1, -300, 0, 56), Position = UDim2.fromOffset(144, 38), Font = BODY2, TextSize = 14, TextColor3 = C.muted,
|
||
RichText = true, TextWrapped = true, TextYAlignment = Enum.TextYAlignment.Top, Text = o.lines, Parent = row,
|
||
})
|
||
btn({
|
||
Size = UDim2.fromOffset(140, 50), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 0),
|
||
Text = o.buttonText, BackgroundColor3 = o.buttonColor, AutoButtonColor = o.active, TextSize = 19, Parent = row,
|
||
}, o.active and o.onClick or nil)
|
||
return row
|
||
end
|
||
|
||
local function progressBar(parent, pos, size, frac, color)
|
||
local back = new("Frame", { Size = size, Position = pos, BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = parent }, { corner(7) })
|
||
new("Frame", { Size = UDim2.fromScale(math.clamp(frac, 0, 1), 1), BackgroundColor3 = color, Parent = back }, { corner(7) })
|
||
return back
|
||
end
|
||
|
||
---------------------------------------------------------------- данные с сервера
|
||
|
||
local inventory, discovered, claimed = {}, {}, {}
|
||
local chain, daily = nil, { available = false, streak = 0, nextStreak = 1 }
|
||
|
||
---------------------------------------------------------------- магазин
|
||
|
||
local shopWin = makeWindow("🎣 Магазин Михалыча", Color3.fromRGB(215, 120, 40), {
|
||
{ id = "rods", label = "🎣 Удочки" },
|
||
{ id = "upgrade", label = "✨ Улучшение" },
|
||
{ id = "bags", label = "🎒 Сумки" },
|
||
{ id = "luck", label = "🍀 Удача" },
|
||
})
|
||
local shopLists = {
|
||
rods = scrollArea(shopWin.pages.rods),
|
||
upgrade = scrollArea(shopWin.pages.upgrade),
|
||
bags = scrollArea(shopWin.pages.bags),
|
||
luck = scrollArea(shopWin.pages.luck),
|
||
}
|
||
|
||
local function statLine(s)
|
||
return ("🍀 Удача <b>+%d%%</b> ⏱ Клёв <b>x%.2f</b> 🎯 Зона <b>%d%%</b>"):format(math.floor(s.luck * 100 + 0.5), s.speed, math.floor(s.zone * 100 + 0.5))
|
||
end
|
||
local function buyButton(price, level, myLevel, coins)
|
||
if myLevel < level then
|
||
return "🔒 Ур. " .. level, C.grey, false
|
||
end
|
||
return "💰 " .. fmt(price), coins >= price and C.green or Color3.fromRGB(150, 95, 60), true
|
||
end
|
||
|
||
shopWin.render = function(tab)
|
||
local list = shopLists[tab]
|
||
if not list then
|
||
return
|
||
end
|
||
clear(list)
|
||
local myLevel = player:GetAttribute("Level") or 1
|
||
local coins = player:GetAttribute("Coins") or 0
|
||
local levels = rodLevels()
|
||
|
||
if tab == "rods" then
|
||
local owned = attrSet("OwnedRods")
|
||
for i, rod in ipairs(Config.Rods) do
|
||
local lv = levels[rod.id] or 0
|
||
local equipped = player:GetAttribute("Rod") == rod.id
|
||
local bText, bColor, active
|
||
if equipped then
|
||
bText, bColor, active = "Надето ✓", C.grey, false
|
||
elseif owned[rod.id] then
|
||
bText, bColor, active = "Надеть", C.blue, true
|
||
else
|
||
bText, bColor, active = buyButton(rod.price, rod.level, myLevel, coins)
|
||
end
|
||
itemRow(list, i, {
|
||
model = Models.buildRod(rod.id, lv, true), dir = ROD_VIEW, zoom = 0.6,
|
||
title = rod.name .. (owned[rod.id] and (" <font color=\"#FFD45A\">" .. stars(lv) .. "</font>") or ""),
|
||
lines = statLine(Config.RodStats(rod.id, lv)) .. "\n" .. (owned[rod.id] and "Куплена" or ("Нужен уровень " .. rod.level)),
|
||
strokeColor = equipped and C.gold or nil,
|
||
buttonText = bText, buttonColor = bColor, active = active,
|
||
onClick = function()
|
||
remote:FireServer("Buy", "Rod", rod.id)
|
||
end,
|
||
})
|
||
end
|
||
elseif tab == "upgrade" then
|
||
text({
|
||
Size = UDim2.new(1, -4, 0, 40), LayoutOrder = 0, TextSize = 14, Font = BODY2, TextColor3 = C.muted, TextWrapped = true,
|
||
Text = "Каждое улучшение даёт +" .. math.floor(Config.RodUpgrade.luckPerLevel * 100) .. "% удачи, ускоряет клёв и расширяет зелёную зону. Максимум — " .. stars(Config.RodUpgrade.maxLevel),
|
||
Parent = list,
|
||
})
|
||
local owned = attrSet("OwnedRods")
|
||
local order = 0
|
||
for _, rod in ipairs(Config.Rods) do
|
||
if owned[rod.id] then
|
||
order += 1
|
||
local lv = levels[rod.id] or 0
|
||
local now = Config.RodStats(rod.id, lv)
|
||
local maxed = lv >= Config.RodUpgrade.maxLevel
|
||
local lines
|
||
if maxed then
|
||
lines = statLine(now) .. "\n<font color=\"#FFD45A\">Максимальное улучшение!</font>"
|
||
else
|
||
local nxt = Config.RodStats(rod.id, lv + 1)
|
||
lines = ("🍀 +%d%% → <font color=\"#7CFF9A\"><b>+%d%%</b></font> ⏱ x%.2f → <font color=\"#7CFF9A\"><b>x%.2f</b></font>\n🎯 %d%% → <font color=\"#7CFF9A\"><b>%d%%</b></font>"):format(
|
||
math.floor(now.luck * 100 + 0.5), math.floor(nxt.luck * 100 + 0.5), now.speed, nxt.speed,
|
||
math.floor(now.zone * 100 + 0.5), math.floor(nxt.zone * 100 + 0.5))
|
||
end
|
||
local cost = Config.UpgradeCost(rod, lv)
|
||
itemRow(list, order, {
|
||
model = Models.buildRod(rod.id, lv, true), dir = ROD_VIEW, zoom = 0.6,
|
||
title = rod.name .. " <font color=\"#FFD45A\">" .. stars(lv) .. "</font>",
|
||
lines = lines,
|
||
strokeColor = player:GetAttribute("Rod") == rod.id and C.gold or nil,
|
||
buttonText = maxed and "MAX ★" or ("✨ " .. fmt(cost)),
|
||
buttonColor = maxed and C.grey or (coins >= cost and Color3.fromRGB(190, 120, 255) or Color3.fromRGB(110, 80, 140)),
|
||
active = not maxed,
|
||
onClick = function()
|
||
remote:FireServer("Buy", "Upgrade", rod.id)
|
||
end,
|
||
})
|
||
end
|
||
end
|
||
elseif tab == "bags" then
|
||
local owned = attrSet("OwnedBags")
|
||
local bonus = attrSet("Passes").BigBag and 100 or 0
|
||
for i, bag in ipairs(Config.Bags) do
|
||
local equipped = player:GetAttribute("Bag") == bag.id
|
||
local bText, bColor, active
|
||
if equipped then
|
||
bText, bColor, active = "Надето ✓", C.grey, false
|
||
elseif owned[bag.id] then
|
||
bText, bColor, active = "Надеть", C.blue, true
|
||
else
|
||
bText, bColor, active = buyButton(bag.price, bag.level, myLevel, coins)
|
||
end
|
||
itemRow(list, i, {
|
||
model = Models.buildBag(bag.id, true), dir = BAG_VIEW, zoom = 0.8,
|
||
title = bag.name,
|
||
lines = ("🎒 Вмещает <b>%d</b> рыб%s\n%s"):format(bag.capacity + bonus, bonus > 0 and " (с пропуском)" or "", owned[bag.id] and "Куплена" or ("Нужен уровень " .. bag.level)),
|
||
strokeColor = equipped and C.gold or nil,
|
||
buttonText = bText, buttonColor = bColor, active = active,
|
||
onClick = function()
|
||
remote:FireServer("Buy", "Bag", bag.id)
|
||
end,
|
||
})
|
||
end
|
||
elseif tab == "luck" then
|
||
local lv = levels[player:GetAttribute("Rod") or "Basic"] or 0
|
||
local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic") or Config.Rods[1]
|
||
local boost = player:GetAttribute("BoostBonus") or 0
|
||
local total = player:GetAttribute("Luck") or 100
|
||
local ps = attrSet("Passes")
|
||
local evId = workspace:GetAttribute("Event")
|
||
local event = evId and Config.Find(Config.Events, evId)
|
||
local mutLine = {}
|
||
for _, m in ipairs(Config.Mutations) do
|
||
table.insert(mutLine, ("<font color=\"%s\">%s %.1f%%</font>"):format(hex(m.color), m.name, math.min(100, m.chance * total / 100 * ((event and event.mutation) or 1) * 100)))
|
||
end
|
||
local lines = {
|
||
("<font size=\"24\" face=\"FredokaOne\" color=\"#7CFF9A\">🍀 Твоя удача: %d%%</font>"):format(total),
|
||
("Базовая 100%% · 🎣 Удочка +%d%% · ✨ Улучшения +%d%%"):format(math.floor(rod.luck * 100 + 0.5), math.floor(lv * Config.RodUpgrade.luckPerLevel * 100 + 0.5)),
|
||
("⭐ Уровень +%d%% · 🏆 Мастерство миров +%d%%"):format(math.floor(((player:GetAttribute("Level") or 1) - 1) * Config.LuckPerPlayerLevel * 100 + 0.5), math.floor((player:GetAttribute("Mastery") or 0) * Config.MasteryLuck * 100 + 0.5)),
|
||
("🧪 Зелье +%d%%%s · 👑 Пропуска +%d%%%s"):format(math.floor(boost * 100 + 0.5), boost > 0 and (" (" .. timeStr(player:GetAttribute("BoostLeft") or 0) .. ")") or "",
|
||
(ps.VIP and 25 or 0) + (ps.LuckyCharm and 50 or 0), (event and event.luck) and (" · 🎉 Событие +" .. event.luck * 100 .. "%") or ""),
|
||
"Шанс мутаций: " .. table.concat(mutLine, " · "),
|
||
}
|
||
local info = new("Frame", { Size = UDim2.new(1, -4, 0, 160), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = list },
|
||
{ corner(14), stroke(Color3.fromRGB(90, 220, 120), 2, 0.2), gradient(Color3.fromRGB(35, 70, 55), C.panel, 90), new("UIPadding", { PaddingLeft = UDim.new(0, 16), PaddingTop = UDim.new(0, 10), PaddingRight = UDim.new(0, 16) }) })
|
||
text({ Size = UDim2.fromScale(1, 1), TextSize = 15, RichText = true, TextYAlignment = Enum.TextYAlignment.Top, TextWrapped = true, Text = table.concat(lines, "\n"), Parent = info })
|
||
for i, p in ipairs(Config.Potions) do
|
||
local bText, bColor, active = buyButton(p.price, p.level or 1, myLevel, coins)
|
||
itemRow(list, i, {
|
||
icon = "🧪", iconBg = p.color:Lerp(C.bg, 0.6),
|
||
title = p.name, titleColor = p.color,
|
||
lines = ("Удача <b>+%d%%</b> на <b>%d мин</b>.\nРедкая рыба и мутации попадаются чаще!"):format(p.bonus * 100, p.duration / 60),
|
||
buttonText = bText, buttonColor = bColor, active = active,
|
||
onClick = function()
|
||
remote:FireServer("Buy", "Potion", p.id)
|
||
end,
|
||
})
|
||
end
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- сумка и коллекция
|
||
|
||
local bagWin = makeWindow("🎒 Сумка", Color3.fromRGB(60, 140, 220), {
|
||
{ id = "fish", label = "🐟 Улов" },
|
||
{ id = "dex", label = "📖 Коллекция" },
|
||
})
|
||
|
||
local fishHeader = new("Frame", { Size = UDim2.new(1, 0, 0, 50), BackgroundColor3 = WHITE, Parent = bagWin.pages.fish }, { corner(12), gradient(C.panel2, C.panel, 90) })
|
||
local fishSummary = text({ Size = UDim2.new(1, -200, 1, 0), Position = UDim2.fromOffset(14, 0), Font = TITLE, TextSize = 19, RichText = true, Text = "", Parent = fishHeader })
|
||
btn({ Size = UDim2.fromOffset(170, 38), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0), BackgroundColor3 = C.green, Text = "💰 Продать всё", TextSize = 18, Parent = fishHeader }, function()
|
||
remote:FireServer("SellAll")
|
||
end)
|
||
local fishGrid = scrollArea(bagWin.pages.fish, UDim2.fromOffset(132, 176), 60)
|
||
|
||
local dexWorld = "World1"
|
||
local dexTabs = new("Frame", { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1, Parent = bagWin.pages.dex },
|
||
{ new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, Padding = UDim.new(0, 8) }) })
|
||
local dexList = scrollArea(bagWin.pages.dex, nil, 46)
|
||
local dexTabButtons = {}
|
||
|
||
local function fishCard(parent, order, rarityColor, strokeColor)
|
||
return new("Frame", { BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent },
|
||
{ corner(14), stroke(strokeColor or rarityColor, 2.5, 0.05), gradient(rarityColor:Lerp(C.bg, 0.55), C.panel, 90) })
|
||
end
|
||
|
||
local function rewardButton(parent, state, label, onClick)
|
||
local color = (state == "ready") and C.green or C.grey
|
||
return btn({
|
||
Size = UDim2.fromOffset(150, 34), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0),
|
||
BackgroundColor3 = color, AutoButtonColor = state == "ready", Text = label, TextSize = 16, Parent = parent,
|
||
}, state == "ready" and onClick or nil)
|
||
end
|
||
|
||
local function renderDex()
|
||
clear(dexList)
|
||
for id, b in pairs(dexTabButtons) do
|
||
b.BackgroundColor3 = (id == dexWorld) and C.purple or C.panel2
|
||
end
|
||
local world = Config.Find(Config.Worlds, dexWorld)
|
||
local all = Config.Zones[dexWorld].fish
|
||
local found = 0
|
||
for _, f in ipairs(all) do
|
||
if discovered[f.id] then
|
||
found += 1
|
||
end
|
||
end
|
||
|
||
-- мастерство мира
|
||
local head = new("Frame", { Size = UDim2.new(1, -4, 0, 56), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = dexList },
|
||
{ corner(12), stroke(C.gold, 2, 0.3), gradient(Color3.fromRGB(70, 55, 20), C.panel, 90) })
|
||
text({
|
||
Size = UDim2.new(1, -180, 1, 0), Position = UDim2.fromOffset(14, 0), Font = TITLE, TextSize = 17, RichText = true, TextWrapped = true,
|
||
Text = ("%s %s — <font color=\"#FFD45A\">%d / %d</font>\n<font size=\"13\" color=\"#AAB4CD\">Собери всех: +%s 💰 и +%d%% удачи навсегда</font>"):format(
|
||
world.icon, world.name, found, #all, fmt(Config.MasteryCoins * world.mult), math.floor(Config.MasteryLuck * 100 + 0.5)),
|
||
Parent = head,
|
||
})
|
||
local mKey = dexWorld .. ":Master"
|
||
rewardButton(head, claimed[mKey] and "done" or (found == #all and "ready" or "locked"),
|
||
claimed[mKey] and "Получено ✓" or (found == #all and "🏆 Забрать" or "🔒 Не собрано"), function()
|
||
remote:FireServer("ClaimCollection", dexWorld, "Master")
|
||
end)
|
||
|
||
for ri, rarity in ipairs(Config.RarityOrder) do
|
||
local group = {}
|
||
for _, f in ipairs(all) do
|
||
if f.rarity == rarity then
|
||
table.insert(group, f)
|
||
end
|
||
end
|
||
if #group > 0 then
|
||
local r = Config.Rarities[rarity]
|
||
local have = 0
|
||
for _, f in ipairs(group) do
|
||
if discovered[f.id] then
|
||
have += 1
|
||
end
|
||
end
|
||
local section = new("Frame", { Size = UDim2.new(1, -4, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, LayoutOrder = ri, Parent = dexList },
|
||
{ new("UIListLayout", { Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||
local hdr = new("Frame", { Size = UDim2.new(1, 0, 0, 44), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = section },
|
||
{ corner(10), gradient(r.color:Lerp(C.bg, 0.5), C.panel, 0) })
|
||
local reward = Config.CollectionRewards[rarity]
|
||
text({
|
||
Size = UDim2.new(1, -180, 1, 0), Position = UDim2.fromOffset(12, 0), Font = TITLE, TextSize = 17, RichText = true,
|
||
Text = ("<font color=\"%s\">%s</font> %d/%d <font size=\"13\" color=\"#AAB4CD\">+%s 💰 +%s XP</font>"):format(
|
||
hex(r.color), r.name, have, #group, fmt(reward.coins * world.mult), fmt(reward.xp * world.mult)),
|
||
Parent = hdr,
|
||
})
|
||
local key = dexWorld .. ":" .. rarity
|
||
rewardButton(hdr, claimed[key] and "done" or (have == #group and "ready" or "locked"),
|
||
claimed[key] and "Получено ✓" or (have == #group and "🎁 Забрать" or ("🔒 " .. have .. "/" .. #group)), function()
|
||
remote:FireServer("ClaimCollection", dexWorld, rarity)
|
||
end)
|
||
local grid = new("Frame", { Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, LayoutOrder = 1, Parent = section },
|
||
{ new("UIGridLayout", { CellSize = UDim2.fromOffset(124, 150), CellPadding = UDim2.fromOffset(8, 8), SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||
for i, f in ipairs(group) do
|
||
local rec = discovered[f.id]
|
||
local card = fishCard(grid, i, rec and r.color or C.grey)
|
||
local view = new("Frame", { Size = UDim2.new(1, -12, 0, 76), Position = UDim2.fromOffset(6, 6), BackgroundTransparency = 1, Parent = card })
|
||
local model = Models.buildFish(f.id, nil, 1, true)
|
||
viewport(view, rec and model or silhouette(model), FISH_VIEW, 0.72)
|
||
text({ Size = UDim2.new(1, -10, 0, 20), Position = UDim2.fromOffset(6, 84), Font = TITLE, TextSize = 15, TextColor3 = rec and r.color or C.muted, Text = rec and f.name or "???", TextTruncate = Enum.TextTruncate.AtEnd, Parent = card })
|
||
text({
|
||
Size = UDim2.new(1, -10, 0, 40), Position = UDim2.fromOffset(6, 104), Font = BODY2, TextSize = 12, TextColor3 = C.muted, TextWrapped = true,
|
||
TextYAlignment = Enum.TextYAlignment.Top,
|
||
Text = rec and ("Поймано: %d\nРекорд: %.2f кг"):format(rec.count, rec.best) or "Ещё не поймана", Parent = card,
|
||
})
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
for i, w in ipairs(Config.Worlds) do
|
||
if not w.soon then
|
||
dexTabButtons[w.id] = btn({ Size = UDim2.new(0, 170, 1, 0), Text = w.icon .. " " .. w.name, TextSize = 15, BackgroundColor3 = C.panel2, LayoutOrder = i, Parent = dexTabs }, function()
|
||
dexWorld = w.id
|
||
renderDex()
|
||
end)
|
||
end
|
||
end
|
||
|
||
bagWin.render = function(tab)
|
||
if tab == "fish" then
|
||
clear(fishGrid)
|
||
local total = 0
|
||
for _, it in ipairs(inventory) do
|
||
total += it.value
|
||
end
|
||
fishSummary.Text = ("🐟 %d / %d · <font color=\"#FFD45A\">💰 ≈%s</font>"):format(#inventory, player:GetAttribute("BagCap") or 0, fmt(player:GetAttribute("BagValue") or total))
|
||
if #inventory == 0 then
|
||
text({ Size = UDim2.fromOffset(400, 60), Font = TITLE, TextSize = 20, TextColor3 = C.muted, TextWrapped = true, Text = "Сумка пуста. Иди к воде и поймай рыбу! 🎣", Parent = fishGrid })
|
||
return
|
||
end
|
||
local sorted = table.clone(inventory)
|
||
table.sort(sorted, function(a, b)
|
||
return a.value > b.value
|
||
end)
|
||
for i, it in ipairs(sorted) do
|
||
local r = Config.Rarities[it.rarity] or Config.Rarities.Common
|
||
local mut = it.mutation and Config.Find(Config.Mutations, it.mutation)
|
||
local card = fishCard(fishGrid, i, r.color, mut and mut.color)
|
||
local view = new("Frame", { Size = UDim2.new(1, -12, 0, 84), Position = UDim2.fromOffset(6, 6), BackgroundTransparency = 1, Parent = card })
|
||
viewport(view, Models.buildFish(it.id, it.mutation, 1, true), FISH_VIEW, 0.72)
|
||
if mut then
|
||
local tag = new("Frame", { Size = UDim2.fromOffset(0, 20), AutomaticSize = Enum.AutomaticSize.X, Position = UDim2.fromOffset(6, 6), BackgroundColor3 = mut.color, ZIndex = 3, Parent = card },
|
||
{ corner(6), new("UIPadding", { PaddingLeft = UDim.new(0, 6), PaddingRight = UDim.new(0, 6) }) })
|
||
text({ Size = UDim2.new(0, 0, 1, 0), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 13, TextColor3 = C.bg, Text = mut.name, ZIndex = 4, Parent = tag })
|
||
end
|
||
text({ Size = UDim2.new(1, -10, 0, 20), Position = UDim2.fromOffset(6, 92), Font = TITLE, TextSize = 16, TextColor3 = r.color, Text = it.name, TextTruncate = Enum.TextTruncate.AtEnd, Parent = card })
|
||
text({ Size = UDim2.new(1, -10, 0, 16), Position = UDim2.fromOffset(6, 112), Font = BODY2, TextSize = 13, TextColor3 = C.muted, Text = ("%.2f кг · %s"):format(it.weight, r.name), Parent = card })
|
||
btn({ Size = UDim2.new(1, -12, 0, 32), Position = UDim2.fromOffset(6, 136), BackgroundColor3 = C.green, Text = "💰 " .. fmt(it.value), TextSize = 17, Parent = card }, function()
|
||
remote:FireServer("SellOne", it.uid)
|
||
end)
|
||
end
|
||
elseif tab == "dex" then
|
||
renderDex()
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- миры
|
||
|
||
local worldsWin = makeWindow("🌍 Миры", Color3.fromRGB(40, 160, 200), { { id = "list", label = "Миры" } })
|
||
local worldsList = scrollArea(worldsWin.pages.list)
|
||
|
||
local function currentWorld()
|
||
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||
return hrp and Config.WorldAt(hrp.Position)
|
||
end
|
||
|
||
worldsWin.render = function()
|
||
clear(worldsList)
|
||
local myLevel = player:GetAttribute("Level") or 1
|
||
local here = currentWorld()
|
||
itemRow(worldsList, 0, {
|
||
icon = "🏠", iconBg = Color3.fromRGB(90, 70, 30),
|
||
title = "Лобби", titleColor = C.gold,
|
||
lines = "Магазин удочек, скупка, донат-лавки и ежедневный сундук.",
|
||
buttonText = here == nil and "Вы здесь" or "🌀 Телепорт", buttonColor = here == nil and C.grey or C.blue, active = here ~= nil,
|
||
onClick = function()
|
||
remote:FireServer("Teleport", "Lobby")
|
||
worldsWin.close()
|
||
end,
|
||
})
|
||
for i, w in ipairs(Config.Worlds) do
|
||
local zone = Config.Zones[w.id]
|
||
local total, found = 0, 0
|
||
if zone then
|
||
for _, f in ipairs(zone.fish) do
|
||
total += 1
|
||
if discovered[f.id] then
|
||
found += 1
|
||
end
|
||
end
|
||
end
|
||
local bText, bColor, active
|
||
if w.soon then
|
||
bText, bColor, active = "Скоро…", C.grey, false
|
||
elseif myLevel < w.level then
|
||
bText, bColor, active = "🔒 Ур. " .. w.level, C.grey, false
|
||
elseif here and here.id == w.id then
|
||
bText, bColor, active = "Вы здесь", C.grey, false
|
||
else
|
||
bText, bColor, active = "🌀 Телепорт", C.blue, true
|
||
end
|
||
itemRow(worldsList, i, {
|
||
icon = w.icon, iconBg = w.color:Lerp(C.bg, 0.6),
|
||
title = w.name, titleColor = w.color,
|
||
lines = w.desc .. "\n" .. (w.soon and "В разработке" or ("Уровень: %d · Рыб поймано: %d / %d · Награды x%d"):format(w.level, found, total, w.mult)),
|
||
strokeColor = (here and here.id == w.id) and C.gold or nil,
|
||
buttonText = bText, buttonColor = bColor, active = active,
|
||
onClick = function()
|
||
remote:FireServer("Teleport", w.id)
|
||
worldsWin.close()
|
||
end,
|
||
})
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- задания и ежедневная награда
|
||
|
||
local questWin = makeWindow("📜 Задания", Color3.fromRGB(200, 140, 40), {
|
||
{ id = "quests", label = "📜 Задания" },
|
||
{ id = "daily", label = "🎁 Ежедневно" },
|
||
})
|
||
local questList = scrollArea(questWin.pages.quests)
|
||
local dailyPage = questWin.pages.daily
|
||
|
||
local function questText(kind, goal)
|
||
local t = Config.QuestKinds[kind]
|
||
if not t then
|
||
return kind
|
||
end
|
||
if t.forms then
|
||
local m10, m100 = goal % 10, goal % 100
|
||
local i = (m10 == 1 and m100 ~= 11) and 1 or ((m10 >= 2 and m10 <= 4 and (m100 < 12 or m100 > 14)) and 2 or 3)
|
||
return t.text:format(goal, t.forms[i])
|
||
end
|
||
return string.find(t.text, "%%d") and t.text:format(goal) or t.text
|
||
end
|
||
|
||
questWin.render = function(tab)
|
||
if tab == "quests" then
|
||
clear(questList)
|
||
if not chain then
|
||
return
|
||
end
|
||
text({
|
||
Size = UDim2.new(1, -4, 0, 30), LayoutOrder = 0, Font = TITLE, TextSize = 22, RichText = true,
|
||
Text = ("%s <font color=\"#AAB4CD\" size=\"15\">круг %d · награда сразу, следующее задание — тоже</font>"):format(chain.name, chain.round), Parent = questList,
|
||
})
|
||
for i, st in ipairs(chain.steps) do
|
||
local done, cur = i < chain.step, i == chain.step
|
||
local row = new("Frame", { Size = UDim2.new(1, -4, 0, cur and 84 or 56), BackgroundColor3 = WHITE, LayoutOrder = i, Parent = questList },
|
||
{ corner(14), stroke(cur and C.gold or (done and C.green or C.line), cur and 3 or 2, (cur or done) and 0 or 0.5), gradient(cur and Color3.fromRGB(70, 60, 30) or C.panel2, C.panel, 90) })
|
||
text({
|
||
Size = UDim2.new(1, -200, 0, 28), Position = UDim2.fromOffset(16, cur and 8 or 14), Font = TITLE, TextSize = 19,
|
||
TextColor3 = (done or cur) and C.text or C.muted, Text = (done and "✅ " or (cur and "▶ " or "🔒 ")) .. questText(st.kind, st.goal),
|
||
TextTruncate = Enum.TextTruncate.AtEnd, Parent = row,
|
||
})
|
||
text({
|
||
Size = UDim2.fromOffset(180, 28), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -14, 0, cur and 8 or 14), Font = TITLE, TextSize = 17,
|
||
TextXAlignment = Enum.TextXAlignment.Right, TextColor3 = done and C.muted or C.gold, Text = ("+%s 💰 +%s XP"):format(fmt(st.coins), fmt(st.xp)), Parent = row,
|
||
})
|
||
if cur then
|
||
progressBar(row, UDim2.fromOffset(16, 44), UDim2.new(1, -110, 0, 16), chain.progress / st.goal, C.gold)
|
||
text({ Size = UDim2.fromOffset(80, 20), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -14, 0, 42), Font = TITLE, TextSize = 16,
|
||
TextXAlignment = Enum.TextXAlignment.Right, Text = ("%s / %s"):format(fmt(chain.progress), fmt(st.goal)), Parent = row })
|
||
end
|
||
end
|
||
local b = chain.bonus
|
||
local row = new("Frame", { Size = UDim2.new(1, -4, 0, 56), BackgroundColor3 = WHITE, LayoutOrder = 100, Parent = questList },
|
||
{ corner(14), stroke(C.purple, 2, 0.2), gradient(Color3.fromRGB(70, 40, 100), C.panel, 90) })
|
||
text({
|
||
Size = UDim2.new(1, -32, 1, 0), Position = UDim2.fromOffset(16, 0), Font = TITLE, TextSize = 18, RichText = true,
|
||
Text = ("🎁 За всю цепочку: <font color=\"#FFD45A\">+%s 💰 +%s XP</font>%s"):format(fmt(b.coins), fmt(b.xp), b.potion and (" + " .. b.potion) or ""), Parent = row,
|
||
})
|
||
elseif tab == "daily" then
|
||
clear(dailyPage)
|
||
local myLevel = player:GetAttribute("Level") or 1
|
||
text({
|
||
Size = UDim2.new(1, 0, 0, 30), Font = TITLE, TextSize = 20, RichText = true,
|
||
Text = ("🔥 Серия: <font color=\"#FFD45A\">%d</font> дн. Заходи каждый день — награда растёт!"):format(daily.streak), Parent = dailyPage,
|
||
})
|
||
local row = new("Frame", { Size = UDim2.new(1, 0, 0, 150), Position = UDim2.fromOffset(0, 40), BackgroundTransparency = 1, Parent = dailyPage },
|
||
{ new("UIGridLayout", { CellSize = UDim2.new(1 / 7, -8, 1, 0), CellPadding = UDim2.fromOffset(8, 0) }) })
|
||
for d, r in ipairs(Config.DailyRewards) do
|
||
local isNext = d == daily.nextStreak and daily.available
|
||
local passed = d <= daily.streak and not (daily.available and daily.nextStreak == 1)
|
||
local cell = new("Frame", { BackgroundColor3 = WHITE, Parent = row },
|
||
{ corner(12), stroke(isNext and C.gold or C.line, isNext and 3 or 2, isNext and 0 or 0.4), gradient(isNext and Color3.fromRGB(90, 70, 20) or C.panel2, C.panel, 90) })
|
||
text({ Size = UDim2.new(1, 0, 0, 24), Position = UDim2.fromOffset(0, 6), Font = TITLE, TextSize = 15, TextXAlignment = Enum.TextXAlignment.Center, Text = "День " .. d, Parent = cell })
|
||
text({ Size = UDim2.new(1, 0, 0, 44), Position = UDim2.fromOffset(0, 32), TextSize = 32, TextXAlignment = Enum.TextXAlignment.Center, Text = passed and "✅" or (r.potion and "🧪" or "💰"), Parent = cell })
|
||
text({
|
||
Size = UDim2.new(1, -6, 0, 50), Position = UDim2.fromOffset(3, 80), Font = BODY2, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, TextWrapped = true, TextColor3 = C.gold,
|
||
Text = fmt(r.coins * (1 + (myLevel - 1) * 0.2)) .. " 💰" .. (r.potion and "\n+ зелье" or ""), Parent = cell,
|
||
})
|
||
end
|
||
btn({
|
||
Size = UDim2.fromOffset(260, 54), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 210),
|
||
BackgroundColor3 = daily.available and C.green or C.grey, AutoButtonColor = daily.available,
|
||
Text = daily.available and "🎁 Забрать награду" or "Приходи завтра!", TextSize = 22, Parent = dailyPage,
|
||
}, daily.available and function()
|
||
remote:FireServer("ClaimDaily")
|
||
end or nil)
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- донат
|
||
|
||
local robuxWin = makeWindow("💎 Премиум", Color3.fromRGB(150, 80, 210), {
|
||
{ id = "passes", label = "👑 Пропуска" },
|
||
{ id = "products", label = "🪙 Наборы" },
|
||
})
|
||
local robuxLists = { passes = scrollArea(robuxWin.pages.passes), products = scrollArea(robuxWin.pages.products) }
|
||
|
||
robuxWin.render = function(tab)
|
||
local list = robuxLists[tab]
|
||
clear(list)
|
||
local owned = attrSet("Passes")
|
||
local items = tab == "passes" and Config.GamePasses or Config.Products
|
||
for i, it in ipairs(items) do
|
||
local has = tab == "passes" and owned[it.key]
|
||
itemRow(list, i, {
|
||
icon = it.icon, iconBg = Color3.fromRGB(70, 40, 100),
|
||
title = it.name, titleColor = C.gold,
|
||
lines = it.desc .. (tab == "passes" and "\nДействует навсегда" or ""),
|
||
strokeColor = has and C.gold or nil,
|
||
buttonText = has and "Куплено ✓" or ("R$ " .. it.robux), buttonColor = has and C.grey or C.green, active = not has,
|
||
onClick = function()
|
||
if not it.id or it.id == 0 then
|
||
notify("⚙ Товар не настроен", Color3.fromRGB(255, 200, 120))
|
||
return
|
||
end
|
||
if tab == "passes" then
|
||
MarketplaceService:PromptGamePassPurchase(player, it.id)
|
||
else
|
||
MarketplaceService:PromptProductPurchase(player, it.id)
|
||
end
|
||
end,
|
||
})
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- настройки звука
|
||
|
||
local settingsWin = makeWindow("⚙ Настройки", Color3.fromRGB(150, 120, 80), { { id = "sound", label = "Звук" } })
|
||
local settingsPage = settingsWin.pages.sound
|
||
local volumes = {
|
||
music = player:GetAttribute("VolMusic") or Config.DefaultVolume.music,
|
||
sfx = player:GetAttribute("VolSfx") or Config.DefaultVolume.sfx,
|
||
}
|
||
|
||
local function setVolume(key, value)
|
||
volumes[key] = math.clamp(math.floor(value * 10 + 0.5) / 10, 0, 1)
|
||
-- сразу у себя (слышно без задержки), сервер сохранит и подтвердит
|
||
player:SetAttribute(key == "music" and "VolMusic" or "VolSfx", volumes[key])
|
||
remote:FireServer("Settings", volumes.music, volumes.sfx)
|
||
settingsWin.refresh()
|
||
end
|
||
|
||
settingsWin.render = function()
|
||
clear(settingsPage)
|
||
for i, row in ipairs({ { "music", "🎵 Музыка" }, { "sfx", "🔊 Звуки и окружение" } }) do
|
||
local key, label = row[1], row[2]
|
||
local f = new("Frame", { Size = UDim2.new(1, -4, 0, 70), Position = UDim2.fromOffset(0, (i - 1) * 82), BackgroundColor3 = WHITE, Parent = settingsPage },
|
||
{ corner(14), stroke(C.line, 2, 0.45), gradient(C.panel2, C.panel, 90) })
|
||
text({ Size = UDim2.new(1, -260, 1, 0), Position = UDim2.fromOffset(18, 0), Font = TITLE, TextSize = 21, Text = label, Parent = f })
|
||
btn({ Size = UDim2.fromOffset(52, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -170, 0.5, 0), BackgroundColor3 = C.grey, Text = "−", TextSize = 26, Parent = f }, function()
|
||
setVolume(key, volumes[key] - 0.1)
|
||
end)
|
||
text({ Size = UDim2.fromOffset(90, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -74, 0.5, 0), Font = TITLE, TextSize = 22,
|
||
TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, Text = math.floor(volumes[key] * 100 + 0.5) .. "%", Parent = f })
|
||
btn({ Size = UDim2.fromOffset(52, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -14, 0.5, 0), BackgroundColor3 = C.green, Text = "+", TextSize = 26, Parent = f }, function()
|
||
setVolume(key, volumes[key] + 0.1)
|
||
end)
|
||
end
|
||
end
|
||
-- сервер прислал сохранённую громкость
|
||
player:GetAttributeChangedSignal("VolMusic"):Connect(function()
|
||
volumes.music = player:GetAttribute("VolMusic") or volumes.music
|
||
settingsWin.refresh()
|
||
end)
|
||
player:GetAttributeChangedSignal("VolSfx"):Connect(function()
|
||
volumes.sfx = player:GetAttribute("VolSfx") or volumes.sfx
|
||
settingsWin.refresh()
|
||
end)
|
||
|
||
---------------------------------------------------------------- боковые кнопки
|
||
|
||
sideButton(1, "🎒", "Сумка", "B", Color3.fromRGB(60, 140, 220), function()
|
||
bagWin.toggle("fish")
|
||
end)
|
||
sideButton(2, "📖", "Рыбы", "C", Color3.fromRGB(150, 90, 220), function()
|
||
bagWin.toggle("dex")
|
||
end)
|
||
sideButton(3, "🌍", "Миры", "M", Color3.fromRGB(40, 160, 200), function()
|
||
worldsWin.toggle()
|
||
end)
|
||
sideButton(4, "📜", "Задания", "Q", Color3.fromRGB(210, 150, 40), function()
|
||
questWin.toggle()
|
||
end)
|
||
sideButton(5, "💎", "Донат", nil, Color3.fromRGB(150, 80, 210), function()
|
||
robuxWin.toggle()
|
||
end)
|
||
sideButton(6, "⚙", "Звук", nil, Color3.fromRGB(150, 120, 80), function()
|
||
settingsWin.toggle()
|
||
end)
|
||
|
||
local function refreshDots()
|
||
-- задания цепочки награждаются сами, точка — только для ежедневной награды
|
||
sideDots["Задания"].Visible = daily.available
|
||
local c = false
|
||
for _, w in ipairs(Config.Worlds) do
|
||
local zone = Config.Zones[w.id]
|
||
if zone then
|
||
for _, rarity in ipairs(Config.RarityOrder) do
|
||
local any, all = false, true
|
||
for _, f in ipairs(zone.fish) do
|
||
if f.rarity == rarity then
|
||
any = true
|
||
if not discovered[f.id] then
|
||
all = false
|
||
end
|
||
end
|
||
end
|
||
if any and all and not claimed[w.id .. ":" .. rarity] then
|
||
c = true
|
||
end
|
||
end
|
||
end
|
||
end
|
||
sideDots["Рыбы"].Visible = c
|
||
end
|
||
|
||
---------------------------------------------------------------- HUD: обновление
|
||
|
||
local function refreshHud()
|
||
local xp = player:GetAttribute("XP") or 0
|
||
local need = player:GetAttribute("XPNeed") or 100
|
||
coinsText.Text = "💰 " .. fmt(player:GetAttribute("Coins") or 0)
|
||
lvlText.Text = tostring(player:GetAttribute("Level") or 1)
|
||
xpText.Text = ("%d / %d XP"):format(xp, need)
|
||
TweenService:Create(xpFill, TweenInfo.new(0.3), { Size = UDim2.fromScale(math.clamp(xp / need, 0, 1), 1) }):Play()
|
||
local boost = player:GetAttribute("BoostBonus") or 0
|
||
luckText.Text = ("🍀 Удача <b>%d%%</b>%s"):format(player:GetAttribute("Luck") or 100,
|
||
boost > 0 and (" <font color=\"#FFD45A\">🧪 +%d%% %s</font>"):format(boost * 100, timeStr(player:GetAttribute("BoostLeft") or 0)) or "")
|
||
local count, cap = player:GetAttribute("BagCount") or 0, player:GetAttribute("BagCap") or 10
|
||
bagText.Text = ("🎒 %d / %d · ≈ %s 💰"):format(count, cap, fmt(player:GetAttribute("BagValue") or 0))
|
||
bagText.TextColor3 = count >= cap and Color3.fromRGB(255, 120, 120) or C.text
|
||
local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic")
|
||
rodText.Text = ("🎣 %s <font color=\"#FFD45A\">%s</font>"):format(rod and rod.name or "", stars(player:GetAttribute("RodLevel") or 0))
|
||
end
|
||
|
||
local pending = false
|
||
player.AttributeChanged:Connect(function(name)
|
||
refreshHud()
|
||
if name == "BoostLeft" and not (shopWin.isOpen() and shopWin.current == "luck") then
|
||
return
|
||
end
|
||
if not pending then
|
||
pending = true
|
||
task.defer(function()
|
||
pending = false
|
||
shopWin.refresh()
|
||
robuxWin.refresh()
|
||
if worldsWin.isOpen() then
|
||
worldsWin.refresh()
|
||
end
|
||
end)
|
||
end
|
||
end)
|
||
refreshHud()
|
||
|
||
---------------------------------------------------------------- рыбалка
|
||
|
||
local state = "idle"
|
||
local mg = { pos = 0, dir = 1, speed = 1, zoneStart = 0.4, zoneWidth = 0.25, hits = 0, need = 1, misses = 0, maxMisses = 2, deadline = 0, timeout = 10 }
|
||
|
||
-- с начала зарядки и до конца рыбалки персонажем не управляем: не ходит, не прыгает, не поворачивается
|
||
local ContextActionService = game:GetService("ContextActionService")
|
||
local MOVE_KEYS = {
|
||
Enum.KeyCode.W, Enum.KeyCode.A, Enum.KeyCode.S, Enum.KeyCode.D, Enum.KeyCode.Space,
|
||
Enum.KeyCode.Up, Enum.KeyCode.Down, Enum.KeyCode.Left, Enum.KeyCode.Right,
|
||
Enum.KeyCode.Thumbstick1, Enum.KeyCode.ButtonA,
|
||
}
|
||
local controls
|
||
local movementLocked = false
|
||
local function setMovementLocked(locked)
|
||
if not controls then
|
||
local pm = player:FindFirstChild("PlayerScripts") and player.PlayerScripts:FindFirstChild("PlayerModule")
|
||
local ok, mod = pcall(require, pm)
|
||
controls = ok and mod and mod:GetControls() or nil
|
||
end
|
||
if controls then
|
||
if locked then
|
||
controls:Disable()
|
||
else
|
||
controls:Enable()
|
||
end
|
||
end
|
||
if locked ~= movementLocked then
|
||
movementLocked = locked
|
||
if locked then
|
||
ContextActionService:BindActionAtPriority("FishingLock", function()
|
||
return Enum.ContextActionResult.Sink
|
||
end, false, Enum.ContextActionPriority.High.Value + 100, table.unpack(MOVE_KEYS))
|
||
else
|
||
ContextActionService:UnbindAction("FishingLock")
|
||
end
|
||
end
|
||
local hum = player.Character and player.Character:FindFirstChildOfClass("Humanoid")
|
||
if hum then
|
||
hum.AutoRotate = not locked
|
||
hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, not locked)
|
||
if locked then
|
||
hum:Move(Vector3.zero)
|
||
end
|
||
end
|
||
end
|
||
|
||
local function easeInOut(a)
|
||
return a < 0.5 and 4 * a * a * a or 1 - (-2 * a + 2) ^ 3 / 2
|
||
end
|
||
local function easeOut(a)
|
||
return 1 - (1 - a) ^ 3
|
||
end
|
||
|
||
---------------------------------------------------------------- заброс: зарядка, шкала силы, наклон удочки
|
||
-- держишь ЛКМ — сила растёт, удочка уходит назад; отпустил — бросок на дальность по силе
|
||
|
||
local REST_ANGLE, BACK_ANGLE = 30, 110 -- удочка в покое (как в GameServer) и в полном замахе
|
||
local function gripCF(angle)
|
||
return (CFrame.Angles(math.rad(angle), 0, 0) * CFrame.new(0, 0, -0.3)):Inverse()
|
||
end
|
||
|
||
local charge = nil -- { t0, tool }
|
||
local castTool = nil -- удочка последнего броска: вернуть её в покой, если бросок не удался
|
||
-- сила ездит туда-сюда: 0 → 1 за CastChargeTime, потом обратно к 0 и снова вверх, пока держишь ЛКМ
|
||
local function chargePower()
|
||
if not charge then
|
||
return 0
|
||
end
|
||
local t = ((os.clock() - charge.t0) / Config.CastChargeTime) % 2
|
||
return t <= 1 and t or 2 - t
|
||
end
|
||
local function inPerfect(v)
|
||
return v >= Config.CastPerfect[1] and v <= Config.CastPerfect[2]
|
||
end
|
||
|
||
-- шкала-дуга справа от персонажа: внизу слабый бросок, вверху сильный, зелёная зона — бонус удачи
|
||
local GAUGE_R, GAUGE_DEG, GAUGE_N = 190, 110, 32
|
||
local gauge = new("Frame", {
|
||
Size = UDim2.fromOffset(150, 280), AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0.57, 0, 0.48, 0),
|
||
BackgroundTransparency = 1, Visible = false, Parent = gui,
|
||
})
|
||
local GAUGE_C = Vector2.new(110 - GAUGE_R, 140) -- центр окружности левее рамки: дуга выгнута вправо
|
||
local function arcPoint(v, r)
|
||
local th = math.rad(-GAUGE_DEG / 2 + GAUGE_DEG * v)
|
||
return GAUGE_C + Vector2.new(math.cos(th) * r, -math.sin(th) * r), -math.deg(th)
|
||
end
|
||
do
|
||
local segLen = 2 * math.pi * GAUGE_R * (GAUGE_DEG / 360) / GAUGE_N
|
||
for _, layer in ipairs({ { 46, 4, BLACK }, { 34, 1 } }) do -- чёрная обводка, потом цветные секции
|
||
for i = 0, GAUGE_N - 1 do
|
||
local v = (i + 0.5) / GAUGE_N
|
||
local pos, rot = arcPoint(v, GAUGE_R)
|
||
local color = layer[3]
|
||
or ((v < 0.12 or v > 0.94) and C.red)
|
||
or (inPerfect(v) and Color3.fromRGB(110, 235, 60))
|
||
or Color3.fromRGB(40, 70, 95)
|
||
new("Frame", {
|
||
Size = UDim2.fromOffset(layer[1], segLen + layer[2]), AnchorPoint = Vector2.new(0.5, 0.5),
|
||
Position = UDim2.fromOffset(pos.X, pos.Y), Rotation = rot, BorderSizePixel = 0,
|
||
BackgroundColor3 = color, Parent = gauge,
|
||
})
|
||
end
|
||
end
|
||
end
|
||
local needle = new("Frame", {
|
||
Size = UDim2.fromOffset(64, 8), AnchorPoint = Vector2.new(0.5, 0.5), BackgroundColor3 = WHITE,
|
||
BorderSizePixel = 0, ZIndex = 3, Parent = gauge,
|
||
}, { corner(4), stroke(BLACK, 2) })
|
||
local multLabel = text({
|
||
Size = UDim2.fromOffset(110, 40), AnchorPoint = Vector2.new(0.5, 1), Font = TITLE, TextSize = 34,
|
||
Text = "×" .. Config.CastPerfectLuck, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 4,
|
||
Visible = false, Parent = gauge,
|
||
})
|
||
new("UIStroke", { Color = BLACK, Thickness = 3, Parent = multLabel })
|
||
do
|
||
local top = arcPoint(1, GAUGE_R)
|
||
multLabel.Position = UDim2.fromOffset(top.X + 10, top.Y - 18)
|
||
end
|
||
|
||
local function updateCharge()
|
||
local p = chargePower()
|
||
local pos, rot = arcPoint(p, GAUGE_R)
|
||
needle.Position = UDim2.fromOffset(pos.X, pos.Y)
|
||
needle.Rotation = rot
|
||
local good = inPerfect(p)
|
||
multLabel.Visible = good
|
||
needle.BackgroundColor3 = good and Color3.fromRGB(190, 255, 150) or WHITE
|
||
if charge.tool and charge.tool.Parent then
|
||
charge.tool.Grip = gripCF(REST_ANGLE + (BACK_ANGLE - REST_ANGLE) * easeOut(p))
|
||
end
|
||
end
|
||
|
||
---------------------------------------------------------------- камера при забросе
|
||
-- зарядка: камера уходит в сторону от персонажа и отъезжает тем дальше, чем сильнее замах;
|
||
-- бросок: камера сбоку разгоняется за поплавком; потом сверху-сбоку держит в кадре игрока и поплавок
|
||
|
||
local CAM_IN, CAM_SETTLE, CAM_RETURN = 0.35, 0.8, 0.6
|
||
local UP = Vector3.new(0, 1, 0)
|
||
local fishCam = nil
|
||
|
||
local function sideCF(fc, p)
|
||
return CFrame.lookAt(fc.hrp + fc.r * (9 + 3 * p) - fc.f * (3 + 2 * p) + UP * (3 + 1.5 * p), fc.hrp + fc.f * 6 + UP)
|
||
end
|
||
local function chaseCF(fc, p)
|
||
return CFrame.lookAt(p + fc.r * 9 - fc.f * 5 + UP * 3, p + fc.f * 3)
|
||
end
|
||
local function restCF(fc)
|
||
local d = ((fc.target - fc.hrp) * Vector3.new(1, 0, 1)).Magnitude
|
||
local mid = fc.hrp:Lerp(fc.target, 0.5)
|
||
return CFrame.lookAt(mid + fc.r * (8 + d * 0.55) - fc.f * 4 + UP * (6 + d * 0.25), fc.hrp:Lerp(fc.target, 0.6))
|
||
end
|
||
|
||
local function fishCamStep()
|
||
local fc = fishCam
|
||
local cam = workspace.CurrentCamera
|
||
if not fc or not cam then
|
||
return
|
||
end
|
||
if fc.returning then
|
||
local a = math.min(1, (os.clock() - fc.returning) / CAM_RETURN)
|
||
local e = easeInOut(a)
|
||
cam.CFrame = fc.leaveCF:Lerp(fc.origCF, e)
|
||
cam.FieldOfView = fc.leaveFov + (fc.origFov - fc.leaveFov) * e
|
||
if a >= 1 then
|
||
RunService:UnbindFromRenderStep("FishCam")
|
||
cam.CameraType = Enum.CameraType.Custom
|
||
fishCam = nil
|
||
end
|
||
return
|
||
end
|
||
local now = os.clock()
|
||
local cf, fov
|
||
if not fc.castT0 then
|
||
-- зарядка: плавно уходим в вид сбоку; чем сильнее замах, тем дальше камера и шире обзор
|
||
-- после отпускания ЛКМ, пока ждём ответ сервера, держим набранную силу
|
||
local p = charge and chargePower() or (fc.power or 0)
|
||
fc.power = p
|
||
local e = easeOut(math.min(1, (now - fc.t0) / CAM_IN))
|
||
cf = fc.origCF:Lerp(sideCF(fc, p), e)
|
||
fov = fc.origFov + 12 * p * e
|
||
else
|
||
local th = fc.throw
|
||
local t = now - fc.castT0
|
||
local lunge = fc.fromCF + fc.f * 1.5
|
||
if t < th.windup then
|
||
-- рывок удочки вперёд: камера подаётся следом
|
||
local e = easeOut(t / th.windup)
|
||
cf = fc.fromCF:Lerp(lunge, e)
|
||
fov = fc.fromFov + 4 * e
|
||
elseif t < th.windup + th.flight then
|
||
if not fc.start then
|
||
fc.start = (fc.tip and fc.tip.Parent and fc.tip.WorldPosition) or (fc.hrp + fc.f * 2 + UP * 4)
|
||
end
|
||
local a = (t - th.windup) / th.flight
|
||
local p = fc.start:Lerp(fc.target, a) + UP * (math.sin(a * math.pi) * th.arc) -- та же дуга, что у поплавка
|
||
local e = easeInOut(a)
|
||
cf = lunge:Lerp(chaseCF(fc, p), e)
|
||
fov = (fc.fromFov + 4) + ((fc.origFov - 6) - (fc.fromFov + 4)) * e
|
||
else
|
||
local e = easeOut(math.min(1, (t - th.windup - th.flight) / CAM_SETTLE))
|
||
local sway = Vector3.new(math.sin(now * 0.7) * 0.5, math.sin(now * 1.1) * 0.25, 0)
|
||
if state == "bite" then
|
||
sway += Vector3.new(math.random() - 0.5, math.random() - 0.5, 0) * 0.15
|
||
end
|
||
cf = chaseCF(fc, fc.target):Lerp(restCF(fc) + sway, e)
|
||
fov = fc.origFov - 6 + 6 * e
|
||
end
|
||
end
|
||
cam.CFrame = cf
|
||
cam.FieldOfView = fov
|
||
end
|
||
|
||
-- начало зарядки: dir — куда полетит поплавок (к центру озера)
|
||
local function startChargeCam(tool, dir)
|
||
local cam = workspace.CurrentCamera
|
||
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||
if not cam or not hrp then
|
||
return
|
||
end
|
||
fishCam = {
|
||
t0 = os.clock(), hrp = hrp.Position, f = dir, r = dir:Cross(UP),
|
||
tip = tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip"),
|
||
-- если камера ещё возвращалась с прошлого заброса, возвращаться будем туда же
|
||
origCF = fishCam and fishCam.origCF or cam.CFrame,
|
||
origFov = fishCam and fishCam.origFov or cam.FieldOfView,
|
||
}
|
||
cam.CameraType = Enum.CameraType.Scriptable
|
||
RunService:UnbindFromRenderStep("FishCam")
|
||
RunService:BindToRenderStep("FishCam", Enum.RenderPriority.Camera.Value + 1, fishCamStep)
|
||
end
|
||
|
||
-- сервер принял бросок: target — куда упадёт поплавок, throw — тайминги и высота дуги
|
||
local function startCastCam(target, throw)
|
||
local cam = workspace.CurrentCamera
|
||
if not fishCam or fishCam.returning or not cam or typeof(target) ~= "Vector3" or type(throw) ~= "table" then
|
||
return
|
||
end
|
||
fishCam.castT0 = os.clock()
|
||
fishCam.target = target
|
||
fishCam.throw = throw
|
||
fishCam.fromCF = cam.CFrame
|
||
fishCam.fromFov = cam.FieldOfView
|
||
end
|
||
|
||
local function stopFishCam()
|
||
local cam = workspace.CurrentCamera
|
||
if not fishCam or fishCam.returning or not cam then
|
||
return
|
||
end
|
||
fishCam.returning = os.clock()
|
||
fishCam.leaveCF = cam.CFrame
|
||
fishCam.leaveFov = cam.FieldOfView
|
||
end
|
||
|
||
local reelToken
|
||
local function setState(s)
|
||
if s ~= "charging" and charge then
|
||
-- зарядку прервали (убрал удочку и т.п.): удочку обратно в покой
|
||
if charge.tool.Parent then
|
||
charge.tool.Grip = gripCF(REST_ANGLE)
|
||
end
|
||
charge = nil
|
||
end
|
||
state = s
|
||
Audio.fade(reelSound, s == "bite" and 1 or 0, s == "bite" and 0.2 or 0.4)
|
||
statusLabel.Visible = (s == "waiting")
|
||
mgFrame.Visible = (s == "bite")
|
||
gauge.Visible = (s == "charging")
|
||
setMovementLocked(s ~= "idle")
|
||
if s == "idle" then
|
||
stopFishCam()
|
||
elseif s == "reeling" then
|
||
-- на случай, если сервер не ответит на вытаскивание: не оставляем игрока замороженным
|
||
local token = {}
|
||
reelToken = token
|
||
task.delay(4, function()
|
||
if state == "reeling" and reelToken == token then
|
||
setState("idle")
|
||
end
|
||
end)
|
||
end
|
||
end
|
||
local function updatePips()
|
||
pipsText.Text = "🎯 " .. string.rep("<font color=\"#7CFF9A\">●</font>", mg.hits) .. string.rep("<font color=\"#5A6480\">●</font>", mg.need - mg.hits)
|
||
missText.Text = string.rep("<font color=\"#5A6480\">✖</font>", mg.misses) .. string.rep("❤️", mg.maxMisses - mg.misses)
|
||
end
|
||
local function flash(color)
|
||
bar.BackgroundColor3 = color
|
||
TweenService:Create(bar, TweenInfo.new(0.35), { BackgroundColor3 = Color3.fromRGB(22, 28, 46) }):Play()
|
||
end
|
||
local function placeZone()
|
||
mg.zoneStart = math.random() * (1 - mg.zoneWidth)
|
||
zoneF.Size = UDim2.fromScale(mg.zoneWidth, 1)
|
||
zoneF.Position = UDim2.fromScale(mg.zoneStart, 0)
|
||
end
|
||
|
||
-- ЛКМ зажата: персонаж разворачивается к центру озера, начинается зарядка
|
||
local function startCharge(tool)
|
||
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||
if not hrp then
|
||
return
|
||
end
|
||
local world = Config.WorldAt(hrp.Position)
|
||
-- из воды и издалека не заряжаем вовсе: сразу подсказка
|
||
local can = Config.CanCastFrom(world, hrp.Position, player.Character:FindFirstChildOfClass("Humanoid"))
|
||
if can ~= true then
|
||
notify(can, Color3.fromRGB(255, 200, 120))
|
||
return
|
||
end
|
||
local dir = Config.CastDirection(world, hrp.Position)
|
||
if not dir then
|
||
dir = hrp.CFrame.LookVector * Vector3.new(1, 0, 1)
|
||
dir = dir.Magnitude > 0.01 and dir.Unit or Vector3.new(0, 0, -1)
|
||
end
|
||
hrp.CFrame = CFrame.lookAt(hrp.Position, hrp.Position + dir)
|
||
charge = { t0 = os.clock(), tool = tool }
|
||
setState("charging")
|
||
startChargeCam(tool, dir)
|
||
updateCharge()
|
||
end
|
||
|
||
-- ЛКМ отпущена: бросок с набранной силой
|
||
local function releaseCast()
|
||
if state ~= "charging" or not charge then
|
||
return
|
||
end
|
||
local power = chargePower()
|
||
castTool = charge.tool
|
||
charge = nil -- удочку не возвращаем: сервер сам сделает рывок вперёд
|
||
setState("casting")
|
||
remote:FireServer("Cast", power)
|
||
end
|
||
|
||
local function onActivate()
|
||
if state == "waiting" then
|
||
remote:FireServer("Cancel")
|
||
setState("idle")
|
||
elseif state == "bite" then
|
||
local inZone = mg.pos >= mg.zoneStart and mg.pos <= mg.zoneStart + mg.zoneWidth
|
||
if inZone then
|
||
mg.hits += 1
|
||
flash(Color3.fromRGB(60, 160, 80))
|
||
if mg.hits >= mg.need then
|
||
setState("reeling")
|
||
remote:FireServer("Catch", true, mg.misses)
|
||
return
|
||
end
|
||
mg.speed *= 1.12
|
||
placeZone()
|
||
else
|
||
mg.misses += 1
|
||
flash(Color3.fromRGB(170, 50, 50))
|
||
if mg.misses >= mg.maxMisses then
|
||
setState("reeling")
|
||
remote:FireServer("Catch", false, mg.misses)
|
||
return
|
||
end
|
||
end
|
||
updatePips()
|
||
end
|
||
end
|
||
|
||
local hooked = setmetatable({}, { __mode = "k" })
|
||
local function hookTool(tool)
|
||
if hooked[tool] or not tool:IsA("Tool") or not tool:GetAttribute("IsRod") then
|
||
return
|
||
end
|
||
hooked[tool] = true
|
||
tool.Activated:Connect(function()
|
||
if state == "idle" then
|
||
startCharge(tool)
|
||
else
|
||
onActivate()
|
||
end
|
||
end)
|
||
tool.Deactivated:Connect(releaseCast)
|
||
tool.Unequipped:Connect(function()
|
||
if state == "waiting" or state == "bite" or state == "casting" then
|
||
remote:FireServer("Cancel")
|
||
end
|
||
setState("idle")
|
||
end)
|
||
end
|
||
local function watch(container)
|
||
for _, c in ipairs(container:GetChildren()) do
|
||
hookTool(c)
|
||
end
|
||
container.ChildAdded:Connect(hookTool)
|
||
end
|
||
player.ChildAdded:Connect(function(c)
|
||
if c:IsA("Backpack") then
|
||
watch(c)
|
||
end
|
||
end)
|
||
if player:FindFirstChild("Backpack") then
|
||
watch(player.Backpack)
|
||
end
|
||
player.CharacterAdded:Connect(function(char)
|
||
setState("idle")
|
||
watch(char)
|
||
end)
|
||
if player.Character then
|
||
watch(player.Character)
|
||
end
|
||
|
||
RunService.RenderStepped:Connect(function()
|
||
if state == "charging" and charge then
|
||
updateCharge()
|
||
end
|
||
end)
|
||
|
||
RunService.RenderStepped:Connect(function(dt)
|
||
if state ~= "bite" then
|
||
return
|
||
end
|
||
mg.pos += mg.dir * mg.speed * dt
|
||
if mg.pos >= 1 then
|
||
mg.pos, mg.dir = 1, -1
|
||
elseif mg.pos <= 0 then
|
||
mg.pos, mg.dir = 0, 1
|
||
end
|
||
markerF.Position = UDim2.fromScale(mg.pos, 0.5)
|
||
local left = math.max(0, mg.deadline - os.clock())
|
||
timeBar.Size = UDim2.new(left / mg.timeout, -30 * left / mg.timeout, 0, 5)
|
||
if left <= 0 then
|
||
setState("reeling")
|
||
remote:FireServer("Catch", false, mg.misses)
|
||
end
|
||
end)
|
||
|
||
UserInputService.InputBegan:Connect(function(input, processed)
|
||
if processed then
|
||
return
|
||
end
|
||
local k = input.KeyCode
|
||
if k == Enum.KeyCode.B then
|
||
bagWin.toggle("fish")
|
||
elseif k == Enum.KeyCode.C then
|
||
bagWin.toggle("dex")
|
||
elseif k == Enum.KeyCode.M then
|
||
worldsWin.toggle()
|
||
elseif k == Enum.KeyCode.Q then
|
||
questWin.toggle()
|
||
end
|
||
end)
|
||
|
||
---------------------------------------------------------------- атмосфера миров (только у этого игрока)
|
||
|
||
local snowPart = new("Part", {
|
||
Name = "SnowFX", Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false,
|
||
Transparency = 1, Size = Vector3.new(90, 1, 90), Parent = workspace,
|
||
})
|
||
local snow = new("ParticleEmitter", {
|
||
Rate = 0, Lifetime = NumberRange.new(5, 7), Speed = NumberRange.new(4, 7),
|
||
EmissionDirection = Enum.NormalId.Bottom, SpreadAngle = Vector2.new(15, 15),
|
||
Size = NumberSequence.new(0.25), Color = ColorSequence.new(WHITE), LightEmission = 0.3,
|
||
Parent = snowPart,
|
||
})
|
||
local lastWorldId = "none"
|
||
local terrain = workspace.Terrain
|
||
|
||
-- то, что мир может поменять под себя (оттенок, цвета травы и песка); вода не трогается — она из свойств Terrain
|
||
local DEFAULT_LOOK = { tint = Color3.new(1, 1, 1) }
|
||
local defaultTerrainColors = nil
|
||
|
||
-- world.look: свет и эффекты мира; при выходе свойства возвращаются к тем, что были до первого входа
|
||
local lookTargets = {
|
||
lighting = function() return Lighting end,
|
||
atmosphere = function() return Lighting:FindFirstChildOfClass("Atmosphere") end,
|
||
color = function() return Lighting:FindFirstChildOfClass("ColorCorrectionEffect") end,
|
||
bloom = function() return Lighting:FindFirstChildOfClass("BloomEffect") end,
|
||
sunRays = function() return Lighting:FindFirstChildOfClass("SunRaysEffect") end,
|
||
dof = function()
|
||
return Lighting:FindFirstChildOfClass("DepthOfFieldEffect")
|
||
or new("DepthOfFieldEffect", { Enabled = false, Parent = Lighting })
|
||
end,
|
||
grading = function() return Lighting:FindFirstChildOfClass("ColorGradingEffect") end,
|
||
}
|
||
local lookDefaults = {}
|
||
-- лобби настраивается так же, как миры
|
||
local lookSources = table.clone(Config.Worlds)
|
||
table.insert(lookSources, Config.Lobby)
|
||
|
||
-- смена света: плавно или сразу (за экраном загрузки)
|
||
local lookTweens = {}
|
||
local function setLook(obj, goal, instant)
|
||
if instant then
|
||
for prop, v in pairs(goal) do
|
||
obj[prop] = v
|
||
end
|
||
else
|
||
local tw = TweenService:Create(obj, TweenInfo.new(2), goal)
|
||
table.insert(lookTweens, tw)
|
||
tw:Play()
|
||
end
|
||
end
|
||
|
||
-- погода сгущает дымку поверх настроек локации (туман — сильно, дождь и гроза — слегка)
|
||
local WEATHER_ATMO = {
|
||
Fog = { Density = 0.22, Haze = 1.5 },
|
||
Rain = { Density = 0.06, Haze = 0.4 },
|
||
Storm = { Density = 0.12, Haze = 0.8 },
|
||
}
|
||
local function weatherAtmo(prop)
|
||
local add = WEATHER_ATMO[workspace:GetAttribute("Weather") or ""]
|
||
return (add and add[prop]) or 0
|
||
end
|
||
|
||
local function applyLook(world, instant)
|
||
-- исходные значения запоминаем до первой правки; эффект мог ещё не прийти с сервера, тогда в следующий раз
|
||
for _, w in ipairs(lookSources) do
|
||
for section, props in pairs(w.look or {}) do
|
||
local obj = lookTargets[section] and lookTargets[section]()
|
||
if obj then
|
||
lookDefaults[section] = lookDefaults[section] or {}
|
||
for prop in pairs(props) do
|
||
if lookDefaults[section][prop] == nil then
|
||
lookDefaults[section][prop] = obj[prop]
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
local look = (world and world.look) or {}
|
||
for section, defaults in pairs(lookDefaults) do
|
||
local obj = lookTargets[section]()
|
||
if obj then
|
||
local goal = {}
|
||
for prop, def in pairs(defaults) do
|
||
local v = look[section] and look[section][prop]
|
||
if v == nil then v = def end
|
||
if section == "atmosphere" and typeof(v) == "number" then
|
||
v += weatherAtmo(prop)
|
||
end
|
||
-- плавно меняются только числа и цвета; флаги и режимы (EnumItem) ставим сразу
|
||
local kind = typeof(v)
|
||
if kind == "number" or kind == "Color3" then goal[prop] = v else obj[prop] = v end
|
||
end
|
||
setLook(obj, goal, instant)
|
||
end
|
||
end
|
||
end
|
||
|
||
local function applyAmbience(world, instant)
|
||
-- прошлая плавная смена ещё может идти — она перебила бы новые значения
|
||
for _, tw in ipairs(lookTweens) do
|
||
tw:Cancel()
|
||
end
|
||
table.clear(lookTweens)
|
||
world = world or Config.Lobby
|
||
-- при смене суток часы двигает Ambience; иначе у каждой локации своё время
|
||
if not Config.DayNight.enabled then
|
||
setLook(Lighting, { ClockTime = (world and world.clock) or 14.5 }, instant)
|
||
end
|
||
local cc = Lighting:FindFirstChildOfClass("ColorCorrectionEffect")
|
||
if cc then
|
||
setLook(cc, { TintColor = (world and world.tint) or DEFAULT_LOOK.tint }, instant)
|
||
end
|
||
-- цвета материалов террейна общие для всей карты, поэтому меняем их только у себя и возвращаем при выходе
|
||
if not defaultTerrainColors then
|
||
defaultTerrainColors = {}
|
||
for _, name in ipairs({ "Snow", "Salt", "Mud", "Sand", "Rock", "Slate", "Grass", "Ground" }) do
|
||
defaultTerrainColors[name] = terrain:GetMaterialColor(Enum.Material[name])
|
||
end
|
||
end
|
||
local colors = (world and world.terrainColors) or {}
|
||
for name, def in pairs(defaultTerrainColors) do
|
||
terrain:SetMaterialColor(Enum.Material[name], colors[name] or def)
|
||
end
|
||
local atm = Lighting:FindFirstChildOfClass("Atmosphere")
|
||
if atm then
|
||
local frost = world and world.id == "World3"
|
||
setLook(atm, {
|
||
Density = frost and 0.38 or 0.25,
|
||
Color = frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232),
|
||
}, instant)
|
||
end
|
||
applyLook(world, instant)
|
||
snow.Rate = (world and world.id == "World3") and 140 or 0
|
||
end
|
||
|
||
-- тёмные силуэты рыб под прозрачной водой «Тихого озера», медленно плавают по кругу (только у этого игрока)
|
||
do
|
||
local w1 = Config.Worlds[1]
|
||
local fishList = Config.Zones.World1.fish
|
||
local frng = Random.new(11)
|
||
local folder = new("Folder", { Name = "FishShadows", Parent = workspace })
|
||
local swimmers = {}
|
||
for i = 1, 10 do
|
||
local l = w1.lakes[(i - 1) % #w1.lakes + 1]
|
||
local ok, model = pcall(Models.buildFish, fishList[(i - 1) % #fishList + 1].id, nil, frng:NextNumber(1.3, 2), true)
|
||
if ok and model then
|
||
for _, d in ipairs(model:GetDescendants()) do
|
||
if d:IsA("BasePart") then
|
||
d.Color = Color3.fromRGB(22, 70, 74)
|
||
d.Material = Enum.Material.SmoothPlastic
|
||
d.Transparency = 0.5
|
||
d.CanCollide, d.CanQuery, d.CanTouch, d.CastShadow = false, false, false, false
|
||
elseif d:IsA("Decal") or d:IsA("ParticleEmitter") or d:IsA("Light") then
|
||
d:Destroy()
|
||
end
|
||
end
|
||
model.Parent = folder
|
||
table.insert(swimmers, {
|
||
model = model,
|
||
c = w1.center + Vector3.new(l[1] + frng:NextNumber(-l[3], l[3]) * 0.25, w1.waterY - frng:NextNumber(1.4, 2.4), l[2] + frng:NextNumber(-l[3], l[3]) * 0.25),
|
||
r = l[3] * frng:NextNumber(0.25, 0.55), a = frng:NextNumber(0, math.pi * 2),
|
||
w = frng:NextNumber(0.08, 0.18) * (frng:NextNumber() < 0.5 and -1 or 1),
|
||
})
|
||
end
|
||
end
|
||
local acc = 0
|
||
RunService.Heartbeat:Connect(function(dt)
|
||
acc += dt
|
||
if acc < 1 / 30 then
|
||
return
|
||
end
|
||
local step = acc
|
||
acc = 0
|
||
local w = currentWorld()
|
||
if not (w and w.id == "World1") then
|
||
return
|
||
end
|
||
for _, s in ipairs(swimmers) do
|
||
s.a += s.w * step
|
||
local pos = s.c + Vector3.new(math.cos(s.a) * s.r, math.sin(s.a * 3) * 0.2, math.sin(s.a) * s.r)
|
||
local dir = Vector3.new(-math.sin(s.a), 0, math.cos(s.a)) * math.sign(s.w)
|
||
-- голова рыбы смотрит в +X модели, поэтому разворачиваем на 90°
|
||
s.model:PivotTo(CFrame.lookAt(pos, pos + dir) * CFrame.Angles(0, math.rad(90), 0))
|
||
end
|
||
end)
|
||
end
|
||
|
||
-- экран загрузки (ReplicatedFirst/Loading): при входе и телепорте свет локации ставится, пока он закрывает картинку
|
||
local loadingGui = player:WaitForChild("PlayerGui"):WaitForChild("LoadingScreen", 10)
|
||
local function loadingVisible()
|
||
return loadingGui ~= nil and loadingGui.Enabled
|
||
end
|
||
|
||
local function placeTitle(w)
|
||
return w and (w.icon .. " " .. w.name) or "🏠 Лобби"
|
||
end
|
||
|
||
local function enterWorld(w, instant)
|
||
lastWorldId = w and w.id or "lobby"
|
||
applyAmbience(w, instant)
|
||
if w then
|
||
-- название локации — когда экран загрузки уже ушёл
|
||
task.spawn(function()
|
||
while loadingVisible() do
|
||
task.wait(0.1)
|
||
end
|
||
notify(w.icon .. " " .. w.name, w.color)
|
||
end)
|
||
end
|
||
end
|
||
|
||
-- погода сменилась: плавно пересчитываем дымку текущей локации
|
||
workspace:GetAttributeChangedSignal("Weather"):Connect(function()
|
||
if lastWorldId ~= "none" and not loadingVisible() then
|
||
applyAmbience(currentWorld(), false)
|
||
end
|
||
end)
|
||
|
||
-- новый уровень — арфа
|
||
do
|
||
local lastLevel = player:GetAttribute("Level")
|
||
player:GetAttributeChangedSignal("Level"):Connect(function()
|
||
local lv = player:GetAttribute("Level")
|
||
if lastLevel and lv and lv > lastLevel then
|
||
Audio.play("levelUp")
|
||
end
|
||
lastLevel = lv
|
||
end)
|
||
end
|
||
|
||
-- первое появление: ждём персонажа, ставим свет его локации сразу и отпускаем экран загрузки
|
||
task.spawn(function()
|
||
local char = player.Character or player.CharacterAdded:Wait()
|
||
char:WaitForChild("HumanoidRootPart", 30)
|
||
local w = currentWorld()
|
||
enterWorld(w, true)
|
||
if loadingGui then
|
||
loadingGui:SetAttribute("Title", placeTitle(w))
|
||
loadingGui:SetAttribute("Ready", true)
|
||
end
|
||
end)
|
||
|
||
-- телепорт: экран загрузки закрывает картинку, сервер переносит персонажа, свет новой локации ставится сразу
|
||
local teleportToken = 0
|
||
local function teleportLoading(targetId, delay)
|
||
teleportToken += 1
|
||
local token = teleportToken
|
||
local target = Config.Find(Config.Worlds, targetId)
|
||
if loadingGui then
|
||
local now = os.clock()
|
||
loadingGui:SetAttribute("Ready", false)
|
||
loadingGui:SetAttribute("StartAt", now)
|
||
loadingGui:SetAttribute("MinUntil", now + Config.Loading.teleport)
|
||
loadingGui:SetAttribute("Title", placeTitle(target))
|
||
loadingGui:SetAttribute("Visible", true)
|
||
end
|
||
task.spawn(function()
|
||
-- ждём, пока персонаж окажется в новой локации (или сдаёмся через пару секунд)
|
||
local deadline = os.clock() + delay + 3
|
||
local w
|
||
repeat
|
||
task.wait()
|
||
w = currentWorld()
|
||
until (w and w.id or "Lobby") == targetId or os.clock() > deadline or token ~= teleportToken
|
||
if token ~= teleportToken then
|
||
return
|
||
end
|
||
enterWorld(w, true)
|
||
if loadingGui then
|
||
loadingGui:SetAttribute("Ready", true)
|
||
end
|
||
end)
|
||
end
|
||
|
||
task.spawn(function()
|
||
while true do
|
||
local w = currentWorld()
|
||
local id = w and w.id or "lobby"
|
||
if id ~= lastWorldId and lastWorldId ~= "none" and not loadingVisible() then
|
||
enterWorld(w, false) -- без телепорта (например, после возрождения): плавно
|
||
end
|
||
local cam = workspace.CurrentCamera
|
||
if cam then
|
||
snowPart.CFrame = CFrame.new(cam.CFrame.Position + Vector3.new(0, 25, 0))
|
||
end
|
||
-- баннер события
|
||
local evId = workspace:GetAttribute("Event")
|
||
local event = evId and Config.Find(Config.Events, evId)
|
||
if event then
|
||
eventBanner.Visible = true
|
||
eventTitle.Text = event.name .. " " .. timeStr((workspace:GetAttribute("EventEnds") or 0) - workspace:GetServerTimeNow())
|
||
eventDesc.Text = event.desc
|
||
else
|
||
eventBanner.Visible = false
|
||
end
|
||
task.wait(0.5)
|
||
end
|
||
end)
|
||
|
||
---------------------------------------------------------------- обучение: линия-подсказка
|
||
-- белые «стрелки» бегут по земле от игрока к цели текущего шага (см. Config.TutorialDone)
|
||
|
||
local GUIDE_N, GUIDE_GAP, GUIDE_SPEED = 32, 3, 7 -- сколько стрелок, шаг между ними, скорость бега
|
||
local guideStep = 0 -- шаг, отправленный на сервер (атрибут Tutorial может прийти чуть позже)
|
||
|
||
-- крупная мультяшная подсказка под уведомлениями: покачивается, при смене шага «выпрыгивает»
|
||
local guideHint, guideHintText = softPlate(
|
||
{ Size = UDim2.fromOffset(0, 70), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 10), Visible = false, Parent = gui },
|
||
{ TextSize = 42, Text = "" }
|
||
)
|
||
wobble(guideHint, 1.2, 1.6)
|
||
local lastHint = nil
|
||
|
||
local guideFolder = new("Folder", { Name = "TutorialGuide", Parent = workspace })
|
||
local chevrons = {}
|
||
for i = 1, GUIDE_N do
|
||
local arms = {}
|
||
for k = 1, 2 do
|
||
arms[k] = new("Part", {
|
||
Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false, CastShadow = false,
|
||
Material = Enum.Material.Neon, Color = Color3.fromRGB(70, 195, 255), Size = Vector3.new(0.5, 0.5, 2), Transparency = 1,
|
||
Parent = guideFolder,
|
||
})
|
||
end
|
||
chevrons[i] = arms
|
||
end
|
||
-- два объёмных бруска стрелки «>» острием вперёд (по -Z)
|
||
local GUIDE_HEIGHT = 2.2 -- стрелки висят в воздухе над землёй
|
||
local ARM_CF = {}
|
||
for k, s in ipairs({ -1, 1 }) do
|
||
local center = Vector3.new(s * 0.65, 0, -0.15)
|
||
ARM_CF[k] = CFrame.lookAt(center, center + Vector3.new(s * 1.3, 0, 1.5))
|
||
end
|
||
local function hideChevrons(from)
|
||
for i = from, GUIDE_N do
|
||
chevrons[i][1].Transparency = 1
|
||
chevrons[i][2].Transparency = 1
|
||
end
|
||
end
|
||
|
||
local guideRay = RaycastParams.new()
|
||
guideRay.FilterType = Enum.RaycastFilterType.Exclude
|
||
guideRay.RespectCanCollide = true
|
||
guideRay.IgnoreWater = false
|
||
|
||
local function tutorialStep()
|
||
return math.max(player:GetAttribute("Tutorial") or 0, guideStep)
|
||
end
|
||
local function advanceTutorial(step)
|
||
if step > tutorialStep() then
|
||
guideStep = step
|
||
remote:FireServer("Tutorial", step)
|
||
if step >= Config.TutorialDone then
|
||
notify("🎓 Обучение пройдено!", C.gold)
|
||
end
|
||
end
|
||
end
|
||
|
||
local function guideMarker(name)
|
||
local map = workspace:FindFirstChild("FishingMap")
|
||
local m = map and map:FindFirstChild(name, true) -- маркеры могут лежать в папках уровня (World1Map)
|
||
return m and m.Position
|
||
end
|
||
|
||
-- объект цели обводится мягким светящимся контуром (атрибут GuideTarget ставит MapBuilder);
|
||
-- Occluded: то, что стоит перед объектом (персонаж на мостике), не перекрашивается
|
||
local guideHighlight = new("Highlight", {
|
||
FillColor = Color3.fromRGB(150, 225, 255), OutlineColor = Color3.fromRGB(190, 240, 255),
|
||
DepthMode = Enum.HighlightDepthMode.Occluded, Enabled = false, Parent = guideFolder,
|
||
})
|
||
local guideObjects, guideScanAt = {}, {}
|
||
local function guideObject(key)
|
||
local obj = guideObjects[key]
|
||
if obj and obj.Parent then
|
||
return obj
|
||
end
|
||
-- карта большая: если объекта нет (ещё не загрузился), ищем заново не чаще раза в 2 секунды
|
||
if guideScanAt[key] and os.clock() - guideScanAt[key] < 2 then
|
||
return nil
|
||
end
|
||
guideScanAt[key] = os.clock()
|
||
local map = workspace:FindFirstChild("FishingMap")
|
||
if not map then
|
||
return nil
|
||
end
|
||
for _, d in ipairs(map:GetDescendants()) do
|
||
if d:GetAttribute("GuideTarget") == key then
|
||
guideObjects[key] = d
|
||
return d
|
||
end
|
||
end
|
||
return nil
|
||
end
|
||
|
||
-- первый подход к табличке: камера крупно на табличку, управление и весь интерфейс убраны;
|
||
-- кнопка «Далее» плавно возвращает камеру, интерфейс и управление
|
||
local StarterGui = game:GetService("StarterGui")
|
||
local BOARD_CAM_TIME, BOARD_FOV = 0.8, 70
|
||
local boardView = nil
|
||
local closeBoardView
|
||
-- кнопка в отдельном ScreenGui: основной интерфейс на это время выключается целиком
|
||
local boardGui = new("ScreenGui", { Name = "BoardView", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 50, Enabled = false, Parent = player:WaitForChild("PlayerGui") })
|
||
btn({
|
||
Size = UDim2.fromOffset(240, 60), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -40),
|
||
BackgroundColor3 = C.green, Text = "Далее ▶", TextSize = 26, Parent = boardGui,
|
||
}, function()
|
||
closeBoardView()
|
||
end)
|
||
|
||
local function setInterfaceHidden(hidden)
|
||
gui.Enabled = not hidden
|
||
boardGui.Enabled = hidden
|
||
pcall(function()
|
||
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, not hidden)
|
||
end)
|
||
-- надписи над объектами (порталы, лавки) тоже прячем, потом возвращаем как было
|
||
if hidden then
|
||
boardView.billboards = {}
|
||
local map = workspace:FindFirstChild("FishingMap")
|
||
for _, d in ipairs(map and map:GetDescendants() or {}) do
|
||
if d:IsA("BillboardGui") and d.Enabled then
|
||
d.Enabled = false
|
||
table.insert(boardView.billboards, d)
|
||
end
|
||
end
|
||
elseif boardView and boardView.billboards then
|
||
for _, d in ipairs(boardView.billboards) do
|
||
d.Enabled = true
|
||
end
|
||
boardView.billboards = nil
|
||
end
|
||
end
|
||
|
||
local function boardCamStep()
|
||
local bv, cam = boardView, workspace.CurrentCamera
|
||
if not bv or not cam then
|
||
return
|
||
end
|
||
local e = easeInOut(math.min(1, (os.clock() - bv.t0) / BOARD_CAM_TIME))
|
||
cam.CFrame = bv.fromCF:Lerp(bv.toCF, e)
|
||
cam.FieldOfView = bv.fromFov + (bv.toFov - bv.fromFov) * e
|
||
if bv.returning and e >= 1 then
|
||
RunService:UnbindFromRenderStep("BoardCam")
|
||
cam.CameraType = Enum.CameraType.Custom
|
||
setInterfaceHidden(false)
|
||
boardView = nil
|
||
setMovementLocked(false)
|
||
end
|
||
end
|
||
|
||
local function openBoardView(board)
|
||
local cam = workspace.CurrentCamera
|
||
-- отходим ровно настолько, чтобы табличка целиком влезла в кадр (по высоте и по ширине) с небольшим запасом
|
||
local half = math.tan(math.rad(BOARD_FOV / 2))
|
||
local aspect = cam.ViewportSize.X / math.max(1, cam.ViewportSize.Y)
|
||
local dist = math.max((board.Size.Y / 2) / half, (board.Size.X / 2) / (half * aspect)) * 1.15
|
||
boardView = {
|
||
t0 = os.clock(), origCF = cam.CFrame, origFov = cam.FieldOfView,
|
||
fromCF = cam.CFrame, fromFov = cam.FieldOfView,
|
||
-- надписи на лицевой стороне (Front), она смотрит по LookVector
|
||
toCF = CFrame.lookAt(board.Position + board.CFrame.LookVector * dist, board.Position), toFov = BOARD_FOV,
|
||
}
|
||
setMovementLocked(true)
|
||
setInterfaceHidden(true)
|
||
cam.CameraType = Enum.CameraType.Scriptable
|
||
RunService:UnbindFromRenderStep("BoardCam")
|
||
RunService:BindToRenderStep("BoardCam", Enum.RenderPriority.Camera.Value + 1, boardCamStep)
|
||
end
|
||
|
||
closeBoardView = function()
|
||
local cam = workspace.CurrentCamera
|
||
if not boardView or boardView.returning or not cam then
|
||
return
|
||
end
|
||
boardGui.Enabled = false -- кнопка пропадает сразу, остальной интерфейс — когда камера вернётся
|
||
boardView.returning = true
|
||
boardView.t0 = os.clock()
|
||
boardView.fromCF, boardView.fromFov = cam.CFrame, cam.FieldOfView
|
||
boardView.toCF, boardView.toFov = boardView.origCF, boardView.origFov
|
||
advanceTutorial(1)
|
||
end
|
||
|
||
-- скупка «Тихого озера»: ведём к прилавку с подсказкой «Продать» внутри лавки (GuideTarget = "Sell"),
|
||
-- поэтому стрелка идёт за лавкой, куда бы её ни переставили; маркер GuideSell — запасной вариант
|
||
local function sellTargetW1()
|
||
local shop = guideObject("Sell")
|
||
if shop then
|
||
for _, d in ipairs(shop:GetDescendants()) do
|
||
if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then
|
||
local p = d.Parent
|
||
local at = (p:IsA("BasePart") and p.Position) or (p:IsA("Attachment") and p.WorldPosition)
|
||
if at then
|
||
return at
|
||
end
|
||
end
|
||
end
|
||
return shop:IsA("Model") and shop:GetPivot().Position or shop.Position
|
||
end
|
||
return guideMarker("GuideSell")
|
||
end
|
||
|
||
-- маршрут для текущего шага: точки ломаной (без игрока), подсказка и что подсветить; nil — линию не показываем
|
||
local function guideRoute(step, pos, world)
|
||
local inW1 = world and world.id == "World1"
|
||
if step == 0 and not world then
|
||
return { guideMarker("GuideBoard") }, "📋 Прочитай табличку", "Board"
|
||
elseif not world then -- шаги 1–3 из лобби: сначала в портал
|
||
return { guideMarker("GuidePortal") }, "🌊 Иди в портал", "Portal"
|
||
elseif step == 2 and inW1 then
|
||
return { guideMarker("GuideFishSpot") }, "🎣 Зажми ЛКМ у воды", "Pier"
|
||
elseif step == 3 and inW1 then
|
||
return { sellTargetW1() }, "💰 Продай рыбу", "Sell" -- лавка у самого причала, идём напрямую
|
||
end
|
||
return nil
|
||
end
|
||
|
||
-- ближайшая скупка в этом мире (или в лобби): прилавки с ProximityPrompt Action = "Sell"
|
||
local nearestSell
|
||
do
|
||
local sellSpots, sellScanAt = {}, -math.huge
|
||
nearestSell = function(pos, world)
|
||
if #sellSpots == 0 and os.clock() - sellScanAt > 3 then
|
||
sellScanAt = os.clock()
|
||
local map = workspace:FindFirstChild("FishingMap")
|
||
for _, d in ipairs(map and map:GetDescendants() or {}) do
|
||
if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then
|
||
local p = d.Parent
|
||
local at = (p:IsA("BasePart") and p.Position) or (p:IsA("Attachment") and p.WorldPosition) or (p:IsA("Model") and p:GetPivot().Position)
|
||
if at then
|
||
table.insert(sellSpots, at)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
local best, bestD = nil, nil
|
||
for _, at in ipairs(sellSpots) do
|
||
if Config.WorldAt(at) == world then
|
||
local d = (at - pos).Magnitude
|
||
if not bestD or d < bestD then
|
||
best, bestD = at, d
|
||
end
|
||
end
|
||
end
|
||
return best
|
||
end
|
||
end
|
||
|
||
RunService.RenderStepped:Connect(function()
|
||
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||
local step = tutorialStep()
|
||
-- пока сервер не прислал шаг (данные ещё грузятся), обучение не показываем;
|
||
-- после обучения линия ведёт к скупщику, когда сумка полна
|
||
local tutorialOn = player:GetAttribute("Tutorial") ~= nil and step < Config.TutorialDone
|
||
local bagFull = (player:GetAttribute("BagCount") or 0) >= (player:GetAttribute("BagCap") or math.huge)
|
||
if not hrp or not (tutorialOn or bagFull) then
|
||
guideHint.Visible = false
|
||
guideHighlight.Enabled = false
|
||
hideChevrons(1)
|
||
return
|
||
end
|
||
if boardView then -- смотрим на табличку: ни линии, ни подсказок
|
||
guideHint.Visible = false
|
||
guideHighlight.Enabled = false
|
||
hideChevrons(1)
|
||
return
|
||
end
|
||
local pos = hrp.Position
|
||
local world = Config.WorldAt(pos)
|
||
|
||
-- переходы между шагами
|
||
if not tutorialOn then
|
||
-- обучение пройдено, остаётся только дорога к скупщику
|
||
elseif step <= 1 and world and world.id == "World1" then
|
||
advanceTutorial(2)
|
||
elseif step == 0 then
|
||
local board = guideMarker("GuideBoard")
|
||
if board and (board - pos).Magnitude < 9 and state == "idle" then
|
||
local obj = guideObject("Board")
|
||
if obj then
|
||
openBoardView(obj) -- шаг засчитается по кнопке «Далее»
|
||
return
|
||
end
|
||
advanceTutorial(1)
|
||
end
|
||
elseif step == 2 and (player:GetAttribute("TotalCaught") or 0) > 0 then
|
||
advanceTutorial(3)
|
||
end
|
||
step = tutorialStep()
|
||
|
||
local route, hint, key
|
||
if tutorialOn then
|
||
route, hint, key = guideRoute(step, pos, world)
|
||
end
|
||
if not route and bagFull then
|
||
local inW1 = world and world.id == "World1"
|
||
local at = (inW1 and sellTargetW1()) or nearestSell(pos, world)
|
||
route, hint, key = at and { at } or nil, "🎒 Сумка полна — продай рыбу!", inW1 and "Sell" or nil
|
||
end
|
||
guideHintText.Text = hint or ""
|
||
local showHint = hint ~= nil and state == "idle"
|
||
if showHint and (hint ~= lastHint or not guideHint.Visible) then
|
||
popIn(guideHint, 0.5)
|
||
end
|
||
lastHint = hint
|
||
guideHint.Visible = showHint
|
||
local target = (key and state == "idle") and guideObject(key) or nil
|
||
guideHighlight.Adornee = target or nil
|
||
guideHighlight.Enabled = target ~= nil
|
||
if target then
|
||
local pulse = (math.sin(os.clock() * 4) + 1) / 2 -- мягкое мигание
|
||
guideHighlight.FillTransparency = 0.86 + 0.1 * pulse -- лёгкое «дыхание», цвет объекта виден
|
||
guideHighlight.OutlineTransparency = 0.1 + 0.45 * pulse
|
||
end
|
||
if not route or #route == 0 or state ~= "idle" then
|
||
hideChevrons(1)
|
||
return
|
||
end
|
||
|
||
-- ломаная от ног игрока через точки маршрута
|
||
local pts = { pos - Vector3.new(0, 3, 0) }
|
||
for _, p in ipairs(route) do
|
||
table.insert(pts, p)
|
||
end
|
||
local lens, total = {}, 0
|
||
for i = 2, #pts do
|
||
local d = ((pts[i] - pts[i - 1]) * Vector3.new(1, 0, 1)).Magnitude
|
||
lens[i] = math.max(d, 0.001)
|
||
total += d
|
||
end
|
||
if total < 4 then
|
||
hideChevrons(1) -- уже на месте
|
||
return
|
||
end
|
||
|
||
guideRay.FilterDescendantsInstances = { player.Character, guideFolder }
|
||
local phase = (os.clock() * GUIDE_SPEED) % GUIDE_GAP
|
||
local seg, segStart = 2, 0
|
||
for i = 1, GUIDE_N do
|
||
local d = 2 + phase + (i - 1) * GUIDE_GAP
|
||
if d > total - 1 then
|
||
hideChevrons(i)
|
||
break
|
||
end
|
||
while seg < #pts and d > segStart + lens[seg] do
|
||
segStart += lens[seg]
|
||
seg += 1
|
||
end
|
||
local a, b = pts[seg - 1], pts[seg]
|
||
local p = a:Lerp(b, (d - segStart) / lens[seg])
|
||
local dir = (b - a) * Vector3.new(1, 0, 1)
|
||
local hit = workspace:Raycast(p + Vector3.new(0, 4, 0), Vector3.new(0, -12, 0), guideRay)
|
||
-- висят в воздухе и слегка покачиваются волной
|
||
local y = (hit and hit.Position.Y or p.Y) + GUIDE_HEIGHT + math.sin(os.clock() * 4 - d * 0.5) * 0.25
|
||
local base = CFrame.lookAt(Vector3.new(p.X, y, p.Z), Vector3.new(p.X, y, p.Z) + dir)
|
||
-- у игрока и у цели стрелки плавно проявляются и гаснут
|
||
local fade = math.max(0, 1 - math.min(d - 2, total - 1 - d) / 2.5)
|
||
local tr = 0.05 + 0.95 * fade
|
||
for k = 1, 2 do
|
||
chevrons[i][k].CFrame = base * ARM_CF[k]
|
||
chevrons[i][k].Transparency = tr
|
||
end
|
||
end
|
||
end)
|
||
|
||
---------------------------------------------------------------- цели на экране: серия, трекер, босс, покупка у скупщика
|
||
-- в отдельной функции: у основного скрипта почти исчерпан лимит в 200 локальных переменных
|
||
|
||
local refreshTracker, bestOffer, showOffer
|
||
local offerState = { bagWasFull = false } -- была ли сумка полной перед продажей (тогда первым предлагаем сумку побольше)
|
||
;(function()
|
||
local CENTER = Enum.TextXAlignment.Center
|
||
local RIGHT = Enum.TextXAlignment.Right
|
||
local FIRE = Color3.fromRGB(255, 150, 60)
|
||
|
||
-- серия улова — справа от HUD; полоска показывает, сколько осталось до того, как серия сгорит
|
||
local comboBox = new("Frame", {
|
||
Size = UDim2.fromOffset(140, 66), Position = UDim2.fromOffset(310, 10), BackgroundColor3 = WHITE, Visible = false, Parent = gui,
|
||
}, { corner(14), stroke(FIRE, 2, 0.1), gradient(Color3.fromRGB(110, 50, 20), C.bg, 90) })
|
||
local comboMultText = text({ Size = UDim2.new(1, 0, 0, 34), Position = UDim2.fromOffset(0, 3), Font = TITLE, TextSize = 28, TextXAlignment = CENTER, TextColor3 = Color3.fromRGB(255, 195, 95), TextStrokeTransparency = 0.5, Text = "", Parent = comboBox })
|
||
local comboSub = text({ Size = UDim2.new(1, 0, 0, 16), Position = UDim2.fromOffset(0, 36), Font = BODY2, TextSize = 12, TextXAlignment = CENTER, TextColor3 = C.muted, Text = "", Parent = comboBox })
|
||
local comboBack = new("Frame", { Size = UDim2.new(1, -20, 0, 5), Position = UDim2.new(0, 10, 1, -10), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = comboBox }, { corner(3) })
|
||
local comboFill = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = FIRE, BorderSizePixel = 0, Parent = comboBack }, { corner(3) })
|
||
|
||
local function refreshCombo(pop)
|
||
local n = player:GetAttribute("Combo") or 0
|
||
comboBox.Visible = n > 0
|
||
if n > 0 then
|
||
-- множитель следующей рыбы (сервер считает так же)
|
||
comboMultText.Text = ("🔥 x%.1f"):format(math.min(Config.Combo.max, 1 + Config.Combo.step * n))
|
||
comboSub.Text = ("серия %d · не упусти!"):format(n)
|
||
if pop then
|
||
popIn(comboBox, 0.6)
|
||
end
|
||
end
|
||
end
|
||
player:GetAttributeChangedSignal("Combo"):Connect(function()
|
||
refreshCombo(true)
|
||
end)
|
||
refreshCombo(false)
|
||
|
||
-- правая колонка: босс и цели
|
||
local rightCol = new("Frame", {
|
||
Size = UDim2.fromOffset(300, 0), AutomaticSize = Enum.AutomaticSize.Y, AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 10),
|
||
BackgroundTransparency = 1, Parent = gui,
|
||
}, { new("UIListLayout", { Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) })
|
||
|
||
local bossBox = new("Frame", { Size = UDim2.fromOffset(300, 78), BackgroundColor3 = WHITE, Visible = false, LayoutOrder = 1, Parent = rightCol },
|
||
{ corner(14), stroke(C.red, 2.5, 0.05), gradient(Color3.fromRGB(110, 30, 40), C.bg, 90) })
|
||
local bossTitle = text({ Size = UDim2.new(1, -80, 0, 24), Position = UDim2.fromOffset(12, 5), Font = TITLE, TextSize = 18, TextColor3 = Color3.fromRGB(255, 205, 120), TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = bossBox })
|
||
local bossTime = text({ Size = UDim2.fromOffset(60, 24), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 5), Font = TITLE, TextSize = 17, TextXAlignment = RIGHT, Text = "", Parent = bossBox })
|
||
local bossBack = new("Frame", { Size = UDim2.new(1, -24, 0, 18), Position = UDim2.fromOffset(12, 32), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = bossBox }, { corner(9) })
|
||
local bossFill = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = WHITE, Parent = bossBack }, { corner(9), gradient(Color3.fromRGB(255, 120, 90), Color3.fromRGB(190, 30, 50), 0) })
|
||
local bossHpText = text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = CENTER, ZIndex = 2, TextStrokeTransparency = 0.5, Text = "", Parent = bossBack })
|
||
local bossHint = text({ Size = UDim2.new(1, -24, 0, 18), Position = UDim2.fromOffset(12, 54), Font = BODY2, TextSize = 12, TextColor3 = C.muted, Text = "", Parent = bossBox })
|
||
|
||
local tracker = new("Frame", { Size = UDim2.fromOffset(300, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundColor3 = WHITE, LayoutOrder = 2, Parent = rightCol }, {
|
||
corner(14), stroke(C.line, 2, 0.35), gradient(C.panel2, C.bg, 90),
|
||
new("UIPadding", { PaddingLeft = UDim.new(0, 12), PaddingRight = UDim.new(0, 12), PaddingTop = UDim.new(0, 8), PaddingBottom = UDim.new(0, 10) }),
|
||
new("UIListLayout", { Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder }),
|
||
})
|
||
text({ Size = UDim2.new(1, 0, 0, 20), LayoutOrder = 0, Font = TITLE, TextSize = 16, TextColor3 = C.muted, Text = "🎯 Цели", Parent = tracker })
|
||
|
||
local function trackerLine(order, onClick)
|
||
local root = new("TextButton", { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1, AutoButtonColor = false, Text = "", LayoutOrder = order, Parent = tracker })
|
||
local label = text({ Size = UDim2.new(1, 0, 0, 22), Font = BODY, TextSize = 14, RichText = true, TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = root })
|
||
local back = new("Frame", { Size = UDim2.new(1, 0, 0, 8), Position = UDim2.fromOffset(0, 26), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = root }, { corner(4) })
|
||
local fill = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = C.gold, BorderSizePixel = 0, Parent = back }, { corner(4) })
|
||
if onClick then
|
||
root.MouseButton1Click:Connect(onClick)
|
||
end
|
||
return { root = root, label = label, back = back, fill = fill }
|
||
end
|
||
local function setLine(line, txt, frac, color)
|
||
line.root.Visible = txt ~= nil
|
||
if not txt then
|
||
return
|
||
end
|
||
line.label.Text = txt
|
||
line.back.Visible = frac ~= nil
|
||
line.root.Size = UDim2.new(1, 0, 0, frac and 38 or 22)
|
||
if frac then
|
||
line.fill.Size = UDim2.fromScale(math.clamp(frac, 0, 1), 1)
|
||
line.fill.BackgroundColor3 = color or C.gold
|
||
end
|
||
end
|
||
|
||
local questLine = trackerLine(1, function()
|
||
questWin.open("quests")
|
||
end)
|
||
local buyLine = trackerLine(2, function()
|
||
shopWin.open("rods")
|
||
end)
|
||
local dexLine = trackerLine(3, function()
|
||
bagWin.open("dex")
|
||
end)
|
||
local bagLine = trackerLine(4, function()
|
||
bagWin.open("fish")
|
||
end)
|
||
|
||
local function plural(n, one, few, many)
|
||
local m10, m100 = n % 10, n % 100
|
||
if m10 == 1 and m100 ~= 11 then
|
||
return one
|
||
elseif m10 >= 2 and m10 <= 4 and (m100 < 12 or m100 > 14) then
|
||
return few
|
||
end
|
||
return many
|
||
end
|
||
|
||
-- ближайшая покупка: следующая удочка, а когда все куплены — улучшение текущей
|
||
local function buyGoal()
|
||
local coins, lvl = player:GetAttribute("Coins") or 0, player:GetAttribute("Level") or 1
|
||
local owned = attrSet("OwnedRods")
|
||
for _, r in ipairs(Config.Rods) do
|
||
if not owned[r.id] then
|
||
if lvl < r.level then
|
||
return ("🎣 %s · 🔒 нужен ур. %d"):format(r.name, r.level), lvl / r.level, C.blue
|
||
elseif coins >= r.price then
|
||
return ("🎣 <b>%s</b> — можно купить!"):format(r.name), 1, C.green
|
||
end
|
||
return ("🎣 До «%s»: ещё <b>%s</b> 💰"):format(r.name, fmt(r.price - coins)), coins / r.price, C.gold
|
||
end
|
||
end
|
||
local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic")
|
||
local rl = player:GetAttribute("RodLevel") or 0
|
||
if rod and rl < Config.RodUpgrade.maxLevel then
|
||
local cost = Config.UpgradeCost(rod, rl)
|
||
if coins >= cost then
|
||
return ("✨ Улучшение до +%d — можно купить!"):format(rl + 1), 1, C.green
|
||
end
|
||
return ("✨ До улучшения +%d: ещё <b>%s</b> 💰"):format(rl + 1, fmt(cost - coins)), coins / cost, C.gold
|
||
end
|
||
return nil
|
||
end
|
||
|
||
-- коллекция текущего мира: ближайшая незакрытая редкость
|
||
local function dexGoal()
|
||
local w = currentWorld() or Config.Worlds[1]
|
||
local zone = Config.Zones[w.id]
|
||
if not zone then
|
||
return nil
|
||
end
|
||
for _, rarity in ipairs(Config.RarityOrder) do
|
||
local total, found, missing = 0, 0, {}
|
||
for _, f in ipairs(zone.fish) do
|
||
if f.rarity == rarity then
|
||
total += 1
|
||
if discovered[f.id] then
|
||
found += 1
|
||
else
|
||
table.insert(missing, f.name)
|
||
end
|
||
end
|
||
end
|
||
if total > 0 and not claimed[w.id .. ":" .. rarity] then
|
||
local r = Config.Rarities[rarity]
|
||
if found >= total then
|
||
return ("📖 Награда за «%s» ждёт! (C)"):format(r.name), 1, C.green
|
||
end
|
||
local left = total - found
|
||
local what = left == 1 and ("осталась <b>%s</b>"):format(missing[1]) or ("ещё %d %s"):format(left, plural(left, "вид", "вида", "видов"))
|
||
return ("📖 «%s»: %s"):format(r.name, what), found / total, r.color
|
||
end
|
||
end
|
||
return nil
|
||
end
|
||
|
||
local lastQuestKey = nil
|
||
refreshTracker = function()
|
||
if chain and chain.steps[chain.step] then
|
||
local st = chain.steps[chain.step]
|
||
setLine(questLine, ("📜 %s · <b>%s/%s</b>"):format(questText(st.kind, st.goal), fmt(chain.progress), fmt(st.goal)), chain.progress / st.goal, C.gold)
|
||
local key = chain.name .. chain.step
|
||
if key ~= lastQuestKey then
|
||
if lastQuestKey then
|
||
popIn(questLine.root, 0.6)
|
||
end
|
||
lastQuestKey = key
|
||
end
|
||
else
|
||
setLine(questLine, nil)
|
||
end
|
||
setLine(buyLine, buyGoal())
|
||
setLine(dexLine, dexGoal())
|
||
local count, cap = player:GetAttribute("BagCount") or 0, player:GetAttribute("BagCap") or 10
|
||
if count >= cap then
|
||
setLine(bagLine, ("<font color=\"#FF8080\">🎒 Сумка полна — продай рыбу!</font>"), 1, C.red)
|
||
elseif count >= cap * 0.75 then
|
||
setLine(bagLine, ("🎒 Сумка почти полна: %d / %d"):format(count, cap), count / cap, Color3.fromRGB(255, 170, 80))
|
||
else
|
||
setLine(bagLine, nil)
|
||
end
|
||
end
|
||
task.spawn(function()
|
||
while true do
|
||
refreshTracker()
|
||
task.wait(0.5)
|
||
end
|
||
end)
|
||
|
||
-- босс: полоска здоровья и таймер
|
||
local function bossWorld()
|
||
local id = workspace:GetAttribute("BossWorld")
|
||
return id and Config.Find(Config.Worlds, id)
|
||
end
|
||
RunService.RenderStepped:Connect(function()
|
||
if comboBox.Visible then
|
||
local ends = player:GetAttribute("ComboEnds")
|
||
local left = ends and (ends - workspace:GetServerTimeNow()) or 0
|
||
comboFill.Size = UDim2.fromScale(math.clamp(left / Config.Combo.timeout, 0, 1), 1)
|
||
comboFill.BackgroundColor3 = left < 15 and C.red or FIRE
|
||
end
|
||
local bw = bossWorld()
|
||
bossBox.Visible = bw ~= nil
|
||
if bw then
|
||
local hp, max = workspace:GetAttribute("BossHP") or 0, math.max(1, workspace:GetAttribute("BossMax") or 1)
|
||
bossTitle.Text = "👑 " .. (workspace:GetAttribute("BossName") or "Босс")
|
||
bossTime.Text = timeStr((workspace:GetAttribute("BossEnds") or 0) - workspace:GetServerTimeNow())
|
||
bossFill.Size = UDim2.fromScale(math.clamp(hp / max, 0, 1), 1)
|
||
bossHpText.Text = ("%d / %d"):format(hp, max)
|
||
local here = currentWorld()
|
||
bossHint.Text = (here and here.id == bw.id) and "Лови рыбу — каждая бьёт босса! Редкие сильнее" or ("Он в мире «%s» — жми M"):format(bw.name)
|
||
end
|
||
end)
|
||
|
||
-- босс в воде: огромная рыба кружит по озеру и выпрыгивает (у каждого игрока своя копия, только для вида)
|
||
local bossModel, bossModelWorld = nil, nil
|
||
local function bossPath(world)
|
||
if world.lakes and not world.holes then
|
||
local l = world.lakes[1]
|
||
return world.center + Vector3.new(l[1], 0, l[2]), l[3] * 0.5
|
||
elseif world.sea then
|
||
return world.center, world.sea + 35
|
||
end
|
||
return nil -- Мир 3: босс подо льдом, его не видно
|
||
end
|
||
RunService.Heartbeat:Connect(function()
|
||
local bw = bossWorld()
|
||
local id = bw and bw.id
|
||
if id ~= bossModelWorld then
|
||
if bossModel then
|
||
bossModel:Destroy()
|
||
bossModel = nil
|
||
end
|
||
bossModelWorld = id
|
||
local def = id and Config.Boss.worlds[id]
|
||
if def and bossPath(bw) then
|
||
bossModel = Models.buildFish(def.fish, def.mutation, def.scale, true)
|
||
for _, p in ipairs(bossModel:GetDescendants()) do
|
||
if p:IsA("BasePart") then
|
||
p.CanCollide, p.CanQuery, p.CanTouch = false, false, false
|
||
end
|
||
end
|
||
bossModel.Name = "LakeBoss"
|
||
bossModel.Parent = workspace
|
||
end
|
||
end
|
||
if bossModel then
|
||
local center, r = bossPath(bw)
|
||
local a = os.clock() * 0.35
|
||
local pos = center + Vector3.new(math.cos(a) * r, (bw.waterY or 0) - 0.8, math.sin(a) * r)
|
||
local jump = os.clock() % 7
|
||
if jump < 1.4 then
|
||
pos += Vector3.new(0, math.sin(jump / 1.4 * math.pi) * 9, 0)
|
||
end
|
||
local dir = Vector3.new(-math.sin(a), 0, math.cos(a))
|
||
-- голова рыбы смотрит в +X модели, поэтому разворачиваем на 90°
|
||
bossModel:PivotTo(CFrame.lookAt(pos, pos + dir) * CFrame.Angles(0, math.rad(90), 0))
|
||
end
|
||
end)
|
||
|
||
-- у скупщика после продажи: предложение купить то, на что уже хватает
|
||
local offerCard = new("Frame", {
|
||
Size = UDim2.fromOffset(440, 96), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -110),
|
||
BackgroundColor3 = WHITE, Visible = false, Parent = gui,
|
||
}, { corner(16), stroke(C.green, 2.5, 0.05), gradient(Color3.fromRGB(30, 85, 55), C.bg, 90) })
|
||
local offerIcon = text({ Size = UDim2.fromOffset(70, 70), Position = UDim2.fromOffset(12, 13), TextSize = 46, TextXAlignment = CENTER, Text = "", Parent = offerCard })
|
||
local offerTitle = text({ Size = UDim2.new(1, -250, 0, 26), Position = UDim2.fromOffset(90, 12), Font = TITLE, TextSize = 19, TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = offerCard })
|
||
local offerDesc = text({ Size = UDim2.new(1, -250, 0, 44), Position = UDim2.fromOffset(90, 40), Font = BODY2, TextSize = 13, TextColor3 = C.muted, TextWrapped = true, TextYAlignment = Enum.TextYAlignment.Top, Text = "", Parent = offerCard })
|
||
local offerItem, offerToken = nil, 0
|
||
local function hideOffer()
|
||
offerCard.Visible = false
|
||
offerItem = nil
|
||
end
|
||
local offerBuy = btn({ Size = UDim2.fromOffset(146, 52), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -14, 0.5, 0), BackgroundColor3 = C.green, TextSize = 18, Text = "", Parent = offerCard }, function()
|
||
if offerItem then
|
||
remote:FireServer("Buy", offerItem.kind, offerItem.id)
|
||
Audio.play("coins")
|
||
end
|
||
hideOffer()
|
||
end)
|
||
btn({ Size = UDim2.fromOffset(26, 26), Position = UDim2.new(1, -18, 0, -8), BackgroundColor3 = C.red, Text = "✕", TextSize = 14, Parent = offerCard }, hideOffer)
|
||
|
||
bestOffer = function(bagWasFull)
|
||
local coins, lvl = player:GetAttribute("Coins") or 0, player:GetAttribute("Level") or 1
|
||
local options = {}
|
||
local bag = Config.Find(Config.Bags, player:GetAttribute("Bag") or "Pouch")
|
||
local ownedBags = attrSet("OwnedBags")
|
||
for _, b in ipairs(Config.Bags) do
|
||
if not ownedBags[b.id] and b.capacity > (bag and bag.capacity or 0) and lvl >= b.level and coins >= b.price then
|
||
table.insert(options, { kind = "Bag", id = b.id, icon = "🎒", title = b.name, price = b.price, prio = bagWasFull and 3 or 1,
|
||
desc = ("%d мест вместо %d — реже бегать к скупщику"):format(b.capacity, bag and bag.capacity or 0) })
|
||
break
|
||
end
|
||
end
|
||
local ownedRods = attrSet("OwnedRods")
|
||
local bestRod = nil
|
||
for _, r in ipairs(Config.Rods) do
|
||
if not ownedRods[r.id] and lvl >= r.level and coins >= r.price then
|
||
bestRod = r -- удочки по возрастанию цены: берём самую сильную из доступных
|
||
end
|
||
end
|
||
if bestRod then
|
||
table.insert(options, { kind = "Rod", id = bestRod.id, icon = "🎣", title = bestRod.name, price = bestRod.price, prio = 2,
|
||
desc = ("Удача +%d%%, клюёт быстрее, шире зелёная зона"):format(bestRod.luck * 100) })
|
||
end
|
||
local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic")
|
||
local rl = player:GetAttribute("RodLevel") or 0
|
||
if rod and rl < Config.RodUpgrade.maxLevel then
|
||
local cost = Config.UpgradeCost(rod, rl)
|
||
if coins >= cost then
|
||
table.insert(options, { kind = "Upgrade", id = rod.id, icon = "✨", title = ("%s +%d"):format(rod.name, rl + 1), price = cost, prio = 1.5,
|
||
desc = "Больше удачи и шире зелёная зона" })
|
||
end
|
||
end
|
||
local potion = Config.Potions[1]
|
||
if coins >= potion.price and (player:GetAttribute("BoostBonus") or 0) == 0 then
|
||
table.insert(options, { kind = "Potion", id = potion.id, icon = "🧪", title = potion.name, price = potion.price, prio = 0.5,
|
||
desc = ("+%d%% удачи на %d мин"):format(potion.bonus * 100, potion.duration / 60) })
|
||
end
|
||
table.sort(options, function(x, y)
|
||
return x.prio > y.prio
|
||
end)
|
||
return options[1]
|
||
end
|
||
|
||
showOffer = function(o)
|
||
offerToken += 1
|
||
local my = offerToken
|
||
offerItem = o
|
||
offerIcon.Text = o.icon
|
||
offerTitle.Text = o.title
|
||
offerDesc.Text = o.desc
|
||
offerBuy.Text = ("Купить · %s 💰"):format(fmt(o.price))
|
||
offerCard.Visible = true
|
||
popIn(offerCard, 0.6)
|
||
task.delay(9, function()
|
||
if my == offerToken then
|
||
hideOffer()
|
||
end
|
||
end)
|
||
end
|
||
|
||
player:GetAttributeChangedSignal("BagCount"):Connect(function()
|
||
if (player:GetAttribute("BagCount") or 0) >= (player:GetAttribute("BagCap") or math.huge) then
|
||
offerState.bagWasFull = true
|
||
end
|
||
end)
|
||
end)()
|
||
|
||
---------------------------------------------------------------- события от сервера
|
||
|
||
remote.OnClientEvent:Connect(function(action, a, b, c, d)
|
||
if action == "Notify" then
|
||
notify(a, b)
|
||
elseif action == "TeleportFade" then
|
||
teleportLoading(a, b)
|
||
elseif action == "Cast" then
|
||
Audio.play("cast")
|
||
setState("waiting")
|
||
startCastCam(a, b)
|
||
elseif action == "CastFail" or action == "Cancel" or action == "Escaped" then
|
||
if action == "Escaped" then
|
||
Audio.play("escape")
|
||
end
|
||
if action == "CastFail" and castTool and castTool.Parent then
|
||
castTool.Grip = gripCF(REST_ANGLE) -- сервер удочку не трогал, а у нас она в замахе
|
||
end
|
||
setState("idle")
|
||
elseif action == "Bite" then
|
||
mg.speed = a.speed
|
||
mg.zoneWidth = a.zoneWidth
|
||
mg.need = a.hits
|
||
mg.hits = 0
|
||
mg.misses = 0
|
||
mg.maxMisses = a.misses
|
||
mg.timeout = a.timeout
|
||
mg.deadline = os.clock() + a.timeout
|
||
mg.pos, mg.dir = 0, 1
|
||
placeZone()
|
||
updatePips()
|
||
Audio.play("bite")
|
||
setState("bite")
|
||
elseif action == "Caught" then
|
||
setState("idle")
|
||
showCatch(a, b)
|
||
Audio.play("catchSplash")
|
||
local r = Config.Rarities[a.rarity]
|
||
Audio.play((r and r.rank >= 4) and "fanfare" or "catch")
|
||
if a.mutation then
|
||
Audio.play("sparkle")
|
||
end
|
||
elseif action == "Sold" then
|
||
Audio.play("coins")
|
||
if tutorialStep() == 3 then
|
||
advanceTutorial(Config.TutorialDone)
|
||
end
|
||
floatText("+" .. fmt(a) .. " 💰", C.gold)
|
||
notify(("💰 +%s"):format(fmt(a)), Color3.fromRGB(120, 255, 140))
|
||
-- монеты приходят атрибутом чуть позже события, поэтому предложение — с задержкой
|
||
local wasFull = offerState.bagWasFull
|
||
offerState.bagWasFull = false
|
||
-- продать можно и с заброшенной удочкой; не мешаем только мини-игре поклёвки (она тоже внизу экрана)
|
||
task.delay(0.5, function()
|
||
local t0 = os.clock()
|
||
while state == "bite" and os.clock() - t0 < 10 do
|
||
task.wait(0.3)
|
||
end
|
||
local o = state ~= "bite" and bestOffer(wasFull)
|
||
if o then
|
||
showOffer(o)
|
||
end
|
||
end)
|
||
elseif action == "Inventory" then
|
||
inventory = a or {}
|
||
discovered = b or {}
|
||
claimed = c or {}
|
||
bagWin.refresh()
|
||
refreshDots()
|
||
refreshTracker()
|
||
elseif action == "Quests" then
|
||
chain = a
|
||
daily = b or daily
|
||
questWin.refresh()
|
||
refreshDots()
|
||
refreshTracker()
|
||
elseif action == "QuestDone" then
|
||
notify(("✅ %s +%s 💰 +%s XP"):format(questText(a, b), fmt(c), fmt(d or 0)), Color3.fromRGB(120, 255, 140))
|
||
Audio.play("quest")
|
||
elseif action == "ChainDone" then
|
||
floatText("🏆 Цепочка пройдена!", C.gold)
|
||
notify(("🎁 %s: +%s 💰 +%s XP%s"):format(a, fmt(b), fmt(c), d and (" + " .. d) or ""), C.gold)
|
||
Audio.play("fanfare")
|
||
elseif action == "ComboLost" then
|
||
notify(("💔 Серия из %d прервана"):format(a), Color3.fromRGB(255, 130, 110))
|
||
elseif action == "BossStart" then
|
||
notify(("👑 %s в мире «%s»! Ловите всем сервером"):format(a, b), C.gold)
|
||
Audio.play("quest")
|
||
elseif action == "BossHit" then
|
||
floatText(("⚔ -%d боссу"):format(a), Color3.fromRGB(255, 130, 100))
|
||
elseif action == "BossDone" then
|
||
if a then
|
||
notify(("🏆 %s пойман всем сервером!%s"):format(b, c and (" Лучший: " .. c) or ""), C.gold)
|
||
else
|
||
notify(("🌊 %s ушёл на глубину…"):format(b), C.muted)
|
||
end
|
||
elseif action == "BossReward" then
|
||
notify(("🎁 За босса: +%s 💰 +%s XP%s"):format(fmt(a), fmt(b), c and (" + " .. c) or ""), Color3.fromRGB(120, 255, 140))
|
||
elseif action == "OpenShop" then
|
||
shopWin.open("rods")
|
||
elseif action == "OpenQuests" then
|
||
questWin.open("daily")
|
||
elseif action == "OpenRobux" then
|
||
robuxWin.open(a)
|
||
end
|
||
end)
|
||
|
||
remote:FireServer("RequestInventory")
|
||
]=====])
|
||
put('LocalScript', 'Loading', game.ReplicatedFirst, [=====[-- Loading (LocalScript) -> ReplicatedFirst
|
||
-- Экран загрузки. Закрывает картинку при входе в игру и при каждом телепорте: игрок уже стоит на месте,
|
||
-- сцена прогружается, клиент ставит свет локации — и только потом экран плавно уходит.
|
||
--
|
||
-- FishingClient управляет экраном через атрибуты ScreenGui «LoadingScreen»:
|
||
-- Visible = true — показать (при телепорте);
|
||
-- Ready = true — свет и террейн локации выставлены;
|
||
-- StartAt / MinUntil — os.clock() начала и минимального конца показа (полоска заполняется за это время);
|
||
-- Title — подпись под названием игры (куда идём).
|
||
-- Экран уходит, когда Ready = true и минимальное время прошло.
|
||
|
||
local Players = game:GetService("Players")
|
||
local ReplicatedFirst = game:GetService("ReplicatedFirst")
|
||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||
local RunService = game:GetService("RunService")
|
||
local TweenService = game:GetService("TweenService")
|
||
|
||
local player = Players.LocalPlayer
|
||
pcall(function() ReplicatedFirst:RemoveDefaultLoadingScreen() end)
|
||
|
||
local GOLD = Color3.fromRGB(255, 205, 90)
|
||
local TIPS = {
|
||
"Чем реже рыба, тем быстрее бегает метка — нужна точность!",
|
||
"Улучшай удочку в магазине: рыба клюёт быстрее, удача выше.",
|
||
"Собери все виды одной редкости — получишь награду в коллекции (C).",
|
||
"Каждый день заходи за наградой из сундука в лобби.",
|
||
"Новые миры открываются с уровнем: следи за опытом!",
|
||
}
|
||
|
||
local function new(class, props)
|
||
local o = Instance.new(class)
|
||
for k, v in pairs(props) do
|
||
if k ~= "Parent" then
|
||
o[k] = v
|
||
end
|
||
end
|
||
o.Parent = props.Parent
|
||
return o
|
||
end
|
||
|
||
local gui = new("ScreenGui", {
|
||
Name = "LoadingScreen", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 200,
|
||
ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = player:WaitForChild("PlayerGui"),
|
||
})
|
||
-- фон: арт лобби (временная заглушка); пока картинка грузится, виден тёплый закатный градиент
|
||
local BG_IMAGE = "rbxassetid://118616665961176"
|
||
local root = new("CanvasGroup", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.fromRGB(255, 190, 120), BorderSizePixel = 0, Parent = gui })
|
||
new("UIGradient", {
|
||
Rotation = 90,
|
||
Color = ColorSequence.new(Color3.fromRGB(120, 200, 255), Color3.fromRGB(255, 170, 110)),
|
||
Parent = root,
|
||
})
|
||
local bg = new("ImageLabel", {
|
||
Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, Image = BG_IMAGE,
|
||
ScaleType = Enum.ScaleType.Crop, Parent = root,
|
||
})
|
||
task.spawn(function()
|
||
pcall(function() game:GetService("ContentProvider"):PreloadAsync({ bg }) end)
|
||
end)
|
||
|
||
-- плашка снизу: куда идём, полоска загрузки, совет
|
||
local panel = new("Frame", {
|
||
AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -28), Size = UDim2.fromOffset(560, 118),
|
||
BackgroundColor3 = Color3.fromRGB(70, 40, 22), BackgroundTransparency = 0.18, BorderSizePixel = 0, Parent = root,
|
||
})
|
||
new("UICorner", { CornerRadius = UDim.new(0, 18), Parent = panel })
|
||
new("UIStroke", { Color = GOLD, Thickness = 3, Transparency = 0.1, Parent = panel })
|
||
new("UIGradient", {
|
||
Rotation = 90,
|
||
Color = ColorSequence.new(Color3.fromRGB(150, 95, 50), Color3.fromRGB(95, 55, 28)),
|
||
Parent = panel,
|
||
})
|
||
local float = new("TextLabel", {
|
||
AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(44, 32), Size = UDim2.fromOffset(46, 46),
|
||
BackgroundTransparency = 1, Text = "🎣", TextScaled = true, Font = Enum.Font.FredokaOne, Parent = panel,
|
||
})
|
||
local title = new("TextLabel", {
|
||
Position = UDim2.fromOffset(78, 12), Size = UDim2.new(1, -96, 0, 38), BackgroundTransparency = 1,
|
||
Text = "", TextColor3 = Color3.fromRGB(255, 240, 200), TextScaled = true, TextXAlignment = Enum.TextXAlignment.Left,
|
||
Font = Enum.Font.FredokaOne, Parent = panel,
|
||
})
|
||
new("UIStroke", { Color = Color3.fromRGB(60, 30, 10), Thickness = 2, Parent = title })
|
||
local barBack = new("Frame", {
|
||
AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 62), Size = UDim2.new(1, -36, 0, 16),
|
||
BackgroundColor3 = Color3.fromRGB(40, 22, 10), BackgroundTransparency = 0.15, BorderSizePixel = 0, Parent = panel,
|
||
})
|
||
new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = barBack })
|
||
local bar = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = GOLD, BorderSizePixel = 0, Parent = barBack })
|
||
new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = bar })
|
||
new("UIGradient", { Color = ColorSequence.new(Color3.fromRGB(255, 230, 120), Color3.fromRGB(255, 160, 60)), Parent = bar })
|
||
local tip = new("TextLabel", {
|
||
Position = UDim2.fromOffset(18, 86), Size = UDim2.new(1, -36, 0, 22), BackgroundTransparency = 1,
|
||
Text = "", TextColor3 = Color3.fromRGB(255, 228, 185), TextScaled = true,
|
||
Font = Enum.Font.GothamMedium, Parent = panel,
|
||
})
|
||
|
||
local rng = Random.new()
|
||
local function showTip()
|
||
tip.Text = "💡 " .. TIPS[rng:NextInteger(1, #TIPS)]
|
||
end
|
||
|
||
-- при входе: экран виден сразу, минимум — из FishConfig, когда он загрузится
|
||
local now = os.clock()
|
||
gui:SetAttribute("Visible", true)
|
||
gui:SetAttribute("Ready", false)
|
||
gui:SetAttribute("StartAt", now)
|
||
gui:SetAttribute("MinUntil", now + 3)
|
||
gui:SetAttribute("Title", "Загрузка…")
|
||
showTip()
|
||
|
||
task.spawn(function()
|
||
if not game:IsLoaded() then
|
||
game.Loaded:Wait()
|
||
end
|
||
local ok, Config = pcall(require, ReplicatedStorage:WaitForChild("FishConfig"))
|
||
if ok and Config.Loading then
|
||
gui:SetAttribute("MinUntil", gui:GetAttribute("StartAt") + Config.Loading.firstJoin)
|
||
end
|
||
end)
|
||
|
||
local hiding = false
|
||
gui:GetAttributeChangedSignal("Visible"):Connect(function()
|
||
-- новый телепорт мог прийти, пока экран ещё уходил: тогда возвращаем его
|
||
if gui:GetAttribute("Visible") and (hiding or not gui.Enabled) then
|
||
hiding = false
|
||
showTip()
|
||
gui.Enabled = true
|
||
TweenService:Create(root, TweenInfo.new(0.25), { GroupTransparency = 0 }):Play()
|
||
end
|
||
end)
|
||
gui:GetAttributeChangedSignal("Title"):Connect(function()
|
||
title.Text = gui:GetAttribute("Title") or ""
|
||
end)
|
||
title.Text = gui:GetAttribute("Title")
|
||
|
||
RunService.RenderStepped:Connect(function()
|
||
if not gui.Enabled then
|
||
return
|
||
end
|
||
local t = os.clock()
|
||
float.Rotation = math.sin(t * 2.2) * 12
|
||
float.Position = UDim2.fromOffset(44, 32 + math.sin(t * 3) * 3)
|
||
local startAt, minUntil = gui:GetAttribute("StartAt") or t, gui:GetAttribute("MinUntil") or t
|
||
local p = math.clamp((t - startAt) / math.max(0.01, minUntil - startAt), 0, 1)
|
||
local ready = gui:GetAttribute("Ready") == true
|
||
if not ready then
|
||
p = math.min(p, 0.95) -- пока локация не готова, полоска не доходит до конца
|
||
end
|
||
bar.Size = UDim2.fromScale(p, 1)
|
||
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||
if ready and hrp and t >= minUntil and not hiding then
|
||
hiding = true
|
||
local tw = TweenService:Create(root, TweenInfo.new(0.6), { GroupTransparency = 1 })
|
||
tw.Completed:Connect(function()
|
||
if hiding then
|
||
gui.Enabled = false
|
||
gui:SetAttribute("Visible", false)
|
||
end
|
||
end)
|
||
tw:Play()
|
||
end
|
||
end)
|
||
]=====])
|
||
print('DONE! Скрипты обновлены (11 шт). Нажми Ctrl+S, потом Play (F5).')
|