From 8cf3be75c28f93ab20822a02c826b0f7bda8747b Mon Sep 17 00:00:00 2001 From: listik Date: Tue, 3 Nov 2026 19:56:18 +0300 Subject: [PATCH] 12 --- README.md | 20 +- build.ps1 | 5 +- install/1_FishConfig_ReplicatedStorage.rbxmx | 89 +- .../3_MapBuilder_ServerScriptService.rbxmx | 1247 +----- .../4_GameServer_ServerScriptService.rbxmx | 316 +- ...5_FishingClient_StarterPlayerScripts.rbxmx | 583 ++- .../6_World1Builder_ServerScriptService.rbxmx | 3 +- .../7_WorldBuilder_ServerScriptService.rbxmx | 1394 +++++++ install/INSTALL.lua | 3632 ++++++++++------- src/ReplicatedStorage/FishConfig.lua | 3 + src/ServerScriptService/MapBuilder.server.lua | 1242 +----- src/ServerScriptService/World1Builder.lua | 3 +- src/ServerScriptService/WorldBuilder.lua | 1391 +++++++ 13 files changed, 5944 insertions(+), 3984 deletions(-) create mode 100644 install/7_WorldBuilder_ServerScriptService.rbxmx create mode 100644 src/ServerScriptService/WorldBuilder.lua diff --git a/README.md b/README.md index 883c99b..e4ca5c4 100644 --- a/README.md +++ b/README.md @@ -17,21 +17,25 @@ default.project.json проект Rojo Откройте `Fishing.rbxlx` в Roblox Studio (**File → Open from File…** или двойной клик) и нажмите **Play** (F5). Файл собирается из `src/` командой `powershell -ExecutionPolicy Bypass -File build.ps1` (в git он не попадает — см. `.gitignore`). -## «Тихое озеро»: уровень собирается один раз и правится руками +## Карта собирается один раз в Studio и правится руками -Локацию «Тихое озеро» строит модуль `src/ServerScriptService/World1Builder.lua`. Порядок: +Лобби и все миры строит модуль `src/ServerScriptService/WorldBuilder.lua` («Тихое озеро» он берёт из `World1Builder.lua`). Порядок: -1. Откройте `Fishing.rbxlx` в Studio и подключите Rojo (**Plugins → Rojo → Connect**). +1. Откройте плейс в Studio и подключите Rojo (**Plugins → Rojo → Connect**). 2. В **Command Bar** выполните: ```lua - require(game.ServerScriptService.World1Builder:Clone()).bake() + require(game.ServerScriptService.WorldBuilder:Clone()).bake() ``` - В `Workspace` появится папка `World1Map` (детали и модели), а на месте мира — террейн. -3. Сохраните плейс (**Ctrl+S**). Дальше двигайте, удаляйте и добавляйте объекты как обычно, в том числе модели из Toolbox. Игра возьмёт уровень из плейса и не будет генерировать его заново. + В `Workspace` появится папка `FishingMap` (лобби и миры: детали и модели), а на месте миров — террейн. +3. Сохраните плейс (**Ctrl+S**). Дальше двигайте, удаляйте и добавляйте объекты как обычно, в том числе модели из Toolbox. Игра возьмёт карту из плейса и не будет генерировать её заново. -Не удаляйте маркеры `World1Spawn`, `GuideFishSpot`, `GuideSell`, `World1NpcSeller`, `World1NpcGrandpa` и доску `World1Bestiary`. Двигать их можно: NPC и точка появления встанут туда при запуске. Если меняете форму озера, поправьте круги `lakes` у Мира 1 в `FishConfig.lua`: по ним игра решает, где вода. +Повторный `bake()` стирает `FishingMap` и террейн миров и строит всё заново, ручные правки при этом пропадут. Исключение — «Тихое озеро» (`FishingMap/World1Map`): его `bake()` переносит в новую карту как есть, вместе с террейном. Чтобы собрать и его заново, сначала удалите `World1Map`. -После сборки уровня `build.ps1` больше не перезаписывает `Fishing.rbxlx`: скрипты приходят через Rojo. Команда `build.ps1 -Force` пересоздаёт плейс с нуля и **стирает** собранный уровень. +Цвета материалов террейна общие на весь плейс, и в нём сохранены цвета «Тихого озера» (зелёный `Snow`). Поэтому в редакторе снег Ледяного фьорда тоже зелёный, а в игре его перекрашивает `terrainColors` мира в `FishConfig.lua`. + +NPC в редакторе показаны полупрозрачными фигурами (`NpcSpot`, `World1NpcSeller`, `World1NpcGrandpa`): при запуске на их место встаёт персонаж, имя и цвета берутся из атрибутов детали. Доски с атрибутом `Bestiary` получают список рыб из `FishConfig` при каждом запуске. Не удаляйте маркеры (`LobbySpawn`, `World1Spawn`, `World2Spawn`, `World3Spawn`, `Guide*`), двигать их можно. Если меняете форму озера, поправьте круги `lakes` у мира в `FishConfig.lua`: по ним игра решает, где вода. + +После сборки карты `build.ps1` больше не перезаписывает `Fishing.rbxlx`: скрипты приходят через Rojo. Команда `build.ps1 -Force` пересоздаёт плейс с нуля и **стирает** собранную карту. ## Установка в свой плейс без Rojo diff --git a/build.ps1 b/build.ps1 index 488c7c1..3d3e559 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,7 +1,7 @@ # Builds Fishing.rbxlx (place file for Roblox Studio) and install/* from src/. # Run: powershell -ExecutionPolicy Bypass -File build.ps1 -# Fishing.rbxlx is created only if it does not exist yet: after the level is baked in Studio -# (World1Builder) the place file holds the hand-edited map, and scripts reach it via Rojo. +# Fishing.rbxlx is created only if it does not exist yet: after the map is baked in Studio +# (WorldBuilder) the place file holds the hand-edited map, and scripts reach it via Rojo. # Use -Force to recreate it from scratch (this DELETES the map built in Studio). param([switch]$Force) @@ -14,6 +14,7 @@ $scripts = @( @{ Name = 'MapBuilder'; Class = 'Script'; Service = 'ServerScriptService'; Path = 'src\ServerScriptService\MapBuilder.server.lua'; Rbxmx = '3_MapBuilder_ServerScriptService.rbxmx' }, @{ Name = 'GameServer'; Class = 'Script'; Service = 'ServerScriptService'; Path = 'src\ServerScriptService\GameServer.server.lua'; Rbxmx = '4_GameServer_ServerScriptService.rbxmx' }, @{ Name = 'World1Builder'; Class = 'ModuleScript'; Service = 'ServerScriptService'; Path = 'src\ServerScriptService\World1Builder.lua'; Rbxmx = '6_World1Builder_ServerScriptService.rbxmx' }, + @{ Name = 'WorldBuilder'; Class = 'ModuleScript'; Service = 'ServerScriptService'; Path = 'src\ServerScriptService\WorldBuilder.lua'; Rbxmx = '7_WorldBuilder_ServerScriptService.rbxmx' }, @{ Name = 'FishingClient'; Class = 'LocalScript'; Service = 'StarterPlayerScripts'; Path = 'src\StarterPlayer\StarterPlayerScripts\FishingClient.client.lua'; Rbxmx = '5_FishingClient_StarterPlayerScripts.rbxmx' } ) diff --git a/install/1_FishConfig_ReplicatedStorage.rbxmx b/install/1_FishConfig_ReplicatedStorage.rbxmx index 310f034..9c9ba1d 100644 --- a/install/1_FishConfig_ReplicatedStorage.rbxmx +++ b/install/1_FishConfig_ReplicatedStorage.rbxmx @@ -13,14 +13,34 @@ 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.4, water = Color3.fromRGB(38, 172, 166), + clock = 16.2, waterY = 0, lakes = { { 0, -15, 62 }, { -42, 8, 34 }, { 44, 2, 36 }, { 0, 22, 30 }, { 48, -50, 22 } }, -- { x, z, радиус } от центра -- внешний вид только этого мира (применяет клиент при входе, при выходе возвращает как было) - waterTransparency = 0.6, waveSize = 0.12, tint = Color3.fromRGB(255, 240, 222), + 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(122, 182, 74), Salt = Color3.fromRGB(176, 136, 90), + 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), }, }, @@ -28,7 +48,7 @@ Config.Worlds = { id = "World2", name = "Тропический остров", icon = "🏝", level = 8, mult = 4, center = Vector3.new(1500, 0, 0), color = Color3.fromRGB(255, 190, 70), desc = "Бирюзовое море, пальмы и яркая рифовая рыба.", - clock = 13, water = Color3.fromRGB(35, 175, 185), + clock = 13, waterY = 0, sea = 119, -- всё дальше этого радиуса от центра — море }, @@ -36,7 +56,7 @@ Config.Worlds = { id = "World3", name = "Ледяной фьорд", icon = "❄", level = 18, mult = 12, center = Vector3.new(-1500, 0, 0), color = Color3.fromRGB(150, 220, 255), desc = "Рыбалка в лунках среди льдов и северного сияния.", - clock = 18.3, water = Color3.fromRGB(25, 70, 100), + clock = 18.3, waterY = 1, lakes = { { 0, 0, 70 }, { -55, 30, 45 }, { 55, -25, 50 }, { 5, -70, 40 } }, -- подо льдом holes = { @@ -44,6 +64,9 @@ Config.Worlds = { { -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, @@ -290,17 +313,53 @@ Config.CollectionRewards = { } Config.MasteryCoins = 5000 -- за весь мир (тоже умножается на mult) ----------------------------------------------------------------- задания --- coins/xp = награда за 1 единицу цели (умножается на цель и уровень игрока) -Config.Quests = { - { kind = "catch", text = "Поймай %d рыб", goals = { 10, 20, 35 }, coins = 6, xp = 5 }, - { kind = "rare", text = "Поймай %d рыб редкости «Редкая» и выше", goals = { 1, 2, 3 }, coins = 60, xp = 50 }, - { kind = "epic", text = "Поймай эпическую рыбу или реже", goals = { 1 }, coins = 250, xp = 200 }, - { kind = "mutation", text = "Поймай рыбу с мутацией", goals = { 1 }, coins = 200, xp = 150 }, - { kind = "earn", text = "Заработай %d монет на продаже", goals = { 200, 600, 1500 }, coins = 0.25, xp = 0.2 }, - { kind = "perfect", text = "Сделай %d идеальных подсечек (без промаха)", goals = { 5, 10, 15 }, coins = 15, xp = 12 }, +---------------------------------------------------------------- цепочки заданий +-- короткие задания идут по очереди: награда сразу, следующее появляется мгновенно. +-- после последнего шага — бонус цепочки и следующая цепочка; каждый новый круг цели растут +-- 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 }, + }, } -Config.QuestSlots = 3 -- ежедневная награда (7 дней по кругу), монеты растут с уровнем Config.DailyRewards = { diff --git a/install/3_MapBuilder_ServerScriptService.rbxmx b/install/3_MapBuilder_ServerScriptService.rbxmx index f975c17..ff14581 100644 --- a/install/3_MapBuilder_ServerScriptService.rbxmx +++ b/install/3_MapBuilder_ServerScriptService.rbxmx @@ -1,63 +1,15 @@ MapBuilder ServerScriptService --- Строит лобби и Мир 1 «Тихое озеро» при запуске игры, настраивает свет и воду. --- Если в Workspace уже есть папка "FishingMap", детали не строятся заново --- (террейн, свет и точка появления настраиваются всегда). +-- При запуске игры: свет, точка появления в лобби, карта и NPC. +-- Карту (лобби и все миры) строит модуль WorldBuilder. Обычно она уже собрана в Studio и +-- сохранена в плейсе (Workspace.FishingMap) — тогда берём её как есть, правки руками сохраняются. +-- Если карты в плейсе нет, строим её здесь тем же модулем. local Workspace = game:GetService("Workspace") -local Lighting = game:GetService("Lighting") -local Players = game:GetService("Players") -local ReplicatedStorage = game:GetService("ReplicatedStorage") -local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) -local Models = require(ReplicatedStorage:WaitForChild("GameModels")) +local WorldBuilder = require(script.Parent:WaitForChild("WorldBuilder")) -local V = Vector3.new -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 - -Lighting.ClockTime = 14.5 -Lighting.Brightness = 2.3 -Lighting.Ambient = Color3.fromRGB(70, 70, 85) -Lighting.OutdoorAmbient = Color3.fromRGB(140, 145, 160) -Lighting.EnvironmentDiffuseScale = 0.6 -Lighting.EnvironmentSpecularScale = 0.8 -ensure("Atmosphere", Lighting, { - Density = 0.25, Offset = 0.12, Glare = 0, Haze = 0.6, - Color = Color3.fromRGB(200, 215, 232), Decay = Color3.fromRGB(110, 140, 175), -}) -ensure("BloomEffect", Lighting, { Intensity = 0.5, Size = 24, Threshold = 1.4 }) -ensure("ColorCorrectionEffect", Lighting, { Saturation = 0.15, Contrast = 0.06, Brightness = 0.02 }) -ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.8 }) - ----------------------------------------------------------------- вода - -local terrain = Workspace.Terrain --- низкое отражение, иначе вода «засвечивается» небом и выглядит белой -terrain.WaterColor = Color3.fromRGB(10, 55, 70) -terrain.WaterTransparency = 0.15 -terrain.WaterReflectance = 0.08 -terrain.WaterWaveSize = 0.3 -terrain.WaterWaveSpeed = 12 - ----------------------------------------------------------------- МИР 1: «Тихое озеро» --- Уровень собирает модуль World1Builder: один раз в Studio (тогда он лежит в Workspace.World1Map --- вместе с террейном и правится руками как обычные модели) или здесь при запуске, если готового --- уровня в плейсе нет. Сам уровень и NPC подключаются ниже, после создания папки FishingMap. - -local World1Builder = require(script.Parent:WaitForChild("World1Builder")) -local world1Prebuilt = Workspace:FindFirstChild("World1Map") -local GROUND_Y = 4 -- верх земли в мирах (запасная высота для groundY) +WorldBuilder.applyLighting() ---------------------------------------------------------------- точка появления в лобби @@ -67,7 +19,7 @@ if not spawn then spawn.Parent = Workspace end spawn.Anchored = true -spawn.Size = V(8, 0.2, 8) +spawn.Size = Vector3.new(8, 0.2, 8) spawn.CFrame = CFrame.new(0, 1.15, 57) spawn.Transparency = 1 spawn.Duration = 0 @@ -77,1188 +29,9 @@ for _, d in ipairs(spawn:GetChildren()) do end end -if Workspace:FindFirstChild("FishingMap") then - return -end +---------------------------------------------------------------- карта -local map = Instance.new("Folder") -map.Name = "FishingMap" -map.Parent = Workspace -local zonesFolder = Instance.new("Folder") -zonesFolder.Name = "FishingZones" -zonesFolder.Parent = map - ----------------------------------------------------------------- помощники - -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 groundY(x, z) - local params = RaycastParams.new() - params.FilterType = Enum.RaycastFilterType.Include - params.FilterDescendantsInstances = { terrain } - params.IgnoreWater = true - local hit = Workspace:Raycast(V(x, 150, z), V(0, -300, 0), params) - return hit and hit.Position.Y or GROUND_Y, hit and hit.Material -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 - -local function npc(name, cf, colors, action, actionText) - 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(cf) - rig.Parent = map - - 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 - if action then - prompt(root, actionText, name, action, 14) - end - return rig -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 - return counter -end - -local function portal(baseCF, title, color, worldId, locked) - 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 - ----------------------------------------------------------------- ЛОББИ - -local FLOOR = 1 -- верх пола лобби - -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 - --- живая изгородь по краю (с проходами) -for deg = 0, 359, 7 do - local skip = (deg > 80 and deg < 100) or (deg > 255 and deg < 285) or deg < 8 or deg > 352 or (deg > 172 and deg < 188) - if not skip then - 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 -end - --- магазин (запад) и скупка (восток) -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, - "КАК ИГРАТЬ\n1. Портал «Мир 1» или кнопка 🌍 Миры\n2. Удочка — клавиша 1, у воды зажми ЛКМ и отпусти\n3. Клюёт → кликай в зелёную зону\n4. 🎒 Сумка — B, 📜 Задания — Q\n5. Собирай коллекцию — получай награды!", - Color3.fromRGB(255, 245, 225), { TextXAlignment = Enum.TextXAlignment.Left }) -end - ----------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО -do - -- готовый уровень из плейса или собранный сейчас; кладём в FishingMap — там игра ищет маркеры - local w1map = world1Prebuilt or World1Builder.build(map) - w1map.Parent = map - -- NPC стоят на маркерах — их можно двигать в Studio - local seller = w1map:FindFirstChild("World1NpcSeller", true) - if seller then - npc("Скупщик Гриша", seller.CFrame, { - 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 then - npc("Дед Петрович", grandpa.CFrame, { - 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:FindFirstChildOfClass("SurfaceGui") then - local lines = { "🐟 КТО ВОДИТСЯ В ОЗЕРЕ" } - for _, f in ipairs(Config.Zones.World1.fish) do - local r = Config.Rarities[f.rarity] - table.insert(lines, ("%s — %s"):format(r.color:ToHex(), f.name, r.name)) - end - surfaceText(board, Enum.NormalId.Front, table.concat(lines, "\n"), Color3.new(1, 1, 1)) - 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({ Size = V(13, 10, 0.5), CFrame = cf * CFrame.new(0, 7, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) - local lines = { ("%s"):format(titleHex, title) } - for _, f in ipairs(Config.Zones[worldId].fish) do - local r = Config.Rarities[f.rarity] - table.insert(lines, ("%s — %s"):format(r.color:ToHex(), f.name, r.name)) - end - surfaceText(board, Enum.NormalId.Front, table.concat(lines, "\n"), Color3.new(1, 1, 1)) -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.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 - for _, h in ipairs(HOLES) do - terrain:FillCylinder(CFrame.new(W3 + V(h[1], -1, h[2])), 4, 6, Enum.Material.Water) - 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() - task.delay(5, ensureLakeWater) - 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 +local map = Workspace:FindFirstChild("FishingMap") or WorldBuilder.build() +WorldBuilder.prepareRuntime(map) ]]> diff --git a/install/4_GameServer_ServerScriptService.rbxmx b/install/4_GameServer_ServerScriptService.rbxmx index 57b48d6..4361c91 100644 --- a/install/4_GameServer_ServerScriptService.rbxmx +++ b/install/4_GameServer_ServerScriptService.rbxmx @@ -42,7 +42,7 @@ local function defaultData() rod = "Basic", rods = { Basic = true }, rodLevels = {}, bag = "Pouch", bags = { Pouch = true }, items = {}, discovered = {}, claimed = {}, - quests = {}, daily = { last = 0, streak = 0 }, + chain = { index = 1, step = 1, progress = 0, tier = 0 }, daily = { last = 0, streak = 0 }, boostUntil = 0, boostBonus = 0, totalCaught = 0, nextUid = 1, receipts = {}, } @@ -169,13 +169,58 @@ local function sendInventory(player) 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", data.quests, { + 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), @@ -256,79 +301,54 @@ local function applyPotion(data, bonus, duration) data.boostUntil = math.max(os.time(), data.boostUntil) + duration end ----------------------------------------------------------------- задания +---------------------------------------------------------------- задания: прогресс цепочки -local function makeQuest(data, exclude) - local pool = {} - for _, q in ipairs(Config.Quests) do - if not exclude[q.kind] then - table.insert(pool, q) - end +-- у старых сохранений вместо цепочки были три случайных задания +local function ensureChain(data) + if type(data.chain) ~= "table" then + data.chain = { index = 1, step = 1, progress = 0, tier = 0 } end - if #pool == 0 then - pool = Config.Quests - end - local t = pool[rng:NextInteger(1, #pool)] - local goal = t.goals[rng:NextInteger(1, #t.goals)] - local mult = 1 + (data.level - 1) * 0.25 - return { - kind = t.kind, goal = goal, progress = 0, - coins = math.max(10, math.floor(t.coins * goal * mult)), - xp = math.max(10, math.floor(t.xp * goal * mult)), - } + data.quests = nil end -local function ensureQuests(data) - local kinds = {} - for _, q in ipairs(data.quests) do - kinds[q.kind] = true - end - while #data.quests < Config.QuestSlots do - local q = makeQuest(data, kinds) - kinds[q.kind] = true - table.insert(data.quests, q) - end -end - -local function questProgress(player, kind, amount) +-- absolute = true: amount — текущее значение (серия), а не прибавка +local function questProgress(player, kind, amount, absolute) local data = profiles[player] if not data then return end - local changed = false - for _, q in ipairs(data.quests) do - if q.kind == kind and q.progress < q.goal then - q.progress = math.min(q.goal, q.progress + amount) - changed = true - if q.progress >= q.goal then - notify(player, "📜 Задание готово! (Q)", GOLD) - end - end - end - if changed then - sendQuests(player) - end -end - -local function claimQuest(player, index) - local data = profiles[player] - local q = data and type(index) == "number" and data.quests[index] - if not q or q.progress < q.goal then + local chain, step = currentChain(data) + if step[1] ~= kind then return end - data.coins += q.coins - addXp(player, data, q.xp) - local kinds = {} - for i, other in ipairs(data.quests) do - if i ~= index then - kinds[other.kind] = true + 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 - kinds[q.kind] = true - data.quests[index] = makeQuest(data, kinds) - updateStats(player) sendQuests(player) - notify(player, ("📜 Награда: +%d 💰 +%d XP"):format(q.coins, q.xp), GREEN) end local function claimDaily(player) @@ -609,6 +629,34 @@ 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) @@ -813,7 +861,7 @@ local function onCast(player, power) remote:FireClient(player, "CastFail") return end - local s = { stage = "casting", fish = fish, tool = tool } + 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 } @@ -876,6 +924,7 @@ local function onCast(player, power) stopFishing(player, false) remote:FireClient(player, "Escaped") notify(player, "🐟 Рыба ушла", RED) + breakCombo(player) end end) end @@ -904,11 +953,18 @@ local function onCatch(player, success, misses) 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, @@ -934,22 +990,26 @@ local function onCatch(player, success, misses) if fromPos then showFishFlight(player, fish, fromPos) end - remote:FireClient(player, "Caught", fish, { new = isNew, record = isRecord }) + 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 rank >= 4 then - questProgress(player, "epic", 1) - end - if fish.mutation then - questProgress(player, "mutation", 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 ---------------------------------------------------------------- скупка @@ -1005,6 +1065,7 @@ local function sellItems(player, filterUid) updateStats(player) sendInventory(player) remote:FireClient(player, "Sold", total, count) + questProgress(player, "sell", count) questProgress(player, "earn", total) end @@ -1038,6 +1099,7 @@ local function buy(player, kind, id) end updateStats(player) notify(player, ("✨ %s улучшена до +%d!"):format(rod.name, lvl + 1), GOLD) + questProgress(player, "buy", 1) return end if kind == "Potion" then @@ -1057,6 +1119,7 @@ local function buy(player, kind, id) 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 @@ -1071,6 +1134,7 @@ local function buy(player, kind, 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) @@ -1082,6 +1146,7 @@ local function buy(player, kind, id) end data.coins -= item.price owned[id] = true + bought = true notify(player, "✅ " .. item.name, GREEN) end if kind == "Rod" then @@ -1093,6 +1158,9 @@ local function buy(player, kind, id) attachBag(player) end updateStats(player) + if bought then + questProgress(player, "buy", 1) + end end ---------------------------------------------------------------- телепорт @@ -1215,8 +1283,6 @@ remote.OnServerEvent:Connect(function(player, action, a, b) teleportTo(player, a) elseif action == "ClaimCollection" then claimCollection(player, a, b) - elseif action == "ClaimQuest" then - claimQuest(player, a) elseif action == "ClaimDaily" then claimDaily(player) elseif action == "RequestInventory" then @@ -1304,6 +1370,105 @@ task.spawn(function() 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) @@ -1321,7 +1486,7 @@ local function onPlayerAdded(player) return end loadPasses(player) - ensureQuests(data) + ensureChain(data) profiles[player] = data loadedOk[player] = ok updateStats(player) @@ -1348,6 +1513,7 @@ end Players.PlayerRemoving:Connect(function(player) stopFishing(player, false) + combo[player], comboUntil[player] = nil, nil saveData(player) profiles[player] = nil loadedOk[player] = nil @@ -1371,6 +1537,10 @@ task.spawn(function() 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 diff --git a/install/5_FishingClient_StarterPlayerScripts.rbxmx b/install/5_FishingClient_StarterPlayerScripts.rbxmx index 35a95a8..51641d4 100644 --- a/install/5_FishingClient_StarterPlayerScripts.rbxmx +++ b/install/5_FishingClient_StarterPlayerScripts.rbxmx @@ -334,7 +334,8 @@ local function showCatch(fish, extra) catchName.TextColor3 = r.color catchInfo.Text = ("%s%s · %.2f кг"):format( hex(r.color), r.name, mut and (" · " .. mut.name .. " x" .. mut.mult .. "") or "", fish.weight) - catchValue.Text = ("💰 %s ⭐ +%d XP"):format(fmt(fish.value), fish.xp * ((extra and extra.new) and 2 or 1)) + 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() @@ -505,7 +506,7 @@ end ---------------------------------------------------------------- данные с сервера local inventory, discovered, claimed = {}, {}, {} -local quests, daily = {}, { available = false, streak = 0, nextStreak = 1 } +local chain, daily = nil, { available = false, streak = 0, nextStreak = 1 } ---------------------------------------------------------------- магазин @@ -893,35 +894,55 @@ local questWin = makeWindow("📜 Задания", Color3.fromRGB(200, 140, 40), local questList = scrollArea(questWin.pages.quests) local dailyPage = questWin.pages.daily -local function questText(q) - local t = Config.Quests[1] - for _, def in ipairs(Config.Quests) do - if def.kind == q.kind then - t = def - end +local function questText(kind, goal) + local t = Config.QuestKinds[kind] + if not t then + return kind end - return string.find(t.text, "%%d") and t.text:format(q.goal) or t.text + 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) - text({ Size = UDim2.new(1, -4, 0, 30), LayoutOrder = 0, Font = BODY2, TextSize = 14, TextColor3 = C.muted, Text = "Выполняй задания — после награды появится новое.", Parent = questList }) - for i, q in ipairs(quests) do - local done = q.progress >= q.goal - local row = new("Frame", { Size = UDim2.new(1, -4, 0, 92), BackgroundColor3 = WHITE, LayoutOrder = i, Parent = questList }, - { corner(14), stroke(done and C.green or C.line, 2, done and 0 or 0.45), gradient(C.panel2, C.panel, 90) }) - text({ Size = UDim2.new(1, -190, 0, 28), Position = UDim2.fromOffset(16, 8), Font = TITLE, TextSize = 19, Text = questText(q), TextTruncate = Enum.TextTruncate.AtEnd, Parent = row }) - progressBar(row, UDim2.fromOffset(16, 42), UDim2.new(1, -200, 0, 14), q.progress / q.goal, done and C.green or C.gold) - text({ Size = UDim2.new(1, -190, 0, 20), Position = UDim2.fromOffset(16, 62), Font = BODY2, TextSize = 13, TextColor3 = C.muted, RichText = true, - Text = ("%s / %s · +%s 💰 +%s XP"):format(fmt(q.progress), fmt(q.goal), fmt(q.coins), fmt(q.xp)), Parent = row }) - btn({ - Size = UDim2.fromOffset(150, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 0), - BackgroundColor3 = done and C.green or C.grey, AutoButtonColor = done, Text = done and "🎁 Забрать" or "В процессе", TextSize = 18, Parent = row, - }, done and function() - remote:FireServer("ClaimQuest", i) - end or nil) + if not chain then + return end + text({ + Size = UDim2.new(1, -4, 0, 30), LayoutOrder = 0, Font = TITLE, TextSize = 22, RichText = true, + Text = ("%s круг %d · награда сразу, следующее задание — тоже"):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 = ("🎁 За всю цепочку: +%s 💰 +%s XP%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 @@ -1008,13 +1029,8 @@ sideButton(5, "💎", "Донат", nil, Color3.fromRGB(150, 80, 210), function( end) local function refreshDots() - local q = false - for _, quest in ipairs(quests) do - if quest.progress >= quest.goal then - q = true - end - end - sideDots["Задания"].Visible = q or daily.available + -- задания цепочки награждаются сами, точка — только для ежедневной награды + sideDots["Задания"].Visible = daily.available local c = false for _, w in ipairs(Config.Worlds) do local zone = Config.Zones[w.id] @@ -1537,18 +1553,58 @@ local snow = new("ParticleEmitter", { }) local lastWorldId = "none" local terrain = workspace.Terrain -local defaultWater = Color3.fromRGB(10, 55, 70) --- то, что мир может поменять под себя (вода, оттенок, цвета травы и песка); остальные миры — как в MapBuilder -local DEFAULT_LOOK = { waterTransparency = 0.15, waveSize = 0.3, tint = Color3.new(1, 1, 1) } +-- то, что мир может поменять под себя (оттенок, цвета травы и песка); вода не трогается — она из свойств 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, +} +local lookDefaults = {} + +local function applyLook(world) + -- исходные значения запоминаем до первой правки; эффект мог ещё не прийти с сервера, тогда в следующий раз + for _, w in ipairs(Config.Worlds) 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 typeof(v) == "boolean" then obj[prop] = v else goal[prop] = v end + end + TweenService:Create(obj, TweenInfo.new(2), goal):Play() + end + end +end + local function applyAmbience(world) local clock = (world and world.clock) or 14.5 TweenService:Create(Lighting, TweenInfo.new(2), { ClockTime = clock }):Play() - terrain.WaterColor = (world and world.water) or defaultWater - terrain.WaterTransparency = (world and world.waterTransparency) or DEFAULT_LOOK.waterTransparency - terrain.WaterWaveSize = (world and world.waveSize) or DEFAULT_LOOK.waveSize local cc = Lighting:FindFirstChildOfClass("ColorCorrectionEffect") if cc then TweenService:Create(cc, TweenInfo.new(2), { TintColor = (world and world.tint) or DEFAULT_LOOK.tint }):Play() @@ -1556,7 +1612,7 @@ local function applyAmbience(world) -- цвета материалов террейна общие для всей карты, поэтому меняем их только у себя и возвращаем при выходе if not defaultTerrainColors then defaultTerrainColors = {} - for _, name in ipairs({ "Snow", "Salt", "Mud", "Sand" }) do + for _, name in ipairs({ "Snow", "Salt", "Mud", "Sand", "Rock", "Slate" }) do defaultTerrainColors[name] = terrain:GetMaterialColor(Enum.Material[name]) end end @@ -1572,6 +1628,7 @@ local function applyAmbience(world) Color = frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232), }):Play() end + applyLook(world) snow.Rate = (world and world.id == "World3") and 140 or 0 end @@ -1853,11 +1910,45 @@ local function guideRoute(step, pos, world) 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() - -- пока сервер не прислал шаг (данные ещё грузятся), ничего не показываем - if not hrp or player:GetAttribute("Tutorial") == nil or step >= Config.TutorialDone then + -- пока сервер не прислал шаг (данные ещё грузятся), обучение не показываем; + -- после обучения линия ведёт к скупщику, когда сумка полна + 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) @@ -1873,7 +1964,9 @@ RunService.RenderStepped:Connect(function() local world = Config.WorldAt(pos) -- переходы между шагами - if step <= 1 and world and world.id == "World1" then + if not tutorialOn then + -- обучение пройдено, остаётся только дорога к скупщику + elseif step <= 1 and world and world.id == "World1" then advanceTutorial(2) elseif step == 0 then local board = guideMarker("GuideBoard") @@ -1890,7 +1983,15 @@ RunService.RenderStepped:Connect(function() end step = tutorialStep() - local route, hint, key = guideRoute(step, pos, world) + 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 guideMarker("GuideSell")) 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 @@ -1957,9 +2058,365 @@ RunService.RenderStepped:Connect(function() 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 ("🎣 %s — можно купить!"):format(r.name), 1, C.green + end + return ("🎣 До «%s»: ещё %s 💰"):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: ещё %s 💰"):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 ("осталась %s"):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 · %s/%s"):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, ("🎒 Сумка полна — продай рыбу!"), 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) + playUiSound(DING, 0.5) + 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) +remote.OnClientEvent:Connect(function(action, a, b, c, d) if action == "Notify" then notify(a, b) elseif action == "Cast" then @@ -1993,17 +2450,55 @@ remote.OnClientEvent:Connect(function(action, a, b, c) 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 - quests = a or {} + 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)) + playUiSound(DING, 0.6) + 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) + playUiSound(DING, 0.8) + 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) + playUiSound(DING, 0.8) + 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 diff --git a/install/6_World1Builder_ServerScriptService.rbxmx b/install/6_World1Builder_ServerScriptService.rbxmx index cd23f01..bb93a0d 100644 --- a/install/6_World1Builder_ServerScriptService.rbxmx +++ b/install/6_World1Builder_ServerScriptService.rbxmx @@ -5,7 +5,8 @@ -- Команда для Command Bar (строка внизу Studio): -- require(game.ServerScriptService.World1Builder:Clone()).bake() -- bake() стирает старую папку Workspace.World1Map и террейн этого мира и строит всё заново. --- Если папки World1Map в плейсе нет, MapBuilder при запуске игры строит уровень этим же модулем. +-- Обычно уровень собирается вместе со всей картой: WorldBuilder.bake() (см. README). +-- Если папки World1Map в плейсе нет, WorldBuilder строит уровень этим же модулем. -- -- Что нужно игре от уровня (не удаляйте и не переименовывайте): -- маркеры World1Spawn, GuideFishSpot, GuideSell, World1NpcSeller, World1NpcGrandpa — невидимые diff --git a/install/7_WorldBuilder_ServerScriptService.rbxmx b/install/7_WorldBuilder_ServerScriptService.rbxmx new file mode 100644 index 0000000..79bea75 --- /dev/null +++ b/install/7_WorldBuilder_ServerScriptService.rbxmx @@ -0,0 +1,1394 @@ + +WorldBuilder 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 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 + +function Builder.applyLighting() + Lighting.ClockTime = 14.5 + Lighting.Brightness = 2.3 + Lighting.Ambient = Color3.fromRGB(70, 70, 85) + Lighting.OutdoorAmbient = Color3.fromRGB(140, 145, 160) + Lighting.EnvironmentDiffuseScale = 0.6 + Lighting.EnvironmentSpecularScale = 0.8 + ensure("Atmosphere", Lighting, { + Density = 0.25, Offset = 0.12, Glare = 0, Haze = 0.6, + Color = Color3.fromRGB(200, 215, 232), Decay = Color3.fromRGB(110, 140, 175), + }) + ensure("BloomEffect", Lighting, { Intensity = 0.5, Size = 24, Threshold = 1.4 }) + ensure("ColorCorrectionEffect", Lighting, { Saturation = 0.15, Contrast = 0.06, Brightness = 0.02 }) + ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.8 }) +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 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 = { ("%s"):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, ("%s — %s"):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 + +-- лавка: 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 + return counter +end + +local function portal(baseCF, title, color, worldId, locked) + 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 + + -- живая изгородь по краю (с проходами) + for deg = 0, 359, 7 do + local skip = (deg > 80 and deg < 100) or (deg > 255 and deg < 285) or deg < 8 or deg > 352 or (deg > 172 and deg < 188) + if not skip then + 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 + end + + -- магазин (запад) и скупка (восток) + 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, + "КАК ИГРАТЬ\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) + w1map.Parent = map + -- 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 +]]> + diff --git a/install/INSTALL.lua b/install/INSTALL.lua index 7210a9e..a95ebcc 100644 --- a/install/INSTALL.lua +++ b/install/INSTALL.lua @@ -22,14 +22,34 @@ 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.4, water = Color3.fromRGB(38, 172, 166), + clock = 16.2, waterY = 0, lakes = { { 0, -15, 62 }, { -42, 8, 34 }, { 44, 2, 36 }, { 0, 22, 30 }, { 48, -50, 22 } }, -- { x, z, радиус } от центра -- внешний вид только этого мира (применяет клиент при входе, при выходе возвращает как было) - waterTransparency = 0.6, waveSize = 0.12, tint = Color3.fromRGB(255, 240, 222), + 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(122, 182, 74), Salt = Color3.fromRGB(176, 136, 90), + 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), }, }, @@ -37,7 +57,7 @@ Config.Worlds = { id = "World2", name = "Тропический остров", icon = "🏝", level = 8, mult = 4, center = Vector3.new(1500, 0, 0), color = Color3.fromRGB(255, 190, 70), desc = "Бирюзовое море, пальмы и яркая рифовая рыба.", - clock = 13, water = Color3.fromRGB(35, 175, 185), + clock = 13, waterY = 0, sea = 119, -- всё дальше этого радиуса от центра — море }, @@ -45,7 +65,7 @@ Config.Worlds = { id = "World3", name = "Ледяной фьорд", icon = "❄", level = 18, mult = 12, center = Vector3.new(-1500, 0, 0), color = Color3.fromRGB(150, 220, 255), desc = "Рыбалка в лунках среди льдов и северного сияния.", - clock = 18.3, water = Color3.fromRGB(25, 70, 100), + clock = 18.3, waterY = 1, lakes = { { 0, 0, 70 }, { -55, 30, 45 }, { 55, -25, 50 }, { 5, -70, 40 } }, -- подо льдом holes = { @@ -53,6 +73,9 @@ Config.Worlds = { { -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, @@ -299,17 +322,53 @@ Config.CollectionRewards = { } Config.MasteryCoins = 5000 -- за весь мир (тоже умножается на mult) ----------------------------------------------------------------- задания --- coins/xp = награда за 1 единицу цели (умножается на цель и уровень игрока) -Config.Quests = { - { kind = "catch", text = "Поймай %d рыб", goals = { 10, 20, 35 }, coins = 6, xp = 5 }, - { kind = "rare", text = "Поймай %d рыб редкости «Редкая» и выше", goals = { 1, 2, 3 }, coins = 60, xp = 50 }, - { kind = "epic", text = "Поймай эпическую рыбу или реже", goals = { 1 }, coins = 250, xp = 200 }, - { kind = "mutation", text = "Поймай рыбу с мутацией", goals = { 1 }, coins = 200, xp = 150 }, - { kind = "earn", text = "Заработай %d монет на продаже", goals = { 200, 600, 1500 }, coins = 0.25, xp = 0.2 }, - { kind = "perfect", text = "Сделай %d идеальных подсечек (без промаха)", goals = { 5, 10, 15 }, coins = 15, xp = 12 }, +---------------------------------------------------------------- цепочки заданий +-- короткие задания идут по очереди: награда сразу, следующее появляется мгновенно. +-- после последнего шага — бонус цепочки и следующая цепочка; каждый новый круг цели растут +-- 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 }, + }, } -Config.QuestSlots = 3 -- ежедневная награда (7 дней по кругу), монеты растут с уровнем Config.DailyRewards = { @@ -966,64 +1025,16 @@ end return M ]=====]) make('Script', 'MapBuilder', game.ServerScriptService, [=====[-- MapBuilder (Script) -> ServerScriptService --- Строит лобби и Мир 1 «Тихое озеро» при запуске игры, настраивает свет и воду. --- Если в Workspace уже есть папка "FishingMap", детали не строятся заново --- (террейн, свет и точка появления настраиваются всегда). +-- При запуске игры: свет, точка появления в лобби, карта и NPC. +-- Карту (лобби и все миры) строит модуль WorldBuilder. Обычно она уже собрана в Studio и +-- сохранена в плейсе (Workspace.FishingMap) — тогда берём её как есть, правки руками сохраняются. +-- Если карты в плейсе нет, строим её здесь тем же модулем. local Workspace = game:GetService("Workspace") -local Lighting = game:GetService("Lighting") -local Players = game:GetService("Players") -local ReplicatedStorage = game:GetService("ReplicatedStorage") -local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) -local Models = require(ReplicatedStorage:WaitForChild("GameModels")) +local WorldBuilder = require(script.Parent:WaitForChild("WorldBuilder")) -local V = Vector3.new -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 - -Lighting.ClockTime = 14.5 -Lighting.Brightness = 2.3 -Lighting.Ambient = Color3.fromRGB(70, 70, 85) -Lighting.OutdoorAmbient = Color3.fromRGB(140, 145, 160) -Lighting.EnvironmentDiffuseScale = 0.6 -Lighting.EnvironmentSpecularScale = 0.8 -ensure("Atmosphere", Lighting, { - Density = 0.25, Offset = 0.12, Glare = 0, Haze = 0.6, - Color = Color3.fromRGB(200, 215, 232), Decay = Color3.fromRGB(110, 140, 175), -}) -ensure("BloomEffect", Lighting, { Intensity = 0.5, Size = 24, Threshold = 1.4 }) -ensure("ColorCorrectionEffect", Lighting, { Saturation = 0.15, Contrast = 0.06, Brightness = 0.02 }) -ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.8 }) - ----------------------------------------------------------------- вода - -local terrain = Workspace.Terrain --- низкое отражение, иначе вода «засвечивается» небом и выглядит белой -terrain.WaterColor = Color3.fromRGB(10, 55, 70) -terrain.WaterTransparency = 0.15 -terrain.WaterReflectance = 0.08 -terrain.WaterWaveSize = 0.3 -terrain.WaterWaveSpeed = 12 - ----------------------------------------------------------------- МИР 1: «Тихое озеро» --- Уровень собирает модуль World1Builder: один раз в Studio (тогда он лежит в Workspace.World1Map --- вместе с террейном и правится руками как обычные модели) или здесь при запуске, если готового --- уровня в плейсе нет. Сам уровень и NPC подключаются ниже, после создания папки FishingMap. - -local World1Builder = require(script.Parent:WaitForChild("World1Builder")) -local world1Prebuilt = Workspace:FindFirstChild("World1Map") -local GROUND_Y = 4 -- верх земли в мирах (запасная высота для groundY) +WorldBuilder.applyLighting() ---------------------------------------------------------------- точка появления в лобби @@ -1033,7 +1044,7 @@ if not spawn then spawn.Parent = Workspace end spawn.Anchored = true -spawn.Size = V(8, 0.2, 8) +spawn.Size = Vector3.new(8, 0.2, 8) spawn.CFrame = CFrame.new(0, 1.15, 57) spawn.Transparency = 1 spawn.Duration = 0 @@ -1043,1189 +1054,10 @@ for _, d in ipairs(spawn:GetChildren()) do end end -if Workspace:FindFirstChild("FishingMap") then - return -end +---------------------------------------------------------------- карта -local map = Instance.new("Folder") -map.Name = "FishingMap" -map.Parent = Workspace -local zonesFolder = Instance.new("Folder") -zonesFolder.Name = "FishingZones" -zonesFolder.Parent = map - ----------------------------------------------------------------- помощники - -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 groundY(x, z) - local params = RaycastParams.new() - params.FilterType = Enum.RaycastFilterType.Include - params.FilterDescendantsInstances = { terrain } - params.IgnoreWater = true - local hit = Workspace:Raycast(V(x, 150, z), V(0, -300, 0), params) - return hit and hit.Position.Y or GROUND_Y, hit and hit.Material -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 - -local function npc(name, cf, colors, action, actionText) - 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(cf) - rig.Parent = map - - 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 - if action then - prompt(root, actionText, name, action, 14) - end - return rig -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 - return counter -end - -local function portal(baseCF, title, color, worldId, locked) - 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 - ----------------------------------------------------------------- ЛОББИ - -local FLOOR = 1 -- верх пола лобби - -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 - --- живая изгородь по краю (с проходами) -for deg = 0, 359, 7 do - local skip = (deg > 80 and deg < 100) or (deg > 255 and deg < 285) or deg < 8 or deg > 352 or (deg > 172 and deg < 188) - if not skip then - 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 -end - --- магазин (запад) и скупка (восток) -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, - "КАК ИГРАТЬ\n1. Портал «Мир 1» или кнопка 🌍 Миры\n2. Удочка — клавиша 1, у воды зажми ЛКМ и отпусти\n3. Клюёт → кликай в зелёную зону\n4. 🎒 Сумка — B, 📜 Задания — Q\n5. Собирай коллекцию — получай награды!", - Color3.fromRGB(255, 245, 225), { TextXAlignment = Enum.TextXAlignment.Left }) -end - ----------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО -do - -- готовый уровень из плейса или собранный сейчас; кладём в FishingMap — там игра ищет маркеры - local w1map = world1Prebuilt or World1Builder.build(map) - w1map.Parent = map - -- NPC стоят на маркерах — их можно двигать в Studio - local seller = w1map:FindFirstChild("World1NpcSeller", true) - if seller then - npc("Скупщик Гриша", seller.CFrame, { - 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 then - npc("Дед Петрович", grandpa.CFrame, { - 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:FindFirstChildOfClass("SurfaceGui") then - local lines = { "🐟 КТО ВОДИТСЯ В ОЗЕРЕ" } - for _, f in ipairs(Config.Zones.World1.fish) do - local r = Config.Rarities[f.rarity] - table.insert(lines, ("%s — %s"):format(r.color:ToHex(), f.name, r.name)) - end - surfaceText(board, Enum.NormalId.Front, table.concat(lines, "\n"), Color3.new(1, 1, 1)) - 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({ Size = V(13, 10, 0.5), CFrame = cf * CFrame.new(0, 7, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) - local lines = { ("%s"):format(titleHex, title) } - for _, f in ipairs(Config.Zones[worldId].fish) do - local r = Config.Rarities[f.rarity] - table.insert(lines, ("%s — %s"):format(r.color:ToHex(), f.name, r.name)) - end - surfaceText(board, Enum.NormalId.Front, table.concat(lines, "\n"), Color3.new(1, 1, 1)) -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.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 - for _, h in ipairs(HOLES) do - terrain:FillCylinder(CFrame.new(W3 + V(h[1], -1, h[2])), 4, 6, Enum.Material.Water) - 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() - task.delay(5, ensureLakeWater) - 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 +local map = Workspace:FindFirstChild("FishingMap") or WorldBuilder.build() +WorldBuilder.prepareRuntime(map) ]=====]) make('Script', 'GameServer', game.ServerScriptService, [=====[-- GameServer (Script) -> ServerScriptService -- Логика игры: данные, удача, рыбалка с анимацией, сумка, магазин, улучшения, @@ -2270,7 +1102,7 @@ local function defaultData() rod = "Basic", rods = { Basic = true }, rodLevels = {}, bag = "Pouch", bags = { Pouch = true }, items = {}, discovered = {}, claimed = {}, - quests = {}, daily = { last = 0, streak = 0 }, + chain = { index = 1, step = 1, progress = 0, tier = 0 }, daily = { last = 0, streak = 0 }, boostUntil = 0, boostBonus = 0, totalCaught = 0, nextUid = 1, receipts = {}, } @@ -2397,13 +1229,58 @@ local function sendInventory(player) 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", data.quests, { + 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), @@ -2484,79 +1361,54 @@ local function applyPotion(data, bonus, duration) data.boostUntil = math.max(os.time(), data.boostUntil) + duration end ----------------------------------------------------------------- задания +---------------------------------------------------------------- задания: прогресс цепочки -local function makeQuest(data, exclude) - local pool = {} - for _, q in ipairs(Config.Quests) do - if not exclude[q.kind] then - table.insert(pool, q) - end +-- у старых сохранений вместо цепочки были три случайных задания +local function ensureChain(data) + if type(data.chain) ~= "table" then + data.chain = { index = 1, step = 1, progress = 0, tier = 0 } end - if #pool == 0 then - pool = Config.Quests - end - local t = pool[rng:NextInteger(1, #pool)] - local goal = t.goals[rng:NextInteger(1, #t.goals)] - local mult = 1 + (data.level - 1) * 0.25 - return { - kind = t.kind, goal = goal, progress = 0, - coins = math.max(10, math.floor(t.coins * goal * mult)), - xp = math.max(10, math.floor(t.xp * goal * mult)), - } + data.quests = nil end -local function ensureQuests(data) - local kinds = {} - for _, q in ipairs(data.quests) do - kinds[q.kind] = true - end - while #data.quests < Config.QuestSlots do - local q = makeQuest(data, kinds) - kinds[q.kind] = true - table.insert(data.quests, q) - end -end - -local function questProgress(player, kind, amount) +-- absolute = true: amount — текущее значение (серия), а не прибавка +local function questProgress(player, kind, amount, absolute) local data = profiles[player] if not data then return end - local changed = false - for _, q in ipairs(data.quests) do - if q.kind == kind and q.progress < q.goal then - q.progress = math.min(q.goal, q.progress + amount) - changed = true - if q.progress >= q.goal then - notify(player, "📜 Задание готово! (Q)", GOLD) - end - end - end - if changed then - sendQuests(player) - end -end - -local function claimQuest(player, index) - local data = profiles[player] - local q = data and type(index) == "number" and data.quests[index] - if not q or q.progress < q.goal then + local chain, step = currentChain(data) + if step[1] ~= kind then return end - data.coins += q.coins - addXp(player, data, q.xp) - local kinds = {} - for i, other in ipairs(data.quests) do - if i ~= index then - kinds[other.kind] = true + 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 - kinds[q.kind] = true - data.quests[index] = makeQuest(data, kinds) - updateStats(player) sendQuests(player) - notify(player, ("📜 Награда: +%d 💰 +%d XP"):format(q.coins, q.xp), GREEN) end local function claimDaily(player) @@ -2837,6 +1689,34 @@ 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) @@ -3041,7 +1921,7 @@ local function onCast(player, power) remote:FireClient(player, "CastFail") return end - local s = { stage = "casting", fish = fish, tool = tool } + 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 } @@ -3104,6 +1984,7 @@ local function onCast(player, power) stopFishing(player, false) remote:FireClient(player, "Escaped") notify(player, "🐟 Рыба ушла", RED) + breakCombo(player) end end) end @@ -3132,11 +2013,18 @@ local function onCatch(player, success, misses) 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, @@ -3162,22 +2050,26 @@ local function onCatch(player, success, misses) if fromPos then showFishFlight(player, fish, fromPos) end - remote:FireClient(player, "Caught", fish, { new = isNew, record = isRecord }) + 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 rank >= 4 then - questProgress(player, "epic", 1) - end - if fish.mutation then - questProgress(player, "mutation", 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 ---------------------------------------------------------------- скупка @@ -3233,6 +2125,7 @@ local function sellItems(player, filterUid) updateStats(player) sendInventory(player) remote:FireClient(player, "Sold", total, count) + questProgress(player, "sell", count) questProgress(player, "earn", total) end @@ -3266,6 +2159,7 @@ local function buy(player, kind, id) end updateStats(player) notify(player, ("✨ %s улучшена до +%d!"):format(rod.name, lvl + 1), GOLD) + questProgress(player, "buy", 1) return end if kind == "Potion" then @@ -3285,6 +2179,7 @@ local function buy(player, kind, id) 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 @@ -3299,6 +2194,7 @@ local function buy(player, kind, 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) @@ -3310,6 +2206,7 @@ local function buy(player, kind, id) end data.coins -= item.price owned[id] = true + bought = true notify(player, "✅ " .. item.name, GREEN) end if kind == "Rod" then @@ -3321,6 +2218,9 @@ local function buy(player, kind, id) attachBag(player) end updateStats(player) + if bought then + questProgress(player, "buy", 1) + end end ---------------------------------------------------------------- телепорт @@ -3443,8 +2343,6 @@ remote.OnServerEvent:Connect(function(player, action, a, b) teleportTo(player, a) elseif action == "ClaimCollection" then claimCollection(player, a, b) - elseif action == "ClaimQuest" then - claimQuest(player, a) elseif action == "ClaimDaily" then claimDaily(player) elseif action == "RequestInventory" then @@ -3532,6 +2430,105 @@ task.spawn(function() 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) @@ -3549,7 +2546,7 @@ local function onPlayerAdded(player) return end loadPasses(player) - ensureQuests(data) + ensureChain(data) profiles[player] = data loadedOk[player] = ok updateStats(player) @@ -3576,6 +2573,7 @@ end Players.PlayerRemoving:Connect(function(player) stopFishing(player, false) + combo[player], comboUntil[player] = nil, nil saveData(player) profiles[player] = nil loadedOk[player] = nil @@ -3599,6 +2597,10 @@ task.spawn(function() 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 @@ -3614,7 +2616,8 @@ make('ModuleScript', 'World1Builder', game.ServerScriptService, [=====[-- World1 -- Команда для Command Bar (строка внизу Studio): -- require(game.ServerScriptService.World1Builder:Clone()).bake() -- bake() стирает старую папку Workspace.World1Map и террейн этого мира и строит всё заново. --- Если папки World1Map в плейсе нет, MapBuilder при запуске игры строит уровень этим же модулем. +-- Обычно уровень собирается вместе со всей картой: WorldBuilder.bake() (см. README). +-- Если папки World1Map в плейсе нет, WorldBuilder строит уровень этим же модулем. -- -- Что нужно игре от уровня (не удаляйте и не переименовывайте): -- маркеры World1Spawn, GuideFishSpot, GuideSell, World1NpcSeller, World1NpcGrandpa — невидимые @@ -4604,6 +3607,1398 @@ function Builder.bake() return map end +return Builder +]=====]) +make('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 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 + +function Builder.applyLighting() + Lighting.ClockTime = 14.5 + Lighting.Brightness = 2.3 + Lighting.Ambient = Color3.fromRGB(70, 70, 85) + Lighting.OutdoorAmbient = Color3.fromRGB(140, 145, 160) + Lighting.EnvironmentDiffuseScale = 0.6 + Lighting.EnvironmentSpecularScale = 0.8 + ensure("Atmosphere", Lighting, { + Density = 0.25, Offset = 0.12, Glare = 0, Haze = 0.6, + Color = Color3.fromRGB(200, 215, 232), Decay = Color3.fromRGB(110, 140, 175), + }) + ensure("BloomEffect", Lighting, { Intensity = 0.5, Size = 24, Threshold = 1.4 }) + ensure("ColorCorrectionEffect", Lighting, { Saturation = 0.15, Contrast = 0.06, Brightness = 0.02 }) + ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.8 }) +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 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 = { ("%s"):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, ("%s — %s"):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 + +-- лавка: 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 + return counter +end + +local function portal(baseCF, title, color, worldId, locked) + 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 + + -- живая изгородь по краю (с проходами) + for deg = 0, 359, 7 do + local skip = (deg > 80 and deg < 100) or (deg > 255 and deg < 285) or deg < 8 or deg > 352 or (deg > 172 and deg < 188) + if not skip then + 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 + end + + -- магазин (запад) и скупка (восток) + 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, + "КАК ИГРАТЬ\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) + w1map.Parent = map + -- 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 ]=====]) make('LocalScript', 'FishingClient', game.StarterPlayer.StarterPlayerScripts, [=====[-- FishingClient (LocalScript) -> StarterPlayer > StarterPlayerScripts @@ -4941,7 +5336,8 @@ local function showCatch(fish, extra) catchName.TextColor3 = r.color catchInfo.Text = ("%s%s · %.2f кг"):format( hex(r.color), r.name, mut and (" · " .. mut.name .. " x" .. mut.mult .. "") or "", fish.weight) - catchValue.Text = ("💰 %s ⭐ +%d XP"):format(fmt(fish.value), fish.xp * ((extra and extra.new) and 2 or 1)) + 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() @@ -5112,7 +5508,7 @@ end ---------------------------------------------------------------- данные с сервера local inventory, discovered, claimed = {}, {}, {} -local quests, daily = {}, { available = false, streak = 0, nextStreak = 1 } +local chain, daily = nil, { available = false, streak = 0, nextStreak = 1 } ---------------------------------------------------------------- магазин @@ -5500,35 +5896,55 @@ local questWin = makeWindow("📜 Задания", Color3.fromRGB(200, 140, 40), local questList = scrollArea(questWin.pages.quests) local dailyPage = questWin.pages.daily -local function questText(q) - local t = Config.Quests[1] - for _, def in ipairs(Config.Quests) do - if def.kind == q.kind then - t = def - end +local function questText(kind, goal) + local t = Config.QuestKinds[kind] + if not t then + return kind end - return string.find(t.text, "%%d") and t.text:format(q.goal) or t.text + 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) - text({ Size = UDim2.new(1, -4, 0, 30), LayoutOrder = 0, Font = BODY2, TextSize = 14, TextColor3 = C.muted, Text = "Выполняй задания — после награды появится новое.", Parent = questList }) - for i, q in ipairs(quests) do - local done = q.progress >= q.goal - local row = new("Frame", { Size = UDim2.new(1, -4, 0, 92), BackgroundColor3 = WHITE, LayoutOrder = i, Parent = questList }, - { corner(14), stroke(done and C.green or C.line, 2, done and 0 or 0.45), gradient(C.panel2, C.panel, 90) }) - text({ Size = UDim2.new(1, -190, 0, 28), Position = UDim2.fromOffset(16, 8), Font = TITLE, TextSize = 19, Text = questText(q), TextTruncate = Enum.TextTruncate.AtEnd, Parent = row }) - progressBar(row, UDim2.fromOffset(16, 42), UDim2.new(1, -200, 0, 14), q.progress / q.goal, done and C.green or C.gold) - text({ Size = UDim2.new(1, -190, 0, 20), Position = UDim2.fromOffset(16, 62), Font = BODY2, TextSize = 13, TextColor3 = C.muted, RichText = true, - Text = ("%s / %s · +%s 💰 +%s XP"):format(fmt(q.progress), fmt(q.goal), fmt(q.coins), fmt(q.xp)), Parent = row }) - btn({ - Size = UDim2.fromOffset(150, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 0), - BackgroundColor3 = done and C.green or C.grey, AutoButtonColor = done, Text = done and "🎁 Забрать" or "В процессе", TextSize = 18, Parent = row, - }, done and function() - remote:FireServer("ClaimQuest", i) - end or nil) + if not chain then + return end + text({ + Size = UDim2.new(1, -4, 0, 30), LayoutOrder = 0, Font = TITLE, TextSize = 22, RichText = true, + Text = ("%s круг %d · награда сразу, следующее задание — тоже"):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 = ("🎁 За всю цепочку: +%s 💰 +%s XP%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 @@ -5615,13 +6031,8 @@ sideButton(5, "💎", "Донат", nil, Color3.fromRGB(150, 80, 210), function( end) local function refreshDots() - local q = false - for _, quest in ipairs(quests) do - if quest.progress >= quest.goal then - q = true - end - end - sideDots["Задания"].Visible = q or daily.available + -- задания цепочки награждаются сами, точка — только для ежедневной награды + sideDots["Задания"].Visible = daily.available local c = false for _, w in ipairs(Config.Worlds) do local zone = Config.Zones[w.id] @@ -6144,18 +6555,58 @@ local snow = new("ParticleEmitter", { }) local lastWorldId = "none" local terrain = workspace.Terrain -local defaultWater = Color3.fromRGB(10, 55, 70) --- то, что мир может поменять под себя (вода, оттенок, цвета травы и песка); остальные миры — как в MapBuilder -local DEFAULT_LOOK = { waterTransparency = 0.15, waveSize = 0.3, tint = Color3.new(1, 1, 1) } +-- то, что мир может поменять под себя (оттенок, цвета травы и песка); вода не трогается — она из свойств 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, +} +local lookDefaults = {} + +local function applyLook(world) + -- исходные значения запоминаем до первой правки; эффект мог ещё не прийти с сервера, тогда в следующий раз + for _, w in ipairs(Config.Worlds) 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 typeof(v) == "boolean" then obj[prop] = v else goal[prop] = v end + end + TweenService:Create(obj, TweenInfo.new(2), goal):Play() + end + end +end + local function applyAmbience(world) local clock = (world and world.clock) or 14.5 TweenService:Create(Lighting, TweenInfo.new(2), { ClockTime = clock }):Play() - terrain.WaterColor = (world and world.water) or defaultWater - terrain.WaterTransparency = (world and world.waterTransparency) or DEFAULT_LOOK.waterTransparency - terrain.WaterWaveSize = (world and world.waveSize) or DEFAULT_LOOK.waveSize local cc = Lighting:FindFirstChildOfClass("ColorCorrectionEffect") if cc then TweenService:Create(cc, TweenInfo.new(2), { TintColor = (world and world.tint) or DEFAULT_LOOK.tint }):Play() @@ -6163,7 +6614,7 @@ local function applyAmbience(world) -- цвета материалов террейна общие для всей карты, поэтому меняем их только у себя и возвращаем при выходе if not defaultTerrainColors then defaultTerrainColors = {} - for _, name in ipairs({ "Snow", "Salt", "Mud", "Sand" }) do + for _, name in ipairs({ "Snow", "Salt", "Mud", "Sand", "Rock", "Slate" }) do defaultTerrainColors[name] = terrain:GetMaterialColor(Enum.Material[name]) end end @@ -6179,6 +6630,7 @@ local function applyAmbience(world) Color = frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232), }):Play() end + applyLook(world) snow.Rate = (world and world.id == "World3") and 140 or 0 end @@ -6460,11 +6912,45 @@ local function guideRoute(step, pos, world) 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() - -- пока сервер не прислал шаг (данные ещё грузятся), ничего не показываем - if not hrp or player:GetAttribute("Tutorial") == nil or step >= Config.TutorialDone then + -- пока сервер не прислал шаг (данные ещё грузятся), обучение не показываем; + -- после обучения линия ведёт к скупщику, когда сумка полна + 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) @@ -6480,7 +6966,9 @@ RunService.RenderStepped:Connect(function() local world = Config.WorldAt(pos) -- переходы между шагами - if step <= 1 and world and world.id == "World1" then + if not tutorialOn then + -- обучение пройдено, остаётся только дорога к скупщику + elseif step <= 1 and world and world.id == "World1" then advanceTutorial(2) elseif step == 0 then local board = guideMarker("GuideBoard") @@ -6497,7 +6985,15 @@ RunService.RenderStepped:Connect(function() end step = tutorialStep() - local route, hint, key = guideRoute(step, pos, world) + 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 guideMarker("GuideSell")) 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 @@ -6564,9 +7060,365 @@ RunService.RenderStepped:Connect(function() 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 ("🎣 %s — можно купить!"):format(r.name), 1, C.green + end + return ("🎣 До «%s»: ещё %s 💰"):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: ещё %s 💰"):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 ("осталась %s"):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 · %s/%s"):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, ("🎒 Сумка полна — продай рыбу!"), 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) + playUiSound(DING, 0.5) + 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) +remote.OnClientEvent:Connect(function(action, a, b, c, d) if action == "Notify" then notify(a, b) elseif action == "Cast" then @@ -6600,17 +7452,55 @@ remote.OnClientEvent:Connect(function(action, a, b, c) 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 - quests = a or {} + 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)) + playUiSound(DING, 0.6) + 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) + playUiSound(DING, 0.8) + 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) + playUiSound(DING, 0.8) + 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 @@ -6622,4 +7512,4 @@ end) remote:FireServer("RequestInventory") ]=====]) -print('DONE! 6 scripts installed. Press Play (F5).') +print('DONE! 7 scripts installed. Press Play (F5).') diff --git a/src/ReplicatedStorage/FishConfig.lua b/src/ReplicatedStorage/FishConfig.lua index f634344..409b453 100644 --- a/src/ReplicatedStorage/FishConfig.lua +++ b/src/ReplicatedStorage/FishConfig.lua @@ -63,6 +63,9 @@ Config.Worlds = { { -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, diff --git a/src/ServerScriptService/MapBuilder.server.lua b/src/ServerScriptService/MapBuilder.server.lua index 8fc6a65..5c9f643 100644 --- a/src/ServerScriptService/MapBuilder.server.lua +++ b/src/ServerScriptService/MapBuilder.server.lua @@ -1,57 +1,14 @@ -- MapBuilder (Script) -> ServerScriptService --- Строит лобби и Мир 1 «Тихое озеро» при запуске игры, настраивает свет и воду. --- Если в Workspace уже есть папка "FishingMap", детали не строятся заново --- (террейн, свет и точка появления настраиваются всегда). +-- При запуске игры: свет, точка появления в лобби, карта и NPC. +-- Карту (лобби и все миры) строит модуль WorldBuilder. Обычно она уже собрана в Studio и +-- сохранена в плейсе (Workspace.FishingMap) — тогда берём её как есть, правки руками сохраняются. +-- Если карты в плейсе нет, строим её здесь тем же модулем. local Workspace = game:GetService("Workspace") -local Lighting = game:GetService("Lighting") -local Players = game:GetService("Players") -local ReplicatedStorage = game:GetService("ReplicatedStorage") -local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) -local Models = require(ReplicatedStorage:WaitForChild("GameModels")) +local WorldBuilder = require(script.Parent:WaitForChild("WorldBuilder")) -local V = Vector3.new -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 - -Lighting.ClockTime = 14.5 -Lighting.Brightness = 2.3 -Lighting.Ambient = Color3.fromRGB(70, 70, 85) -Lighting.OutdoorAmbient = Color3.fromRGB(140, 145, 160) -Lighting.EnvironmentDiffuseScale = 0.6 -Lighting.EnvironmentSpecularScale = 0.8 -ensure("Atmosphere", Lighting, { - Density = 0.25, Offset = 0.12, Glare = 0, Haze = 0.6, - Color = Color3.fromRGB(200, 215, 232), Decay = Color3.fromRGB(110, 140, 175), -}) -ensure("BloomEffect", Lighting, { Intensity = 0.5, Size = 24, Threshold = 1.4 }) -ensure("ColorCorrectionEffect", Lighting, { Saturation = 0.15, Contrast = 0.06, Brightness = 0.02 }) -ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.8 }) - ----------------------------------------------------------------- вода --- цвет, прозрачность и волны воды не задаются скриптом: берутся из свойств Terrain в плейсе - -local terrain = Workspace.Terrain - ----------------------------------------------------------------- МИР 1: «Тихое озеро» --- Уровень собирает модуль World1Builder: один раз в Studio (тогда он лежит в Workspace.World1Map --- вместе с террейном и правится руками как обычные модели) или здесь при запуске, если готового --- уровня в плейсе нет. Сам уровень и NPC подключаются ниже, после создания папки FishingMap. - -local World1Builder = require(script.Parent:WaitForChild("World1Builder")) -local world1Prebuilt = Workspace:FindFirstChild("World1Map") -local GROUND_Y = 4 -- верх земли в мирах (запасная высота для groundY) +WorldBuilder.applyLighting() ---------------------------------------------------------------- точка появления в лобби @@ -61,7 +18,7 @@ if not spawn then spawn.Parent = Workspace end spawn.Anchored = true -spawn.Size = V(8, 0.2, 8) +spawn.Size = Vector3.new(8, 0.2, 8) spawn.CFrame = CFrame.new(0, 1.15, 57) spawn.Transparency = 1 spawn.Duration = 0 @@ -71,1186 +28,7 @@ for _, d in ipairs(spawn:GetChildren()) do end end -if Workspace:FindFirstChild("FishingMap") then - return -end +---------------------------------------------------------------- карта -local map = Instance.new("Folder") -map.Name = "FishingMap" -map.Parent = Workspace -local zonesFolder = Instance.new("Folder") -zonesFolder.Name = "FishingZones" -zonesFolder.Parent = map - ----------------------------------------------------------------- помощники - -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 groundY(x, z) - local params = RaycastParams.new() - params.FilterType = Enum.RaycastFilterType.Include - params.FilterDescendantsInstances = { terrain } - params.IgnoreWater = true - local hit = Workspace:Raycast(V(x, 150, z), V(0, -300, 0), params) - return hit and hit.Position.Y or GROUND_Y, hit and hit.Material -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 - -local function npc(name, cf, colors, action, actionText) - 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(cf) - rig.Parent = map - - 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 - if action then - prompt(root, actionText, name, action, 14) - end - return rig -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 - return counter -end - -local function portal(baseCF, title, color, worldId, locked) - 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 - ----------------------------------------------------------------- ЛОББИ - -local FLOOR = 1 -- верх пола лобби - -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 - --- живая изгородь по краю (с проходами) -for deg = 0, 359, 7 do - local skip = (deg > 80 and deg < 100) or (deg > 255 and deg < 285) or deg < 8 or deg > 352 or (deg > 172 and deg < 188) - if not skip then - 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 -end - --- магазин (запад) и скупка (восток) -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, - "КАК ИГРАТЬ\n1. Портал «Мир 1» или кнопка 🌍 Миры\n2. Удочка — клавиша 1, у воды зажми ЛКМ и отпусти\n3. Клюёт → кликай в зелёную зону\n4. 🎒 Сумка — B, 📜 Задания — Q\n5. Собирай коллекцию — получай награды!", - Color3.fromRGB(255, 245, 225), { TextXAlignment = Enum.TextXAlignment.Left }) -end - ----------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО -do - -- готовый уровень из плейса или собранный сейчас; кладём в FishingMap — там игра ищет маркеры - local w1map = world1Prebuilt or World1Builder.build(map) - w1map.Parent = map - -- NPC стоят на маркерах — их можно двигать в Studio - local seller = w1map:FindFirstChild("World1NpcSeller", true) - if seller then - npc("Скупщик Гриша", seller.CFrame, { - 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 then - npc("Дед Петрович", grandpa.CFrame, { - 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:FindFirstChildOfClass("SurfaceGui") then - local lines = { "🐟 КТО ВОДИТСЯ В ОЗЕРЕ" } - for _, f in ipairs(Config.Zones.World1.fish) do - local r = Config.Rarities[f.rarity] - table.insert(lines, ("%s — %s"):format(r.color:ToHex(), f.name, r.name)) - end - surfaceText(board, Enum.NormalId.Front, table.concat(lines, "\n"), Color3.new(1, 1, 1)) - 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({ Size = V(13, 10, 0.5), CFrame = cf * CFrame.new(0, 7, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) - local lines = { ("%s"):format(titleHex, title) } - for _, f in ipairs(Config.Zones[worldId].fish) do - local r = Config.Rarities[f.rarity] - table.insert(lines, ("%s — %s"):format(r.color:ToHex(), f.name, r.name)) - end - surfaceText(board, Enum.NormalId.Front, table.concat(lines, "\n"), Color3.new(1, 1, 1)) -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.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 - for _, h in ipairs(HOLES) do - terrain:FillCylinder(CFrame.new(W3 + V(h[1], -1, h[2])), 4, 6, Enum.Material.Water) - 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() - task.delay(5, ensureLakeWater) - 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 +local map = Workspace:FindFirstChild("FishingMap") or WorldBuilder.build() +WorldBuilder.prepareRuntime(map) diff --git a/src/ServerScriptService/World1Builder.lua b/src/ServerScriptService/World1Builder.lua index 3307a26..81a711c 100644 --- a/src/ServerScriptService/World1Builder.lua +++ b/src/ServerScriptService/World1Builder.lua @@ -4,7 +4,8 @@ -- Команда для Command Bar (строка внизу Studio): -- require(game.ServerScriptService.World1Builder:Clone()).bake() -- bake() стирает старую папку Workspace.World1Map и террейн этого мира и строит всё заново. --- Если папки World1Map в плейсе нет, MapBuilder при запуске игры строит уровень этим же модулем. +-- Обычно уровень собирается вместе со всей картой: WorldBuilder.bake() (см. README). +-- Если папки World1Map в плейсе нет, WorldBuilder строит уровень этим же модулем. -- -- Что нужно игре от уровня (не удаляйте и не переименовывайте): -- маркеры World1Spawn, GuideFishSpot, GuideSell, World1NpcSeller, World1NpcGrandpa — невидимые diff --git a/src/ServerScriptService/WorldBuilder.lua b/src/ServerScriptService/WorldBuilder.lua new file mode 100644 index 0000000..4e21b98 --- /dev/null +++ b/src/ServerScriptService/WorldBuilder.lua @@ -0,0 +1,1391 @@ +-- 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 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 + +function Builder.applyLighting() + Lighting.ClockTime = 14.5 + Lighting.Brightness = 2.3 + Lighting.Ambient = Color3.fromRGB(70, 70, 85) + Lighting.OutdoorAmbient = Color3.fromRGB(140, 145, 160) + Lighting.EnvironmentDiffuseScale = 0.6 + Lighting.EnvironmentSpecularScale = 0.8 + ensure("Atmosphere", Lighting, { + Density = 0.25, Offset = 0.12, Glare = 0, Haze = 0.6, + Color = Color3.fromRGB(200, 215, 232), Decay = Color3.fromRGB(110, 140, 175), + }) + ensure("BloomEffect", Lighting, { Intensity = 0.5, Size = 24, Threshold = 1.4 }) + ensure("ColorCorrectionEffect", Lighting, { Saturation = 0.15, Contrast = 0.06, Brightness = 0.02 }) + ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.8 }) +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 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 = { ("%s"):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, ("%s — %s"):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 + +-- лавка: 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 + return counter +end + +local function portal(baseCF, title, color, worldId, locked) + 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 + + -- живая изгородь по краю (с проходами) + for deg = 0, 359, 7 do + local skip = (deg > 80 and deg < 100) or (deg > 255 and deg < 285) or deg < 8 or deg > 352 or (deg > 172 and deg < 188) + if not skip then + 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 + end + + -- магазин (запад) и скупка (восток) + 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, + "КАК ИГРАТЬ\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) + w1map.Parent = map + -- 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