diff --git a/.gitignore b/.gitignore index dbcd4e3..c511c2f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ # Rojo / инструменты sourcemap.json +rojo.exe +backups/ diff --git a/.mcp.json b/.mcp.json new file mode 100644 index 0000000..101a161 --- /dev/null +++ b/.mcp.json @@ -0,0 +1,9 @@ +{ + "mcpServers": { + "Roblox_Studio": { + "type": "stdio", + "command": "cmd.exe", + "args": ["/c", "cd /d %LOCALAPPDATA%\\Roblox && .\\mcp.bat"] + } + } +} \ No newline at end of file diff --git a/Fishing.lnk b/Fishing.lnk new file mode 100644 index 0000000..597bfb4 Binary files /dev/null and b/Fishing.lnk differ diff --git a/README.md b/README.md index 1575da6..e4ca5c4 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ ## Структура -``` src/ ReplicatedStorage/ FishConfig.lua, GameModels.lua (ModuleScript) ServerScriptService/ MapBuilder.server.lua, GameServer.server.lua (Script) @@ -18,6 +17,26 @@ 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/WorldBuilder.lua` («Тихое озеро» он берёт из `World1Builder.lua`). Порядок: + +1. Откройте плейс в Studio и подключите Rojo (**Plugins → Rojo → Connect**). +2. В **Command Bar** выполните: + ```lua + require(game.ServerScriptService.WorldBuilder:Clone()).bake() + ``` + В `Workspace` появится папка `FishingMap` (лобби и миры: детали и модели), а на месте миров — террейн. +3. Сохраните плейс (**Ctrl+S**). Дальше двигайте, удаляйте и добавляйте объекты как обычно, в том числе модели из Toolbox. Игра возьмёт карту из плейса и не будет генерировать её заново. + +Повторный `bake()` стирает `FishingMap` и террейн миров и строит всё заново, ручные правки при этом пропадут. Исключение — «Тихое озеро» (`FishingMap/World1Map`): его `bake()` переносит в новую карту как есть, вместе с террейном. Чтобы собрать и его заново, сначала удалите `World1Map`. + +Цвета материалов террейна общие на весь плейс, и в нём сохранены цвета «Тихого озера» (зелёный `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 1. Откройте плейс в Roblox Studio (например, шаблон **Baseplate**). diff --git a/build.ps1 b/build.ps1 index 437b0d6..6667a28 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,5 +1,9 @@ # 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 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) $root = $PSScriptRoot $enc = New-Object System.Text.UTF8Encoding($false) @@ -9,7 +13,10 @@ $scripts = @( @{ Name = 'GameModels'; Class = 'ModuleScript'; Service = 'ReplicatedStorage'; Path = 'src\ReplicatedStorage\GameModels.lua'; Rbxmx = '2_GameModels_ReplicatedStorage.rbxmx' }, @{ 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 = 'FishingClient'; Class = 'LocalScript'; Service = 'StarterPlayerScripts'; Path = 'src\StarterPlayer\StarterPlayerScripts\FishingClient.client.lua'; Rbxmx = '5_FishingClient_StarterPlayerScripts.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' }, + @{ Name = 'Loading'; Class = 'LocalScript'; Service = 'ReplicatedFirst'; Path = 'src\ReplicatedFirst\Loading.client.lua'; Rbxmx = '8_Loading_ReplicatedFirst.rbxmx' } ) $header = '' @@ -30,18 +37,26 @@ function ServiceItem($class, $children) { $rs = ($scripts | Where-Object { $_.Service -eq 'ReplicatedStorage' } | ForEach-Object { ScriptItem $_ }) -join '' $sss = ($scripts | Where-Object { $_.Service -eq 'ServerScriptService' } | ForEach-Object { ScriptItem $_ }) -join '' $sps = ($scripts | Where-Object { $_.Service -eq 'StarterPlayerScripts' } | ForEach-Object { ScriptItem $_ }) -join '' +$rf = ($scripts | Where-Object { $_.Service -eq 'ReplicatedFirst' } | ForEach-Object { ScriptItem $_ }) -join '' $place = $header + "`n" + + (ServiceItem 'ReplicatedFirst' $rf) + (ServiceItem 'ReplicatedStorage' $rs) + (ServiceItem 'ServerScriptService' $sss) + (ServiceItem 'StarterPlayer' (ServiceItem 'StarterPlayerScripts' $sps)) + "`n" -[System.IO.File]::WriteAllText((Join-Path $root 'Fishing.rbxlx'), $place, $enc) +$placePath = Join-Path $root 'Fishing.rbxlx' +if ($Force -or -not (Test-Path $placePath)) { + [System.IO.File]::WriteAllText($placePath, $place, $enc) + Write-Host "Built Fishing.rbxlx" +} else { + Write-Host "Fishing.rbxlx already exists - left untouched (it holds the map built in Studio; scripts come via Rojo). Use -Force to recreate." +} # --- install/*.rbxmx and install/INSTALL.lua --- $installDir = Join-Path $root 'install' New-Item -ItemType Directory -Force $installDir | Out-Null -$parents = @{ ReplicatedStorage = 'game.ReplicatedStorage'; ServerScriptService = 'game.ServerScriptService'; StarterPlayerScripts = 'game.StarterPlayer.StarterPlayerScripts' } +$parents = @{ ReplicatedStorage = 'game.ReplicatedStorage'; ServerScriptService = 'game.ServerScriptService'; StarterPlayerScripts = 'game.StarterPlayer.StarterPlayerScripts'; ReplicatedFirst = 'game.ReplicatedFirst' } $sb = New-Object System.Text.StringBuilder [void]$sb.Append("local function make(class, name, parent, src)`n local old = parent:FindFirstChild(name)`n if old then old:Destroy() end`n local s = Instance.new(class)`n s.Name = name`n s.Source = src`n s.Parent = parent`nend`nlocal oldMap = workspace:FindFirstChild('FishingMap')`nif oldMap then oldMap:Destroy() end`n") foreach ($s in $scripts) { @@ -52,7 +67,7 @@ foreach ($s in $scripts) { $xml = $header + "`n" + (ScriptItem $s) + "`n" [System.IO.File]::WriteAllText((Join-Path $installDir $s.Rbxmx), $xml, $enc) } -[void]$sb.Append("print('DONE! 5 scripts installed. Press Play (F5).')`n") +[void]$sb.Append("print('DONE! $($scripts.Count) scripts installed. Press Play (F5).')`n") [System.IO.File]::WriteAllText((Join-Path $installDir 'INSTALL.lua'), $sb.ToString(), $enc) -Write-Host "Built Fishing.rbxlx and install/" +Write-Host "Built install/" diff --git a/default.project.json b/default.project.json index cfa9b42..4f117d9 100644 --- a/default.project.json +++ b/default.project.json @@ -2,6 +2,9 @@ "name": "Fishing", "tree": { "$className": "DataModel", + "ReplicatedFirst": { + "$path": "src/ReplicatedFirst" + }, "ReplicatedStorage": { "$path": "src/ReplicatedStorage" }, diff --git a/docs/guild-economy-design.md b/docs/guild-economy-design.md new file mode 100644 index 0000000..058da85 --- /dev/null +++ b/docs/guild-economy-design.md @@ -0,0 +1,135 @@ +# Гильдия рыбаков, экономика и новый стиль интерфейса + +Дизайн-документ. Утверждён пользователем 2026-11-04. Фокус — лобби и Мир 1 «Тихое озеро». +Цель: Мир 1 занимает **1,5–3 часа**, каждые 5–10 минут игрок что-то получает, игра не утомляет. + +--- + +## 1. Валюты + +| Валюта | Ключ в данных | Откуда | На что | +|---|---|---|---| +| 🪙 **Серебро** (основная) | `coins` (не переименовывать в данных, только в интерфейсе) | продажа рыбы, заказы, задания | удочки, сумки, улучшения, наживка | +| 🦪 **Жемчуг** (редкая) | `pearls` | мутации (Блестящая 1, Золотая 3, Радужная 10), босс 5, ежедневка (7-й день 5), повышение ранга 10, иногда заказы | премиум-наживка, переброс заказов (2), слоты ловушек, позже — зачарования и косметика | +| 📜 **Печати гильдии** (репутация) | `seals` | только заказы гильдии и испытания | копятся для повышения ранга (не тратятся) | + +Во всём интерфейсе «монеты/💰» → «серебро/🪙». + +--- + +## 2. Гильдия рыбаков (стержень прогрессии) + +Атмосфера — гильдия авантюристов из аниме: ранги-буквы, доска заказов, испытание на ранг, жетон над головой. + +### Ранги + +| Буква | Ранг | Печатей (всего) | Испытание на ранг | Открывает | +|---|---|---|---|---| +| F | Ученик | 0 | — | Мир 1, доска заказов (3 заказа) | +| E | Подмастерье | 30 | Сдать 5 окуней | **автоловля**, 4-й заказ на доске | +| D | Рыбак | 120 | Поймать «Редкую» рыбу в дождь или грозу | **Мир 2** (+ уровень 8), **ловушки** (1 шт) | +| C | Опытный рыбак | 350 | Нанести урон боссу озера (участие в победе) | ловушки 2 шт, скидка у торговцев 5% | +| B | Мастер | 900 | Собрать коллекцию Мира 1 полностью | **Мир 3** (+ уровень 18), ловушки 3 шт | +| A | Магистр | 2000 | Поймать «Эпическую» ночью | титул «Магистр», скидка 10% | +| S | Легенда | 4500 | Поймать «Мифическую» рыбу | золотой жетон, автоловля без штрафа к редкости | + +- Печати копятся → при достаточном количестве у **главы гильдии** берётся **испытание** → после выполнения — церемония: фанфары, конфетти, +10 жемчуга, объявление на сервер «⚔ Игрок X получил ранг D!». +- **Жетон ранга над головой** (BillboardGui): буква в щите цвета ранга (F серый, E зелёный, D синий, C фиолетовый, B красный, A золотой, S радужный). +- Миры теперь требуют **и уровень, и ранг**. + +### Глава гильдии (NPC) +Имя: **Старейшина Ворон** — седой рыбак с повязкой на глазу. Реплики с характером (наставник из аниме). Стоит в здании гильдии в лобби. + +### Здание гильдии в лобби +Средневековый дом с вывеской «⚓ ГИЛЬДИЯ РЫБАКОВ», знамёна гильдии, **доска заказов** (пергаменты на доске), стол главы. Карта лобби уже собрана в Studio (`Workspace.FishingMap`) — строить в плейсе и сохранить, не ломая существующее лобби (порталы, лавки, фонтан, точки появления). + +--- + +## 3. Заказы гильдии (доска заказов) + +- Личные для каждого игрока, **обновляются каждые 3 часа** (по серверному времени, окно `floor(os.time()/10800)`), можно перебросить один заказ за 2 жемчуга. +- 3 заказа на ранге F, 4 — начиная с E. +- Сложность и награда растут с рангом. + +Типы заказов: +| Тип | Пример | Как засчитывается | +|---|---|---| +| deliver | «Сдай 5 карасей» | рыба **забирается из сумки** при сдаче у доски | +| heavy | «Принеси окуня тяжелее 1 кг» | забирается из сумки | +| weather | «Поймай 3 рыбы в дождь» | по ходу рыбалки | +| night | «Поймай 2 необычные рыбы ночью» | по ходу | +| combo | «Набери серию из 6» | по ходу | +| perfect | «5 забросов в зелёную зону» | по ходу | + +Награда: печати 5–25 (по сложности), серебро, шанс 20% на 1–3 жемчуга. + +--- + +## 4. Наживка + +Лавка наживки — у рыбака на причале Мира 1 и в магазине лобби. Один слот наживки, 1 штука тратится на заброс. + +| Наживка | Цена | Эффект | +|---|---|---| +| Червь | 🪙 40 за 10 шт | клюёт на 10% быстрее | +| Мотыль | 🪙 90 за 10 шт | удача +15% | +| Светлячок | 🪙 120 за 10 шт | ночью удача +30% (вместо +10%) | +| Кровавая приманка | 🪙 400 за 10 шт, ранг D | редкие и выше чаще (вес ×1.5) | +| Жемчужная блесна | 🦪 5 за 5 шт | шанс мутаций ×2 | + +--- + +## 5. Автоловля (ранг E) + +- Кнопка «🎣 Автоловля» (вкл/выкл). Работает, если игрок стоит у воды с удочкой в руках. +- Сервер сам забрасывает и вытаскивает. Штрафы: удача ×0.6, не выше «Редкой», нет бонуса идеального заброса и серии, каждая поимка на 50% дольше. +- Останавливается при полной сумке, при отходе от воды, при смене мира. +- Ранг S снимает ограничение редкости. Позже — пропуск за робуксы «Опытный подмастерье» (без штрафов). + +## 6. Ловушки-вентери (ранг D) + +- В окне гильдии: 1–3 ловушки (по рангу, + слоты за жемчуг позже). +- Каждая ловушка приносит 1 рыбу Мира 1 (обычные/необычные) каждые 15 минут, максимум 16 рыб (4 часа). **Работает и офлайн.** +- «Забрать улов» переносит рыбу в сумку (сколько влезет). + +## 7. Бонус отдыха + +- Пока игрока нет, копится «отдых»: 1 минута двойного опыта за каждые 4 минуты офлайн, максимум 60 минут. +- Тратится, пока игрок ловит. Показывается в HUD («🛌 Отдых ×2 опыт: 23 мин»). + +## 8. Кривая уровней + +- `XPForLevel(level) = floor(50 * level ^ 1.6)` (было `60 + 60*level`). +- Опыт за рыбу не трогаем. До 8 уровня ≈ 3 600 опыта ≈ 1,5–2 часа вместе с заказами. +- Старые сохранения: уровень игрока не понижать. + +--- + +## 9. Новый стиль интерфейса — «средневековая гильдия» + +Вайб — тёплое дерево, пергамент, золотые оковки, багровые ленты. Как в топовых рыболовных плейсах (тёмные панели с золотой рамкой), но **в нашем средневековом стиле**. + +### Палитра +| Токен | Цвет | Где | +|---|---|---| +| woodDark | 40, 28, 20 | фон окон | +| wood | 66, 46, 30 | панели, карточки | +| woodLight | 98, 70, 44 | кнопки вкладок | +| parchment | 236, 220, 180 | вставки с текстом (свитки), текст на тёмном | +| ink | 52, 36, 24 | текст на пергаменте | +| gold | 218, 172, 92 | рамки, заголовки, цены | +| goldBright | 255, 214, 120 | акценты | +| crimson | 150, 40, 35 | ленты заголовков, «закрыть», опасные кнопки | +| forest | 64, 112, 62 | «купить», «забрать» | + +### Элементы +- **Окно**: деревянная панель, золотая рамка в 2 слоя (тёмная + светлая), ромбики-заклёпки по углам, заголовок на **багровой ленте** с золотым текстом, кнопка закрытия — круглая багровая печать «✕». +- **Кнопки**: дерево с золотой окантовкой; основные действия — зелёные «сургучные», опасные — багровые. +- **Карточки**: тёмное дерево, редкость — цветной камень в углу и цветная полоса. +- **Шрифты**: заголовки — с засечками/каллиграфия (проверить, что есть **кириллица**: кандидаты `Merriweather`, `Oswald`, `Nunito`; декоративные — только если кириллица рендерится), текст — читаемый без засечек. Обязательно проверить русский текст в Studio. +- **Иконки** пока эмодзи; позже пользователь нарисует свои (Photopea/Blockbench). + +### Телефон (обязательно) +- `UIScale` по размеру экрана (база 1280×720). +- На узком экране (ширина < 900 или TouchEnabled): боковые кнопки — компактная сетка 2×N у левого края или нижняя панель; окна — почти на весь экран; HUD компактнее; ничего не перекрывает кнопку прыжка (правый низ) и меню Roblox (левый верх). +- Проверить в Studio эмуляторе устройств (iPhone SE, Android 16:9) — ничего не наслаивается. diff --git a/docs/landscape-style.md b/docs/landscape-style.md new file mode 100644 index 0000000..80ad47f --- /dev/null +++ b/docs/landscape-style.md @@ -0,0 +1,25 @@ +# Low-poly landscape — 2026-11-03 + +The baked scene uses flat, matte MaterialVariants for Snow (olive grass), Salt +(ochre paths), and Slate/Rock (cool gray stone). Color and roughness use the +opaque white Roblox built-in `rbxasset://textures/SelfView/whiteRect.png` map; +normal and metalness maps are empty. Geometry supplies the facets. + +## Toolbox credits + +- **FracturedSkies** — [Low Poly Rock Pack FREE](https://create.roblox.com/store/asset/2128776869), used for shoreline boulders and cliff foot rocks. Credit is also stored on `World1Map.LowPolyRockwork`. +- **DaveCam456** — [Low-Poly Rocky Cliff](https://create.roblox.com/store/asset/11751641277), used for cliff faces. +- **DaveCam456** — [Low-Poly Rocky Mountain Border](https://create.roblox.com/store/asset/11751636142), used for perimeter ridges. + +Imported templates are in `ServerStorage.LandscapeAssetLibrary`; only anchored +geometry is copied into the landscape. No imported scripts are used. + +## Reapply + +`install/LOW_POLY_LANDSCAPE.lua` applies materials and places rock meshes onto an +existing baked World1Map. It requires the above templates in the asset library. +The source palette and the live FishConfig/FishingClient were updated together +so entering World1 does not restore the old grass colors. + +Studio changes must be saved with the place. The filesystem build does not +automatically serialize the edited Terrain or imported meshes from Studio. diff --git a/docs/prompt-tihoe-ozero.md b/docs/prompt-tihoe-ozero.md new file mode 100644 index 0000000..8ce19ac --- /dev/null +++ b/docs/prompt-tihoe-ozero.md @@ -0,0 +1,1192 @@ +# Промпт для ChatGPT: переделать локацию «Тихое озеро» по дизайн-макету + +> Как пользоваться: вставьте в ChatGPT весь этот файл целиком **и приложите картинку-макет** (скриншот локации с причалом, лавкой, водопадом). Код проекта, который нужен ChatGPT, уже лежит в приложениях в конце файла. + +--- + +## 1. Роль и задача + +Ты — опытный разработчик Roblox (Luau) и левел-дизайнер. У меня есть игра про рыбалку «Клёвое место». Карта целиком строится **скриптом при запуске игры** — из обычных `Part` и `Terrain`, без моделей из Toolbox, без MeshPart и без загруженных текстур/мешей. Мне нужно, чтобы первая локация **«Тихое озеро» (Мир 1)** выглядела **максимально похоже на приложенный дизайн-макет**: уютное лесное озеро в стиле «стилизованный low-poly мультяшный Roblox», тёплый солнечный вечер, бирюзовая прозрачная вода, водопад со скал, деревянный причал, лавка рыбака, бревенчатые домики, сосновый лес и горы. + +Перепиши код построения Мира 1 так, чтобы локация соответствовала макету, **не ломая игровую механику** (раздел 5). Работай только средствами из раздела 4 и стандартного Roblox API. + +--- + +## 2. Что за проект + +- Roblox, язык Luau. Код синхронизируется в Studio через Rojo. +- Файлы: + - `src/ServerScriptService/MapBuilder.server.lua` — строит всю карту: свет, террейн, лобби, миры. **Основная работа — здесь.** + - `src/ReplicatedStorage/FishConfig.lua` — настройки. Там описаны миры: центр, уровень воды, озёра в виде кругов. По этим кругам игра решает, где вода (заброс, подсказки). + - `src/StarterPlayer/StarterPlayerScripts/FishingClient.client.lua` — интерфейс и эффекты у игрока. При входе в мир функция `applyAmbience(world)` меняет время суток (`world.clock`), цвет воды (`world.water`) и плотность атмосферы. + - `src/ServerScriptService/GameServer.server.lua` — логика: заброс, клёв, продажа, телепорты, обучение. +- **Система координат Мира 1:** + - `W = Vector3.new(0, 0, 1500)` — центр мира. Все координаты внутри мира пишутся как `W + V(x, y, z)`, где `V = Vector3.new`. + - `GROUND_Y = 4` — верх земли (травы). + - `WATER_Y = 0` — поверхность воды. + - Мир — квадрат примерно ±245 studs от центра, по краям невидимые стены (`worldWalls`). + - Масштаб: персонаж ростом около 5 studs, 1 stud ≈ 0.28 м. +- **Ориентация:** игрок появляется в точке прибытия `W + V(0, 4, 94)` и смотрит на север, в сторону −Z, к озеру. Это ровно ракурс макета: игрок на причале, перед ним озеро, вдали водопад и горы. +- **Как устроена сборка:** + 1. Блок «МИР 1: террейн» строится всегда. Он заливает траву, холмы, песчаную чашу озера, ил, воду (`carveLake` прописывает воду и воздух над ней прямо по вокселям), дорожку. + 2. Если в Workspace уже есть папка `FishingMap`, остальной код карты не выполняется. + 3. Блок «МИР 1: ТИХОЕ ОЗЕРО (детали)» строит из Part'ов всё остальное: арку, портал, скупку, доску «Кто водится», костёр, деда-NPC, домик, причалы, лодку, кувшинки, камыш, деревья, кусты, камни, фонари, стены мира. +- Генератор случайных чисел: `local rng = Random.new(7)`. Карта должна получаться одинаковой при каждом запуске, поэтому используй только `rng`, а не `math.random`. + +--- + +## 3. Подробное описание макета (что должно получиться) + +### 3.1 Общее настроение, свет, палитра +- Стилизованная мультяшная графика (как в популярных Roblox-симуляторах): мягкие формы, насыщенные цвета, много мелких деталей у воды. +- **Время суток:** тёплый поздний день, около 16:00–16:30. Солнце низко слева-сзади, всё освещено золотистым светом, тени мягкие и длинные. Небо голубое с крупными белыми кучевыми облаками. +- **Атмосфера:** лёгкая дымка вдали, горы на горизонте голубовато-серые. +- **Палитра** (ориентиры, RGB): + - вода у берега бирюзовая `(40, 185, 175)`, на глубине `(20, 130, 135)`; + - трава светлая `(125, 180, 75)`, трава в тени `(90, 145, 60)`; + - хвоя сосен `(45, 105, 60)` и `(35, 85, 50)`; + - светлое дерево причала `(190, 135, 85)`, тёмное дерево и брёвна `(120, 80, 50)`; + - канат `(215, 180, 125)`; + - скалы `(140, 138, 150)` с зеленоватым мхом `(95, 130, 70)`; + - тёмно-зелёная крыша `(60, 100, 75)`; + - тент лавки: полосы зелёная `(45, 105, 70)` и кремовая `(240, 230, 200)`; + - огни фонарей и окон тёплые `(255, 200, 120)`. + +### 3.2 Озеро и вода +- Большое озеро в центре кадра, вода **прозрачная и бирюзовая**: видно дно, камни и **тени рыб**, медленно плавающих под водой. +- У берегов мелко и светлее, к центру темнее. +- Кувшинки с розовыми цветками группами у берегов. Камыш (рогоз) с коричневыми «початками» у берега справа и у причала. +- Круглые валуны и камни по кромке воды, часть из них в воде. +- Поплавок: красно-белый, на воде расходятся кольца-круги. Механика поплавка уже есть, менять её не нужно. + +### 3.3 Водопад и скалы (дальний план справа) +- На северо-восточном берегу высокая скала из нескольких уступов, серо-фиолетовый камень с пятнами мха и травой сверху. +- С уступа падает широкий **водопад** в озеро. Внизу белая пена и брызги (туман), от него по воде расходится рябь. +- Над водопадом **деревянный арочный мост** с перилами через речку, которая питает водопад. +- На скалах растут сосны. + +### 3.4 Дальний план: холм, вышка, горы, лес +- Позади озера, слева от водопада, **зелёный холм**. +- **Тропинка** серпантином поднимается по холму, вдоль неё деревянный забор и фонари. +- На вершине холма **деревянная смотровая вышка** на сваях с крышей и **зелёным флагом с белой рыбой**. +- Весь задний план — плотный **сосновый лес** (много ёлок разной высоты, тёмные и светлые оттенки). +- За лесом **горы**: крупные, голубовато-серые из-за дымки. + +### 3.5 Средний план: домики +- Слева за лавкой большой **бревенчатый дом**: стены из горизонтальных брёвен, тёмно-зелёная двускатная крыша, каменная **труба с дымком**, тёплый свет в окнах, крыльцо. +- Правее и ниже по берегу второй, поменьше, такой же домик, тоже с дымком из трубы. +- Возле тропинки **деревянный столб-вывеска** с висящим тёмно-зелёным знаменем, на нём белая рыба. +- Справа на воде **деревянные мостки** на сваях, на них фонарь. + +### 3.6 Передний план слева: лавка рыбака (это наша «Скупка») +- Деревянный прилавок под **полосатым зелёно-кремовым тентом**. Над тентом деревянная вывеска с силуэтом рыбы. +- На прилавке **поплавки** (красно-белые шарики) и ящички. Сзади висят **цветные воблеры**: зелёный, жёлтый, оранжевый, синий. +- За прилавком **NPC-продавец**: соломенная шляпа, светлая рубашка, зелёный фартук. +- На углу столба висит **фонарь** с тёплым светом. +- Рядом **бочки** и деревянные ящики. + +### 3.7 Передний план: причал +- Игрок стоит на **широком деревянном причале** из досок. +- По краям причала **толстые круглые сваи-кнехты**, обмотанные **канатом** (2–3 витка). +- На причале **ящик для снастей**: серо-зелёный, с ручкой. Рядом деревянный ящик. +- Причал заходит в воду. Справа у отдельных свай стоит **деревянная лодка** с вёслами. + +### 3.8 Интерфейс на макете (на этом шаге НЕ делать) +На макете видны счётчик монет слева сверху, мини-карта справа сверху, панель предметов из 5 слотов снизу и круглая кнопка заброса справа снизу. Это отдельная задача. **Сейчас делай только саму локацию.** + +--- + +## 4. Чем можно пользоваться (готовые помощники в MapBuilder) + +Все функции определены в `MapBuilder.server.lua` выше блока Мира 1, их полный код — в приложении Б. Используй их, а не изобретай свои аналоги. Новые помощники писать можно, если они нужны: бревенчатая стена, сосна в low-poly стиле, канат на свае, водопад и т.п. + +| Функция | Что делает | +|---|---| +| `P(props)` | Создаёт заякоренный Part в папке карты. `props` — любые свойства Part (`Size`, `CFrame`/`Position`, `Color`, `Material`, `Transparency`, `CanCollide`, `Shape` …). Возвращает Part. | +| `vcyl(pos, h, d, props)` | Вертикальный цилиндр высотой `h` и диаметром `d` с центром в `pos`. | +| `cylA(a, b, d, props)` | Цилиндр диаметром `d` от точки `a` до точки `b` (брёвна, перила, балки). | +| `ball(pos, d, props)` | Шар диаметром `d`. | +| `surfaceText(part, face, text, color, extra)` | Надпись на грани детали. | +| `billboard(target, text, color, offsetY, width)` | Надпись над объектом, всегда повёрнута к камере. | +| `prompt(target, actionText, objectText, action, dist)` | ProximityPrompt с атрибутом `Action`. Сервер обрабатывает `Sell`, `Shop`, `Portal`, `Talk`, `Daily`. | +| `marker(name, cf)` | Невидимая точка-маркер с именем. | +| `groundY(x, z)` | Высота земли (террейна) в мировой точке. | +| `lamp(pos, color)` | Фонарный столб с PointLight. | +| `tree(pos, kind)` | Дерево: `"pine"`, `"birch"` или `"round"`. | +| `bush(pos)` | Куст, иногда с цветами. | +| `bench(cf)` | Скамейка. | +| `npc(name, cf, colors, action, actionText)` | NPC с панамой. `colors = { skin, shirt, pants, hat }`. Если передан `action`, на NPC появляется подсказка с этим действием. | +| `stall(cf, opt)` | Лавка с навесом, прилавком, вывеской и продавцом. Сторона −Z у `cf` смотрит на покупателя. **Возвращает Part прилавка.** | +| `portal(baseCF, title, color, worldId, locked)` | Портал. Возвращает диск портала. | +| `arch(cf, span, height, title, color)` | Арка с надписью. | +| `pier(center, size)` | Причал (настил и сваи). Возвращает настил. | +| `inLake(x, z, extra)` | Лежит ли точка (относительно `W`) в озере. | +| `carveLake(l)` | Прописывает воду и воздух над ней в круге `l = {x, z, r}`. | +| `worldWalls(center)` | Невидимые стены по краю мира. | + +Террейн: `terrain:FillBlock`, `FillBall`, `FillCylinder`, `FillWedge`, `ReplaceMaterial`, `WriteVoxels`. Подходящие материалы: `Grass`, `LeafyGrass`, `Ground`, `Mud`, `Sand`, `Rock`, `Slate`, `Basalt`, `Limestone`, `Cobblestone`, `Water`. + +--- + +## 5. Что нельзя ломать (игровые контракты) + +1. **Форма озера = `Config.Worlds[1].lakes`** в `FishConfig.lua` — список кругов `{x, z, радиус}` относительно `W`. По нему работают `Config.IsWater`, `Config.WaterGap` (заброс разрешён не дальше 7 studs от воды), `Config.CastDirection` (заброс летит к центру ближайшего круга), а также `carveLake` и проверка воды при старте. Если меняешь форму озера, меняй **этот список** и строй воду только по нему. Вода, которой нет в списке (например, речка над водопадом), должна быть узкой, или её нужно тоже добавить в список. +2. **Поверхность воды на высоте 0** (`WATER_Y = 0`, `waterY = 0`). Песчаная чаша, ил и вода строятся в порядке: песок → выемка → ил → вода → `carveLake`. +3. **Маркеры** с точными именами, они нужны серверу и обучению: + - `World1Spawn` — точка прибытия, смотрит на озеро; + - `GuideFishSpot` — на конце главного причала, над водой; + - `GuideSell` — перед прилавком скупки, со стороны покупателя. +4. **Атрибуты `GuideTarget`** (их подсвечивает обучение): + - на **настиле главного причала** — `"Pier"`; + - на **Part'е прилавка скупки** (то, что возвращает `stall`) — `"Sell"`. +5. **Взаимодействия:** + - скупка — `stall(...)` с `action = "Sell"`; + - портал в лобби — `portal(cf, "🏠 В лобби", цвет, "Lobby")`; + - NPC «Дед Петрович» с `action = "Talk"`, `actionText = "Поговорить"`; + - доска «Кто водится в озере» — в текущем коде она строится по `Config.Zones.World1.fish`, сохрани её. +6. **Короткие маршруты** (важно для геймплея): от точки прибытия до причала, скупки и портала в лобби не больше 15–25 studs. Всё нужное рядом с главным причалом, далеко ходить не должно приходиться. Декор (водопад, вышка, домики) может быть дальше. +7. **Конец главного причала** должен стоять **над водой** (внутри одного из кругов `lakes`). С края причала до воды должно быть не дальше 7 studs. +8. **Без невидимых стен вокруг озера.** Игроки могут прыгать в воду. +9. **Невидимые стены по краю мира** (`worldWalls(W)`) оставить. +10. **Производительность:** + - на весь Мир 1 не больше ~3000 Part'ов; + - не больше ~25 источников света (`PointLight`/`SpotLight`), у мелких деталей `CastShadow = false`; + - не больше ~10 `ParticleEmitter` с умеренным `Rate`; + - декор, о который игрок не должен цепляться (листва, камыш, кувшинки, флаги, дым), с `CanCollide = false`; у невидимых и чисто декоративных мелочей ещё `CanQuery = false`; + - всё `Anchored = true` (это делает `P`). +11. **Без внешних ассетов.** Никаких `rbxassetid://` из Toolbox, никаких MeshPart. Разрешены встроенные ресурсы `rbxasset://textures/...` и `rbxasset://sounds/...` (например, `rbxasset://textures/particles/smoke_main.dds`, `rbxasset://textures/particles/sparkles_main.dds`). + +--- + +## 6. Как перенести макет на наши координаты (план расстановки) + +Ракурс макета — с главного причала на север (−Z). Предлагаемая раскладка (можно уточнять, если сохраняются контракты из раздела 5): + +- **Главный причал** остаётся на оси X = 0: от берега (z ≈ 79) в воду до z ≈ 38. Сделай его **шире (10–12 studs)**, по краям толстые сваи-кнехты с канатом каждые ~8 studs, на причале ящик для снастей и деревянный ящик. +- **Скупка (лавка рыбака)** — **слева от корня причала**, примерно `W + V(-18, 4, 84)`, лицом к причалу и точке прибытия. Она должна быть оформлена как на макете: зелёно-кремовый тент, вывеска с силуэтом рыбы, поплавки и воблеры, фонарь на столбе, бочки. Перенеси маркер `GuideSell` и атрибут `GuideTarget = "Sell"` вместе с ней. Продавец — `npcName = "Скупщик Гриша"` в соломенной шляпе и зелёном фартуке (фартук — отдельный Part, приваренный к торсу, или просто цвет рубашки и штанов). +- **Портал «В лобби»** — справа от точки прибытия, примерно `W + V(20, 4, 96)`. +- **Дед Петрович** — у корня причала справа. +- **Доска «Кто водится в озере»** — у входа на причал. +- **Бревенчатый дом** (большой) — левее и дальше скупки, на склоне, примерно `W + V(-45, 4, 60)`. Второй домик меньше — на северо-западном берегу. +- **Холм с тропинкой и вышкой** — северо-запад, примерно `W + V(-60…-20, *, -90…-140)`. Холм из террейна (`FillBall` травой), тропинка `Ground` серпантином, забор из столбиков и жердей, 3–4 фонаря. Вышка на вершине: 4 сваи, площадка, перила, крыша, флаг. +- **Скала с водопадом** — северо-восток за озером, примерно `W + V(40…80, *, -80…-110)`. Скала из террейна (`Rock`/`Slate`, несколько уступов через `FillBall`/`FillBlock`), сверху мох и трава, на уступах сосны. **Водопад** — набор вертикальных полупрозрачных Part'ов (`Material.Glass` или `SmoothPlastic`, `Transparency` 0.3–0.5, бело-бирюзовые). Сверху вниз ползёт текстура — например, `Beam` с `rbxasset://textures/particles/smoke_main.dds` и `TextureSpeed`, или `Texture` с анимацией `OffsetStudsV` из отдельного скрипта. Внизу пена: белые сплюснутые шары и `ParticleEmitter` тумана. Звук воды — `Sound` с `Looped = true`, `RollOffMaxDistance` около 120. +- **Деревянный мост** над водопадом: арочный настил из досок и перила (`cylA`). +- **Мостки справа** (восточный берег) с фонарём; **лодка с вёслами** у свай. +- **Лес:** + - по периметру мира и на заднем плане плотный пояс сосен (стилизованная ёлка из 3–4 конусов или шаров разного размера, два оттенка зелёного); + - у воды и у тропинки отдельные лиственные деревья и кусты; + - деревья не должны закрывать путь от прибытия к причалу, скупке и порталу. +- **Горы на горизонте** — за стенами мира, очень крупные фигуры (террейн `Rock`/`Slate` или большие Part'ы с `CanCollide = false`), голубовато-серые, чтобы дымка Atmosphere их «растворяла». +- **Кувшинки, камыш, валуны** — гуще у берегов, особенно у причала и справа у мостков. +- **Тени рыб под водой:** + - 6–10 тёмных полупрозрачных силуэтов-рыб на глубине ~1.5 studs, `CanCollide = false`, `CanQuery = false`; + - медленно плавают по кругам или восьмёркам внутри `lakes` (TweenService или цикл `RunService.Heartbeat` на сервере); + - не должны мешать забросу. +- **Дым из труб** — `ParticleEmitter` с `smoke_main.dds`, серо-белый, `Rate` 3–5. + +### Свет и вода (настройки) +- В `FishConfig.Worlds[1]`: + - `clock` = 16.2 (тёплый поздний день); + - `water` = бирюзовый, примерно `Color3.fromRGB(40, 170, 165)`. +- Сделай воду прозрачнее только в Мире 1: + - добавь в конфиг мира поле `waterTransparency = 0.6`; + - в `FishingClient.client.lua` в функции `applyAmbience(world)` применяй `terrain.WaterTransparency = world.waterTransparency or 0.15`. +- Для тёплого света можно добавить в конфиг мира поля атмосферы и цветокоррекции и применять их в `applyAmbience` так же, как сейчас применяется `clock`: лёгкий жёлто-оранжевый оттенок `ColorCorrection.TintColor`, `Atmosphere.Color` светло-голубой, `Haze` около 1. + +--- + +## 7. Требования к ответу + +1. Сначала коротко (5–10 строк) опиши план: что где стоит, с координатами относительно `W`. +2. Затем дай **готовый к вставке код**: + - **полную замену** блока `---------------------------------------------------------------- МИР 1: террейн (строится всегда)` (до строки `---------------------------------------------------------------- точка появления в лобби`); + - **полную замену** блока `---------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО (детали)` (до строки `---------------------------------------------------------------- помощники для новых миров`); + - новые помощники (если нужны) — отдельным блоком с указанием, куда вставить (до блока Мира 1, после существующих помощников); + - изменения в `FishConfig.lua` (запись `Config.Worlds[1]`) и в `applyAmbience` клиента — точными фрагментами «было → стало». +3. Код должен компилироваться в Luau без доработок: никаких «…», «TODO», «добавь сам». Все переменные объявлены, все функции существуют (из приложений или написаны тобой). +4. Комментарии в коде — **на русском**, коротко и по делу, в стиле существующего кода (см. приложения): один комментарий над блоком, без комментариев к каждой строке. +5. Используй `rng`, а не `math.random`, чтобы карта была одинаковой при каждом запуске. +6. В конце — чек-лист, как ты выполнил каждый пункт раздела 5. И список того, что из макета **не получилось** повторить средствами Part/Terrain и чем это заменено. + +--- + +## Приложения: текущий код проекта + +(Ниже — актуальные фрагменты кода. Используй их как образец стиля и как справку по помощникам и контрактам.) + +### Приложение А. MapBuilder: начало файла, свет, вода и террейн Мира 1 (строки 1–110) + +```lua +-- MapBuilder (Script) -> ServerScriptService +-- Строит лобби и Мир 1 «Тихое озеро» при запуске игры, настраивает свет и воду. +-- Если в 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 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: террейн (строится всегда) + +local W = V(0, 0, 1500) -- центр Мира 1 +local GROUND_Y = 4 -- верх земли +local WATER_Y = 0 -- поверхность воды + +-- озеро из нескольких кругов: { x, z, радиус } +local LAKES = Config.Worlds[1].lakes + +terrain:FillBlock(CFrame.new(W + V(0, -10, 0)), V(500, 28, 500), Enum.Material.Grass) +-- холмы по краям +for _, h in ipairs({ { -190, 160, 50 }, { 185, 175, 45 }, { -175, -175, 60 }, { 190, -150, 55 }, { 0, -215, 50 }, { -215, 0, 40 }, { 215, 30, 42 } }) do + terrain:FillBall(W + V(h[1], -14, h[2]), h[3], Enum.Material.Grass) +end +-- порядок важен: песок → выемка → ил → вода +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -10, l[2])), 28, l[3] + 11, Enum.Material.Sand) +end +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], 11, l[2])), 18, l[3] + 7, Enum.Material.Air) +end +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], 10, l[2])), 20, l[3] + 2, Enum.Material.Air) +end +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -18, l[2])), 12, l[3], Enum.Material.Mud) +end +for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -6, l[2])), 12, l[3], Enum.Material.Water) +end +-- то же самое напрямую по вокселям: вода ниже WATER_Y, воздух выше. +-- Fill* с Air иногда оставляет песок над водой, и озеро выглядит сухим. +local function carveLake(l) + local region = Region3.new(W + V(l[1] - l[3], WATER_Y - 12, l[2] - l[3]), W + V(l[1] + l[3], WATER_Y + 16, l[2] + l[3])):ExpandToGrid(4) + local mats, occ = terrain:ReadVoxels(region, 4) + local size = mats.Size + local corner = region.CFrame.Position - region.Size / 2 + local center = W + V(l[1], 0, l[2]) + for x = 1, size.X do + for y = 1, size.Y do + for z = 1, size.Z do + local c = corner + V(x - 0.5, y - 0.5, z - 0.5) * 4 + if (V(c.X, 0, c.Z) - center).Magnitude <= l[3] then + local water = c.Y < WATER_Y + mats[x][y][z] = water and Enum.Material.Water or Enum.Material.Air + occ[x][y][z] = water and 1 or 0 + end + end + end + end + terrain:WriteVoxels(region, 4, mats, occ) +end +for _, l in ipairs(LAKES) do + carveLake(l) +end +-- дорожка от точки прибытия к причалу и площадка +terrain:FillBlock(CFrame.new(W + V(0, 2, 86)), V(8, 4, 14), Enum.Material.Ground) +terrain:FillCylinder(CFrame.new(W + V(0, 2, 96)), 4, 12, Enum.Material.Cobblestone) + +``` + +### Приложение Б. MapBuilder: помощники (строки 140–502) + +```lua +---------------------------------------------------------------- помощники + +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 + +``` + +### Приложение В. MapBuilder: детали Мира 1 — текущая версия (строки 779–1011) + +```lua +---------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО (детали) + +local function inLake(x, z, extra) + for _, l in ipairs(LAKES) do + if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + (extra or 0) then + return true + end + end + return false +end + +-- прибытие +-- всё рядом с главным причалом: прибытие → арка → причал, по бокам портал, скупка и дед +local arrive = W + V(0, GROUND_Y, 94) +marker("World1Spawn", CFrame.lookAt(arrive + V(0, 1, 0), arrive + V(0, 1, -10))) +arch(CFrame.new(W + V(0, GROUND_Y, 82)), 14, 11, "🌊 ТИХОЕ ОЗЕРО", Color3.fromRGB(80, 200, 255)) +portal(CFrame.lookAt(W + V(-22, GROUND_Y, 96), arrive), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") +-- точки для линии-подсказки: конец главного причала и место перед скупкой +marker("GuideFishSpot", CFrame.new(W + V(0, GROUND_Y + 0.5, 42))) +marker("GuideSell", CFrame.lookAt(W + V(26, GROUND_Y, 98), arrive) * CFrame.new(0, 0, -10)) +local w1Counter = stall(CFrame.lookAt(W + V(26, GROUND_Y, 98), arrive), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(150, 255, 160), + wall = Color3.fromRGB(150, 115, 80), + 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(200, 150, 110), shirt = Color3.fromRGB(70, 130, 80), pants = Color3.fromRGB(60, 50, 40), hat = Color3.fromRGB(200, 170, 110) }, +}) +w1Counter:SetAttribute("GuideTarget", "Sell") -- прилавок подсвечивается на шаге обучения + +-- доска «Кто водится в озере» +do + local pos = W + V(-15, GROUND_Y, 80) + local cf = CFrame.lookAt(pos, arrive) + 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 = { "🐟 КТО ВОДИТСЯ В ОЗЕРЕ" } + 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 + +-- костёр с брёвнами +do + local c = W + V(-8, GROUND_Y, 110) + 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 fireBase = 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 = fireBase + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 160, 80) + light.Range = 20 + light.Brightness = 2 + light.Parent = fireBase + for _, a in ipairs({ 0, 2.1, 4.2 }) do + local p = c + V(math.cos(a) * 6, 0.6, math.sin(a) * 6) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 1.4, 1.4), CFrame = CFrame.lookAt(p, c) * CFrame.Angles(0, math.rad(90), 0) * CFrame.Angles(0, math.rad(90), 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(115, 80, 50) }) + end +end + +-- дед-рыбак с подсказками +npc("Дед Петрович", CFrame.lookAt(W + V(12, GROUND_Y + 3, 86), arrive + V(0, 3, 0)), { + 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", "Поговорить") + +-- домик рыбака +do + local cf = CFrame.lookAt(W + V(-44, GROUND_Y, 98), W + V(0, GROUND_Y, 98)) + local logC = Color3.fromRGB(130, 90, 55) + P({ Size = V(14, 1, 12), CFrame = cf * CFrame.new(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(110, 80, 50) }) + P({ Size = V(14, 8, 1), CFrame = cf * CFrame.new(0, 5, 5.5), Material = Enum.Material.Wood, Color = logC }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(1, 8, 12), CFrame = cf * CFrame.new(s * 6.5, 5, 0), Material = Enum.Material.Wood, Color = logC }) + P({ Size = V(5, 8, 1), CFrame = cf * CFrame.new(s * 4.5, 5, -5.5), Material = Enum.Material.Wood, Color = logC }) + P({ Size = V(16, 1, 8.8), CFrame = cf * CFrame.new(0, 11.2, s * 3.4) * CFrame.Angles(math.rad(-s * 38), 0, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 60, 45) }) + end + P({ Size = V(4, 2, 1), CFrame = cf * CFrame.new(0, 8, -5.5), Material = Enum.Material.Wood, Color = logC }) + P({ Size = V(2.2, 2, 0.3), CFrame = cf * CFrame.new(-4.5, 5.5, -6.05), Material = Enum.Material.Glass, Color = Color3.fromRGB(255, 225, 150), Transparency = 0.2 }) + P({ Size = V(14, 3, 1), CFrame = cf * CFrame.new(0, 10.5, 5.5), Material = Enum.Material.Wood, Color = logC }) +end + +-- причалы +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 +-- { центр от W, размер } +local PIERS = { + { V(0, GROUND_Y + 0.2, 58), V(8, 0.6, 42) }, + { V(-86, GROUND_Y + 0.2, 15), V(34, 0.6, 7) }, + { V(86, GROUND_Y + 0.2, -10), V(34, 0.6, 7) }, +} +for i, p in ipairs(PIERS) do + local deck = pier(W + p[1], p[2]) + if i == 1 then + deck:SetAttribute("GuideTarget", "Pier") -- главный причал подсвечивается на шаге обучения + end +end + +lamp(W + V(-3.5, GROUND_Y + 0.5, 40), Color3.fromRGB(255, 220, 160)) +lamp(W + V(-70, GROUND_Y + 0.5, 18), Color3.fromRGB(255, 220, 160)) +lamp(W + V(70, GROUND_Y + 0.5, -13), Color3.fromRGB(255, 220, 160)) + +-- лодка у западного причала +do + local cf = CFrame.new(W + V(-74, WATER_Y + 0.3, 24)) * CFrame.Angles(0, math.rad(15), 0) + local hull = Color3.fromRGB(170, 70, 50) + P({ Size = V(4, 0.5, 9), CFrame = cf, Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 100, 65) }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.4, 1.4, 9), CFrame = cf * CFrame.new(s * 2, 0.7, 0), Material = Enum.Material.Wood, Color = hull }) + P({ Size = V(4.4, 1.4, 0.4), CFrame = cf * CFrame.new(0, 0.7, s * 4.5), Material = Enum.Material.Wood, Color = hull }) + end + P({ Size = V(4, 0.3, 1.2), CFrame = cf * CFrame.new(0, 1, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 100, 65) }) +end + +-- кувшинки и камыши +for _, l in ipairs(LAKES) do + for _ = 1, 7 do + local a, d = rng:NextNumber(0, math.pi * 2), rng:NextNumber(6, l[3] - 5) + local x, z = l[1] + math.cos(a) * d, l[2] + math.sin(a) * d + local size = rng:NextNumber(2, 3.5) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.15, size, size), CFrame = CFrame.new(W + V(x, WATER_Y + 0.28, z)) * CFrame.Angles(0, 0, math.rad(90)), Color = Color3.fromRGB(70, 150, 60), CanCollide = false }) + if rng:NextNumber() < 0.4 then + ball(W + V(x + 0.3, WATER_Y + 0.55, z), 0.7, { Color = Color3.fromRGB(255, 150, 190), CanCollide = false }) + end + end + for _ = 1, 9 do + local a = rng:NextNumber(0, math.pi * 2) + local x, z = l[1] + math.cos(a) * (l[3] + 1.2), l[2] + math.sin(a) * (l[3] + 1.2) + local inOther = false + for _, o in ipairs(LAKES) do + if o ~= l and (V(x, 0, z) - V(o[1], 0, o[2])).Magnitude < o[3] + 1 then + inOther = true + end + end + if not inOther and not (math.abs(x) < 6 and z > 30) then + for _ = 1, 5 do + local h = rng:NextNumber(3, 5) + local p = W + V(x + rng:NextNumber(-1.2, 1.2), WATER_Y + h / 2 - 0.5, z + rng:NextNumber(-1.2, 1.2)) + P({ Size = V(0.18, h, 0.18), Position = p, Color = Color3.fromRGB(85, 130, 50), CanCollide = false }) + P({ Size = V(0.35, 0.9, 0.35), Position = p + V(0, h / 2 - 0.3, 0), Color = Color3.fromRGB(110, 70, 40), CanCollide = false }) + end + end + end +end + +-- деревья, кусты, камни +local function freeSpot(x, z) + if inLake(x, z, 14) then + return false + end + if (V(x, 0, z) - V(0, 0, 94)).Magnitude < 36 then + return false + end + if math.abs(x) < 9 and z > 60 and z < 125 then + return false + end + if (V(x, 0, z) - V(-44, 0, 98)).Magnitude < 14 then + return false + end + return true +end + +local placed = 0 +for _ = 1, 400 do + if placed >= 110 then + break + end + local x, z = rng:NextNumber(-230, 230), rng:NextNumber(-230, 230) + if freeSpot(x, z) then + local y = groundY(W.X + x, W.Z + z) + local roll = rng:NextNumber() + tree(W + V(x, y - 0.5, z), roll < 0.35 and "pine" or (roll < 0.5 and "birch" or "round")) + placed += 1 + end +end +for _ = 1, 60 do + local x, z = rng:NextNumber(-200, 200), rng:NextNumber(-200, 200) + if freeSpot(x, z) then + bush(W + V(x, groundY(W.X + x, W.Z + z) - 0.6, z)) + end +end +for _, l in ipairs(LAKES) do + for _ = 1, 4 do + local a = rng:NextNumber(0, math.pi * 2) + local x, z = l[1] + math.cos(a) * (l[3] + 8), l[2] + math.sin(a) * (l[3] + 8) + if not inLake(x, z, 3) and not (math.abs(x) < 8 and z > 30) then + local s = rng:NextNumber(2.5, 5) + P({ Size = V(s, s * 0.7, s * 0.9), CFrame = CFrame.new(W + V(x, groundY(W.X + x, W.Z + z), z)) * CFrame.Angles(rng:NextNumber(0, 1), rng:NextNumber(0, 6), rng:NextNumber(0, 1)), Material = Enum.Material.Rock, Color = Color3.fromRGB(125, 125, 130) }) + end + end +end + +-- фонари вдоль дорожки +lamp(W + V(6, GROUND_Y, 90)) +lamp(W + V(-6, GROUND_Y, 90)) + +-- невидимые стены по краю мира +for _, w in ipairs({ + { V(0, 0, 245), V(500, 120, 2) }, + { V(0, 0, -245), V(500, 120, 2) }, + { V(245, 0, 0), V(2, 120, 500) }, + { V(-245, 0, 0), V(2, 120, 500) }, +}) do + P({ Size = w[2], Position = W + w[1] + V(0, 40, 0), Transparency = 1 }) +end + +``` + +### Приложение Г. MapBuilder: помощники для новых миров (строки 1012–1078) + +```lua +---------------------------------------------------------------- помощники для новых миров + +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 + +``` + +### Приложение Д. FishConfig: миры (строки 8–58) + +```lua +---------------------------------------------------------------- миры +-- center = центр мира на карте; mult = множитель наград коллекции +Config.Worlds = { + { + id = "World1", name = "Тихое озеро", icon = "🌊", level = 1, mult = 1, + center = Vector3.new(0, 0, 1500), color = Color3.fromRGB(60, 200, 255), + desc = "Спокойное лесное озеро. Отличное место, чтобы начать.", + clock = 14.5, water = Color3.fromRGB(10, 55, 70), + waterY = 0, + lakes = { { 0, 0, 55 }, { -45, 15, 40 }, { 45, -10, 42 }, { 10, -42, 34 }, { -22, 40, 28 } }, -- { x, z, радиус } от центра + }, + { + 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), + waterY = 0, + sea = 119, -- всё дальше этого радиуса от центра — море + }, + { + id = "World3", name = "Ледяной фьорд", icon = "❄", level = 18, mult = 12, + center = Vector3.new(-1500, 0, 0), color = Color3.fromRGB(150, 220, 255), + desc = "Рыбалка в лунках среди льдов и северного сияния.", + clock = 18.3, water = Color3.fromRGB(25, 70, 100), + waterY = 1, + lakes = { { 0, 0, 70 }, { -55, 30, 45 }, { 55, -25, 50 }, { 5, -70, 40 } }, -- подо льдом + holes = { + { 0, 40 }, { -22, 18 }, { 22, 12 }, { 0, -12 }, { -30, -30 }, { 30, 40 }, { -60, 35 }, + { -45, 15 }, { 55, -25 }, { 75, -5 }, { 40, -50 }, { 5, -75 }, { -15, -60 }, { 25, -80 }, + }, + holeRadius = 6, + }, + { + id = "World4", name = "Вулкан", icon = "🌋", level = 30, mult = 30, soon = true, + center = Vector3.new(0, 0, -1500), color = Color3.fromRGB(255, 90, 40), + desc = "Рыбалка в лаве. Скоро!", + }, +} +Config.WorldRadius = 260 + +function Config.WorldAt(pos) + for _, w in ipairs(Config.Worlds) do + if not w.soon then + local d = Vector3.new(pos.X - w.center.X, 0, pos.Z - w.center.Z).Magnitude + if d < Config.WorldRadius then + return w + end + end + end + return nil +end +``` + +### Приложение Е. FishConfig: где вода, откуда и куда можно забрасывать (строки 60–159) + +```lua +-- куда бросать из этой точки (единичный вектор по горизонтали): к центру ближайшего озера или лунки, +-- а если ближе море — от центра острова к морю +function Config.CastDirection(world, pos) + if not world then + return nil + end + local x, z = pos.X - world.center.X, pos.Z - world.center.Z + local best, bestGap + local function consider(dir, gap) + if dir.Magnitude > 0.1 and (not bestGap or gap < bestGap) then + best, bestGap = dir.Unit, gap + end + end + if world.holes then + for _, h in ipairs(world.holes) do + consider(Vector3.new(h[1] - x, 0, h[2] - z), math.sqrt((h[1] - x) ^ 2 + (h[2] - z) ^ 2) - (world.holeRadius or 6)) + end + end + for _, l in ipairs(world.lakes or {}) do + if not world.holes then -- в Мире 3 озёра подо льдом, бросаем только в лунки + consider(Vector3.new(l[1] - x, 0, l[2] - z), math.sqrt((l[1] - x) ^ 2 + (l[2] - z) ^ 2) - l[3]) + end + end + if world.sea then + consider(Vector3.new(x, 0, z), world.sea - math.sqrt(x * x + z * z)) + end + return best +end + +-- расстояние по горизонтали от точки до ближайшей воды (0 — над водой: на причале или в воде) +function Config.WaterGap(world, pos) + if not world then + return math.huge + end + local x, z = pos.X - world.center.X, pos.Z - world.center.Z + local gap = math.huge + if world.holes then + for _, h in ipairs(world.holes) do + gap = math.min(gap, math.sqrt((h[1] - x) ^ 2 + (h[2] - z) ^ 2) - (world.holeRadius or 6)) + end + else + for _, l in ipairs(world.lakes or {}) do + gap = math.min(gap, math.sqrt((l[1] - x) ^ 2 + (l[2] - z) ^ 2) - l[3]) + end + end + if world.sea then + gap = math.min(gap, world.sea - math.sqrt(x * x + z * z)) + end + return math.max(0, gap) +end + +-- можно ли закидывать отсюда (pos — центр персонажа): стоим на берегу или платформе +-- и до воды не дальше Config.CastReach. Возвращает true или текст подсказки. +-- humanoid можно не передавать (на сервере его состояние ненадёжно) — тогда проверяем только по высоте. +function Config.CanCastFrom(world, pos, humanoid) + if not world then + return "🌍 Тут нет рыбы" + end + local inWater = pos.Y < (world.waterY or 0) + 2 -- у плывущего персонажа центр почти на уровне воды + if humanoid then + inWater = inWater or humanoid:GetState() == Enum.HumanoidStateType.Swimming or humanoid.FloorMaterial == Enum.Material.Water + end + if inWater then + return "🏊 Выйди из воды" + end + if humanoid and humanoid.FloorMaterial == Enum.Material.Air then + return "Встань на землю" + end + if Config.WaterGap(world, pos) > Config.CastReach then + return "🌊 Подойди к воде" + end + return true +end + +-- есть ли вода в этой точке мира (озеро, море или лунка) +function Config.IsWater(world, pos) + if not world then + return false + end + local x, z = pos.X - world.center.X, pos.Z - world.center.Z + if world.holes then + local r = world.holeRadius or 6 + for _, h in ipairs(world.holes) do + if (x - h[1]) ^ 2 + (z - h[2]) ^ 2 <= r * r then + return true + end + end + return false + end + if world.sea and math.sqrt(x * x + z * z) >= world.sea then + return true + end + for _, l in ipairs(world.lakes or {}) do + if (x - l[1]) ^ 2 + (z - l[2]) ^ 2 <= (l[3] - 1) ^ 2 then + return true + end + end + return false +end + +``` + +### Приложение Ж. FishingClient: атмосфера мира при входе (applyAmbience) + +```lua +local lastWorldId = "none" +local terrain = workspace.Terrain +local defaultWater = Color3.fromRGB(10, 55, 70) + +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 + local atm = Lighting:FindFirstChildOfClass("Atmosphere") + if atm then + local frost = world and world.id == "World3" + TweenService:Create(atm, TweenInfo.new(2), { + Density = frost and 0.38 or 0.25, + Color = frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232), + }):Play() + end + snow.Rate = (world and world.id == "World3") and 140 or 0 +end +``` diff --git a/docs/toolbox-assets.md b/docs/toolbox-assets.md new file mode 100644 index 0000000..924708c --- /dev/null +++ b/docs/toolbox-assets.md @@ -0,0 +1,112 @@ +# Модели из Toolbox для локации «Тихое озеро» + +Подобраны 2026-11-03 по макету. Как отбирал: + +- искал через официальный поиск Creator Store; +- брал только **бесплатные модели без скриптов**; +- у модели должно быть **не меньше 8 лайков**, лайков минимум в 4 раза больше, чем дизлайков; +- каждую модель проверил по превью; +- `tri` — число треугольников, чем меньше, тем легче для FPS. + +Ссылка на модель: `https://create.roblox.com/store/asset/`. + +## Основной набор (подходят по стилю) + +| Элемент макета | Модель | ID | tri | 👍/👎 | Комментарий | +|---|---|---|---|---|---| +| Сосны (лес, задний план) | Low-Poly Pine Trees Asset Pack | 8559395722 | 26 476 (весь пак) | 67/3 | Ярусные мультяшные ёлки, почти как на макете. Основа леса. | +| Лиственные деревья у воды | Yasu's Stylized Tree Pack | 79689531752352 | 40 144 (весь пак) | 400/0 | Самый популярный стилизованный пак. Брать 2–3 вида. | +| Простая ёлка (дальний фон) | Pine Tree Cartoon | 8611822577 | 276 | 9/1 | Очень лёгкая: для дальних рядов леса. | +| Бревенчатый дом | Log cabin | 4696763099 | 4 424 | 18/2 | Дом из брёвен с крыльцом. Крышу перекрасить в тёмно-зелёный, трубу добавить. | +| Лавка рыбака (скупка) | Shop Stand | 16407780460 | 1 752 | 44/6 | Прилавок под навесом с ящиками. Навес перекрасить в зелёно-кремовую полоску. | +| Лавка (вариант с тентом) | tent market stall | 10970560969 | 40 032 | 10/0 | Полосатый тент как на макете, но тяжёлая. | +| Фонарь на столбе | Low poly Street Lantern | 8990192177 | 700 | 99/1 | Столб с висящим фонарём, ровно как у лавки на макете. | +| Сваи с канатом на причале | Rope-Fence | 7845357309 | 1 344 | 10/0 | Деревянный столб с канатом, похож на кнехты с макета. | +| Причал | Realistic Dock | 1902636966 | 1 104 | 36/4 | Деревянные мостки на сваях. Подойдут для правых мостков. Главный причал лучше оставить нашим: к нему привязаны обучение и заброс. | +| Лодка с вёслами | Boat Model | 9617142471 | 6 404 | 166/34 | Деревянная лодка в мультяшном стиле. | +| Лодка (запасной вариант) | boat | 704501925 | 1 372 | 86/14 | Легче, но проще. | +| Водопад | Low Poly Waterfall | 16444908253 | — | 96/4 | Мультяшный голубой водопад, лучшее совпадение со стилем. | +| Арочный мост над водопадом | Wooden Bridge | 11935185367 | 2 923 | 192/8 | Деревянный арочный мост с перилами, как на макете. | +| Смотровая вышка на холме | Fire Lookout Tower | 937377053 | 44 382 | 18/2 | Деревянная вышка с домиком наверху. Тяжёлая, но она одна. Флаг с рыбой добавить отдельно. | +| Валуны у воды | Low Poly Rock Pack [FREE] | 2128776869 | 750 | 19/1 | Лёгкие серые low-poly камни. | +| Скалы / горы на горизонте | Low-Poly Rocky Mountain Border | 11751636142 | 557 | 74/6 | Серые зубчатые скалы. Годятся и для скалы водопада, и для гор за краем мира (крупно, без коллизии). | +| Камыш (рогоз) | Pond Cattail | 216373354 | 924 | 56/4 | Одобрено Roblox (Endorsed). Ставить группами. | +| Тростник | Reeds | 217647458 | 5 712 | 64/6 | Одобрено Roblox (Endorsed). | +| Кувшинки с цветами | lily pad | 13503798787 | 2 493 | 40/0 | Розовые цветы на листьях. | +| Забор вдоль тропинки | Farm Fence | 4831942116 | 804 | 658/42 | Деревянный забор из жердей. | +| Бочки и ящики | Barrels and Crates | 13018691172 | 18 252 | 50/0 | Бочки и ящики к лавке и на причал. | +| Ящик для снастей | Toolbox | 11464827472 | 464 | 10/0 | Ящик с ручкой. Перекрасить в серо-зелёный. | +| Костёр | Campfire | 1084175510 | 372 | 10/0 | Лёгкий, если нужен костёр у домика. | + +## Чего в Toolbox нет — делаем сами из деталей + +| Элемент | Как сделать | +|---|---| +| Вывеска с силуэтом рыбы над лавкой | Доска + наш `surfaceText` с эмодзи 🐟 или силуэт из 3–4 Part'ов | +| Тёмно-зелёное знамя с белой рыбой (на столбе и на вышке) | Part `Fabric` тёмно-зелёный + `surfaceText("🐟")` | +| Поплавки и воблеры на прилавке | Маленькие шары `ball()` красно-белые, цветные «рыбки» из 2 Part'ов | +| Дым из труб | `ParticleEmitter` с `rbxasset://textures/particles/smoke_main.dds` | +| Тени рыб под водой | Тёмные полупрозрачные силуэты, медленно плавают (из нашего `Models.buildFish`) | +| Пена и брызги у водопада | Белые сплюснутые шары + `ParticleEmitter` | + +## Безопасность — важно + +- Модели из Toolbox бывают с **бэкдорами** — скрытыми скриптами, через которые чужой человек может управлять игрой. Пример из этого поиска: модель «Low Poly Log» (117538820047265) в описании пишет «No scripts», а внутри у неё 2 скрипта и звук. **Её не брать.** +- Все модели в таблице выше по данным Creator Store **без скриптов**. Скрипт импорта ниже всё равно удаляет любые скрипты из вставленных моделей. +- После вставки загляните в окно **Output**: скрипт напишет, сколько скриптов удалил. Если у модели из таблицы вдруг найдутся скрипты, её лучше не использовать. + +## Как перенести модели в проект + +Наш плейс `Fishing.rbxlx` пересобирается из `src/`. Если просто вставить модели в Studio и сохранить, при следующей сборке они пропадут. Поэтому порядок такой. + +### Шаг 1. Вставить все модели одной командой + +Откройте плейс в Studio, вставьте этот код в **Command Bar** (строка внизу) и нажмите **Enter**. Модели появятся в `ServerStorage → Assets`, все скрипты из них будут удалены. + +```lua +local ids = { + PinePack = 8559395722, YasuTrees = 79689531752352, PineCartoon = 8611822577, + LogCabin = 4696763099, ShopStand = 16407780460, StreetLantern = 8990192177, + RopePost = 7845357309, SideDock = 1902636966, Rowboat = 9617142471, + Waterfall = 16444908253, Bridge = 11935185367, Lookout = 937377053, + Rocks = 2128776869, Mountains = 11751636142, Cattail = 216373354, Reeds = 217647458, + LilyPad = 13503798787, Fence = 4831942116, BarrelsCrates = 13018691172, + TackleBox = 11464827472, Campfire = 1084175510, +} +local folder = game.ServerStorage:FindFirstChild("Assets") or Instance.new("Folder") +folder.Name = "Assets" +folder.Parent = game.ServerStorage +for name, id in pairs(ids) do + local ok, objs = pcall(function() return game:GetObjects("rbxassetid://" .. id) end) + if ok and objs[1] then + local m = Instance.new("Model") + m.Name = name + for _, o in ipairs(objs) do o.Parent = m end + local removed = 0 + for _, d in ipairs(m:GetDescendants()) do + if d:IsA("LuaSourceContainer") then d:Destroy(); removed += 1 end + end + m.Parent = folder + print(("OK %s (%d) скриптов удалено: %d"):format(name, id, removed)) + else + warn("НЕ ВСТАВИЛОСЬ", name, id, objs) + end +end +``` + +### Шаг 2. Посмотреть и выбрать + +Перетащите модели из `ServerStorage/Assets` в Workspace и посмотрите вблизи. Неподходящие удалите. + +### Шаг 3. Сохранить в проект + +Правый клик по папке `Assets` → **Save to File…** → сохраните как `C:\Fishing\assets\Assets.rbxmx` (формат XML, `.rbxmx`). Дальше я: + +- подключу этот файл в `build.ps1` и `default.project.json`, чтобы модели попадали в `ServerStorage` при каждой сборке; +- научу `MapBuilder` расставлять копии моделей по локации (вместо части деталей), с перекраской и масштабом под макет. + +## Про производительность + +Самые тяжёлые модели в списке: вышка (44 тыс. треугольников), тент-лавка (40 тыс.), пак Yasu (40 тыс. на весь пак). Их ставить по одной штуке. + +Много копий можно делать только с лёгких моделей: «Pine Tree Cartoon», камни, камыш. diff --git a/install/1_FishConfig_ReplicatedStorage.rbxmx b/install/1_FishConfig_ReplicatedStorage.rbxmx index cea6d36..06669c1 100644 --- a/install/1_FishConfig_ReplicatedStorage.rbxmx +++ b/install/1_FishConfig_ReplicatedStorage.rbxmx @@ -13,15 +13,42 @@ Config.Worlds = { id = "World1", name = "Тихое озеро", icon = "🌊", level = 1, mult = 1, center = Vector3.new(0, 0, 1500), color = Color3.fromRGB(60, 200, 255), desc = "Спокойное лесное озеро. Отличное место, чтобы начать.", - clock = 14.5, water = Color3.fromRGB(20, 95, 115), + clock = 16.2, waterY = 0, - lakes = { { 0, 0, 55 }, { -45, 15, 40 }, { 45, -10, 42 }, { 10, -42, 34 }, { -22, 40, 28 } }, -- { x, z, радиус } от центра + lakes = { { 0, -15, 62 }, { -42, 8, 34 }, { 44, 2, 36 }, { 0, 22, 30 }, { 48, -50, 22 } }, -- { x, z, радиус } от центра + -- внешний вид только этого мира (применяет клиент при входе, при выходе возвращает как было) + tint = Color3.fromRGB(255, 247, 236), + -- свет и эффекты: свойства Lighting и его эффектов; чего здесь нет, остаётся как в MapBuilder + look = { + lighting = { + Brightness = 2.6, ExposureCompensation = -0.15, + Ambient = Color3.fromRGB(62, 66, 84), OutdoorAmbient = Color3.fromRGB(105, 112, 132), + ColorShift_Top = Color3.fromRGB(255, 232, 196), + EnvironmentDiffuseScale = 0.6, EnvironmentSpecularScale = 0.8, + }, + -- дымка вдали: Density — сколько тумана, Haze — насколько он плотный у горизонта + atmosphere = { + Density = 0.38, Offset = 0.1, Haze = 1.2, Glare = 0.15, + Color = Color3.fromRGB(188, 204, 224), Decay = Color3.fromRGB(196, 176, 160), + }, + color = { Saturation = 0.28, Contrast = 0.2, Brightness = -0.02 }, + bloom = { Intensity = 0.45, Size = 28, Threshold = 1.2 }, + sunRays = { Intensity = 0.06, Spread = 0.6 }, + -- лёгкое размытие дальнего плана + dof = { Enabled = true, FarIntensity = 0.2, FocusDistance = 60, InFocusRadius = 120, NearIntensity = 0 }, + }, + -- земля мира залита материалом Snow (ровный, без травинок), дорожки — Salt; здесь они перекрашиваются + terrainColors = { + Snow = Color3.fromRGB(127, 163, 63), Salt = Color3.fromRGB(191, 155, 105), + Rock = Color3.fromRGB(132, 139, 155), Slate = Color3.fromRGB(132, 139, 155), + Mud = Color3.fromRGB(78, 110, 92), Sand = Color3.fromRGB(205, 190, 140), + }, }, { id = "World2", name = "Тропический остров", icon = "🏝", level = 8, mult = 4, center = Vector3.new(1500, 0, 0), color = Color3.fromRGB(255, 190, 70), desc = "Бирюзовое море, пальмы и яркая рифовая рыба.", - clock = 13, water = Color3.fromRGB(35, 175, 185), + clock = 13, waterY = 0, sea = 119, -- всё дальше этого радиуса от центра — море }, @@ -29,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 = { @@ -37,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, @@ -46,6 +76,43 @@ Config.Worlds = { } Config.WorldRadius = 260 +-- экран загрузки: при входе в игру и при каждом телепорте игрок уже стоит на месте, сцена прогружается +-- и свет локации ставится под ним; картинку видно только после этого (секунды — минимум показа) +Config.Loading = { + firstJoin = 3, + teleport = 2.5, +} + +-- лобби: те же поля внешнего вида, что у миров (clock, tint, look, terrainColors); клиент применяет их вне миров +Config.Lobby = { + id = "Lobby", + clock = 16.3, -- предвечернее солнце: тени длиннее, свет теплее + tint = Color3.fromRGB(255, 242, 228), + look = { + lighting = { + Brightness = 2.0, ExposureCompensation = -0.3, + Ambient = Color3.fromRGB(64, 60, 72), OutdoorAmbient = Color3.fromRGB(120, 114, 124), + ColorShift_Top = Color3.fromRGB(255, 224, 186), + EnvironmentDiffuseScale = 0.5, EnvironmentSpecularScale = 0.5, + GlobalShadows = true, + }, + -- тёплая дымка: дальние холмы за скалами тонут в ней + atmosphere = { + Density = 0.4, Offset = 0.18, Haze = 1.6, Glare = 0.25, + Color = Color3.fromRGB(222, 212, 204), Decay = Color3.fromRGB(186, 160, 150), + }, + color = { Saturation = 0.18, Contrast = 0.14, Brightness = -0.04 }, + bloom = { Intensity = 0.3, Size = 24, Threshold = 1.8 }, + sunRays = { Intensity = 0.05, Spread = 0.7 }, + dof = { Enabled = true, FarIntensity = 0.18, FocusDistance = 55, InFocusRadius = 95, NearIntensity = 0 }, + -- мягкий тонмаппинг вместо Retro: светлая плитка и вывески не выгорают в белое + grading = { TonemapperPreset = Enum.TonemapperPreset.Default }, + }, + terrainColors = { + Grass = Color3.fromRGB(104, 150, 72), Ground = Color3.fromRGB(120, 98, 74), Rock = Color3.fromRGB(140, 126, 130), + }, +} + function Config.WorldAt(pos) for _, w in ipairs(Config.Worlds) do if not w.soon then @@ -58,6 +125,80 @@ function Config.WorldAt(pos) return nil end +-- куда бросать из этой точки (единичный вектор по горизонтали): к центру ближайшего озера или лунки, +-- а если ближе море — от центра острова к морю +function Config.CastDirection(world, pos) + if not world then + return nil + end + local x, z = pos.X - world.center.X, pos.Z - world.center.Z + local best, bestGap + local function consider(dir, gap) + if dir.Magnitude > 0.1 and (not bestGap or gap < bestGap) then + best, bestGap = dir.Unit, gap + end + end + if world.holes then + for _, h in ipairs(world.holes) do + consider(Vector3.new(h[1] - x, 0, h[2] - z), math.sqrt((h[1] - x) ^ 2 + (h[2] - z) ^ 2) - (world.holeRadius or 6)) + end + end + for _, l in ipairs(world.lakes or {}) do + if not world.holes then -- в Мире 3 озёра подо льдом, бросаем только в лунки + consider(Vector3.new(l[1] - x, 0, l[2] - z), math.sqrt((l[1] - x) ^ 2 + (l[2] - z) ^ 2) - l[3]) + end + end + if world.sea then + consider(Vector3.new(x, 0, z), world.sea - math.sqrt(x * x + z * z)) + end + return best +end + +-- расстояние по горизонтали от точки до ближайшей воды (0 — над водой: на причале или в воде) +function Config.WaterGap(world, pos) + if not world then + return math.huge + end + local x, z = pos.X - world.center.X, pos.Z - world.center.Z + local gap = math.huge + if world.holes then + for _, h in ipairs(world.holes) do + gap = math.min(gap, math.sqrt((h[1] - x) ^ 2 + (h[2] - z) ^ 2) - (world.holeRadius or 6)) + end + else + for _, l in ipairs(world.lakes or {}) do + gap = math.min(gap, math.sqrt((l[1] - x) ^ 2 + (l[2] - z) ^ 2) - l[3]) + end + end + if world.sea then + gap = math.min(gap, world.sea - math.sqrt(x * x + z * z)) + end + return math.max(0, gap) +end + +-- можно ли закидывать отсюда (pos — центр персонажа): стоим на берегу или платформе +-- и до воды не дальше Config.CastReach. Возвращает true или текст подсказки. +-- humanoid можно не передавать (на сервере его состояние ненадёжно) — тогда проверяем только по высоте. +function Config.CanCastFrom(world, pos, humanoid) + if not world then + return "🌍 Тут нет рыбы" + end + local inWater = pos.Y < (world.waterY or 0) + 2 -- у плывущего персонажа центр почти на уровне воды + if humanoid then + inWater = inWater or humanoid:GetState() == Enum.HumanoidStateType.Swimming or humanoid.FloorMaterial == Enum.Material.Water + end + if inWater then + return "🏊 Выйди из воды" + end + if humanoid and humanoid.FloorMaterial == Enum.Material.Air then + return "Встань на землю" + end + if Config.WaterGap(world, pos) > Config.CastReach then + return "🌊 Подойди к воде" + end + return true +end + -- есть ли вода в этой точке мира (озеро, море или лунка) function Config.IsWater(world, pos) if not world then @@ -209,17 +350,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 = { @@ -264,6 +441,16 @@ Config.BiteTimeMin = 3 Config.BiteTimeMax = 7 Config.BiteTimeout = 12 Config.MaxMisses = 2 +-- заброс: держишь ЛКМ — сила ездит 0 → 1 → 0 → …; от силы в момент отпускания зависит дальность +Config.CastChargeTime = 1.3 -- секунд на проход шкалы в одну сторону +Config.CastMinDist, Config.CastMaxDist = 6, 28 +Config.CastReach = 7 -- закидывать можно не дальше ~2 м (7 studs) от воды +Config.CastPerfect = { 0.72, 0.86 } -- зелёная зона шкалы +Config.CastPerfectLuck = 1.2 -- множитель удачи за попадание в зелёную зону + +-- обучение: линия-подсказка ведёт по шагам 0 → 1 → 2 → 3, на 4 обучение пройдено +-- 0 — табличка «Как играть», 1 — портал в Мир 1, 2 — причал (поймать рыбу), 3 — скупка (продать) +Config.TutorialDone = 4 function Config.HitsNeeded(rank) return math.ceil(rank / 2) end diff --git a/install/3_MapBuilder_ServerScriptService.rbxmx b/install/3_MapBuilder_ServerScriptService.rbxmx index 4a5fdca..ff14581 100644 --- a/install/3_MapBuilder_ServerScriptService.rbxmx +++ b/install/3_MapBuilder_ServerScriptService.rbxmx @@ -1,88 +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(20, 95, 115) -terrain.WaterTransparency = 0.2 -terrain.WaterReflectance = 0.08 -terrain.WaterWaveSize = 0.1 -terrain.WaterWaveSpeed = 8 - ----------------------------------------------------------------- МИР 1: террейн (строится всегда) - -local W = V(0, 0, 1500) -- центр Мира 1 -local GROUND_Y = 4 -- верх земли -local WATER_Y = 0 -- поверхность воды - --- озеро из нескольких кругов: { x, z, радиус } -local LAKES = Config.Worlds[1].lakes - -terrain:FillBlock(CFrame.new(W + V(0, -10, 0)), V(500, 28, 500), Enum.Material.Grass) --- холмы по краям -for _, h in ipairs({ { -190, 160, 50 }, { 185, 175, 45 }, { -175, -175, 60 }, { 190, -150, 55 }, { 0, -215, 50 }, { -215, 0, 40 }, { 215, 30, 42 } }) do - terrain:FillBall(W + V(h[1], -14, h[2]), h[3], Enum.Material.Grass) -end --- порядок важен: песок → выемка → ил → вода -for _, l in ipairs(LAKES) do - terrain:FillCylinder(CFrame.new(W + V(l[1], -10, l[2])), 28, l[3] + 11, Enum.Material.Sand) -end -for _, l in ipairs(LAKES) do - terrain:FillCylinder(CFrame.new(W + V(l[1], 11, l[2])), 18, l[3] + 7, Enum.Material.Air) -end -for _, l in ipairs(LAKES) do - terrain:FillCylinder(CFrame.new(W + V(l[1], 10, l[2])), 20, l[3] + 2, Enum.Material.Air) -end -for _, l in ipairs(LAKES) do - terrain:FillCylinder(CFrame.new(W + V(l[1], -18, l[2])), 12, l[3], Enum.Material.Mud) -end -for _, l in ipairs(LAKES) do - terrain:FillCylinder(CFrame.new(W + V(l[1], -6, l[2])), 12, l[3], Enum.Material.Water) -end --- дорожка от точки прибытия к причалу и площадка -terrain:FillBlock(CFrame.new(W + V(0, 2, 100)), V(8, 4, 44), Enum.Material.Ground) -terrain:FillCylinder(CFrame.new(W + V(0, 2, 130)), 4, 17, Enum.Material.Cobblestone) +WorldBuilder.applyLighting() ---------------------------------------------------------------- точка появления в лобби @@ -92,8 +19,8 @@ if not spawn then spawn.Parent = Workspace end spawn.Anchored = true -spawn.Size = V(8, 0.2, 8) -spawn.CFrame = CFrame.new(0, 1.15, 50) +spawn.Size = Vector3.new(8, 0.2, 8) +spawn.CFrame = CFrame.new(0, 1.15, 57) spawn.Transparency = 1 spawn.Duration = 0 for _, d in ipairs(spawn:GetChildren()) do @@ -102,1307 +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, 50)) - --- фонтан со статуей золотой рыбы -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 i = 0, 5 do - local a = math.rad(i * 60 + 30) - bench(CFrame.lookAt(V(math.cos(a) * 17, FLOOR, math.sin(a) * 17), V(math.cos(a) * 30, FLOOR, math.sin(a) * 30))) -end - --- фонари по кругу -for i = 0, 7 do - local a = math.rad(i * 45 + 22.5) - lamp(V(math.cos(a) * 40, FLOOR, math.sin(a) * 40)) -end - --- клумбы с деревьями -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, -}) - --- порталы во все миры и арка с названием -local portalCF = CFrame.lookAt(V(0, FLOOR, -66), V(0, FLOOR, 0)) -arch(portalCF, 84, 24, "🎣 " .. string.upper(Config.GameName) .. " 🎣", Color3.fromRGB(255, 190, 60)) -for i, w in ipairs(Config.Worlds) do - local title = w.icon .. " " .. w.name .. (w.level > 1 and (" (ур. " .. w.level .. ")") or "") - portal(portalCF * CFrame.new(-27 + (i - 1) * 18, 0, 0), title, w.color, w.id, w.soon) -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(-14, FLOOR, 34) - local cf = CFrame.lookAt(pos, V(0, FLOOR, 50)) - 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) }) - 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: ТИХОЕ ОЗЕРО (детали) - -local function inLake(x, z, extra) - for _, l in ipairs(LAKES) do - if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + (extra or 0) then - return true - end - end - return false -end - --- прибытие -local arrive = W + V(0, GROUND_Y, 128) -marker("World1Spawn", CFrame.lookAt(arrive + V(0, 1, 0), arrive + V(0, 1, -10))) -arch(CFrame.new(W + V(0, GROUND_Y, 112)), 14, 11, "🌊 ТИХОЕ ОЗЕРО", Color3.fromRGB(80, 200, 255)) -portal(CFrame.lookAt(W + V(-26, GROUND_Y, 140), arrive), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") -stall(CFrame.lookAt(W + V(30, GROUND_Y, 140), arrive), { - title = "💰 СКУПКА", - titleColor = Color3.fromRGB(150, 255, 160), - wall = Color3.fromRGB(150, 115, 80), - 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(200, 150, 110), shirt = Color3.fromRGB(70, 130, 80), pants = Color3.fromRGB(60, 50, 40), hat = Color3.fromRGB(200, 170, 110) }, -}) - --- доска «Кто водится в озере» -do - local pos = W + V(-16, GROUND_Y, 104) - local cf = CFrame.lookAt(pos, W + V(0, GROUND_Y, 120)) - 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 = { "🐟 КТО ВОДИТСЯ В ОЗЕРЕ" } - 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 - --- костёр с брёвнами -do - local c = W + V(14, GROUND_Y, 118) - 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 fireBase = 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 = fireBase - local light = Instance.new("PointLight") - light.Color = Color3.fromRGB(255, 160, 80) - light.Range = 20 - light.Brightness = 2 - light.Parent = fireBase - for _, a in ipairs({ 0, 2.1, 4.2 }) do - local p = c + V(math.cos(a) * 6, 0.6, math.sin(a) * 6) - P({ Shape = Enum.PartType.Cylinder, Size = V(5, 1.4, 1.4), CFrame = CFrame.lookAt(p, c) * CFrame.Angles(0, math.rad(90), 0) * CFrame.Angles(0, math.rad(90), 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(115, 80, 50) }) - end -end - --- дед-рыбак с подсказками -npc("Дед Петрович", CFrame.lookAt(W + V(-7, GROUND_Y + 3, 80), W + V(0, GROUND_Y + 3, 95)), { - 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", "Поговорить") - --- домик рыбака -do - local cf = CFrame.lookAt(W + V(-34, GROUND_Y, 100), W + V(0, GROUND_Y, 100)) - local logC = Color3.fromRGB(130, 90, 55) - P({ Size = V(14, 1, 12), CFrame = cf * CFrame.new(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(110, 80, 50) }) - P({ Size = V(14, 8, 1), CFrame = cf * CFrame.new(0, 5, 5.5), Material = Enum.Material.Wood, Color = logC }) - for _, s in ipairs({ -1, 1 }) do - P({ Size = V(1, 8, 12), CFrame = cf * CFrame.new(s * 6.5, 5, 0), Material = Enum.Material.Wood, Color = logC }) - P({ Size = V(5, 8, 1), CFrame = cf * CFrame.new(s * 4.5, 5, -5.5), Material = Enum.Material.Wood, Color = logC }) - P({ Size = V(16, 1, 8.8), CFrame = cf * CFrame.new(0, 11.2, s * 3.4) * CFrame.Angles(math.rad(-s * 38), 0, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 60, 45) }) - end - P({ Size = V(4, 2, 1), CFrame = cf * CFrame.new(0, 8, -5.5), Material = Enum.Material.Wood, Color = logC }) - P({ Size = V(2.2, 2, 0.3), CFrame = cf * CFrame.new(-4.5, 5.5, -6.05), Material = Enum.Material.Glass, Color = Color3.fromRGB(255, 225, 150), Transparency = 0.2 }) - P({ Size = V(14, 3, 1), CFrame = cf * CFrame.new(0, 10.5, 5.5), Material = Enum.Material.Wood, Color = logC }) -end - --- причалы -local function pier(center, size) - 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 -end -pier(W + V(0, GROUND_Y + 0.2, 58), V(8, 0.6, 42)) -pier(W + V(-86, GROUND_Y + 0.2, 15), V(34, 0.6, 7)) -pier(W + V(86, GROUND_Y + 0.2, -10), V(34, 0.6, 7)) -lamp(W + V(-3.5, GROUND_Y + 0.5, 40), Color3.fromRGB(255, 220, 160)) -lamp(W + V(-70, GROUND_Y + 0.5, 18), Color3.fromRGB(255, 220, 160)) -lamp(W + V(70, GROUND_Y + 0.5, -13), Color3.fromRGB(255, 220, 160)) - --- лодка у западного причала -do - local cf = CFrame.new(W + V(-74, WATER_Y + 0.3, 24)) * CFrame.Angles(0, math.rad(15), 0) - local hull = Color3.fromRGB(170, 70, 50) - P({ Size = V(4, 0.5, 9), CFrame = cf, Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 100, 65) }) - for _, s in ipairs({ -1, 1 }) do - P({ Size = V(0.4, 1.4, 9), CFrame = cf * CFrame.new(s * 2, 0.7, 0), Material = Enum.Material.Wood, Color = hull }) - P({ Size = V(4.4, 1.4, 0.4), CFrame = cf * CFrame.new(0, 0.7, s * 4.5), Material = Enum.Material.Wood, Color = hull }) - end - P({ Size = V(4, 0.3, 1.2), CFrame = cf * CFrame.new(0, 1, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 100, 65) }) -end - --- кувшинки и камыши -for _, l in ipairs(LAKES) do - for _ = 1, 7 do - local a, d = rng:NextNumber(0, math.pi * 2), rng:NextNumber(6, l[3] - 5) - local x, z = l[1] + math.cos(a) * d, l[2] + math.sin(a) * d - local size = rng:NextNumber(2, 3.5) - P({ Shape = Enum.PartType.Cylinder, Size = V(0.15, size, size), CFrame = CFrame.new(W + V(x, WATER_Y + 0.28, z)) * CFrame.Angles(0, 0, math.rad(90)), Color = Color3.fromRGB(70, 150, 60), CanCollide = false }) - if rng:NextNumber() < 0.4 then - ball(W + V(x + 0.3, WATER_Y + 0.55, z), 0.7, { Color = Color3.fromRGB(255, 150, 190), CanCollide = false }) - end - end - for _ = 1, 9 do - local a = rng:NextNumber(0, math.pi * 2) - local x, z = l[1] + math.cos(a) * (l[3] + 1.2), l[2] + math.sin(a) * (l[3] + 1.2) - local inOther = false - for _, o in ipairs(LAKES) do - if o ~= l and (V(x, 0, z) - V(o[1], 0, o[2])).Magnitude < o[3] + 1 then - inOther = true - end - end - if not inOther and not (math.abs(x) < 6 and z > 30) then - for _ = 1, 5 do - local h = rng:NextNumber(3, 5) - local p = W + V(x + rng:NextNumber(-1.2, 1.2), WATER_Y + h / 2 - 0.5, z + rng:NextNumber(-1.2, 1.2)) - P({ Size = V(0.18, h, 0.18), Position = p, Color = Color3.fromRGB(85, 130, 50), CanCollide = false }) - P({ Size = V(0.35, 0.9, 0.35), Position = p + V(0, h / 2 - 0.3, 0), Color = Color3.fromRGB(110, 70, 40), CanCollide = false }) - end - end - end -end - --- деревья, кусты, камни -local function freeSpot(x, z) - if inLake(x, z, 14) then - return false - end - if (V(x, 0, z) - V(0, 0, 128)).Magnitude < 34 then - return false - end - if math.abs(x) < 9 and z > 70 and z < 125 then - return false - end - if (V(x, 0, z) - V(-34, 0, 100)).Magnitude < 14 then - return false - end - return true -end - -local placed = 0 -for _ = 1, 400 do - if placed >= 110 then - break - end - local x, z = rng:NextNumber(-230, 230), rng:NextNumber(-230, 230) - if freeSpot(x, z) then - local y = groundY(W.X + x, W.Z + z) - local roll = rng:NextNumber() - tree(W + V(x, y - 0.5, z), roll < 0.35 and "pine" or (roll < 0.5 and "birch" or "round")) - placed += 1 - end -end -for _ = 1, 60 do - local x, z = rng:NextNumber(-200, 200), rng:NextNumber(-200, 200) - if freeSpot(x, z) then - bush(W + V(x, groundY(W.X + x, W.Z + z) - 0.6, z)) - end -end -for _, l in ipairs(LAKES) do - for _ = 1, 4 do - local a = rng:NextNumber(0, math.pi * 2) - local x, z = l[1] + math.cos(a) * (l[3] + 8), l[2] + math.sin(a) * (l[3] + 8) - if not inLake(x, z, 3) and not (math.abs(x) < 8 and z > 30) then - local s = rng:NextNumber(2.5, 5) - P({ Size = V(s, s * 0.7, s * 0.9), CFrame = CFrame.new(W + V(x, groundY(W.X + x, W.Z + z), z)) * CFrame.Angles(rng:NextNumber(0, 1), rng:NextNumber(0, 6), rng:NextNumber(0, 1)), Material = Enum.Material.Rock, Color = Color3.fromRGB(125, 125, 130) }) - end - end -end - --- фонари вдоль дорожки -for _, z in ipairs({ 84, 100 }) do - lamp(W + V(6, GROUND_Y, z)) - lamp(W + V(-6, GROUND_Y, z)) -end - --- невидимые стены по краю мира -for _, w in ipairs({ - { V(0, 0, 245), V(500, 120, 2) }, - { V(0, 0, -245), V(500, 120, 2) }, - { V(245, 0, 0), V(2, 120, 500) }, - { V(-245, 0, 0), V(2, 120, 500) }, -}) do - P({ Size = w[2], Position = W + w[1] + V(0, 40, 0), Transparency = 1 }) -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] - if not terrainHasWater(w1.center + V(0, -4, 0)) then - warn("[MapBuilder] Вода в террейне Мира 1 не создалась — ставлю запасную поверхность воды") - waterPlane(w1.center + V(0, w1.waterY, 0), 490, Color3.fromRGB(30, 120, 150)) - 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 9914731..bacf498 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), @@ -220,6 +265,8 @@ local function updateStats(player) player:SetAttribute("BoostBonus", boostActive(data)) player:SetAttribute("BoostLeft", math.max(0, data.boostUntil - os.time())) player:SetAttribute("TotalCaught", data.totalCaught) + -- шаг обучения (линия-подсказка); у старых игроков без поля, уже ловивших рыбу, обучение пройдено + player:SetAttribute("Tutorial", data.tutorial or (data.totalCaught > 0 and Config.TutorialDone or 0)) player:SetAttribute("Mastery", masteryCount(data)) player:SetAttribute("Passes", table.concat(ps, ",")) @@ -240,10 +287,10 @@ local function addXp(player, data, amount) leveled = true end if leveled then - notify(player, "⭐ Новый уровень: " .. data.level .. "! Удача +" .. math.floor(Config.LuckPerPlayerLevel * 100) .. "%", GOLD) + notify(player, "⭐ Уровень " .. data.level .. "!", GOLD) for _, w in ipairs(Config.Worlds) do if w.level == data.level and not w.soon then - notify(player, "🌍 Открыт новый мир: " .. w.icon .. " " .. w.name .. "!", w.color) + notify(player, "🌍 Открыт: " .. w.icon .. " " .. w.name, w.color) end end end @@ -254,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) @@ -336,7 +358,7 @@ local function claimDaily(player) end local t = today() if data.daily.last >= t then - notify(player, "🎁 Сегодня награда уже получена. Приходи завтра!", Color3.fromRGB(255, 200, 120)) + notify(player, "🎁 Приходи завтра", Color3.fromRGB(255, 200, 120)) return end local streak = (data.daily.last == t - 1) and (data.daily.streak % 7 + 1) or 1 @@ -372,7 +394,7 @@ local function claimCollection(player, worldId, rarity) end for _, f in ipairs(zone.fish) do if (rarity == "Master" or f.rarity == rarity) and not data.discovered[f.id] then - notify(player, "Сначала поймай всех рыб этой группы!", RED) + notify(player, "Сначала поймай всех", RED) return end end @@ -380,7 +402,7 @@ local function claimCollection(player, worldId, rarity) if rarity == "Master" then local coins = Config.MasteryCoins * world.mult data.coins += coins - notify(player, ("🏆 Мир «%s» собран! +%d 💰 и +%d%% удачи навсегда"):format(world.name, coins, math.floor(Config.MasteryLuck * 100 + 0.5)), GOLD) + notify(player, ("🏆 «%s» собран! +%d 💰"):format(world.name, coins), GOLD) else local r = Config.CollectionRewards[rarity] if not r then @@ -388,7 +410,7 @@ local function claimCollection(player, worldId, rarity) end data.coins += r.coins * world.mult addXp(player, data, r.xp * world.mult) - notify(player, ("📖 Коллекция «%s»: +%d 💰 +%d XP"):format(Config.Rarities[rarity].name, r.coins * world.mult, r.xp * world.mult), GREEN) + notify(player, ("📖 +%d 💰 +%d XP"):format(r.coins * world.mult, r.xp * world.mult), GREEN) end updateStats(player) sendInventory(player) @@ -542,6 +564,28 @@ local function splash(part, count) end -- рыба вылетает из воды, летит к игроку и показывается над головой +-- шлейф за летящим предметом — эффект быстрого движения (ширина — расстояние между точками крепления) +local TRAIL_COLOR = Color3.fromRGB(215, 245, 255) +local function addTrail(part, width) + local a0 = Instance.new("Attachment") + a0.Position = Vector3.new(0, width / 2, 0) + a0.Parent = part + local a1 = Instance.new("Attachment") + a1.Position = Vector3.new(0, -width / 2, 0) + a1.Parent = part + local trail = Instance.new("Trail") + trail.Attachment0, trail.Attachment1 = a0, a1 + trail.FaceCamera = true + trail.Lifetime = 0.35 + trail.MinLength = 0.05 + trail.LightEmission = 0.7 + trail.Color = ColorSequence.new(TRAIL_COLOR) + trail.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.1), NumberSequenceKeypoint.new(1, 1) }) + trail.WidthScale = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(1, 0) }) + trail.Parent = part + return trail +end + local function showFishFlight(player, fish, fromPos) local head = player.Character and player.Character:FindFirstChild("Head") if not head then @@ -550,6 +594,14 @@ local function showFishFlight(player, fish, fromPos) local model = Models.buildFish(fish.id, fish.mutation, 0.9, true) model:PivotTo(CFrame.new(fromPos)) model.Parent = workspace + -- шлейф на отдельной невидимой детали: рыба крутится, а шлейф должен оставаться ровным + local carrier = Instance.new("Part") + carrier.Anchored, carrier.CanCollide, carrier.CanQuery, carrier.CanTouch = true, false, false, false + carrier.Transparency = 1 + carrier.Size = Vector3.new(0.2, 0.2, 0.2) + carrier.CFrame = CFrame.new(fromPos) + carrier.Parent = model + local trail = addTrail(carrier, 1.8) task.spawn(function() local t0, dur = os.clock(), 0.55 while head.Parent do @@ -557,11 +609,13 @@ local function showFishFlight(player, fish, fromPos) local target = head.Position + Vector3.new(0, 2.8, 0) local p = fromPos:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * 8, 0) model:PivotTo(CFrame.new(p) * CFrame.Angles(0, 0, a * math.pi * 2)) + carrier.CFrame = CFrame.new(p) if a >= 1 then break end RunService.Heartbeat:Wait() end + trail.Enabled = false local t1 = os.clock() while head.Parent and os.clock() - t1 < 1.8 do model:PivotTo(CFrame.new(head.Position + Vector3.new(0, 2.8, 0)) * CFrame.Angles(0, os.clock() * 3, math.rad(-15))) @@ -575,22 +629,87 @@ end local fishing = {} --- ищем воду перед игроком по карте мира из FishConfig (не зависит от террейна) -local function findWater(hrp, world) - local look = hrp.CFrame.LookVector * Vector3.new(1, 0, 1) - if look.Magnitude < 0.01 then - look = Vector3.new(0, 0, -1) +-- серия улова (на время игры, не сохраняется) +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 - look = look.Unit - for _, d in ipairs({ 14, 11, 17, 8, 20, 6, 24, 4 }) do - local p = hrp.Position + look * d - if Config.IsWater(world, p) then - return Vector3.new(p.X, world.waterY or 0, p.Z) + setCombo(player, 0) +end + +-- босс озера: { world, def, hp, max, dmg = { [player] = урон } } +local boss = nil +local function bossHit(player, world, dmg) + if not boss or boss.hp <= 0 or not world or world.id ~= boss.world.id then + return + end + boss.hp = math.max(0, boss.hp - dmg) + boss.dmg[player] = (boss.dmg[player] or 0) + dmg + workspace:SetAttribute("BossHP", boss.hp) + remote:FireClient(player, "BossHit", dmg) + questProgress(player, "boss", dmg) +end + +-- ищем воду по карте мира из FishConfig (не зависит от террейна) в сторону центра ближайшего озера: +-- сначала на дальности, которую задала сила заброса, потом всё дальше от неё +local function findWater(hrp, world, power) + local look = Config.CastDirection(world, hrp.Position) + if not look then + look = hrp.CFrame.LookVector * Vector3.new(1, 0, 1) + look = look.Magnitude > 0.01 and look.Unit or Vector3.new(0, 0, -1) + end + local want = Config.CastMinDist + (Config.CastMaxDist - Config.CastMinDist) * power + for off = 0, 26, 2 do + for _, d in ipairs({ want - off, want + off }) do + if d >= 4 and d <= Config.CastMaxDist + 2 then + local p = hrp.Position + look * d + if Config.IsWater(world, p) then + return Vector3.new(p.X, world.waterY or 0, p.Z), d + end + end end end return nil end +-- вытягивание пустого поплавка: быстро летит к кончику удочки со шлейфом и исчезает +local function reelBobber(bobber, tool) + local root = bobber and bobber.PrimaryPart + local tip = tool and tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip") + if not root or not tip then + if bobber then + bobber:Destroy() + end + return + end + local trail = bobber:FindFirstChildWhichIsA("Trail", true) + if trail then + trail.Enabled = true + else + addTrail(root, 1.2) + end + local from = root.Position + task.spawn(function() + local t0, dur = os.clock(), 0.3 + while bobber.Parent and tip.Parent do + local a = math.min(1, (os.clock() - t0) / dur) + bobber:PivotTo(CFrame.new(from:Lerp(tip.WorldPosition, a) + Vector3.new(0, math.sin(a * math.pi) * 2.5, 0))) + if a >= 1 then + break + end + RunService.Heartbeat:Wait() + end + bobber:Destroy() + end) +end + local function stopFishing(player, tellClient) local s = fishing[player] if not s then @@ -601,7 +720,11 @@ local function stopFishing(player, tellClient) s.tween:Cancel() end if s.bobber then - s.bobber:Destroy() + if s.stage == "casting" then + s.bobber:Destroy() -- ещё летит: его двигает flyBobber + else + reelBobber(s.bobber, s.tool) + end end if s.tool then tweenGrip(s.tool, REST_ANGLE, 0.3) @@ -611,12 +734,12 @@ local function stopFishing(player, tellClient) end end -local function rollFish(player, data, worldId) +local function rollFish(player, data, worldId, luckMult) local zone = Config.Zones[worldId] if not zone then return nil end - local luck = totalLuck(player, data) + local luck = totalLuck(player, data) * (luckMult or 1) local bonus = luck - 1 local weights, total = {}, 0 for i, f in ipairs(zone.fish) do @@ -658,13 +781,14 @@ local function rollFish(player, data, worldId) } end -local function flyBobber(s, tool, target) +local function flyBobber(s, tool, target, dur, arc) local tip = tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip") local start = tip and tip.WorldPosition or (target + Vector3.new(0, 6, 0)) local bobber = Models.buildBobber() bobber:PivotTo(CFrame.new(start)) bobber.Parent = workspace s.bobber = bobber + local trail = addTrail(bobber.PrimaryPart, 1.2) if tip then local a1 = Instance.new("Attachment") a1.Position = Vector3.new(0, 0.9, 0) @@ -678,22 +802,24 @@ local function flyBobber(s, tool, target) line.Color = ColorSequence.new(Color3.fromRGB(245, 245, 245)) line.Parent = bobber end - local t0, dur = os.clock(), 0.55 + local t0 = os.clock() while bobber.Parent do local a = math.min(1, (os.clock() - t0) / dur) - bobber:PivotTo(CFrame.new(start:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * 6, 0))) + bobber:PivotTo(CFrame.new(start:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * arc, 0))) if a >= 1 then break end RunService.Heartbeat:Wait() end + trail.Enabled = false -- на воде поплавок качается, шлейф уже не нужен if bobber.Parent then splash(bobber.PrimaryPart, 18) playSound(bobber.PrimaryPart, SPLASH_SOUND, 0.5) end end -local function onCast(player) +local function onCast(player, power) + power = math.clamp(tonumber(power) or 0.6, 0, 1) local data = profiles[player] if not data then return @@ -710,42 +836,47 @@ local function onCast(player) return end local world = Config.WorldAt(hrp.Position) - local target = world and findWater(hrp, world) + local can = Config.CanCastFrom(world, hrp.Position) + if can ~= true then + remote:FireClient(player, "CastFail") + notify(player, can, Color3.fromRGB(255, 200, 120)) + return + end + local target, dist = findWater(hrp, world, power) if not target then remote:FireClient(player, "CastFail") - notify(player, world and "Повернись лицом к воде (или к лунке)!" or "Здесь нет рыбы — иди в один из миров 🌍", Color3.fromRGB(255, 200, 120)) + notify(player, "🌊 Подойди к воде", Color3.fromRGB(255, 200, 120)) return end if #data.items >= bagCapacity(player, data) then remote:FireClient(player, "CastFail") - notify(player, "🎒 Сумка полна! Продай рыбу в скупке.", RED) + notify(player, "🎒 Сумка полна!", RED) return end local stats = Config.RodStats(data.rod, rodLevel(data)) - local fish = rollFish(player, data, world.id) + local perfect = power >= Config.CastPerfect[1] and power <= Config.CastPerfect[2] + local fish = rollFish(player, data, world.id, perfect and Config.CastPerfectLuck or 1) if not fish then remote:FireClient(player, "CastFail") return end - local s = { stage = "casting", fish = fish, tool = tool } + local s = { stage = "casting", fish = fish, tool = tool, perfect = perfect } fishing[player] = s - remote:FireClient(player, "Cast") + -- замах игрок уже сделал, пока держал кнопку (у себя на клиенте); здесь только бросок вперёд + local throw = { windup = 0.15, flight = 0.35 + dist * 0.018, arc = 2 + dist * 0.3, perfect = perfect } + local splashAt = target + Vector3.new(0, 0.15, 0) + remote:FireClient(player, "Cast", splashAt, throw) -- клиенту для камеры task.spawn(function() - -- замах назад и бросок вперёд - local tw = tweenGrip(tool, 100, 0.25) - if tw then - tw.Completed:Wait() - end - tw = tweenGrip(tool, 8, 0.15) + local tw = tweenGrip(tool, 8, throw.windup) if tw then tw.Completed:Wait() end if fishing[player] ~= s then return end - flyBobber(s, tool, target + Vector3.new(0, 0.15, 0)) + flyBobber(s, tool, splashAt, throw.flight, throw.arc) tweenGrip(tool, REST_ANGLE - 5, 0.4) if fishing[player] ~= s then if s.bobber then @@ -792,7 +923,8 @@ local function onCast(player) if fishing[player] == s and s.stage == "bite" then stopFishing(player, false) remote:FireClient(player, "Escaped") - notify(player, "Рыба ушла… не успел вытащить.", RED) + notify(player, "🐟 Рыба ушла", RED) + breakCombo(player) end end) end @@ -810,19 +942,29 @@ local function onCatch(player, success, misses) if s.tween then s.tween:Cancel() end - if s.bobber then - s.bobber:Destroy() + local failed = success ~= true or os.clock() - s.biteAt > Config.BiteTimeout + 1 + if failed then + reelBobber(s.bobber, tool) + elseif s.bobber then + s.bobber:Destroy() -- вместо поплавка к игроку летит рыба end - if success ~= true or os.clock() - s.biteAt > Config.BiteTimeout + 1 then + if failed then gripSequence(tool, { { REST_ANGLE, 0.3 } }) remote:FireClient(player, "Escaped") - notify(player, "Рыба сорвалась!", RED) + 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, @@ -848,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 ---------------------------------------------------------------- скупка @@ -910,7 +1056,7 @@ local function sellItems(player, filterUid) end if count == 0 then if filterUid == nil then - notify(player, "Нечего продавать — сначала поймай рыбу!", Color3.fromRGB(255, 200, 120)) + notify(player, "🎒 Сумка пуста", Color3.fromRGB(255, 200, 120)) end return end @@ -919,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 @@ -936,12 +1083,12 @@ local function buy(player, kind, id) end local lvl = rodLevel(data, id) if lvl >= Config.RodUpgrade.maxLevel then - notify(player, "Удочка уже улучшена до максимума ★★★★★", GOLD) + notify(player, "★★★★★ Максимум", GOLD) return end local cost = Config.UpgradeCost(rod, lvl) if data.coins < cost then - notify(player, "Не хватает монет: нужно " .. cost .. " 💰", RED) + notify(player, "Нужно " .. cost .. " 💰", RED) return end data.coins -= cost @@ -952,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 @@ -960,17 +1108,18 @@ local function buy(player, kind, id) return end if potion.level and data.level < potion.level then - notify(player, "Нужен уровень " .. potion.level .. "!", RED) + notify(player, "🔒 Нужен ур. " .. potion.level, RED) return end if data.coins < potion.price then - notify(player, "Не хватает монет: нужно " .. potion.price .. " 💰", RED) + notify(player, "Нужно " .. potion.price .. " 💰", RED) return end data.coins -= potion.price applyPotion(data, potion.bonus, potion.duration) updateStats(player) - notify(player, ("🍀 %s: удача +%d%% на %d мин"):format(potion.name, potion.bonus * 100, potion.duration / 60), GREEN) + notify(player, ("🍀 +%d%% удачи, %d мин"):format(potion.bonus * 100, potion.duration / 60), GREEN) + questProgress(player, "buy", 1) return end local list, owned @@ -985,18 +1134,20 @@ 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) + notify(player, "🔒 Нужен ур. " .. item.level, RED) return end if data.coins < item.price then - notify(player, "Не хватает монет: нужно " .. item.price .. " 💰", RED) + notify(player, "Нужно " .. item.price .. " 💰", RED) return end data.coins -= item.price owned[id] = true - notify(player, "Куплено: " .. item.name .. "!", GREEN) + bought = true + notify(player, "✅ " .. item.name, GREEN) end if kind == "Rod" then data.rod = id @@ -1007,10 +1158,19 @@ local function buy(player, kind, id) attachBag(player) end updateStats(player) + if bought then + questProgress(player, "buy", 1) + end end ---------------------------------------------------------------- телепорт +local TELEPORT_FADE = 0.3 -- сколько клиент затемняет экран перед переносом +local teleporting = {} +Players.PlayerRemoving:Connect(function(p) + teleporting[p] = nil +end) + local function teleportTo(player, worldId) local data = profiles[player] local char = player.Character @@ -1026,20 +1186,28 @@ local function teleportTo(player, worldId) return end if world.soon then - notify(player, world.icon .. " " .. world.name .. " скоро откроется! Следи за обновлениями.", world.color) + notify(player, world.icon .. " " .. world.name .. " — скоро!", world.color) return end if data.level < world.level then - notify(player, ("🔒 %s откроется на %d уровне"):format(world.name, world.level), RED) + notify(player, ("🔒 %s: ур. %d"):format(world.name, world.level), RED) return end markerName = world.id .. "Spawn" end local map = workspace:FindFirstChild("FishingMap") - local m = map and map:FindFirstChild(markerName) - if m then + local m = map and map:FindFirstChild(markerName, true) -- маркеры могут лежать в папках уровня (World1Map) + if m and not teleporting[player] then + -- клиент затемняет экран, переносим уже в темноте: свет новой локации ставится до того, как её видно + teleporting[player] = true stopFishing(player, true) - char:PivotTo(m.CFrame + Vector3.new(0, 3, 0)) + remote:FireClient(player, "TeleportFade", worldId, TELEPORT_FADE) + task.wait(TELEPORT_FADE) + teleporting[player] = nil + char = player.Character + if char and char.Parent then + char:PivotTo(m.CFrame + Vector3.new(0, 3, 0)) + end end end @@ -1095,7 +1263,15 @@ end) remote.OnServerEvent:Connect(function(player, action, a, b) if action == "Cast" then - onCast(player) + onCast(player, a) + elseif action == "Tutorial" then + -- шаги обучения идут только вперёд + local data = profiles[player] + local step = math.floor(tonumber(a) or 0) + if data and step > (player:GetAttribute("Tutorial") or 0) and step <= Config.TutorialDone then + data.tutorial = step + player:SetAttribute("Tutorial", step) + end elseif action == "Catch" then onCatch(player, a, b) elseif action == "Cancel" then @@ -1109,20 +1285,18 @@ remote.OnServerEvent:Connect(function(player, action, a, b) if nearSeller(player) then sellItems(player, a) else - notify(player, "Продавать можно только у скупщика 💰", Color3.fromRGB(255, 200, 120)) + notify(player, "💰 Только у скупщика", Color3.fromRGB(255, 200, 120)) end elseif action == "SellAll" then if nearSeller(player) then sellItems(player, nil) else - notify(player, "Продавать можно только у скупщика 💰", Color3.fromRGB(255, 200, 120)) + notify(player, "💰 Только у скупщика", Color3.fromRGB(255, 200, 120)) end elseif action == "Teleport" then teleportTo(player, a) elseif action == "ClaimCollection" then claimCollection(player, a, b) - elseif action == "ClaimQuest" then - claimQuest(player, a) elseif action == "ClaimDaily" then claimDaily(player) elseif action == "RequestInventory" then @@ -1141,7 +1315,7 @@ MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passI if gp.id == passId then passes[player] = passes[player] or {} passes[player][gp.key] = true - notify(player, "Спасибо за покупку! " .. gp.icon .. " " .. gp.name .. " активирован", GOLD) + notify(player, "✅ " .. gp.icon .. " " .. gp.name, GOLD) if gp.key == "VIP" then vipTag(player) end @@ -1177,7 +1351,7 @@ MarketplaceService.ProcessReceipt = function(info) end if product.boost then applyPotion(data, product.boost, product.duration) - notify(player, ("Спасибо! Удача +%d%% на %d мин"):format(product.boost * 100, product.duration / 60), GOLD) + notify(player, ("🍀 +%d%% удачи, %d мин"):format(product.boost * 100, product.duration / 60), GOLD) end table.insert(data.receipts, info.PurchaseId) if #data.receipts > 50 then @@ -1197,7 +1371,7 @@ task.spawn(function() workspace:SetAttribute("Event", currentEvent.id) workspace:SetAttribute("EventEnds", workspace:GetServerTimeNow() + currentEvent.duration) for _, p in ipairs(Players:GetPlayers()) do - notify(p, "🎉 Событие: " .. currentEvent.name .. " — " .. currentEvent.desc, GOLD) + notify(p, "🎉 " .. currentEvent.name, GOLD) updateStats(p) end task.wait(currentEvent.duration) @@ -1210,6 +1384,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) @@ -1227,7 +1500,7 @@ local function onPlayerAdded(player) return end loadPasses(player) - ensureQuests(data) + ensureChain(data) profiles[player] = data loadedOk[player] = ok updateStats(player) @@ -1254,6 +1527,7 @@ end Players.PlayerRemoving:Connect(function(player) stopFishing(player, false) + combo[player], comboUntil[player] = nil, nil saveData(player) profiles[player] = nil loadedOk[player] = nil @@ -1277,6 +1551,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 d0f7e80..741ca17 100644 --- a/install/5_FishingClient_StarterPlayerScripts.rbxmx +++ b/install/5_FishingClient_StarterPlayerScripts.rbxmx @@ -219,9 +219,44 @@ local function sideButton(order, icon, label, key, color, onClick) end ---------------------------------------------------------------- уведомления +-- мультяшный стиль подсказок: крупный круглый шрифт без обводки на мягкой «дымке» — +-- тёмная подложка, которая плавно растворяется к краям; появляются «пружинкой» +local SOFT_EDGES = NumberSequence.new({ + NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.18, 0.62), + NumberSequenceKeypoint.new(0.82, 0.62), NumberSequenceKeypoint.new(1, 1), +}) +-- жирный округлый шрифт с кириллицей (у FredokaOne кириллицы нет — Roblox подставляет тонкий шрифт) +local HINT_FONT = Font.new("rbxasset://fonts/families/Nunito.json", Enum.FontWeight.Heavy) +-- плашка-дымка (Frame) с текстом внутри; градиент только на плашке, на текст он не действует +local function softPlate(props, textProps) + local plate = new("Frame", props) + plate.BackgroundColor3 = BLACK + plate.BackgroundTransparency = 0 + corner(30).Parent = plate + new("UIGradient", { Transparency = SOFT_EDGES, Parent = plate }) + new("UIPadding", { PaddingLeft = UDim.new(0, 48), PaddingRight = UDim.new(0, 48), Parent = plate }) + local d = { Size = UDim2.fromScale(0, 1), AutomaticSize = Enum.AutomaticSize.X, TextXAlignment = Enum.TextXAlignment.Center, Parent = plate } + for k, v in pairs(textProps) do + d[k] = v + end + local label = text(d) + label.FontFace = HINT_FONT + return plate, label +end +local function popIn(obj, from) + local sc = obj:FindFirstChildOfClass("UIScale") or new("UIScale", { Parent = obj }) + sc.Scale = from or 0.4 + TweenService:Create(sc, TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play() +end +local function wobble(obj, deg, period) + obj.Rotation = -deg + TweenService:Create(obj, TweenInfo.new(period, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true), { Rotation = deg }):Play() +end + +-- уведомления — под подсказкой обучения, которая стоит в самом верху local toasts = new("Frame", { - Size = UDim2.new(0, 560, 0, 200), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 8), + Size = UDim2.new(0, 900, 0, 200), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 84), BackgroundTransparency = 1, Parent = gui, }, { new("UIListLayout", { Padding = UDim.new(0, 6), HorizontalAlignment = Enum.HorizontalAlignment.Center, SortOrder = Enum.SortOrder.LayoutOrder }) }) local toastOrder = 0 @@ -251,11 +286,11 @@ local function notify(msg, color) if #items >= 3 then items[1]:Destroy() end - local t = new("Frame", { - Size = UDim2.new(0, 0, 0, 38), AutomaticSize = Enum.AutomaticSize.X, BackgroundColor3 = C.bg, - BackgroundTransparency = 0.15, LayoutOrder = toastOrder, Parent = toasts, - }, { corner(12), stroke(color or WHITE, 2, 0.2), new("UIPadding", { PaddingLeft = UDim.new(0, 16), PaddingRight = UDim.new(0, 16) }) }) - local l = text({ Size = UDim2.new(0, 0, 1, 0), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 19, TextColor3 = color or WHITE, Text = msg, Parent = t }) + local t, l = softPlate( + { Size = UDim2.new(0, 0, 0, 54), AutomaticSize = Enum.AutomaticSize.X, LayoutOrder = toastOrder, Parent = toasts }, + { TextSize = 30, TextColor3 = color or WHITE, Text = msg } + ) + popIn(t) t:SetAttribute("Msg", msg) toastTimers[t] = 0 task.delay(3.2, function() @@ -299,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() @@ -328,11 +364,12 @@ end ---------------------------------------------------------------- статус и мини-игра -local statusLabel = text({ - Size = UDim2.fromOffset(460, 34), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -110), - Font = TITLE, TextSize = 22, TextXAlignment = Enum.TextXAlignment.Center, TextStrokeTransparency = 0.3, - Text = "🎣 Ждём поклёвку… (клик — смотать)", Visible = false, Parent = gui, -}) +-- вверху, на месте подсказки обучения (она во время рыбалки скрыта) +local statusLabel = softPlate( + { Size = UDim2.fromOffset(0, 64), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 12), Visible = false, Parent = gui }, + { TextSize = 36, Text = "🎣 Ждём клёв…" } +) +wobble(statusLabel, 1.2, 1.4) local mgFrame = new("Frame", { Size = UDim2.fromOffset(480, 124), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -100), BackgroundColor3 = WHITE, Visible = false, Parent = gui, @@ -469,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 } ---------------------------------------------------------------- магазин @@ -857,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 @@ -940,7 +997,7 @@ robuxWin.render = function(tab) buttonText = has and "Куплено ✓" or ("R$ " .. it.robux), buttonColor = has and C.grey or C.green, active = not has, onClick = function() if not it.id or it.id == 0 then - notify("Товар ещё не настроен: впиши его ID в FishConfig", Color3.fromRGB(255, 200, 120)) + notify("⚙ Товар не настроен", Color3.fromRGB(255, 200, 120)) return end if tab == "passes" then @@ -972,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] @@ -1046,10 +1098,282 @@ refreshHud() local state = "idle" local mg = { pos = 0, dir = 1, speed = 1, zoneStart = 0.4, zoneWidth = 0.25, hits = 0, need = 1, misses = 0, maxMisses = 2, deadline = 0, timeout = 10 } +-- с начала зарядки и до конца рыбалки персонажем не управляем: не ходит, не прыгает, не поворачивается +local ContextActionService = game:GetService("ContextActionService") +local MOVE_KEYS = { + Enum.KeyCode.W, Enum.KeyCode.A, Enum.KeyCode.S, Enum.KeyCode.D, Enum.KeyCode.Space, + Enum.KeyCode.Up, Enum.KeyCode.Down, Enum.KeyCode.Left, Enum.KeyCode.Right, + Enum.KeyCode.Thumbstick1, Enum.KeyCode.ButtonA, +} +local controls +local movementLocked = false +local function setMovementLocked(locked) + if not controls then + local pm = player:FindFirstChild("PlayerScripts") and player.PlayerScripts:FindFirstChild("PlayerModule") + local ok, mod = pcall(require, pm) + controls = ok and mod and mod:GetControls() or nil + end + if controls then + if locked then + controls:Disable() + else + controls:Enable() + end + end + if locked ~= movementLocked then + movementLocked = locked + if locked then + ContextActionService:BindActionAtPriority("FishingLock", function() + return Enum.ContextActionResult.Sink + end, false, Enum.ContextActionPriority.High.Value + 100, table.unpack(MOVE_KEYS)) + else + ContextActionService:UnbindAction("FishingLock") + end + end + local hum = player.Character and player.Character:FindFirstChildOfClass("Humanoid") + if hum then + hum.AutoRotate = not locked + hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, not locked) + if locked then + hum:Move(Vector3.zero) + end + end +end + +local function easeInOut(a) + return a < 0.5 and 4 * a * a * a or 1 - (-2 * a + 2) ^ 3 / 2 +end +local function easeOut(a) + return 1 - (1 - a) ^ 3 +end + +---------------------------------------------------------------- заброс: зарядка, шкала силы, наклон удочки +-- держишь ЛКМ — сила растёт, удочка уходит назад; отпустил — бросок на дальность по силе + +local REST_ANGLE, BACK_ANGLE = 30, 110 -- удочка в покое (как в GameServer) и в полном замахе +local function gripCF(angle) + return (CFrame.Angles(math.rad(angle), 0, 0) * CFrame.new(0, 0, -0.3)):Inverse() +end + +local charge = nil -- { t0, tool } +local castTool = nil -- удочка последнего броска: вернуть её в покой, если бросок не удался +-- сила ездит туда-сюда: 0 → 1 за CastChargeTime, потом обратно к 0 и снова вверх, пока держишь ЛКМ +local function chargePower() + if not charge then + return 0 + end + local t = ((os.clock() - charge.t0) / Config.CastChargeTime) % 2 + return t <= 1 and t or 2 - t +end +local function inPerfect(v) + return v >= Config.CastPerfect[1] and v <= Config.CastPerfect[2] +end + +-- шкала-дуга справа от персонажа: внизу слабый бросок, вверху сильный, зелёная зона — бонус удачи +local GAUGE_R, GAUGE_DEG, GAUGE_N = 190, 110, 32 +local gauge = new("Frame", { + Size = UDim2.fromOffset(150, 280), AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0.57, 0, 0.48, 0), + BackgroundTransparency = 1, Visible = false, Parent = gui, +}) +local GAUGE_C = Vector2.new(110 - GAUGE_R, 140) -- центр окружности левее рамки: дуга выгнута вправо +local function arcPoint(v, r) + local th = math.rad(-GAUGE_DEG / 2 + GAUGE_DEG * v) + return GAUGE_C + Vector2.new(math.cos(th) * r, -math.sin(th) * r), -math.deg(th) +end +do + local segLen = 2 * math.pi * GAUGE_R * (GAUGE_DEG / 360) / GAUGE_N + for _, layer in ipairs({ { 46, 4, BLACK }, { 34, 1 } }) do -- чёрная обводка, потом цветные секции + for i = 0, GAUGE_N - 1 do + local v = (i + 0.5) / GAUGE_N + local pos, rot = arcPoint(v, GAUGE_R) + local color = layer[3] + or ((v < 0.12 or v > 0.94) and C.red) + or (inPerfect(v) and Color3.fromRGB(110, 235, 60)) + or Color3.fromRGB(40, 70, 95) + new("Frame", { + Size = UDim2.fromOffset(layer[1], segLen + layer[2]), AnchorPoint = Vector2.new(0.5, 0.5), + Position = UDim2.fromOffset(pos.X, pos.Y), Rotation = rot, BorderSizePixel = 0, + BackgroundColor3 = color, Parent = gauge, + }) + end + end +end +local needle = new("Frame", { + Size = UDim2.fromOffset(64, 8), AnchorPoint = Vector2.new(0.5, 0.5), BackgroundColor3 = WHITE, + BorderSizePixel = 0, ZIndex = 3, Parent = gauge, +}, { corner(4), stroke(BLACK, 2) }) +local multLabel = text({ + Size = UDim2.fromOffset(110, 40), AnchorPoint = Vector2.new(0.5, 1), Font = TITLE, TextSize = 34, + Text = "×" .. Config.CastPerfectLuck, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 4, + Visible = false, Parent = gauge, +}) +new("UIStroke", { Color = BLACK, Thickness = 3, Parent = multLabel }) +do + local top = arcPoint(1, GAUGE_R) + multLabel.Position = UDim2.fromOffset(top.X + 10, top.Y - 18) +end + +local function updateCharge() + local p = chargePower() + local pos, rot = arcPoint(p, GAUGE_R) + needle.Position = UDim2.fromOffset(pos.X, pos.Y) + needle.Rotation = rot + local good = inPerfect(p) + multLabel.Visible = good + needle.BackgroundColor3 = good and Color3.fromRGB(190, 255, 150) or WHITE + if charge.tool and charge.tool.Parent then + charge.tool.Grip = gripCF(REST_ANGLE + (BACK_ANGLE - REST_ANGLE) * easeOut(p)) + end +end + +---------------------------------------------------------------- камера при забросе +-- зарядка: камера уходит в сторону от персонажа и отъезжает тем дальше, чем сильнее замах; +-- бросок: камера сбоку разгоняется за поплавком; потом сверху-сбоку держит в кадре игрока и поплавок + +local CAM_IN, CAM_SETTLE, CAM_RETURN = 0.35, 0.8, 0.6 +local UP = Vector3.new(0, 1, 0) +local fishCam = nil + +local function sideCF(fc, p) + return CFrame.lookAt(fc.hrp + fc.r * (9 + 3 * p) - fc.f * (3 + 2 * p) + UP * (3 + 1.5 * p), fc.hrp + fc.f * 6 + UP) +end +local function chaseCF(fc, p) + return CFrame.lookAt(p + fc.r * 9 - fc.f * 5 + UP * 3, p + fc.f * 3) +end +local function restCF(fc) + local d = ((fc.target - fc.hrp) * Vector3.new(1, 0, 1)).Magnitude + local mid = fc.hrp:Lerp(fc.target, 0.5) + return CFrame.lookAt(mid + fc.r * (8 + d * 0.55) - fc.f * 4 + UP * (6 + d * 0.25), fc.hrp:Lerp(fc.target, 0.6)) +end + +local function fishCamStep() + local fc = fishCam + local cam = workspace.CurrentCamera + if not fc or not cam then + return + end + if fc.returning then + local a = math.min(1, (os.clock() - fc.returning) / CAM_RETURN) + local e = easeInOut(a) + cam.CFrame = fc.leaveCF:Lerp(fc.origCF, e) + cam.FieldOfView = fc.leaveFov + (fc.origFov - fc.leaveFov) * e + if a >= 1 then + RunService:UnbindFromRenderStep("FishCam") + cam.CameraType = Enum.CameraType.Custom + fishCam = nil + end + return + end + local now = os.clock() + local cf, fov + if not fc.castT0 then + -- зарядка: плавно уходим в вид сбоку; чем сильнее замах, тем дальше камера и шире обзор + -- после отпускания ЛКМ, пока ждём ответ сервера, держим набранную силу + local p = charge and chargePower() or (fc.power or 0) + fc.power = p + local e = easeOut(math.min(1, (now - fc.t0) / CAM_IN)) + cf = fc.origCF:Lerp(sideCF(fc, p), e) + fov = fc.origFov + 12 * p * e + else + local th = fc.throw + local t = now - fc.castT0 + local lunge = fc.fromCF + fc.f * 1.5 + if t < th.windup then + -- рывок удочки вперёд: камера подаётся следом + local e = easeOut(t / th.windup) + cf = fc.fromCF:Lerp(lunge, e) + fov = fc.fromFov + 4 * e + elseif t < th.windup + th.flight then + if not fc.start then + fc.start = (fc.tip and fc.tip.Parent and fc.tip.WorldPosition) or (fc.hrp + fc.f * 2 + UP * 4) + end + local a = (t - th.windup) / th.flight + local p = fc.start:Lerp(fc.target, a) + UP * (math.sin(a * math.pi) * th.arc) -- та же дуга, что у поплавка + local e = easeInOut(a) + cf = lunge:Lerp(chaseCF(fc, p), e) + fov = (fc.fromFov + 4) + ((fc.origFov - 6) - (fc.fromFov + 4)) * e + else + local e = easeOut(math.min(1, (t - th.windup - th.flight) / CAM_SETTLE)) + local sway = Vector3.new(math.sin(now * 0.7) * 0.5, math.sin(now * 1.1) * 0.25, 0) + if state == "bite" then + sway += Vector3.new(math.random() - 0.5, math.random() - 0.5, 0) * 0.15 + end + cf = chaseCF(fc, fc.target):Lerp(restCF(fc) + sway, e) + fov = fc.origFov - 6 + 6 * e + end + end + cam.CFrame = cf + cam.FieldOfView = fov +end + +-- начало зарядки: dir — куда полетит поплавок (к центру озера) +local function startChargeCam(tool, dir) + local cam = workspace.CurrentCamera + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if not cam or not hrp then + return + end + fishCam = { + t0 = os.clock(), hrp = hrp.Position, f = dir, r = dir:Cross(UP), + tip = tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip"), + -- если камера ещё возвращалась с прошлого заброса, возвращаться будем туда же + origCF = fishCam and fishCam.origCF or cam.CFrame, + origFov = fishCam and fishCam.origFov or cam.FieldOfView, + } + cam.CameraType = Enum.CameraType.Scriptable + RunService:UnbindFromRenderStep("FishCam") + RunService:BindToRenderStep("FishCam", Enum.RenderPriority.Camera.Value + 1, fishCamStep) +end + +-- сервер принял бросок: target — куда упадёт поплавок, throw — тайминги и высота дуги +local function startCastCam(target, throw) + local cam = workspace.CurrentCamera + if not fishCam or fishCam.returning or not cam or typeof(target) ~= "Vector3" or type(throw) ~= "table" then + return + end + fishCam.castT0 = os.clock() + fishCam.target = target + fishCam.throw = throw + fishCam.fromCF = cam.CFrame + fishCam.fromFov = cam.FieldOfView +end + +local function stopFishCam() + local cam = workspace.CurrentCamera + if not fishCam or fishCam.returning or not cam then + return + end + fishCam.returning = os.clock() + fishCam.leaveCF = cam.CFrame + fishCam.leaveFov = cam.FieldOfView +end + +local reelToken local function setState(s) + if s ~= "charging" and charge then + -- зарядку прервали (убрал удочку и т.п.): удочку обратно в покой + if charge.tool.Parent then + charge.tool.Grip = gripCF(REST_ANGLE) + end + charge = nil + end state = s statusLabel.Visible = (s == "waiting") mgFrame.Visible = (s == "bite") + gauge.Visible = (s == "charging") + setMovementLocked(s ~= "idle") + if s == "idle" then + stopFishCam() + elseif s == "reeling" then + -- на случай, если сервер не ответит на вытаскивание: не оставляем игрока замороженным + local token = {} + reelToken = token + task.delay(4, function() + if state == "reeling" and reelToken == token then + setState("idle") + end + end) + end end local function updatePips() pipsText.Text = "🎯 " .. string.rep("●", mg.hits) .. string.rep("●", mg.need - mg.hits) @@ -1065,11 +1389,45 @@ local function placeZone() zoneF.Position = UDim2.fromScale(mg.zoneStart, 0) end +-- ЛКМ зажата: персонаж разворачивается к центру озера, начинается зарядка +local function startCharge(tool) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if not hrp then + return + end + local world = Config.WorldAt(hrp.Position) + -- из воды и издалека не заряжаем вовсе: сразу подсказка + local can = Config.CanCastFrom(world, hrp.Position, player.Character:FindFirstChildOfClass("Humanoid")) + if can ~= true then + notify(can, Color3.fromRGB(255, 200, 120)) + return + end + local dir = Config.CastDirection(world, hrp.Position) + if not dir then + dir = hrp.CFrame.LookVector * Vector3.new(1, 0, 1) + dir = dir.Magnitude > 0.01 and dir.Unit or Vector3.new(0, 0, -1) + end + hrp.CFrame = CFrame.lookAt(hrp.Position, hrp.Position + dir) + charge = { t0 = os.clock(), tool = tool } + setState("charging") + startChargeCam(tool, dir) + updateCharge() +end + +-- ЛКМ отпущена: бросок с набранной силой +local function releaseCast() + if state ~= "charging" or not charge then + return + end + local power = chargePower() + castTool = charge.tool + charge = nil -- удочку не возвращаем: сервер сам сделает рывок вперёд + setState("casting") + remote:FireServer("Cast", power) +end + local function onActivate() - if state == "idle" then - setState("casting") - remote:FireServer("Cast") - elseif state == "waiting" then + if state == "waiting" then remote:FireServer("Cancel") setState("idle") elseif state == "bite" then @@ -1103,7 +1461,14 @@ local function hookTool(tool) return end hooked[tool] = true - tool.Activated:Connect(onActivate) + tool.Activated:Connect(function() + if state == "idle" then + startCharge(tool) + else + onActivate() + end + end) + tool.Deactivated:Connect(releaseCast) tool.Unequipped:Connect(function() if state == "waiting" or state == "bite" or state == "casting" then remote:FireServer("Cancel") @@ -1133,6 +1498,12 @@ if player.Character then watch(player.Character) end +RunService.RenderStepped:Connect(function() + if state == "charging" and charge then + updateCharge() + end +end) + RunService.RenderStepped:Connect(function(dt) if state ~= "bite" then return @@ -1182,33 +1553,237 @@ local snow = new("ParticleEmitter", { }) local lastWorldId = "none" local terrain = workspace.Terrain -local defaultWater = Color3.fromRGB(20, 95, 115) -local function applyAmbience(world) +-- то, что мир может поменять под себя (оттенок, цвета травы и песка); вода не трогается — она из свойств Terrain +local DEFAULT_LOOK = { tint = Color3.new(1, 1, 1) } +local defaultTerrainColors = nil + +-- world.look: свет и эффекты мира; при выходе свойства возвращаются к тем, что были до первого входа +local lookTargets = { + lighting = function() return Lighting end, + atmosphere = function() return Lighting:FindFirstChildOfClass("Atmosphere") end, + color = function() return Lighting:FindFirstChildOfClass("ColorCorrectionEffect") end, + bloom = function() return Lighting:FindFirstChildOfClass("BloomEffect") end, + sunRays = function() return Lighting:FindFirstChildOfClass("SunRaysEffect") end, + dof = function() + return Lighting:FindFirstChildOfClass("DepthOfFieldEffect") + or new("DepthOfFieldEffect", { Enabled = false, Parent = Lighting }) + end, + grading = function() return Lighting:FindFirstChildOfClass("ColorGradingEffect") end, +} +local lookDefaults = {} +-- лобби настраивается так же, как миры +local lookSources = table.clone(Config.Worlds) +table.insert(lookSources, Config.Lobby) + +-- смена света: плавно или сразу (за экраном загрузки) +local lookTweens = {} +local function setLook(obj, goal, instant) + if instant then + for prop, v in pairs(goal) do + obj[prop] = v + end + else + local tw = TweenService:Create(obj, TweenInfo.new(2), goal) + table.insert(lookTweens, tw) + tw:Play() + end +end + +local function applyLook(world, instant) + -- исходные значения запоминаем до первой правки; эффект мог ещё не прийти с сервера, тогда в следующий раз + for _, w in ipairs(lookSources) do + for section, props in pairs(w.look or {}) do + local obj = lookTargets[section] and lookTargets[section]() + if obj then + lookDefaults[section] = lookDefaults[section] or {} + for prop in pairs(props) do + if lookDefaults[section][prop] == nil then + lookDefaults[section][prop] = obj[prop] + end + end + end + end + end + local look = (world and world.look) or {} + for section, defaults in pairs(lookDefaults) do + local obj = lookTargets[section]() + if obj then + local goal = {} + for prop, def in pairs(defaults) do + local v = look[section] and look[section][prop] + if v == nil then v = def end + -- плавно меняются только числа и цвета; флаги и режимы (EnumItem) ставим сразу + local kind = typeof(v) + if kind == "number" or kind == "Color3" then goal[prop] = v else obj[prop] = v end + end + setLook(obj, goal, instant) + end + end +end + +local function applyAmbience(world, instant) + -- прошлая плавная смена ещё может идти — она перебила бы новые значения + for _, tw in ipairs(lookTweens) do + tw:Cancel() + end + table.clear(lookTweens) + world = world or Config.Lobby 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 + setLook(Lighting, { ClockTime = clock }, instant) + local cc = Lighting:FindFirstChildOfClass("ColorCorrectionEffect") + if cc then + setLook(cc, { TintColor = (world and world.tint) or DEFAULT_LOOK.tint }, instant) + end + -- цвета материалов террейна общие для всей карты, поэтому меняем их только у себя и возвращаем при выходе + if not defaultTerrainColors then + defaultTerrainColors = {} + for _, name in ipairs({ "Snow", "Salt", "Mud", "Sand", "Rock", "Slate", "Grass", "Ground" }) do + defaultTerrainColors[name] = terrain:GetMaterialColor(Enum.Material[name]) + end + end + local colors = (world and world.terrainColors) or {} + for name, def in pairs(defaultTerrainColors) do + terrain:SetMaterialColor(Enum.Material[name], colors[name] or def) + end local atm = Lighting:FindFirstChildOfClass("Atmosphere") if atm then local frost = world and world.id == "World3" - TweenService:Create(atm, TweenInfo.new(2), { + setLook(atm, { Density = frost and 0.38 or 0.25, Color = frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232), - }):Play() + }, instant) end + applyLook(world, instant) snow.Rate = (world and world.id == "World3") and 140 or 0 end +-- тёмные силуэты рыб под прозрачной водой «Тихого озера», медленно плавают по кругу (только у этого игрока) +do + local w1 = Config.Worlds[1] + local fishList = Config.Zones.World1.fish + local frng = Random.new(11) + local folder = new("Folder", { Name = "FishShadows", Parent = workspace }) + local swimmers = {} + for i = 1, 10 do + local l = w1.lakes[(i - 1) % #w1.lakes + 1] + local ok, model = pcall(Models.buildFish, fishList[(i - 1) % #fishList + 1].id, nil, frng:NextNumber(1.3, 2), true) + if ok and model then + for _, d in ipairs(model:GetDescendants()) do + if d:IsA("BasePart") then + d.Color = Color3.fromRGB(22, 70, 74) + d.Material = Enum.Material.SmoothPlastic + d.Transparency = 0.5 + d.CanCollide, d.CanQuery, d.CanTouch, d.CastShadow = false, false, false, false + elseif d:IsA("Decal") or d:IsA("ParticleEmitter") or d:IsA("Light") then + d:Destroy() + end + end + model.Parent = folder + table.insert(swimmers, { + model = model, + c = w1.center + Vector3.new(l[1] + frng:NextNumber(-l[3], l[3]) * 0.25, w1.waterY - frng:NextNumber(1.4, 2.4), l[2] + frng:NextNumber(-l[3], l[3]) * 0.25), + r = l[3] * frng:NextNumber(0.25, 0.55), a = frng:NextNumber(0, math.pi * 2), + w = frng:NextNumber(0.08, 0.18) * (frng:NextNumber() < 0.5 and -1 or 1), + }) + end + end + local acc = 0 + RunService.Heartbeat:Connect(function(dt) + acc += dt + if acc < 1 / 30 then + return + end + local step = acc + acc = 0 + local w = currentWorld() + if not (w and w.id == "World1") then + return + end + for _, s in ipairs(swimmers) do + s.a += s.w * step + local pos = s.c + Vector3.new(math.cos(s.a) * s.r, math.sin(s.a * 3) * 0.2, math.sin(s.a) * s.r) + local dir = Vector3.new(-math.sin(s.a), 0, math.cos(s.a)) * math.sign(s.w) + -- голова рыбы смотрит в +X модели, поэтому разворачиваем на 90° + s.model:PivotTo(CFrame.lookAt(pos, pos + dir) * CFrame.Angles(0, math.rad(90), 0)) + end + end) +end + +-- экран загрузки (ReplicatedFirst/Loading): при входе и телепорте свет локации ставится, пока он закрывает картинку +local loadingGui = player:WaitForChild("PlayerGui"):WaitForChild("LoadingScreen", 10) +local function loadingVisible() + return loadingGui ~= nil and loadingGui.Enabled +end + +local function placeTitle(w) + return w and (w.icon .. " " .. w.name) or "🏠 Лобби" +end + +local function enterWorld(w, instant) + lastWorldId = w and w.id or "lobby" + applyAmbience(w, instant) + if w then + -- название локации — когда экран загрузки уже ушёл + task.spawn(function() + while loadingVisible() do + task.wait(0.1) + end + notify(w.icon .. " " .. w.name, w.color) + end) + end +end + +-- первое появление: ждём персонажа, ставим свет его локации сразу и отпускаем экран загрузки +task.spawn(function() + local char = player.Character or player.CharacterAdded:Wait() + char:WaitForChild("HumanoidRootPart", 30) + local w = currentWorld() + enterWorld(w, true) + if loadingGui then + loadingGui:SetAttribute("Title", placeTitle(w)) + loadingGui:SetAttribute("Ready", true) + end +end) + +-- телепорт: экран загрузки закрывает картинку, сервер переносит персонажа, свет новой локации ставится сразу +local teleportToken = 0 +local function teleportLoading(targetId, delay) + teleportToken += 1 + local token = teleportToken + local target = Config.Find(Config.Worlds, targetId) + if loadingGui then + local now = os.clock() + loadingGui:SetAttribute("Ready", false) + loadingGui:SetAttribute("StartAt", now) + loadingGui:SetAttribute("MinUntil", now + Config.Loading.teleport) + loadingGui:SetAttribute("Title", placeTitle(target)) + loadingGui:SetAttribute("Visible", true) + end + task.spawn(function() + -- ждём, пока персонаж окажется в новой локации (или сдаёмся через пару секунд) + local deadline = os.clock() + delay + 3 + local w + repeat + task.wait() + w = currentWorld() + until (w and w.id or "Lobby") == targetId or os.clock() > deadline or token ~= teleportToken + if token ~= teleportToken then + return + end + enterWorld(w, true) + if loadingGui then + loadingGui:SetAttribute("Ready", true) + end + end) +end + task.spawn(function() while true do local w = currentWorld() local id = w and w.id or "lobby" - if id ~= lastWorldId then - lastWorldId = id - applyAmbience(w) - if w then - notify(w.icon .. " " .. w.name, w.color) - end + if id ~= lastWorldId and lastWorldId ~= "none" and not loadingVisible() then + enterWorld(w, false) -- без телепорта (например, после возрождения): плавно end local cam = workspace.CurrentCamera if cam then @@ -1228,14 +1803,741 @@ task.spawn(function() end end) +---------------------------------------------------------------- обучение: линия-подсказка +-- белые «стрелки» бегут по земле от игрока к цели текущего шага (см. Config.TutorialDone) + +local GUIDE_N, GUIDE_GAP, GUIDE_SPEED = 32, 3, 7 -- сколько стрелок, шаг между ними, скорость бега +local guideStep = 0 -- шаг, отправленный на сервер (атрибут Tutorial может прийти чуть позже) + +-- крупная мультяшная подсказка под уведомлениями: покачивается, при смене шага «выпрыгивает» +local guideHint, guideHintText = softPlate( + { Size = UDim2.fromOffset(0, 70), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 10), Visible = false, Parent = gui }, + { TextSize = 42, Text = "" } +) +wobble(guideHint, 1.2, 1.6) +local lastHint = nil + +local guideFolder = new("Folder", { Name = "TutorialGuide", Parent = workspace }) +local chevrons = {} +for i = 1, GUIDE_N do + local arms = {} + for k = 1, 2 do + arms[k] = new("Part", { + Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false, CastShadow = false, + Material = Enum.Material.Neon, Color = Color3.fromRGB(70, 195, 255), Size = Vector3.new(0.5, 0.5, 2), Transparency = 1, + Parent = guideFolder, + }) + end + chevrons[i] = arms +end +-- два объёмных бруска стрелки «>» острием вперёд (по -Z) +local GUIDE_HEIGHT = 2.2 -- стрелки висят в воздухе над землёй +local ARM_CF = {} +for k, s in ipairs({ -1, 1 }) do + local center = Vector3.new(s * 0.65, 0, -0.15) + ARM_CF[k] = CFrame.lookAt(center, center + Vector3.new(s * 1.3, 0, 1.5)) +end +local function hideChevrons(from) + for i = from, GUIDE_N do + chevrons[i][1].Transparency = 1 + chevrons[i][2].Transparency = 1 + end +end + +local guideRay = RaycastParams.new() +guideRay.FilterType = Enum.RaycastFilterType.Exclude +guideRay.RespectCanCollide = true +guideRay.IgnoreWater = false + +local function tutorialStep() + return math.max(player:GetAttribute("Tutorial") or 0, guideStep) +end +local function advanceTutorial(step) + if step > tutorialStep() then + guideStep = step + remote:FireServer("Tutorial", step) + if step >= Config.TutorialDone then + notify("🎓 Обучение пройдено!", C.gold) + end + end +end + +local function guideMarker(name) + local map = workspace:FindFirstChild("FishingMap") + local m = map and map:FindFirstChild(name, true) -- маркеры могут лежать в папках уровня (World1Map) + return m and m.Position +end + +-- объект цели обводится мягким светящимся контуром (атрибут GuideTarget ставит MapBuilder); +-- Occluded: то, что стоит перед объектом (персонаж на мостике), не перекрашивается +local guideHighlight = new("Highlight", { + FillColor = Color3.fromRGB(150, 225, 255), OutlineColor = Color3.fromRGB(190, 240, 255), + DepthMode = Enum.HighlightDepthMode.Occluded, Enabled = false, Parent = guideFolder, +}) +local guideObjects, guideScanAt = {}, {} +local function guideObject(key) + local obj = guideObjects[key] + if obj and obj.Parent then + return obj + end + -- карта большая: если объекта нет (ещё не загрузился), ищем заново не чаще раза в 2 секунды + if guideScanAt[key] and os.clock() - guideScanAt[key] < 2 then + return nil + end + guideScanAt[key] = os.clock() + local map = workspace:FindFirstChild("FishingMap") + if not map then + return nil + end + for _, d in ipairs(map:GetDescendants()) do + if d:GetAttribute("GuideTarget") == key then + guideObjects[key] = d + return d + end + end + return nil +end + +-- первый подход к табличке: камера крупно на табличку, управление и весь интерфейс убраны; +-- кнопка «Далее» плавно возвращает камеру, интерфейс и управление +local StarterGui = game:GetService("StarterGui") +local BOARD_CAM_TIME, BOARD_FOV = 0.8, 70 +local boardView = nil +local closeBoardView +-- кнопка в отдельном ScreenGui: основной интерфейс на это время выключается целиком +local boardGui = new("ScreenGui", { Name = "BoardView", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 50, Enabled = false, Parent = player:WaitForChild("PlayerGui") }) +btn({ + Size = UDim2.fromOffset(240, 60), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -40), + BackgroundColor3 = C.green, Text = "Далее ▶", TextSize = 26, Parent = boardGui, +}, function() + closeBoardView() +end) + +local function setInterfaceHidden(hidden) + gui.Enabled = not hidden + boardGui.Enabled = hidden + pcall(function() + StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, not hidden) + end) + -- надписи над объектами (порталы, лавки) тоже прячем, потом возвращаем как было + if hidden then + boardView.billboards = {} + local map = workspace:FindFirstChild("FishingMap") + for _, d in ipairs(map and map:GetDescendants() or {}) do + if d:IsA("BillboardGui") and d.Enabled then + d.Enabled = false + table.insert(boardView.billboards, d) + end + end + elseif boardView and boardView.billboards then + for _, d in ipairs(boardView.billboards) do + d.Enabled = true + end + boardView.billboards = nil + end +end + +local function boardCamStep() + local bv, cam = boardView, workspace.CurrentCamera + if not bv or not cam then + return + end + local e = easeInOut(math.min(1, (os.clock() - bv.t0) / BOARD_CAM_TIME)) + cam.CFrame = bv.fromCF:Lerp(bv.toCF, e) + cam.FieldOfView = bv.fromFov + (bv.toFov - bv.fromFov) * e + if bv.returning and e >= 1 then + RunService:UnbindFromRenderStep("BoardCam") + cam.CameraType = Enum.CameraType.Custom + setInterfaceHidden(false) + boardView = nil + setMovementLocked(false) + end +end + +local function openBoardView(board) + local cam = workspace.CurrentCamera + -- отходим ровно настолько, чтобы табличка целиком влезла в кадр (по высоте и по ширине) с небольшим запасом + local half = math.tan(math.rad(BOARD_FOV / 2)) + local aspect = cam.ViewportSize.X / math.max(1, cam.ViewportSize.Y) + local dist = math.max((board.Size.Y / 2) / half, (board.Size.X / 2) / (half * aspect)) * 1.15 + boardView = { + t0 = os.clock(), origCF = cam.CFrame, origFov = cam.FieldOfView, + fromCF = cam.CFrame, fromFov = cam.FieldOfView, + -- надписи на лицевой стороне (Front), она смотрит по LookVector + toCF = CFrame.lookAt(board.Position + board.CFrame.LookVector * dist, board.Position), toFov = BOARD_FOV, + } + setMovementLocked(true) + setInterfaceHidden(true) + cam.CameraType = Enum.CameraType.Scriptable + RunService:UnbindFromRenderStep("BoardCam") + RunService:BindToRenderStep("BoardCam", Enum.RenderPriority.Camera.Value + 1, boardCamStep) +end + +closeBoardView = function() + local cam = workspace.CurrentCamera + if not boardView or boardView.returning or not cam then + return + end + boardGui.Enabled = false -- кнопка пропадает сразу, остальной интерфейс — когда камера вернётся + boardView.returning = true + boardView.t0 = os.clock() + boardView.fromCF, boardView.fromFov = cam.CFrame, cam.FieldOfView + boardView.toCF, boardView.toFov = boardView.origCF, boardView.origFov + advanceTutorial(1) +end + +-- скупка «Тихого озера»: ведём к прилавку с подсказкой «Продать» внутри лавки (GuideTarget = "Sell"), +-- поэтому стрелка идёт за лавкой, куда бы её ни переставили; маркер GuideSell — запасной вариант +local function sellTargetW1() + local shop = guideObject("Sell") + if shop then + for _, d in ipairs(shop:GetDescendants()) do + if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then + local p = d.Parent + local at = (p:IsA("BasePart") and p.Position) or (p:IsA("Attachment") and p.WorldPosition) + if at then + return at + end + end + end + return shop:IsA("Model") and shop:GetPivot().Position or shop.Position + end + return guideMarker("GuideSell") +end + +-- маршрут для текущего шага: точки ломаной (без игрока), подсказка и что подсветить; nil — линию не показываем +local function guideRoute(step, pos, world) + local inW1 = world and world.id == "World1" + if step == 0 and not world then + return { guideMarker("GuideBoard") }, "📋 Прочитай табличку", "Board" + elseif not world then -- шаги 1–3 из лобби: сначала в портал + return { guideMarker("GuidePortal") }, "🌊 Иди в портал", "Portal" + elseif step == 2 and inW1 then + return { guideMarker("GuideFishSpot") }, "🎣 Зажми ЛКМ у воды", "Pier" + elseif step == 3 and inW1 then + return { sellTargetW1() }, "💰 Продай рыбу", "Sell" -- лавка у самого причала, идём напрямую + end + return nil +end + +-- ближайшая скупка в этом мире (или в лобби): прилавки с ProximityPrompt Action = "Sell" +local nearestSell +do +local sellSpots, sellScanAt = {}, -math.huge +nearestSell = function(pos, world) + if #sellSpots == 0 and os.clock() - sellScanAt > 3 then + sellScanAt = os.clock() + local map = workspace:FindFirstChild("FishingMap") + for _, d in ipairs(map and map:GetDescendants() or {}) do + if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then + local p = d.Parent + local at = (p:IsA("BasePart") and p.Position) or (p:IsA("Attachment") and p.WorldPosition) or (p:IsA("Model") and p:GetPivot().Position) + if at then + table.insert(sellSpots, at) + end + end + end + end + local best, bestD = nil, nil + for _, at in ipairs(sellSpots) do + if Config.WorldAt(at) == world then + local d = (at - pos).Magnitude + if not bestD or d < bestD then + best, bestD = at, d + end + end + end + return best +end +end + +RunService.RenderStepped:Connect(function() + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + local step = tutorialStep() + -- пока сервер не прислал шаг (данные ещё грузятся), обучение не показываем; + -- после обучения линия ведёт к скупщику, когда сумка полна + local tutorialOn = player:GetAttribute("Tutorial") ~= nil and step < Config.TutorialDone + local bagFull = (player:GetAttribute("BagCount") or 0) >= (player:GetAttribute("BagCap") or math.huge) + if not hrp or not (tutorialOn or bagFull) then + guideHint.Visible = false + guideHighlight.Enabled = false + hideChevrons(1) + return + end + if boardView then -- смотрим на табличку: ни линии, ни подсказок + guideHint.Visible = false + guideHighlight.Enabled = false + hideChevrons(1) + return + end + local pos = hrp.Position + local world = Config.WorldAt(pos) + + -- переходы между шагами + if not tutorialOn then + -- обучение пройдено, остаётся только дорога к скупщику + elseif step <= 1 and world and world.id == "World1" then + advanceTutorial(2) + elseif step == 0 then + local board = guideMarker("GuideBoard") + if board and (board - pos).Magnitude < 9 and state == "idle" then + local obj = guideObject("Board") + if obj then + openBoardView(obj) -- шаг засчитается по кнопке «Далее» + return + end + advanceTutorial(1) + end + elseif step == 2 and (player:GetAttribute("TotalCaught") or 0) > 0 then + advanceTutorial(3) + end + step = tutorialStep() + + local route, hint, key + if tutorialOn then + route, hint, key = guideRoute(step, pos, world) + end + if not route and bagFull then + local inW1 = world and world.id == "World1" + local at = (inW1 and sellTargetW1()) or nearestSell(pos, world) + route, hint, key = at and { at } or nil, "🎒 Сумка полна — продай рыбу!", inW1 and "Sell" or nil + end + guideHintText.Text = hint or "" + local showHint = hint ~= nil and state == "idle" + if showHint and (hint ~= lastHint or not guideHint.Visible) then + popIn(guideHint, 0.5) + end + lastHint = hint + guideHint.Visible = showHint + local target = (key and state == "idle") and guideObject(key) or nil + guideHighlight.Adornee = target or nil + guideHighlight.Enabled = target ~= nil + if target then + local pulse = (math.sin(os.clock() * 4) + 1) / 2 -- мягкое мигание + guideHighlight.FillTransparency = 0.86 + 0.1 * pulse -- лёгкое «дыхание», цвет объекта виден + guideHighlight.OutlineTransparency = 0.1 + 0.45 * pulse + end + if not route or #route == 0 or state ~= "idle" then + hideChevrons(1) + return + end + + -- ломаная от ног игрока через точки маршрута + local pts = { pos - Vector3.new(0, 3, 0) } + for _, p in ipairs(route) do + table.insert(pts, p) + end + local lens, total = {}, 0 + for i = 2, #pts do + local d = ((pts[i] - pts[i - 1]) * Vector3.new(1, 0, 1)).Magnitude + lens[i] = math.max(d, 0.001) + total += d + end + if total < 4 then + hideChevrons(1) -- уже на месте + return + end + + guideRay.FilterDescendantsInstances = { player.Character, guideFolder } + local phase = (os.clock() * GUIDE_SPEED) % GUIDE_GAP + local seg, segStart = 2, 0 + for i = 1, GUIDE_N do + local d = 2 + phase + (i - 1) * GUIDE_GAP + if d > total - 1 then + hideChevrons(i) + break + end + while seg < #pts and d > segStart + lens[seg] do + segStart += lens[seg] + seg += 1 + end + local a, b = pts[seg - 1], pts[seg] + local p = a:Lerp(b, (d - segStart) / lens[seg]) + local dir = (b - a) * Vector3.new(1, 0, 1) + local hit = workspace:Raycast(p + Vector3.new(0, 4, 0), Vector3.new(0, -12, 0), guideRay) + -- висят в воздухе и слегка покачиваются волной + local y = (hit and hit.Position.Y or p.Y) + GUIDE_HEIGHT + math.sin(os.clock() * 4 - d * 0.5) * 0.25 + local base = CFrame.lookAt(Vector3.new(p.X, y, p.Z), Vector3.new(p.X, y, p.Z) + dir) + -- у игрока и у цели стрелки плавно проявляются и гаснут + local fade = math.max(0, 1 - math.min(d - 2, total - 1 - d) / 2.5) + local tr = 0.05 + 0.95 * fade + for k = 1, 2 do + chevrons[i][k].CFrame = base * ARM_CF[k] + chevrons[i][k].Transparency = tr + end + end +end) + +---------------------------------------------------------------- цели на экране: серия, трекер, босс, покупка у скупщика +-- в отдельной функции: у основного скрипта почти исчерпан лимит в 200 локальных переменных + +local refreshTracker, bestOffer, showOffer +local offerState = { bagWasFull = false } -- была ли сумка полной перед продажей (тогда первым предлагаем сумку побольше) +;(function() +local CENTER = Enum.TextXAlignment.Center +local RIGHT = Enum.TextXAlignment.Right +local FIRE = Color3.fromRGB(255, 150, 60) + +-- серия улова — справа от HUD; полоска показывает, сколько осталось до того, как серия сгорит +local comboBox = new("Frame", { + Size = UDim2.fromOffset(140, 66), Position = UDim2.fromOffset(310, 10), BackgroundColor3 = WHITE, Visible = false, Parent = gui, +}, { corner(14), stroke(FIRE, 2, 0.1), gradient(Color3.fromRGB(110, 50, 20), C.bg, 90) }) +local comboMultText = text({ Size = UDim2.new(1, 0, 0, 34), Position = UDim2.fromOffset(0, 3), Font = TITLE, TextSize = 28, TextXAlignment = CENTER, TextColor3 = Color3.fromRGB(255, 195, 95), TextStrokeTransparency = 0.5, Text = "", Parent = comboBox }) +local comboSub = text({ Size = UDim2.new(1, 0, 0, 16), Position = UDim2.fromOffset(0, 36), Font = BODY2, TextSize = 12, TextXAlignment = CENTER, TextColor3 = C.muted, Text = "", Parent = comboBox }) +local comboBack = new("Frame", { Size = UDim2.new(1, -20, 0, 5), Position = UDim2.new(0, 10, 1, -10), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = comboBox }, { corner(3) }) +local comboFill = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = FIRE, BorderSizePixel = 0, Parent = comboBack }, { corner(3) }) + +local function refreshCombo(pop) + local n = player:GetAttribute("Combo") or 0 + comboBox.Visible = n > 0 + if n > 0 then + -- множитель следующей рыбы (сервер считает так же) + comboMultText.Text = ("🔥 x%.1f"):format(math.min(Config.Combo.max, 1 + Config.Combo.step * n)) + comboSub.Text = ("серия %d · не упусти!"):format(n) + if pop then + popIn(comboBox, 0.6) + end + end +end +player:GetAttributeChangedSignal("Combo"):Connect(function() + refreshCombo(true) +end) +refreshCombo(false) + +-- правая колонка: босс и цели +local rightCol = new("Frame", { + Size = UDim2.fromOffset(300, 0), AutomaticSize = Enum.AutomaticSize.Y, AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 10), + BackgroundTransparency = 1, Parent = gui, +}, { new("UIListLayout", { Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + +local bossBox = new("Frame", { Size = UDim2.fromOffset(300, 78), BackgroundColor3 = WHITE, Visible = false, LayoutOrder = 1, Parent = rightCol }, + { corner(14), stroke(C.red, 2.5, 0.05), gradient(Color3.fromRGB(110, 30, 40), C.bg, 90) }) +local bossTitle = text({ Size = UDim2.new(1, -80, 0, 24), Position = UDim2.fromOffset(12, 5), Font = TITLE, TextSize = 18, TextColor3 = Color3.fromRGB(255, 205, 120), TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = bossBox }) +local bossTime = text({ Size = UDim2.fromOffset(60, 24), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 5), Font = TITLE, TextSize = 17, TextXAlignment = RIGHT, Text = "", Parent = bossBox }) +local bossBack = new("Frame", { Size = UDim2.new(1, -24, 0, 18), Position = UDim2.fromOffset(12, 32), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = bossBox }, { corner(9) }) +local bossFill = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = WHITE, Parent = bossBack }, { corner(9), gradient(Color3.fromRGB(255, 120, 90), Color3.fromRGB(190, 30, 50), 0) }) +local bossHpText = text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = CENTER, ZIndex = 2, TextStrokeTransparency = 0.5, Text = "", Parent = bossBack }) +local bossHint = text({ Size = UDim2.new(1, -24, 0, 18), Position = UDim2.fromOffset(12, 54), Font = BODY2, TextSize = 12, TextColor3 = C.muted, Text = "", Parent = bossBox }) + +local tracker = new("Frame", { Size = UDim2.fromOffset(300, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundColor3 = WHITE, LayoutOrder = 2, Parent = rightCol }, { + corner(14), stroke(C.line, 2, 0.35), gradient(C.panel2, C.bg, 90), + new("UIPadding", { PaddingLeft = UDim.new(0, 12), PaddingRight = UDim.new(0, 12), PaddingTop = UDim.new(0, 8), PaddingBottom = UDim.new(0, 10) }), + new("UIListLayout", { Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder }), +}) +text({ Size = UDim2.new(1, 0, 0, 20), LayoutOrder = 0, Font = TITLE, TextSize = 16, TextColor3 = C.muted, Text = "🎯 Цели", Parent = tracker }) + +local function trackerLine(order, onClick) + local root = new("TextButton", { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1, AutoButtonColor = false, Text = "", LayoutOrder = order, Parent = tracker }) + local label = text({ Size = UDim2.new(1, 0, 0, 22), Font = BODY, TextSize = 14, RichText = true, TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = root }) + local back = new("Frame", { Size = UDim2.new(1, 0, 0, 8), Position = UDim2.fromOffset(0, 26), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = root }, { corner(4) }) + local fill = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = C.gold, BorderSizePixel = 0, Parent = back }, { corner(4) }) + if onClick then + root.MouseButton1Click:Connect(onClick) + end + return { root = root, label = label, back = back, fill = fill } +end +local function setLine(line, txt, frac, color) + line.root.Visible = txt ~= nil + if not txt then + return + end + line.label.Text = txt + line.back.Visible = frac ~= nil + line.root.Size = UDim2.new(1, 0, 0, frac and 38 or 22) + if frac then + line.fill.Size = UDim2.fromScale(math.clamp(frac, 0, 1), 1) + line.fill.BackgroundColor3 = color or C.gold + end +end + +local questLine = trackerLine(1, function() + questWin.open("quests") +end) +local buyLine = trackerLine(2, function() + shopWin.open("rods") +end) +local dexLine = trackerLine(3, function() + bagWin.open("dex") +end) +local bagLine = trackerLine(4, function() + bagWin.open("fish") +end) + +local function plural(n, one, few, many) + local m10, m100 = n % 10, n % 100 + if m10 == 1 and m100 ~= 11 then + return one + elseif m10 >= 2 and m10 <= 4 and (m100 < 12 or m100 > 14) then + return few + end + return many +end + +-- ближайшая покупка: следующая удочка, а когда все куплены — улучшение текущей +local function buyGoal() + local coins, lvl = player:GetAttribute("Coins") or 0, player:GetAttribute("Level") or 1 + local owned = attrSet("OwnedRods") + for _, r in ipairs(Config.Rods) do + if not owned[r.id] then + if lvl < r.level then + return ("🎣 %s · 🔒 нужен ур. %d"):format(r.name, r.level), lvl / r.level, C.blue + elseif coins >= r.price then + return ("🎣 %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 == "TeleportFade" then + teleportLoading(a, b) elseif action == "Cast" then setState("waiting") + startCastCam(a, b) elseif action == "CastFail" or action == "Cancel" or action == "Escaped" then + if action == "CastFail" and castTool and castTool.Parent then + castTool.Grip = gripCF(REST_ANGLE) -- сервер удочку не трогал, а у нас она в замахе + end setState("idle") elseif action == "Bite" then mg.speed = a.speed @@ -1255,19 +2557,60 @@ remote.OnClientEvent:Connect(function(action, a, b, c) showCatch(a, b) playUiSound(DING, 0.5) elseif action == "Sold" then + if tutorialStep() == 3 then + advanceTutorial(Config.TutorialDone) + end floatText("+" .. fmt(a) .. " 💰", C.gold) - notify(("Продано рыб: %d → +%s 💰"):format(b, fmt(a)), Color3.fromRGB(120, 255, 140)) + 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 new file mode 100644 index 0000000..0c1c6cc --- /dev/null +++ b/install/6_World1Builder_ServerScriptService.rbxmx @@ -0,0 +1,1012 @@ + +World1Builder ServerScriptService +-- Генератор локации «Тихое озеро» (Мир 1). Им ОДИН РАЗ собирают уровень прямо в Roblox Studio, +-- в режиме редактирования, а дальше уровень правится руками как обычные детали и модели. +-- Команда для Command Bar (строка внизу Studio): +-- require(game.ServerScriptService.World1Builder:Clone()).bake() +-- bake() стирает старую папку Workspace.World1Map и террейн этого мира и строит всё заново. +-- Обычно уровень собирается вместе со всей картой: WorldBuilder.bake() (см. README). +-- Если папки World1Map в плейсе нет, WorldBuilder строит уровень этим же модулем. +-- +-- Что нужно игре от уровня (не удаляйте и не переименовывайте): +-- маркеры World1Spawn, GuideFishSpot, GuideSell, World1NpcSeller, World1NpcGrandpa — невидимые +-- плитки; их можно двигать, NPC и точка появления встанут туда при запуске; +-- атрибут GuideTarget = "Pier" (модель MainDock) и "Sell" (модель BaitShop) — подсветка в обучении; +-- ProximityPrompt с атрибутом Action = "Sell" на прилавке и портал «В лобби» (Action = "Portal"); +-- деталь World1Bestiary — доска «Кто водится в озере», текст на неё пишет MapBuilder при запуске. +-- Форма воды для заброса берётся из FishConfig (Worlds[1].lakes) — если меняете озеро руками, +-- поправьте там круги, иначе игра будет считать водой старые места. + +local Workspace = game:GetService("Workspace") +local ReplicatedStorage = game:GetService("ReplicatedStorage") + +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) + +local V = Vector3.new +local terrain = Workspace.Terrain +local W1 = Config.Worlds[1] +local W = W1.center -- центр Мира 1 +local GROUND_Y = 4 -- верх земли +local WATER_Y = W1.waterY -- поверхность воды +local LAKES = W1.lakes -- озеро из кругов { x, z, радиус } от W + +-- холмы: { x, z, радиус, высота центра шара } — верх холма = высота центра + радиус +local HILLS = { + { -78, -138, 62, -22 }, -- холм с вышкой + { -175, -55, 58, -34 }, { 175, -165, 62, -30 }, { -175, 160, 52, -32 }, + { 180, 130, 48, -30 }, { 10, -225, 60, -34 }, { -60, 175, 45, -28 }, { 95, 190, 40, -26 }, +} +-- тропинка на холм к вышке (точки от W) +local HILL_PATH = { { -22, -76 }, { -40, -92 }, { -28, -106 }, { -52, -114 }, { -44, -127 }, { -66, -131 } } +-- «трава» — материал Snow: у него нет травинок и почти нет рисунка, получается ровная мультяшная +-- поверхность. В зелёный (а дорожки из Salt — в коричневый) его красит клиент только в этом мире. +local GROUND_MAT, PATH_MAT = Enum.Material.Snow, Enum.Material.Salt + +local Builder = {} + +-- вода ниже WATER_Y и воздух над ней прямо по вокселям (Fill* с Air иногда оставляет песок над водой) +function Builder.carveLake(l) + local region = Region3.new(W + V(l[1] - l[3], WATER_Y - 12, l[2] - l[3]), W + V(l[1] + l[3], WATER_Y + 16, l[2] + l[3])):ExpandToGrid(4) + local mats, occ = terrain:ReadVoxels(region, 4) + local size = mats.Size + local corner = region.CFrame.Position - region.Size / 2 + local center = W + V(l[1], 0, l[2]) + for x = 1, size.X do + for y = 1, size.Y do + for z = 1, size.Z do + local c = corner + V(x - 0.5, y - 0.5, z - 0.5) * 4 + if (V(c.X, 0, c.Z) - center).Magnitude <= l[3] then + local water = c.Y < WATER_Y + mats[x][y][z] = water and Enum.Material.Water or Enum.Material.Air + occ[x][y][z] = water and 1 or 0 + end + end + end + end + terrain:WriteVoxels(region, 4, mats, occ) +end + +-- высота земли с учётом холмов: считаем по формуле (лучи по только что залитому террейну ненадёжны) +local function hillY(x, z) + local y = GROUND_Y + for _, h in ipairs(HILLS) do + local d2 = (x - h[1]) ^ 2 + (z - h[2]) ^ 2 + if d2 < h[3] ^ 2 then + y = math.max(y, h[4] + math.sqrt(h[3] ^ 2 - d2)) + end + end + return y +end + +local function inLake(x, z, extra) + for _, l in ipairs(LAKES) do + if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + (extra or 0) then + return true + end + end + return false +end + +---------------------------------------------------------------- террейн +local function buildTerrain() + terrain:FillBlock(CFrame.new(W + V(0, -10, 0)), V(500, 28, 500), GROUND_MAT) + for _, h in ipairs(HILLS) do + terrain:FillBall(W + V(h[1], h[4], h[2]), h[3], GROUND_MAT) + end + -- порядок важен: узкая песчаная кромка → выемка → ил → вода + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -10, l[2])), 28, l[3] + 3, Enum.Material.Sand) + end + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], 11, l[2])), 18, l[3] + 2, Enum.Material.Air) + end + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], 10, l[2])), 20, l[3] + 1, Enum.Material.Air) + end + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -18, l[2])), 12, l[3], Enum.Material.Mud) + end + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -6, l[2])), 12, l[3], Enum.Material.Water) + end + for _, l in ipairs(LAKES) do + Builder.carveLake(l) + end + -- земляные дорожки: меняем материал травы на материал дорожки, объём не меняется + local function dirtPath(points, width) + for i = 2, #points do + local a, b = points[i - 1], points[i] + local len = math.sqrt((b[1] - a[1]) ^ 2 + (b[2] - a[2]) ^ 2) + for s = 0, len, 2 do + local x, z = a[1] + (b[1] - a[1]) * s / len, a[2] + (b[2] - a[2]) * s / len + local half = V(width / 2, 3, width / 2) + local p = W + V(x, hillY(x, z), z) + terrain:ReplaceMaterial(Region3.new(p - half, p + half):ExpandToGrid(4), 4, GROUND_MAT, PATH_MAT) + end + end + end + dirtPath(HILL_PATH, 4) + dirtPath({ { 0, 84 }, { 0, 64 } }, 6) -- площадка у корня причала + dirtPath({ { 8, -84 }, { 8, -100 } }, 4) -- к домику у мостков +end + +---------------------------------------------------------------- детали +-- parent — куда положить папку World1Map (Workspace при сборке в Studio, FishingMap при запуске игры) +-- makePortal — WorldBuilder.portalModel: ставит модель портала из шаблона (без него строится старое кольцо) +function Builder.build(parent, makePortal) + buildTerrain() + + local rng = Random.new(7) + local map = Instance.new("Folder") + map.Name = "World1Map" + + -------------------------------------------------- помощники + local function P(props) + local p = Instance.new("Part") + if props.Shape then + p.Shape = props.Shape + end + p.Anchored = true + p.TopSurface = Enum.SurfaceType.Smooth + p.BottomSurface = Enum.SurfaceType.Smooth + for k, v in pairs(props) do + if k ~= "Parent" and k ~= "Shape" then + p[k] = v + end + end + p.Parent = props.Parent or map + return p + end + local function vcyl(pos, h, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(h, d, d) + props.CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)) + return P(props) + end + local function ball(pos, d, props) + props.Shape = Enum.PartType.Ball + props.Size = V(d, d, d) + props.Position = pos + return P(props) + end + -- цилиндр между двумя точками (брёвна, балки, перила, вёсла) + local function rod(a, b, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(math.max(0.05, (b - a).Magnitude), d, d) + props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0) + return P(props) + end + local function surfaceText(part, face, text, color) + local sg = Instance.new("SurfaceGui") + sg.Face = face + sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud + sg.PixelsPerStud = 40 + sg.LightInfluence = 0 + sg.Parent = part + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = color + t.TextStrokeTransparency = 1 + t.Text = text + t.Parent = sg + end + local function prompt(target, actionText, objectText, action) + local pp = Instance.new("ProximityPrompt") + pp.ActionText = actionText + pp.ObjectText = objectText + pp.HoldDuration = 0 + pp.MaxActivationDistance = 14 + pp.RequiresLineOfSight = false + pp:SetAttribute("Action", action) + pp.Parent = target + return pp + end + local function marker(name, cf) + return P({ Name = name, Size = V(4, 1, 4), CFrame = cf, Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false }) + end + + local COL = { + plank = Color3.fromRGB(196, 140, 88), plankDark = Color3.fromRGB(160, 110, 68), + log = Color3.fromRGB(156, 102, 60), logDark = Color3.fromRGB(105, 70, 44), + rope = Color3.fromRGB(218, 184, 128), roof = Color3.fromRGB(62, 104, 78), stone = Color3.fromRGB(150, 146, 150), + rock = Color3.fromRGB(150, 146, 162), rockDark = Color3.fromRGB(112, 108, 128), moss = Color3.fromRGB(108, 152, 72), + pine = Color3.fromRGB(58, 126, 70), pineDark = Color3.fromRGB(30, 82, 52), + leaf = Color3.fromRGB(110, 170, 64), leafDark = Color3.fromRGB(72, 136, 56), + glow = Color3.fromRGB(255, 200, 120), awnA = Color3.fromRGB(46, 106, 72), awnB = Color3.fromRGB(242, 232, 204), + banner = Color3.fromRGB(40, 92, 62), metal = Color3.fromRGB(48, 44, 42), water = Color3.fromRGB(70, 200, 195), + } + local WOOD, PLANKS, SMOOTH = Enum.Material.Wood, Enum.Material.WoodPlanks, Enum.Material.SmoothPlastic + -- куб, повёрнутый вершиной вверх: три грани сходятся в острый пик (ёлки, горы, обломки скал) + local CUBE_UP = CFrame.Angles(math.rad(-35.264), 0, 0) * CFrame.Angles(0, 0, math.rad(45)) + + -- столб с кронштейном и висящим фонарём; facing — куда смотрит кронштейн + local function postLantern(base, facing, h) + h = h or 8 + local top = base + V(0, h, 0) + vcyl(base + V(0, h / 2, 0), h, 0.8, { Color = COL.logDark, Material = WOOD }) + rod(top - V(0, 0.3, 0), top + facing * 2.4 - V(0, 0.3, 0), 0.35, { Color = COL.logDark, Material = WOOD }) + local hang = top + facing * 2 - V(0, 1.8, 0) + rod(hang + V(0, 0.9, 0), top + facing * 2 - V(0, 0.3, 0), 0.08, { Color = COL.metal, Material = Enum.Material.Metal, CanCollide = false }) + P({ Size = V(1.2, 0.3, 1.2), Position = hang + V(0, 0.85, 0), Color = COL.metal, Material = Enum.Material.Metal, CanCollide = false }) + local glass = P({ Size = V(0.9, 1.3, 0.9), Position = hang, Color = COL.glow, Material = Enum.Material.Neon, CanCollide = false, CastShadow = false }) + P({ Size = V(1.2, 0.3, 1.2), Position = hang - V(0, 0.8, 0), Color = COL.metal, Material = Enum.Material.Metal, CanCollide = false }) + local light = Instance.new("PointLight") + light.Range = 18 + light.Brightness = 1.5 + light.Color = COL.glow + light.Parent = glass + end + + -- low-poly ёлка: ствол и ярусы-«ромбы» (кубы вершиной вверх), к верху меньше + local function pine(pos, h, tiers) + tiers = tiers or 3 + vcyl(pos + V(0, h * 0.15, 0), h * 0.3, math.max(0.8, h * 0.07), { Color = COL.logDark, Material = WOOD, CastShadow = false }) + local shade = rng:NextNumber(0, 0.3) + for i = 0, tiers - 1 do + local t = tiers > 1 and i / (tiers - 1) or 1 + local s = h * (0.42 - 0.22 * t) + P({ + Size = V(s, s, s), + CFrame = CFrame.new(pos + V(0, h * (0.34 + 0.48 * t), 0)) * CFrame.Angles(0, rng:NextNumber(0, 6.28), 0) * CUBE_UP, + Color = COL.pineDark:Lerp(COL.pine, 0.2 + 0.5 * t + shade), Material = SMOOTH, CanCollide = false, + }) + end + end + + -- круглое лиственное дерево + local function leafy(pos, s) + vcyl(pos + V(0, s * 0.4, 0), s * 0.8, s * 0.14, { Color = COL.log, Material = WOOD }) + local c = COL.leafDark:Lerp(COL.leaf, rng:NextNumber(0.3, 1)) + ball(pos + V(0, s * 1.05, 0), s * 0.95, { Color = c, Material = SMOOTH, CanCollide = false }) + ball(pos + V(s * 0.38, s * 0.85, s * 0.1), s * 0.65, { Color = c:Lerp(COL.leaf, 0.3), Material = SMOOTH, CanCollide = false }) + ball(pos + V(-s * 0.35, s * 0.9, -s * 0.2), s * 0.6, { Color = c:Lerp(COL.leafDark, 0.3), Material = SMOOTH, CanCollide = false }) + end + + -- угловатый low-poly камень + local function rock(pos, s, col) + return P({ + Size = V(s, s * rng:NextNumber(0.55, 0.85), s * rng:NextNumber(0.7, 1)), + CFrame = CFrame.new(pos) * CFrame.Angles(rng:NextNumber(-0.4, 0.4), rng:NextNumber(0, 6.28), rng:NextNumber(-0.4, 0.4)), + Color = (col or COL.rock):Lerp(COL.rockDark, rng:NextNumber(0, 0.6)), Material = SMOOTH, + }) + end + -- острый обломок скалы (куб вершиной вверх), наполовину утоплен + local function crag(pos, s) + return P({ + Size = V(s, s, s), + CFrame = CFrame.new(pos) * CFrame.Angles(rng:NextNumber(-0.2, 0.2), rng:NextNumber(0, 6.28), rng:NextNumber(-0.2, 0.2)) * CUBE_UP, + Color = COL.rock:Lerp(COL.rockDark, rng:NextNumber(0, 0.6)), Material = SMOOTH, + }) + end + + -- рогоз: несколько стеблей с коричневыми «початками» и листья + local function cattails(pos) + for _ = 1, rng:NextInteger(3, 6) do + local p = pos + V(rng:NextNumber(-1.3, 1.3), 0, rng:NextNumber(-1.3, 1.3)) + local top = p + V(rng:NextNumber(-0.4, 0.4), rng:NextNumber(3.5, 6), rng:NextNumber(-0.4, 0.4)) + rod(p, top, 0.16, { Color = Color3.fromRGB(96, 140, 62), Material = SMOOTH, CanCollide = false, CastShadow = false }) + local dir = (top - p).Unit + rod(top - dir * 2, top - dir * 0.6, 0.5, { Color = Color3.fromRGB(122, 74, 40), Material = SMOOTH, CanCollide = false, CastShadow = false }) + end + for _ = 1, 3 do + P({ + Size = V(0.35, rng:NextNumber(3, 4.5), 0.08), + CFrame = CFrame.new(pos + V(0, 1.6, 0)) * CFrame.Angles(0, rng:NextNumber(0, 6.28), rng:NextNumber(-0.35, 0.35)), + Color = Color3.fromRGB(110, 160, 70), Material = SMOOTH, CanCollide = false, CastShadow = false, + }) + end + end + + -- круглая свая с намотанным канатом; y0 — низ (под водой), top — верх сваи + local function ropePost(x, z, y0, top, d, parent) + d = d or 1.6 + vcyl(W + V(x, (y0 + top) / 2, z), top - y0, d, { Color = COL.log, Material = WOOD, Parent = parent }) + vcyl(W + V(x, top + 0.1, z), 0.2, d * 0.9, { Color = COL.plankDark, Material = WOOD, Parent = parent }) + for i = 1, 3 do + vcyl(W + V(x, top - 0.5 - i * 0.38, z), 0.3, d + 0.25, { Color = COL.rope, Material = Enum.Material.Fabric, CanCollide = false, Parent = parent }) + end + end + + -- маленькие мостки: доски поперёк и сваи + local function smallDock(x, z0, z1, w, y) + local dir = z1 > z0 and 1 or -1 + for z = z0, z1, dir * 1.6 do + P({ Size = V(w, 0.45, 1.45), Position = W + V(x, y - 0.22, z), Color = COL.plank:Lerp(COL.plankDark, rng:NextNumber(0, 0.6)), Material = PLANKS }) + end + for z = z0 + dir * 2, z1, dir * 6 do + for _, s in ipairs({ -1, 1 }) do + vcyl(W + V(x + s * (w / 2 - 0.3), y - 4, z), 8, 0.8, { Color = COL.logDark, Material = WOOD }) + end + end + end + + -- бревенчатый дом: стены из брёвен, двускатная зелёная крыша, тёплые окна, труба с дымом, крыльцо. + -- cf — центр пола на земле, сторона -Z (LookVector) — фасад с дверью + local function logCabin(name, cf, w, d, wallH) + local house = Instance.new("Model") + house.Name = name + house.Parent = map + local function part(props) + props.Parent = house + return P(props) + end + local LOG = 1.25 + local rows = math.floor(wallH / LOG) + local wallTop = 1 + rows * LOG + local function at(x, y, z) + return (cf * CFrame.new(x, y, z)).Position + end + part({ Size = V(w + 1.5, 1, d + 1.5), CFrame = cf * CFrame.new(0, 0.5, 0), Color = COL.stone, Material = Enum.Material.Slate }) + for r = 0, rows - 1 do + local y = 1 + LOG / 2 + r * LOG + local col = (r % 2 == 0) and COL.log or COL.log:Lerp(COL.logDark, 0.3) + for _, s in ipairs({ -1, 1 }) do + rod(at(-w / 2 - 0.9, y, s * d / 2), at(w / 2 + 0.9, y, s * d / 2), LOG, { Color = col, Material = WOOD, Parent = house }) + rod(at(s * w / 2, y, -d / 2 - 0.9), at(s * w / 2, y, d / 2 + 0.9), LOG, { Color = col, Material = WOOD, Parent = house }) + end + end + -- фронтоны (по бокам) — брёвна всё короче к коньку + local a = math.rad(34) + local rise = (d / 2) * math.tan(a) + for k = 0, math.floor(rise / LOG) - 1 do + local y = wallTop + LOG / 2 + k * LOG + local half = (d / 2) * (1 - (k + 1) * LOG / rise) + if half > 0.6 then + for _, s in ipairs({ -1, 1 }) do + rod(at(s * w / 2, y, -half), at(s * w / 2, y, half), LOG, { Color = COL.log:Lerp(COL.logDark, 0.15), Material = WOOD, Parent = house }) + end + end + end + -- крыша: два ската, конёк вдоль X + local run = d / 2 + 1.6 + for _, s in ipairs({ -1, 1 }) do + part({ Size = V(w + 3, 0.7, run / math.cos(a)), CFrame = cf * CFrame.new(0, wallTop + run * math.tan(a) / 2 + 0.35, s * run / 2) * CFrame.Angles(s * a, 0, 0), Color = COL.roof, Material = SMOOTH }) + end + part({ Size = V(w + 3.2, 0.6, 0.9), CFrame = cf * CFrame.new(0, wallTop + run * math.tan(a) + 0.2, 0), Color = COL.roof:Lerp(Color3.new(0, 0, 0), 0.25), Material = SMOOTH }) + -- дверь и окна с тёплым светом + part({ Size = V(3, 5.2, 0.5), CFrame = cf * CFrame.new(0, 3.6, -d / 2 - 0.7), Color = COL.logDark, Material = PLANKS }) + for i, wdw in ipairs({ { -w / 4, -d / 2 - 0.65, 0 }, { w / 4, -d / 2 - 0.65, 0 }, { -w / 2 - 0.65, 0, 90 }, { w / 2 + 0.65, 0, 90 } }) do + local wcf = cf * CFrame.new(wdw[1], 4.6, wdw[2]) * CFrame.Angles(0, math.rad(wdw[3]), 0) + part({ Size = V(3, 2.6, 0.4), CFrame = wcf, Color = COL.logDark, Material = WOOD }) + local g = part({ Size = V(2.4, 2, 0.45), CFrame = wcf, Color = COL.glow, Material = Enum.Material.Neon, CastShadow = false }) + part({ Size = V(0.2, 2, 0.5), CFrame = wcf, Color = COL.logDark, Material = WOOD }) + if i == 1 then + local l = Instance.new("PointLight") + l.Range = 14 + l.Brightness = 1 + l.Color = COL.glow + l.Parent = g + end + end + -- крыльцо + part({ Size = V(w * 0.55, 0.6, 4), CFrame = cf * CFrame.new(0, 1.1, -d / 2 - 2.8), Color = COL.plank, Material = PLANKS }) + for _, s in ipairs({ -1, 1 }) do + vcyl(at(s * w * 0.25, 4.2, -d / 2 - 4.4), 6.2, 0.6, { Color = COL.log, Material = WOOD, Parent = house }) + end + part({ Size = V(w * 0.62, 0.5, 4.8), CFrame = cf * CFrame.new(0, 7.3, -d / 2 - 2.6) * CFrame.Angles(-math.rad(14), 0, 0), Color = COL.roof, Material = SMOOTH }) + -- труба с дымом + local ch = at(w / 2 - 2.2, 0, d / 4) + local chTop = wallTop + rise + 3 + part({ Size = V(2.2, chTop, 2.2), Position = ch + V(0, chTop / 2, 0), Color = Color3.fromRGB(150, 110, 95), Material = Enum.Material.Brick }) + local smokeAt = part({ Size = V(1, 1, 1), Position = ch + V(0, chTop + 0.5, 0), Transparency = 1, CanCollide = false, CanQuery = false }) + local smoke = Instance.new("ParticleEmitter") + smoke.Texture = "rbxasset://textures/particles/smoke_main.dds" + smoke.Color = ColorSequence.new(Color3.fromRGB(235, 235, 235)) + smoke.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1.5), NumberSequenceKeypoint.new(1, 6) }) + smoke.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.4), NumberSequenceKeypoint.new(1, 1) }) + smoke.Lifetime = NumberRange.new(4, 6) + smoke.Rate = 4 + smoke.Speed = NumberRange.new(2, 3) + smoke.SpreadAngle = Vector2.new(10, 10) + smoke.Acceleration = V(1, 0.4, 0) + smoke.Parent = smokeAt + end + + -------------------------------------------------- прибытие, причал, лавка + local DOCK = { z0 = 64, z1 = 36, w = 12 } -- от берега (z0) в воду (z1), по оси X = 0 + local DECK_Y = GROUND_Y + 0.6 -- верх настила + local spawnAt = W + V(0, DECK_Y, 60) + marker("World1Spawn", CFrame.lookAt(spawnAt + V(0, 1, 0), spawnAt + V(0, 1, -10))) + marker("GuideFishSpot", CFrame.new(W + V(0, DECK_Y + 0.5, DOCK.z1 + 3))) + + -- главный причал: доски поперёк, толстые сваи с канатом по краям, ящик для снастей + do + local dock = Instance.new("Model") + dock.Name = "MainDock" + dock:SetAttribute("GuideTarget", "Pier") -- подсвечивается на шаге обучения + dock.Parent = map + for z = DOCK.z1 + 0.8, DOCK.z0 - 0.8, 1.6 do + P({ + Size = V(DOCK.w + rng:NextNumber(-0.3, 0.3), 0.5, 1.48), Position = W + V(0, DECK_Y - 0.25, z), + Color = COL.plank:Lerp(COL.plankDark, rng:NextNumber(0, 0.7)), Material = PLANKS, Parent = dock, + }) + end + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.8, 0.8, DOCK.z0 - DOCK.z1), Position = W + V(s * (DOCK.w / 2 - 1), DECK_Y - 0.9, (DOCK.z0 + DOCK.z1) / 2), Color = COL.logDark, Material = WOOD, Parent = dock }) + for z = DOCK.z1 + 1, DOCK.z0 - 2, 8 do + ropePost(s * (DOCK.w / 2 - 0.2), z, -6, DECK_Y + 2.4, 1.7, dock) + end + end + local tb = W + V(-3.4, DECK_Y, 46) + P({ Size = V(2.6, 1.3, 1.5), Position = tb + V(0, 0.65, 0), Color = Color3.fromRGB(120, 142, 124), Material = SMOOTH, Parent = dock }) + P({ Size = V(2.7, 0.35, 1.6), Position = tb + V(0, 1.45, 0), Color = Color3.fromRGB(96, 116, 100), Material = SMOOTH, Parent = dock }) + rod(tb + V(-0.7, 1.65, 0), tb + V(0.7, 1.65, 0), 0.18, { Color = COL.metal, Material = Enum.Material.Metal, Parent = dock }) + P({ Size = V(0.35, 0.35, 0.1), Position = tb + V(0, 1.2, -0.8), Color = Color3.fromRGB(230, 190, 70), Material = Enum.Material.Metal, Parent = dock }) + P({ Size = V(2, 2, 2), CFrame = CFrame.new(W + V(-4.2, DECK_Y + 1, 49.5)) * CFrame.Angles(0, 0.25, 0), Color = COL.plankDark, Material = PLANKS, Parent = dock }) + end + + -- лавка рыбака (скупка) слева от корня причала, прилавком к причалу: тент, вывеска, поплавки, + -- воблеры, бочки и ящики, фонарь на столбе. Продавца ставит MapBuilder на маркер World1NpcSeller. + do + local cf = CFrame.lookAt(W + V(-15, GROUND_Y, 60), W + V(0, GROUND_Y, 57)) + local shop = Instance.new("Model") + shop.Name = "BaitShop" + shop:SetAttribute("GuideTarget", "Sell") -- подсвечивается на шаге обучения + shop.Parent = map + local function at(x, y, z) + return cf * CFrame.new(x, y, z) + end + local function part(props) + props.Parent = shop + return P(props) + end + part({ Size = V(14, 0.8, 10), CFrame = at(0, 0.4, 0), Color = COL.plankDark, Material = PLANKS }) + part({ Size = V(14, 9, 0.8), CFrame = at(0, 5, 4.6), Color = COL.plank, Material = PLANKS }) + for _, s in ipairs({ -1, 1 }) do + part({ Size = V(0.8, 9, 10), CFrame = at(s * 6.6, 5, 0), Color = COL.plank, Material = PLANKS }) + part({ Size = V(1.2, 10.4, 1.2), CFrame = at(s * 6.6, 5.2, -4.8), Color = COL.logDark, Material = WOOD }) + end + part({ Size = V(15.5, 0.7, 11), CFrame = at(0, 10.4, 0), Color = COL.logDark, Material = PLANKS }) + local counter = part({ Name = "Counter", Size = V(12, 3.4, 2.4), CFrame = at(0, 2.5, -3.6), Color = COL.plank, Material = PLANKS }) + part({ Size = V(13, 0.4, 3), CFrame = at(0, 4.4, -3.6), Color = COL.logDark, Material = WOOD }) + prompt(counter, "Продать всю рыбу", "Скупка", "Sell") + -- полосатый тент и фестончики + local n = 8 + for i = 0, n - 1 do + local c = (i % 2 == 0) and COL.awnA or COL.awnB + local x = -7.5 + (i + 0.5) * 15 / n + part({ Size = V(15 / n + 0.02, 0.25, 5), CFrame = at(x, 9.7, -6.9) * CFrame.Angles(math.rad(-24), 0, 0), Color = c, Material = Enum.Material.Fabric }) + part({ Shape = Enum.PartType.Cylinder, Size = V(0.25, 15 / n, 15 / n), CFrame = at(x, 8.7, -9.25) * CFrame.Angles(0, math.rad(90), 0), Color = c, Material = Enum.Material.Fabric, CanCollide = false }) + end + -- вывеска над тентом + local sign = part({ Size = V(8, 3, 0.5), CFrame = at(0, 12.6, -4.9), Color = COL.plank, Material = PLANKS }) + part({ Size = V(8.6, 3.6, 0.3), CFrame = at(0, 12.6, -4.6), Color = COL.logDark, Material = WOOD }) + surfaceText(sign, Enum.NormalId.Front, "🐟 СКУПКА", Color3.fromRGB(60, 40, 25)) + -- воблеры на задней стене + for i, c in ipairs({ Color3.fromRGB(90, 200, 80), Color3.fromRGB(245, 210, 60), Color3.fromRGB(245, 140, 50), Color3.fromRGB(70, 150, 230), Color3.fromRGB(230, 70, 70) }) do + local x = -4.4 + (i - 1) * 2.2 + part({ Size = V(0.08, 1.4, 0.08), CFrame = at(x, 8.4, 4.05), Color = COL.metal, CanCollide = false }) + part({ Size = V(0.55, 1.6, 0.5), CFrame = at(x, 7, 4.0), Color = c, Material = SMOOTH, CanCollide = false }) + part({ Size = V(0.3, 0.5, 0.45), CFrame = at(x, 6, 4.0), Color = c:Lerp(Color3.new(1, 1, 1), 0.4), Material = SMOOTH, CanCollide = false }) + end + -- поплавки и ящички на прилавке + for i = 0, 3 do + local p = at(-4.5 + i * 1.3, 5.05, -3.4).Position + ball(p, 0.9, { Color = Color3.fromRGB(225, 50, 45), Material = SMOOTH, Parent = shop, CanCollide = false }) + ball(p + V(0, 0.55, 0), 0.6, { Color = Color3.fromRGB(250, 250, 250), Material = SMOOTH, Parent = shop, CanCollide = false }) + end + part({ Size = V(2.2, 1, 1.4), CFrame = at(2.6, 5.1, -3.5), Color = Color3.fromRGB(120, 140, 125), Material = SMOOTH }) + part({ Size = V(1.6, 0.8, 1.2), CFrame = at(4.8, 5, -3.4), Color = COL.plankDark, Material = PLANKS }) + -- бочки и ящики сбоку + for i, off in ipairs({ { 8.6, -2.6 }, { 9.2, 0.6 } }) do + local p = at(off[1], 1.7, off[2]).Position + vcyl(p, 3.4, 2.8, { Color = COL.log, Material = WOOD, Parent = shop }) + for _, dy in ipairs({ -1, 1 }) do + vcyl(p + V(0, dy, 0), 0.3, 2.95, { Color = COL.metal, Material = Enum.Material.Metal, Parent = shop, CanCollide = false }) + end + if i == 2 then + part({ Size = V(2.2, 2.2, 2.2), CFrame = at(9, 4.5, 0.6) * CFrame.Angles(0, 0.3, 0), Color = COL.plankDark, Material = PLANKS }) + end + end + part({ Size = V(2.6, 2.6, 2.6), CFrame = at(-9, 1.3, -1.5) * CFrame.Angles(0, 0.2, 0), Color = COL.plankDark, Material = PLANKS }) + marker("World1NpcSeller", at(0, 3.9, 1.6)) + marker("GuideSell", cf * CFrame.new(0, 0, -9)) + postLantern(at(-7.8, 0, -6.2).Position, (cf.LookVector * V(1, 0, 1)).Unit, 9) + end + leafy(W + V(-27, GROUND_Y, 70), 13) -- большое дерево над лавкой, как на макете + postLantern(W + V(7.5, GROUND_Y, 66), V(-1, 0, 0), 8) + + -- деревянная лодка с вёслами справа от причала у двух свай + do + local cf = CFrame.new(W + V(12.5, WATER_Y + 0.25, 46)) * CFrame.Angles(0, math.rad(12), 0) + local boat = Instance.new("Model") + boat.Name = "Rowboat" + boat.Parent = map + local hull, inner = Color3.fromRGB(150, 92, 52), Color3.fromRGB(196, 140, 88) + P({ Size = V(3.4, 0.4, 8.4), CFrame = cf, Color = inner, Material = PLANKS, Parent = boat }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.4, 1.7, 8.6), CFrame = cf * CFrame.new(s * 1.95, 0.7, 0.2) * CFrame.Angles(0, 0, math.rad(-s * 14)), Color = hull, Material = WOOD, Parent = boat }) + P({ Size = V(0.4, 1.7, 3), CFrame = cf * CFrame.new(s * 1.05, 0.8, -5) * CFrame.Angles(0, math.rad(s * 38), 0), Color = hull, Material = WOOD, Parent = boat }) + P({ Size = V(0.5, 0.3, 8.6), CFrame = cf * CFrame.new(s * 2.2, 1.6, 0.2), Color = COL.logDark, Material = WOOD, Parent = boat }) + local a = (cf * CFrame.new(s * 1.6, 1.4, 0.2)).Position + local b = (cf * CFrame.new(s * 5.2, -0.1, 1.4)).Position + rod(a, b, 0.22, { Color = COL.plank, Material = WOOD, CanCollide = false, Parent = boat }) + P({ Size = V(0.15, 0.9, 1.9), CFrame = CFrame.lookAt(b, b + (b - a)) * CFrame.Angles(0, math.rad(90), 0), Color = COL.plank, Material = WOOD, CanCollide = false, Parent = boat }) + end + P({ Size = V(4.4, 1.7, 0.4), CFrame = cf * CFrame.new(0, 0.7, 4.5), Color = hull, Material = WOOD, Parent = boat }) + for _, z in ipairs({ -1.6, 1.8 }) do + P({ Size = V(3.8, 0.3, 1.1), CFrame = cf * CFrame.new(0, 1.1, z), Color = inner, Material = PLANKS, Parent = boat }) + end + ropePost(9.8, 52, -6, 3.4, 1.4, boat) + ropePost(16, 40, -6, 2.8, 1.4, boat) + end + + -- за спиной игрока: портал в лобби, место деда-рыбака, доска «Кто водится в озере» + do + local baseCF = CFrame.lookAt(W + V(15, GROUND_Y, 86), W + V(0, GROUND_Y, 62)) + local color = Color3.fromRGB(255, 200, 80) + local portalModel = Instance.new("Model") + portalModel.Name = "PortalToLobby" + portalModel.Parent = map + local center = baseCF * CFrame.new(0, 10, 0) + local fancy = makePortal and makePortal(baseCF, color, "PortalModel_Lobby", portalModel) + local disc + if fancy then + -- модель из шаблона; невидимый якорь держит подсказку, подпись и искры + disc = P({ + Name = "Portal_Lobby", Size = V(1, 1, 1), CFrame = center * CFrame.Angles(0, math.rad(90), 0), + Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false, Parent = portalModel, + }) + else + P({ Size = V(17, 1, 9), CFrame = baseCF * CFrame.new(0, 0.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(95, 100, 115), Parent = portalModel }) + P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130), Parent = portalModel }) + local R, n = 7, 20 + for i = 0, n - 1 do + local a = (i + 0.5) / n * math.pi * 2 + P({ Size = V(2 * math.pi * R / n + 0.4, 1.7, 1.7), CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(80, 85, 100), Parent = portalModel }) + if i % 2 == 0 then + P({ Size = V(0.6, 0.6, 1.9), CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R + 0.95, 0), Material = Enum.Material.Neon, Color = color, Parent = portalModel }) + end + end + disc = P({ + Name = "Portal_Lobby", Shape = Enum.PartType.Cylinder, Size = V(0.3, 2 * R - 1, 2 * R - 1), CFrame = center * CFrame.Angles(0, math.rad(90), 0), + Material = Enum.Material.Neon, Color = color, Transparency = 0.3, CanCollide = false, Parent = portalModel, + }) + end + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + pe.LightEmission = 1 + pe.Rate = 25 + pe.Lifetime = NumberRange.new(1, 1.8) + pe.Speed = NumberRange.new(0.5, 2) + pe.SpreadAngle = Vector2.new(180, 180) + pe.Size = NumberSequence.new(0.5, 0) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Parent = disc + local bb = Instance.new("BillboardGui") + bb.Size = UDim2.fromOffset(250, 64) + bb.StudsOffset = V(0, fancy and 7 or 10, 0) + bb.MaxDistance = 160 + bb.LightInfluence = 0 + bb.Parent = disc + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = color:Lerp(Color3.new(1, 1, 1), 0.4) + t.TextStrokeTransparency = 0.15 + t.Text = "🏠 В лобби" + t.Parent = bb + prompt(disc, "Перейти", "🏠 В лобби", "Portal"):SetAttribute("World", "Lobby") + end + marker("World1NpcGrandpa", CFrame.lookAt(W + V(9, GROUND_Y + 3, 72), W + V(0, GROUND_Y + 3, 62))) + do + local cf = CFrame.lookAt(W + V(-12, GROUND_Y, 80), W + V(0, GROUND_Y, 62)) + for _, x in ipairs({ -5.5, 5.5 }) do + P({ Size = V(0.8, 10, 0.8), CFrame = cf * CFrame.new(x, 5, 0.3), Material = WOOD, Color = COL.logDark }) + end + P({ Name = "World1Bestiary", Size = V(12, 9, 0.5), CFrame = cf * CFrame.new(0, 6.5, 0), Material = PLANKS, Color = Color3.fromRGB(70, 48, 32) }) + end + + -------------------------------------------------- дальний берег: дом, холм с тропинкой и вышкой + logCabin("BigCabin", CFrame.lookAt(W + V(-58, GROUND_Y, -62), W + V(-20, GROUND_Y, 10)), 16, 12, 8) + postLantern(W + V(-44, GROUND_Y, -58), V(1, 0, 0), 8) + + -- столб-вывеска с зелёным знаменем и белой рыбой у начала тропинки + do + local base = W + V(-17, GROUND_Y, -80) + vcyl(base + V(0, 6, 0), 12, 0.9, { Color = COL.logDark, Material = WOOD }) + rod(base + V(0, 11.4, 0), base + V(3.6, 11.4, 0), 0.5, { Color = COL.logDark, Material = WOOD }) + local flag = P({ Size = V(3, 5, 0.2), CFrame = CFrame.lookAt(base + V(2.2, 8.6, 0), base + V(2.2, 8.6, 10)), Color = COL.banner, Material = Enum.Material.Fabric, CanCollide = false }) + surfaceText(flag, Enum.NormalId.Front, "🐟", Color3.new(1, 1, 1)) + surfaceText(flag, Enum.NormalId.Back, "🐟", Color3.new(1, 1, 1)) + end + + -- забор вдоль тропинки и фонари + do + local posts = {} + for i = 2, #HILL_PATH do + local a, b = HILL_PATH[i - 1], HILL_PATH[i] + local dx, dz = b[1] - a[1], b[2] - a[2] + local len = math.sqrt(dx * dx + dz * dz) + local nx, nz = -dz / len, dx / len -- влево от направления + for s = 0, len - 0.1, 4.5 do + local x, z = a[1] + dx * s / len + nx * 3, a[2] + dz * s / len + nz * 3 + table.insert(posts, W + V(x, hillY(x, z), z)) + end + end + for i, p in ipairs(posts) do + vcyl(p + V(0, 1.3, 0), 3, 0.45, { Color = COL.log, Material = WOOD }) + local q = posts[i + 1] + if q and (q - p).Magnitude < 8 then + for _, h in ipairs({ 1.2, 2.3 }) do + rod(p + V(0, h, 0), q + V(0, h, 0), 0.3, { Color = COL.log, Material = WOOD, CanCollide = false }) + end + end + end + for _, i in ipairs({ 2, 4 }) do + local x, z = HILL_PATH[i][1] + 3, HILL_PATH[i][2] + postLantern(W + V(x, hillY(x, z), z), V(-1, 0, 0), 7) + end + end + + -- смотровая вышка на вершине холма с зелёным флагом + do + local tower = Instance.new("Model") + tower.Name = "Watchtower" + tower.Parent = map + local c = W + V(-76, hillY(-76, -136) - 0.5, -136) + local H = 14 + local function wood(props) + props.Parent = tower + return props + end + for _, sx in ipairs({ -1, 1 }) do + for _, sz in ipairs({ -1, 1 }) do + rod(c + V(sx * 4.2, 0, sz * 4.2), c + V(sx * 3.2, H, sz * 3.2), 1.1, wood({ Color = COL.log, Material = WOOD })) + end + end + for _, y in ipairs({ 4.5, 9 }) do + for _, s in ipairs({ -1, 1 }) do + local k = 4.2 - y / H + rod(c + V(-k, y, s * k), c + V(k, y - 3, s * k), 0.4, wood({ Color = COL.logDark, Material = WOOD, CanCollide = false })) + rod(c + V(s * k, y, -k), c + V(s * k, y - 3, k), 0.4, wood({ Color = COL.logDark, Material = WOOD, CanCollide = false })) + end + end + P(wood({ Size = V(9, 0.6, 9), Position = c + V(0, H, 0), Color = COL.plank, Material = PLANKS })) + for _, s in ipairs({ -1, 1 }) do + P(wood({ Size = V(9, 1.4, 0.3), Position = c + V(0, H + 1.2, s * 4.4), Color = COL.log, Material = WOOD })) + P(wood({ Size = V(0.3, 1.4, 9), Position = c + V(s * 4.4, H + 1.2, 0), Color = COL.log, Material = WOOD })) + end + for _, sx in ipairs({ -1, 1 }) do + for _, sz in ipairs({ -1, 1 }) do + vcyl(c + V(sx * 4.2, H + 2.6, sz * 4.2), 5.2, 0.4, wood({ Color = COL.log, Material = WOOD })) + end + end + for _, s in ipairs({ -1, 1 }) do + P(wood({ Size = V(11, 0.5, 6.4), CFrame = CFrame.new(c + V(0, H + 6.2, s * 2.7)) * CFrame.Angles(s * math.rad(30), 0, 0), Color = COL.roof, Material = SMOOTH })) + end + vcyl(c + V(0, H + 10.5, 0), 7, 0.25, wood({ Color = COL.logDark, Material = WOOD })) + local flag = P(wood({ Size = V(4, 2.6, 0.15), CFrame = CFrame.new(c + V(2.1, H + 12.6, 0)), Color = COL.banner, Material = Enum.Material.Fabric, CanCollide = false })) + surfaceText(flag, Enum.NormalId.Front, "🐟", Color3.new(1, 1, 1)) + surfaceText(flag, Enum.NormalId.Back, "🐟", Color3.new(1, 1, 1)) + end + + -------------------------------------------------- северо-восток: домик с мостками, скала, водопад, мост + logCabin("SmallCabin", CFrame.lookAt(W + V(8, GROUND_Y, -96), W + V(4, GROUND_Y, 0)), 11, 9, 7) + smallDock(8, -86, -68, 6, GROUND_Y + 0.4) + postLantern(W + V(10.6, GROUND_Y + 0.4, -70), V(-1, 0, 0), 6) + + local CLIFF_FRONT = -66 -- передняя кромка скалы по Z + local RIVER_X, RIVER_W, LIP_Y = 48, 10, 35 -- русло реки над водопадом и высота уступа + local cliff = Instance.new("Model") + cliff.Name = "Cliff" + cliff.Parent = map + do + -- скала уступами: три ряда блоков всё выше к заднему плану; у русла — вровень с уступом водопада + local rows = { { CLIFF_FRONT, 14, 22 }, { CLIFF_FRONT - 18, 26, 34 }, { CLIFF_FRONT - 40, 38, 50 } } -- { кромка, мин. высота, макс. высота } + for ri, row in ipairs(rows) do + local x = 28 + while x < 116 do + local w = rng:NextNumber(11, 16) + local cx = x + w / 2 + if math.abs(cx - RIVER_X) > RIVER_W / 2 + w / 2 - 1 then + local h = rng:NextNumber(row[2], row[3]) + if ri <= 2 and math.abs(cx - RIVER_X) < 16 then + h = LIP_Y + rng:NextNumber(-0.5, 1.5) -- берега реки вровень с уступом: на них стоит мост + end + local d = rng:NextNumber(18, 24) + local cf = CFrame.new(W + V(cx, h / 2, row[1] - d / 2)) * CFrame.Angles(rng:NextNumber(-0.06, 0.06), rng:NextNumber(-0.25, 0.25), rng:NextNumber(-0.06, 0.06)) + P({ Size = V(w, h, d), CFrame = cf, Color = COL.rock:Lerp(COL.rockDark, rng:NextNumber(0, 0.5)), Material = SMOOTH, Parent = cliff }) + P({ Size = V(w - 1, 1.2, d - 1), CFrame = cf * CFrame.new(0, h / 2 + 0.3, 0), Color = COL.moss:Lerp(COL.leaf, rng:NextNumber(0, 0.5)), Material = SMOOTH, Parent = cliff }) + -- острые обломки на кромке и на гранях — чтобы скала не выглядела ровной стеной + for _ = 1, 2 do + local s = rng:NextNumber(5, 9) + local cr = crag((cf * CFrame.new(rng:NextNumber(-w / 2, w / 2), rng:NextNumber(-h / 2, h / 2 - 2), -d / 2 + s * 0.2)).Position, s) + cr.Parent = cliff + end + if rng:NextNumber() < 0.7 then + pine((cf * CFrame.new(rng:NextNumber(-w / 4, w / 4), h / 2 + 0.8, rng:NextNumber(-d / 4, d / 4))).Position, rng:NextNumber(12, 20), 3) + end + end + x += w - 0.5 + end + end + for x = 30, 112, 9 do + local cr = crag(W + V(x + rng:NextNumber(-3, 3), 2, CLIFF_FRONT + rng:NextNumber(0, 3)), rng:NextNumber(6, 11)) + cr.Parent = cliff + end + -- ложе реки и стена за водопадом, река наверху + P({ Size = V(RIVER_W + 4, LIP_Y, 70), Position = W + V(RIVER_X, LIP_Y / 2, CLIFF_FRONT - 35), Color = COL.rockDark, Material = SMOOTH, Parent = cliff }) + P({ Size = V(RIVER_W, 0.8, 70), Position = W + V(RIVER_X, LIP_Y + 0.4, CLIFF_FRONT - 35), Color = COL.water, Material = Enum.Material.Glass, Transparency = 0.15, CanCollide = false, Parent = cliff }) + for z = CLIFF_FRONT - 4, CLIFF_FRONT - 66, -7 do + for _, s in ipairs({ -1, 1 }) do + rock(W + V(RIVER_X + s * (RIVER_W / 2 + 0.5), LIP_Y + 1, z + rng:NextNumber(-2, 2)), rng:NextNumber(2.5, 4.5)).Parent = cliff + end + end + end + + -- водопад: полупрозрачная «простыня», бегущие вниз струи (Beam с текстурой), пена и туман внизу + do + local fall = Instance.new("Model") + fall.Name = "Waterfall" + fall.Parent = map + local zf = CLIFF_FRONT - 1.2 + local sheet = P({ + Size = V(RIVER_W - 1, LIP_Y + 0.8, 1), Position = W + V(RIVER_X, LIP_Y / 2, zf), + Color = Color3.fromRGB(170, 236, 240), Material = Enum.Material.Glass, Transparency = 0.25, CanCollide = false, CastShadow = false, Parent = fall, + }) + for i = 0, 4 do + local x = -RIVER_W / 2 + 1.5 + i * (RIVER_W - 3) / 4 + local a0 = Instance.new("Attachment") + a0.Position = V(x, LIP_Y / 2, -0.6) + a0.Parent = sheet + local a1 = Instance.new("Attachment") + a1.Position = V(x + rng:NextNumber(-0.5, 0.5), -LIP_Y / 2, -0.6) + a1.Parent = sheet + local b = Instance.new("Beam") + b.Attachment0, b.Attachment1 = a0, a1 + b.Texture = "rbxasset://textures/particles/smoke_main.dds" + b.TextureMode = Enum.TextureMode.Wrap + b.TextureLength = 5 + b.TextureSpeed = rng:NextNumber(1.6, 2.4) + b.Width0, b.Width1 = 2.6, 3.2 + b.FaceCamera = true + b.LightEmission = 0.35 + b.Color = ColorSequence.new(Color3.new(1, 1, 1)) + b.Transparency = NumberSequence.new(0.25) + b.Parent = sheet + end + for _ = 1, 9 do + vcyl(W + V(RIVER_X + rng:NextNumber(-6, 6), WATER_Y + 0.2, zf + rng:NextNumber(0.5, 6)), 0.5, rng:NextNumber(3, 6), { + Color = Color3.fromRGB(240, 252, 252), Material = SMOOTH, Transparency = 0.15, CanCollide = false, CastShadow = false, Parent = fall, + }) + end + local function mistAt(pos, size, rate, s0, s1) + local holder = P({ Size = size, Position = pos, Transparency = 1, CanCollide = false, CanQuery = false, Parent = fall }) + local mist = Instance.new("ParticleEmitter") + mist.Texture = "rbxasset://textures/particles/smoke_main.dds" + mist.Color = ColorSequence.new(Color3.new(1, 1, 1)) + mist.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0, s0), NumberSequenceKeypoint.new(1, s1) }) + mist.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.45), NumberSequenceKeypoint.new(1, 1) }) + mist.Lifetime = NumberRange.new(2, 3.5) + mist.Rate = rate + mist.Speed = NumberRange.new(2, 5) + mist.SpreadAngle = Vector2.new(70, 70) + mist.Parent = holder + end + mistAt(W + V(RIVER_X, WATER_Y + 1, zf + 2), V(RIVER_W, 1, 2), 14, 4, 11) + mistAt(W + V(RIVER_X, LIP_Y, zf), V(RIVER_W, 1, 1), 5, 2, 5) + end + + -- арочный деревянный мост через реку над водопадом + do + local bridge = Instance.new("Model") + bridge.Name = "Bridge" + bridge.Parent = map + local z, x0, x1, y0, rise = CLIFF_FRONT - 22, RIVER_X - 11, RIVER_X + 11, LIP_Y + 1, 3.2 + local N = 12 + local function arc(t) + return W + V(x0 + (x1 - x0) * t, y0 + math.sin(t * math.pi) * rise, z) + end + for i = 0, N - 1 do + local a, b = arc(i / N), arc((i + 1) / N) + P({ Size = V((b - a).Magnitude + 0.1, 0.5, 5), CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0), Color = COL.plank:Lerp(COL.plankDark, (i % 2) * 0.4), Material = PLANKS, Parent = bridge }) + end + for _, s in ipairs({ -1, 1 }) do + local prev + for i = 0, N, 2 do + local p = arc(i / N) + V(0, 0, s * 2.3) + vcyl(p + V(0, 1.4, 0), 2.8, 0.4, { Color = COL.log, Material = WOOD, Parent = bridge }) + if prev then + rod(prev + V(0, 2.6, 0), p + V(0, 2.6, 0), 0.32, { Color = COL.log, Material = WOOD, Parent = bridge }) + end + prev = p + end + end + end + + -------------------------------------------------- у воды: камни, рогоз, кувшинки + local function nearDock(x, z) + return math.abs(x) < 9 and z > 28 and z < 70 + end + local function inCliff(x, z) + return x > 24 and x < 118 and z < -58 and z > -150 + end + for _, l in ipairs(LAKES) do + for _ = 1, 9 do + local a = rng:NextNumber(0, math.pi * 2) + local r = l[3] + rng:NextNumber(-1, 2.5) + local x, z = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r + if not inLake(x, z, -4) and not nearDock(x, z) and not inCliff(x, z) then + rock(W + V(x, rng:NextNumber(0.5, 2.5), z), rng:NextNumber(2.5, 5.5)) + end + end + for _ = 1, 5 do + local a = rng:NextNumber(0, math.pi * 2) + local r = l[3] + rng:NextNumber(-1.5, 0.5) + local x, z = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r + if not inLake(x, z, -3) and not nearDock(x, z) and not inCliff(x, z) then + cattails(W + V(x, WATER_Y - 0.5, z)) + end + end + end + for _, p in ipairs({ { 11, 55 }, { 15, 52 }, { -9, 53 }, { 20, 47 } }) do -- рогоз в правом нижнем углу кадра + cattails(W + V(p[1], WATER_Y - 0.5, p[2])) + end + for _ = 1, 14 do -- кувшинки группами + local l = LAKES[rng:NextInteger(1, #LAKES)] + local a = rng:NextNumber(0, math.pi * 2) + local r = l[3] * rng:NextNumber(0.5, 0.88) + local cx, cz = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r + for _ = 1, rng:NextInteger(2, 5) do + local x, z = cx + rng:NextNumber(-3, 3), cz + rng:NextNumber(-3, 3) + if inLake(x, z, -2) and not nearDock(x, z) and not (x > 6 and x < 20 and z > 36 and z < 56) then + local size = rng:NextNumber(2, 3.4) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.15, size, size), CFrame = CFrame.new(W + V(x, WATER_Y + 0.12, z)) * CFrame.Angles(0, 0, math.rad(90)), Color = Color3.fromRGB(78, 168, 70):Lerp(Color3.fromRGB(110, 190, 80), rng:NextNumber()), Material = SMOOTH, CanCollide = false, CastShadow = false }) + if rng:NextNumber() < 0.35 then + ball(W + V(x + 0.3, WATER_Y + 0.45, z), 0.8, { Color = Color3.fromRGB(255, 150, 195), Material = SMOOTH, CanCollide = false, CastShadow = false }) + ball(W + V(x + 0.3, WATER_Y + 0.75, z), 0.4, { Color = Color3.fromRGB(255, 235, 120), Material = SMOOTH, CanCollide = false, CastShadow = false }) + end + end + end + end + + -------------------------------------------------- лес, кусты, цветы + local function nearPath(x, z, dist) + for i = 2, #HILL_PATH do + local a, b = HILL_PATH[i - 1], HILL_PATH[i] + local abx, abz = b[1] - a[1], b[2] - a[2] + local t = math.clamp(((x - a[1]) * abx + (z - a[2]) * abz) / (abx * abx + abz * abz), 0, 1) + if (x - a[1] - abx * t) ^ 2 + (z - a[2] - abz * t) ^ 2 < dist * dist then + return true + end + end + return false + end + local function freeSpot(x, z) + if math.abs(x) > 236 or math.abs(z) > 236 or inLake(x, z, 6) or inCliff(x, z) or nearPath(x, z, 6) then + return false + end + if x > -32 and x < 30 and z > 44 and z < 100 then -- прибытие, лавка, портал + return false + end + for _, c in ipairs({ { -58, -62, 16 }, { 8, -96, 13 }, { -76, -136, 11 }, { -17, -80, 5 } }) do + if (x - c[1]) ^ 2 + (z - c[2]) ^ 2 < c[3] * c[3] then + return false + end + end + return not (x > 2 and x < 14 and z > -100 and z < -64) -- мостки у домика + end + + local placed = 0 + for _ = 1, 700 do + if placed >= 210 then + break + end + local x, z = rng:NextNumber(-236, 236), rng:NextNumber(-236, 236) + -- за озером лес гуще, перед ним (за спиной игрока) реже + if (z < 0 or rng:NextNumber() < 0.45) and freeSpot(x, z) then + local far = math.max(math.abs(x), math.abs(z)) > 150 + pine(W + V(x, hillY(x, z) - 0.3, z), far and rng:NextNumber(22, 32) or rng:NextNumber(15, 25), far and 2 or 3) + placed += 1 + end + end + for _ = 1, 25 do -- лиственные деревья у берегов + local l = LAKES[rng:NextInteger(1, #LAKES)] + local a = rng:NextNumber(0, math.pi * 2) + local r = l[3] + rng:NextNumber(8, 18) + local x, z = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r + if freeSpot(x, z) then + leafy(W + V(x, hillY(x, z) - 0.3, z), rng:NextNumber(8, 12)) + end + end + for _ = 1, 50 do -- кусты + local x, z = rng:NextNumber(-150, 150), rng:NextNumber(-150, 120) + if freeSpot(x, z) then + local y = hillY(x, z) + local c = COL.leafDark:Lerp(COL.leaf, rng:NextNumber()) + for _ = 1, 3 do + ball(W + V(x + rng:NextNumber(-1.5, 1.5), y + 0.8, z + rng:NextNumber(-1.5, 1.5)), rng:NextNumber(2.5, 4), { Color = c, Material = SMOOTH, CanCollide = false }) + end + end + end + for _ = 1, 80 do -- цветы + local x, z = rng:NextNumber(-120, 120), rng:NextNumber(-140, 110) + if freeSpot(x, z) or nearPath(x, z, 6) and not nearPath(x, z, 3) then + ball(W + V(x, hillY(x, z) + 0.4, z), 0.6, { + Color = ({ Color3.fromRGB(255, 120, 150), Color3.fromRGB(255, 230, 90), Color3.fromRGB(245, 245, 255), Color3.fromRGB(190, 140, 255) })[rng:NextInteger(1, 4)], + Material = SMOOTH, CanCollide = false, CastShadow = false, + }) + end + end + -- отдельные детали (деревья, камни, кусты, фонари) — в папку Decor, чтобы в Explorer было видно + -- главное: модели и маркеры World1*/Guide* + local decor = Instance.new("Folder") + decor.Name = "Decor" + decor.Parent = map + for _, c in ipairs(map:GetChildren()) do + if c:IsA("BasePart") and not c.Name:match("^World1") and not c.Name:match("^Guide") then + c.Parent = decor + end + end + + -------------------------------------------------- горизонт: горы и облака + do + local horizon = Instance.new("Folder") + horizon.Name = "Horizon" + horizon.Parent = map + -- гора — несколько острых пиков (кубы вершиной вверх) разного размера + local function mountain(a, dist, s) + local base = W + V(math.cos(a) * dist, 0, math.sin(a) * dist) + for k = 1, 3 do + local ss = k == 1 and s or s * rng:NextNumber(0.45, 0.7) + local off = k == 1 and V(0, 0, 0) or V(rng:NextNumber(-0.7, 0.7) * s, 0, rng:NextNumber(-0.4, 0.4) * s) + local apex = ss * rng:NextNumber(0.55, 0.75) -- высота пика над землёй + P({ + Size = V(ss, ss, ss), + CFrame = CFrame.new(base + off + V(0, apex - ss * 0.866, 0)) * CFrame.Angles(rng:NextNumber(-0.1, 0.1), rng:NextNumber(0, 6.28), rng:NextNumber(-0.1, 0.1)) * CUBE_UP, + Color = Color3.fromRGB(152, 166, 190):Lerp(Color3.fromRGB(118, 134, 164), rng:NextNumber()), Material = SMOOTH, + CanCollide = false, CanQuery = false, CastShadow = false, Parent = horizon, + }) + end + end + for i = 0, 13 do -- север (за озером) — крупнее и плотнее + mountain(math.rad(-160 + i * 10 + rng:NextNumber(-4, 4)), rng:NextNumber(340, 470), rng:NextNumber(130, 220)) + end + for i = 0, 9 do -- остальные стороны + mountain(math.rad(20 + i * 16 + rng:NextNumber(-5, 5)), rng:NextNumber(360, 480), rng:NextNumber(100, 160)) + end + for _ = 1, 9 do + local c = W + V(rng:NextNumber(-380, 380), rng:NextNumber(170, 230), rng:NextNumber(-420, 200)) + for _ = 1, rng:NextInteger(4, 6) do + ball(c + V(rng:NextNumber(-30, 30), rng:NextNumber(-5, 8), rng:NextNumber(-12, 12)), rng:NextNumber(22, 42), { + Color = Color3.new(1, 1, 1), Material = SMOOTH, CanCollide = false, CanQuery = false, CastShadow = false, Parent = horizon, + }) + end + end + end + + -- невидимые стены по краю мира + for _, w in ipairs({ + { V(0, 0, 245), V(500, 120, 2) }, + { V(0, 0, -245), V(500, 120, 2) }, + { V(245, 0, 0), V(2, 120, 500) }, + { V(-245, 0, 0), V(2, 120, 500) }, + }) do + P({ Name = "WorldWall", Size = w[2], Position = W + w[1] + V(0, 50, 0), Transparency = 1, CanQuery = false }) + end + + map.Parent = parent + return map +end + +-- сборка в Studio: стирает старую папку и террейн мира, строит заново прямо в Workspace +function Builder.bake() + local old = Workspace:FindFirstChild("World1Map") + if old then + old:Destroy() + end + terrain:FillBlock(CFrame.new(W + V(0, 30, 0)), V(504, 120, 504), Enum.Material.Air) + local map = Builder.build(Workspace) + print(("✅ «Тихое озеро» собрано: Workspace.World1Map, деталей: %d. Сохраните плейс (Ctrl+S)."):format(#map:GetDescendants())) + return map +end + +return Builder +]]> + diff --git a/install/7_WorldBuilder_ServerScriptService.rbxmx b/install/7_WorldBuilder_ServerScriptService.rbxmx new file mode 100644 index 0000000..e519f67 --- /dev/null +++ b/install/7_WorldBuilder_ServerScriptService.rbxmx @@ -0,0 +1,1865 @@ + +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 ServerStorage = game:GetService("ServerStorage") +local Lighting = game:GetService("Lighting") +local Players = game:GetService("Players") +local RunService = game:GetService("RunService") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local ServerScriptService = game:GetService("ServerScriptService") + +-- в Command Bar require кэширует модули: берём копии, чтобы подхватывать свежие правки из Rojo +-- (копия на время загрузки лежит рядом с оригиналом — модули ищут соседей через script.Parent) +local function load(module) + if RunService:IsRunning() then + return require(module) + end + local copy = module:Clone() + copy.Parent = module.Parent + local ok, result = pcall(require, copy) + copy:Destroy() + if not ok then + error(result, 0) + end + return result +end +local Config = load(ReplicatedStorage:WaitForChild("FishConfig")) +local Models = load(ReplicatedStorage:WaitForChild("GameModels")) +local World1Builder = load(ServerScriptService:WaitForChild("World1Builder")) + +local V = Vector3.new +local terrain = Workspace.Terrain +local GROUND_Y = 4 -- верх земли в мирах (запасная высота для groundY) +local FLOOR = 1 -- верх пола лобби + +local Builder = {} +local map -- папка FishingMap, которую сейчас строим +local rng = Random.new(7) + +---------------------------------------------------------------- свет и атмосфера + +local function ensure(class, parent, props) + local obj = parent:FindFirstChildOfClass(class) or Instance.new(class) + for k, v in pairs(props) do + obj[k] = v + end + obj.Parent = parent + return obj +end + +-- Базовый свет при запуске игры (совпадает со светом лобби). Под каждую локацию его меняет клиент +-- по полям look из FishConfig, пока игрок за экраном загрузки. +function Builder.applyLighting() + Lighting.ClockTime = 16.3 + Lighting.Brightness = 2.0 + Lighting.ExposureCompensation = -0.3 + Lighting.Ambient = Color3.fromRGB(64, 60, 72) + Lighting.OutdoorAmbient = Color3.fromRGB(120, 114, 124) + Lighting.ColorShift_Top = Color3.fromRGB(255, 224, 186) + Lighting.EnvironmentDiffuseScale = 0.5 + Lighting.EnvironmentSpecularScale = 0.5 + Lighting.GlobalShadows = true + ensure("Atmosphere", Lighting, { + Density = 0.4, Offset = 0.18, Glare = 0.25, Haze = 1.6, + Color = Color3.fromRGB(222, 212, 204), Decay = Color3.fromRGB(186, 160, 150), + }) + ensure("BloomEffect", Lighting, { Intensity = 0.3, Size = 24, Threshold = 1.8 }) + ensure("ColorCorrectionEffect", Lighting, { + Saturation = 0.18, Contrast = 0.14, Brightness = -0.04, TintColor = Color3.fromRGB(255, 242, 228), + }) + ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.7 }) + -- размытие дальнего плана включают миры и лобби через look.dof + ensure("DepthOfFieldEffect", Lighting, { Enabled = false, FarIntensity = 0.18, FocusDistance = 55, InFocusRadius = 95, NearIntensity = 0 }) +end + +---------------------------------------------------------------- помощники + +local function P(props) + local p = Instance.new("Part") + if props.Shape then + p.Shape = props.Shape + end + p.Anchored = true + p.TopSurface = Enum.SurfaceType.Smooth + p.BottomSurface = Enum.SurfaceType.Smooth + for k, v in pairs(props) do + if k ~= "Parent" and k ~= "Shape" then + p[k] = v + end + end + p.Parent = props.Parent or map + return p +end + +local function vcyl(pos, h, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(h, d, d) + props.CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)) + return P(props) +end + +local function ball(pos, d, props) + props.Shape = Enum.PartType.Ball + props.Size = V(d, d, d) + props.Position = pos + return P(props) +end + +local function surfaceText(part, face, text, color, extra) + local sg = Instance.new("SurfaceGui") + sg.Face = face + sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud + sg.PixelsPerStud = 40 + sg.LightInfluence = 0 + sg.Parent = part + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.RichText = true + t.TextColor3 = color or Color3.new(1, 1, 1) + t.TextStrokeTransparency = 0.4 + t.Text = text + t.Parent = sg + local pad = Instance.new("UIPadding") + pad.PaddingLeft = UDim.new(0.05, 0) + pad.PaddingRight = UDim.new(0.05, 0) + pad.PaddingTop = UDim.new(0.06, 0) + pad.PaddingBottom = UDim.new(0.06, 0) + pad.Parent = t + for k, v in pairs(extra or {}) do + t[k] = v + end + return t +end + +local function billboard(target, text, color, offsetY, width) + local bb = Instance.new("BillboardGui") + bb.Size = UDim2.fromOffset(width or 300, 64) + bb.StudsOffset = V(0, offsetY or 5, 0) + bb.MaxDistance = 160 + bb.LightInfluence = 0 + bb.Parent = target + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = color or Color3.new(1, 1, 1) + t.TextStrokeTransparency = 0.15 + t.Text = text + t.Parent = bb + return bb +end + +local function prompt(target, actionText, objectText, action, dist) + local pp = Instance.new("ProximityPrompt") + pp.ActionText = actionText + pp.ObjectText = objectText + pp.HoldDuration = 0 + pp.MaxActivationDistance = dist or 13 + pp.RequiresLineOfSight = false + pp:SetAttribute("Action", action) + pp.Parent = target + return pp +end + +local function marker(name, cf) + return P({ Name = name, Size = V(4, 1, 4), CFrame = cf, Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false }) +end + +local function lobbyCliffs() + local template = ServerStorage:FindFirstChild("FishingCliffTemplate") + if not template or not template:IsA("Model") then + warn("FishingCliffTemplate отсутствует; используем низкую изгородь лобби") + for deg = 0, 359, 7 do + local a = math.rad(deg) + local p = V(math.cos(a) * 82, FLOOR + 2, math.sin(a) * 82) + P({ Size = V(10.5, 4, 3), CFrame = CFrame.lookAt(p, V(0, p.Y, 0)), Material = Enum.Material.Grass, Color = Color3.fromRGB(60, 130, 55) }) + end + return + end + + local ring = Instance.new("Folder") + ring.Name = "LobbyCliffs" + ring.Parent = map + local count = 24 + local tiers = { + { name = "LobbyCliff", radius = 88, scale = 1.4, baseY = FLOOR }, + { name = "LobbyCliffUpper", radius = 104, scale = 2.2, baseY = FLOOR + 10 }, + } + for _, tier in ipairs(tiers) do + for i = 1, count do + local angle = (i - 1) * 2 * math.pi / count + local radial = V(math.cos(angle), 0, math.sin(angle)) + local center = V(radial.X * tier.radius, tier.baseY, radial.Z * tier.radius) + local model = template:Clone() + model.Name = string.format("%s_%02d", tier.name, i) + model:ScaleTo(tier.scale) + local facing = CFrame.lookAt(center, center + radial) + local rotation = facing - facing.Position + model:PivotTo(CFrame.new(center) * rotation) + local boxCF, boxSize = model:GetBoundingBox() + local targetBoxCenter = V(center.X, tier.baseY + boxSize.Y / 2, center.Z) + model:PivotTo(model:GetPivot() + (targetBoxCenter - boxCF.Position)) + model.Parent = ring + end + end +end + +local function rockTopPosition(cliffs, radial, desiredRadius, radiusOffsets) + local params = RaycastParams.new() + params.FilterType = Enum.RaycastFilterType.Include + params.FilterDescendantsInstances = { cliffs } + for _, offset in ipairs(radiusOffsets) do + local radius = desiredRadius + offset + local origin = V(radial.X * radius, 128, radial.Z * radius) + local hit = Workspace:Raycast(origin, V(0, -180, 0), params) + if hit then + return hit.Position + end + end + return V(radial.X * desiredRadius, FLOOR, radial.Z * desiredRadius) +end + +local function placeModelOnRock(model, position, yaw) + local rotation = CFrame.Angles(0, yaw, 0) + model:PivotTo(CFrame.new(position) * rotation) + local boxCF, boxSize = model:GetBoundingBox() + local targetBoxCenter = V(position.X, position.Y + boxSize.Y / 2, position.Z) + model:PivotTo(model:GetPivot() + (targetBoxCenter - boxCF.Position)) +end + +local function lobbyTrees() + local templates = ServerStorage:FindFirstChild("LobbyTreeTemplates") + local cliffs = map:FindFirstChild("LobbyCliffs") + if not templates or not cliffs then + warn("LobbyTreeTemplates или LobbyCliffs отсутствует; деревья лобби пропущены") + return + end + local treeTypes = { "LargeCanopy", "Pine", "RoundCanopy" } + local treeScale = { LargeCanopy = 1, Pine = 1.25, RoundCanopy = 1.2 } + local folder = Instance.new("Folder") + folder.Name = "LobbyTrees" + folder.Parent = map + for layer = 1, 2 do + local baseRadius = layer == 1 and 84 or 96 + local radiusOffsets = { 0, -2, 2, -4, 4, -6, 6 } + for i = 1, 18 do + local degrees = (i - 1) * 20 + 10 + (layer == 2 and 10 or 0) + local angle = math.rad(degrees) + local radial = V(math.cos(angle), 0, math.sin(angle)) + local position = rockTopPosition(cliffs, radial, baseRadius, radiusOffsets) + local kind = treeTypes[(i + layer - 2) % #treeTypes + 1] + local template = templates:FindFirstChild(kind) + if template and template:IsA("Model") then + local model = template:Clone() + model.Name = string.format("LobbyTree_L%d_%02d_%s", layer, i, kind) + model:ScaleTo(treeScale[kind]) + placeModelOnRock(model, position, math.rad((i * 47 + layer * 23) % 360)) + for _, part in ipairs(model:GetDescendants()) do + if part:IsA("BasePart") then part.Anchored = true end + end + model.Parent = folder + end + end + end +end + +local function lobbyRockPlants() + local templates = ServerStorage:FindFirstChild("LobbyRockPlantTemplates") + local cliffs = map:FindFirstChild("LobbyCliffs") + if not templates or not cliffs then + warn("LobbyRockPlantTemplates или LobbyCliffs отсутствует; растительность скал пропущена") + return + end + local folder = Instance.new("Folder") + folder.Name = "LobbyRockPlants" + folder.Parent = map + local clusterAngles = { + { layer = 1, degrees = 45 }, { layer = 1, degrees = 135 }, + { layer = 1, degrees = 225 }, { layer = 1, degrees = 315 }, + { layer = 2, degrees = 0 }, { layer = 2, degrees = 90 }, + { layer = 2, degrees = 180 }, { layer = 2, degrees = 270 }, + } + local tuftKinds = { "GrassTuft", "BladeGrass", "GrassTuft", "FlowerPatch", "GrassTuft", "WideGrass" } + local tuftScales = { GrassTuft = 1.15, BladeGrass = 1.45, FlowerPatch = 1.1, WideGrass = 0.55 } + local offsets = { { 0, 0 }, { -2.2, 0 }, { 2.2, 0 }, { 0, -2.2 }, { 0, 2.2 }, { 1.6, 1.6 } } + local rayParams = RaycastParams.new() + rayParams.FilterType = Enum.RaycastFilterType.Include + rayParams.FilterDescendantsInstances = { cliffs } + for clusterIndex, cluster in ipairs(clusterAngles) do + local baseRadius = cluster.layer == 1 and 84 or 96 + local baseAngle = math.rad(cluster.degrees) + local radial = V(math.cos(baseAngle), 0, math.sin(baseAngle)) + local tangent = V(-radial.Z, 0, radial.X) + local basePos = rockTopPosition(cliffs, radial, baseRadius, { 0, -2, 2, -4, 4, -6, 6 }) + local bush = Instance.new("Model") + bush.Name = string.format("GrassBush_%02d_L%d", clusterIndex, cluster.layer) + for i, offset in ipairs(offsets) do + local xz = basePos + radial * offset[1] + tangent * offset[2] + local plantPos + for _, correction in ipairs({ 0, -2, 2, -4, 4 }) do + local candidate = xz + radial * correction + local hit = Workspace:Raycast(V(candidate.X, 128, candidate.Z), V(0, -180, 0), rayParams) + if hit then plantPos = hit.Position; break end + end + if plantPos then + local kind = tuftKinds[i] + local template = templates:FindFirstChild(kind) + if template and template:IsA("Model") then + local plant = template:Clone() + plant.Name = kind .. "_" .. i + plant:ScaleTo(tuftScales[kind]) + placeModelOnRock(plant, plantPos, math.rad((clusterIndex * 37 + i * 53) % 360)) + for _, part in ipairs(plant:GetDescendants()) do + if part:IsA("BasePart") then part.Anchored = true end + end + plant.Parent = bush + end + end + end + bush.Parent = folder + end +end +-- холмы и горы за скалами лобби (террейн), ельники на склонах и кольцо тумана за горами. +-- К горизонту холмы выше, чтобы из лобби было видно не пустоту, а гряду в дымке. +local function lobbyHillHeight(x, z) + local r = math.sqrt(x * x + z * z) + if r < 120 then + return nil + end + local t = math.clamp((r - 120) / 220, 0, 1) + local base = 22 + 90 * t ^ 0.85 + local n = math.noise(x / 95, z / 95, 1.7) * 30 + math.noise(x / 38, z / 38, 5.1) * 9 + local peak = math.max(0, math.noise(x / 150, z / 150, 9.3)) * 70 * t + local edge = math.clamp((r - 120) / 12, 0, 1) + return (base + n * (0.35 + 0.65 * t) + peak) * edge +end + +local function lobbyHills() + local R, Y0, Y1, CH = 384, -8, 232, 64 + for cx = -R, R - CH, CH do + for cz = -R, R - CH, CH do + -- чанк целиком внутри лобби пропускаем + local far = math.sqrt(math.max(cx * cx, (cx + CH) ^ 2) + math.max(cz * cz, (cz + CH) ^ 2)) + if far >= 120 then + local region = Region3.new(V(cx, Y0, cz), V(cx + CH, Y1, cz + CH)) + local nx, ny, nz = CH / 4, (Y1 - Y0) / 4, CH / 4 + local mats, occs = {}, {} + for i = 1, nx do + mats[i], occs[i] = {}, {} + for j = 1, ny do + mats[i][j], occs[i][j] = {}, {} + end + for k = 1, nz do + local x, z = cx + (i - 0.5) * 4, cz + (k - 0.5) * 4 + local h = (math.sqrt(x * x + z * z) <= R) and lobbyHillHeight(x, z) or nil + for j = 1, ny do + local yb = Y0 + (j - 1) * 4 + local occ = h and math.clamp((h - yb) / 4, 0, 1) or 0 + local m = Enum.Material.Air + if occ > 0 then + if yb > h - 6 then + m = h > 118 and Enum.Material.Rock or Enum.Material.Grass + else + m = Enum.Material.Ground + end + end + mats[i][j][k], occs[i][j][k] = m, occ + end + end + end + terrain:WriteVoxels(region, 4, mats, occs) + end + end + end + + -- ельники пятнами на склонах + local pines = ServerStorage:FindFirstChild("OldPines") + local forest = Instance.new("Folder") + forest.Name = "LobbyHillForest" + forest.Parent = map + if pines and #pines:GetChildren() > 0 then + local templates = pines:GetChildren() + local frng = Random.new(1104) + local placed = {} + for _ = 1, 4000 do + if #placed >= 170 then break end + local a = frng:NextNumber(0, math.pi * 2) + local r = frng:NextNumber(132, 300) + local x, z = math.cos(a) * r, math.sin(a) * r + -- высоту берём из той же формулы: лучи по только что залитому террейну в редакторе ненадёжны + local h = lobbyHillHeight(x, z) + local slope = h and math.max(math.abs((lobbyHillHeight(x + 4, z) or h) - h), math.abs((lobbyHillHeight(x, z + 4) or h) - h)) / 4 + if h and h <= 118 and slope < 0.8 and math.noise(x / 60, z / 60, 3.3) > -0.05 then + local ground = V(x, h, z) + local ok = true + for _, q in ipairs(placed) do + if (q - ground).Magnitude < 9 then ok = false break end + end + if ok then + local m = templates[frng:NextInteger(1, #templates)]:Clone() + for _, d in ipairs(m:GetDescendants()) do + if d:IsA("LuaSourceContainer") then + d:Destroy() + elseif d:IsA("BasePart") then + d.Anchored = true + d.CanCollide = false + d.CastShadow = false + end + end + m:ScaleTo(m:GetScale() * frng:NextNumber(0.8, 1.5)) + m:PivotTo(CFrame.new(ground) * CFrame.Angles(0, frng:NextNumber(0, math.pi * 2), 0)) + local bcf, bsz = m:GetBoundingBox() + m:PivotTo(m:GetPivot() + V(0, ground.Y - (bcf.Position.Y - bsz.Y / 2) - 1, 0)) + m.Parent = forest + table.insert(placed, ground) + end + end + end + end + + -- туман за горами: медленные крупные клубы по двум кольцам + local haze = Instance.new("Folder") + haze.Name = "LobbyHaze" + haze.Parent = map + for ring, cfg in ipairs({ { r = 150, n = 28, y = 18, size = 45 }, { r = 250, n = 36, y = 40, size = 70 } }) do + for i = 1, cfg.n do + local a = (i - 1) / cfg.n * math.pi * 2 + local x, z = math.cos(a) * cfg.r, math.sin(a) * cfg.r + local h = lobbyHillHeight(x, z) or 0 + local anchor = Instance.new("Part") + anchor.Name = "HazeAnchor" + anchor.Anchored = true + anchor.CanCollide = false + anchor.CanQuery = false + anchor.CanTouch = false + anchor.Transparency = 1 + anchor.Size = V(30, 4, 30) + anchor.CFrame = CFrame.new(x, h + cfg.y, z) + anchor.Parent = haze + local pe = Instance.new("ParticleEmitter") + pe.Texture = "rbxasset://textures/particles/smoke_main.dds" + pe.Color = ColorSequence.new(Color3.fromRGB(236, 228, 220)) + pe.LightEmission = 0.15 + pe.LightInfluence = 0.6 + pe.Rate = ring == 1 and 0.5 or 0.35 + pe.Lifetime = NumberRange.new(16, 22) + pe.Speed = NumberRange.new(0.3, 0.8) + pe.SpreadAngle = Vector2.new(60, 60) + pe.Rotation = NumberRange.new(0, 360) + pe.RotSpeed = NumberRange.new(-4, 4) + pe.Size = NumberSequence.new({ + NumberSequenceKeypoint.new(0, cfg.size * 0.7), + NumberSequenceKeypoint.new(1, cfg.size * 1.2), + }) + pe.Transparency = NumberSequence.new({ + NumberSequenceKeypoint.new(0, 1), + NumberSequenceKeypoint.new(0.3, 0.8), + NumberSequenceKeypoint.new(0.7, 0.82), + NumberSequenceKeypoint.new(1, 1), + }) + pe.Parent = anchor + end + end +end + +-- высота земли: читаем воксели столбца (лучи по только что залитому террейну ненадёжны, особенно в редакторе) +local function groundY(x, z) + local region = Region3.new(V(x - 1, -128, z - 1), V(x + 1, 160, z + 1)):ExpandToGrid(4) + local ok, mats, occ = pcall(terrain.ReadVoxels, terrain, region, 4) + if ok then + local bottom = region.CFrame.Position.Y - region.Size.Y / 2 + for y = mats.Size.Y, 1, -1 do + local m = mats[1][y][1] + if m ~= Enum.Material.Air and m ~= Enum.Material.Water then + return bottom + (y - 1 + occ[1][y][1]) * 4, m + end + end + end + return GROUND_Y +end + +local function lamp(pos, color) + vcyl(pos + V(0, 4.5, 0), 9, 0.5, { Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + P({ Size = V(1.4, 0.3, 1.4), Position = pos + V(0, 9.1, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + local bulb = P({ Size = V(1, 1.4, 1), Position = pos + V(0, 9.95, 0), Material = Enum.Material.Neon, Color = color or Color3.fromRGB(255, 215, 150) }) + P({ Size = V(1.5, 0.35, 1.5), Position = pos + V(0, 10.8, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + local light = Instance.new("PointLight") + light.Range = 16 + light.Brightness = 1.2 + light.Color = color or Color3.fromRGB(255, 210, 150) + light.Parent = bulb +end + +local function tree(pos, kind) + if kind == "pine" then + local h = rng:NextNumber(8, 12) + vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(95, 65, 40), Material = Enum.Material.Wood }) + for i = 0, 3 do + ball(pos + V(0, h * 0.4 + i * 2.8, 0), 10 - i * 2.2, { Color = Color3.fromRGB(35, 100 + i * 10, 55), Material = Enum.Material.Grass }) + end + else + local birch = kind == "birch" + local h = rng:NextNumber(7, 10) + vcyl(pos + V(0, h / 2, 0), h, 1.5, { + Color = birch and Color3.fromRGB(225, 222, 210) or Color3.fromRGB(105, 72, 45), + Material = Enum.Material.Wood, + }) + local leaf = birch and Color3.fromRGB(150, 195, 80) or Color3.fromRGB(65, rng:NextInteger(135, 165), 60) + local s = rng:NextNumber(9, 12) + ball(pos + V(0, h + s * 0.25, 0), s, { Color = leaf, Material = Enum.Material.Grass }) + ball(pos + V(s * 0.35, h - 0.5, s * 0.1), s * 0.7, { Color = leaf, Material = Enum.Material.Grass }) + ball(pos + V(-s * 0.3, h - 0.2, -s * 0.2), s * 0.65, { Color = leaf, Material = Enum.Material.Grass }) + end +end + +local function bush(pos) + local c = Color3.fromRGB(55, rng:NextInteger(120, 150), 55) + for i = 1, 3 do + ball(pos + V(rng:NextNumber(-1.5, 1.5), 1, rng:NextNumber(-1.5, 1.5)), rng:NextNumber(2.5, 4), { Color = c, Material = Enum.Material.Grass }) + end + if rng:NextNumber() < 0.5 then + for i = 1, 4 do + ball(pos + V(rng:NextNumber(-1.8, 1.8), rng:NextNumber(1.5, 2.6), rng:NextNumber(-1.8, 1.8)), 0.5, { + Color = ({ Color3.fromRGB(255, 120, 150), Color3.fromRGB(255, 230, 90), Color3.fromRGB(240, 240, 255) })[rng:NextInteger(1, 3)], + CanCollide = false, + }) + end + end +end + +local function bench(cf) + local seat = Instance.new("Seat") + seat.Anchored = true + seat.Size = V(5, 0.4, 1.6) + seat.CFrame = cf * CFrame.new(0, 1.6, 0) + seat.Material = Enum.Material.WoodPlanks + seat.Color = Color3.fromRGB(150, 105, 65) + seat.TopSurface = Enum.SurfaceType.Smooth + seat.Parent = map + for _, x in ipairs({ -2.1, 2.1 }) do + P({ Size = V(0.4, 1.4, 1.4), CFrame = cf * CFrame.new(x, 0.7, 0), Color = Color3.fromRGB(50, 50, 55), Material = Enum.Material.Metal }) + end + P({ Size = V(5, 1.3, 0.3), CFrame = cf * CFrame.new(0, 2.6, 0.75) * CFrame.Angles(math.rad(-10), 0, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 105, 65) }) +end + +-- место NPC: полупрозрачная фигура в редакторе; сам NPC встаёт сюда при запуске (prepareRuntime) +local function setNpc(part, name, colors, action, actionText) + part:SetAttribute("NpcName", name) + part:SetAttribute("SkinColor", colors.skin) + part:SetAttribute("ShirtColor", colors.shirt) + part:SetAttribute("PantsColor", colors.pants) + part:SetAttribute("HatColor", colors.hat) + part:SetAttribute("NpcAction", action) + part:SetAttribute("NpcActionText", actionText) + part.Size = V(2, 5, 1) + part.Color = colors.shirt + part.Transparency = 0.5 + part.CanCollide = false + part.CanQuery = false + part.CanTouch = false + return part +end + +local function npc(name, cf, colors, action, actionText) + return setNpc(P({ Name = "NpcSpot", CFrame = cf }), name, colors, action, actionText) +end + +-- доска «кто водится»: атрибуты Bestiary (зона), BestiaryTitle, BestiaryHex; текст пишется заново при запуске +local function writeBestiary(board) + local old = board:FindFirstChild("BestiaryText") + if old then + old:Destroy() + end + local zone = Config.Zones[board:GetAttribute("Bestiary")] + if not zone then + return + end + local lines = { ("%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 + +-- Лавки в стиле low poly: без фотореалистичных текстур (доски, ткань), плоские цвета с разбросом оттенков. +-- Большие дощатые панели (стены, пол, крыша) режутся на отдельные доски, шарики-гирлянды становятся +-- ромбиками-флажками, неоновая рамка вывески — матовой золотой. frame — CFrame лавки (для флажков), может быть nil. +local LOWPOLY_FLAT = { + [Enum.Material.WoodPlanks] = true, [Enum.Material.Wood] = true, [Enum.Material.Fabric] = true, + [Enum.Material.Metal] = true, [Enum.Material.Brick] = true, [Enum.Material.Plastic] = true, +} + +local function lowPolyShade(c, lrng, spread) + local k = 1 + lrng:NextNumber(-spread, spread) + return Color3.new(math.clamp(c.R * k, 0, 1), math.clamp(c.G * k, 0, 1), math.clamp(c.B * k, 0, 1)) +end + +local function lowPolyPlanks(p, lrng) + local s = p.Size + local dims = { s.X, s.Y, s.Z } + local thin = 1 + for i = 2, 3 do + if dims[i] < dims[thin] then thin = i end + end + -- режем вдоль самой длинной горизонтальной оси (кроме тонкой): стены — вертикальные доски, пол — продольные + local axis = (thin ~= 1 and (thin == 3 or s.X >= s.Z)) and 1 or 3 + local len = dims[axis] + local n = math.max(2, math.floor(len / 1.8 + 0.5)) + local w = len / n + for i = 1, n do + local off = -len / 2 + w * (i - 0.5) + local depth = lrng:NextNumber(-0.06, 0.06) + local o = { 0, 0, 0 } + o[axis] = off + o[thin] = depth + local size = { s.X, s.Y, s.Z } + size[axis] = w + local plank = Instance.new("Part") + plank.Name = "Plank" + plank.Anchored = true + plank.TopSurface, plank.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth + plank.Material = Enum.Material.SmoothPlastic + plank.Size = V(size[1], size[2], size[3]) + plank.CFrame = p.CFrame * CFrame.new(o[1], o[2], o[3]) + plank.Color = lowPolyShade(p.Color, lrng, 0.09) + plank.CanCollide, plank.CastShadow, plank.CanQuery = p.CanCollide, p.CastShadow, p.CanQuery + plank.Parent = p.Parent + end + p:Destroy() +end + +function Builder.lowPolyParts(parts, frame, seed) + local lrng = Random.new(seed or 5) + for _, p in ipairs(parts) do + if p:IsA("BasePart") and p.Parent and p.Transparency < 0.5 and not p.Name:find("Npc") then + local isBlock = p.ClassName == "Part" and p.Shape == Enum.PartType.Block + if p.Material == Enum.Material.Fabric and p.ClassName == "Part" and p.Shape == Enum.PartType.Ball and frame then + -- шарик гирлянды → ромбик-флажок, повёрнутый к покупателям + local d = p.Size.X + local flag = Instance.new("Part") + flag.Name = "Pennant" + flag.Anchored = true + flag.CanCollide = false + flag.Material = Enum.Material.SmoothPlastic + flag.Size = V(d * 1.15, d * 1.15, 0.25) + flag.CFrame = CFrame.new(p.Position) * (frame - frame.Position) * CFrame.Angles(0, 0, math.rad(45)) + flag.Color = p.Color + flag.Parent = p.Parent + p:Destroy() + elseif p.Material == Enum.Material.Neon and math.max(p.Size.X, p.Size.Y, p.Size.Z) > 4 then + p.Material = Enum.Material.SmoothPlastic -- рамка вывески: без свечения + p.Color = Color3.fromRGB(214, 160, 70) + elseif p.Material == Enum.Material.WoodPlanks and isBlock and #p:GetChildren() == 0 + and math.min(p.Size.X, p.Size.Y, p.Size.Z) <= 1.2 and math.max(p.Size.X, p.Size.Z) >= 4 then + lowPolyPlanks(p, lrng) + elseif LOWPOLY_FLAT[p.Material] then + p.Material = Enum.Material.SmoothPlastic + p.Color = lowPolyShade(p.Color, lrng, 0.06) + end + end + end +end + +-- детали лавки, построенной stall(cf): всё, что лежит в её габаритах прямо в папке parent +function Builder.stallParts(cf, parent) + local list = {} + for _, p in ipairs(parent:GetChildren()) do + if p:IsA("BasePart") then + local l = cf:PointToObjectSpace(p.Position) + if math.abs(l.X) <= 15.5 and l.Y >= -0.5 and l.Y <= 21 and l.Z >= -14.5 and l.Z <= 9.5 then + table.insert(list, p) + end + end + end + return list +end + +-- лавка: cf стоит на полу, сторона -Z смотрит на покупателей +local function stall(cf, opt) + local function at(x, y, z) + return cf * CFrame.new(x, y, z) + end + local wall, dark = opt.wall, opt.wall:Lerp(Color3.new(0, 0, 0), 0.3) + + P({ Size = V(24, 1, 17), CFrame = at(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 120, 80) }) + P({ Size = V(24, 13, 1), CFrame = at(0, 7.5, 8), Material = Enum.Material.WoodPlanks, Color = wall }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(1, 13, 17), CFrame = at(s * 11.5, 7.5, 0), Material = Enum.Material.WoodPlanks, Color = wall }) + P({ Size = V(1.5, 14.5, 1.5), CFrame = at(s * 11.6, 7.25, -8.3), Material = Enum.Material.Wood, Color = dark }) + end + P({ Size = V(26, 1, 19), CFrame = at(0, 14.5, 0), Material = Enum.Material.WoodPlanks, Color = dark }) + -- полосатый навес + for i = 0, 7 do + P({ + Size = V(3, 0.35, 6), + CFrame = at(-10.5 + i * 3, 13.1, -10.6) * CFrame.Angles(math.rad(-22), 0, 0), + Material = Enum.Material.Fabric, + Color = (i % 2 == 0) and opt.stripeA or opt.stripeB, + }) + ball(at(-10.5 + i * 3, 11.9, -13.3).Position, 0.9, { Color = (i % 2 == 0) and opt.stripeA or opt.stripeB, Material = Enum.Material.Fabric }) + end + -- прилавок + local counter = P({ Size = V(18, 4, 3), CFrame = at(0, 3, -4), Material = Enum.Material.WoodPlanks, Color = wall }) + P({ Size = V(19, 0.5, 3.8), CFrame = at(0, 5.25, -4), Material = Enum.Material.Wood, Color = dark }) + -- вывеска + local board = P({ Size = V(20, 4.5, 0.6), CFrame = at(0, 17.6, -9.2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 45, 30) }) + P({ Size = V(20.8, 5.3, 0.3), CFrame = at(0, 17.6, -8.9), Material = Enum.Material.Neon, Color = opt.glow }) + for _, x in ipairs({ -8, 8 }) do + P({ Size = V(0.6, 3, 0.6), CFrame = at(x, 15.5, -9.2), Material = Enum.Material.Wood, Color = dark }) + end + surfaceText(board, Enum.NormalId.Front, opt.title, opt.titleColor) + -- фонарики + for _, x in ipairs({ -9.5, 9.5 }) do + local l = P({ Size = V(0.8, 1.1, 0.8), CFrame = at(x, 11.2, -9.4), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 210, 140) }) + local light = Instance.new("PointLight") + light.Range = 14 + light.Brightness = 1 + light.Color = Color3.fromRGB(255, 210, 150) + light.Parent = l + end + -- бочки по бокам + for _, s in ipairs({ -1, 1 }) do + vcyl(at(s * 14.5, 2.6, -5).Position, 3.2, 2.6, { Color = Color3.fromRGB(130, 85, 50), Material = Enum.Material.Wood }) + vcyl(at(s * 14.5, 2.6, -5).Position, 0.3, 2.75, { Color = Color3.fromRGB(70, 70, 75), Material = Enum.Material.Metal }) + end + + prompt(counter, opt.promptText, opt.promptObject, opt.action, 14) + if opt.npcName then + npc(opt.npcName, at(0, 4, 1.5), opt.npcColors) + end + if opt.decor then + opt.decor(at) + end + Builder.lowPolyParts(Builder.stallParts(cf, map), cf, math.floor(cf.Position.X + cf.Position.Z)) + return counter +end + +-- Модель портала из ServerStorage.FishingPortalTemplate, перекрашенная в цвет мира и +-- поставленная основанием на baseCF. Без шаблона возвращает nil (тогда строится старое кольцо). +function Builder.portalModel(baseCF, color, name, parent) + local template = ServerStorage:FindFirstChild("FishingPortalTemplate") + if not (template and template:IsA("Model")) then + return nil + end + local model = template:Clone() + model.Name = name + for _, part in ipairs(model:GetDescendants()) do + if part:IsA("BasePart") then + local c = part.Color + local isGreen = c.G > c.R * 1.15 and c.G > c.B * 1.10 and c.G > 0.25 + if part.Material == Enum.Material.Neon then + part.Color = color + elseif isGreen then + part.Color = color:Lerp(Color3.fromRGB(55, 65, 75), 0.30) + part.Material = Enum.Material.SmoothPlastic + end + elseif part:IsA("ParticleEmitter") then + part.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + end + end + + local pivot = template:GetPivot() + local boxCFrame, boxSize = template:GetBoundingBox() + local boxBottom = pivot:PointToObjectSpace(Vector3.new( + boxCFrame.Position.X, + boxCFrame.Position.Y - boxSize.Y / 2, + boxCFrame.Position.Z + )).Y + model:PivotTo(baseCF * CFrame.new(0, -boxBottom, 0)) + model.Parent = parent + return model +end + +local function portal(baseCF, title, color, worldId, locked) + -- Все порталы, и в лобби, и возвратные в мирах, используют модель автора из ServerStorage. + do + local model = Builder.portalModel(baseCF, color, "PortalModel_" .. worldId, map) + if model then + -- Этот невидимый якорь сохраняет ProximityPrompt и подпись мира. + local disc = P({ + Name = "Portal_" .. worldId, + Size = V(1, 1, 1), + CFrame = baseCF * CFrame.new(0, 10, 0), + Transparency = 1, + CanCollide = false, + CanQuery = false, + CanTouch = false, + }) + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + pe.LightEmission = 1 + pe.Rate = 25 + pe.Lifetime = NumberRange.new(1, 1.8) + pe.Speed = NumberRange.new(0.5, 2) + pe.SpreadAngle = Vector2.new(180, 180) + pe.Size = NumberSequence.new(0.5, 0) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Parent = disc + billboard(disc, title, color:Lerp(Color3.new(1, 1, 1), 0.4), 7, 200) + if locked then + billboard(disc, "🔒", Color3.new(1, 1, 1), 0, 120) + end + local pp = prompt(disc, locked and "Посмотреть" or "Перейти", title, "Portal", 14) + pp:SetAttribute("World", worldId) + return disc + end + end + + local center = baseCF * CFrame.new(0, 10, 0) + P({ Size = V(17, 1, 9), CFrame = baseCF * CFrame.new(0, 0.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(95, 100, 115) }) + P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130) }) + local R, n = 7, 20 + for i = 0, n - 1 do + local a = (i + 0.5) / n * math.pi * 2 + P({ + Size = V(2 * math.pi * R / n + 0.4, 1.7, 1.7), + CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R, 0), + Material = Enum.Material.Slate, + Color = Color3.fromRGB(80, 85, 100), + }) + if i % 2 == 0 then + P({ + Size = V(0.6, 0.6, 1.9), + CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R + 0.95, 0), + Material = Enum.Material.Neon, + Color = color, + }) + end + end + local disc = P({ + Name = "Portal_" .. worldId, + Shape = Enum.PartType.Cylinder, + Size = V(0.3, 2 * R - 1, 2 * R - 1), + CFrame = center * CFrame.Angles(0, math.rad(90), 0), + Material = Enum.Material.Neon, + Color = color, + Transparency = 0.3, + CanCollide = false, + }) + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + pe.LightEmission = 1 + pe.Rate = 25 + pe.Lifetime = NumberRange.new(1, 1.8) + pe.Speed = NumberRange.new(0.5, 2) + pe.SpreadAngle = Vector2.new(180, 180) + pe.Size = NumberSequence.new(0.5, 0) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Parent = disc + billboard(disc, title, color:Lerp(Color3.new(1, 1, 1), 0.4), 10, 250) + if locked then + billboard(disc, "🔒", Color3.new(1, 1, 1), 0, 120) + end + local pp = prompt(disc, locked and "Посмотреть" or "Перейти", title, "Portal", 14) + pp:SetAttribute("World", worldId) + return disc +end + +local function banner(pos, color, icon, text) + local look = CFrame.lookAt(pos, V(0, pos.Y, 0)) -- смотрит в центр лобби + vcyl(pos + V(0, 8, 0), 16, 0.7, { Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal }) + ball(pos + V(0, 16.3, 0), 1.2, { Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal }) + P({ Size = V(5.2, 0.4, 0.4), CFrame = look * CFrame.new(0, 15, -0.6), Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal }) + local flag = P({ Size = V(4.6, 8, 0.25), CFrame = look * CFrame.new(0, 10.8, -0.6), Color = color, Material = Enum.Material.Fabric, CanCollide = false }) + P({ Size = V(4.6, 0.5, 0.3), CFrame = look * CFrame.new(0, 6.6, -0.6), Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal }) + local label = icon .. "\n" .. text + surfaceText(flag, Enum.NormalId.Front, label, Color3.new(1, 1, 1)) + surfaceText(flag, Enum.NormalId.Back, label, Color3.new(1, 1, 1)) +end + +local function arch(cf, span, height, title, color) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(4, height, 4), CFrame = cf * CFrame.new(s * span / 2, height / 2, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) + P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, height + 0.6, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 195, 60) }) + P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, 0.6, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(150, 145, 140) }) + end + local beam = P({ Size = V(span + 6, 6, 2.5), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(60, 85, 140) }) + P({ Size = V(span + 7, 7, 2), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.Neon, Color = color }) + surfaceText(beam, Enum.NormalId.Front, title, Color3.fromRGB(255, 230, 120)) + surfaceText(beam, Enum.NormalId.Back, title, Color3.fromRGB(255, 230, 120)) +end + +---------------------------------------------------------------- сборка карты + +function Builder.build() + rng = Random.new(7) + map = Instance.new("Folder") + map.Name = "FishingMap" + local zonesFolder = Instance.new("Folder") + zonesFolder.Name = "FishingZones" + zonesFolder.Parent = map + local world1Prebuilt = Workspace:FindFirstChild("World1Map") + + ---------------------------------------------------------------- ЛОББИ + + P({ Shape = Enum.PartType.Cylinder, Size = V(1, 170, 170), CFrame = CFrame.new(0, 0.5, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Cobblestone, Color = Color3.fromRGB(190, 180, 165) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 74, 74), CFrame = CFrame.new(0, 0.52, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Marble, Color = Color3.fromRGB(232, 226, 214) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 78, 78), CFrame = CFrame.new(0, 0.51, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.SmoothPlastic, Color = Color3.fromRGB(60, 120, 190) }) + -- дорожки-лучи к лавкам и порталам + for _, a in ipairs({ 0, 90, 180, 270 }) do + local r = math.rad(a) + P({ Size = V(10, 1.0, 48), CFrame = CFrame.new(math.cos(r) * 60, 0.52, math.sin(r) * 60) * CFrame.Angles(0, -r + math.pi / 2, 0), Material = Enum.Material.Marble, Color = Color3.fromRGB(225, 218, 205) }) + end + + marker("LobbySpawn", CFrame.new(0, FLOOR + 2, 57)) -- на дорожке за табличкой «Как играть»: сначала она, дальше портал в Мир 1 + + -- фонтан со статуей золотой рыбы + vcyl(V(0, FLOOR + 1, 0), 2, 24, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) + vcyl(V(0, FLOOR + 1.6, 0), 1.0, 21, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 }) + vcyl(V(0, FLOOR + 4, 0), 6, 3, { Material = Enum.Material.Slate, Color = Color3.fromRGB(190, 185, 175) }) + local bowl = vcyl(V(0, FLOOR + 7.3, 0), 1, 9, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) + vcyl(V(0, FLOOR + 7.75, 0), 0.2, 8, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 }) + do + local statue = Models.buildFish("Gold", "Golden", 3.2, true) + statue:PivotTo(CFrame.new(0, FLOOR + 12, 0) * CFrame.Angles(0, math.rad(30), math.rad(40))) + statue.Parent = map + local sp = Instance.new("ParticleEmitter") + sp.Texture = "rbxasset://textures/particles/sparkles_main.dds" + sp.Rate = 12 + sp.LightEmission = 1 + sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90)) + sp.Size = NumberSequence.new(0.6, 0) + sp.Lifetime = NumberRange.new(1, 1.5) + sp.SpreadAngle = Vector2.new(180, 180) + sp.Speed = NumberRange.new(1, 2) + sp.Parent = statue.PrimaryPart + -- струи воды + local att = Instance.new("Attachment") + att.Position = V(0.6, 0, 0) -- у повёрнутого цилиндра ось X смотрит вверх + att.Orientation = V(0, 0, -90) -- направить струю вверх + att.Parent = bowl + local water = Instance.new("ParticleEmitter") + water.Color = ColorSequence.new(Color3.fromRGB(200, 235, 255)) + water.Transparency = NumberSequence.new(0.3, 1) + water.Size = NumberSequence.new(0.6, 1.2) + water.Rate = 60 + water.Lifetime = NumberRange.new(1.2, 1.5) + water.Speed = NumberRange.new(10, 12) + water.SpreadAngle = Vector2.new(25, 25) + water.Acceleration = V(0, -25, 0) + water.Parent = att + end + -- скамейки по внешнему краю площади, между порталами, лицом к фонтану + for _, deg in ipairs({ 45, 135, 225, 315 }) do + local a = math.rad(deg) + for _, side in ipairs({ -1, 1 }) do + local b = a + side * math.rad(9) + bench(CFrame.lookAt(V(math.cos(b) * 34, FLOOR, math.sin(b) * 34), V(0, FLOOR, 0))) + end + end + + -- фонари по кругу (у спавна — за спиной игрока, чтобы не закрывали табличку и сундук) + for i = 0, 7 do + local deg = i * 45 + 22.5 + if deg ~= 67.5 and deg ~= 112.5 then + local a = math.rad(deg) + lamp(V(math.cos(a) * 40, FLOOR, math.sin(a) * 40)) + end + end + lamp(V(7, FLOOR, 48)) -- левый фонарь стоит за табличкой «Как играть» + + -- клумбы с деревьями + for _, deg in ipairs({ 225, 315 }) do + local a = math.rad(deg) + local p = V(math.cos(a) * 58, FLOOR, math.sin(a) * 58) + vcyl(p + V(0, 1, 0), 2, 12, { Material = Enum.Material.Brick, Color = Color3.fromRGB(150, 95, 70) }) + vcyl(p + V(0, 1.6, 0), 1.0, 11, { Material = Enum.Material.Grass, Color = Color3.fromRGB(70, 140, 60) }) + tree(p + V(0, 2, 0), "round") + for j = 1, 5 do + local b = rng:NextNumber(0, math.pi * 2) + ball(p + V(math.cos(b) * 4, 2.4, math.sin(b) * 4), 0.8, { Color = ({ Color3.fromRGB(255, 110, 140), Color3.fromRGB(255, 220, 80), Color3.fromRGB(170, 120, 255) })[rng:NextInteger(1, 3)] }) + end + end + + -- баннеры + local bannerData = { + { 15, Color3.fromRGB(40, 110, 200), "🎣", "Лови!" }, + { 70, Color3.fromRGB(240, 140, 40), "🐟", "Продавай" }, + { 110, Color3.fromRGB(40, 110, 200), "⭐", "Качайся" }, + { 165, Color3.fromRGB(240, 140, 40), "🍀", "Удача" }, + { 205, Color3.fromRGB(40, 110, 200), "🏆", "Рекорды" }, + { 335, Color3.fromRGB(240, 140, 40), "💎", "Мифика" }, + } + for _, b in ipairs(bannerData) do + local a = math.rad(b[1]) + banner(V(math.cos(a) * 74, FLOOR, math.sin(a) * 74), b[2], b[3], b[4]) + end + + -- высокий скальный контур закрывает горизонт и удерживает игроков в лобби + lobbyCliffs() + lobbyTrees() + lobbyRockPlants() + lobbyHills() + + -- магазин (запад) и скупка (восток) + stall(CFrame.lookAt(V(-62, FLOOR, 0), V(0, FLOOR, 0)), { + title = "🎣 УДОЧКИ И СНАРЯЖЕНИЕ", + titleColor = Color3.fromRGB(255, 230, 120), + wall = Color3.fromRGB(185, 130, 85), + stripeA = Color3.fromRGB(215, 55, 55), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(255, 170, 60), + action = "Shop", + promptText = "Открыть магазин", + promptObject = "Магазин", + npcName = "Продавец Михалыч", + npcColors = { skin = Color3.fromRGB(234, 184, 146), shirt = Color3.fromRGB(200, 60, 50), pants = Color3.fromRGB(60, 70, 100), hat = Color3.fromRGB(90, 110, 60) }, + decor = function(at) + -- витрина удочек на задней стене + for i, rod in ipairs(Config.Rods) do + local x = -8 + (i - 1) * 4 + local m = Models.buildRod(rod.id, 0, true) + m:PivotTo(at(x, 3, 7) * CFrame.Angles(math.rad(80), 0, 0)) + m.Parent = map + local plaque = P({ Size = V(3.6, 1.6, 0.2), CFrame = at(x, 11.7, 7.4), Material = Enum.Material.Wood, Color = Color3.fromRGB(60, 40, 25) }) + surfaceText(plaque, Enum.NormalId.Front, rod.name .. "\n" .. (rod.price > 0 and (rod.price .. " 💰") or "бесплатно"), Color3.fromRGB(255, 235, 180)) + end + end, + }) + + stall(CFrame.lookAt(V(62, FLOOR, 0), V(0, FLOOR, 0)), { + title = "💰 СКУПКА РЫБЫ", + titleColor = Color3.fromRGB(150, 255, 160), + wall = Color3.fromRGB(110, 150, 175), + stripeA = Color3.fromRGB(50, 150, 80), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(80, 230, 120), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщица Зина", + npcColors = { skin = Color3.fromRGB(240, 195, 160), shirt = Color3.fromRGB(60, 120, 170), pants = Color3.fromRGB(50, 50, 60), hat = Color3.fromRGB(230, 230, 230) }, + decor = function(at) + -- лёд с рыбой на прилавке + P({ Size = V(10, 0.4, 3), CFrame = at(-3, 5.7, -4), Material = Enum.Material.Glass, Color = Color3.fromRGB(200, 235, 255), Transparency = 0.2 }) + for i, id in ipairs({ "Karas", "Okun", "Shuka" }) do + local f = Models.buildFish(id, nil, 0.9, true) + f:PivotTo(at(-6.5 + i * 2.5, 6.2, -4) * CFrame.Angles(math.rad(90), 0, math.rad(90))) + f.Parent = map + end + -- весы + P({ Size = V(2, 0.5, 2), CFrame = at(6, 5.75, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) }) + P({ Size = V(0.3, 1.4, 0.3), CFrame = at(6, 6.7, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 2.4, 2.4), CFrame = at(6, 7.45, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(200, 200, 205) }) + -- ящики с уловом + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(3, 2, 3), CFrame = at(s * 14.5, 2, 2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) }) + local f = Models.buildFish(s < 0 and "Lesh" or "Sudak", nil, 0.7, true) + f:PivotTo(at(s * 14.5, 3.3, 2) * CFrame.Angles(math.rad(90), 0, 0)) + f.Parent = map + end + end, + }) + + -- арка с названием + arch(CFrame.lookAt(V(0, FLOOR, -66), V(0, FLOOR, 0)), 84, 24, "🎣 " .. string.upper(Config.GameName) .. " 🎣", Color3.fromRGB(255, 190, 60)) + + -- порталы по кругу у фонтана, лицом наружу; первый (бесплатный) мир — прямо перед точкой появления + local PORTAL_R = 19 + for i, w in ipairs(Config.Worlds) do + local title = w.icon .. " " .. w.name .. (w.level > 1 and (" (ур. " .. w.level .. ")") or "") + local a = math.rad(90 - (i - 1) * 90) -- 90° = сторона спавна (+Z) + local pos = V(math.cos(a) * PORTAL_R, FLOOR, math.sin(a) * PORTAL_R) + local disc = portal(CFrame.lookAt(pos, V(pos.X * 2, FLOOR, pos.Z * 2)), title, w.color, w.id, w.soon) + if i == 1 then + disc:SetAttribute("GuideTarget", "Portal") + marker("GuidePortal", CFrame.new(pos.X * 1.3, FLOOR, pos.Z * 1.3)) -- точка перед порталом для линии-подсказки + end + end + + -- невидимая стена по кругу: из лобби не уйти + for deg = 0, 359, 5 do + local a = math.rad(deg) + local p = V(math.cos(a) * 86, 30, math.sin(a) * 86) + P({ Size = V(8, 60, 2), CFrame = CFrame.lookAt(p, V(0, 30, 0)), Transparency = 1, CanQuery = false }) + end + + -- донат-лавки + stall(CFrame.lookAt(V(41, FLOOR, 41), V(0, FLOOR, 0)), { + title = "💎 ПРЕМИУМ", + titleColor = Color3.fromRGB(255, 220, 120), + wall = Color3.fromRGB(120, 70, 170), + stripeA = Color3.fromRGB(255, 200, 60), + stripeB = Color3.fromRGB(150, 80, 210), + glow = Color3.fromRGB(255, 200, 60), + action = "RobuxPasses", + promptText = "Открыть", + promptObject = "Премиум-пропуска", + npcName = "Барон Злотов", + npcColors = { skin = Color3.fromRGB(230, 185, 150), shirt = Color3.fromRGB(110, 40, 140), pants = Color3.fromRGB(30, 30, 40), hat = Color3.fromRGB(255, 200, 60) }, + decor = function(at) + -- сундук с самоцветами + P({ Size = V(4, 2, 2.5), CFrame = at(-5, 6.5, -4), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(120, 75, 40) }) + P({ Size = V(4.2, 0.4, 2.7), CFrame = at(-5, 7.6, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) }) + for i, c in ipairs({ Color3.fromRGB(255, 60, 90), Color3.fromRGB(80, 200, 255), Color3.fromRGB(120, 255, 120), Color3.fromRGB(200, 100, 255) }) do + P({ Size = V(0.7, 0.7, 0.7), CFrame = at(-6.5 + i * 0.75, 8.1, -4) * CFrame.Angles(0.6, i, 0.6), Material = Enum.Material.Neon, Color = c }) + end + P({ Size = V(3, 4, 0.3), CFrame = at(5, 7.5, -4.8), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 200, 60) }) + end, + }) + stall(CFrame.lookAt(V(-41, FLOOR, 41), V(0, FLOOR, 0)), { + title = "🪙 СОКРОВИЩНИЦА", + titleColor = Color3.fromRGB(255, 235, 140), + wall = Color3.fromRGB(200, 160, 70), + stripeA = Color3.fromRGB(230, 180, 40), + stripeB = Color3.fromRGB(255, 250, 230), + glow = Color3.fromRGB(255, 220, 90), + action = "RobuxProducts", + promptText = "Открыть", + promptObject = "Наборы монет", + npcName = "Купчиха Злата", + npcColors = { skin = Color3.fromRGB(240, 200, 165), shirt = Color3.fromRGB(220, 170, 50), pants = Color3.fromRGB(90, 50, 30), hat = Color3.fromRGB(180, 40, 40) }, + decor = function(at) + -- горки монет + for i = 0, 4 do + for j = 0, 3 - (i % 3) do + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 0.9, 0.9), CFrame = at(-7 + i * 1.2, 5.6 + j * 0.2, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 205, 60) }) + end + end + for _, s in ipairs({ -1, 1 }) do + ball(at(s * 14.5, 2.2, 2).Position, 2.6, { Color = Color3.fromRGB(190, 160, 110), Material = Enum.Material.Fabric }) + ball(at(s * 14.5, 3.5, 2).Position, 1.2, { Color = Color3.fromRGB(255, 205, 60), Material = Enum.Material.Metal }) + end + end, + }) + + -- сундук с ежедневной наградой + do + local cf = CFrame.lookAt(V(14, FLOOR, 34), V(0, FLOOR, 50)) + local base = P({ Size = V(5, 3, 3.2), CFrame = cf * CFrame.new(0, 1.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 90, 50) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 3.2, 3.2), CFrame = cf * CFrame.new(0, 3, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 105, 60) }) + for _, x in ipairs({ -1.8, 1.8 }) do + P({ Size = V(0.4, 4.9, 3.4), CFrame = cf * CFrame.new(x, 2.3, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) }) + end + P({ Size = V(0.9, 1.1, 0.3), CFrame = cf * CFrame.new(0, 2.8, -1.7), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 220, 90) }) + local sp = Instance.new("ParticleEmitter") + sp.Texture = "rbxasset://textures/particles/sparkles_main.dds" + sp.Rate = 8 + sp.LightEmission = 1 + sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90)) + sp.Size = NumberSequence.new(0.5, 0) + sp.Parent = base + billboard(base, "🎁 Ежедневная награда", Color3.fromRGB(255, 220, 120), 5, 260) + prompt(base, "Забрать", "Сундук", "Daily", 12) + end + + -- табличка «Как играть» + do + -- слева от дорожки за точкой появления, лицом к камере игрока; фонарь — за табличкой + local pos = V(-12, FLOOR, 48) + local cf = CFrame.lookAt(pos, V(0, FLOOR, 64)) + lamp((cf * CFrame.new(0, 0, 2.5)).Position) + marker("GuideBoard", cf * CFrame.new(0, 0, -6)) -- перед табличкой, для линии-подсказки + for _, x in ipairs({ -6.5, 6.5 }) do + P({ Size = V(0.8, 9, 0.8), CFrame = cf * CFrame.new(x, 4.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Size = V(14, 8, 0.5), CFrame = cf * CFrame.new(0, 6, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + board:SetAttribute("GuideTarget", "Board") -- подсвечивается на шаге обучения + surfaceText(board, Enum.NormalId.Front, + "КАК ИГРАТЬ\n1. Портал «Мир 1» или кнопка 🌍 Миры\n2. Удочка — клавиша 1, у воды зажми ЛКМ и отпусти\n3. Клюёт → кликай в зелёную зону\n4. 🎒 Сумка — B, 📜 Задания — Q\n5. Собирай коллекцию — получай награды!", + Color3.fromRGB(255, 245, 225), { TextXAlignment = Enum.TextXAlignment.Left }) + end + + ---------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО + do + -- отдельно собранное раньше «Тихое озеро» (Workspace.World1Map) переносим в карту, иначе строим заново + local w1map = world1Prebuilt or World1Builder.build(map, Builder.portalModel) + w1map.Parent = map + local baitShop = not world1Prebuilt and w1map:FindFirstChild("BaitShop", true) + if baitShop then + Builder.lowPolyParts(baitShop:GetDescendants(), baitShop:GetPivot(), 11) + end + -- NPC встают на маркеры — их можно двигать в Studio + local seller = w1map:FindFirstChild("World1NpcSeller", true) + if seller and not seller:GetAttribute("NpcName") then + setNpc(seller, "Скупщик Гриша", { + skin = Color3.fromRGB(234, 190, 150), shirt = Color3.fromRGB(236, 228, 210), + pants = Color3.fromRGB(70, 110, 76), hat = Color3.fromRGB(226, 196, 122), + }) + end + local grandpa = w1map:FindFirstChild("World1NpcGrandpa", true) + if grandpa and not grandpa:GetAttribute("NpcName") then + setNpc(grandpa, "Дед Петрович", { + skin = Color3.fromRGB(225, 175, 140), shirt = Color3.fromRGB(110, 120, 80), pants = Color3.fromRGB(70, 60, 45), hat = Color3.fromRGB(90, 110, 60), + }, "Talk", "Поговорить") + end + local board = w1map:FindFirstChild("World1Bestiary", true) + if board and not board:GetAttribute("Bestiary") then + setBestiary(board, "World1", "🐟 КТО ВОДИТСЯ В ОЗЕРЕ", "#9BE7FF") + end + end + + -- причал (используется в Мире 2): настил и сваи; возвращает настил + local function pier(center, size) + local deck = P({ Size = size, Position = center, Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) }) + local alongZ = size.Z > size.X + local len = alongZ and size.Z or size.X + local wid = alongZ and size.X or size.Z + for d = -len / 2 + 1, len / 2 - 1, 6 do + for _, s in ipairs({ -1, 1 }) do + local off = alongZ and V(s * (wid / 2 - 0.4), 0, d) or V(d, 0, s * (wid / 2 - 0.4)) + vcyl(center + off + V(0, -6, 0), 13, 0.9, { Color = Color3.fromRGB(100, 70, 45), Material = Enum.Material.Wood }) + end + end + return deck + end + + ---------------------------------------------------------------- помощники для новых миров + + local function cylA(a, b, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(math.max(0.05, (b - a).Magnitude), d, d) + props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0) + return P(props) + end + + local function worldWalls(center) + for _, w in ipairs({ + { V(0, 0, 245), V(500, 160, 2) }, + { V(0, 0, -245), V(500, 160, 2) }, + { V(245, 0, 0), V(2, 160, 500) }, + { V(-245, 0, 0), V(2, 160, 500) }, + }) do + P({ Size = w[2], Position = center + w[1] + V(0, 60, 0), Transparency = 1, CanQuery = false }) + end + end + + local function bestiary(pos, lookAt, worldId, title, titleHex) + local cf = CFrame.lookAt(pos, lookAt) + for _, x in ipairs({ -6, 6 }) do + P({ Size = V(0.8, 11, 0.8), CFrame = cf * CFrame.new(x, 5.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Name = worldId .. "Bestiary", Size = V(13, 10, 0.5), CFrame = cf * CFrame.new(0, 7, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + setBestiary(board, worldId, title, titleHex) + end + + local function campfire(c) + for i = 0, 7 do + local a = i / 8 * math.pi * 2 + ball(c + V(math.cos(a) * 2.2, 0.3, math.sin(a) * 2.2), 1, { Color = Color3.fromRGB(120, 120, 125), Material = Enum.Material.Rock }) + end + for i = 0, 2 do + P({ Shape = Enum.PartType.Cylinder, Size = V(3, 0.6, 0.6), CFrame = CFrame.new(c + V(0, 0.4, 0)) * CFrame.Angles(0, i * math.pi / 3, 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 35) }) + end + local base = P({ Size = V(1, 1, 1), Position = c + V(0, 0.8, 0), Transparency = 1, CanCollide = false }) + local fire = Instance.new("Fire") + fire.Size = 5 + fire.Heat = 9 + fire.Parent = base + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 160, 80) + light.Range = 20 + light.Brightness = 2 + light.Parent = base + end + + local function torch(pos) + cylA(pos, pos + V(0, 5, 0), 0.35, { Color = Color3.fromRGB(170, 130, 70), Material = Enum.Material.Wood }) + local top = P({ Size = V(0.8, 0.8, 0.8), Position = pos + V(0, 5.3, 0), Color = Color3.fromRGB(90, 60, 30), Material = Enum.Material.Wood }) + local fire = Instance.new("Fire") + fire.Size = 3 + fire.Heat = 6 + fire.Parent = top + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 170, 90) + light.Range = 14 + light.Parent = top + end + + ---------------------------------------------------------------- МИР 2: ТРОПИЧЕСКИЙ ОСТРОВ + + do + local W2 = Config.Worlds[2].center + local leafColors = { Color3.fromRGB(60, 160, 60), Color3.fromRGB(85, 185, 70) } + + -- море, мелководье уступами, песчаный пляж, зелёный остров, холм + terrain:FillBlock(CFrame.new(W2 + V(0, -34, 0)), V(520, 8, 520), Enum.Material.Sand) + terrain:FillBlock(CFrame.new(W2 + V(0, -15, 0)), V(520, 30, 520), Enum.Material.Water) + terrain:FillCylinder(CFrame.new(W2 + V(0, -17, 0)), 28, 140, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -15, 0)), 32, 118, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -14, 0)), 34, 106, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -13.5, 0)), 35, 88, Enum.Material.Grass) + terrain:FillBall(W2 + V(20, -20, -30), 32, Enum.Material.Grass) + terrain:FillCylinder(CFrame.new(W2 + V(0, 2, 40)), 4, 14, Enum.Material.Sandstone) + + local function palm(pos) + local h = rng:NextNumber(12, 18) + local a = rng:NextNumber(0, math.pi * 2) + local dir = V(math.cos(a), 0, math.sin(a)) + local p = pos + for i = 1, 6 do + local t = i / 6 + local q = pos + V(0, h * t, 0) + dir * (t * t * h * 0.3) + local d = 1.4 - t * 0.45 + cylA(p, q, d, { Color = Color3.fromRGB(150, 115, 70), Material = Enum.Material.Wood }) + ball(q, d, { Color = Color3.fromRGB(130, 100, 60), Material = Enum.Material.Wood }) + p = q + end + for k = 0, 7 do + local b = k / 8 * math.pi * 2 + rng:NextNumber(-0.2, 0.2) + local ld = V(math.cos(b), 0, math.sin(b)) + local mid = p + ld * 3.5 + V(0, 0.8, 0) + local tipP = p + ld * 7 + V(0, -2.2, 0) + for _, seg in ipairs({ { p, mid }, { mid, tipP } }) do + P({ Size = V(2, 0.15, (seg[2] - seg[1]).Magnitude), CFrame = CFrame.lookAt((seg[1] + seg[2]) / 2, seg[2]), Material = Enum.Material.Grass, Color = leafColors[k % 2 + 1], CanCollide = false }) + end + end + for _ = 1, 3 do + ball(p + V(rng:NextNumber(-0.7, 0.7), -0.7, rng:NextNumber(-0.7, 0.7)), 0.9, { Color = Color3.fromRGB(110, 75, 40) }) + end + end + + local function tikiHut(pos, look) + local cf = CFrame.lookAt(pos, look) + P({ Size = V(12, 1, 12), CFrame = cf * CFrame.new(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 120, 75) }) + for _, c in ipairs({ { -5, -5 }, { 5, -5 }, { -5, 5 }, { 5, 5 } }) do + vcyl((cf * CFrame.new(c[1], 4.5, c[2])).Position, 8, 0.8, { Color = Color3.fromRGB(200, 175, 100), Material = Enum.Material.Wood }) + end + for i = 0, 4 do + vcyl((cf * CFrame.new(0, 8.8 + i * 1.2, 0)).Position, 1.4, 16 - i * 3.2, { Color = Color3.fromRGB(205, 170, 95), Material = Enum.Material.Grass }) + end + local bar = P({ Size = V(7, 3, 1.5), CFrame = cf * CFrame.new(0, 2.5, -3), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 95, 55) }) + billboard(bar, "🍹", Color3.new(1, 1, 1), 3, 60) + end + + local function umbrella(pos, color) + cylA(pos, pos + V(0, 7, 0), 0.25, { Color = Color3.fromRGB(235, 235, 235), Material = Enum.Material.Metal }) + vcyl(pos + V(0, 7, 0), 0.6, 9, { Color = color, Material = Enum.Material.Fabric }) + vcyl(pos + V(0, 7.5, 0), 0.6, 4.5, { Color = Color3.new(1, 1, 1), Material = Enum.Material.Fabric }) + P({ Size = V(2.2, 0.5, 6), CFrame = CFrame.new(pos + V(3.5, 0.6, 0)) * CFrame.Angles(0, rng:NextNumber(-0.5, 0.5), 0), Color = Color3.fromRGB(245, 245, 240), Material = Enum.Material.Fabric }) + P({ Size = V(2.25, 0.52, 1.2), CFrame = CFrame.new(pos + V(3.5, 0.62, 1.5)), Color = color, Material = Enum.Material.Fabric }) + end + + local coralColors = { Color3.fromRGB(255, 110, 150), Color3.fromRGB(255, 150, 60), Color3.fromRGB(170, 90, 255), Color3.fromRGB(255, 220, 80), Color3.fromRGB(80, 220, 200) } + local function coral(pos) + local c = coralColors[rng:NextInteger(1, #coralColors)] + for _ = 1, rng:NextInteger(3, 5) do + local dir = V(rng:NextNumber(-0.5, 0.5), 1, rng:NextNumber(-0.5, 0.5)).Unit + local h = rng:NextNumber(1.5, 3.5) + cylA(pos, pos + dir * h, 0.45, { Color = c, CanCollide = false }) + ball(pos + dir * h, 0.75, { Color = c:Lerp(Color3.new(1, 1, 1), 0.3), CanCollide = false }) + end + end + + local function starfish(pos) + local c = Color3.fromRGB(255, rng:NextInteger(90, 150), 60) + ball(pos, 0.7, { Color = c, CanCollide = false }) + for k = 0, 4 do + local a = k / 5 * math.pi * 2 + P({ Size = V(0.35, 0.2, 1.1), CFrame = CFrame.new(pos) * CFrame.Angles(0, a, 0) * CFrame.new(0, 0, -0.6), Color = c, CanCollide = false }) + end + end + + local spawn2 = W2 + V(0, 4, 40) + marker("World2Spawn", CFrame.lookAt(spawn2 + V(0, 1, 0), spawn2 + V(0, 1, -10))) + arch(CFrame.new(W2 + V(0, 4, 24)), 14, 11, "🏝 ТРОПИЧЕСКИЙ ОСТРОВ", Color3.fromRGB(255, 190, 70)) + portal(CFrame.lookAt(W2 + V(-32, 4, 60), spawn2), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") + stall(CFrame.lookAt(W2 + V(32, 4, 62), spawn2), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(150, 255, 220), + wall = Color3.fromRGB(200, 170, 110), + stripeA = Color3.fromRGB(40, 180, 170), + stripeB = Color3.fromRGB(255, 250, 230), + glow = Color3.fromRGB(80, 230, 200), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщик Мигель", + npcColors = { skin = Color3.fromRGB(190, 140, 100), shirt = Color3.fromRGB(240, 120, 60), pants = Color3.fromRGB(240, 230, 200), hat = Color3.fromRGB(230, 210, 150) }, + }) + bestiary(W2 + V(-18, 4, 22), spawn2, "World2", "🐠 КТО ВОДИТСЯ У ОСТРОВА", "#FFD27A") + npc("Капитан Боря", CFrame.lookAt(W2 + V(10, 6, 100), W2 + V(0, 6, 120)), { + skin = Color3.fromRGB(225, 175, 140), shirt = Color3.fromRGB(240, 240, 240), pants = Color3.fromRGB(30, 40, 80), hat = Color3.fromRGB(30, 30, 60), + }, "Talk", "Поговорить") + + pier(W2 + V(0, 3.2, 125), V(8, 0.6, 50)) + pier(W2 + V(125, 3.2, -10), V(50, 0.6, 8)) + for _, z in ipairs({ 105, 125, 145 }) do + torch(W2 + V(4.5, 3.5, z)) + end + for _, x in ipairs({ 110, 140 }) do + torch(W2 + V(x, 3.5, -14.5)) + end + tikiHut(W2 + V(-50, groundY(W2.X - 50, W2.Z - 20), -20), W2) + tikiHut(W2 + V(-20, groundY(W2.X - 20, W2.Z - 65), -65), W2) + campfire(W2 + V(-10, 4, 55)) + for _, deg in ipairs({ 200, 222, 318, 340 }) do + local a = math.rad(deg) + local x, z = math.cos(a) * 99, math.sin(a) * 99 + umbrella(W2 + V(x, groundY(W2.X + x, W2.Z + z), z), coralColors[rng:NextInteger(1, #coralColors)]) + end + + local function free2(x, z) + local r = math.sqrt(x * x + z * z) + if r > 100 then + return false + end + if (V(x, 0, z) - V(0, 0, 45)).Magnitude < 28 then + return false + end + for _, p in ipairs({ { 32, 62 }, { -32, 60 }, { -50, -20 }, { -20, -65 }, { -18, 22 }, { -10, 55 } }) do + if (V(x, 0, z) - V(p[1], 0, p[2])).Magnitude < 16 then + return false + end + end + return true + end + local count = 0 + for _ = 1, 300 do + if count >= 40 then + break + end + local x, z = rng:NextNumber(-100, 100), rng:NextNumber(-100, 100) + if free2(x, z) then + palm(W2 + V(x, groundY(W2.X + x, W2.Z + z) - 0.5, z)) + count += 1 + end + end + for _ = 1, 35 do + local a = rng:NextNumber(0, math.pi * 2) + local r = rng:NextNumber(121, 138) + local x, z = math.cos(a) * r, math.sin(a) * r + if not (math.abs(x) < 8 and z > 0) and not (math.abs(z + 10) < 8 and x > 0) then + coral(W2 + V(x, groundY(W2.X + x, W2.Z + z) - 0.3, z)) + end + end + for _ = 1, 12 do + local a = rng:NextNumber(0, math.pi * 2) + local r = rng:NextNumber(107, 115) + local x, z = math.cos(a) * r, math.sin(a) * r + starfish(W2 + V(x, groundY(W2.X + x, W2.Z + z) + 0.1, z)) + end + worldWalls(W2) + end + + ---------------------------------------------------------------- МИР 3: ЛЕДЯНОЙ ФЬОРД + + do + local W3 = Config.Worlds[3].center + local LAKES3 = Config.Worlds[3].lakes + local HOLES = Config.Worlds[3].holes + + terrain:FillBlock(CFrame.new(W3 + V(0, -10, 0)), V(500, 28, 500), Enum.Material.Snow) + for i = 0, 13 do + local a = i / 14 * math.pi * 2 + local r = rng:NextNumber(215, 235) + local rad = rng:NextNumber(50, 70) + local c = W3 + V(math.cos(a) * r, -15, math.sin(a) * r) + terrain:FillBall(c, rad, Enum.Material.Rock) + terrain:FillBall(c + V(0, rad * 0.35, 0), rad * 0.7, Enum.Material.Snow) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], 16, l[2])), 30, l[3] + 4, Enum.Material.Air) + end + -- вода не вытесняет снег и лёд, поэтому место под неё сначала вырезаем воздухом + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -19, l[2])), 10, l[3], Enum.Material.Mud) + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -7, l[2])), 14, l[3], Enum.Material.Air) + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -7, l[2])), 14, l[3], Enum.Material.Water) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -1, l[2])), 4, l[3], Enum.Material.Glacier) + end + -- лунки режем прямо по вокселям: тонкая заливка в 4 стада не перекрывает ячейку льда целиком + local holeR = Config.Worlds[3].holeRadius or 6 + local waterY3 = Config.Worlds[3].waterY + for _, h in ipairs(HOLES) do + local c = W3 + V(h[1], 0, h[2]) + local region = Region3.new(c + V(-holeR, -12, -holeR), c + V(holeR, 8, holeR)):ExpandToGrid(4) + local mats, occ = terrain:ReadVoxels(region, 4) + local corner = region.CFrame.Position - region.Size / 2 + for x = 1, mats.Size.X do + for y = 1, mats.Size.Y do + for z = 1, mats.Size.Z do + local p = corner + V(x - 0.5, y - 0.5, z - 0.5) * 4 + if (V(p.X, 0, p.Z) - V(c.X, 0, c.Z)).Magnitude <= holeR then + local water = p.Y < waterY3 + mats[x][y][z] = water and Enum.Material.Water or Enum.Material.Air + occ[x][y][z] = water and 1 or 0 + end + end + end + end + terrain:WriteVoxels(region, 4, mats, occ) + end + + local function snowPine(pos) + local h = rng:NextNumber(8, 13) + vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(90, 62, 40), Material = Enum.Material.Wood }) + for i = 0, 3 do + local s = 10 - i * 2.2 + local y = h * 0.4 + i * 2.8 + ball(pos + V(0, y, 0), s, { Color = Color3.fromRGB(35, 85 + i * 8, 60), Material = Enum.Material.Grass }) + ball(pos + V(0, y + s * 0.3, 0), s * 0.75, { Color = Color3.fromRGB(240, 245, 255), Material = Enum.Material.Snow }) + end + end + + local function igloo(pos, look) + local cf = CFrame.lookAt(pos, look) + P({ Shape = Enum.PartType.Ball, Size = V(14, 14, 14), CFrame = cf, Material = Enum.Material.Snow, Color = Color3.fromRGB(240, 245, 255) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 5, 5), CFrame = cf * CFrame.new(0, 1.2, -7) * CFrame.Angles(0, math.rad(90), 0), Material = Enum.Material.Snow, Color = Color3.fromRGB(235, 240, 250) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 3.6, 3.6), CFrame = cf * CFrame.new(0, 1.2, -9.55) * CFrame.Angles(0, math.rad(90), 0), Color = Color3.fromRGB(20, 25, 35) }) + end + + local function tent(pos, look) + local cf = CFrame.lookAt(pos, look) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.2, 5, 6), CFrame = cf * CFrame.new(s * 1.6, 2.2, 0) * CFrame.Angles(0, 0, math.rad(s * 35)), Material = Enum.Material.Fabric, Color = Color3.fromRGB(230, 110, 40) }) + end + vcyl((cf * CFrame.new(0, 0.9, -4.5)).Position, 1.6, 1.4, { Color = Color3.fromRGB(110, 80, 50), Material = Enum.Material.Wood }) + end + + local function crystal(pos) + for _ = 1, 5 do + local h = rng:NextNumber(3, 8) + P({ + Size = V(1.2, h, 1.2), + CFrame = CFrame.new(pos + V(rng:NextNumber(-2, 2), h / 2 - 0.5, rng:NextNumber(-2, 2))) * CFrame.Angles(rng:NextNumber(-0.4, 0.4), rng:NextNumber(0, 3), rng:NextNumber(-0.4, 0.4)), + Material = Enum.Material.Neon, Color = Color3.fromRGB(140, 230, 255), Transparency = 0.15, + }) + end + end + + local function snowman(pos) + ball(pos + V(0, 2, 0), 4, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + ball(pos + V(0, 5, 0), 3, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + ball(pos + V(0, 7.3, 0), 2.2, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + cylA(pos + V(0, 7.3, -1), pos + V(0, 7.2, -2), 0.3, { Color = Color3.fromRGB(255, 130, 30) }) + for _, x in ipairs({ -0.4, 0.4 }) do + ball(pos + V(x, 7.7, -0.95), 0.3, { Color = Color3.fromRGB(20, 20, 20) }) + end + vcyl(pos + V(0, 8.6, 0), 1.2, 1.4, { Color = Color3.fromRGB(30, 30, 35) }) + vcyl(pos + V(0, 8.1, 0), 0.2, 2.2, { Color = Color3.fromRGB(30, 30, 35) }) + end + + -- лунки: льдинки по краю и флажки + for i, h in ipairs(HOLES) do + local c = W3 + V(h[1], 1.2, h[2]) + for k = 0, 7 do + local a = k / 8 * math.pi * 2 + P({ Size = V(1.2, 0.6, 1.2), CFrame = CFrame.new(c + V(math.cos(a) * 6.6, 0, math.sin(a) * 6.6)) * CFrame.Angles(0, a, 0.2), Material = Enum.Material.Ice, Color = Color3.fromRGB(200, 235, 255) }) + end + if i % 3 == 1 then + cylA(c + V(6, -0.2, 6), c + V(6, 4, 6), 0.15, { Color = Color3.fromRGB(80, 60, 40) }) + P({ Size = V(1.4, 0.9, 0.1), Position = c + V(6.75, 3.5, 6), Material = Enum.Material.Fabric, Color = Color3.fromRGB(220, 40, 40) }) + end + if i % 4 == 0 then + tent(c + V(-9, -0.2, 0), c) + end + end + + local spawn3 = W3 + V(0, 4, 120) + marker("World3Spawn", CFrame.lookAt(spawn3 + V(0, 1, 0), spawn3 + V(0, 1, -10))) + arch(CFrame.new(W3 + V(0, 4, 104)), 14, 11, "❄ ЛЕДЯНОЙ ФЬОРД", Color3.fromRGB(150, 220, 255)) + portal(CFrame.lookAt(W3 + V(-32, 4, 140), spawn3), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") + stall(CFrame.lookAt(W3 + V(32, 4, 138), spawn3), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(180, 230, 255), + wall = Color3.fromRGB(120, 95, 75), + stripeA = Color3.fromRGB(60, 120, 200), + stripeB = Color3.fromRGB(245, 250, 255), + glow = Color3.fromRGB(140, 210, 255), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщица Нина", + npcColors = { skin = Color3.fromRGB(240, 205, 175), shirt = Color3.fromRGB(180, 40, 50), pants = Color3.fromRGB(40, 40, 60), hat = Color3.fromRGB(240, 240, 250) }, + }) + bestiary(W3 + V(-20, 4, 100), spawn3, "World3", "❄ КТО ВОДИТСЯ ПОДО ЛЬДОМ", "#BFEAFF") + npc("Полярник Саша", CFrame.lookAt(W3 + V(12, 7, 88), W3 + V(0, 7, 60)), { + skin = Color3.fromRGB(230, 190, 160), shirt = Color3.fromRGB(230, 120, 30), pants = Color3.fromRGB(50, 55, 70), hat = Color3.fromRGB(200, 40, 40), + }, "Talk", "Поговорить") + igloo(W3 + V(-45, 4, 95), W3 + V(0, 4, 110)) + campfire(W3 + V(20, 4, 108)) + snowman(W3 + V(42, 4, 100)) + for _, p in ipairs({ { -85, -45 }, { 90, 30 }, { -25, -110 }, { 70, -90 }, { -95, 60 } }) do + crystal(W3 + V(p[1], groundY(W3.X + p[1], W3.Z + p[2]), p[2])) + end + + local function free3(x, z) + for _, l in ipairs(LAKES3) do + if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + 12 then + return false + end + end + if (V(x, 0, z) - V(0, 0, 120)).Magnitude < 40 then + return false + end + if (V(x, 0, z) - V(-45, 0, 95)).Magnitude < 14 then + return false + end + return true + end + local count = 0 + for _ = 1, 400 do + if count >= 80 then + break + end + local x, z = rng:NextNumber(-200, 200), rng:NextNumber(-200, 200) + if free3(x, z) then + snowPine(W3 + V(x, groundY(W3.X + x, W3.Z + z) - 0.5, z)) + count += 1 + end + end + + -- северное сияние + for i = 0, 7 do + P({ + Size = V(55, 26, 0.6), + CFrame = CFrame.new(W3 + V(-175 + i * 50, 150 + math.sin(i * 1.3) * 10, -150 + math.cos(i * 0.9) * 25)) * CFrame.Angles(math.rad(10), math.rad(i * 8 - 28), 0), + Material = Enum.Material.Neon, + Color = (i % 3 == 0) and Color3.fromRGB(170, 90, 255) or Color3.fromRGB(80, 255, 170), + Transparency = 0.6, CanCollide = false, CanQuery = false, CastShadow = false, + }) + end + worldWalls(W3) + end + + ---------------------------------------------------------------- проверка воды + -- Если вода в террейне не создалась (бывает в некоторых плейсах/настройках), + -- ставим поверхность воды из деталей, чтобы озёра и море точно были видны. + + local function terrainHasWater(pos) + local region = Region3.new(pos - V(2, 2, 2), pos + V(2, 2, 2)):ExpandToGrid(4) + local ok, mats = pcall(function() + return terrain:ReadVoxels(region, 4) + end) + if not ok then + return true + end + for _, plane in ipairs(mats) do + for _, column in ipairs(plane) do + for _, m in ipairs(column) do + if m == Enum.Material.Water then + return true + end + end + end + end + return false + end + + local function waterPlane(pos, diameter, color) + return P({ + Name = "WaterSurface", + Shape = Enum.PartType.Cylinder, + Size = V(0.4, diameter, diameter), + CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)), + Color = color, + Material = Enum.Material.SmoothPlastic, + Reflectance = 0.08, + CanCollide = false, + CanQuery = false, + CanTouch = false, + CastShadow = false, + }) + end + + do + local w1, w2, w3 = Config.Worlds[1], Config.Worlds[2], Config.Worlds[3] + -- Мир 1: каждое озеро; нет воды — заливаем ещё раз, не помогло — поверхность из деталей. + -- Повторяем через несколько секунд на случай, если террейн перезаписал другой скрипт. + local planes = {} + -- материал вокселя (читаем воксели, а не лучом: физика террейна обновляется с задержкой) + local function voxelAt(pos) + local region = Region3.new(pos - V(1, 1, 1), pos + V(1, 1, 1)):ExpandToGrid(4) + local ok, mats = pcall(function() + return terrain:ReadVoxels(region, 4) + end) + return ok and mats[1] and mats[1][1] and mats[1][1][1] or nil + end + -- в центре озера: под поверхностью вода, над ней пусто + local function lakeState(l) + local c = w1.center + V(l[1], w1.waterY, l[2]) + return voxelAt(c - V(0, 2, 0)), voxelAt(c + V(0, 2, 0)) + end + local function lakeOk(below, above) + return below == nil or (below == Enum.Material.Water and above == Enum.Material.Air) + end + local function ensureLakeWater() + for i, l in ipairs(w1.lakes) do + local below, above = lakeState(l) + if not planes[i] and not lakeOk(below, above) then + warn(("[MapBuilder] Озеро %d Мира 1: под водой %s, над водой %s — заливаю заново"):format(i, tostring(below), tostring(above))) + World1Builder.carveLake(l) + below, above = lakeState(l) + if not lakeOk(below, above) then + warn(("[MapBuilder] Озеро %d Мира 1: всё ещё %s / %s — ставлю запасную поверхность воды"):format(i, tostring(below), tostring(above))) + planes[i] = waterPlane(w1.center + V(l[1], w1.waterY + 0.05, l[2]), l[3] * 2, Color3.fromRGB(30, 120, 150)) + end + end + end + end + -- уровень, собранный и поправленный руками в Studio, не трогаем: озеро там могли поменять намеренно + if not world1Prebuilt then + ensureLakeWater() + if RunService:IsRunning() then + task.delay(5, ensureLakeWater) + end + end + if not terrainHasWater(w2.center + V(180, -4, 0)) then + warn("[MapBuilder] Вода в террейне Мира 2 не создалась — ставлю запасную поверхность воды") + waterPlane(w2.center + V(0, w2.waterY, 0), 500, Color3.fromRGB(40, 180, 190)) + end + local h = w3.holes[1] + if not terrainHasWater(w3.center + V(h[1], -1, h[2])) then + warn("[MapBuilder] Вода в лунках Мира 3 не создалась — ставлю запасную поверхность воды") + for _, hole in ipairs(w3.holes) do + waterPlane(w3.center + V(hole[1], w3.waterY + 0.05, hole[2]), w3.holeRadius * 2, Color3.fromRGB(25, 75, 110)) + end + end + end + + map.Parent = Workspace + return map +end + +---------------------------------------------------------------- сборка в Studio + +function Builder.bake() + assert(not RunService:IsRunning(), "Собирайте карту в режиме редактирования, а не во время Play") + local old = Workspace:FindFirstChild("FishingMap") + if old then + -- «Тихое озеро» правят руками: переносим его в новую карту как есть (чтобы собрать заново — удалите World1Map) + local w1 = old:FindFirstChild("World1Map") + if w1 then + w1.Parent = Workspace + end + old:Destroy() + end + -- собранное раньше «Тихое озеро» (Workspace.World1Map) сохраняем вместе с его террейном + local keepWorld1 = Workspace:FindFirstChild("World1Map") ~= nil + for i = 1, 3 do + if i ~= 1 or not keepWorld1 then + terrain:FillBlock(CFrame.new(Config.Worlds[i].center + V(0, 30, 0)), V(680, 260, 680), Enum.Material.Air) + end + end + Builder.applyLighting() + local built = Builder.build() + print(("✅ Карта собрана: Workspace.FishingMap, деталей: %d. Сохраните плейс (Ctrl+S)."):format(#built:GetDescendants())) + return built +end + +---------------------------------------------------------------- при запуске игры + +local function spawnNpc(spot, parent) + local function color(name, default) + return spot:GetAttribute(name) or default + end + local name = spot:GetAttribute("NpcName") + local colors = { + skin = color("SkinColor", Color3.fromRGB(234, 184, 146)), + shirt = color("ShirtColor", Color3.fromRGB(200, 60, 50)), + pants = color("PantsColor", Color3.fromRGB(60, 70, 100)), + hat = color("HatColor", Color3.fromRGB(90, 110, 60)), + } + local ok, rig = pcall(function() + local d = Instance.new("HumanoidDescription") + d.HeadColor = colors.skin + d.LeftArmColor = colors.skin + d.RightArmColor = colors.skin + d.TorsoColor = colors.shirt + d.LeftLegColor = colors.pants + d.RightLegColor = colors.pants + return Players:CreateHumanoidModelFromDescription(d, Enum.HumanoidRigType.R15) + end) + if not ok or not rig then + warn("NPC не создан: " .. tostring(rig)) + return nil + end + rig.Name = name + local hum = rig:FindFirstChildOfClass("Humanoid") + hum.DisplayName = name + hum.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff + hum.NameDisplayDistance = 60 + local root = rig:FindFirstChild("HumanoidRootPart") + root.Anchored = true + rig:PivotTo(spot.CFrame) + rig.Parent = parent + + local head = rig:FindFirstChild("Head") + if head then + if not head:FindFirstChildOfClass("Decal") then + local face = Instance.new("Decal") + face.Name = "face" + face.Texture = "rbxasset://textures/face.png" + face.Parent = head + end + -- панама рыбака + local function hatPart(size, offset, shape) + local p = Instance.new("Part") + p.Shape = shape + p.Size = size + p.CanCollide = false + p.Massless = true + p.Color = colors.hat + p.Material = Enum.Material.Fabric + p.CFrame = head.CFrame * offset + local w = Instance.new("Weld") + w.Part0 = head + w.Part1 = p + w.C0 = head.CFrame:Inverse() * p.CFrame + w.Parent = p + p.Parent = rig + end + hatPart(V(0.15, 2.0, 2.0), CFrame.new(0, 0.55, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder) + hatPart(V(0.6, 1.35, 1.35), CFrame.new(0, 0.85, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder) + end + local action = spot:GetAttribute("NpcAction") + if action then + prompt(root, spot:GetAttribute("NpcActionText") or "Поговорить", name, action, 14) + end + return rig +end + +-- NPC встают на свои детали-места, доски «кто водится» получают актуальный список рыб +function Builder.prepareRuntime(root) + local spots, boards = {}, {} + for _, d in ipairs(root:GetDescendants()) do + if d:IsA("BasePart") then + if d:GetAttribute("NpcName") then + table.insert(spots, d) + elseif d:GetAttribute("Bestiary") then + table.insert(boards, d) + end + end + end + for _, spot in ipairs(spots) do + spot.Transparency = 1 + spawnNpc(spot, root) + end + for _, board in ipairs(boards) do + writeBestiary(board) + end +end + +return Builder +]]> + diff --git a/install/8_Loading_ReplicatedFirst.rbxmx b/install/8_Loading_ReplicatedFirst.rbxmx new file mode 100644 index 0000000..ad71606 --- /dev/null +++ b/install/8_Loading_ReplicatedFirst.rbxmx @@ -0,0 +1,165 @@ + +Loading ReplicatedFirst +-- Экран загрузки. Закрывает картинку при входе в игру и при каждом телепорте: игрок уже стоит на месте, +-- сцена прогружается, клиент ставит свет локации — и только потом экран плавно уходит. +-- +-- FishingClient управляет экраном через атрибуты ScreenGui «LoadingScreen»: +-- Visible = true — показать (при телепорте); +-- Ready = true — свет и террейн локации выставлены; +-- StartAt / MinUntil — os.clock() начала и минимального конца показа (полоска заполняется за это время); +-- Title — подпись под названием игры (куда идём). +-- Экран уходит, когда Ready = true и минимальное время прошло. + +local Players = game:GetService("Players") +local ReplicatedFirst = game:GetService("ReplicatedFirst") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local TweenService = game:GetService("TweenService") + +local player = Players.LocalPlayer +pcall(function() ReplicatedFirst:RemoveDefaultLoadingScreen() end) + +local GOLD = Color3.fromRGB(255, 205, 90) +local TIPS = { + "Чем реже рыба, тем быстрее бегает метка — нужна точность!", + "Улучшай удочку в магазине: рыба клюёт быстрее, удача выше.", + "Собери все виды одной редкости — получишь награду в коллекции (C).", + "Каждый день заходи за наградой из сундука в лобби.", + "Новые миры открываются с уровнем: следи за опытом!", +} + +local function new(class, props) + local o = Instance.new(class) + for k, v in pairs(props) do + if k ~= "Parent" then + o[k] = v + end + end + o.Parent = props.Parent + return o +end + +local gui = new("ScreenGui", { + Name = "LoadingScreen", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 200, + ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = player:WaitForChild("PlayerGui"), +}) +-- фон: арт лобби (временная заглушка); пока картинка грузится, виден тёплый закатный градиент +local BG_IMAGE = "rbxassetid://118616665961176" +local root = new("CanvasGroup", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.fromRGB(255, 190, 120), BorderSizePixel = 0, Parent = gui }) +new("UIGradient", { + Rotation = 90, + Color = ColorSequence.new(Color3.fromRGB(120, 200, 255), Color3.fromRGB(255, 170, 110)), + Parent = root, +}) +local bg = new("ImageLabel", { + Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, Image = BG_IMAGE, + ScaleType = Enum.ScaleType.Crop, Parent = root, +}) +task.spawn(function() + pcall(function() game:GetService("ContentProvider"):PreloadAsync({ bg }) end) +end) + +-- плашка снизу: куда идём, полоска загрузки, совет +local panel = new("Frame", { + AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -28), Size = UDim2.fromOffset(560, 118), + BackgroundColor3 = Color3.fromRGB(70, 40, 22), BackgroundTransparency = 0.18, BorderSizePixel = 0, Parent = root, +}) +new("UICorner", { CornerRadius = UDim.new(0, 18), Parent = panel }) +new("UIStroke", { Color = GOLD, Thickness = 3, Transparency = 0.1, Parent = panel }) +new("UIGradient", { + Rotation = 90, + Color = ColorSequence.new(Color3.fromRGB(150, 95, 50), Color3.fromRGB(95, 55, 28)), + Parent = panel, +}) +local float = new("TextLabel", { + AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(44, 32), Size = UDim2.fromOffset(46, 46), + BackgroundTransparency = 1, Text = "🎣", TextScaled = true, Font = Enum.Font.FredokaOne, Parent = panel, +}) +local title = new("TextLabel", { + Position = UDim2.fromOffset(78, 12), Size = UDim2.new(1, -96, 0, 38), BackgroundTransparency = 1, + Text = "", TextColor3 = Color3.fromRGB(255, 240, 200), TextScaled = true, TextXAlignment = Enum.TextXAlignment.Left, + Font = Enum.Font.FredokaOne, Parent = panel, +}) +new("UIStroke", { Color = Color3.fromRGB(60, 30, 10), Thickness = 2, Parent = title }) +local barBack = new("Frame", { + AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 62), Size = UDim2.new(1, -36, 0, 16), + BackgroundColor3 = Color3.fromRGB(40, 22, 10), BackgroundTransparency = 0.15, BorderSizePixel = 0, Parent = panel, +}) +new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = barBack }) +local bar = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = GOLD, BorderSizePixel = 0, Parent = barBack }) +new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = bar }) +new("UIGradient", { Color = ColorSequence.new(Color3.fromRGB(255, 230, 120), Color3.fromRGB(255, 160, 60)), Parent = bar }) +local tip = new("TextLabel", { + Position = UDim2.fromOffset(18, 86), Size = UDim2.new(1, -36, 0, 22), BackgroundTransparency = 1, + Text = "", TextColor3 = Color3.fromRGB(255, 228, 185), TextScaled = true, + Font = Enum.Font.GothamMedium, Parent = panel, +}) + +local rng = Random.new() +local function showTip() + tip.Text = "💡 " .. TIPS[rng:NextInteger(1, #TIPS)] +end + +-- при входе: экран виден сразу, минимум — из FishConfig, когда он загрузится +local now = os.clock() +gui:SetAttribute("Visible", true) +gui:SetAttribute("Ready", false) +gui:SetAttribute("StartAt", now) +gui:SetAttribute("MinUntil", now + 3) +gui:SetAttribute("Title", "Загрузка…") +showTip() + +task.spawn(function() + if not game:IsLoaded() then + game.Loaded:Wait() + end + local ok, Config = pcall(require, ReplicatedStorage:WaitForChild("FishConfig")) + if ok and Config.Loading then + gui:SetAttribute("MinUntil", gui:GetAttribute("StartAt") + Config.Loading.firstJoin) + end +end) + +local hiding = false +gui:GetAttributeChangedSignal("Visible"):Connect(function() + -- новый телепорт мог прийти, пока экран ещё уходил: тогда возвращаем его + if gui:GetAttribute("Visible") and (hiding or not gui.Enabled) then + hiding = false + showTip() + gui.Enabled = true + TweenService:Create(root, TweenInfo.new(0.25), { GroupTransparency = 0 }):Play() + end +end) +gui:GetAttributeChangedSignal("Title"):Connect(function() + title.Text = gui:GetAttribute("Title") or "" +end) +title.Text = gui:GetAttribute("Title") + +RunService.RenderStepped:Connect(function() + if not gui.Enabled then + return + end + local t = os.clock() + float.Rotation = math.sin(t * 2.2) * 12 + float.Position = UDim2.fromOffset(44, 32 + math.sin(t * 3) * 3) + local startAt, minUntil = gui:GetAttribute("StartAt") or t, gui:GetAttribute("MinUntil") or t + local p = math.clamp((t - startAt) / math.max(0.01, minUntil - startAt), 0, 1) + local ready = gui:GetAttribute("Ready") == true + if not ready then + p = math.min(p, 0.95) -- пока локация не готова, полоска не доходит до конца + end + bar.Size = UDim2.fromScale(p, 1) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if ready and hrp and t >= minUntil and not hiding then + hiding = true + local tw = TweenService:Create(root, TweenInfo.new(0.6), { GroupTransparency = 1 }) + tw.Completed:Connect(function() + if hiding then + gui.Enabled = false + gui:SetAttribute("Visible", false) + end + end) + tw:Play() + end +end) +]]> + diff --git a/install/FINISH_LANDSCAPE.lua b/install/FINISH_LANDSCAPE.lua new file mode 100644 index 0000000..5574bbf --- /dev/null +++ b/install/FINISH_LANDSCAPE.lua @@ -0,0 +1,61 @@ +-- Apply after REBUILD_LANDSCAPE.lua in Studio Edit mode. +local V,CF=Vector3.new,CFrame.new +local map=workspace.World1Map +local folder=map.LandscapeDetails +local cabin=map.BigCabin;cabin:ScaleTo(1.65) +local c,s=cabin:GetBoundingBox() +cabin:PivotTo(cabin:GetPivot()+V(-80-c.X,10-(c.Y-s.Y/2),1450-c.Z)) +local old=folder:FindFirstChild('CabinRamp');if old then old:Destroy() end +local ramp=Instance.new('Model');ramp.Name='CabinRamp';ramp.Parent=folder +local function part(name,size,cf,color,mat,parent) + local p=Instance.new('Part');p.Name=name;p.Anchored=true;p.Size=size;p.CFrame=cf;p.Color=color;p.Material=mat or Enum.Material.Wood;p.TopSurface=Enum.SurfaceType.Smooth;p.BottomSurface=Enum.SurfaceType.Smooth;p.Parent=parent or ramp;return p +end +local function beam(a,b,w,color,parent) + return part('Rail',V(w,w,(a-b).Magnitude),CFrame.lookAt((a+b)/2,b),color,Enum.Material.Wood,parent) +end +local wood=Color3.fromRGB(137,89,48) +local a,b=V(-68.1,12.15,1457.1),V(-68.1,4.3,1479) +local cf=CFrame.lookAt((a+b)/2,b) +part('WalkableRamp',V(6.5,0.55,(b-a).Magnitude+0.5),cf,wood,Enum.Material.WoodPlanks) +for j=0,16 do + local p=a:Lerp(b,j/16) + local strip=part('CrossPlank',V(6.55,0.12,0.10),CF(p+V(0,0.33,0))*cf.Rotation,Color3.fromRGB(103,65,37)) + strip.CanCollide=false +end +for _,side in {-1,1} do + local prev + for j=0,4 do + local p=a:Lerp(b,j/4)+V(side*3,0,0) + part('RampPost',V(0.45,3.5,0.45),CF(p+V(0,1.5,0)),wood) + if prev then beam(prev+V(0,2.9,0),p+V(0,2.9,0),0.32,wood) end + prev=p + end +end +-- Warm lamps at the cabin and along the uphill trail. +for _,p in {V(-65,12,1457),V(-88,7,1530),V(-104,20,1464),V(-93,37,1415),V(-46,60,1385)} do + part('LanternPost',V(0.6,6,0.6),CF(p+V(0,3,0)),wood,nil,folder) + local lamp=part('AmberLantern',V(1.1,1.6,1.1),CF(p+V(0,6,0)),Color3.fromRGB(255,199,99),Enum.Material.Neon,folder) + part('LanternCap',V(1.5,0.3,1.5),CF(p+V(0,6.95,0)),Color3.fromRGB(64,57,41),Enum.Material.Metal,folder) + local light=Instance.new('PointLight');light.Color=lamp.Color;light.Brightness=1.3;light.Range=13;light.Parent=lamp +end +-- Broaden the cascade while retaining its original animation and particles. +local sheet=map.Waterfall:GetChildren()[1] +if not sheet:GetAttribute('LandscapeWidened') then + sheet.Size=V(19,sheet.Size.Y,sheet.Size.Z) + for _,a in sheet:GetChildren() do if a:IsA('Attachment') then a.Position=V(a.Position.X*1.9,a.Position.Y,a.Position.Z) end end + sheet:SetAttribute('LandscapeWidened',true) +end +-- The small waterside cabin sits on the opposite shore, below the lookout. +local small=map.SmallCabin;local sc,ss=small:GetBoundingBox() +small:PivotTo(small:GetPivot()+V(-10-sc.X,5.05-(sc.Y-ss.Y/2),1424-sc.Z)) +local bridge=map.Bridge +local low=math.huge +for _,p in bridge:GetDescendants() do + if p:IsA('BasePart') and math.abs(p.Size.Y-0.5)<0.01 then low=math.min(low,p.Position.Y+0.25) end +end +if low 0.1 and (not bestGap or gap < bestGap) then + best, bestGap = dir.Unit, gap + end + end + if world.holes then + for _, h in ipairs(world.holes) do + consider(Vector3.new(h[1] - x, 0, h[2] - z), math.sqrt((h[1] - x) ^ 2 + (h[2] - z) ^ 2) - (world.holeRadius or 6)) + end + end + for _, l in ipairs(world.lakes or {}) do + if not world.holes then -- в Мире 3 озёра подо льдом, бросаем только в лунки + consider(Vector3.new(l[1] - x, 0, l[2] - z), math.sqrt((l[1] - x) ^ 2 + (l[2] - z) ^ 2) - l[3]) + end + end + if world.sea then + consider(Vector3.new(x, 0, z), world.sea - math.sqrt(x * x + z * z)) + end + return best +end + +-- расстояние по горизонтали от точки до ближайшей воды (0 — над водой: на причале или в воде) +function Config.WaterGap(world, pos) + if not world then + return math.huge + end + local x, z = pos.X - world.center.X, pos.Z - world.center.Z + local gap = math.huge + if world.holes then + for _, h in ipairs(world.holes) do + gap = math.min(gap, math.sqrt((h[1] - x) ^ 2 + (h[2] - z) ^ 2) - (world.holeRadius or 6)) + end + else + for _, l in ipairs(world.lakes or {}) do + gap = math.min(gap, math.sqrt((l[1] - x) ^ 2 + (l[2] - z) ^ 2) - l[3]) + end + end + if world.sea then + gap = math.min(gap, world.sea - math.sqrt(x * x + z * z)) + end + return math.max(0, gap) +end + +-- можно ли закидывать отсюда (pos — центр персонажа): стоим на берегу или платформе +-- и до воды не дальше Config.CastReach. Возвращает true или текст подсказки. +-- humanoid можно не передавать (на сервере его состояние ненадёжно) — тогда проверяем только по высоте. +function Config.CanCastFrom(world, pos, humanoid) + if not world then + return "🌍 Тут нет рыбы" + end + local inWater = pos.Y < (world.waterY or 0) + 2 -- у плывущего персонажа центр почти на уровне воды + if humanoid then + inWater = inWater or humanoid:GetState() == Enum.HumanoidStateType.Swimming or humanoid.FloorMaterial == Enum.Material.Water + end + if inWater then + return "🏊 Выйди из воды" + end + if humanoid and humanoid.FloorMaterial == Enum.Material.Air then + return "Встань на землю" + end + if Config.WaterGap(world, pos) > Config.CastReach then + return "🌊 Подойди к воде" + end + return true +end + -- есть ли вода в этой точке мира (озеро, море или лунка) function Config.IsWater(world, pos) if not world then @@ -218,17 +359,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 = { @@ -273,6 +450,16 @@ Config.BiteTimeMin = 3 Config.BiteTimeMax = 7 Config.BiteTimeout = 12 Config.MaxMisses = 2 +-- заброс: держишь ЛКМ — сила ездит 0 → 1 → 0 → …; от силы в момент отпускания зависит дальность +Config.CastChargeTime = 1.3 -- секунд на проход шкалы в одну сторону +Config.CastMinDist, Config.CastMaxDist = 6, 28 +Config.CastReach = 7 -- закидывать можно не дальше ~2 м (7 studs) от воды +Config.CastPerfect = { 0.72, 0.86 } -- зелёная зона шкалы +Config.CastPerfectLuck = 1.2 -- множитель удачи за попадание в зелёную зону + +-- обучение: линия-подсказка ведёт по шагам 0 → 1 → 2 → 3, на 4 обучение пройдено +-- 0 — табличка «Как играть», 1 — портал в Мир 1, 2 — причал (поймать рыбу), 3 — скупка (продать) +Config.TutorialDone = 4 function Config.HitsNeeded(rank) return math.ceil(rank / 2) end @@ -875,89 +1062,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(20, 95, 115) -terrain.WaterTransparency = 0.2 -terrain.WaterReflectance = 0.08 -terrain.WaterWaveSize = 0.1 -terrain.WaterWaveSpeed = 8 - ----------------------------------------------------------------- МИР 1: террейн (строится всегда) - -local W = V(0, 0, 1500) -- центр Мира 1 -local GROUND_Y = 4 -- верх земли -local WATER_Y = 0 -- поверхность воды - --- озеро из нескольких кругов: { x, z, радиус } -local LAKES = Config.Worlds[1].lakes - -terrain:FillBlock(CFrame.new(W + V(0, -10, 0)), V(500, 28, 500), Enum.Material.Grass) --- холмы по краям -for _, h in ipairs({ { -190, 160, 50 }, { 185, 175, 45 }, { -175, -175, 60 }, { 190, -150, 55 }, { 0, -215, 50 }, { -215, 0, 40 }, { 215, 30, 42 } }) do - terrain:FillBall(W + V(h[1], -14, h[2]), h[3], Enum.Material.Grass) -end --- порядок важен: песок → выемка → ил → вода -for _, l in ipairs(LAKES) do - terrain:FillCylinder(CFrame.new(W + V(l[1], -10, l[2])), 28, l[3] + 11, Enum.Material.Sand) -end -for _, l in ipairs(LAKES) do - terrain:FillCylinder(CFrame.new(W + V(l[1], 11, l[2])), 18, l[3] + 7, Enum.Material.Air) -end -for _, l in ipairs(LAKES) do - terrain:FillCylinder(CFrame.new(W + V(l[1], 10, l[2])), 20, l[3] + 2, Enum.Material.Air) -end -for _, l in ipairs(LAKES) do - terrain:FillCylinder(CFrame.new(W + V(l[1], -18, l[2])), 12, l[3], Enum.Material.Mud) -end -for _, l in ipairs(LAKES) do - terrain:FillCylinder(CFrame.new(W + V(l[1], -6, l[2])), 12, l[3], Enum.Material.Water) -end --- дорожка от точки прибытия к причалу и площадка -terrain:FillBlock(CFrame.new(W + V(0, 2, 100)), V(8, 4, 44), Enum.Material.Ground) -terrain:FillCylinder(CFrame.new(W + V(0, 2, 130)), 4, 17, Enum.Material.Cobblestone) +WorldBuilder.applyLighting() ---------------------------------------------------------------- точка появления в лобби @@ -967,8 +1081,8 @@ if not spawn then spawn.Parent = Workspace end spawn.Anchored = true -spawn.Size = V(8, 0.2, 8) -spawn.CFrame = CFrame.new(0, 1.15, 50) +spawn.Size = Vector3.new(8, 0.2, 8) +spawn.CFrame = CFrame.new(0, 1.15, 57) spawn.Transparency = 1 spawn.Duration = 0 for _, d in ipairs(spawn:GetChildren()) do @@ -977,1308 +1091,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, 50)) - --- фонтан со статуей золотой рыбы -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 i = 0, 5 do - local a = math.rad(i * 60 + 30) - bench(CFrame.lookAt(V(math.cos(a) * 17, FLOOR, math.sin(a) * 17), V(math.cos(a) * 30, FLOOR, math.sin(a) * 30))) -end - --- фонари по кругу -for i = 0, 7 do - local a = math.rad(i * 45 + 22.5) - lamp(V(math.cos(a) * 40, FLOOR, math.sin(a) * 40)) -end - --- клумбы с деревьями -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, -}) - --- порталы во все миры и арка с названием -local portalCF = CFrame.lookAt(V(0, FLOOR, -66), V(0, FLOOR, 0)) -arch(portalCF, 84, 24, "🎣 " .. string.upper(Config.GameName) .. " 🎣", Color3.fromRGB(255, 190, 60)) -for i, w in ipairs(Config.Worlds) do - local title = w.icon .. " " .. w.name .. (w.level > 1 and (" (ур. " .. w.level .. ")") or "") - portal(portalCF * CFrame.new(-27 + (i - 1) * 18, 0, 0), title, w.color, w.id, w.soon) -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(-14, FLOOR, 34) - local cf = CFrame.lookAt(pos, V(0, FLOOR, 50)) - 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) }) - 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: ТИХОЕ ОЗЕРО (детали) - -local function inLake(x, z, extra) - for _, l in ipairs(LAKES) do - if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + (extra or 0) then - return true - end - end - return false -end - --- прибытие -local arrive = W + V(0, GROUND_Y, 128) -marker("World1Spawn", CFrame.lookAt(arrive + V(0, 1, 0), arrive + V(0, 1, -10))) -arch(CFrame.new(W + V(0, GROUND_Y, 112)), 14, 11, "🌊 ТИХОЕ ОЗЕРО", Color3.fromRGB(80, 200, 255)) -portal(CFrame.lookAt(W + V(-26, GROUND_Y, 140), arrive), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") -stall(CFrame.lookAt(W + V(30, GROUND_Y, 140), arrive), { - title = "💰 СКУПКА", - titleColor = Color3.fromRGB(150, 255, 160), - wall = Color3.fromRGB(150, 115, 80), - 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(200, 150, 110), shirt = Color3.fromRGB(70, 130, 80), pants = Color3.fromRGB(60, 50, 40), hat = Color3.fromRGB(200, 170, 110) }, -}) - --- доска «Кто водится в озере» -do - local pos = W + V(-16, GROUND_Y, 104) - local cf = CFrame.lookAt(pos, W + V(0, GROUND_Y, 120)) - 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 = { "🐟 КТО ВОДИТСЯ В ОЗЕРЕ" } - 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 - --- костёр с брёвнами -do - local c = W + V(14, GROUND_Y, 118) - 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 fireBase = 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 = fireBase - local light = Instance.new("PointLight") - light.Color = Color3.fromRGB(255, 160, 80) - light.Range = 20 - light.Brightness = 2 - light.Parent = fireBase - for _, a in ipairs({ 0, 2.1, 4.2 }) do - local p = c + V(math.cos(a) * 6, 0.6, math.sin(a) * 6) - P({ Shape = Enum.PartType.Cylinder, Size = V(5, 1.4, 1.4), CFrame = CFrame.lookAt(p, c) * CFrame.Angles(0, math.rad(90), 0) * CFrame.Angles(0, math.rad(90), 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(115, 80, 50) }) - end -end - --- дед-рыбак с подсказками -npc("Дед Петрович", CFrame.lookAt(W + V(-7, GROUND_Y + 3, 80), W + V(0, GROUND_Y + 3, 95)), { - 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", "Поговорить") - --- домик рыбака -do - local cf = CFrame.lookAt(W + V(-34, GROUND_Y, 100), W + V(0, GROUND_Y, 100)) - local logC = Color3.fromRGB(130, 90, 55) - P({ Size = V(14, 1, 12), CFrame = cf * CFrame.new(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(110, 80, 50) }) - P({ Size = V(14, 8, 1), CFrame = cf * CFrame.new(0, 5, 5.5), Material = Enum.Material.Wood, Color = logC }) - for _, s in ipairs({ -1, 1 }) do - P({ Size = V(1, 8, 12), CFrame = cf * CFrame.new(s * 6.5, 5, 0), Material = Enum.Material.Wood, Color = logC }) - P({ Size = V(5, 8, 1), CFrame = cf * CFrame.new(s * 4.5, 5, -5.5), Material = Enum.Material.Wood, Color = logC }) - P({ Size = V(16, 1, 8.8), CFrame = cf * CFrame.new(0, 11.2, s * 3.4) * CFrame.Angles(math.rad(-s * 38), 0, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 60, 45) }) - end - P({ Size = V(4, 2, 1), CFrame = cf * CFrame.new(0, 8, -5.5), Material = Enum.Material.Wood, Color = logC }) - P({ Size = V(2.2, 2, 0.3), CFrame = cf * CFrame.new(-4.5, 5.5, -6.05), Material = Enum.Material.Glass, Color = Color3.fromRGB(255, 225, 150), Transparency = 0.2 }) - P({ Size = V(14, 3, 1), CFrame = cf * CFrame.new(0, 10.5, 5.5), Material = Enum.Material.Wood, Color = logC }) -end - --- причалы -local function pier(center, size) - 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 -end -pier(W + V(0, GROUND_Y + 0.2, 58), V(8, 0.6, 42)) -pier(W + V(-86, GROUND_Y + 0.2, 15), V(34, 0.6, 7)) -pier(W + V(86, GROUND_Y + 0.2, -10), V(34, 0.6, 7)) -lamp(W + V(-3.5, GROUND_Y + 0.5, 40), Color3.fromRGB(255, 220, 160)) -lamp(W + V(-70, GROUND_Y + 0.5, 18), Color3.fromRGB(255, 220, 160)) -lamp(W + V(70, GROUND_Y + 0.5, -13), Color3.fromRGB(255, 220, 160)) - --- лодка у западного причала -do - local cf = CFrame.new(W + V(-74, WATER_Y + 0.3, 24)) * CFrame.Angles(0, math.rad(15), 0) - local hull = Color3.fromRGB(170, 70, 50) - P({ Size = V(4, 0.5, 9), CFrame = cf, Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 100, 65) }) - for _, s in ipairs({ -1, 1 }) do - P({ Size = V(0.4, 1.4, 9), CFrame = cf * CFrame.new(s * 2, 0.7, 0), Material = Enum.Material.Wood, Color = hull }) - P({ Size = V(4.4, 1.4, 0.4), CFrame = cf * CFrame.new(0, 0.7, s * 4.5), Material = Enum.Material.Wood, Color = hull }) - end - P({ Size = V(4, 0.3, 1.2), CFrame = cf * CFrame.new(0, 1, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 100, 65) }) -end - --- кувшинки и камыши -for _, l in ipairs(LAKES) do - for _ = 1, 7 do - local a, d = rng:NextNumber(0, math.pi * 2), rng:NextNumber(6, l[3] - 5) - local x, z = l[1] + math.cos(a) * d, l[2] + math.sin(a) * d - local size = rng:NextNumber(2, 3.5) - P({ Shape = Enum.PartType.Cylinder, Size = V(0.15, size, size), CFrame = CFrame.new(W + V(x, WATER_Y + 0.28, z)) * CFrame.Angles(0, 0, math.rad(90)), Color = Color3.fromRGB(70, 150, 60), CanCollide = false }) - if rng:NextNumber() < 0.4 then - ball(W + V(x + 0.3, WATER_Y + 0.55, z), 0.7, { Color = Color3.fromRGB(255, 150, 190), CanCollide = false }) - end - end - for _ = 1, 9 do - local a = rng:NextNumber(0, math.pi * 2) - local x, z = l[1] + math.cos(a) * (l[3] + 1.2), l[2] + math.sin(a) * (l[3] + 1.2) - local inOther = false - for _, o in ipairs(LAKES) do - if o ~= l and (V(x, 0, z) - V(o[1], 0, o[2])).Magnitude < o[3] + 1 then - inOther = true - end - end - if not inOther and not (math.abs(x) < 6 and z > 30) then - for _ = 1, 5 do - local h = rng:NextNumber(3, 5) - local p = W + V(x + rng:NextNumber(-1.2, 1.2), WATER_Y + h / 2 - 0.5, z + rng:NextNumber(-1.2, 1.2)) - P({ Size = V(0.18, h, 0.18), Position = p, Color = Color3.fromRGB(85, 130, 50), CanCollide = false }) - P({ Size = V(0.35, 0.9, 0.35), Position = p + V(0, h / 2 - 0.3, 0), Color = Color3.fromRGB(110, 70, 40), CanCollide = false }) - end - end - end -end - --- деревья, кусты, камни -local function freeSpot(x, z) - if inLake(x, z, 14) then - return false - end - if (V(x, 0, z) - V(0, 0, 128)).Magnitude < 34 then - return false - end - if math.abs(x) < 9 and z > 70 and z < 125 then - return false - end - if (V(x, 0, z) - V(-34, 0, 100)).Magnitude < 14 then - return false - end - return true -end - -local placed = 0 -for _ = 1, 400 do - if placed >= 110 then - break - end - local x, z = rng:NextNumber(-230, 230), rng:NextNumber(-230, 230) - if freeSpot(x, z) then - local y = groundY(W.X + x, W.Z + z) - local roll = rng:NextNumber() - tree(W + V(x, y - 0.5, z), roll < 0.35 and "pine" or (roll < 0.5 and "birch" or "round")) - placed += 1 - end -end -for _ = 1, 60 do - local x, z = rng:NextNumber(-200, 200), rng:NextNumber(-200, 200) - if freeSpot(x, z) then - bush(W + V(x, groundY(W.X + x, W.Z + z) - 0.6, z)) - end -end -for _, l in ipairs(LAKES) do - for _ = 1, 4 do - local a = rng:NextNumber(0, math.pi * 2) - local x, z = l[1] + math.cos(a) * (l[3] + 8), l[2] + math.sin(a) * (l[3] + 8) - if not inLake(x, z, 3) and not (math.abs(x) < 8 and z > 30) then - local s = rng:NextNumber(2.5, 5) - P({ Size = V(s, s * 0.7, s * 0.9), CFrame = CFrame.new(W + V(x, groundY(W.X + x, W.Z + z), z)) * CFrame.Angles(rng:NextNumber(0, 1), rng:NextNumber(0, 6), rng:NextNumber(0, 1)), Material = Enum.Material.Rock, Color = Color3.fromRGB(125, 125, 130) }) - end - end -end - --- фонари вдоль дорожки -for _, z in ipairs({ 84, 100 }) do - lamp(W + V(6, GROUND_Y, z)) - lamp(W + V(-6, GROUND_Y, z)) -end - --- невидимые стены по краю мира -for _, w in ipairs({ - { V(0, 0, 245), V(500, 120, 2) }, - { V(0, 0, -245), V(500, 120, 2) }, - { V(245, 0, 0), V(2, 120, 500) }, - { V(-245, 0, 0), V(2, 120, 500) }, -}) do - P({ Size = w[2], Position = W + w[1] + V(0, 40, 0), Transparency = 1 }) -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] - if not terrainHasWater(w1.center + V(0, -4, 0)) then - warn("[MapBuilder] Вода в террейне Мира 1 не создалась — ставлю запасную поверхность воды") - waterPlane(w1.center + V(0, w1.waterY, 0), 490, Color3.fromRGB(30, 120, 150)) - 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 -- Логика игры: данные, удача, рыбалка с анимацией, сумка, магазин, улучшения, @@ -2323,7 +1139,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 = {}, } @@ -2450,13 +1266,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), @@ -2501,6 +1362,8 @@ local function updateStats(player) player:SetAttribute("BoostBonus", boostActive(data)) player:SetAttribute("BoostLeft", math.max(0, data.boostUntil - os.time())) player:SetAttribute("TotalCaught", data.totalCaught) + -- шаг обучения (линия-подсказка); у старых игроков без поля, уже ловивших рыбу, обучение пройдено + player:SetAttribute("Tutorial", data.tutorial or (data.totalCaught > 0 and Config.TutorialDone or 0)) player:SetAttribute("Mastery", masteryCount(data)) player:SetAttribute("Passes", table.concat(ps, ",")) @@ -2521,10 +1384,10 @@ local function addXp(player, data, amount) leveled = true end if leveled then - notify(player, "⭐ Новый уровень: " .. data.level .. "! Удача +" .. math.floor(Config.LuckPerPlayerLevel * 100) .. "%", GOLD) + notify(player, "⭐ Уровень " .. data.level .. "!", GOLD) for _, w in ipairs(Config.Worlds) do if w.level == data.level and not w.soon then - notify(player, "🌍 Открыт новый мир: " .. w.icon .. " " .. w.name .. "!", w.color) + notify(player, "🌍 Открыт: " .. w.icon .. " " .. w.name, w.color) end end end @@ -2535,79 +1398,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) @@ -2617,7 +1455,7 @@ local function claimDaily(player) end local t = today() if data.daily.last >= t then - notify(player, "🎁 Сегодня награда уже получена. Приходи завтра!", Color3.fromRGB(255, 200, 120)) + notify(player, "🎁 Приходи завтра", Color3.fromRGB(255, 200, 120)) return end local streak = (data.daily.last == t - 1) and (data.daily.streak % 7 + 1) or 1 @@ -2653,7 +1491,7 @@ local function claimCollection(player, worldId, rarity) end for _, f in ipairs(zone.fish) do if (rarity == "Master" or f.rarity == rarity) and not data.discovered[f.id] then - notify(player, "Сначала поймай всех рыб этой группы!", RED) + notify(player, "Сначала поймай всех", RED) return end end @@ -2661,7 +1499,7 @@ local function claimCollection(player, worldId, rarity) if rarity == "Master" then local coins = Config.MasteryCoins * world.mult data.coins += coins - notify(player, ("🏆 Мир «%s» собран! +%d 💰 и +%d%% удачи навсегда"):format(world.name, coins, math.floor(Config.MasteryLuck * 100 + 0.5)), GOLD) + notify(player, ("🏆 «%s» собран! +%d 💰"):format(world.name, coins), GOLD) else local r = Config.CollectionRewards[rarity] if not r then @@ -2669,7 +1507,7 @@ local function claimCollection(player, worldId, rarity) end data.coins += r.coins * world.mult addXp(player, data, r.xp * world.mult) - notify(player, ("📖 Коллекция «%s»: +%d 💰 +%d XP"):format(Config.Rarities[rarity].name, r.coins * world.mult, r.xp * world.mult), GREEN) + notify(player, ("📖 +%d 💰 +%d XP"):format(r.coins * world.mult, r.xp * world.mult), GREEN) end updateStats(player) sendInventory(player) @@ -2823,6 +1661,28 @@ local function splash(part, count) end -- рыба вылетает из воды, летит к игроку и показывается над головой +-- шлейф за летящим предметом — эффект быстрого движения (ширина — расстояние между точками крепления) +local TRAIL_COLOR = Color3.fromRGB(215, 245, 255) +local function addTrail(part, width) + local a0 = Instance.new("Attachment") + a0.Position = Vector3.new(0, width / 2, 0) + a0.Parent = part + local a1 = Instance.new("Attachment") + a1.Position = Vector3.new(0, -width / 2, 0) + a1.Parent = part + local trail = Instance.new("Trail") + trail.Attachment0, trail.Attachment1 = a0, a1 + trail.FaceCamera = true + trail.Lifetime = 0.35 + trail.MinLength = 0.05 + trail.LightEmission = 0.7 + trail.Color = ColorSequence.new(TRAIL_COLOR) + trail.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.1), NumberSequenceKeypoint.new(1, 1) }) + trail.WidthScale = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(1, 0) }) + trail.Parent = part + return trail +end + local function showFishFlight(player, fish, fromPos) local head = player.Character and player.Character:FindFirstChild("Head") if not head then @@ -2831,6 +1691,14 @@ local function showFishFlight(player, fish, fromPos) local model = Models.buildFish(fish.id, fish.mutation, 0.9, true) model:PivotTo(CFrame.new(fromPos)) model.Parent = workspace + -- шлейф на отдельной невидимой детали: рыба крутится, а шлейф должен оставаться ровным + local carrier = Instance.new("Part") + carrier.Anchored, carrier.CanCollide, carrier.CanQuery, carrier.CanTouch = true, false, false, false + carrier.Transparency = 1 + carrier.Size = Vector3.new(0.2, 0.2, 0.2) + carrier.CFrame = CFrame.new(fromPos) + carrier.Parent = model + local trail = addTrail(carrier, 1.8) task.spawn(function() local t0, dur = os.clock(), 0.55 while head.Parent do @@ -2838,11 +1706,13 @@ local function showFishFlight(player, fish, fromPos) local target = head.Position + Vector3.new(0, 2.8, 0) local p = fromPos:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * 8, 0) model:PivotTo(CFrame.new(p) * CFrame.Angles(0, 0, a * math.pi * 2)) + carrier.CFrame = CFrame.new(p) if a >= 1 then break end RunService.Heartbeat:Wait() end + trail.Enabled = false local t1 = os.clock() while head.Parent and os.clock() - t1 < 1.8 do model:PivotTo(CFrame.new(head.Position + Vector3.new(0, 2.8, 0)) * CFrame.Angles(0, os.clock() * 3, math.rad(-15))) @@ -2856,22 +1726,87 @@ end local fishing = {} --- ищем воду перед игроком по карте мира из FishConfig (не зависит от террейна) -local function findWater(hrp, world) - local look = hrp.CFrame.LookVector * Vector3.new(1, 0, 1) - if look.Magnitude < 0.01 then - look = Vector3.new(0, 0, -1) +-- серия улова (на время игры, не сохраняется) +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 - look = look.Unit - for _, d in ipairs({ 14, 11, 17, 8, 20, 6, 24, 4 }) do - local p = hrp.Position + look * d - if Config.IsWater(world, p) then - return Vector3.new(p.X, world.waterY or 0, p.Z) + setCombo(player, 0) +end + +-- босс озера: { world, def, hp, max, dmg = { [player] = урон } } +local boss = nil +local function bossHit(player, world, dmg) + if not boss or boss.hp <= 0 or not world or world.id ~= boss.world.id then + return + end + boss.hp = math.max(0, boss.hp - dmg) + boss.dmg[player] = (boss.dmg[player] or 0) + dmg + workspace:SetAttribute("BossHP", boss.hp) + remote:FireClient(player, "BossHit", dmg) + questProgress(player, "boss", dmg) +end + +-- ищем воду по карте мира из FishConfig (не зависит от террейна) в сторону центра ближайшего озера: +-- сначала на дальности, которую задала сила заброса, потом всё дальше от неё +local function findWater(hrp, world, power) + local look = Config.CastDirection(world, hrp.Position) + if not look then + look = hrp.CFrame.LookVector * Vector3.new(1, 0, 1) + look = look.Magnitude > 0.01 and look.Unit or Vector3.new(0, 0, -1) + end + local want = Config.CastMinDist + (Config.CastMaxDist - Config.CastMinDist) * power + for off = 0, 26, 2 do + for _, d in ipairs({ want - off, want + off }) do + if d >= 4 and d <= Config.CastMaxDist + 2 then + local p = hrp.Position + look * d + if Config.IsWater(world, p) then + return Vector3.new(p.X, world.waterY or 0, p.Z), d + end + end end end return nil end +-- вытягивание пустого поплавка: быстро летит к кончику удочки со шлейфом и исчезает +local function reelBobber(bobber, tool) + local root = bobber and bobber.PrimaryPart + local tip = tool and tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip") + if not root or not tip then + if bobber then + bobber:Destroy() + end + return + end + local trail = bobber:FindFirstChildWhichIsA("Trail", true) + if trail then + trail.Enabled = true + else + addTrail(root, 1.2) + end + local from = root.Position + task.spawn(function() + local t0, dur = os.clock(), 0.3 + while bobber.Parent and tip.Parent do + local a = math.min(1, (os.clock() - t0) / dur) + bobber:PivotTo(CFrame.new(from:Lerp(tip.WorldPosition, a) + Vector3.new(0, math.sin(a * math.pi) * 2.5, 0))) + if a >= 1 then + break + end + RunService.Heartbeat:Wait() + end + bobber:Destroy() + end) +end + local function stopFishing(player, tellClient) local s = fishing[player] if not s then @@ -2882,7 +1817,11 @@ local function stopFishing(player, tellClient) s.tween:Cancel() end if s.bobber then - s.bobber:Destroy() + if s.stage == "casting" then + s.bobber:Destroy() -- ещё летит: его двигает flyBobber + else + reelBobber(s.bobber, s.tool) + end end if s.tool then tweenGrip(s.tool, REST_ANGLE, 0.3) @@ -2892,12 +1831,12 @@ local function stopFishing(player, tellClient) end end -local function rollFish(player, data, worldId) +local function rollFish(player, data, worldId, luckMult) local zone = Config.Zones[worldId] if not zone then return nil end - local luck = totalLuck(player, data) + local luck = totalLuck(player, data) * (luckMult or 1) local bonus = luck - 1 local weights, total = {}, 0 for i, f in ipairs(zone.fish) do @@ -2939,13 +1878,14 @@ local function rollFish(player, data, worldId) } end -local function flyBobber(s, tool, target) +local function flyBobber(s, tool, target, dur, arc) local tip = tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip") local start = tip and tip.WorldPosition or (target + Vector3.new(0, 6, 0)) local bobber = Models.buildBobber() bobber:PivotTo(CFrame.new(start)) bobber.Parent = workspace s.bobber = bobber + local trail = addTrail(bobber.PrimaryPart, 1.2) if tip then local a1 = Instance.new("Attachment") a1.Position = Vector3.new(0, 0.9, 0) @@ -2959,22 +1899,24 @@ local function flyBobber(s, tool, target) line.Color = ColorSequence.new(Color3.fromRGB(245, 245, 245)) line.Parent = bobber end - local t0, dur = os.clock(), 0.55 + local t0 = os.clock() while bobber.Parent do local a = math.min(1, (os.clock() - t0) / dur) - bobber:PivotTo(CFrame.new(start:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * 6, 0))) + bobber:PivotTo(CFrame.new(start:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * arc, 0))) if a >= 1 then break end RunService.Heartbeat:Wait() end + trail.Enabled = false -- на воде поплавок качается, шлейф уже не нужен if bobber.Parent then splash(bobber.PrimaryPart, 18) playSound(bobber.PrimaryPart, SPLASH_SOUND, 0.5) end end -local function onCast(player) +local function onCast(player, power) + power = math.clamp(tonumber(power) or 0.6, 0, 1) local data = profiles[player] if not data then return @@ -2991,42 +1933,47 @@ local function onCast(player) return end local world = Config.WorldAt(hrp.Position) - local target = world and findWater(hrp, world) + local can = Config.CanCastFrom(world, hrp.Position) + if can ~= true then + remote:FireClient(player, "CastFail") + notify(player, can, Color3.fromRGB(255, 200, 120)) + return + end + local target, dist = findWater(hrp, world, power) if not target then remote:FireClient(player, "CastFail") - notify(player, world and "Повернись лицом к воде (или к лунке)!" or "Здесь нет рыбы — иди в один из миров 🌍", Color3.fromRGB(255, 200, 120)) + notify(player, "🌊 Подойди к воде", Color3.fromRGB(255, 200, 120)) return end if #data.items >= bagCapacity(player, data) then remote:FireClient(player, "CastFail") - notify(player, "🎒 Сумка полна! Продай рыбу в скупке.", RED) + notify(player, "🎒 Сумка полна!", RED) return end local stats = Config.RodStats(data.rod, rodLevel(data)) - local fish = rollFish(player, data, world.id) + local perfect = power >= Config.CastPerfect[1] and power <= Config.CastPerfect[2] + local fish = rollFish(player, data, world.id, perfect and Config.CastPerfectLuck or 1) if not fish then remote:FireClient(player, "CastFail") return end - local s = { stage = "casting", fish = fish, tool = tool } + local s = { stage = "casting", fish = fish, tool = tool, perfect = perfect } fishing[player] = s - remote:FireClient(player, "Cast") + -- замах игрок уже сделал, пока держал кнопку (у себя на клиенте); здесь только бросок вперёд + local throw = { windup = 0.15, flight = 0.35 + dist * 0.018, arc = 2 + dist * 0.3, perfect = perfect } + local splashAt = target + Vector3.new(0, 0.15, 0) + remote:FireClient(player, "Cast", splashAt, throw) -- клиенту для камеры task.spawn(function() - -- замах назад и бросок вперёд - local tw = tweenGrip(tool, 100, 0.25) - if tw then - tw.Completed:Wait() - end - tw = tweenGrip(tool, 8, 0.15) + local tw = tweenGrip(tool, 8, throw.windup) if tw then tw.Completed:Wait() end if fishing[player] ~= s then return end - flyBobber(s, tool, target + Vector3.new(0, 0.15, 0)) + flyBobber(s, tool, splashAt, throw.flight, throw.arc) tweenGrip(tool, REST_ANGLE - 5, 0.4) if fishing[player] ~= s then if s.bobber then @@ -3073,7 +2020,8 @@ local function onCast(player) if fishing[player] == s and s.stage == "bite" then stopFishing(player, false) remote:FireClient(player, "Escaped") - notify(player, "Рыба ушла… не успел вытащить.", RED) + notify(player, "🐟 Рыба ушла", RED) + breakCombo(player) end end) end @@ -3091,19 +2039,29 @@ local function onCatch(player, success, misses) if s.tween then s.tween:Cancel() end - if s.bobber then - s.bobber:Destroy() + local failed = success ~= true or os.clock() - s.biteAt > Config.BiteTimeout + 1 + if failed then + reelBobber(s.bobber, tool) + elseif s.bobber then + s.bobber:Destroy() -- вместо поплавка к игроку летит рыба end - if success ~= true or os.clock() - s.biteAt > Config.BiteTimeout + 1 then + if failed then gripSequence(tool, { { REST_ANGLE, 0.3 } }) remote:FireClient(player, "Escaped") - notify(player, "Рыба сорвалась!", RED) + 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, @@ -3129,22 +2087,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 ---------------------------------------------------------------- скупка @@ -3191,7 +2153,7 @@ local function sellItems(player, filterUid) end if count == 0 then if filterUid == nil then - notify(player, "Нечего продавать — сначала поймай рыбу!", Color3.fromRGB(255, 200, 120)) + notify(player, "🎒 Сумка пуста", Color3.fromRGB(255, 200, 120)) end return end @@ -3200,6 +2162,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 @@ -3217,12 +2180,12 @@ local function buy(player, kind, id) end local lvl = rodLevel(data, id) if lvl >= Config.RodUpgrade.maxLevel then - notify(player, "Удочка уже улучшена до максимума ★★★★★", GOLD) + notify(player, "★★★★★ Максимум", GOLD) return end local cost = Config.UpgradeCost(rod, lvl) if data.coins < cost then - notify(player, "Не хватает монет: нужно " .. cost .. " 💰", RED) + notify(player, "Нужно " .. cost .. " 💰", RED) return end data.coins -= cost @@ -3233,6 +2196,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 @@ -3241,17 +2205,18 @@ local function buy(player, kind, id) return end if potion.level and data.level < potion.level then - notify(player, "Нужен уровень " .. potion.level .. "!", RED) + notify(player, "🔒 Нужен ур. " .. potion.level, RED) return end if data.coins < potion.price then - notify(player, "Не хватает монет: нужно " .. potion.price .. " 💰", RED) + notify(player, "Нужно " .. potion.price .. " 💰", RED) return end data.coins -= potion.price applyPotion(data, potion.bonus, potion.duration) updateStats(player) - notify(player, ("🍀 %s: удача +%d%% на %d мин"):format(potion.name, potion.bonus * 100, potion.duration / 60), GREEN) + notify(player, ("🍀 +%d%% удачи, %d мин"):format(potion.bonus * 100, potion.duration / 60), GREEN) + questProgress(player, "buy", 1) return end local list, owned @@ -3266,18 +2231,20 @@ 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) + notify(player, "🔒 Нужен ур. " .. item.level, RED) return end if data.coins < item.price then - notify(player, "Не хватает монет: нужно " .. item.price .. " 💰", RED) + notify(player, "Нужно " .. item.price .. " 💰", RED) return end data.coins -= item.price owned[id] = true - notify(player, "Куплено: " .. item.name .. "!", GREEN) + bought = true + notify(player, "✅ " .. item.name, GREEN) end if kind == "Rod" then data.rod = id @@ -3288,10 +2255,19 @@ local function buy(player, kind, id) attachBag(player) end updateStats(player) + if bought then + questProgress(player, "buy", 1) + end end ---------------------------------------------------------------- телепорт +local TELEPORT_FADE = 0.3 -- сколько клиент затемняет экран перед переносом +local teleporting = {} +Players.PlayerRemoving:Connect(function(p) + teleporting[p] = nil +end) + local function teleportTo(player, worldId) local data = profiles[player] local char = player.Character @@ -3307,20 +2283,28 @@ local function teleportTo(player, worldId) return end if world.soon then - notify(player, world.icon .. " " .. world.name .. " скоро откроется! Следи за обновлениями.", world.color) + notify(player, world.icon .. " " .. world.name .. " — скоро!", world.color) return end if data.level < world.level then - notify(player, ("🔒 %s откроется на %d уровне"):format(world.name, world.level), RED) + notify(player, ("🔒 %s: ур. %d"):format(world.name, world.level), RED) return end markerName = world.id .. "Spawn" end local map = workspace:FindFirstChild("FishingMap") - local m = map and map:FindFirstChild(markerName) - if m then + local m = map and map:FindFirstChild(markerName, true) -- маркеры могут лежать в папках уровня (World1Map) + if m and not teleporting[player] then + -- клиент затемняет экран, переносим уже в темноте: свет новой локации ставится до того, как её видно + teleporting[player] = true stopFishing(player, true) - char:PivotTo(m.CFrame + Vector3.new(0, 3, 0)) + remote:FireClient(player, "TeleportFade", worldId, TELEPORT_FADE) + task.wait(TELEPORT_FADE) + teleporting[player] = nil + char = player.Character + if char and char.Parent then + char:PivotTo(m.CFrame + Vector3.new(0, 3, 0)) + end end end @@ -3376,7 +2360,15 @@ end) remote.OnServerEvent:Connect(function(player, action, a, b) if action == "Cast" then - onCast(player) + onCast(player, a) + elseif action == "Tutorial" then + -- шаги обучения идут только вперёд + local data = profiles[player] + local step = math.floor(tonumber(a) or 0) + if data and step > (player:GetAttribute("Tutorial") or 0) and step <= Config.TutorialDone then + data.tutorial = step + player:SetAttribute("Tutorial", step) + end elseif action == "Catch" then onCatch(player, a, b) elseif action == "Cancel" then @@ -3390,20 +2382,18 @@ remote.OnServerEvent:Connect(function(player, action, a, b) if nearSeller(player) then sellItems(player, a) else - notify(player, "Продавать можно только у скупщика 💰", Color3.fromRGB(255, 200, 120)) + notify(player, "💰 Только у скупщика", Color3.fromRGB(255, 200, 120)) end elseif action == "SellAll" then if nearSeller(player) then sellItems(player, nil) else - notify(player, "Продавать можно только у скупщика 💰", Color3.fromRGB(255, 200, 120)) + notify(player, "💰 Только у скупщика", Color3.fromRGB(255, 200, 120)) end elseif action == "Teleport" then teleportTo(player, a) elseif action == "ClaimCollection" then claimCollection(player, a, b) - elseif action == "ClaimQuest" then - claimQuest(player, a) elseif action == "ClaimDaily" then claimDaily(player) elseif action == "RequestInventory" then @@ -3422,7 +2412,7 @@ MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passI if gp.id == passId then passes[player] = passes[player] or {} passes[player][gp.key] = true - notify(player, "Спасибо за покупку! " .. gp.icon .. " " .. gp.name .. " активирован", GOLD) + notify(player, "✅ " .. gp.icon .. " " .. gp.name, GOLD) if gp.key == "VIP" then vipTag(player) end @@ -3458,7 +2448,7 @@ MarketplaceService.ProcessReceipt = function(info) end if product.boost then applyPotion(data, product.boost, product.duration) - notify(player, ("Спасибо! Удача +%d%% на %d мин"):format(product.boost * 100, product.duration / 60), GOLD) + notify(player, ("🍀 +%d%% удачи, %d мин"):format(product.boost * 100, product.duration / 60), GOLD) end table.insert(data.receipts, info.PurchaseId) if #data.receipts > 50 then @@ -3478,7 +2468,7 @@ task.spawn(function() workspace:SetAttribute("Event", currentEvent.id) workspace:SetAttribute("EventEnds", workspace:GetServerTimeNow() + currentEvent.duration) for _, p in ipairs(Players:GetPlayers()) do - notify(p, "🎉 Событие: " .. currentEvent.name .. " — " .. currentEvent.desc, GOLD) + notify(p, "🎉 " .. currentEvent.name, GOLD) updateStats(p) end task.wait(currentEvent.duration) @@ -3491,6 +2481,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) @@ -3508,7 +2597,7 @@ local function onPlayerAdded(player) return end loadPasses(player) - ensureQuests(data) + ensureChain(data) profiles[player] = data loadedOk[player] = ok updateStats(player) @@ -3535,6 +2624,7 @@ end Players.PlayerRemoving:Connect(function(player) stopFishing(player, false) + combo[player], comboUntil[player] = nil, nil saveData(player) profiles[player] = nil loadedOk[player] = nil @@ -3558,6 +2648,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 @@ -3567,6 +2661,2879 @@ task.spawn(function() end end) ]=====]) +make('ModuleScript', 'World1Builder', game.ServerScriptService, [=====[-- World1Builder (ModuleScript) -> ServerScriptService +-- Генератор локации «Тихое озеро» (Мир 1). Им ОДИН РАЗ собирают уровень прямо в Roblox Studio, +-- в режиме редактирования, а дальше уровень правится руками как обычные детали и модели. +-- Команда для Command Bar (строка внизу Studio): +-- require(game.ServerScriptService.World1Builder:Clone()).bake() +-- bake() стирает старую папку Workspace.World1Map и террейн этого мира и строит всё заново. +-- Обычно уровень собирается вместе со всей картой: WorldBuilder.bake() (см. README). +-- Если папки World1Map в плейсе нет, WorldBuilder строит уровень этим же модулем. +-- +-- Что нужно игре от уровня (не удаляйте и не переименовывайте): +-- маркеры World1Spawn, GuideFishSpot, GuideSell, World1NpcSeller, World1NpcGrandpa — невидимые +-- плитки; их можно двигать, NPC и точка появления встанут туда при запуске; +-- атрибут GuideTarget = "Pier" (модель MainDock) и "Sell" (модель BaitShop) — подсветка в обучении; +-- ProximityPrompt с атрибутом Action = "Sell" на прилавке и портал «В лобби» (Action = "Portal"); +-- деталь World1Bestiary — доска «Кто водится в озере», текст на неё пишет MapBuilder при запуске. +-- Форма воды для заброса берётся из FishConfig (Worlds[1].lakes) — если меняете озеро руками, +-- поправьте там круги, иначе игра будет считать водой старые места. + +local Workspace = game:GetService("Workspace") +local ReplicatedStorage = game:GetService("ReplicatedStorage") + +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) + +local V = Vector3.new +local terrain = Workspace.Terrain +local W1 = Config.Worlds[1] +local W = W1.center -- центр Мира 1 +local GROUND_Y = 4 -- верх земли +local WATER_Y = W1.waterY -- поверхность воды +local LAKES = W1.lakes -- озеро из кругов { x, z, радиус } от W + +-- холмы: { x, z, радиус, высота центра шара } — верх холма = высота центра + радиус +local HILLS = { + { -78, -138, 62, -22 }, -- холм с вышкой + { -175, -55, 58, -34 }, { 175, -165, 62, -30 }, { -175, 160, 52, -32 }, + { 180, 130, 48, -30 }, { 10, -225, 60, -34 }, { -60, 175, 45, -28 }, { 95, 190, 40, -26 }, +} +-- тропинка на холм к вышке (точки от W) +local HILL_PATH = { { -22, -76 }, { -40, -92 }, { -28, -106 }, { -52, -114 }, { -44, -127 }, { -66, -131 } } +-- «трава» — материал Snow: у него нет травинок и почти нет рисунка, получается ровная мультяшная +-- поверхность. В зелёный (а дорожки из Salt — в коричневый) его красит клиент только в этом мире. +local GROUND_MAT, PATH_MAT = Enum.Material.Snow, Enum.Material.Salt + +local Builder = {} + +-- вода ниже WATER_Y и воздух над ней прямо по вокселям (Fill* с Air иногда оставляет песок над водой) +function Builder.carveLake(l) + local region = Region3.new(W + V(l[1] - l[3], WATER_Y - 12, l[2] - l[3]), W + V(l[1] + l[3], WATER_Y + 16, l[2] + l[3])):ExpandToGrid(4) + local mats, occ = terrain:ReadVoxels(region, 4) + local size = mats.Size + local corner = region.CFrame.Position - region.Size / 2 + local center = W + V(l[1], 0, l[2]) + for x = 1, size.X do + for y = 1, size.Y do + for z = 1, size.Z do + local c = corner + V(x - 0.5, y - 0.5, z - 0.5) * 4 + if (V(c.X, 0, c.Z) - center).Magnitude <= l[3] then + local water = c.Y < WATER_Y + mats[x][y][z] = water and Enum.Material.Water or Enum.Material.Air + occ[x][y][z] = water and 1 or 0 + end + end + end + end + terrain:WriteVoxels(region, 4, mats, occ) +end + +-- высота земли с учётом холмов: считаем по формуле (лучи по только что залитому террейну ненадёжны) +local function hillY(x, z) + local y = GROUND_Y + for _, h in ipairs(HILLS) do + local d2 = (x - h[1]) ^ 2 + (z - h[2]) ^ 2 + if d2 < h[3] ^ 2 then + y = math.max(y, h[4] + math.sqrt(h[3] ^ 2 - d2)) + end + end + return y +end + +local function inLake(x, z, extra) + for _, l in ipairs(LAKES) do + if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + (extra or 0) then + return true + end + end + return false +end + +---------------------------------------------------------------- террейн +local function buildTerrain() + terrain:FillBlock(CFrame.new(W + V(0, -10, 0)), V(500, 28, 500), GROUND_MAT) + for _, h in ipairs(HILLS) do + terrain:FillBall(W + V(h[1], h[4], h[2]), h[3], GROUND_MAT) + end + -- порядок важен: узкая песчаная кромка → выемка → ил → вода + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -10, l[2])), 28, l[3] + 3, Enum.Material.Sand) + end + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], 11, l[2])), 18, l[3] + 2, Enum.Material.Air) + end + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], 10, l[2])), 20, l[3] + 1, Enum.Material.Air) + end + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -18, l[2])), 12, l[3], Enum.Material.Mud) + end + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -6, l[2])), 12, l[3], Enum.Material.Water) + end + for _, l in ipairs(LAKES) do + Builder.carveLake(l) + end + -- земляные дорожки: меняем материал травы на материал дорожки, объём не меняется + local function dirtPath(points, width) + for i = 2, #points do + local a, b = points[i - 1], points[i] + local len = math.sqrt((b[1] - a[1]) ^ 2 + (b[2] - a[2]) ^ 2) + for s = 0, len, 2 do + local x, z = a[1] + (b[1] - a[1]) * s / len, a[2] + (b[2] - a[2]) * s / len + local half = V(width / 2, 3, width / 2) + local p = W + V(x, hillY(x, z), z) + terrain:ReplaceMaterial(Region3.new(p - half, p + half):ExpandToGrid(4), 4, GROUND_MAT, PATH_MAT) + end + end + end + dirtPath(HILL_PATH, 4) + dirtPath({ { 0, 84 }, { 0, 64 } }, 6) -- площадка у корня причала + dirtPath({ { 8, -84 }, { 8, -100 } }, 4) -- к домику у мостков +end + +---------------------------------------------------------------- детали +-- parent — куда положить папку World1Map (Workspace при сборке в Studio, FishingMap при запуске игры) +-- makePortal — WorldBuilder.portalModel: ставит модель портала из шаблона (без него строится старое кольцо) +function Builder.build(parent, makePortal) + buildTerrain() + + local rng = Random.new(7) + local map = Instance.new("Folder") + map.Name = "World1Map" + + -------------------------------------------------- помощники + local function P(props) + local p = Instance.new("Part") + if props.Shape then + p.Shape = props.Shape + end + p.Anchored = true + p.TopSurface = Enum.SurfaceType.Smooth + p.BottomSurface = Enum.SurfaceType.Smooth + for k, v in pairs(props) do + if k ~= "Parent" and k ~= "Shape" then + p[k] = v + end + end + p.Parent = props.Parent or map + return p + end + local function vcyl(pos, h, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(h, d, d) + props.CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)) + return P(props) + end + local function ball(pos, d, props) + props.Shape = Enum.PartType.Ball + props.Size = V(d, d, d) + props.Position = pos + return P(props) + end + -- цилиндр между двумя точками (брёвна, балки, перила, вёсла) + local function rod(a, b, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(math.max(0.05, (b - a).Magnitude), d, d) + props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0) + return P(props) + end + local function surfaceText(part, face, text, color) + local sg = Instance.new("SurfaceGui") + sg.Face = face + sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud + sg.PixelsPerStud = 40 + sg.LightInfluence = 0 + sg.Parent = part + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = color + t.TextStrokeTransparency = 1 + t.Text = text + t.Parent = sg + end + local function prompt(target, actionText, objectText, action) + local pp = Instance.new("ProximityPrompt") + pp.ActionText = actionText + pp.ObjectText = objectText + pp.HoldDuration = 0 + pp.MaxActivationDistance = 14 + pp.RequiresLineOfSight = false + pp:SetAttribute("Action", action) + pp.Parent = target + return pp + end + local function marker(name, cf) + return P({ Name = name, Size = V(4, 1, 4), CFrame = cf, Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false }) + end + + local COL = { + plank = Color3.fromRGB(196, 140, 88), plankDark = Color3.fromRGB(160, 110, 68), + log = Color3.fromRGB(156, 102, 60), logDark = Color3.fromRGB(105, 70, 44), + rope = Color3.fromRGB(218, 184, 128), roof = Color3.fromRGB(62, 104, 78), stone = Color3.fromRGB(150, 146, 150), + rock = Color3.fromRGB(150, 146, 162), rockDark = Color3.fromRGB(112, 108, 128), moss = Color3.fromRGB(108, 152, 72), + pine = Color3.fromRGB(58, 126, 70), pineDark = Color3.fromRGB(30, 82, 52), + leaf = Color3.fromRGB(110, 170, 64), leafDark = Color3.fromRGB(72, 136, 56), + glow = Color3.fromRGB(255, 200, 120), awnA = Color3.fromRGB(46, 106, 72), awnB = Color3.fromRGB(242, 232, 204), + banner = Color3.fromRGB(40, 92, 62), metal = Color3.fromRGB(48, 44, 42), water = Color3.fromRGB(70, 200, 195), + } + local WOOD, PLANKS, SMOOTH = Enum.Material.Wood, Enum.Material.WoodPlanks, Enum.Material.SmoothPlastic + -- куб, повёрнутый вершиной вверх: три грани сходятся в острый пик (ёлки, горы, обломки скал) + local CUBE_UP = CFrame.Angles(math.rad(-35.264), 0, 0) * CFrame.Angles(0, 0, math.rad(45)) + + -- столб с кронштейном и висящим фонарём; facing — куда смотрит кронштейн + local function postLantern(base, facing, h) + h = h or 8 + local top = base + V(0, h, 0) + vcyl(base + V(0, h / 2, 0), h, 0.8, { Color = COL.logDark, Material = WOOD }) + rod(top - V(0, 0.3, 0), top + facing * 2.4 - V(0, 0.3, 0), 0.35, { Color = COL.logDark, Material = WOOD }) + local hang = top + facing * 2 - V(0, 1.8, 0) + rod(hang + V(0, 0.9, 0), top + facing * 2 - V(0, 0.3, 0), 0.08, { Color = COL.metal, Material = Enum.Material.Metal, CanCollide = false }) + P({ Size = V(1.2, 0.3, 1.2), Position = hang + V(0, 0.85, 0), Color = COL.metal, Material = Enum.Material.Metal, CanCollide = false }) + local glass = P({ Size = V(0.9, 1.3, 0.9), Position = hang, Color = COL.glow, Material = Enum.Material.Neon, CanCollide = false, CastShadow = false }) + P({ Size = V(1.2, 0.3, 1.2), Position = hang - V(0, 0.8, 0), Color = COL.metal, Material = Enum.Material.Metal, CanCollide = false }) + local light = Instance.new("PointLight") + light.Range = 18 + light.Brightness = 1.5 + light.Color = COL.glow + light.Parent = glass + end + + -- low-poly ёлка: ствол и ярусы-«ромбы» (кубы вершиной вверх), к верху меньше + local function pine(pos, h, tiers) + tiers = tiers or 3 + vcyl(pos + V(0, h * 0.15, 0), h * 0.3, math.max(0.8, h * 0.07), { Color = COL.logDark, Material = WOOD, CastShadow = false }) + local shade = rng:NextNumber(0, 0.3) + for i = 0, tiers - 1 do + local t = tiers > 1 and i / (tiers - 1) or 1 + local s = h * (0.42 - 0.22 * t) + P({ + Size = V(s, s, s), + CFrame = CFrame.new(pos + V(0, h * (0.34 + 0.48 * t), 0)) * CFrame.Angles(0, rng:NextNumber(0, 6.28), 0) * CUBE_UP, + Color = COL.pineDark:Lerp(COL.pine, 0.2 + 0.5 * t + shade), Material = SMOOTH, CanCollide = false, + }) + end + end + + -- круглое лиственное дерево + local function leafy(pos, s) + vcyl(pos + V(0, s * 0.4, 0), s * 0.8, s * 0.14, { Color = COL.log, Material = WOOD }) + local c = COL.leafDark:Lerp(COL.leaf, rng:NextNumber(0.3, 1)) + ball(pos + V(0, s * 1.05, 0), s * 0.95, { Color = c, Material = SMOOTH, CanCollide = false }) + ball(pos + V(s * 0.38, s * 0.85, s * 0.1), s * 0.65, { Color = c:Lerp(COL.leaf, 0.3), Material = SMOOTH, CanCollide = false }) + ball(pos + V(-s * 0.35, s * 0.9, -s * 0.2), s * 0.6, { Color = c:Lerp(COL.leafDark, 0.3), Material = SMOOTH, CanCollide = false }) + end + + -- угловатый low-poly камень + local function rock(pos, s, col) + return P({ + Size = V(s, s * rng:NextNumber(0.55, 0.85), s * rng:NextNumber(0.7, 1)), + CFrame = CFrame.new(pos) * CFrame.Angles(rng:NextNumber(-0.4, 0.4), rng:NextNumber(0, 6.28), rng:NextNumber(-0.4, 0.4)), + Color = (col or COL.rock):Lerp(COL.rockDark, rng:NextNumber(0, 0.6)), Material = SMOOTH, + }) + end + -- острый обломок скалы (куб вершиной вверх), наполовину утоплен + local function crag(pos, s) + return P({ + Size = V(s, s, s), + CFrame = CFrame.new(pos) * CFrame.Angles(rng:NextNumber(-0.2, 0.2), rng:NextNumber(0, 6.28), rng:NextNumber(-0.2, 0.2)) * CUBE_UP, + Color = COL.rock:Lerp(COL.rockDark, rng:NextNumber(0, 0.6)), Material = SMOOTH, + }) + end + + -- рогоз: несколько стеблей с коричневыми «початками» и листья + local function cattails(pos) + for _ = 1, rng:NextInteger(3, 6) do + local p = pos + V(rng:NextNumber(-1.3, 1.3), 0, rng:NextNumber(-1.3, 1.3)) + local top = p + V(rng:NextNumber(-0.4, 0.4), rng:NextNumber(3.5, 6), rng:NextNumber(-0.4, 0.4)) + rod(p, top, 0.16, { Color = Color3.fromRGB(96, 140, 62), Material = SMOOTH, CanCollide = false, CastShadow = false }) + local dir = (top - p).Unit + rod(top - dir * 2, top - dir * 0.6, 0.5, { Color = Color3.fromRGB(122, 74, 40), Material = SMOOTH, CanCollide = false, CastShadow = false }) + end + for _ = 1, 3 do + P({ + Size = V(0.35, rng:NextNumber(3, 4.5), 0.08), + CFrame = CFrame.new(pos + V(0, 1.6, 0)) * CFrame.Angles(0, rng:NextNumber(0, 6.28), rng:NextNumber(-0.35, 0.35)), + Color = Color3.fromRGB(110, 160, 70), Material = SMOOTH, CanCollide = false, CastShadow = false, + }) + end + end + + -- круглая свая с намотанным канатом; y0 — низ (под водой), top — верх сваи + local function ropePost(x, z, y0, top, d, parent) + d = d or 1.6 + vcyl(W + V(x, (y0 + top) / 2, z), top - y0, d, { Color = COL.log, Material = WOOD, Parent = parent }) + vcyl(W + V(x, top + 0.1, z), 0.2, d * 0.9, { Color = COL.plankDark, Material = WOOD, Parent = parent }) + for i = 1, 3 do + vcyl(W + V(x, top - 0.5 - i * 0.38, z), 0.3, d + 0.25, { Color = COL.rope, Material = Enum.Material.Fabric, CanCollide = false, Parent = parent }) + end + end + + -- маленькие мостки: доски поперёк и сваи + local function smallDock(x, z0, z1, w, y) + local dir = z1 > z0 and 1 or -1 + for z = z0, z1, dir * 1.6 do + P({ Size = V(w, 0.45, 1.45), Position = W + V(x, y - 0.22, z), Color = COL.plank:Lerp(COL.plankDark, rng:NextNumber(0, 0.6)), Material = PLANKS }) + end + for z = z0 + dir * 2, z1, dir * 6 do + for _, s in ipairs({ -1, 1 }) do + vcyl(W + V(x + s * (w / 2 - 0.3), y - 4, z), 8, 0.8, { Color = COL.logDark, Material = WOOD }) + end + end + end + + -- бревенчатый дом: стены из брёвен, двускатная зелёная крыша, тёплые окна, труба с дымом, крыльцо. + -- cf — центр пола на земле, сторона -Z (LookVector) — фасад с дверью + local function logCabin(name, cf, w, d, wallH) + local house = Instance.new("Model") + house.Name = name + house.Parent = map + local function part(props) + props.Parent = house + return P(props) + end + local LOG = 1.25 + local rows = math.floor(wallH / LOG) + local wallTop = 1 + rows * LOG + local function at(x, y, z) + return (cf * CFrame.new(x, y, z)).Position + end + part({ Size = V(w + 1.5, 1, d + 1.5), CFrame = cf * CFrame.new(0, 0.5, 0), Color = COL.stone, Material = Enum.Material.Slate }) + for r = 0, rows - 1 do + local y = 1 + LOG / 2 + r * LOG + local col = (r % 2 == 0) and COL.log or COL.log:Lerp(COL.logDark, 0.3) + for _, s in ipairs({ -1, 1 }) do + rod(at(-w / 2 - 0.9, y, s * d / 2), at(w / 2 + 0.9, y, s * d / 2), LOG, { Color = col, Material = WOOD, Parent = house }) + rod(at(s * w / 2, y, -d / 2 - 0.9), at(s * w / 2, y, d / 2 + 0.9), LOG, { Color = col, Material = WOOD, Parent = house }) + end + end + -- фронтоны (по бокам) — брёвна всё короче к коньку + local a = math.rad(34) + local rise = (d / 2) * math.tan(a) + for k = 0, math.floor(rise / LOG) - 1 do + local y = wallTop + LOG / 2 + k * LOG + local half = (d / 2) * (1 - (k + 1) * LOG / rise) + if half > 0.6 then + for _, s in ipairs({ -1, 1 }) do + rod(at(s * w / 2, y, -half), at(s * w / 2, y, half), LOG, { Color = COL.log:Lerp(COL.logDark, 0.15), Material = WOOD, Parent = house }) + end + end + end + -- крыша: два ската, конёк вдоль X + local run = d / 2 + 1.6 + for _, s in ipairs({ -1, 1 }) do + part({ Size = V(w + 3, 0.7, run / math.cos(a)), CFrame = cf * CFrame.new(0, wallTop + run * math.tan(a) / 2 + 0.35, s * run / 2) * CFrame.Angles(s * a, 0, 0), Color = COL.roof, Material = SMOOTH }) + end + part({ Size = V(w + 3.2, 0.6, 0.9), CFrame = cf * CFrame.new(0, wallTop + run * math.tan(a) + 0.2, 0), Color = COL.roof:Lerp(Color3.new(0, 0, 0), 0.25), Material = SMOOTH }) + -- дверь и окна с тёплым светом + part({ Size = V(3, 5.2, 0.5), CFrame = cf * CFrame.new(0, 3.6, -d / 2 - 0.7), Color = COL.logDark, Material = PLANKS }) + for i, wdw in ipairs({ { -w / 4, -d / 2 - 0.65, 0 }, { w / 4, -d / 2 - 0.65, 0 }, { -w / 2 - 0.65, 0, 90 }, { w / 2 + 0.65, 0, 90 } }) do + local wcf = cf * CFrame.new(wdw[1], 4.6, wdw[2]) * CFrame.Angles(0, math.rad(wdw[3]), 0) + part({ Size = V(3, 2.6, 0.4), CFrame = wcf, Color = COL.logDark, Material = WOOD }) + local g = part({ Size = V(2.4, 2, 0.45), CFrame = wcf, Color = COL.glow, Material = Enum.Material.Neon, CastShadow = false }) + part({ Size = V(0.2, 2, 0.5), CFrame = wcf, Color = COL.logDark, Material = WOOD }) + if i == 1 then + local l = Instance.new("PointLight") + l.Range = 14 + l.Brightness = 1 + l.Color = COL.glow + l.Parent = g + end + end + -- крыльцо + part({ Size = V(w * 0.55, 0.6, 4), CFrame = cf * CFrame.new(0, 1.1, -d / 2 - 2.8), Color = COL.plank, Material = PLANKS }) + for _, s in ipairs({ -1, 1 }) do + vcyl(at(s * w * 0.25, 4.2, -d / 2 - 4.4), 6.2, 0.6, { Color = COL.log, Material = WOOD, Parent = house }) + end + part({ Size = V(w * 0.62, 0.5, 4.8), CFrame = cf * CFrame.new(0, 7.3, -d / 2 - 2.6) * CFrame.Angles(-math.rad(14), 0, 0), Color = COL.roof, Material = SMOOTH }) + -- труба с дымом + local ch = at(w / 2 - 2.2, 0, d / 4) + local chTop = wallTop + rise + 3 + part({ Size = V(2.2, chTop, 2.2), Position = ch + V(0, chTop / 2, 0), Color = Color3.fromRGB(150, 110, 95), Material = Enum.Material.Brick }) + local smokeAt = part({ Size = V(1, 1, 1), Position = ch + V(0, chTop + 0.5, 0), Transparency = 1, CanCollide = false, CanQuery = false }) + local smoke = Instance.new("ParticleEmitter") + smoke.Texture = "rbxasset://textures/particles/smoke_main.dds" + smoke.Color = ColorSequence.new(Color3.fromRGB(235, 235, 235)) + smoke.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1.5), NumberSequenceKeypoint.new(1, 6) }) + smoke.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.4), NumberSequenceKeypoint.new(1, 1) }) + smoke.Lifetime = NumberRange.new(4, 6) + smoke.Rate = 4 + smoke.Speed = NumberRange.new(2, 3) + smoke.SpreadAngle = Vector2.new(10, 10) + smoke.Acceleration = V(1, 0.4, 0) + smoke.Parent = smokeAt + end + + -------------------------------------------------- прибытие, причал, лавка + local DOCK = { z0 = 64, z1 = 36, w = 12 } -- от берега (z0) в воду (z1), по оси X = 0 + local DECK_Y = GROUND_Y + 0.6 -- верх настила + local spawnAt = W + V(0, DECK_Y, 60) + marker("World1Spawn", CFrame.lookAt(spawnAt + V(0, 1, 0), spawnAt + V(0, 1, -10))) + marker("GuideFishSpot", CFrame.new(W + V(0, DECK_Y + 0.5, DOCK.z1 + 3))) + + -- главный причал: доски поперёк, толстые сваи с канатом по краям, ящик для снастей + do + local dock = Instance.new("Model") + dock.Name = "MainDock" + dock:SetAttribute("GuideTarget", "Pier") -- подсвечивается на шаге обучения + dock.Parent = map + for z = DOCK.z1 + 0.8, DOCK.z0 - 0.8, 1.6 do + P({ + Size = V(DOCK.w + rng:NextNumber(-0.3, 0.3), 0.5, 1.48), Position = W + V(0, DECK_Y - 0.25, z), + Color = COL.plank:Lerp(COL.plankDark, rng:NextNumber(0, 0.7)), Material = PLANKS, Parent = dock, + }) + end + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.8, 0.8, DOCK.z0 - DOCK.z1), Position = W + V(s * (DOCK.w / 2 - 1), DECK_Y - 0.9, (DOCK.z0 + DOCK.z1) / 2), Color = COL.logDark, Material = WOOD, Parent = dock }) + for z = DOCK.z1 + 1, DOCK.z0 - 2, 8 do + ropePost(s * (DOCK.w / 2 - 0.2), z, -6, DECK_Y + 2.4, 1.7, dock) + end + end + local tb = W + V(-3.4, DECK_Y, 46) + P({ Size = V(2.6, 1.3, 1.5), Position = tb + V(0, 0.65, 0), Color = Color3.fromRGB(120, 142, 124), Material = SMOOTH, Parent = dock }) + P({ Size = V(2.7, 0.35, 1.6), Position = tb + V(0, 1.45, 0), Color = Color3.fromRGB(96, 116, 100), Material = SMOOTH, Parent = dock }) + rod(tb + V(-0.7, 1.65, 0), tb + V(0.7, 1.65, 0), 0.18, { Color = COL.metal, Material = Enum.Material.Metal, Parent = dock }) + P({ Size = V(0.35, 0.35, 0.1), Position = tb + V(0, 1.2, -0.8), Color = Color3.fromRGB(230, 190, 70), Material = Enum.Material.Metal, Parent = dock }) + P({ Size = V(2, 2, 2), CFrame = CFrame.new(W + V(-4.2, DECK_Y + 1, 49.5)) * CFrame.Angles(0, 0.25, 0), Color = COL.plankDark, Material = PLANKS, Parent = dock }) + end + + -- лавка рыбака (скупка) слева от корня причала, прилавком к причалу: тент, вывеска, поплавки, + -- воблеры, бочки и ящики, фонарь на столбе. Продавца ставит MapBuilder на маркер World1NpcSeller. + do + local cf = CFrame.lookAt(W + V(-15, GROUND_Y, 60), W + V(0, GROUND_Y, 57)) + local shop = Instance.new("Model") + shop.Name = "BaitShop" + shop:SetAttribute("GuideTarget", "Sell") -- подсвечивается на шаге обучения + shop.Parent = map + local function at(x, y, z) + return cf * CFrame.new(x, y, z) + end + local function part(props) + props.Parent = shop + return P(props) + end + part({ Size = V(14, 0.8, 10), CFrame = at(0, 0.4, 0), Color = COL.plankDark, Material = PLANKS }) + part({ Size = V(14, 9, 0.8), CFrame = at(0, 5, 4.6), Color = COL.plank, Material = PLANKS }) + for _, s in ipairs({ -1, 1 }) do + part({ Size = V(0.8, 9, 10), CFrame = at(s * 6.6, 5, 0), Color = COL.plank, Material = PLANKS }) + part({ Size = V(1.2, 10.4, 1.2), CFrame = at(s * 6.6, 5.2, -4.8), Color = COL.logDark, Material = WOOD }) + end + part({ Size = V(15.5, 0.7, 11), CFrame = at(0, 10.4, 0), Color = COL.logDark, Material = PLANKS }) + local counter = part({ Name = "Counter", Size = V(12, 3.4, 2.4), CFrame = at(0, 2.5, -3.6), Color = COL.plank, Material = PLANKS }) + part({ Size = V(13, 0.4, 3), CFrame = at(0, 4.4, -3.6), Color = COL.logDark, Material = WOOD }) + prompt(counter, "Продать всю рыбу", "Скупка", "Sell") + -- полосатый тент и фестончики + local n = 8 + for i = 0, n - 1 do + local c = (i % 2 == 0) and COL.awnA or COL.awnB + local x = -7.5 + (i + 0.5) * 15 / n + part({ Size = V(15 / n + 0.02, 0.25, 5), CFrame = at(x, 9.7, -6.9) * CFrame.Angles(math.rad(-24), 0, 0), Color = c, Material = Enum.Material.Fabric }) + part({ Shape = Enum.PartType.Cylinder, Size = V(0.25, 15 / n, 15 / n), CFrame = at(x, 8.7, -9.25) * CFrame.Angles(0, math.rad(90), 0), Color = c, Material = Enum.Material.Fabric, CanCollide = false }) + end + -- вывеска над тентом + local sign = part({ Size = V(8, 3, 0.5), CFrame = at(0, 12.6, -4.9), Color = COL.plank, Material = PLANKS }) + part({ Size = V(8.6, 3.6, 0.3), CFrame = at(0, 12.6, -4.6), Color = COL.logDark, Material = WOOD }) + surfaceText(sign, Enum.NormalId.Front, "🐟 СКУПКА", Color3.fromRGB(60, 40, 25)) + -- воблеры на задней стене + for i, c in ipairs({ Color3.fromRGB(90, 200, 80), Color3.fromRGB(245, 210, 60), Color3.fromRGB(245, 140, 50), Color3.fromRGB(70, 150, 230), Color3.fromRGB(230, 70, 70) }) do + local x = -4.4 + (i - 1) * 2.2 + part({ Size = V(0.08, 1.4, 0.08), CFrame = at(x, 8.4, 4.05), Color = COL.metal, CanCollide = false }) + part({ Size = V(0.55, 1.6, 0.5), CFrame = at(x, 7, 4.0), Color = c, Material = SMOOTH, CanCollide = false }) + part({ Size = V(0.3, 0.5, 0.45), CFrame = at(x, 6, 4.0), Color = c:Lerp(Color3.new(1, 1, 1), 0.4), Material = SMOOTH, CanCollide = false }) + end + -- поплавки и ящички на прилавке + for i = 0, 3 do + local p = at(-4.5 + i * 1.3, 5.05, -3.4).Position + ball(p, 0.9, { Color = Color3.fromRGB(225, 50, 45), Material = SMOOTH, Parent = shop, CanCollide = false }) + ball(p + V(0, 0.55, 0), 0.6, { Color = Color3.fromRGB(250, 250, 250), Material = SMOOTH, Parent = shop, CanCollide = false }) + end + part({ Size = V(2.2, 1, 1.4), CFrame = at(2.6, 5.1, -3.5), Color = Color3.fromRGB(120, 140, 125), Material = SMOOTH }) + part({ Size = V(1.6, 0.8, 1.2), CFrame = at(4.8, 5, -3.4), Color = COL.plankDark, Material = PLANKS }) + -- бочки и ящики сбоку + for i, off in ipairs({ { 8.6, -2.6 }, { 9.2, 0.6 } }) do + local p = at(off[1], 1.7, off[2]).Position + vcyl(p, 3.4, 2.8, { Color = COL.log, Material = WOOD, Parent = shop }) + for _, dy in ipairs({ -1, 1 }) do + vcyl(p + V(0, dy, 0), 0.3, 2.95, { Color = COL.metal, Material = Enum.Material.Metal, Parent = shop, CanCollide = false }) + end + if i == 2 then + part({ Size = V(2.2, 2.2, 2.2), CFrame = at(9, 4.5, 0.6) * CFrame.Angles(0, 0.3, 0), Color = COL.plankDark, Material = PLANKS }) + end + end + part({ Size = V(2.6, 2.6, 2.6), CFrame = at(-9, 1.3, -1.5) * CFrame.Angles(0, 0.2, 0), Color = COL.plankDark, Material = PLANKS }) + marker("World1NpcSeller", at(0, 3.9, 1.6)) + marker("GuideSell", cf * CFrame.new(0, 0, -9)) + postLantern(at(-7.8, 0, -6.2).Position, (cf.LookVector * V(1, 0, 1)).Unit, 9) + end + leafy(W + V(-27, GROUND_Y, 70), 13) -- большое дерево над лавкой, как на макете + postLantern(W + V(7.5, GROUND_Y, 66), V(-1, 0, 0), 8) + + -- деревянная лодка с вёслами справа от причала у двух свай + do + local cf = CFrame.new(W + V(12.5, WATER_Y + 0.25, 46)) * CFrame.Angles(0, math.rad(12), 0) + local boat = Instance.new("Model") + boat.Name = "Rowboat" + boat.Parent = map + local hull, inner = Color3.fromRGB(150, 92, 52), Color3.fromRGB(196, 140, 88) + P({ Size = V(3.4, 0.4, 8.4), CFrame = cf, Color = inner, Material = PLANKS, Parent = boat }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.4, 1.7, 8.6), CFrame = cf * CFrame.new(s * 1.95, 0.7, 0.2) * CFrame.Angles(0, 0, math.rad(-s * 14)), Color = hull, Material = WOOD, Parent = boat }) + P({ Size = V(0.4, 1.7, 3), CFrame = cf * CFrame.new(s * 1.05, 0.8, -5) * CFrame.Angles(0, math.rad(s * 38), 0), Color = hull, Material = WOOD, Parent = boat }) + P({ Size = V(0.5, 0.3, 8.6), CFrame = cf * CFrame.new(s * 2.2, 1.6, 0.2), Color = COL.logDark, Material = WOOD, Parent = boat }) + local a = (cf * CFrame.new(s * 1.6, 1.4, 0.2)).Position + local b = (cf * CFrame.new(s * 5.2, -0.1, 1.4)).Position + rod(a, b, 0.22, { Color = COL.plank, Material = WOOD, CanCollide = false, Parent = boat }) + P({ Size = V(0.15, 0.9, 1.9), CFrame = CFrame.lookAt(b, b + (b - a)) * CFrame.Angles(0, math.rad(90), 0), Color = COL.plank, Material = WOOD, CanCollide = false, Parent = boat }) + end + P({ Size = V(4.4, 1.7, 0.4), CFrame = cf * CFrame.new(0, 0.7, 4.5), Color = hull, Material = WOOD, Parent = boat }) + for _, z in ipairs({ -1.6, 1.8 }) do + P({ Size = V(3.8, 0.3, 1.1), CFrame = cf * CFrame.new(0, 1.1, z), Color = inner, Material = PLANKS, Parent = boat }) + end + ropePost(9.8, 52, -6, 3.4, 1.4, boat) + ropePost(16, 40, -6, 2.8, 1.4, boat) + end + + -- за спиной игрока: портал в лобби, место деда-рыбака, доска «Кто водится в озере» + do + local baseCF = CFrame.lookAt(W + V(15, GROUND_Y, 86), W + V(0, GROUND_Y, 62)) + local color = Color3.fromRGB(255, 200, 80) + local portalModel = Instance.new("Model") + portalModel.Name = "PortalToLobby" + portalModel.Parent = map + local center = baseCF * CFrame.new(0, 10, 0) + local fancy = makePortal and makePortal(baseCF, color, "PortalModel_Lobby", portalModel) + local disc + if fancy then + -- модель из шаблона; невидимый якорь держит подсказку, подпись и искры + disc = P({ + Name = "Portal_Lobby", Size = V(1, 1, 1), CFrame = center * CFrame.Angles(0, math.rad(90), 0), + Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false, Parent = portalModel, + }) + else + P({ Size = V(17, 1, 9), CFrame = baseCF * CFrame.new(0, 0.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(95, 100, 115), Parent = portalModel }) + P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130), Parent = portalModel }) + local R, n = 7, 20 + for i = 0, n - 1 do + local a = (i + 0.5) / n * math.pi * 2 + P({ Size = V(2 * math.pi * R / n + 0.4, 1.7, 1.7), CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(80, 85, 100), Parent = portalModel }) + if i % 2 == 0 then + P({ Size = V(0.6, 0.6, 1.9), CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R + 0.95, 0), Material = Enum.Material.Neon, Color = color, Parent = portalModel }) + end + end + disc = P({ + Name = "Portal_Lobby", Shape = Enum.PartType.Cylinder, Size = V(0.3, 2 * R - 1, 2 * R - 1), CFrame = center * CFrame.Angles(0, math.rad(90), 0), + Material = Enum.Material.Neon, Color = color, Transparency = 0.3, CanCollide = false, Parent = portalModel, + }) + end + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + pe.LightEmission = 1 + pe.Rate = 25 + pe.Lifetime = NumberRange.new(1, 1.8) + pe.Speed = NumberRange.new(0.5, 2) + pe.SpreadAngle = Vector2.new(180, 180) + pe.Size = NumberSequence.new(0.5, 0) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Parent = disc + local bb = Instance.new("BillboardGui") + bb.Size = UDim2.fromOffset(250, 64) + bb.StudsOffset = V(0, fancy and 7 or 10, 0) + bb.MaxDistance = 160 + bb.LightInfluence = 0 + bb.Parent = disc + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = color:Lerp(Color3.new(1, 1, 1), 0.4) + t.TextStrokeTransparency = 0.15 + t.Text = "🏠 В лобби" + t.Parent = bb + prompt(disc, "Перейти", "🏠 В лобби", "Portal"):SetAttribute("World", "Lobby") + end + marker("World1NpcGrandpa", CFrame.lookAt(W + V(9, GROUND_Y + 3, 72), W + V(0, GROUND_Y + 3, 62))) + do + local cf = CFrame.lookAt(W + V(-12, GROUND_Y, 80), W + V(0, GROUND_Y, 62)) + for _, x in ipairs({ -5.5, 5.5 }) do + P({ Size = V(0.8, 10, 0.8), CFrame = cf * CFrame.new(x, 5, 0.3), Material = WOOD, Color = COL.logDark }) + end + P({ Name = "World1Bestiary", Size = V(12, 9, 0.5), CFrame = cf * CFrame.new(0, 6.5, 0), Material = PLANKS, Color = Color3.fromRGB(70, 48, 32) }) + end + + -------------------------------------------------- дальний берег: дом, холм с тропинкой и вышкой + logCabin("BigCabin", CFrame.lookAt(W + V(-58, GROUND_Y, -62), W + V(-20, GROUND_Y, 10)), 16, 12, 8) + postLantern(W + V(-44, GROUND_Y, -58), V(1, 0, 0), 8) + + -- столб-вывеска с зелёным знаменем и белой рыбой у начала тропинки + do + local base = W + V(-17, GROUND_Y, -80) + vcyl(base + V(0, 6, 0), 12, 0.9, { Color = COL.logDark, Material = WOOD }) + rod(base + V(0, 11.4, 0), base + V(3.6, 11.4, 0), 0.5, { Color = COL.logDark, Material = WOOD }) + local flag = P({ Size = V(3, 5, 0.2), CFrame = CFrame.lookAt(base + V(2.2, 8.6, 0), base + V(2.2, 8.6, 10)), Color = COL.banner, Material = Enum.Material.Fabric, CanCollide = false }) + surfaceText(flag, Enum.NormalId.Front, "🐟", Color3.new(1, 1, 1)) + surfaceText(flag, Enum.NormalId.Back, "🐟", Color3.new(1, 1, 1)) + end + + -- забор вдоль тропинки и фонари + do + local posts = {} + for i = 2, #HILL_PATH do + local a, b = HILL_PATH[i - 1], HILL_PATH[i] + local dx, dz = b[1] - a[1], b[2] - a[2] + local len = math.sqrt(dx * dx + dz * dz) + local nx, nz = -dz / len, dx / len -- влево от направления + for s = 0, len - 0.1, 4.5 do + local x, z = a[1] + dx * s / len + nx * 3, a[2] + dz * s / len + nz * 3 + table.insert(posts, W + V(x, hillY(x, z), z)) + end + end + for i, p in ipairs(posts) do + vcyl(p + V(0, 1.3, 0), 3, 0.45, { Color = COL.log, Material = WOOD }) + local q = posts[i + 1] + if q and (q - p).Magnitude < 8 then + for _, h in ipairs({ 1.2, 2.3 }) do + rod(p + V(0, h, 0), q + V(0, h, 0), 0.3, { Color = COL.log, Material = WOOD, CanCollide = false }) + end + end + end + for _, i in ipairs({ 2, 4 }) do + local x, z = HILL_PATH[i][1] + 3, HILL_PATH[i][2] + postLantern(W + V(x, hillY(x, z), z), V(-1, 0, 0), 7) + end + end + + -- смотровая вышка на вершине холма с зелёным флагом + do + local tower = Instance.new("Model") + tower.Name = "Watchtower" + tower.Parent = map + local c = W + V(-76, hillY(-76, -136) - 0.5, -136) + local H = 14 + local function wood(props) + props.Parent = tower + return props + end + for _, sx in ipairs({ -1, 1 }) do + for _, sz in ipairs({ -1, 1 }) do + rod(c + V(sx * 4.2, 0, sz * 4.2), c + V(sx * 3.2, H, sz * 3.2), 1.1, wood({ Color = COL.log, Material = WOOD })) + end + end + for _, y in ipairs({ 4.5, 9 }) do + for _, s in ipairs({ -1, 1 }) do + local k = 4.2 - y / H + rod(c + V(-k, y, s * k), c + V(k, y - 3, s * k), 0.4, wood({ Color = COL.logDark, Material = WOOD, CanCollide = false })) + rod(c + V(s * k, y, -k), c + V(s * k, y - 3, k), 0.4, wood({ Color = COL.logDark, Material = WOOD, CanCollide = false })) + end + end + P(wood({ Size = V(9, 0.6, 9), Position = c + V(0, H, 0), Color = COL.plank, Material = PLANKS })) + for _, s in ipairs({ -1, 1 }) do + P(wood({ Size = V(9, 1.4, 0.3), Position = c + V(0, H + 1.2, s * 4.4), Color = COL.log, Material = WOOD })) + P(wood({ Size = V(0.3, 1.4, 9), Position = c + V(s * 4.4, H + 1.2, 0), Color = COL.log, Material = WOOD })) + end + for _, sx in ipairs({ -1, 1 }) do + for _, sz in ipairs({ -1, 1 }) do + vcyl(c + V(sx * 4.2, H + 2.6, sz * 4.2), 5.2, 0.4, wood({ Color = COL.log, Material = WOOD })) + end + end + for _, s in ipairs({ -1, 1 }) do + P(wood({ Size = V(11, 0.5, 6.4), CFrame = CFrame.new(c + V(0, H + 6.2, s * 2.7)) * CFrame.Angles(s * math.rad(30), 0, 0), Color = COL.roof, Material = SMOOTH })) + end + vcyl(c + V(0, H + 10.5, 0), 7, 0.25, wood({ Color = COL.logDark, Material = WOOD })) + local flag = P(wood({ Size = V(4, 2.6, 0.15), CFrame = CFrame.new(c + V(2.1, H + 12.6, 0)), Color = COL.banner, Material = Enum.Material.Fabric, CanCollide = false })) + surfaceText(flag, Enum.NormalId.Front, "🐟", Color3.new(1, 1, 1)) + surfaceText(flag, Enum.NormalId.Back, "🐟", Color3.new(1, 1, 1)) + end + + -------------------------------------------------- северо-восток: домик с мостками, скала, водопад, мост + logCabin("SmallCabin", CFrame.lookAt(W + V(8, GROUND_Y, -96), W + V(4, GROUND_Y, 0)), 11, 9, 7) + smallDock(8, -86, -68, 6, GROUND_Y + 0.4) + postLantern(W + V(10.6, GROUND_Y + 0.4, -70), V(-1, 0, 0), 6) + + local CLIFF_FRONT = -66 -- передняя кромка скалы по Z + local RIVER_X, RIVER_W, LIP_Y = 48, 10, 35 -- русло реки над водопадом и высота уступа + local cliff = Instance.new("Model") + cliff.Name = "Cliff" + cliff.Parent = map + do + -- скала уступами: три ряда блоков всё выше к заднему плану; у русла — вровень с уступом водопада + local rows = { { CLIFF_FRONT, 14, 22 }, { CLIFF_FRONT - 18, 26, 34 }, { CLIFF_FRONT - 40, 38, 50 } } -- { кромка, мин. высота, макс. высота } + for ri, row in ipairs(rows) do + local x = 28 + while x < 116 do + local w = rng:NextNumber(11, 16) + local cx = x + w / 2 + if math.abs(cx - RIVER_X) > RIVER_W / 2 + w / 2 - 1 then + local h = rng:NextNumber(row[2], row[3]) + if ri <= 2 and math.abs(cx - RIVER_X) < 16 then + h = LIP_Y + rng:NextNumber(-0.5, 1.5) -- берега реки вровень с уступом: на них стоит мост + end + local d = rng:NextNumber(18, 24) + local cf = CFrame.new(W + V(cx, h / 2, row[1] - d / 2)) * CFrame.Angles(rng:NextNumber(-0.06, 0.06), rng:NextNumber(-0.25, 0.25), rng:NextNumber(-0.06, 0.06)) + P({ Size = V(w, h, d), CFrame = cf, Color = COL.rock:Lerp(COL.rockDark, rng:NextNumber(0, 0.5)), Material = SMOOTH, Parent = cliff }) + P({ Size = V(w - 1, 1.2, d - 1), CFrame = cf * CFrame.new(0, h / 2 + 0.3, 0), Color = COL.moss:Lerp(COL.leaf, rng:NextNumber(0, 0.5)), Material = SMOOTH, Parent = cliff }) + -- острые обломки на кромке и на гранях — чтобы скала не выглядела ровной стеной + for _ = 1, 2 do + local s = rng:NextNumber(5, 9) + local cr = crag((cf * CFrame.new(rng:NextNumber(-w / 2, w / 2), rng:NextNumber(-h / 2, h / 2 - 2), -d / 2 + s * 0.2)).Position, s) + cr.Parent = cliff + end + if rng:NextNumber() < 0.7 then + pine((cf * CFrame.new(rng:NextNumber(-w / 4, w / 4), h / 2 + 0.8, rng:NextNumber(-d / 4, d / 4))).Position, rng:NextNumber(12, 20), 3) + end + end + x += w - 0.5 + end + end + for x = 30, 112, 9 do + local cr = crag(W + V(x + rng:NextNumber(-3, 3), 2, CLIFF_FRONT + rng:NextNumber(0, 3)), rng:NextNumber(6, 11)) + cr.Parent = cliff + end + -- ложе реки и стена за водопадом, река наверху + P({ Size = V(RIVER_W + 4, LIP_Y, 70), Position = W + V(RIVER_X, LIP_Y / 2, CLIFF_FRONT - 35), Color = COL.rockDark, Material = SMOOTH, Parent = cliff }) + P({ Size = V(RIVER_W, 0.8, 70), Position = W + V(RIVER_X, LIP_Y + 0.4, CLIFF_FRONT - 35), Color = COL.water, Material = Enum.Material.Glass, Transparency = 0.15, CanCollide = false, Parent = cliff }) + for z = CLIFF_FRONT - 4, CLIFF_FRONT - 66, -7 do + for _, s in ipairs({ -1, 1 }) do + rock(W + V(RIVER_X + s * (RIVER_W / 2 + 0.5), LIP_Y + 1, z + rng:NextNumber(-2, 2)), rng:NextNumber(2.5, 4.5)).Parent = cliff + end + end + end + + -- водопад: полупрозрачная «простыня», бегущие вниз струи (Beam с текстурой), пена и туман внизу + do + local fall = Instance.new("Model") + fall.Name = "Waterfall" + fall.Parent = map + local zf = CLIFF_FRONT - 1.2 + local sheet = P({ + Size = V(RIVER_W - 1, LIP_Y + 0.8, 1), Position = W + V(RIVER_X, LIP_Y / 2, zf), + Color = Color3.fromRGB(170, 236, 240), Material = Enum.Material.Glass, Transparency = 0.25, CanCollide = false, CastShadow = false, Parent = fall, + }) + for i = 0, 4 do + local x = -RIVER_W / 2 + 1.5 + i * (RIVER_W - 3) / 4 + local a0 = Instance.new("Attachment") + a0.Position = V(x, LIP_Y / 2, -0.6) + a0.Parent = sheet + local a1 = Instance.new("Attachment") + a1.Position = V(x + rng:NextNumber(-0.5, 0.5), -LIP_Y / 2, -0.6) + a1.Parent = sheet + local b = Instance.new("Beam") + b.Attachment0, b.Attachment1 = a0, a1 + b.Texture = "rbxasset://textures/particles/smoke_main.dds" + b.TextureMode = Enum.TextureMode.Wrap + b.TextureLength = 5 + b.TextureSpeed = rng:NextNumber(1.6, 2.4) + b.Width0, b.Width1 = 2.6, 3.2 + b.FaceCamera = true + b.LightEmission = 0.35 + b.Color = ColorSequence.new(Color3.new(1, 1, 1)) + b.Transparency = NumberSequence.new(0.25) + b.Parent = sheet + end + for _ = 1, 9 do + vcyl(W + V(RIVER_X + rng:NextNumber(-6, 6), WATER_Y + 0.2, zf + rng:NextNumber(0.5, 6)), 0.5, rng:NextNumber(3, 6), { + Color = Color3.fromRGB(240, 252, 252), Material = SMOOTH, Transparency = 0.15, CanCollide = false, CastShadow = false, Parent = fall, + }) + end + local function mistAt(pos, size, rate, s0, s1) + local holder = P({ Size = size, Position = pos, Transparency = 1, CanCollide = false, CanQuery = false, Parent = fall }) + local mist = Instance.new("ParticleEmitter") + mist.Texture = "rbxasset://textures/particles/smoke_main.dds" + mist.Color = ColorSequence.new(Color3.new(1, 1, 1)) + mist.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0, s0), NumberSequenceKeypoint.new(1, s1) }) + mist.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.45), NumberSequenceKeypoint.new(1, 1) }) + mist.Lifetime = NumberRange.new(2, 3.5) + mist.Rate = rate + mist.Speed = NumberRange.new(2, 5) + mist.SpreadAngle = Vector2.new(70, 70) + mist.Parent = holder + end + mistAt(W + V(RIVER_X, WATER_Y + 1, zf + 2), V(RIVER_W, 1, 2), 14, 4, 11) + mistAt(W + V(RIVER_X, LIP_Y, zf), V(RIVER_W, 1, 1), 5, 2, 5) + end + + -- арочный деревянный мост через реку над водопадом + do + local bridge = Instance.new("Model") + bridge.Name = "Bridge" + bridge.Parent = map + local z, x0, x1, y0, rise = CLIFF_FRONT - 22, RIVER_X - 11, RIVER_X + 11, LIP_Y + 1, 3.2 + local N = 12 + local function arc(t) + return W + V(x0 + (x1 - x0) * t, y0 + math.sin(t * math.pi) * rise, z) + end + for i = 0, N - 1 do + local a, b = arc(i / N), arc((i + 1) / N) + P({ Size = V((b - a).Magnitude + 0.1, 0.5, 5), CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0), Color = COL.plank:Lerp(COL.plankDark, (i % 2) * 0.4), Material = PLANKS, Parent = bridge }) + end + for _, s in ipairs({ -1, 1 }) do + local prev + for i = 0, N, 2 do + local p = arc(i / N) + V(0, 0, s * 2.3) + vcyl(p + V(0, 1.4, 0), 2.8, 0.4, { Color = COL.log, Material = WOOD, Parent = bridge }) + if prev then + rod(prev + V(0, 2.6, 0), p + V(0, 2.6, 0), 0.32, { Color = COL.log, Material = WOOD, Parent = bridge }) + end + prev = p + end + end + end + + -------------------------------------------------- у воды: камни, рогоз, кувшинки + local function nearDock(x, z) + return math.abs(x) < 9 and z > 28 and z < 70 + end + local function inCliff(x, z) + return x > 24 and x < 118 and z < -58 and z > -150 + end + for _, l in ipairs(LAKES) do + for _ = 1, 9 do + local a = rng:NextNumber(0, math.pi * 2) + local r = l[3] + rng:NextNumber(-1, 2.5) + local x, z = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r + if not inLake(x, z, -4) and not nearDock(x, z) and not inCliff(x, z) then + rock(W + V(x, rng:NextNumber(0.5, 2.5), z), rng:NextNumber(2.5, 5.5)) + end + end + for _ = 1, 5 do + local a = rng:NextNumber(0, math.pi * 2) + local r = l[3] + rng:NextNumber(-1.5, 0.5) + local x, z = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r + if not inLake(x, z, -3) and not nearDock(x, z) and not inCliff(x, z) then + cattails(W + V(x, WATER_Y - 0.5, z)) + end + end + end + for _, p in ipairs({ { 11, 55 }, { 15, 52 }, { -9, 53 }, { 20, 47 } }) do -- рогоз в правом нижнем углу кадра + cattails(W + V(p[1], WATER_Y - 0.5, p[2])) + end + for _ = 1, 14 do -- кувшинки группами + local l = LAKES[rng:NextInteger(1, #LAKES)] + local a = rng:NextNumber(0, math.pi * 2) + local r = l[3] * rng:NextNumber(0.5, 0.88) + local cx, cz = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r + for _ = 1, rng:NextInteger(2, 5) do + local x, z = cx + rng:NextNumber(-3, 3), cz + rng:NextNumber(-3, 3) + if inLake(x, z, -2) and not nearDock(x, z) and not (x > 6 and x < 20 and z > 36 and z < 56) then + local size = rng:NextNumber(2, 3.4) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.15, size, size), CFrame = CFrame.new(W + V(x, WATER_Y + 0.12, z)) * CFrame.Angles(0, 0, math.rad(90)), Color = Color3.fromRGB(78, 168, 70):Lerp(Color3.fromRGB(110, 190, 80), rng:NextNumber()), Material = SMOOTH, CanCollide = false, CastShadow = false }) + if rng:NextNumber() < 0.35 then + ball(W + V(x + 0.3, WATER_Y + 0.45, z), 0.8, { Color = Color3.fromRGB(255, 150, 195), Material = SMOOTH, CanCollide = false, CastShadow = false }) + ball(W + V(x + 0.3, WATER_Y + 0.75, z), 0.4, { Color = Color3.fromRGB(255, 235, 120), Material = SMOOTH, CanCollide = false, CastShadow = false }) + end + end + end + end + + -------------------------------------------------- лес, кусты, цветы + local function nearPath(x, z, dist) + for i = 2, #HILL_PATH do + local a, b = HILL_PATH[i - 1], HILL_PATH[i] + local abx, abz = b[1] - a[1], b[2] - a[2] + local t = math.clamp(((x - a[1]) * abx + (z - a[2]) * abz) / (abx * abx + abz * abz), 0, 1) + if (x - a[1] - abx * t) ^ 2 + (z - a[2] - abz * t) ^ 2 < dist * dist then + return true + end + end + return false + end + local function freeSpot(x, z) + if math.abs(x) > 236 or math.abs(z) > 236 or inLake(x, z, 6) or inCliff(x, z) or nearPath(x, z, 6) then + return false + end + if x > -32 and x < 30 and z > 44 and z < 100 then -- прибытие, лавка, портал + return false + end + for _, c in ipairs({ { -58, -62, 16 }, { 8, -96, 13 }, { -76, -136, 11 }, { -17, -80, 5 } }) do + if (x - c[1]) ^ 2 + (z - c[2]) ^ 2 < c[3] * c[3] then + return false + end + end + return not (x > 2 and x < 14 and z > -100 and z < -64) -- мостки у домика + end + + local placed = 0 + for _ = 1, 700 do + if placed >= 210 then + break + end + local x, z = rng:NextNumber(-236, 236), rng:NextNumber(-236, 236) + -- за озером лес гуще, перед ним (за спиной игрока) реже + if (z < 0 or rng:NextNumber() < 0.45) and freeSpot(x, z) then + local far = math.max(math.abs(x), math.abs(z)) > 150 + pine(W + V(x, hillY(x, z) - 0.3, z), far and rng:NextNumber(22, 32) or rng:NextNumber(15, 25), far and 2 or 3) + placed += 1 + end + end + for _ = 1, 25 do -- лиственные деревья у берегов + local l = LAKES[rng:NextInteger(1, #LAKES)] + local a = rng:NextNumber(0, math.pi * 2) + local r = l[3] + rng:NextNumber(8, 18) + local x, z = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r + if freeSpot(x, z) then + leafy(W + V(x, hillY(x, z) - 0.3, z), rng:NextNumber(8, 12)) + end + end + for _ = 1, 50 do -- кусты + local x, z = rng:NextNumber(-150, 150), rng:NextNumber(-150, 120) + if freeSpot(x, z) then + local y = hillY(x, z) + local c = COL.leafDark:Lerp(COL.leaf, rng:NextNumber()) + for _ = 1, 3 do + ball(W + V(x + rng:NextNumber(-1.5, 1.5), y + 0.8, z + rng:NextNumber(-1.5, 1.5)), rng:NextNumber(2.5, 4), { Color = c, Material = SMOOTH, CanCollide = false }) + end + end + end + for _ = 1, 80 do -- цветы + local x, z = rng:NextNumber(-120, 120), rng:NextNumber(-140, 110) + if freeSpot(x, z) or nearPath(x, z, 6) and not nearPath(x, z, 3) then + ball(W + V(x, hillY(x, z) + 0.4, z), 0.6, { + Color = ({ Color3.fromRGB(255, 120, 150), Color3.fromRGB(255, 230, 90), Color3.fromRGB(245, 245, 255), Color3.fromRGB(190, 140, 255) })[rng:NextInteger(1, 4)], + Material = SMOOTH, CanCollide = false, CastShadow = false, + }) + end + end + -- отдельные детали (деревья, камни, кусты, фонари) — в папку Decor, чтобы в Explorer было видно + -- главное: модели и маркеры World1*/Guide* + local decor = Instance.new("Folder") + decor.Name = "Decor" + decor.Parent = map + for _, c in ipairs(map:GetChildren()) do + if c:IsA("BasePart") and not c.Name:match("^World1") and not c.Name:match("^Guide") then + c.Parent = decor + end + end + + -------------------------------------------------- горизонт: горы и облака + do + local horizon = Instance.new("Folder") + horizon.Name = "Horizon" + horizon.Parent = map + -- гора — несколько острых пиков (кубы вершиной вверх) разного размера + local function mountain(a, dist, s) + local base = W + V(math.cos(a) * dist, 0, math.sin(a) * dist) + for k = 1, 3 do + local ss = k == 1 and s or s * rng:NextNumber(0.45, 0.7) + local off = k == 1 and V(0, 0, 0) or V(rng:NextNumber(-0.7, 0.7) * s, 0, rng:NextNumber(-0.4, 0.4) * s) + local apex = ss * rng:NextNumber(0.55, 0.75) -- высота пика над землёй + P({ + Size = V(ss, ss, ss), + CFrame = CFrame.new(base + off + V(0, apex - ss * 0.866, 0)) * CFrame.Angles(rng:NextNumber(-0.1, 0.1), rng:NextNumber(0, 6.28), rng:NextNumber(-0.1, 0.1)) * CUBE_UP, + Color = Color3.fromRGB(152, 166, 190):Lerp(Color3.fromRGB(118, 134, 164), rng:NextNumber()), Material = SMOOTH, + CanCollide = false, CanQuery = false, CastShadow = false, Parent = horizon, + }) + end + end + for i = 0, 13 do -- север (за озером) — крупнее и плотнее + mountain(math.rad(-160 + i * 10 + rng:NextNumber(-4, 4)), rng:NextNumber(340, 470), rng:NextNumber(130, 220)) + end + for i = 0, 9 do -- остальные стороны + mountain(math.rad(20 + i * 16 + rng:NextNumber(-5, 5)), rng:NextNumber(360, 480), rng:NextNumber(100, 160)) + end + for _ = 1, 9 do + local c = W + V(rng:NextNumber(-380, 380), rng:NextNumber(170, 230), rng:NextNumber(-420, 200)) + for _ = 1, rng:NextInteger(4, 6) do + ball(c + V(rng:NextNumber(-30, 30), rng:NextNumber(-5, 8), rng:NextNumber(-12, 12)), rng:NextNumber(22, 42), { + Color = Color3.new(1, 1, 1), Material = SMOOTH, CanCollide = false, CanQuery = false, CastShadow = false, Parent = horizon, + }) + end + end + end + + -- невидимые стены по краю мира + for _, w in ipairs({ + { V(0, 0, 245), V(500, 120, 2) }, + { V(0, 0, -245), V(500, 120, 2) }, + { V(245, 0, 0), V(2, 120, 500) }, + { V(-245, 0, 0), V(2, 120, 500) }, + }) do + P({ Name = "WorldWall", Size = w[2], Position = W + w[1] + V(0, 50, 0), Transparency = 1, CanQuery = false }) + end + + map.Parent = parent + return map +end + +-- сборка в Studio: стирает старую папку и террейн мира, строит заново прямо в Workspace +function Builder.bake() + local old = Workspace:FindFirstChild("World1Map") + if old then + old:Destroy() + end + terrain:FillBlock(CFrame.new(W + V(0, 30, 0)), V(504, 120, 504), Enum.Material.Air) + local map = Builder.build(Workspace) + print(("✅ «Тихое озеро» собрано: Workspace.World1Map, деталей: %d. Сохраните плейс (Ctrl+S)."):format(#map:GetDescendants())) + return map +end + +return Builder +]=====]) +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 ServerStorage = game:GetService("ServerStorage") +local Lighting = game:GetService("Lighting") +local Players = game:GetService("Players") +local RunService = game:GetService("RunService") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local ServerScriptService = game:GetService("ServerScriptService") + +-- в Command Bar require кэширует модули: берём копии, чтобы подхватывать свежие правки из Rojo +-- (копия на время загрузки лежит рядом с оригиналом — модули ищут соседей через script.Parent) +local function load(module) + if RunService:IsRunning() then + return require(module) + end + local copy = module:Clone() + copy.Parent = module.Parent + local ok, result = pcall(require, copy) + copy:Destroy() + if not ok then + error(result, 0) + end + return result +end +local Config = load(ReplicatedStorage:WaitForChild("FishConfig")) +local Models = load(ReplicatedStorage:WaitForChild("GameModels")) +local World1Builder = load(ServerScriptService:WaitForChild("World1Builder")) + +local V = Vector3.new +local terrain = Workspace.Terrain +local GROUND_Y = 4 -- верх земли в мирах (запасная высота для groundY) +local FLOOR = 1 -- верх пола лобби + +local Builder = {} +local map -- папка FishingMap, которую сейчас строим +local rng = Random.new(7) + +---------------------------------------------------------------- свет и атмосфера + +local function ensure(class, parent, props) + local obj = parent:FindFirstChildOfClass(class) or Instance.new(class) + for k, v in pairs(props) do + obj[k] = v + end + obj.Parent = parent + return obj +end + +-- Базовый свет при запуске игры (совпадает со светом лобби). Под каждую локацию его меняет клиент +-- по полям look из FishConfig, пока игрок за экраном загрузки. +function Builder.applyLighting() + Lighting.ClockTime = 16.3 + Lighting.Brightness = 2.0 + Lighting.ExposureCompensation = -0.3 + Lighting.Ambient = Color3.fromRGB(64, 60, 72) + Lighting.OutdoorAmbient = Color3.fromRGB(120, 114, 124) + Lighting.ColorShift_Top = Color3.fromRGB(255, 224, 186) + Lighting.EnvironmentDiffuseScale = 0.5 + Lighting.EnvironmentSpecularScale = 0.5 + Lighting.GlobalShadows = true + ensure("Atmosphere", Lighting, { + Density = 0.4, Offset = 0.18, Glare = 0.25, Haze = 1.6, + Color = Color3.fromRGB(222, 212, 204), Decay = Color3.fromRGB(186, 160, 150), + }) + ensure("BloomEffect", Lighting, { Intensity = 0.3, Size = 24, Threshold = 1.8 }) + ensure("ColorCorrectionEffect", Lighting, { + Saturation = 0.18, Contrast = 0.14, Brightness = -0.04, TintColor = Color3.fromRGB(255, 242, 228), + }) + ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.7 }) + -- размытие дальнего плана включают миры и лобби через look.dof + ensure("DepthOfFieldEffect", Lighting, { Enabled = false, FarIntensity = 0.18, FocusDistance = 55, InFocusRadius = 95, NearIntensity = 0 }) +end + +---------------------------------------------------------------- помощники + +local function P(props) + local p = Instance.new("Part") + if props.Shape then + p.Shape = props.Shape + end + p.Anchored = true + p.TopSurface = Enum.SurfaceType.Smooth + p.BottomSurface = Enum.SurfaceType.Smooth + for k, v in pairs(props) do + if k ~= "Parent" and k ~= "Shape" then + p[k] = v + end + end + p.Parent = props.Parent or map + return p +end + +local function vcyl(pos, h, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(h, d, d) + props.CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)) + return P(props) +end + +local function ball(pos, d, props) + props.Shape = Enum.PartType.Ball + props.Size = V(d, d, d) + props.Position = pos + return P(props) +end + +local function surfaceText(part, face, text, color, extra) + local sg = Instance.new("SurfaceGui") + sg.Face = face + sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud + sg.PixelsPerStud = 40 + sg.LightInfluence = 0 + sg.Parent = part + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.RichText = true + t.TextColor3 = color or Color3.new(1, 1, 1) + t.TextStrokeTransparency = 0.4 + t.Text = text + t.Parent = sg + local pad = Instance.new("UIPadding") + pad.PaddingLeft = UDim.new(0.05, 0) + pad.PaddingRight = UDim.new(0.05, 0) + pad.PaddingTop = UDim.new(0.06, 0) + pad.PaddingBottom = UDim.new(0.06, 0) + pad.Parent = t + for k, v in pairs(extra or {}) do + t[k] = v + end + return t +end + +local function billboard(target, text, color, offsetY, width) + local bb = Instance.new("BillboardGui") + bb.Size = UDim2.fromOffset(width or 300, 64) + bb.StudsOffset = V(0, offsetY or 5, 0) + bb.MaxDistance = 160 + bb.LightInfluence = 0 + bb.Parent = target + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = color or Color3.new(1, 1, 1) + t.TextStrokeTransparency = 0.15 + t.Text = text + t.Parent = bb + return bb +end + +local function prompt(target, actionText, objectText, action, dist) + local pp = Instance.new("ProximityPrompt") + pp.ActionText = actionText + pp.ObjectText = objectText + pp.HoldDuration = 0 + pp.MaxActivationDistance = dist or 13 + pp.RequiresLineOfSight = false + pp:SetAttribute("Action", action) + pp.Parent = target + return pp +end + +local function marker(name, cf) + return P({ Name = name, Size = V(4, 1, 4), CFrame = cf, Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false }) +end + +local function lobbyCliffs() + local template = ServerStorage:FindFirstChild("FishingCliffTemplate") + if not template or not template:IsA("Model") then + warn("FishingCliffTemplate отсутствует; используем низкую изгородь лобби") + for deg = 0, 359, 7 do + local a = math.rad(deg) + local p = V(math.cos(a) * 82, FLOOR + 2, math.sin(a) * 82) + P({ Size = V(10.5, 4, 3), CFrame = CFrame.lookAt(p, V(0, p.Y, 0)), Material = Enum.Material.Grass, Color = Color3.fromRGB(60, 130, 55) }) + end + return + end + + local ring = Instance.new("Folder") + ring.Name = "LobbyCliffs" + ring.Parent = map + local count = 24 + local tiers = { + { name = "LobbyCliff", radius = 88, scale = 1.4, baseY = FLOOR }, + { name = "LobbyCliffUpper", radius = 104, scale = 2.2, baseY = FLOOR + 10 }, + } + for _, tier in ipairs(tiers) do + for i = 1, count do + local angle = (i - 1) * 2 * math.pi / count + local radial = V(math.cos(angle), 0, math.sin(angle)) + local center = V(radial.X * tier.radius, tier.baseY, radial.Z * tier.radius) + local model = template:Clone() + model.Name = string.format("%s_%02d", tier.name, i) + model:ScaleTo(tier.scale) + local facing = CFrame.lookAt(center, center + radial) + local rotation = facing - facing.Position + model:PivotTo(CFrame.new(center) * rotation) + local boxCF, boxSize = model:GetBoundingBox() + local targetBoxCenter = V(center.X, tier.baseY + boxSize.Y / 2, center.Z) + model:PivotTo(model:GetPivot() + (targetBoxCenter - boxCF.Position)) + model.Parent = ring + end + end +end + +local function rockTopPosition(cliffs, radial, desiredRadius, radiusOffsets) + local params = RaycastParams.new() + params.FilterType = Enum.RaycastFilterType.Include + params.FilterDescendantsInstances = { cliffs } + for _, offset in ipairs(radiusOffsets) do + local radius = desiredRadius + offset + local origin = V(radial.X * radius, 128, radial.Z * radius) + local hit = Workspace:Raycast(origin, V(0, -180, 0), params) + if hit then + return hit.Position + end + end + return V(radial.X * desiredRadius, FLOOR, radial.Z * desiredRadius) +end + +local function placeModelOnRock(model, position, yaw) + local rotation = CFrame.Angles(0, yaw, 0) + model:PivotTo(CFrame.new(position) * rotation) + local boxCF, boxSize = model:GetBoundingBox() + local targetBoxCenter = V(position.X, position.Y + boxSize.Y / 2, position.Z) + model:PivotTo(model:GetPivot() + (targetBoxCenter - boxCF.Position)) +end + +local function lobbyTrees() + local templates = ServerStorage:FindFirstChild("LobbyTreeTemplates") + local cliffs = map:FindFirstChild("LobbyCliffs") + if not templates or not cliffs then + warn("LobbyTreeTemplates или LobbyCliffs отсутствует; деревья лобби пропущены") + return + end + local treeTypes = { "LargeCanopy", "Pine", "RoundCanopy" } + local treeScale = { LargeCanopy = 1, Pine = 1.25, RoundCanopy = 1.2 } + local folder = Instance.new("Folder") + folder.Name = "LobbyTrees" + folder.Parent = map + for layer = 1, 2 do + local baseRadius = layer == 1 and 84 or 96 + local radiusOffsets = { 0, -2, 2, -4, 4, -6, 6 } + for i = 1, 18 do + local degrees = (i - 1) * 20 + 10 + (layer == 2 and 10 or 0) + local angle = math.rad(degrees) + local radial = V(math.cos(angle), 0, math.sin(angle)) + local position = rockTopPosition(cliffs, radial, baseRadius, radiusOffsets) + local kind = treeTypes[(i + layer - 2) % #treeTypes + 1] + local template = templates:FindFirstChild(kind) + if template and template:IsA("Model") then + local model = template:Clone() + model.Name = string.format("LobbyTree_L%d_%02d_%s", layer, i, kind) + model:ScaleTo(treeScale[kind]) + placeModelOnRock(model, position, math.rad((i * 47 + layer * 23) % 360)) + for _, part in ipairs(model:GetDescendants()) do + if part:IsA("BasePart") then part.Anchored = true end + end + model.Parent = folder + end + end + end +end + +local function lobbyRockPlants() + local templates = ServerStorage:FindFirstChild("LobbyRockPlantTemplates") + local cliffs = map:FindFirstChild("LobbyCliffs") + if not templates or not cliffs then + warn("LobbyRockPlantTemplates или LobbyCliffs отсутствует; растительность скал пропущена") + return + end + local folder = Instance.new("Folder") + folder.Name = "LobbyRockPlants" + folder.Parent = map + local clusterAngles = { + { layer = 1, degrees = 45 }, { layer = 1, degrees = 135 }, + { layer = 1, degrees = 225 }, { layer = 1, degrees = 315 }, + { layer = 2, degrees = 0 }, { layer = 2, degrees = 90 }, + { layer = 2, degrees = 180 }, { layer = 2, degrees = 270 }, + } + local tuftKinds = { "GrassTuft", "BladeGrass", "GrassTuft", "FlowerPatch", "GrassTuft", "WideGrass" } + local tuftScales = { GrassTuft = 1.15, BladeGrass = 1.45, FlowerPatch = 1.1, WideGrass = 0.55 } + local offsets = { { 0, 0 }, { -2.2, 0 }, { 2.2, 0 }, { 0, -2.2 }, { 0, 2.2 }, { 1.6, 1.6 } } + local rayParams = RaycastParams.new() + rayParams.FilterType = Enum.RaycastFilterType.Include + rayParams.FilterDescendantsInstances = { cliffs } + for clusterIndex, cluster in ipairs(clusterAngles) do + local baseRadius = cluster.layer == 1 and 84 or 96 + local baseAngle = math.rad(cluster.degrees) + local radial = V(math.cos(baseAngle), 0, math.sin(baseAngle)) + local tangent = V(-radial.Z, 0, radial.X) + local basePos = rockTopPosition(cliffs, radial, baseRadius, { 0, -2, 2, -4, 4, -6, 6 }) + local bush = Instance.new("Model") + bush.Name = string.format("GrassBush_%02d_L%d", clusterIndex, cluster.layer) + for i, offset in ipairs(offsets) do + local xz = basePos + radial * offset[1] + tangent * offset[2] + local plantPos + for _, correction in ipairs({ 0, -2, 2, -4, 4 }) do + local candidate = xz + radial * correction + local hit = Workspace:Raycast(V(candidate.X, 128, candidate.Z), V(0, -180, 0), rayParams) + if hit then plantPos = hit.Position; break end + end + if plantPos then + local kind = tuftKinds[i] + local template = templates:FindFirstChild(kind) + if template and template:IsA("Model") then + local plant = template:Clone() + plant.Name = kind .. "_" .. i + plant:ScaleTo(tuftScales[kind]) + placeModelOnRock(plant, plantPos, math.rad((clusterIndex * 37 + i * 53) % 360)) + for _, part in ipairs(plant:GetDescendants()) do + if part:IsA("BasePart") then part.Anchored = true end + end + plant.Parent = bush + end + end + end + bush.Parent = folder + end +end +-- холмы и горы за скалами лобби (террейн), ельники на склонах и кольцо тумана за горами. +-- К горизонту холмы выше, чтобы из лобби было видно не пустоту, а гряду в дымке. +local function lobbyHillHeight(x, z) + local r = math.sqrt(x * x + z * z) + if r < 120 then + return nil + end + local t = math.clamp((r - 120) / 220, 0, 1) + local base = 22 + 90 * t ^ 0.85 + local n = math.noise(x / 95, z / 95, 1.7) * 30 + math.noise(x / 38, z / 38, 5.1) * 9 + local peak = math.max(0, math.noise(x / 150, z / 150, 9.3)) * 70 * t + local edge = math.clamp((r - 120) / 12, 0, 1) + return (base + n * (0.35 + 0.65 * t) + peak) * edge +end + +local function lobbyHills() + local R, Y0, Y1, CH = 384, -8, 232, 64 + for cx = -R, R - CH, CH do + for cz = -R, R - CH, CH do + -- чанк целиком внутри лобби пропускаем + local far = math.sqrt(math.max(cx * cx, (cx + CH) ^ 2) + math.max(cz * cz, (cz + CH) ^ 2)) + if far >= 120 then + local region = Region3.new(V(cx, Y0, cz), V(cx + CH, Y1, cz + CH)) + local nx, ny, nz = CH / 4, (Y1 - Y0) / 4, CH / 4 + local mats, occs = {}, {} + for i = 1, nx do + mats[i], occs[i] = {}, {} + for j = 1, ny do + mats[i][j], occs[i][j] = {}, {} + end + for k = 1, nz do + local x, z = cx + (i - 0.5) * 4, cz + (k - 0.5) * 4 + local h = (math.sqrt(x * x + z * z) <= R) and lobbyHillHeight(x, z) or nil + for j = 1, ny do + local yb = Y0 + (j - 1) * 4 + local occ = h and math.clamp((h - yb) / 4, 0, 1) or 0 + local m = Enum.Material.Air + if occ > 0 then + if yb > h - 6 then + m = h > 118 and Enum.Material.Rock or Enum.Material.Grass + else + m = Enum.Material.Ground + end + end + mats[i][j][k], occs[i][j][k] = m, occ + end + end + end + terrain:WriteVoxels(region, 4, mats, occs) + end + end + end + + -- ельники пятнами на склонах + local pines = ServerStorage:FindFirstChild("OldPines") + local forest = Instance.new("Folder") + forest.Name = "LobbyHillForest" + forest.Parent = map + if pines and #pines:GetChildren() > 0 then + local templates = pines:GetChildren() + local frng = Random.new(1104) + local placed = {} + for _ = 1, 4000 do + if #placed >= 170 then break end + local a = frng:NextNumber(0, math.pi * 2) + local r = frng:NextNumber(132, 300) + local x, z = math.cos(a) * r, math.sin(a) * r + -- высоту берём из той же формулы: лучи по только что залитому террейну в редакторе ненадёжны + local h = lobbyHillHeight(x, z) + local slope = h and math.max(math.abs((lobbyHillHeight(x + 4, z) or h) - h), math.abs((lobbyHillHeight(x, z + 4) or h) - h)) / 4 + if h and h <= 118 and slope < 0.8 and math.noise(x / 60, z / 60, 3.3) > -0.05 then + local ground = V(x, h, z) + local ok = true + for _, q in ipairs(placed) do + if (q - ground).Magnitude < 9 then ok = false break end + end + if ok then + local m = templates[frng:NextInteger(1, #templates)]:Clone() + for _, d in ipairs(m:GetDescendants()) do + if d:IsA("LuaSourceContainer") then + d:Destroy() + elseif d:IsA("BasePart") then + d.Anchored = true + d.CanCollide = false + d.CastShadow = false + end + end + m:ScaleTo(m:GetScale() * frng:NextNumber(0.8, 1.5)) + m:PivotTo(CFrame.new(ground) * CFrame.Angles(0, frng:NextNumber(0, math.pi * 2), 0)) + local bcf, bsz = m:GetBoundingBox() + m:PivotTo(m:GetPivot() + V(0, ground.Y - (bcf.Position.Y - bsz.Y / 2) - 1, 0)) + m.Parent = forest + table.insert(placed, ground) + end + end + end + end + + -- туман за горами: медленные крупные клубы по двум кольцам + local haze = Instance.new("Folder") + haze.Name = "LobbyHaze" + haze.Parent = map + for ring, cfg in ipairs({ { r = 150, n = 28, y = 18, size = 45 }, { r = 250, n = 36, y = 40, size = 70 } }) do + for i = 1, cfg.n do + local a = (i - 1) / cfg.n * math.pi * 2 + local x, z = math.cos(a) * cfg.r, math.sin(a) * cfg.r + local h = lobbyHillHeight(x, z) or 0 + local anchor = Instance.new("Part") + anchor.Name = "HazeAnchor" + anchor.Anchored = true + anchor.CanCollide = false + anchor.CanQuery = false + anchor.CanTouch = false + anchor.Transparency = 1 + anchor.Size = V(30, 4, 30) + anchor.CFrame = CFrame.new(x, h + cfg.y, z) + anchor.Parent = haze + local pe = Instance.new("ParticleEmitter") + pe.Texture = "rbxasset://textures/particles/smoke_main.dds" + pe.Color = ColorSequence.new(Color3.fromRGB(236, 228, 220)) + pe.LightEmission = 0.15 + pe.LightInfluence = 0.6 + pe.Rate = ring == 1 and 0.5 or 0.35 + pe.Lifetime = NumberRange.new(16, 22) + pe.Speed = NumberRange.new(0.3, 0.8) + pe.SpreadAngle = Vector2.new(60, 60) + pe.Rotation = NumberRange.new(0, 360) + pe.RotSpeed = NumberRange.new(-4, 4) + pe.Size = NumberSequence.new({ + NumberSequenceKeypoint.new(0, cfg.size * 0.7), + NumberSequenceKeypoint.new(1, cfg.size * 1.2), + }) + pe.Transparency = NumberSequence.new({ + NumberSequenceKeypoint.new(0, 1), + NumberSequenceKeypoint.new(0.3, 0.8), + NumberSequenceKeypoint.new(0.7, 0.82), + NumberSequenceKeypoint.new(1, 1), + }) + pe.Parent = anchor + end + end +end + +-- высота земли: читаем воксели столбца (лучи по только что залитому террейну ненадёжны, особенно в редакторе) +local function groundY(x, z) + local region = Region3.new(V(x - 1, -128, z - 1), V(x + 1, 160, z + 1)):ExpandToGrid(4) + local ok, mats, occ = pcall(terrain.ReadVoxels, terrain, region, 4) + if ok then + local bottom = region.CFrame.Position.Y - region.Size.Y / 2 + for y = mats.Size.Y, 1, -1 do + local m = mats[1][y][1] + if m ~= Enum.Material.Air and m ~= Enum.Material.Water then + return bottom + (y - 1 + occ[1][y][1]) * 4, m + end + end + end + return GROUND_Y +end + +local function lamp(pos, color) + vcyl(pos + V(0, 4.5, 0), 9, 0.5, { Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + P({ Size = V(1.4, 0.3, 1.4), Position = pos + V(0, 9.1, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + local bulb = P({ Size = V(1, 1.4, 1), Position = pos + V(0, 9.95, 0), Material = Enum.Material.Neon, Color = color or Color3.fromRGB(255, 215, 150) }) + P({ Size = V(1.5, 0.35, 1.5), Position = pos + V(0, 10.8, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + local light = Instance.new("PointLight") + light.Range = 16 + light.Brightness = 1.2 + light.Color = color or Color3.fromRGB(255, 210, 150) + light.Parent = bulb +end + +local function tree(pos, kind) + if kind == "pine" then + local h = rng:NextNumber(8, 12) + vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(95, 65, 40), Material = Enum.Material.Wood }) + for i = 0, 3 do + ball(pos + V(0, h * 0.4 + i * 2.8, 0), 10 - i * 2.2, { Color = Color3.fromRGB(35, 100 + i * 10, 55), Material = Enum.Material.Grass }) + end + else + local birch = kind == "birch" + local h = rng:NextNumber(7, 10) + vcyl(pos + V(0, h / 2, 0), h, 1.5, { + Color = birch and Color3.fromRGB(225, 222, 210) or Color3.fromRGB(105, 72, 45), + Material = Enum.Material.Wood, + }) + local leaf = birch and Color3.fromRGB(150, 195, 80) or Color3.fromRGB(65, rng:NextInteger(135, 165), 60) + local s = rng:NextNumber(9, 12) + ball(pos + V(0, h + s * 0.25, 0), s, { Color = leaf, Material = Enum.Material.Grass }) + ball(pos + V(s * 0.35, h - 0.5, s * 0.1), s * 0.7, { Color = leaf, Material = Enum.Material.Grass }) + ball(pos + V(-s * 0.3, h - 0.2, -s * 0.2), s * 0.65, { Color = leaf, Material = Enum.Material.Grass }) + end +end + +local function bush(pos) + local c = Color3.fromRGB(55, rng:NextInteger(120, 150), 55) + for i = 1, 3 do + ball(pos + V(rng:NextNumber(-1.5, 1.5), 1, rng:NextNumber(-1.5, 1.5)), rng:NextNumber(2.5, 4), { Color = c, Material = Enum.Material.Grass }) + end + if rng:NextNumber() < 0.5 then + for i = 1, 4 do + ball(pos + V(rng:NextNumber(-1.8, 1.8), rng:NextNumber(1.5, 2.6), rng:NextNumber(-1.8, 1.8)), 0.5, { + Color = ({ Color3.fromRGB(255, 120, 150), Color3.fromRGB(255, 230, 90), Color3.fromRGB(240, 240, 255) })[rng:NextInteger(1, 3)], + CanCollide = false, + }) + end + end +end + +local function bench(cf) + local seat = Instance.new("Seat") + seat.Anchored = true + seat.Size = V(5, 0.4, 1.6) + seat.CFrame = cf * CFrame.new(0, 1.6, 0) + seat.Material = Enum.Material.WoodPlanks + seat.Color = Color3.fromRGB(150, 105, 65) + seat.TopSurface = Enum.SurfaceType.Smooth + seat.Parent = map + for _, x in ipairs({ -2.1, 2.1 }) do + P({ Size = V(0.4, 1.4, 1.4), CFrame = cf * CFrame.new(x, 0.7, 0), Color = Color3.fromRGB(50, 50, 55), Material = Enum.Material.Metal }) + end + P({ Size = V(5, 1.3, 0.3), CFrame = cf * CFrame.new(0, 2.6, 0.75) * CFrame.Angles(math.rad(-10), 0, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 105, 65) }) +end + +-- место NPC: полупрозрачная фигура в редакторе; сам NPC встаёт сюда при запуске (prepareRuntime) +local function setNpc(part, name, colors, action, actionText) + part:SetAttribute("NpcName", name) + part:SetAttribute("SkinColor", colors.skin) + part:SetAttribute("ShirtColor", colors.shirt) + part:SetAttribute("PantsColor", colors.pants) + part:SetAttribute("HatColor", colors.hat) + part:SetAttribute("NpcAction", action) + part:SetAttribute("NpcActionText", actionText) + part.Size = V(2, 5, 1) + part.Color = colors.shirt + part.Transparency = 0.5 + part.CanCollide = false + part.CanQuery = false + part.CanTouch = false + return part +end + +local function npc(name, cf, colors, action, actionText) + return setNpc(P({ Name = "NpcSpot", CFrame = cf }), name, colors, action, actionText) +end + +-- доска «кто водится»: атрибуты Bestiary (зона), BestiaryTitle, BestiaryHex; текст пишется заново при запуске +local function writeBestiary(board) + local old = board:FindFirstChild("BestiaryText") + if old then + old:Destroy() + end + local zone = Config.Zones[board:GetAttribute("Bestiary")] + if not zone then + return + end + local lines = { ("%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 + +-- Лавки в стиле low poly: без фотореалистичных текстур (доски, ткань), плоские цвета с разбросом оттенков. +-- Большие дощатые панели (стены, пол, крыша) режутся на отдельные доски, шарики-гирлянды становятся +-- ромбиками-флажками, неоновая рамка вывески — матовой золотой. frame — CFrame лавки (для флажков), может быть nil. +local LOWPOLY_FLAT = { + [Enum.Material.WoodPlanks] = true, [Enum.Material.Wood] = true, [Enum.Material.Fabric] = true, + [Enum.Material.Metal] = true, [Enum.Material.Brick] = true, [Enum.Material.Plastic] = true, +} + +local function lowPolyShade(c, lrng, spread) + local k = 1 + lrng:NextNumber(-spread, spread) + return Color3.new(math.clamp(c.R * k, 0, 1), math.clamp(c.G * k, 0, 1), math.clamp(c.B * k, 0, 1)) +end + +local function lowPolyPlanks(p, lrng) + local s = p.Size + local dims = { s.X, s.Y, s.Z } + local thin = 1 + for i = 2, 3 do + if dims[i] < dims[thin] then thin = i end + end + -- режем вдоль самой длинной горизонтальной оси (кроме тонкой): стены — вертикальные доски, пол — продольные + local axis = (thin ~= 1 and (thin == 3 or s.X >= s.Z)) and 1 or 3 + local len = dims[axis] + local n = math.max(2, math.floor(len / 1.8 + 0.5)) + local w = len / n + for i = 1, n do + local off = -len / 2 + w * (i - 0.5) + local depth = lrng:NextNumber(-0.06, 0.06) + local o = { 0, 0, 0 } + o[axis] = off + o[thin] = depth + local size = { s.X, s.Y, s.Z } + size[axis] = w + local plank = Instance.new("Part") + plank.Name = "Plank" + plank.Anchored = true + plank.TopSurface, plank.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth + plank.Material = Enum.Material.SmoothPlastic + plank.Size = V(size[1], size[2], size[3]) + plank.CFrame = p.CFrame * CFrame.new(o[1], o[2], o[3]) + plank.Color = lowPolyShade(p.Color, lrng, 0.09) + plank.CanCollide, plank.CastShadow, plank.CanQuery = p.CanCollide, p.CastShadow, p.CanQuery + plank.Parent = p.Parent + end + p:Destroy() +end + +function Builder.lowPolyParts(parts, frame, seed) + local lrng = Random.new(seed or 5) + for _, p in ipairs(parts) do + if p:IsA("BasePart") and p.Parent and p.Transparency < 0.5 and not p.Name:find("Npc") then + local isBlock = p.ClassName == "Part" and p.Shape == Enum.PartType.Block + if p.Material == Enum.Material.Fabric and p.ClassName == "Part" and p.Shape == Enum.PartType.Ball and frame then + -- шарик гирлянды → ромбик-флажок, повёрнутый к покупателям + local d = p.Size.X + local flag = Instance.new("Part") + flag.Name = "Pennant" + flag.Anchored = true + flag.CanCollide = false + flag.Material = Enum.Material.SmoothPlastic + flag.Size = V(d * 1.15, d * 1.15, 0.25) + flag.CFrame = CFrame.new(p.Position) * (frame - frame.Position) * CFrame.Angles(0, 0, math.rad(45)) + flag.Color = p.Color + flag.Parent = p.Parent + p:Destroy() + elseif p.Material == Enum.Material.Neon and math.max(p.Size.X, p.Size.Y, p.Size.Z) > 4 then + p.Material = Enum.Material.SmoothPlastic -- рамка вывески: без свечения + p.Color = Color3.fromRGB(214, 160, 70) + elseif p.Material == Enum.Material.WoodPlanks and isBlock and #p:GetChildren() == 0 + and math.min(p.Size.X, p.Size.Y, p.Size.Z) <= 1.2 and math.max(p.Size.X, p.Size.Z) >= 4 then + lowPolyPlanks(p, lrng) + elseif LOWPOLY_FLAT[p.Material] then + p.Material = Enum.Material.SmoothPlastic + p.Color = lowPolyShade(p.Color, lrng, 0.06) + end + end + end +end + +-- детали лавки, построенной stall(cf): всё, что лежит в её габаритах прямо в папке parent +function Builder.stallParts(cf, parent) + local list = {} + for _, p in ipairs(parent:GetChildren()) do + if p:IsA("BasePart") then + local l = cf:PointToObjectSpace(p.Position) + if math.abs(l.X) <= 15.5 and l.Y >= -0.5 and l.Y <= 21 and l.Z >= -14.5 and l.Z <= 9.5 then + table.insert(list, p) + end + end + end + return list +end + +-- лавка: cf стоит на полу, сторона -Z смотрит на покупателей +local function stall(cf, opt) + local function at(x, y, z) + return cf * CFrame.new(x, y, z) + end + local wall, dark = opt.wall, opt.wall:Lerp(Color3.new(0, 0, 0), 0.3) + + P({ Size = V(24, 1, 17), CFrame = at(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 120, 80) }) + P({ Size = V(24, 13, 1), CFrame = at(0, 7.5, 8), Material = Enum.Material.WoodPlanks, Color = wall }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(1, 13, 17), CFrame = at(s * 11.5, 7.5, 0), Material = Enum.Material.WoodPlanks, Color = wall }) + P({ Size = V(1.5, 14.5, 1.5), CFrame = at(s * 11.6, 7.25, -8.3), Material = Enum.Material.Wood, Color = dark }) + end + P({ Size = V(26, 1, 19), CFrame = at(0, 14.5, 0), Material = Enum.Material.WoodPlanks, Color = dark }) + -- полосатый навес + for i = 0, 7 do + P({ + Size = V(3, 0.35, 6), + CFrame = at(-10.5 + i * 3, 13.1, -10.6) * CFrame.Angles(math.rad(-22), 0, 0), + Material = Enum.Material.Fabric, + Color = (i % 2 == 0) and opt.stripeA or opt.stripeB, + }) + ball(at(-10.5 + i * 3, 11.9, -13.3).Position, 0.9, { Color = (i % 2 == 0) and opt.stripeA or opt.stripeB, Material = Enum.Material.Fabric }) + end + -- прилавок + local counter = P({ Size = V(18, 4, 3), CFrame = at(0, 3, -4), Material = Enum.Material.WoodPlanks, Color = wall }) + P({ Size = V(19, 0.5, 3.8), CFrame = at(0, 5.25, -4), Material = Enum.Material.Wood, Color = dark }) + -- вывеска + local board = P({ Size = V(20, 4.5, 0.6), CFrame = at(0, 17.6, -9.2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 45, 30) }) + P({ Size = V(20.8, 5.3, 0.3), CFrame = at(0, 17.6, -8.9), Material = Enum.Material.Neon, Color = opt.glow }) + for _, x in ipairs({ -8, 8 }) do + P({ Size = V(0.6, 3, 0.6), CFrame = at(x, 15.5, -9.2), Material = Enum.Material.Wood, Color = dark }) + end + surfaceText(board, Enum.NormalId.Front, opt.title, opt.titleColor) + -- фонарики + for _, x in ipairs({ -9.5, 9.5 }) do + local l = P({ Size = V(0.8, 1.1, 0.8), CFrame = at(x, 11.2, -9.4), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 210, 140) }) + local light = Instance.new("PointLight") + light.Range = 14 + light.Brightness = 1 + light.Color = Color3.fromRGB(255, 210, 150) + light.Parent = l + end + -- бочки по бокам + for _, s in ipairs({ -1, 1 }) do + vcyl(at(s * 14.5, 2.6, -5).Position, 3.2, 2.6, { Color = Color3.fromRGB(130, 85, 50), Material = Enum.Material.Wood }) + vcyl(at(s * 14.5, 2.6, -5).Position, 0.3, 2.75, { Color = Color3.fromRGB(70, 70, 75), Material = Enum.Material.Metal }) + end + + prompt(counter, opt.promptText, opt.promptObject, opt.action, 14) + if opt.npcName then + npc(opt.npcName, at(0, 4, 1.5), opt.npcColors) + end + if opt.decor then + opt.decor(at) + end + Builder.lowPolyParts(Builder.stallParts(cf, map), cf, math.floor(cf.Position.X + cf.Position.Z)) + return counter +end + +-- Модель портала из ServerStorage.FishingPortalTemplate, перекрашенная в цвет мира и +-- поставленная основанием на baseCF. Без шаблона возвращает nil (тогда строится старое кольцо). +function Builder.portalModel(baseCF, color, name, parent) + local template = ServerStorage:FindFirstChild("FishingPortalTemplate") + if not (template and template:IsA("Model")) then + return nil + end + local model = template:Clone() + model.Name = name + for _, part in ipairs(model:GetDescendants()) do + if part:IsA("BasePart") then + local c = part.Color + local isGreen = c.G > c.R * 1.15 and c.G > c.B * 1.10 and c.G > 0.25 + if part.Material == Enum.Material.Neon then + part.Color = color + elseif isGreen then + part.Color = color:Lerp(Color3.fromRGB(55, 65, 75), 0.30) + part.Material = Enum.Material.SmoothPlastic + end + elseif part:IsA("ParticleEmitter") then + part.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + end + end + + local pivot = template:GetPivot() + local boxCFrame, boxSize = template:GetBoundingBox() + local boxBottom = pivot:PointToObjectSpace(Vector3.new( + boxCFrame.Position.X, + boxCFrame.Position.Y - boxSize.Y / 2, + boxCFrame.Position.Z + )).Y + model:PivotTo(baseCF * CFrame.new(0, -boxBottom, 0)) + model.Parent = parent + return model +end + +local function portal(baseCF, title, color, worldId, locked) + -- Все порталы, и в лобби, и возвратные в мирах, используют модель автора из ServerStorage. + do + local model = Builder.portalModel(baseCF, color, "PortalModel_" .. worldId, map) + if model then + -- Этот невидимый якорь сохраняет ProximityPrompt и подпись мира. + local disc = P({ + Name = "Portal_" .. worldId, + Size = V(1, 1, 1), + CFrame = baseCF * CFrame.new(0, 10, 0), + Transparency = 1, + CanCollide = false, + CanQuery = false, + CanTouch = false, + }) + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + pe.LightEmission = 1 + pe.Rate = 25 + pe.Lifetime = NumberRange.new(1, 1.8) + pe.Speed = NumberRange.new(0.5, 2) + pe.SpreadAngle = Vector2.new(180, 180) + pe.Size = NumberSequence.new(0.5, 0) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Parent = disc + billboard(disc, title, color:Lerp(Color3.new(1, 1, 1), 0.4), 7, 200) + if locked then + billboard(disc, "🔒", Color3.new(1, 1, 1), 0, 120) + end + local pp = prompt(disc, locked and "Посмотреть" or "Перейти", title, "Portal", 14) + pp:SetAttribute("World", worldId) + return disc + end + end + + local center = baseCF * CFrame.new(0, 10, 0) + P({ Size = V(17, 1, 9), CFrame = baseCF * CFrame.new(0, 0.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(95, 100, 115) }) + P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130) }) + local R, n = 7, 20 + for i = 0, n - 1 do + local a = (i + 0.5) / n * math.pi * 2 + P({ + Size = V(2 * math.pi * R / n + 0.4, 1.7, 1.7), + CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R, 0), + Material = Enum.Material.Slate, + Color = Color3.fromRGB(80, 85, 100), + }) + if i % 2 == 0 then + P({ + Size = V(0.6, 0.6, 1.9), + CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R + 0.95, 0), + Material = Enum.Material.Neon, + Color = color, + }) + end + end + local disc = P({ + Name = "Portal_" .. worldId, + Shape = Enum.PartType.Cylinder, + Size = V(0.3, 2 * R - 1, 2 * R - 1), + CFrame = center * CFrame.Angles(0, math.rad(90), 0), + Material = Enum.Material.Neon, + Color = color, + Transparency = 0.3, + CanCollide = false, + }) + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + pe.LightEmission = 1 + pe.Rate = 25 + pe.Lifetime = NumberRange.new(1, 1.8) + pe.Speed = NumberRange.new(0.5, 2) + pe.SpreadAngle = Vector2.new(180, 180) + pe.Size = NumberSequence.new(0.5, 0) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Parent = disc + billboard(disc, title, color:Lerp(Color3.new(1, 1, 1), 0.4), 10, 250) + if locked then + billboard(disc, "🔒", Color3.new(1, 1, 1), 0, 120) + end + local pp = prompt(disc, locked and "Посмотреть" or "Перейти", title, "Portal", 14) + pp:SetAttribute("World", worldId) + return disc +end + +local function banner(pos, color, icon, text) + local look = CFrame.lookAt(pos, V(0, pos.Y, 0)) -- смотрит в центр лобби + vcyl(pos + V(0, 8, 0), 16, 0.7, { Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal }) + ball(pos + V(0, 16.3, 0), 1.2, { Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal }) + P({ Size = V(5.2, 0.4, 0.4), CFrame = look * CFrame.new(0, 15, -0.6), Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal }) + local flag = P({ Size = V(4.6, 8, 0.25), CFrame = look * CFrame.new(0, 10.8, -0.6), Color = color, Material = Enum.Material.Fabric, CanCollide = false }) + P({ Size = V(4.6, 0.5, 0.3), CFrame = look * CFrame.new(0, 6.6, -0.6), Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal }) + local label = icon .. "\n" .. text + surfaceText(flag, Enum.NormalId.Front, label, Color3.new(1, 1, 1)) + surfaceText(flag, Enum.NormalId.Back, label, Color3.new(1, 1, 1)) +end + +local function arch(cf, span, height, title, color) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(4, height, 4), CFrame = cf * CFrame.new(s * span / 2, height / 2, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) + P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, height + 0.6, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 195, 60) }) + P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, 0.6, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(150, 145, 140) }) + end + local beam = P({ Size = V(span + 6, 6, 2.5), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(60, 85, 140) }) + P({ Size = V(span + 7, 7, 2), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.Neon, Color = color }) + surfaceText(beam, Enum.NormalId.Front, title, Color3.fromRGB(255, 230, 120)) + surfaceText(beam, Enum.NormalId.Back, title, Color3.fromRGB(255, 230, 120)) +end + +---------------------------------------------------------------- сборка карты + +function Builder.build() + rng = Random.new(7) + map = Instance.new("Folder") + map.Name = "FishingMap" + local zonesFolder = Instance.new("Folder") + zonesFolder.Name = "FishingZones" + zonesFolder.Parent = map + local world1Prebuilt = Workspace:FindFirstChild("World1Map") + + ---------------------------------------------------------------- ЛОББИ + + P({ Shape = Enum.PartType.Cylinder, Size = V(1, 170, 170), CFrame = CFrame.new(0, 0.5, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Cobblestone, Color = Color3.fromRGB(190, 180, 165) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 74, 74), CFrame = CFrame.new(0, 0.52, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Marble, Color = Color3.fromRGB(232, 226, 214) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 78, 78), CFrame = CFrame.new(0, 0.51, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.SmoothPlastic, Color = Color3.fromRGB(60, 120, 190) }) + -- дорожки-лучи к лавкам и порталам + for _, a in ipairs({ 0, 90, 180, 270 }) do + local r = math.rad(a) + P({ Size = V(10, 1.0, 48), CFrame = CFrame.new(math.cos(r) * 60, 0.52, math.sin(r) * 60) * CFrame.Angles(0, -r + math.pi / 2, 0), Material = Enum.Material.Marble, Color = Color3.fromRGB(225, 218, 205) }) + end + + marker("LobbySpawn", CFrame.new(0, FLOOR + 2, 57)) -- на дорожке за табличкой «Как играть»: сначала она, дальше портал в Мир 1 + + -- фонтан со статуей золотой рыбы + vcyl(V(0, FLOOR + 1, 0), 2, 24, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) + vcyl(V(0, FLOOR + 1.6, 0), 1.0, 21, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 }) + vcyl(V(0, FLOOR + 4, 0), 6, 3, { Material = Enum.Material.Slate, Color = Color3.fromRGB(190, 185, 175) }) + local bowl = vcyl(V(0, FLOOR + 7.3, 0), 1, 9, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) + vcyl(V(0, FLOOR + 7.75, 0), 0.2, 8, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 }) + do + local statue = Models.buildFish("Gold", "Golden", 3.2, true) + statue:PivotTo(CFrame.new(0, FLOOR + 12, 0) * CFrame.Angles(0, math.rad(30), math.rad(40))) + statue.Parent = map + local sp = Instance.new("ParticleEmitter") + sp.Texture = "rbxasset://textures/particles/sparkles_main.dds" + sp.Rate = 12 + sp.LightEmission = 1 + sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90)) + sp.Size = NumberSequence.new(0.6, 0) + sp.Lifetime = NumberRange.new(1, 1.5) + sp.SpreadAngle = Vector2.new(180, 180) + sp.Speed = NumberRange.new(1, 2) + sp.Parent = statue.PrimaryPart + -- струи воды + local att = Instance.new("Attachment") + att.Position = V(0.6, 0, 0) -- у повёрнутого цилиндра ось X смотрит вверх + att.Orientation = V(0, 0, -90) -- направить струю вверх + att.Parent = bowl + local water = Instance.new("ParticleEmitter") + water.Color = ColorSequence.new(Color3.fromRGB(200, 235, 255)) + water.Transparency = NumberSequence.new(0.3, 1) + water.Size = NumberSequence.new(0.6, 1.2) + water.Rate = 60 + water.Lifetime = NumberRange.new(1.2, 1.5) + water.Speed = NumberRange.new(10, 12) + water.SpreadAngle = Vector2.new(25, 25) + water.Acceleration = V(0, -25, 0) + water.Parent = att + end + -- скамейки по внешнему краю площади, между порталами, лицом к фонтану + for _, deg in ipairs({ 45, 135, 225, 315 }) do + local a = math.rad(deg) + for _, side in ipairs({ -1, 1 }) do + local b = a + side * math.rad(9) + bench(CFrame.lookAt(V(math.cos(b) * 34, FLOOR, math.sin(b) * 34), V(0, FLOOR, 0))) + end + end + + -- фонари по кругу (у спавна — за спиной игрока, чтобы не закрывали табличку и сундук) + for i = 0, 7 do + local deg = i * 45 + 22.5 + if deg ~= 67.5 and deg ~= 112.5 then + local a = math.rad(deg) + lamp(V(math.cos(a) * 40, FLOOR, math.sin(a) * 40)) + end + end + lamp(V(7, FLOOR, 48)) -- левый фонарь стоит за табличкой «Как играть» + + -- клумбы с деревьями + for _, deg in ipairs({ 225, 315 }) do + local a = math.rad(deg) + local p = V(math.cos(a) * 58, FLOOR, math.sin(a) * 58) + vcyl(p + V(0, 1, 0), 2, 12, { Material = Enum.Material.Brick, Color = Color3.fromRGB(150, 95, 70) }) + vcyl(p + V(0, 1.6, 0), 1.0, 11, { Material = Enum.Material.Grass, Color = Color3.fromRGB(70, 140, 60) }) + tree(p + V(0, 2, 0), "round") + for j = 1, 5 do + local b = rng:NextNumber(0, math.pi * 2) + ball(p + V(math.cos(b) * 4, 2.4, math.sin(b) * 4), 0.8, { Color = ({ Color3.fromRGB(255, 110, 140), Color3.fromRGB(255, 220, 80), Color3.fromRGB(170, 120, 255) })[rng:NextInteger(1, 3)] }) + end + end + + -- баннеры + local bannerData = { + { 15, Color3.fromRGB(40, 110, 200), "🎣", "Лови!" }, + { 70, Color3.fromRGB(240, 140, 40), "🐟", "Продавай" }, + { 110, Color3.fromRGB(40, 110, 200), "⭐", "Качайся" }, + { 165, Color3.fromRGB(240, 140, 40), "🍀", "Удача" }, + { 205, Color3.fromRGB(40, 110, 200), "🏆", "Рекорды" }, + { 335, Color3.fromRGB(240, 140, 40), "💎", "Мифика" }, + } + for _, b in ipairs(bannerData) do + local a = math.rad(b[1]) + banner(V(math.cos(a) * 74, FLOOR, math.sin(a) * 74), b[2], b[3], b[4]) + end + + -- высокий скальный контур закрывает горизонт и удерживает игроков в лобби + lobbyCliffs() + lobbyTrees() + lobbyRockPlants() + lobbyHills() + + -- магазин (запад) и скупка (восток) + stall(CFrame.lookAt(V(-62, FLOOR, 0), V(0, FLOOR, 0)), { + title = "🎣 УДОЧКИ И СНАРЯЖЕНИЕ", + titleColor = Color3.fromRGB(255, 230, 120), + wall = Color3.fromRGB(185, 130, 85), + stripeA = Color3.fromRGB(215, 55, 55), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(255, 170, 60), + action = "Shop", + promptText = "Открыть магазин", + promptObject = "Магазин", + npcName = "Продавец Михалыч", + npcColors = { skin = Color3.fromRGB(234, 184, 146), shirt = Color3.fromRGB(200, 60, 50), pants = Color3.fromRGB(60, 70, 100), hat = Color3.fromRGB(90, 110, 60) }, + decor = function(at) + -- витрина удочек на задней стене + for i, rod in ipairs(Config.Rods) do + local x = -8 + (i - 1) * 4 + local m = Models.buildRod(rod.id, 0, true) + m:PivotTo(at(x, 3, 7) * CFrame.Angles(math.rad(80), 0, 0)) + m.Parent = map + local plaque = P({ Size = V(3.6, 1.6, 0.2), CFrame = at(x, 11.7, 7.4), Material = Enum.Material.Wood, Color = Color3.fromRGB(60, 40, 25) }) + surfaceText(plaque, Enum.NormalId.Front, rod.name .. "\n" .. (rod.price > 0 and (rod.price .. " 💰") or "бесплатно"), Color3.fromRGB(255, 235, 180)) + end + end, + }) + + stall(CFrame.lookAt(V(62, FLOOR, 0), V(0, FLOOR, 0)), { + title = "💰 СКУПКА РЫБЫ", + titleColor = Color3.fromRGB(150, 255, 160), + wall = Color3.fromRGB(110, 150, 175), + stripeA = Color3.fromRGB(50, 150, 80), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(80, 230, 120), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщица Зина", + npcColors = { skin = Color3.fromRGB(240, 195, 160), shirt = Color3.fromRGB(60, 120, 170), pants = Color3.fromRGB(50, 50, 60), hat = Color3.fromRGB(230, 230, 230) }, + decor = function(at) + -- лёд с рыбой на прилавке + P({ Size = V(10, 0.4, 3), CFrame = at(-3, 5.7, -4), Material = Enum.Material.Glass, Color = Color3.fromRGB(200, 235, 255), Transparency = 0.2 }) + for i, id in ipairs({ "Karas", "Okun", "Shuka" }) do + local f = Models.buildFish(id, nil, 0.9, true) + f:PivotTo(at(-6.5 + i * 2.5, 6.2, -4) * CFrame.Angles(math.rad(90), 0, math.rad(90))) + f.Parent = map + end + -- весы + P({ Size = V(2, 0.5, 2), CFrame = at(6, 5.75, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) }) + P({ Size = V(0.3, 1.4, 0.3), CFrame = at(6, 6.7, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 2.4, 2.4), CFrame = at(6, 7.45, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(200, 200, 205) }) + -- ящики с уловом + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(3, 2, 3), CFrame = at(s * 14.5, 2, 2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) }) + local f = Models.buildFish(s < 0 and "Lesh" or "Sudak", nil, 0.7, true) + f:PivotTo(at(s * 14.5, 3.3, 2) * CFrame.Angles(math.rad(90), 0, 0)) + f.Parent = map + end + end, + }) + + -- арка с названием + arch(CFrame.lookAt(V(0, FLOOR, -66), V(0, FLOOR, 0)), 84, 24, "🎣 " .. string.upper(Config.GameName) .. " 🎣", Color3.fromRGB(255, 190, 60)) + + -- порталы по кругу у фонтана, лицом наружу; первый (бесплатный) мир — прямо перед точкой появления + local PORTAL_R = 19 + for i, w in ipairs(Config.Worlds) do + local title = w.icon .. " " .. w.name .. (w.level > 1 and (" (ур. " .. w.level .. ")") or "") + local a = math.rad(90 - (i - 1) * 90) -- 90° = сторона спавна (+Z) + local pos = V(math.cos(a) * PORTAL_R, FLOOR, math.sin(a) * PORTAL_R) + local disc = portal(CFrame.lookAt(pos, V(pos.X * 2, FLOOR, pos.Z * 2)), title, w.color, w.id, w.soon) + if i == 1 then + disc:SetAttribute("GuideTarget", "Portal") + marker("GuidePortal", CFrame.new(pos.X * 1.3, FLOOR, pos.Z * 1.3)) -- точка перед порталом для линии-подсказки + end + end + + -- невидимая стена по кругу: из лобби не уйти + for deg = 0, 359, 5 do + local a = math.rad(deg) + local p = V(math.cos(a) * 86, 30, math.sin(a) * 86) + P({ Size = V(8, 60, 2), CFrame = CFrame.lookAt(p, V(0, 30, 0)), Transparency = 1, CanQuery = false }) + end + + -- донат-лавки + stall(CFrame.lookAt(V(41, FLOOR, 41), V(0, FLOOR, 0)), { + title = "💎 ПРЕМИУМ", + titleColor = Color3.fromRGB(255, 220, 120), + wall = Color3.fromRGB(120, 70, 170), + stripeA = Color3.fromRGB(255, 200, 60), + stripeB = Color3.fromRGB(150, 80, 210), + glow = Color3.fromRGB(255, 200, 60), + action = "RobuxPasses", + promptText = "Открыть", + promptObject = "Премиум-пропуска", + npcName = "Барон Злотов", + npcColors = { skin = Color3.fromRGB(230, 185, 150), shirt = Color3.fromRGB(110, 40, 140), pants = Color3.fromRGB(30, 30, 40), hat = Color3.fromRGB(255, 200, 60) }, + decor = function(at) + -- сундук с самоцветами + P({ Size = V(4, 2, 2.5), CFrame = at(-5, 6.5, -4), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(120, 75, 40) }) + P({ Size = V(4.2, 0.4, 2.7), CFrame = at(-5, 7.6, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) }) + for i, c in ipairs({ Color3.fromRGB(255, 60, 90), Color3.fromRGB(80, 200, 255), Color3.fromRGB(120, 255, 120), Color3.fromRGB(200, 100, 255) }) do + P({ Size = V(0.7, 0.7, 0.7), CFrame = at(-6.5 + i * 0.75, 8.1, -4) * CFrame.Angles(0.6, i, 0.6), Material = Enum.Material.Neon, Color = c }) + end + P({ Size = V(3, 4, 0.3), CFrame = at(5, 7.5, -4.8), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 200, 60) }) + end, + }) + stall(CFrame.lookAt(V(-41, FLOOR, 41), V(0, FLOOR, 0)), { + title = "🪙 СОКРОВИЩНИЦА", + titleColor = Color3.fromRGB(255, 235, 140), + wall = Color3.fromRGB(200, 160, 70), + stripeA = Color3.fromRGB(230, 180, 40), + stripeB = Color3.fromRGB(255, 250, 230), + glow = Color3.fromRGB(255, 220, 90), + action = "RobuxProducts", + promptText = "Открыть", + promptObject = "Наборы монет", + npcName = "Купчиха Злата", + npcColors = { skin = Color3.fromRGB(240, 200, 165), shirt = Color3.fromRGB(220, 170, 50), pants = Color3.fromRGB(90, 50, 30), hat = Color3.fromRGB(180, 40, 40) }, + decor = function(at) + -- горки монет + for i = 0, 4 do + for j = 0, 3 - (i % 3) do + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 0.9, 0.9), CFrame = at(-7 + i * 1.2, 5.6 + j * 0.2, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 205, 60) }) + end + end + for _, s in ipairs({ -1, 1 }) do + ball(at(s * 14.5, 2.2, 2).Position, 2.6, { Color = Color3.fromRGB(190, 160, 110), Material = Enum.Material.Fabric }) + ball(at(s * 14.5, 3.5, 2).Position, 1.2, { Color = Color3.fromRGB(255, 205, 60), Material = Enum.Material.Metal }) + end + end, + }) + + -- сундук с ежедневной наградой + do + local cf = CFrame.lookAt(V(14, FLOOR, 34), V(0, FLOOR, 50)) + local base = P({ Size = V(5, 3, 3.2), CFrame = cf * CFrame.new(0, 1.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 90, 50) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 3.2, 3.2), CFrame = cf * CFrame.new(0, 3, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 105, 60) }) + for _, x in ipairs({ -1.8, 1.8 }) do + P({ Size = V(0.4, 4.9, 3.4), CFrame = cf * CFrame.new(x, 2.3, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) }) + end + P({ Size = V(0.9, 1.1, 0.3), CFrame = cf * CFrame.new(0, 2.8, -1.7), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 220, 90) }) + local sp = Instance.new("ParticleEmitter") + sp.Texture = "rbxasset://textures/particles/sparkles_main.dds" + sp.Rate = 8 + sp.LightEmission = 1 + sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90)) + sp.Size = NumberSequence.new(0.5, 0) + sp.Parent = base + billboard(base, "🎁 Ежедневная награда", Color3.fromRGB(255, 220, 120), 5, 260) + prompt(base, "Забрать", "Сундук", "Daily", 12) + end + + -- табличка «Как играть» + do + -- слева от дорожки за точкой появления, лицом к камере игрока; фонарь — за табличкой + local pos = V(-12, FLOOR, 48) + local cf = CFrame.lookAt(pos, V(0, FLOOR, 64)) + lamp((cf * CFrame.new(0, 0, 2.5)).Position) + marker("GuideBoard", cf * CFrame.new(0, 0, -6)) -- перед табличкой, для линии-подсказки + for _, x in ipairs({ -6.5, 6.5 }) do + P({ Size = V(0.8, 9, 0.8), CFrame = cf * CFrame.new(x, 4.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Size = V(14, 8, 0.5), CFrame = cf * CFrame.new(0, 6, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + board:SetAttribute("GuideTarget", "Board") -- подсвечивается на шаге обучения + surfaceText(board, Enum.NormalId.Front, + "КАК ИГРАТЬ\n1. Портал «Мир 1» или кнопка 🌍 Миры\n2. Удочка — клавиша 1, у воды зажми ЛКМ и отпусти\n3. Клюёт → кликай в зелёную зону\n4. 🎒 Сумка — B, 📜 Задания — Q\n5. Собирай коллекцию — получай награды!", + Color3.fromRGB(255, 245, 225), { TextXAlignment = Enum.TextXAlignment.Left }) + end + + ---------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО + do + -- отдельно собранное раньше «Тихое озеро» (Workspace.World1Map) переносим в карту, иначе строим заново + local w1map = world1Prebuilt or World1Builder.build(map, Builder.portalModel) + w1map.Parent = map + local baitShop = not world1Prebuilt and w1map:FindFirstChild("BaitShop", true) + if baitShop then + Builder.lowPolyParts(baitShop:GetDescendants(), baitShop:GetPivot(), 11) + end + -- NPC встают на маркеры — их можно двигать в Studio + local seller = w1map:FindFirstChild("World1NpcSeller", true) + if seller and not seller:GetAttribute("NpcName") then + setNpc(seller, "Скупщик Гриша", { + skin = Color3.fromRGB(234, 190, 150), shirt = Color3.fromRGB(236, 228, 210), + pants = Color3.fromRGB(70, 110, 76), hat = Color3.fromRGB(226, 196, 122), + }) + end + local grandpa = w1map:FindFirstChild("World1NpcGrandpa", true) + if grandpa and not grandpa:GetAttribute("NpcName") then + setNpc(grandpa, "Дед Петрович", { + skin = Color3.fromRGB(225, 175, 140), shirt = Color3.fromRGB(110, 120, 80), pants = Color3.fromRGB(70, 60, 45), hat = Color3.fromRGB(90, 110, 60), + }, "Talk", "Поговорить") + end + local board = w1map:FindFirstChild("World1Bestiary", true) + if board and not board:GetAttribute("Bestiary") then + setBestiary(board, "World1", "🐟 КТО ВОДИТСЯ В ОЗЕРЕ", "#9BE7FF") + end + end + + -- причал (используется в Мире 2): настил и сваи; возвращает настил + local function pier(center, size) + local deck = P({ Size = size, Position = center, Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) }) + local alongZ = size.Z > size.X + local len = alongZ and size.Z or size.X + local wid = alongZ and size.X or size.Z + for d = -len / 2 + 1, len / 2 - 1, 6 do + for _, s in ipairs({ -1, 1 }) do + local off = alongZ and V(s * (wid / 2 - 0.4), 0, d) or V(d, 0, s * (wid / 2 - 0.4)) + vcyl(center + off + V(0, -6, 0), 13, 0.9, { Color = Color3.fromRGB(100, 70, 45), Material = Enum.Material.Wood }) + end + end + return deck + end + + ---------------------------------------------------------------- помощники для новых миров + + local function cylA(a, b, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(math.max(0.05, (b - a).Magnitude), d, d) + props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0) + return P(props) + end + + local function worldWalls(center) + for _, w in ipairs({ + { V(0, 0, 245), V(500, 160, 2) }, + { V(0, 0, -245), V(500, 160, 2) }, + { V(245, 0, 0), V(2, 160, 500) }, + { V(-245, 0, 0), V(2, 160, 500) }, + }) do + P({ Size = w[2], Position = center + w[1] + V(0, 60, 0), Transparency = 1, CanQuery = false }) + end + end + + local function bestiary(pos, lookAt, worldId, title, titleHex) + local cf = CFrame.lookAt(pos, lookAt) + for _, x in ipairs({ -6, 6 }) do + P({ Size = V(0.8, 11, 0.8), CFrame = cf * CFrame.new(x, 5.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Name = worldId .. "Bestiary", Size = V(13, 10, 0.5), CFrame = cf * CFrame.new(0, 7, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + setBestiary(board, worldId, title, titleHex) + end + + local function campfire(c) + for i = 0, 7 do + local a = i / 8 * math.pi * 2 + ball(c + V(math.cos(a) * 2.2, 0.3, math.sin(a) * 2.2), 1, { Color = Color3.fromRGB(120, 120, 125), Material = Enum.Material.Rock }) + end + for i = 0, 2 do + P({ Shape = Enum.PartType.Cylinder, Size = V(3, 0.6, 0.6), CFrame = CFrame.new(c + V(0, 0.4, 0)) * CFrame.Angles(0, i * math.pi / 3, 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 35) }) + end + local base = P({ Size = V(1, 1, 1), Position = c + V(0, 0.8, 0), Transparency = 1, CanCollide = false }) + local fire = Instance.new("Fire") + fire.Size = 5 + fire.Heat = 9 + fire.Parent = base + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 160, 80) + light.Range = 20 + light.Brightness = 2 + light.Parent = base + end + + local function torch(pos) + cylA(pos, pos + V(0, 5, 0), 0.35, { Color = Color3.fromRGB(170, 130, 70), Material = Enum.Material.Wood }) + local top = P({ Size = V(0.8, 0.8, 0.8), Position = pos + V(0, 5.3, 0), Color = Color3.fromRGB(90, 60, 30), Material = Enum.Material.Wood }) + local fire = Instance.new("Fire") + fire.Size = 3 + fire.Heat = 6 + fire.Parent = top + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 170, 90) + light.Range = 14 + light.Parent = top + end + + ---------------------------------------------------------------- МИР 2: ТРОПИЧЕСКИЙ ОСТРОВ + + do + local W2 = Config.Worlds[2].center + local leafColors = { Color3.fromRGB(60, 160, 60), Color3.fromRGB(85, 185, 70) } + + -- море, мелководье уступами, песчаный пляж, зелёный остров, холм + terrain:FillBlock(CFrame.new(W2 + V(0, -34, 0)), V(520, 8, 520), Enum.Material.Sand) + terrain:FillBlock(CFrame.new(W2 + V(0, -15, 0)), V(520, 30, 520), Enum.Material.Water) + terrain:FillCylinder(CFrame.new(W2 + V(0, -17, 0)), 28, 140, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -15, 0)), 32, 118, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -14, 0)), 34, 106, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -13.5, 0)), 35, 88, Enum.Material.Grass) + terrain:FillBall(W2 + V(20, -20, -30), 32, Enum.Material.Grass) + terrain:FillCylinder(CFrame.new(W2 + V(0, 2, 40)), 4, 14, Enum.Material.Sandstone) + + local function palm(pos) + local h = rng:NextNumber(12, 18) + local a = rng:NextNumber(0, math.pi * 2) + local dir = V(math.cos(a), 0, math.sin(a)) + local p = pos + for i = 1, 6 do + local t = i / 6 + local q = pos + V(0, h * t, 0) + dir * (t * t * h * 0.3) + local d = 1.4 - t * 0.45 + cylA(p, q, d, { Color = Color3.fromRGB(150, 115, 70), Material = Enum.Material.Wood }) + ball(q, d, { Color = Color3.fromRGB(130, 100, 60), Material = Enum.Material.Wood }) + p = q + end + for k = 0, 7 do + local b = k / 8 * math.pi * 2 + rng:NextNumber(-0.2, 0.2) + local ld = V(math.cos(b), 0, math.sin(b)) + local mid = p + ld * 3.5 + V(0, 0.8, 0) + local tipP = p + ld * 7 + V(0, -2.2, 0) + for _, seg in ipairs({ { p, mid }, { mid, tipP } }) do + P({ Size = V(2, 0.15, (seg[2] - seg[1]).Magnitude), CFrame = CFrame.lookAt((seg[1] + seg[2]) / 2, seg[2]), Material = Enum.Material.Grass, Color = leafColors[k % 2 + 1], CanCollide = false }) + end + end + for _ = 1, 3 do + ball(p + V(rng:NextNumber(-0.7, 0.7), -0.7, rng:NextNumber(-0.7, 0.7)), 0.9, { Color = Color3.fromRGB(110, 75, 40) }) + end + end + + local function tikiHut(pos, look) + local cf = CFrame.lookAt(pos, look) + P({ Size = V(12, 1, 12), CFrame = cf * CFrame.new(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 120, 75) }) + for _, c in ipairs({ { -5, -5 }, { 5, -5 }, { -5, 5 }, { 5, 5 } }) do + vcyl((cf * CFrame.new(c[1], 4.5, c[2])).Position, 8, 0.8, { Color = Color3.fromRGB(200, 175, 100), Material = Enum.Material.Wood }) + end + for i = 0, 4 do + vcyl((cf * CFrame.new(0, 8.8 + i * 1.2, 0)).Position, 1.4, 16 - i * 3.2, { Color = Color3.fromRGB(205, 170, 95), Material = Enum.Material.Grass }) + end + local bar = P({ Size = V(7, 3, 1.5), CFrame = cf * CFrame.new(0, 2.5, -3), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 95, 55) }) + billboard(bar, "🍹", Color3.new(1, 1, 1), 3, 60) + end + + local function umbrella(pos, color) + cylA(pos, pos + V(0, 7, 0), 0.25, { Color = Color3.fromRGB(235, 235, 235), Material = Enum.Material.Metal }) + vcyl(pos + V(0, 7, 0), 0.6, 9, { Color = color, Material = Enum.Material.Fabric }) + vcyl(pos + V(0, 7.5, 0), 0.6, 4.5, { Color = Color3.new(1, 1, 1), Material = Enum.Material.Fabric }) + P({ Size = V(2.2, 0.5, 6), CFrame = CFrame.new(pos + V(3.5, 0.6, 0)) * CFrame.Angles(0, rng:NextNumber(-0.5, 0.5), 0), Color = Color3.fromRGB(245, 245, 240), Material = Enum.Material.Fabric }) + P({ Size = V(2.25, 0.52, 1.2), CFrame = CFrame.new(pos + V(3.5, 0.62, 1.5)), Color = color, Material = Enum.Material.Fabric }) + end + + local coralColors = { Color3.fromRGB(255, 110, 150), Color3.fromRGB(255, 150, 60), Color3.fromRGB(170, 90, 255), Color3.fromRGB(255, 220, 80), Color3.fromRGB(80, 220, 200) } + local function coral(pos) + local c = coralColors[rng:NextInteger(1, #coralColors)] + for _ = 1, rng:NextInteger(3, 5) do + local dir = V(rng:NextNumber(-0.5, 0.5), 1, rng:NextNumber(-0.5, 0.5)).Unit + local h = rng:NextNumber(1.5, 3.5) + cylA(pos, pos + dir * h, 0.45, { Color = c, CanCollide = false }) + ball(pos + dir * h, 0.75, { Color = c:Lerp(Color3.new(1, 1, 1), 0.3), CanCollide = false }) + end + end + + local function starfish(pos) + local c = Color3.fromRGB(255, rng:NextInteger(90, 150), 60) + ball(pos, 0.7, { Color = c, CanCollide = false }) + for k = 0, 4 do + local a = k / 5 * math.pi * 2 + P({ Size = V(0.35, 0.2, 1.1), CFrame = CFrame.new(pos) * CFrame.Angles(0, a, 0) * CFrame.new(0, 0, -0.6), Color = c, CanCollide = false }) + end + end + + local spawn2 = W2 + V(0, 4, 40) + marker("World2Spawn", CFrame.lookAt(spawn2 + V(0, 1, 0), spawn2 + V(0, 1, -10))) + arch(CFrame.new(W2 + V(0, 4, 24)), 14, 11, "🏝 ТРОПИЧЕСКИЙ ОСТРОВ", Color3.fromRGB(255, 190, 70)) + portal(CFrame.lookAt(W2 + V(-32, 4, 60), spawn2), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") + stall(CFrame.lookAt(W2 + V(32, 4, 62), spawn2), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(150, 255, 220), + wall = Color3.fromRGB(200, 170, 110), + stripeA = Color3.fromRGB(40, 180, 170), + stripeB = Color3.fromRGB(255, 250, 230), + glow = Color3.fromRGB(80, 230, 200), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщик Мигель", + npcColors = { skin = Color3.fromRGB(190, 140, 100), shirt = Color3.fromRGB(240, 120, 60), pants = Color3.fromRGB(240, 230, 200), hat = Color3.fromRGB(230, 210, 150) }, + }) + bestiary(W2 + V(-18, 4, 22), spawn2, "World2", "🐠 КТО ВОДИТСЯ У ОСТРОВА", "#FFD27A") + npc("Капитан Боря", CFrame.lookAt(W2 + V(10, 6, 100), W2 + V(0, 6, 120)), { + skin = Color3.fromRGB(225, 175, 140), shirt = Color3.fromRGB(240, 240, 240), pants = Color3.fromRGB(30, 40, 80), hat = Color3.fromRGB(30, 30, 60), + }, "Talk", "Поговорить") + + pier(W2 + V(0, 3.2, 125), V(8, 0.6, 50)) + pier(W2 + V(125, 3.2, -10), V(50, 0.6, 8)) + for _, z in ipairs({ 105, 125, 145 }) do + torch(W2 + V(4.5, 3.5, z)) + end + for _, x in ipairs({ 110, 140 }) do + torch(W2 + V(x, 3.5, -14.5)) + end + tikiHut(W2 + V(-50, groundY(W2.X - 50, W2.Z - 20), -20), W2) + tikiHut(W2 + V(-20, groundY(W2.X - 20, W2.Z - 65), -65), W2) + campfire(W2 + V(-10, 4, 55)) + for _, deg in ipairs({ 200, 222, 318, 340 }) do + local a = math.rad(deg) + local x, z = math.cos(a) * 99, math.sin(a) * 99 + umbrella(W2 + V(x, groundY(W2.X + x, W2.Z + z), z), coralColors[rng:NextInteger(1, #coralColors)]) + end + + local function free2(x, z) + local r = math.sqrt(x * x + z * z) + if r > 100 then + return false + end + if (V(x, 0, z) - V(0, 0, 45)).Magnitude < 28 then + return false + end + for _, p in ipairs({ { 32, 62 }, { -32, 60 }, { -50, -20 }, { -20, -65 }, { -18, 22 }, { -10, 55 } }) do + if (V(x, 0, z) - V(p[1], 0, p[2])).Magnitude < 16 then + return false + end + end + return true + end + local count = 0 + for _ = 1, 300 do + if count >= 40 then + break + end + local x, z = rng:NextNumber(-100, 100), rng:NextNumber(-100, 100) + if free2(x, z) then + palm(W2 + V(x, groundY(W2.X + x, W2.Z + z) - 0.5, z)) + count += 1 + end + end + for _ = 1, 35 do + local a = rng:NextNumber(0, math.pi * 2) + local r = rng:NextNumber(121, 138) + local x, z = math.cos(a) * r, math.sin(a) * r + if not (math.abs(x) < 8 and z > 0) and not (math.abs(z + 10) < 8 and x > 0) then + coral(W2 + V(x, groundY(W2.X + x, W2.Z + z) - 0.3, z)) + end + end + for _ = 1, 12 do + local a = rng:NextNumber(0, math.pi * 2) + local r = rng:NextNumber(107, 115) + local x, z = math.cos(a) * r, math.sin(a) * r + starfish(W2 + V(x, groundY(W2.X + x, W2.Z + z) + 0.1, z)) + end + worldWalls(W2) + end + + ---------------------------------------------------------------- МИР 3: ЛЕДЯНОЙ ФЬОРД + + do + local W3 = Config.Worlds[3].center + local LAKES3 = Config.Worlds[3].lakes + local HOLES = Config.Worlds[3].holes + + terrain:FillBlock(CFrame.new(W3 + V(0, -10, 0)), V(500, 28, 500), Enum.Material.Snow) + for i = 0, 13 do + local a = i / 14 * math.pi * 2 + local r = rng:NextNumber(215, 235) + local rad = rng:NextNumber(50, 70) + local c = W3 + V(math.cos(a) * r, -15, math.sin(a) * r) + terrain:FillBall(c, rad, Enum.Material.Rock) + terrain:FillBall(c + V(0, rad * 0.35, 0), rad * 0.7, Enum.Material.Snow) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], 16, l[2])), 30, l[3] + 4, Enum.Material.Air) + end + -- вода не вытесняет снег и лёд, поэтому место под неё сначала вырезаем воздухом + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -19, l[2])), 10, l[3], Enum.Material.Mud) + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -7, l[2])), 14, l[3], Enum.Material.Air) + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -7, l[2])), 14, l[3], Enum.Material.Water) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -1, l[2])), 4, l[3], Enum.Material.Glacier) + end + -- лунки режем прямо по вокселям: тонкая заливка в 4 стада не перекрывает ячейку льда целиком + local holeR = Config.Worlds[3].holeRadius or 6 + local waterY3 = Config.Worlds[3].waterY + for _, h in ipairs(HOLES) do + local c = W3 + V(h[1], 0, h[2]) + local region = Region3.new(c + V(-holeR, -12, -holeR), c + V(holeR, 8, holeR)):ExpandToGrid(4) + local mats, occ = terrain:ReadVoxels(region, 4) + local corner = region.CFrame.Position - region.Size / 2 + for x = 1, mats.Size.X do + for y = 1, mats.Size.Y do + for z = 1, mats.Size.Z do + local p = corner + V(x - 0.5, y - 0.5, z - 0.5) * 4 + if (V(p.X, 0, p.Z) - V(c.X, 0, c.Z)).Magnitude <= holeR then + local water = p.Y < waterY3 + mats[x][y][z] = water and Enum.Material.Water or Enum.Material.Air + occ[x][y][z] = water and 1 or 0 + end + end + end + end + terrain:WriteVoxels(region, 4, mats, occ) + end + + local function snowPine(pos) + local h = rng:NextNumber(8, 13) + vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(90, 62, 40), Material = Enum.Material.Wood }) + for i = 0, 3 do + local s = 10 - i * 2.2 + local y = h * 0.4 + i * 2.8 + ball(pos + V(0, y, 0), s, { Color = Color3.fromRGB(35, 85 + i * 8, 60), Material = Enum.Material.Grass }) + ball(pos + V(0, y + s * 0.3, 0), s * 0.75, { Color = Color3.fromRGB(240, 245, 255), Material = Enum.Material.Snow }) + end + end + + local function igloo(pos, look) + local cf = CFrame.lookAt(pos, look) + P({ Shape = Enum.PartType.Ball, Size = V(14, 14, 14), CFrame = cf, Material = Enum.Material.Snow, Color = Color3.fromRGB(240, 245, 255) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 5, 5), CFrame = cf * CFrame.new(0, 1.2, -7) * CFrame.Angles(0, math.rad(90), 0), Material = Enum.Material.Snow, Color = Color3.fromRGB(235, 240, 250) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 3.6, 3.6), CFrame = cf * CFrame.new(0, 1.2, -9.55) * CFrame.Angles(0, math.rad(90), 0), Color = Color3.fromRGB(20, 25, 35) }) + end + + local function tent(pos, look) + local cf = CFrame.lookAt(pos, look) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.2, 5, 6), CFrame = cf * CFrame.new(s * 1.6, 2.2, 0) * CFrame.Angles(0, 0, math.rad(s * 35)), Material = Enum.Material.Fabric, Color = Color3.fromRGB(230, 110, 40) }) + end + vcyl((cf * CFrame.new(0, 0.9, -4.5)).Position, 1.6, 1.4, { Color = Color3.fromRGB(110, 80, 50), Material = Enum.Material.Wood }) + end + + local function crystal(pos) + for _ = 1, 5 do + local h = rng:NextNumber(3, 8) + P({ + Size = V(1.2, h, 1.2), + CFrame = CFrame.new(pos + V(rng:NextNumber(-2, 2), h / 2 - 0.5, rng:NextNumber(-2, 2))) * CFrame.Angles(rng:NextNumber(-0.4, 0.4), rng:NextNumber(0, 3), rng:NextNumber(-0.4, 0.4)), + Material = Enum.Material.Neon, Color = Color3.fromRGB(140, 230, 255), Transparency = 0.15, + }) + end + end + + local function snowman(pos) + ball(pos + V(0, 2, 0), 4, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + ball(pos + V(0, 5, 0), 3, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + ball(pos + V(0, 7.3, 0), 2.2, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + cylA(pos + V(0, 7.3, -1), pos + V(0, 7.2, -2), 0.3, { Color = Color3.fromRGB(255, 130, 30) }) + for _, x in ipairs({ -0.4, 0.4 }) do + ball(pos + V(x, 7.7, -0.95), 0.3, { Color = Color3.fromRGB(20, 20, 20) }) + end + vcyl(pos + V(0, 8.6, 0), 1.2, 1.4, { Color = Color3.fromRGB(30, 30, 35) }) + vcyl(pos + V(0, 8.1, 0), 0.2, 2.2, { Color = Color3.fromRGB(30, 30, 35) }) + end + + -- лунки: льдинки по краю и флажки + for i, h in ipairs(HOLES) do + local c = W3 + V(h[1], 1.2, h[2]) + for k = 0, 7 do + local a = k / 8 * math.pi * 2 + P({ Size = V(1.2, 0.6, 1.2), CFrame = CFrame.new(c + V(math.cos(a) * 6.6, 0, math.sin(a) * 6.6)) * CFrame.Angles(0, a, 0.2), Material = Enum.Material.Ice, Color = Color3.fromRGB(200, 235, 255) }) + end + if i % 3 == 1 then + cylA(c + V(6, -0.2, 6), c + V(6, 4, 6), 0.15, { Color = Color3.fromRGB(80, 60, 40) }) + P({ Size = V(1.4, 0.9, 0.1), Position = c + V(6.75, 3.5, 6), Material = Enum.Material.Fabric, Color = Color3.fromRGB(220, 40, 40) }) + end + if i % 4 == 0 then + tent(c + V(-9, -0.2, 0), c) + end + end + + local spawn3 = W3 + V(0, 4, 120) + marker("World3Spawn", CFrame.lookAt(spawn3 + V(0, 1, 0), spawn3 + V(0, 1, -10))) + arch(CFrame.new(W3 + V(0, 4, 104)), 14, 11, "❄ ЛЕДЯНОЙ ФЬОРД", Color3.fromRGB(150, 220, 255)) + portal(CFrame.lookAt(W3 + V(-32, 4, 140), spawn3), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") + stall(CFrame.lookAt(W3 + V(32, 4, 138), spawn3), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(180, 230, 255), + wall = Color3.fromRGB(120, 95, 75), + stripeA = Color3.fromRGB(60, 120, 200), + stripeB = Color3.fromRGB(245, 250, 255), + glow = Color3.fromRGB(140, 210, 255), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщица Нина", + npcColors = { skin = Color3.fromRGB(240, 205, 175), shirt = Color3.fromRGB(180, 40, 50), pants = Color3.fromRGB(40, 40, 60), hat = Color3.fromRGB(240, 240, 250) }, + }) + bestiary(W3 + V(-20, 4, 100), spawn3, "World3", "❄ КТО ВОДИТСЯ ПОДО ЛЬДОМ", "#BFEAFF") + npc("Полярник Саша", CFrame.lookAt(W3 + V(12, 7, 88), W3 + V(0, 7, 60)), { + skin = Color3.fromRGB(230, 190, 160), shirt = Color3.fromRGB(230, 120, 30), pants = Color3.fromRGB(50, 55, 70), hat = Color3.fromRGB(200, 40, 40), + }, "Talk", "Поговорить") + igloo(W3 + V(-45, 4, 95), W3 + V(0, 4, 110)) + campfire(W3 + V(20, 4, 108)) + snowman(W3 + V(42, 4, 100)) + for _, p in ipairs({ { -85, -45 }, { 90, 30 }, { -25, -110 }, { 70, -90 }, { -95, 60 } }) do + crystal(W3 + V(p[1], groundY(W3.X + p[1], W3.Z + p[2]), p[2])) + end + + local function free3(x, z) + for _, l in ipairs(LAKES3) do + if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + 12 then + return false + end + end + if (V(x, 0, z) - V(0, 0, 120)).Magnitude < 40 then + return false + end + if (V(x, 0, z) - V(-45, 0, 95)).Magnitude < 14 then + return false + end + return true + end + local count = 0 + for _ = 1, 400 do + if count >= 80 then + break + end + local x, z = rng:NextNumber(-200, 200), rng:NextNumber(-200, 200) + if free3(x, z) then + snowPine(W3 + V(x, groundY(W3.X + x, W3.Z + z) - 0.5, z)) + count += 1 + end + end + + -- северное сияние + for i = 0, 7 do + P({ + Size = V(55, 26, 0.6), + CFrame = CFrame.new(W3 + V(-175 + i * 50, 150 + math.sin(i * 1.3) * 10, -150 + math.cos(i * 0.9) * 25)) * CFrame.Angles(math.rad(10), math.rad(i * 8 - 28), 0), + Material = Enum.Material.Neon, + Color = (i % 3 == 0) and Color3.fromRGB(170, 90, 255) or Color3.fromRGB(80, 255, 170), + Transparency = 0.6, CanCollide = false, CanQuery = false, CastShadow = false, + }) + end + worldWalls(W3) + end + + ---------------------------------------------------------------- проверка воды + -- Если вода в террейне не создалась (бывает в некоторых плейсах/настройках), + -- ставим поверхность воды из деталей, чтобы озёра и море точно были видны. + + local function terrainHasWater(pos) + local region = Region3.new(pos - V(2, 2, 2), pos + V(2, 2, 2)):ExpandToGrid(4) + local ok, mats = pcall(function() + return terrain:ReadVoxels(region, 4) + end) + if not ok then + return true + end + for _, plane in ipairs(mats) do + for _, column in ipairs(plane) do + for _, m in ipairs(column) do + if m == Enum.Material.Water then + return true + end + end + end + end + return false + end + + local function waterPlane(pos, diameter, color) + return P({ + Name = "WaterSurface", + Shape = Enum.PartType.Cylinder, + Size = V(0.4, diameter, diameter), + CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)), + Color = color, + Material = Enum.Material.SmoothPlastic, + Reflectance = 0.08, + CanCollide = false, + CanQuery = false, + CanTouch = false, + CastShadow = false, + }) + end + + do + local w1, w2, w3 = Config.Worlds[1], Config.Worlds[2], Config.Worlds[3] + -- Мир 1: каждое озеро; нет воды — заливаем ещё раз, не помогло — поверхность из деталей. + -- Повторяем через несколько секунд на случай, если террейн перезаписал другой скрипт. + local planes = {} + -- материал вокселя (читаем воксели, а не лучом: физика террейна обновляется с задержкой) + local function voxelAt(pos) + local region = Region3.new(pos - V(1, 1, 1), pos + V(1, 1, 1)):ExpandToGrid(4) + local ok, mats = pcall(function() + return terrain:ReadVoxels(region, 4) + end) + return ok and mats[1] and mats[1][1] and mats[1][1][1] or nil + end + -- в центре озера: под поверхностью вода, над ней пусто + local function lakeState(l) + local c = w1.center + V(l[1], w1.waterY, l[2]) + return voxelAt(c - V(0, 2, 0)), voxelAt(c + V(0, 2, 0)) + end + local function lakeOk(below, above) + return below == nil or (below == Enum.Material.Water and above == Enum.Material.Air) + end + local function ensureLakeWater() + for i, l in ipairs(w1.lakes) do + local below, above = lakeState(l) + if not planes[i] and not lakeOk(below, above) then + warn(("[MapBuilder] Озеро %d Мира 1: под водой %s, над водой %s — заливаю заново"):format(i, tostring(below), tostring(above))) + World1Builder.carveLake(l) + below, above = lakeState(l) + if not lakeOk(below, above) then + warn(("[MapBuilder] Озеро %d Мира 1: всё ещё %s / %s — ставлю запасную поверхность воды"):format(i, tostring(below), tostring(above))) + planes[i] = waterPlane(w1.center + V(l[1], w1.waterY + 0.05, l[2]), l[3] * 2, Color3.fromRGB(30, 120, 150)) + end + end + end + end + -- уровень, собранный и поправленный руками в Studio, не трогаем: озеро там могли поменять намеренно + if not world1Prebuilt then + ensureLakeWater() + if RunService:IsRunning() then + task.delay(5, ensureLakeWater) + end + end + if not terrainHasWater(w2.center + V(180, -4, 0)) then + warn("[MapBuilder] Вода в террейне Мира 2 не создалась — ставлю запасную поверхность воды") + waterPlane(w2.center + V(0, w2.waterY, 0), 500, Color3.fromRGB(40, 180, 190)) + end + local h = w3.holes[1] + if not terrainHasWater(w3.center + V(h[1], -1, h[2])) then + warn("[MapBuilder] Вода в лунках Мира 3 не создалась — ставлю запасную поверхность воды") + for _, hole in ipairs(w3.holes) do + waterPlane(w3.center + V(hole[1], w3.waterY + 0.05, hole[2]), w3.holeRadius * 2, Color3.fromRGB(25, 75, 110)) + end + end + end + + map.Parent = Workspace + return map +end + +---------------------------------------------------------------- сборка в Studio + +function Builder.bake() + assert(not RunService:IsRunning(), "Собирайте карту в режиме редактирования, а не во время Play") + local old = Workspace:FindFirstChild("FishingMap") + if old then + -- «Тихое озеро» правят руками: переносим его в новую карту как есть (чтобы собрать заново — удалите World1Map) + local w1 = old:FindFirstChild("World1Map") + if w1 then + w1.Parent = Workspace + end + old:Destroy() + end + -- собранное раньше «Тихое озеро» (Workspace.World1Map) сохраняем вместе с его террейном + local keepWorld1 = Workspace:FindFirstChild("World1Map") ~= nil + for i = 1, 3 do + if i ~= 1 or not keepWorld1 then + terrain:FillBlock(CFrame.new(Config.Worlds[i].center + V(0, 30, 0)), V(680, 260, 680), Enum.Material.Air) + end + end + Builder.applyLighting() + local built = Builder.build() + print(("✅ Карта собрана: Workspace.FishingMap, деталей: %d. Сохраните плейс (Ctrl+S)."):format(#built:GetDescendants())) + return built +end + +---------------------------------------------------------------- при запуске игры + +local function spawnNpc(spot, parent) + local function color(name, default) + return spot:GetAttribute(name) or default + end + local name = spot:GetAttribute("NpcName") + local colors = { + skin = color("SkinColor", Color3.fromRGB(234, 184, 146)), + shirt = color("ShirtColor", Color3.fromRGB(200, 60, 50)), + pants = color("PantsColor", Color3.fromRGB(60, 70, 100)), + hat = color("HatColor", Color3.fromRGB(90, 110, 60)), + } + local ok, rig = pcall(function() + local d = Instance.new("HumanoidDescription") + d.HeadColor = colors.skin + d.LeftArmColor = colors.skin + d.RightArmColor = colors.skin + d.TorsoColor = colors.shirt + d.LeftLegColor = colors.pants + d.RightLegColor = colors.pants + return Players:CreateHumanoidModelFromDescription(d, Enum.HumanoidRigType.R15) + end) + if not ok or not rig then + warn("NPC не создан: " .. tostring(rig)) + return nil + end + rig.Name = name + local hum = rig:FindFirstChildOfClass("Humanoid") + hum.DisplayName = name + hum.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff + hum.NameDisplayDistance = 60 + local root = rig:FindFirstChild("HumanoidRootPart") + root.Anchored = true + rig:PivotTo(spot.CFrame) + rig.Parent = parent + + local head = rig:FindFirstChild("Head") + if head then + if not head:FindFirstChildOfClass("Decal") then + local face = Instance.new("Decal") + face.Name = "face" + face.Texture = "rbxasset://textures/face.png" + face.Parent = head + end + -- панама рыбака + local function hatPart(size, offset, shape) + local p = Instance.new("Part") + p.Shape = shape + p.Size = size + p.CanCollide = false + p.Massless = true + p.Color = colors.hat + p.Material = Enum.Material.Fabric + p.CFrame = head.CFrame * offset + local w = Instance.new("Weld") + w.Part0 = head + w.Part1 = p + w.C0 = head.CFrame:Inverse() * p.CFrame + w.Parent = p + p.Parent = rig + end + hatPart(V(0.15, 2.0, 2.0), CFrame.new(0, 0.55, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder) + hatPart(V(0.6, 1.35, 1.35), CFrame.new(0, 0.85, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder) + end + local action = spot:GetAttribute("NpcAction") + if action then + prompt(root, spot:GetAttribute("NpcActionText") or "Поговорить", name, action, 14) + end + return rig +end + +-- NPC встают на свои детали-места, доски «кто водится» получают актуальный список рыб +function Builder.prepareRuntime(root) + local spots, boards = {}, {} + for _, d in ipairs(root:GetDescendants()) do + if d:IsA("BasePart") then + if d:GetAttribute("NpcName") then + table.insert(spots, d) + elseif d:GetAttribute("Bestiary") then + table.insert(boards, d) + end + end + end + for _, spot in ipairs(spots) do + spot.Transparency = 1 + spawnNpc(spot, root) + end + for _, board in ipairs(boards) do + writeBestiary(board) + end +end + +return Builder +]=====]) make('LocalScript', 'FishingClient', game.StarterPlayer.StarterPlayerScripts, [=====[-- FishingClient (LocalScript) -> StarterPlayer > StarterPlayerScripts -- Интерфейс: HUD, сумка, коллекция с наградами, миры, задания, ежедневная награда, -- магазин, улучшения, удача, донат, событие, мини-игра, атмосфера миров. @@ -3787,9 +5754,44 @@ local function sideButton(order, icon, label, key, color, onClick) end ---------------------------------------------------------------- уведомления +-- мультяшный стиль подсказок: крупный круглый шрифт без обводки на мягкой «дымке» — +-- тёмная подложка, которая плавно растворяется к краям; появляются «пружинкой» +local SOFT_EDGES = NumberSequence.new({ + NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.18, 0.62), + NumberSequenceKeypoint.new(0.82, 0.62), NumberSequenceKeypoint.new(1, 1), +}) +-- жирный округлый шрифт с кириллицей (у FredokaOne кириллицы нет — Roblox подставляет тонкий шрифт) +local HINT_FONT = Font.new("rbxasset://fonts/families/Nunito.json", Enum.FontWeight.Heavy) +-- плашка-дымка (Frame) с текстом внутри; градиент только на плашке, на текст он не действует +local function softPlate(props, textProps) + local plate = new("Frame", props) + plate.BackgroundColor3 = BLACK + plate.BackgroundTransparency = 0 + corner(30).Parent = plate + new("UIGradient", { Transparency = SOFT_EDGES, Parent = plate }) + new("UIPadding", { PaddingLeft = UDim.new(0, 48), PaddingRight = UDim.new(0, 48), Parent = plate }) + local d = { Size = UDim2.fromScale(0, 1), AutomaticSize = Enum.AutomaticSize.X, TextXAlignment = Enum.TextXAlignment.Center, Parent = plate } + for k, v in pairs(textProps) do + d[k] = v + end + local label = text(d) + label.FontFace = HINT_FONT + return plate, label +end +local function popIn(obj, from) + local sc = obj:FindFirstChildOfClass("UIScale") or new("UIScale", { Parent = obj }) + sc.Scale = from or 0.4 + TweenService:Create(sc, TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play() +end +local function wobble(obj, deg, period) + obj.Rotation = -deg + TweenService:Create(obj, TweenInfo.new(period, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true), { Rotation = deg }):Play() +end + +-- уведомления — под подсказкой обучения, которая стоит в самом верху local toasts = new("Frame", { - Size = UDim2.new(0, 560, 0, 200), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 8), + Size = UDim2.new(0, 900, 0, 200), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 84), BackgroundTransparency = 1, Parent = gui, }, { new("UIListLayout", { Padding = UDim.new(0, 6), HorizontalAlignment = Enum.HorizontalAlignment.Center, SortOrder = Enum.SortOrder.LayoutOrder }) }) local toastOrder = 0 @@ -3819,11 +5821,11 @@ local function notify(msg, color) if #items >= 3 then items[1]:Destroy() end - local t = new("Frame", { - Size = UDim2.new(0, 0, 0, 38), AutomaticSize = Enum.AutomaticSize.X, BackgroundColor3 = C.bg, - BackgroundTransparency = 0.15, LayoutOrder = toastOrder, Parent = toasts, - }, { corner(12), stroke(color or WHITE, 2, 0.2), new("UIPadding", { PaddingLeft = UDim.new(0, 16), PaddingRight = UDim.new(0, 16) }) }) - local l = text({ Size = UDim2.new(0, 0, 1, 0), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 19, TextColor3 = color or WHITE, Text = msg, Parent = t }) + local t, l = softPlate( + { Size = UDim2.new(0, 0, 0, 54), AutomaticSize = Enum.AutomaticSize.X, LayoutOrder = toastOrder, Parent = toasts }, + { TextSize = 30, TextColor3 = color or WHITE, Text = msg } + ) + popIn(t) t:SetAttribute("Msg", msg) toastTimers[t] = 0 task.delay(3.2, function() @@ -3867,7 +5869,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() @@ -3896,11 +5899,12 @@ end ---------------------------------------------------------------- статус и мини-игра -local statusLabel = text({ - Size = UDim2.fromOffset(460, 34), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -110), - Font = TITLE, TextSize = 22, TextXAlignment = Enum.TextXAlignment.Center, TextStrokeTransparency = 0.3, - Text = "🎣 Ждём поклёвку… (клик — смотать)", Visible = false, Parent = gui, -}) +-- вверху, на месте подсказки обучения (она во время рыбалки скрыта) +local statusLabel = softPlate( + { Size = UDim2.fromOffset(0, 64), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 12), Visible = false, Parent = gui }, + { TextSize = 36, Text = "🎣 Ждём клёв…" } +) +wobble(statusLabel, 1.2, 1.4) local mgFrame = new("Frame", { Size = UDim2.fromOffset(480, 124), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -100), BackgroundColor3 = WHITE, Visible = false, Parent = gui, @@ -4037,7 +6041,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 } ---------------------------------------------------------------- магазин @@ -4425,35 +6429,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 @@ -4508,7 +6532,7 @@ robuxWin.render = function(tab) buttonText = has and "Куплено ✓" or ("R$ " .. it.robux), buttonColor = has and C.grey or C.green, active = not has, onClick = function() if not it.id or it.id == 0 then - notify("Товар ещё не настроен: впиши его ID в FishConfig", Color3.fromRGB(255, 200, 120)) + notify("⚙ Товар не настроен", Color3.fromRGB(255, 200, 120)) return end if tab == "passes" then @@ -4540,13 +6564,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] @@ -4614,10 +6633,282 @@ refreshHud() local state = "idle" local mg = { pos = 0, dir = 1, speed = 1, zoneStart = 0.4, zoneWidth = 0.25, hits = 0, need = 1, misses = 0, maxMisses = 2, deadline = 0, timeout = 10 } +-- с начала зарядки и до конца рыбалки персонажем не управляем: не ходит, не прыгает, не поворачивается +local ContextActionService = game:GetService("ContextActionService") +local MOVE_KEYS = { + Enum.KeyCode.W, Enum.KeyCode.A, Enum.KeyCode.S, Enum.KeyCode.D, Enum.KeyCode.Space, + Enum.KeyCode.Up, Enum.KeyCode.Down, Enum.KeyCode.Left, Enum.KeyCode.Right, + Enum.KeyCode.Thumbstick1, Enum.KeyCode.ButtonA, +} +local controls +local movementLocked = false +local function setMovementLocked(locked) + if not controls then + local pm = player:FindFirstChild("PlayerScripts") and player.PlayerScripts:FindFirstChild("PlayerModule") + local ok, mod = pcall(require, pm) + controls = ok and mod and mod:GetControls() or nil + end + if controls then + if locked then + controls:Disable() + else + controls:Enable() + end + end + if locked ~= movementLocked then + movementLocked = locked + if locked then + ContextActionService:BindActionAtPriority("FishingLock", function() + return Enum.ContextActionResult.Sink + end, false, Enum.ContextActionPriority.High.Value + 100, table.unpack(MOVE_KEYS)) + else + ContextActionService:UnbindAction("FishingLock") + end + end + local hum = player.Character and player.Character:FindFirstChildOfClass("Humanoid") + if hum then + hum.AutoRotate = not locked + hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, not locked) + if locked then + hum:Move(Vector3.zero) + end + end +end + +local function easeInOut(a) + return a < 0.5 and 4 * a * a * a or 1 - (-2 * a + 2) ^ 3 / 2 +end +local function easeOut(a) + return 1 - (1 - a) ^ 3 +end + +---------------------------------------------------------------- заброс: зарядка, шкала силы, наклон удочки +-- держишь ЛКМ — сила растёт, удочка уходит назад; отпустил — бросок на дальность по силе + +local REST_ANGLE, BACK_ANGLE = 30, 110 -- удочка в покое (как в GameServer) и в полном замахе +local function gripCF(angle) + return (CFrame.Angles(math.rad(angle), 0, 0) * CFrame.new(0, 0, -0.3)):Inverse() +end + +local charge = nil -- { t0, tool } +local castTool = nil -- удочка последнего броска: вернуть её в покой, если бросок не удался +-- сила ездит туда-сюда: 0 → 1 за CastChargeTime, потом обратно к 0 и снова вверх, пока держишь ЛКМ +local function chargePower() + if not charge then + return 0 + end + local t = ((os.clock() - charge.t0) / Config.CastChargeTime) % 2 + return t <= 1 and t or 2 - t +end +local function inPerfect(v) + return v >= Config.CastPerfect[1] and v <= Config.CastPerfect[2] +end + +-- шкала-дуга справа от персонажа: внизу слабый бросок, вверху сильный, зелёная зона — бонус удачи +local GAUGE_R, GAUGE_DEG, GAUGE_N = 190, 110, 32 +local gauge = new("Frame", { + Size = UDim2.fromOffset(150, 280), AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0.57, 0, 0.48, 0), + BackgroundTransparency = 1, Visible = false, Parent = gui, +}) +local GAUGE_C = Vector2.new(110 - GAUGE_R, 140) -- центр окружности левее рамки: дуга выгнута вправо +local function arcPoint(v, r) + local th = math.rad(-GAUGE_DEG / 2 + GAUGE_DEG * v) + return GAUGE_C + Vector2.new(math.cos(th) * r, -math.sin(th) * r), -math.deg(th) +end +do + local segLen = 2 * math.pi * GAUGE_R * (GAUGE_DEG / 360) / GAUGE_N + for _, layer in ipairs({ { 46, 4, BLACK }, { 34, 1 } }) do -- чёрная обводка, потом цветные секции + for i = 0, GAUGE_N - 1 do + local v = (i + 0.5) / GAUGE_N + local pos, rot = arcPoint(v, GAUGE_R) + local color = layer[3] + or ((v < 0.12 or v > 0.94) and C.red) + or (inPerfect(v) and Color3.fromRGB(110, 235, 60)) + or Color3.fromRGB(40, 70, 95) + new("Frame", { + Size = UDim2.fromOffset(layer[1], segLen + layer[2]), AnchorPoint = Vector2.new(0.5, 0.5), + Position = UDim2.fromOffset(pos.X, pos.Y), Rotation = rot, BorderSizePixel = 0, + BackgroundColor3 = color, Parent = gauge, + }) + end + end +end +local needle = new("Frame", { + Size = UDim2.fromOffset(64, 8), AnchorPoint = Vector2.new(0.5, 0.5), BackgroundColor3 = WHITE, + BorderSizePixel = 0, ZIndex = 3, Parent = gauge, +}, { corner(4), stroke(BLACK, 2) }) +local multLabel = text({ + Size = UDim2.fromOffset(110, 40), AnchorPoint = Vector2.new(0.5, 1), Font = TITLE, TextSize = 34, + Text = "×" .. Config.CastPerfectLuck, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 4, + Visible = false, Parent = gauge, +}) +new("UIStroke", { Color = BLACK, Thickness = 3, Parent = multLabel }) +do + local top = arcPoint(1, GAUGE_R) + multLabel.Position = UDim2.fromOffset(top.X + 10, top.Y - 18) +end + +local function updateCharge() + local p = chargePower() + local pos, rot = arcPoint(p, GAUGE_R) + needle.Position = UDim2.fromOffset(pos.X, pos.Y) + needle.Rotation = rot + local good = inPerfect(p) + multLabel.Visible = good + needle.BackgroundColor3 = good and Color3.fromRGB(190, 255, 150) or WHITE + if charge.tool and charge.tool.Parent then + charge.tool.Grip = gripCF(REST_ANGLE + (BACK_ANGLE - REST_ANGLE) * easeOut(p)) + end +end + +---------------------------------------------------------------- камера при забросе +-- зарядка: камера уходит в сторону от персонажа и отъезжает тем дальше, чем сильнее замах; +-- бросок: камера сбоку разгоняется за поплавком; потом сверху-сбоку держит в кадре игрока и поплавок + +local CAM_IN, CAM_SETTLE, CAM_RETURN = 0.35, 0.8, 0.6 +local UP = Vector3.new(0, 1, 0) +local fishCam = nil + +local function sideCF(fc, p) + return CFrame.lookAt(fc.hrp + fc.r * (9 + 3 * p) - fc.f * (3 + 2 * p) + UP * (3 + 1.5 * p), fc.hrp + fc.f * 6 + UP) +end +local function chaseCF(fc, p) + return CFrame.lookAt(p + fc.r * 9 - fc.f * 5 + UP * 3, p + fc.f * 3) +end +local function restCF(fc) + local d = ((fc.target - fc.hrp) * Vector3.new(1, 0, 1)).Magnitude + local mid = fc.hrp:Lerp(fc.target, 0.5) + return CFrame.lookAt(mid + fc.r * (8 + d * 0.55) - fc.f * 4 + UP * (6 + d * 0.25), fc.hrp:Lerp(fc.target, 0.6)) +end + +local function fishCamStep() + local fc = fishCam + local cam = workspace.CurrentCamera + if not fc or not cam then + return + end + if fc.returning then + local a = math.min(1, (os.clock() - fc.returning) / CAM_RETURN) + local e = easeInOut(a) + cam.CFrame = fc.leaveCF:Lerp(fc.origCF, e) + cam.FieldOfView = fc.leaveFov + (fc.origFov - fc.leaveFov) * e + if a >= 1 then + RunService:UnbindFromRenderStep("FishCam") + cam.CameraType = Enum.CameraType.Custom + fishCam = nil + end + return + end + local now = os.clock() + local cf, fov + if not fc.castT0 then + -- зарядка: плавно уходим в вид сбоку; чем сильнее замах, тем дальше камера и шире обзор + -- после отпускания ЛКМ, пока ждём ответ сервера, держим набранную силу + local p = charge and chargePower() or (fc.power or 0) + fc.power = p + local e = easeOut(math.min(1, (now - fc.t0) / CAM_IN)) + cf = fc.origCF:Lerp(sideCF(fc, p), e) + fov = fc.origFov + 12 * p * e + else + local th = fc.throw + local t = now - fc.castT0 + local lunge = fc.fromCF + fc.f * 1.5 + if t < th.windup then + -- рывок удочки вперёд: камера подаётся следом + local e = easeOut(t / th.windup) + cf = fc.fromCF:Lerp(lunge, e) + fov = fc.fromFov + 4 * e + elseif t < th.windup + th.flight then + if not fc.start then + fc.start = (fc.tip and fc.tip.Parent and fc.tip.WorldPosition) or (fc.hrp + fc.f * 2 + UP * 4) + end + local a = (t - th.windup) / th.flight + local p = fc.start:Lerp(fc.target, a) + UP * (math.sin(a * math.pi) * th.arc) -- та же дуга, что у поплавка + local e = easeInOut(a) + cf = lunge:Lerp(chaseCF(fc, p), e) + fov = (fc.fromFov + 4) + ((fc.origFov - 6) - (fc.fromFov + 4)) * e + else + local e = easeOut(math.min(1, (t - th.windup - th.flight) / CAM_SETTLE)) + local sway = Vector3.new(math.sin(now * 0.7) * 0.5, math.sin(now * 1.1) * 0.25, 0) + if state == "bite" then + sway += Vector3.new(math.random() - 0.5, math.random() - 0.5, 0) * 0.15 + end + cf = chaseCF(fc, fc.target):Lerp(restCF(fc) + sway, e) + fov = fc.origFov - 6 + 6 * e + end + end + cam.CFrame = cf + cam.FieldOfView = fov +end + +-- начало зарядки: dir — куда полетит поплавок (к центру озера) +local function startChargeCam(tool, dir) + local cam = workspace.CurrentCamera + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if not cam or not hrp then + return + end + fishCam = { + t0 = os.clock(), hrp = hrp.Position, f = dir, r = dir:Cross(UP), + tip = tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip"), + -- если камера ещё возвращалась с прошлого заброса, возвращаться будем туда же + origCF = fishCam and fishCam.origCF or cam.CFrame, + origFov = fishCam and fishCam.origFov or cam.FieldOfView, + } + cam.CameraType = Enum.CameraType.Scriptable + RunService:UnbindFromRenderStep("FishCam") + RunService:BindToRenderStep("FishCam", Enum.RenderPriority.Camera.Value + 1, fishCamStep) +end + +-- сервер принял бросок: target — куда упадёт поплавок, throw — тайминги и высота дуги +local function startCastCam(target, throw) + local cam = workspace.CurrentCamera + if not fishCam or fishCam.returning or not cam or typeof(target) ~= "Vector3" or type(throw) ~= "table" then + return + end + fishCam.castT0 = os.clock() + fishCam.target = target + fishCam.throw = throw + fishCam.fromCF = cam.CFrame + fishCam.fromFov = cam.FieldOfView +end + +local function stopFishCam() + local cam = workspace.CurrentCamera + if not fishCam or fishCam.returning or not cam then + return + end + fishCam.returning = os.clock() + fishCam.leaveCF = cam.CFrame + fishCam.leaveFov = cam.FieldOfView +end + +local reelToken local function setState(s) + if s ~= "charging" and charge then + -- зарядку прервали (убрал удочку и т.п.): удочку обратно в покой + if charge.tool.Parent then + charge.tool.Grip = gripCF(REST_ANGLE) + end + charge = nil + end state = s statusLabel.Visible = (s == "waiting") mgFrame.Visible = (s == "bite") + gauge.Visible = (s == "charging") + setMovementLocked(s ~= "idle") + if s == "idle" then + stopFishCam() + elseif s == "reeling" then + -- на случай, если сервер не ответит на вытаскивание: не оставляем игрока замороженным + local token = {} + reelToken = token + task.delay(4, function() + if state == "reeling" and reelToken == token then + setState("idle") + end + end) + end end local function updatePips() pipsText.Text = "🎯 " .. string.rep("●", mg.hits) .. string.rep("●", mg.need - mg.hits) @@ -4633,11 +6924,45 @@ local function placeZone() zoneF.Position = UDim2.fromScale(mg.zoneStart, 0) end +-- ЛКМ зажата: персонаж разворачивается к центру озера, начинается зарядка +local function startCharge(tool) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if not hrp then + return + end + local world = Config.WorldAt(hrp.Position) + -- из воды и издалека не заряжаем вовсе: сразу подсказка + local can = Config.CanCastFrom(world, hrp.Position, player.Character:FindFirstChildOfClass("Humanoid")) + if can ~= true then + notify(can, Color3.fromRGB(255, 200, 120)) + return + end + local dir = Config.CastDirection(world, hrp.Position) + if not dir then + dir = hrp.CFrame.LookVector * Vector3.new(1, 0, 1) + dir = dir.Magnitude > 0.01 and dir.Unit or Vector3.new(0, 0, -1) + end + hrp.CFrame = CFrame.lookAt(hrp.Position, hrp.Position + dir) + charge = { t0 = os.clock(), tool = tool } + setState("charging") + startChargeCam(tool, dir) + updateCharge() +end + +-- ЛКМ отпущена: бросок с набранной силой +local function releaseCast() + if state ~= "charging" or not charge then + return + end + local power = chargePower() + castTool = charge.tool + charge = nil -- удочку не возвращаем: сервер сам сделает рывок вперёд + setState("casting") + remote:FireServer("Cast", power) +end + local function onActivate() - if state == "idle" then - setState("casting") - remote:FireServer("Cast") - elseif state == "waiting" then + if state == "waiting" then remote:FireServer("Cancel") setState("idle") elseif state == "bite" then @@ -4671,7 +6996,14 @@ local function hookTool(tool) return end hooked[tool] = true - tool.Activated:Connect(onActivate) + tool.Activated:Connect(function() + if state == "idle" then + startCharge(tool) + else + onActivate() + end + end) + tool.Deactivated:Connect(releaseCast) tool.Unequipped:Connect(function() if state == "waiting" or state == "bite" or state == "casting" then remote:FireServer("Cancel") @@ -4701,6 +7033,12 @@ if player.Character then watch(player.Character) end +RunService.RenderStepped:Connect(function() + if state == "charging" and charge then + updateCharge() + end +end) + RunService.RenderStepped:Connect(function(dt) if state ~= "bite" then return @@ -4750,33 +7088,237 @@ local snow = new("ParticleEmitter", { }) local lastWorldId = "none" local terrain = workspace.Terrain -local defaultWater = Color3.fromRGB(20, 95, 115) -local function applyAmbience(world) +-- то, что мир может поменять под себя (оттенок, цвета травы и песка); вода не трогается — она из свойств Terrain +local DEFAULT_LOOK = { tint = Color3.new(1, 1, 1) } +local defaultTerrainColors = nil + +-- world.look: свет и эффекты мира; при выходе свойства возвращаются к тем, что были до первого входа +local lookTargets = { + lighting = function() return Lighting end, + atmosphere = function() return Lighting:FindFirstChildOfClass("Atmosphere") end, + color = function() return Lighting:FindFirstChildOfClass("ColorCorrectionEffect") end, + bloom = function() return Lighting:FindFirstChildOfClass("BloomEffect") end, + sunRays = function() return Lighting:FindFirstChildOfClass("SunRaysEffect") end, + dof = function() + return Lighting:FindFirstChildOfClass("DepthOfFieldEffect") + or new("DepthOfFieldEffect", { Enabled = false, Parent = Lighting }) + end, + grading = function() return Lighting:FindFirstChildOfClass("ColorGradingEffect") end, +} +local lookDefaults = {} +-- лобби настраивается так же, как миры +local lookSources = table.clone(Config.Worlds) +table.insert(lookSources, Config.Lobby) + +-- смена света: плавно или сразу (за экраном загрузки) +local lookTweens = {} +local function setLook(obj, goal, instant) + if instant then + for prop, v in pairs(goal) do + obj[prop] = v + end + else + local tw = TweenService:Create(obj, TweenInfo.new(2), goal) + table.insert(lookTweens, tw) + tw:Play() + end +end + +local function applyLook(world, instant) + -- исходные значения запоминаем до первой правки; эффект мог ещё не прийти с сервера, тогда в следующий раз + for _, w in ipairs(lookSources) do + for section, props in pairs(w.look or {}) do + local obj = lookTargets[section] and lookTargets[section]() + if obj then + lookDefaults[section] = lookDefaults[section] or {} + for prop in pairs(props) do + if lookDefaults[section][prop] == nil then + lookDefaults[section][prop] = obj[prop] + end + end + end + end + end + local look = (world and world.look) or {} + for section, defaults in pairs(lookDefaults) do + local obj = lookTargets[section]() + if obj then + local goal = {} + for prop, def in pairs(defaults) do + local v = look[section] and look[section][prop] + if v == nil then v = def end + -- плавно меняются только числа и цвета; флаги и режимы (EnumItem) ставим сразу + local kind = typeof(v) + if kind == "number" or kind == "Color3" then goal[prop] = v else obj[prop] = v end + end + setLook(obj, goal, instant) + end + end +end + +local function applyAmbience(world, instant) + -- прошлая плавная смена ещё может идти — она перебила бы новые значения + for _, tw in ipairs(lookTweens) do + tw:Cancel() + end + table.clear(lookTweens) + world = world or Config.Lobby 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 + setLook(Lighting, { ClockTime = clock }, instant) + local cc = Lighting:FindFirstChildOfClass("ColorCorrectionEffect") + if cc then + setLook(cc, { TintColor = (world and world.tint) or DEFAULT_LOOK.tint }, instant) + end + -- цвета материалов террейна общие для всей карты, поэтому меняем их только у себя и возвращаем при выходе + if not defaultTerrainColors then + defaultTerrainColors = {} + for _, name in ipairs({ "Snow", "Salt", "Mud", "Sand", "Rock", "Slate", "Grass", "Ground" }) do + defaultTerrainColors[name] = terrain:GetMaterialColor(Enum.Material[name]) + end + end + local colors = (world and world.terrainColors) or {} + for name, def in pairs(defaultTerrainColors) do + terrain:SetMaterialColor(Enum.Material[name], colors[name] or def) + end local atm = Lighting:FindFirstChildOfClass("Atmosphere") if atm then local frost = world and world.id == "World3" - TweenService:Create(atm, TweenInfo.new(2), { + setLook(atm, { Density = frost and 0.38 or 0.25, Color = frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232), - }):Play() + }, instant) end + applyLook(world, instant) snow.Rate = (world and world.id == "World3") and 140 or 0 end +-- тёмные силуэты рыб под прозрачной водой «Тихого озера», медленно плавают по кругу (только у этого игрока) +do + local w1 = Config.Worlds[1] + local fishList = Config.Zones.World1.fish + local frng = Random.new(11) + local folder = new("Folder", { Name = "FishShadows", Parent = workspace }) + local swimmers = {} + for i = 1, 10 do + local l = w1.lakes[(i - 1) % #w1.lakes + 1] + local ok, model = pcall(Models.buildFish, fishList[(i - 1) % #fishList + 1].id, nil, frng:NextNumber(1.3, 2), true) + if ok and model then + for _, d in ipairs(model:GetDescendants()) do + if d:IsA("BasePart") then + d.Color = Color3.fromRGB(22, 70, 74) + d.Material = Enum.Material.SmoothPlastic + d.Transparency = 0.5 + d.CanCollide, d.CanQuery, d.CanTouch, d.CastShadow = false, false, false, false + elseif d:IsA("Decal") or d:IsA("ParticleEmitter") or d:IsA("Light") then + d:Destroy() + end + end + model.Parent = folder + table.insert(swimmers, { + model = model, + c = w1.center + Vector3.new(l[1] + frng:NextNumber(-l[3], l[3]) * 0.25, w1.waterY - frng:NextNumber(1.4, 2.4), l[2] + frng:NextNumber(-l[3], l[3]) * 0.25), + r = l[3] * frng:NextNumber(0.25, 0.55), a = frng:NextNumber(0, math.pi * 2), + w = frng:NextNumber(0.08, 0.18) * (frng:NextNumber() < 0.5 and -1 or 1), + }) + end + end + local acc = 0 + RunService.Heartbeat:Connect(function(dt) + acc += dt + if acc < 1 / 30 then + return + end + local step = acc + acc = 0 + local w = currentWorld() + if not (w and w.id == "World1") then + return + end + for _, s in ipairs(swimmers) do + s.a += s.w * step + local pos = s.c + Vector3.new(math.cos(s.a) * s.r, math.sin(s.a * 3) * 0.2, math.sin(s.a) * s.r) + local dir = Vector3.new(-math.sin(s.a), 0, math.cos(s.a)) * math.sign(s.w) + -- голова рыбы смотрит в +X модели, поэтому разворачиваем на 90° + s.model:PivotTo(CFrame.lookAt(pos, pos + dir) * CFrame.Angles(0, math.rad(90), 0)) + end + end) +end + +-- экран загрузки (ReplicatedFirst/Loading): при входе и телепорте свет локации ставится, пока он закрывает картинку +local loadingGui = player:WaitForChild("PlayerGui"):WaitForChild("LoadingScreen", 10) +local function loadingVisible() + return loadingGui ~= nil and loadingGui.Enabled +end + +local function placeTitle(w) + return w and (w.icon .. " " .. w.name) or "🏠 Лобби" +end + +local function enterWorld(w, instant) + lastWorldId = w and w.id or "lobby" + applyAmbience(w, instant) + if w then + -- название локации — когда экран загрузки уже ушёл + task.spawn(function() + while loadingVisible() do + task.wait(0.1) + end + notify(w.icon .. " " .. w.name, w.color) + end) + end +end + +-- первое появление: ждём персонажа, ставим свет его локации сразу и отпускаем экран загрузки +task.spawn(function() + local char = player.Character or player.CharacterAdded:Wait() + char:WaitForChild("HumanoidRootPart", 30) + local w = currentWorld() + enterWorld(w, true) + if loadingGui then + loadingGui:SetAttribute("Title", placeTitle(w)) + loadingGui:SetAttribute("Ready", true) + end +end) + +-- телепорт: экран загрузки закрывает картинку, сервер переносит персонажа, свет новой локации ставится сразу +local teleportToken = 0 +local function teleportLoading(targetId, delay) + teleportToken += 1 + local token = teleportToken + local target = Config.Find(Config.Worlds, targetId) + if loadingGui then + local now = os.clock() + loadingGui:SetAttribute("Ready", false) + loadingGui:SetAttribute("StartAt", now) + loadingGui:SetAttribute("MinUntil", now + Config.Loading.teleport) + loadingGui:SetAttribute("Title", placeTitle(target)) + loadingGui:SetAttribute("Visible", true) + end + task.spawn(function() + -- ждём, пока персонаж окажется в новой локации (или сдаёмся через пару секунд) + local deadline = os.clock() + delay + 3 + local w + repeat + task.wait() + w = currentWorld() + until (w and w.id or "Lobby") == targetId or os.clock() > deadline or token ~= teleportToken + if token ~= teleportToken then + return + end + enterWorld(w, true) + if loadingGui then + loadingGui:SetAttribute("Ready", true) + end + end) +end + task.spawn(function() while true do local w = currentWorld() local id = w and w.id or "lobby" - if id ~= lastWorldId then - lastWorldId = id - applyAmbience(w) - if w then - notify(w.icon .. " " .. w.name, w.color) - end + if id ~= lastWorldId and lastWorldId ~= "none" and not loadingVisible() then + enterWorld(w, false) -- без телепорта (например, после возрождения): плавно end local cam = workspace.CurrentCamera if cam then @@ -4796,14 +7338,741 @@ task.spawn(function() end end) +---------------------------------------------------------------- обучение: линия-подсказка +-- белые «стрелки» бегут по земле от игрока к цели текущего шага (см. Config.TutorialDone) + +local GUIDE_N, GUIDE_GAP, GUIDE_SPEED = 32, 3, 7 -- сколько стрелок, шаг между ними, скорость бега +local guideStep = 0 -- шаг, отправленный на сервер (атрибут Tutorial может прийти чуть позже) + +-- крупная мультяшная подсказка под уведомлениями: покачивается, при смене шага «выпрыгивает» +local guideHint, guideHintText = softPlate( + { Size = UDim2.fromOffset(0, 70), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 10), Visible = false, Parent = gui }, + { TextSize = 42, Text = "" } +) +wobble(guideHint, 1.2, 1.6) +local lastHint = nil + +local guideFolder = new("Folder", { Name = "TutorialGuide", Parent = workspace }) +local chevrons = {} +for i = 1, GUIDE_N do + local arms = {} + for k = 1, 2 do + arms[k] = new("Part", { + Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false, CastShadow = false, + Material = Enum.Material.Neon, Color = Color3.fromRGB(70, 195, 255), Size = Vector3.new(0.5, 0.5, 2), Transparency = 1, + Parent = guideFolder, + }) + end + chevrons[i] = arms +end +-- два объёмных бруска стрелки «>» острием вперёд (по -Z) +local GUIDE_HEIGHT = 2.2 -- стрелки висят в воздухе над землёй +local ARM_CF = {} +for k, s in ipairs({ -1, 1 }) do + local center = Vector3.new(s * 0.65, 0, -0.15) + ARM_CF[k] = CFrame.lookAt(center, center + Vector3.new(s * 1.3, 0, 1.5)) +end +local function hideChevrons(from) + for i = from, GUIDE_N do + chevrons[i][1].Transparency = 1 + chevrons[i][2].Transparency = 1 + end +end + +local guideRay = RaycastParams.new() +guideRay.FilterType = Enum.RaycastFilterType.Exclude +guideRay.RespectCanCollide = true +guideRay.IgnoreWater = false + +local function tutorialStep() + return math.max(player:GetAttribute("Tutorial") or 0, guideStep) +end +local function advanceTutorial(step) + if step > tutorialStep() then + guideStep = step + remote:FireServer("Tutorial", step) + if step >= Config.TutorialDone then + notify("🎓 Обучение пройдено!", C.gold) + end + end +end + +local function guideMarker(name) + local map = workspace:FindFirstChild("FishingMap") + local m = map and map:FindFirstChild(name, true) -- маркеры могут лежать в папках уровня (World1Map) + return m and m.Position +end + +-- объект цели обводится мягким светящимся контуром (атрибут GuideTarget ставит MapBuilder); +-- Occluded: то, что стоит перед объектом (персонаж на мостике), не перекрашивается +local guideHighlight = new("Highlight", { + FillColor = Color3.fromRGB(150, 225, 255), OutlineColor = Color3.fromRGB(190, 240, 255), + DepthMode = Enum.HighlightDepthMode.Occluded, Enabled = false, Parent = guideFolder, +}) +local guideObjects, guideScanAt = {}, {} +local function guideObject(key) + local obj = guideObjects[key] + if obj and obj.Parent then + return obj + end + -- карта большая: если объекта нет (ещё не загрузился), ищем заново не чаще раза в 2 секунды + if guideScanAt[key] and os.clock() - guideScanAt[key] < 2 then + return nil + end + guideScanAt[key] = os.clock() + local map = workspace:FindFirstChild("FishingMap") + if not map then + return nil + end + for _, d in ipairs(map:GetDescendants()) do + if d:GetAttribute("GuideTarget") == key then + guideObjects[key] = d + return d + end + end + return nil +end + +-- первый подход к табличке: камера крупно на табличку, управление и весь интерфейс убраны; +-- кнопка «Далее» плавно возвращает камеру, интерфейс и управление +local StarterGui = game:GetService("StarterGui") +local BOARD_CAM_TIME, BOARD_FOV = 0.8, 70 +local boardView = nil +local closeBoardView +-- кнопка в отдельном ScreenGui: основной интерфейс на это время выключается целиком +local boardGui = new("ScreenGui", { Name = "BoardView", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 50, Enabled = false, Parent = player:WaitForChild("PlayerGui") }) +btn({ + Size = UDim2.fromOffset(240, 60), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -40), + BackgroundColor3 = C.green, Text = "Далее ▶", TextSize = 26, Parent = boardGui, +}, function() + closeBoardView() +end) + +local function setInterfaceHidden(hidden) + gui.Enabled = not hidden + boardGui.Enabled = hidden + pcall(function() + StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, not hidden) + end) + -- надписи над объектами (порталы, лавки) тоже прячем, потом возвращаем как было + if hidden then + boardView.billboards = {} + local map = workspace:FindFirstChild("FishingMap") + for _, d in ipairs(map and map:GetDescendants() or {}) do + if d:IsA("BillboardGui") and d.Enabled then + d.Enabled = false + table.insert(boardView.billboards, d) + end + end + elseif boardView and boardView.billboards then + for _, d in ipairs(boardView.billboards) do + d.Enabled = true + end + boardView.billboards = nil + end +end + +local function boardCamStep() + local bv, cam = boardView, workspace.CurrentCamera + if not bv or not cam then + return + end + local e = easeInOut(math.min(1, (os.clock() - bv.t0) / BOARD_CAM_TIME)) + cam.CFrame = bv.fromCF:Lerp(bv.toCF, e) + cam.FieldOfView = bv.fromFov + (bv.toFov - bv.fromFov) * e + if bv.returning and e >= 1 then + RunService:UnbindFromRenderStep("BoardCam") + cam.CameraType = Enum.CameraType.Custom + setInterfaceHidden(false) + boardView = nil + setMovementLocked(false) + end +end + +local function openBoardView(board) + local cam = workspace.CurrentCamera + -- отходим ровно настолько, чтобы табличка целиком влезла в кадр (по высоте и по ширине) с небольшим запасом + local half = math.tan(math.rad(BOARD_FOV / 2)) + local aspect = cam.ViewportSize.X / math.max(1, cam.ViewportSize.Y) + local dist = math.max((board.Size.Y / 2) / half, (board.Size.X / 2) / (half * aspect)) * 1.15 + boardView = { + t0 = os.clock(), origCF = cam.CFrame, origFov = cam.FieldOfView, + fromCF = cam.CFrame, fromFov = cam.FieldOfView, + -- надписи на лицевой стороне (Front), она смотрит по LookVector + toCF = CFrame.lookAt(board.Position + board.CFrame.LookVector * dist, board.Position), toFov = BOARD_FOV, + } + setMovementLocked(true) + setInterfaceHidden(true) + cam.CameraType = Enum.CameraType.Scriptable + RunService:UnbindFromRenderStep("BoardCam") + RunService:BindToRenderStep("BoardCam", Enum.RenderPriority.Camera.Value + 1, boardCamStep) +end + +closeBoardView = function() + local cam = workspace.CurrentCamera + if not boardView or boardView.returning or not cam then + return + end + boardGui.Enabled = false -- кнопка пропадает сразу, остальной интерфейс — когда камера вернётся + boardView.returning = true + boardView.t0 = os.clock() + boardView.fromCF, boardView.fromFov = cam.CFrame, cam.FieldOfView + boardView.toCF, boardView.toFov = boardView.origCF, boardView.origFov + advanceTutorial(1) +end + +-- скупка «Тихого озера»: ведём к прилавку с подсказкой «Продать» внутри лавки (GuideTarget = "Sell"), +-- поэтому стрелка идёт за лавкой, куда бы её ни переставили; маркер GuideSell — запасной вариант +local function sellTargetW1() + local shop = guideObject("Sell") + if shop then + for _, d in ipairs(shop:GetDescendants()) do + if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then + local p = d.Parent + local at = (p:IsA("BasePart") and p.Position) or (p:IsA("Attachment") and p.WorldPosition) + if at then + return at + end + end + end + return shop:IsA("Model") and shop:GetPivot().Position or shop.Position + end + return guideMarker("GuideSell") +end + +-- маршрут для текущего шага: точки ломаной (без игрока), подсказка и что подсветить; nil — линию не показываем +local function guideRoute(step, pos, world) + local inW1 = world and world.id == "World1" + if step == 0 and not world then + return { guideMarker("GuideBoard") }, "📋 Прочитай табличку", "Board" + elseif not world then -- шаги 1–3 из лобби: сначала в портал + return { guideMarker("GuidePortal") }, "🌊 Иди в портал", "Portal" + elseif step == 2 and inW1 then + return { guideMarker("GuideFishSpot") }, "🎣 Зажми ЛКМ у воды", "Pier" + elseif step == 3 and inW1 then + return { sellTargetW1() }, "💰 Продай рыбу", "Sell" -- лавка у самого причала, идём напрямую + end + return nil +end + +-- ближайшая скупка в этом мире (или в лобби): прилавки с ProximityPrompt Action = "Sell" +local nearestSell +do +local sellSpots, sellScanAt = {}, -math.huge +nearestSell = function(pos, world) + if #sellSpots == 0 and os.clock() - sellScanAt > 3 then + sellScanAt = os.clock() + local map = workspace:FindFirstChild("FishingMap") + for _, d in ipairs(map and map:GetDescendants() or {}) do + if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then + local p = d.Parent + local at = (p:IsA("BasePart") and p.Position) or (p:IsA("Attachment") and p.WorldPosition) or (p:IsA("Model") and p:GetPivot().Position) + if at then + table.insert(sellSpots, at) + end + end + end + end + local best, bestD = nil, nil + for _, at in ipairs(sellSpots) do + if Config.WorldAt(at) == world then + local d = (at - pos).Magnitude + if not bestD or d < bestD then + best, bestD = at, d + end + end + end + return best +end +end + +RunService.RenderStepped:Connect(function() + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + local step = tutorialStep() + -- пока сервер не прислал шаг (данные ещё грузятся), обучение не показываем; + -- после обучения линия ведёт к скупщику, когда сумка полна + local tutorialOn = player:GetAttribute("Tutorial") ~= nil and step < Config.TutorialDone + local bagFull = (player:GetAttribute("BagCount") or 0) >= (player:GetAttribute("BagCap") or math.huge) + if not hrp or not (tutorialOn or bagFull) then + guideHint.Visible = false + guideHighlight.Enabled = false + hideChevrons(1) + return + end + if boardView then -- смотрим на табличку: ни линии, ни подсказок + guideHint.Visible = false + guideHighlight.Enabled = false + hideChevrons(1) + return + end + local pos = hrp.Position + local world = Config.WorldAt(pos) + + -- переходы между шагами + if not tutorialOn then + -- обучение пройдено, остаётся только дорога к скупщику + elseif step <= 1 and world and world.id == "World1" then + advanceTutorial(2) + elseif step == 0 then + local board = guideMarker("GuideBoard") + if board and (board - pos).Magnitude < 9 and state == "idle" then + local obj = guideObject("Board") + if obj then + openBoardView(obj) -- шаг засчитается по кнопке «Далее» + return + end + advanceTutorial(1) + end + elseif step == 2 and (player:GetAttribute("TotalCaught") or 0) > 0 then + advanceTutorial(3) + end + step = tutorialStep() + + local route, hint, key + if tutorialOn then + route, hint, key = guideRoute(step, pos, world) + end + if not route and bagFull then + local inW1 = world and world.id == "World1" + local at = (inW1 and sellTargetW1()) or nearestSell(pos, world) + route, hint, key = at and { at } or nil, "🎒 Сумка полна — продай рыбу!", inW1 and "Sell" or nil + end + guideHintText.Text = hint or "" + local showHint = hint ~= nil and state == "idle" + if showHint and (hint ~= lastHint or not guideHint.Visible) then + popIn(guideHint, 0.5) + end + lastHint = hint + guideHint.Visible = showHint + local target = (key and state == "idle") and guideObject(key) or nil + guideHighlight.Adornee = target or nil + guideHighlight.Enabled = target ~= nil + if target then + local pulse = (math.sin(os.clock() * 4) + 1) / 2 -- мягкое мигание + guideHighlight.FillTransparency = 0.86 + 0.1 * pulse -- лёгкое «дыхание», цвет объекта виден + guideHighlight.OutlineTransparency = 0.1 + 0.45 * pulse + end + if not route or #route == 0 or state ~= "idle" then + hideChevrons(1) + return + end + + -- ломаная от ног игрока через точки маршрута + local pts = { pos - Vector3.new(0, 3, 0) } + for _, p in ipairs(route) do + table.insert(pts, p) + end + local lens, total = {}, 0 + for i = 2, #pts do + local d = ((pts[i] - pts[i - 1]) * Vector3.new(1, 0, 1)).Magnitude + lens[i] = math.max(d, 0.001) + total += d + end + if total < 4 then + hideChevrons(1) -- уже на месте + return + end + + guideRay.FilterDescendantsInstances = { player.Character, guideFolder } + local phase = (os.clock() * GUIDE_SPEED) % GUIDE_GAP + local seg, segStart = 2, 0 + for i = 1, GUIDE_N do + local d = 2 + phase + (i - 1) * GUIDE_GAP + if d > total - 1 then + hideChevrons(i) + break + end + while seg < #pts and d > segStart + lens[seg] do + segStart += lens[seg] + seg += 1 + end + local a, b = pts[seg - 1], pts[seg] + local p = a:Lerp(b, (d - segStart) / lens[seg]) + local dir = (b - a) * Vector3.new(1, 0, 1) + local hit = workspace:Raycast(p + Vector3.new(0, 4, 0), Vector3.new(0, -12, 0), guideRay) + -- висят в воздухе и слегка покачиваются волной + local y = (hit and hit.Position.Y or p.Y) + GUIDE_HEIGHT + math.sin(os.clock() * 4 - d * 0.5) * 0.25 + local base = CFrame.lookAt(Vector3.new(p.X, y, p.Z), Vector3.new(p.X, y, p.Z) + dir) + -- у игрока и у цели стрелки плавно проявляются и гаснут + local fade = math.max(0, 1 - math.min(d - 2, total - 1 - d) / 2.5) + local tr = 0.05 + 0.95 * fade + for k = 1, 2 do + chevrons[i][k].CFrame = base * ARM_CF[k] + chevrons[i][k].Transparency = tr + end + end +end) + +---------------------------------------------------------------- цели на экране: серия, трекер, босс, покупка у скупщика +-- в отдельной функции: у основного скрипта почти исчерпан лимит в 200 локальных переменных + +local refreshTracker, bestOffer, showOffer +local offerState = { bagWasFull = false } -- была ли сумка полной перед продажей (тогда первым предлагаем сумку побольше) +;(function() +local CENTER = Enum.TextXAlignment.Center +local RIGHT = Enum.TextXAlignment.Right +local FIRE = Color3.fromRGB(255, 150, 60) + +-- серия улова — справа от HUD; полоска показывает, сколько осталось до того, как серия сгорит +local comboBox = new("Frame", { + Size = UDim2.fromOffset(140, 66), Position = UDim2.fromOffset(310, 10), BackgroundColor3 = WHITE, Visible = false, Parent = gui, +}, { corner(14), stroke(FIRE, 2, 0.1), gradient(Color3.fromRGB(110, 50, 20), C.bg, 90) }) +local comboMultText = text({ Size = UDim2.new(1, 0, 0, 34), Position = UDim2.fromOffset(0, 3), Font = TITLE, TextSize = 28, TextXAlignment = CENTER, TextColor3 = Color3.fromRGB(255, 195, 95), TextStrokeTransparency = 0.5, Text = "", Parent = comboBox }) +local comboSub = text({ Size = UDim2.new(1, 0, 0, 16), Position = UDim2.fromOffset(0, 36), Font = BODY2, TextSize = 12, TextXAlignment = CENTER, TextColor3 = C.muted, Text = "", Parent = comboBox }) +local comboBack = new("Frame", { Size = UDim2.new(1, -20, 0, 5), Position = UDim2.new(0, 10, 1, -10), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = comboBox }, { corner(3) }) +local comboFill = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = FIRE, BorderSizePixel = 0, Parent = comboBack }, { corner(3) }) + +local function refreshCombo(pop) + local n = player:GetAttribute("Combo") or 0 + comboBox.Visible = n > 0 + if n > 0 then + -- множитель следующей рыбы (сервер считает так же) + comboMultText.Text = ("🔥 x%.1f"):format(math.min(Config.Combo.max, 1 + Config.Combo.step * n)) + comboSub.Text = ("серия %d · не упусти!"):format(n) + if pop then + popIn(comboBox, 0.6) + end + end +end +player:GetAttributeChangedSignal("Combo"):Connect(function() + refreshCombo(true) +end) +refreshCombo(false) + +-- правая колонка: босс и цели +local rightCol = new("Frame", { + Size = UDim2.fromOffset(300, 0), AutomaticSize = Enum.AutomaticSize.Y, AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 10), + BackgroundTransparency = 1, Parent = gui, +}, { new("UIListLayout", { Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + +local bossBox = new("Frame", { Size = UDim2.fromOffset(300, 78), BackgroundColor3 = WHITE, Visible = false, LayoutOrder = 1, Parent = rightCol }, + { corner(14), stroke(C.red, 2.5, 0.05), gradient(Color3.fromRGB(110, 30, 40), C.bg, 90) }) +local bossTitle = text({ Size = UDim2.new(1, -80, 0, 24), Position = UDim2.fromOffset(12, 5), Font = TITLE, TextSize = 18, TextColor3 = Color3.fromRGB(255, 205, 120), TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = bossBox }) +local bossTime = text({ Size = UDim2.fromOffset(60, 24), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 5), Font = TITLE, TextSize = 17, TextXAlignment = RIGHT, Text = "", Parent = bossBox }) +local bossBack = new("Frame", { Size = UDim2.new(1, -24, 0, 18), Position = UDim2.fromOffset(12, 32), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = bossBox }, { corner(9) }) +local bossFill = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = WHITE, Parent = bossBack }, { corner(9), gradient(Color3.fromRGB(255, 120, 90), Color3.fromRGB(190, 30, 50), 0) }) +local bossHpText = text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = CENTER, ZIndex = 2, TextStrokeTransparency = 0.5, Text = "", Parent = bossBack }) +local bossHint = text({ Size = UDim2.new(1, -24, 0, 18), Position = UDim2.fromOffset(12, 54), Font = BODY2, TextSize = 12, TextColor3 = C.muted, Text = "", Parent = bossBox }) + +local tracker = new("Frame", { Size = UDim2.fromOffset(300, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundColor3 = WHITE, LayoutOrder = 2, Parent = rightCol }, { + corner(14), stroke(C.line, 2, 0.35), gradient(C.panel2, C.bg, 90), + new("UIPadding", { PaddingLeft = UDim.new(0, 12), PaddingRight = UDim.new(0, 12), PaddingTop = UDim.new(0, 8), PaddingBottom = UDim.new(0, 10) }), + new("UIListLayout", { Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder }), +}) +text({ Size = UDim2.new(1, 0, 0, 20), LayoutOrder = 0, Font = TITLE, TextSize = 16, TextColor3 = C.muted, Text = "🎯 Цели", Parent = tracker }) + +local function trackerLine(order, onClick) + local root = new("TextButton", { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1, AutoButtonColor = false, Text = "", LayoutOrder = order, Parent = tracker }) + local label = text({ Size = UDim2.new(1, 0, 0, 22), Font = BODY, TextSize = 14, RichText = true, TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = root }) + local back = new("Frame", { Size = UDim2.new(1, 0, 0, 8), Position = UDim2.fromOffset(0, 26), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = root }, { corner(4) }) + local fill = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = C.gold, BorderSizePixel = 0, Parent = back }, { corner(4) }) + if onClick then + root.MouseButton1Click:Connect(onClick) + end + return { root = root, label = label, back = back, fill = fill } +end +local function setLine(line, txt, frac, color) + line.root.Visible = txt ~= nil + if not txt then + return + end + line.label.Text = txt + line.back.Visible = frac ~= nil + line.root.Size = UDim2.new(1, 0, 0, frac and 38 or 22) + if frac then + line.fill.Size = UDim2.fromScale(math.clamp(frac, 0, 1), 1) + line.fill.BackgroundColor3 = color or C.gold + end +end + +local questLine = trackerLine(1, function() + questWin.open("quests") +end) +local buyLine = trackerLine(2, function() + shopWin.open("rods") +end) +local dexLine = trackerLine(3, function() + bagWin.open("dex") +end) +local bagLine = trackerLine(4, function() + bagWin.open("fish") +end) + +local function plural(n, one, few, many) + local m10, m100 = n % 10, n % 100 + if m10 == 1 and m100 ~= 11 then + return one + elseif m10 >= 2 and m10 <= 4 and (m100 < 12 or m100 > 14) then + return few + end + return many +end + +-- ближайшая покупка: следующая удочка, а когда все куплены — улучшение текущей +local function buyGoal() + local coins, lvl = player:GetAttribute("Coins") or 0, player:GetAttribute("Level") or 1 + local owned = attrSet("OwnedRods") + for _, r in ipairs(Config.Rods) do + if not owned[r.id] then + if lvl < r.level then + return ("🎣 %s · 🔒 нужен ур. %d"):format(r.name, r.level), lvl / r.level, C.blue + elseif coins >= r.price then + return ("🎣 %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 == "TeleportFade" then + teleportLoading(a, b) elseif action == "Cast" then setState("waiting") + startCastCam(a, b) elseif action == "CastFail" or action == "Cancel" or action == "Escaped" then + if action == "CastFail" and castTool and castTool.Parent then + castTool.Grip = gripCF(REST_ANGLE) -- сервер удочку не трогал, а у нас она в замахе + end setState("idle") elseif action == "Bite" then mg.speed = a.speed @@ -4823,19 +8092,60 @@ remote.OnClientEvent:Connect(function(action, a, b, c) showCatch(a, b) playUiSound(DING, 0.5) elseif action == "Sold" then + if tutorialStep() == 3 then + advanceTutorial(Config.TutorialDone) + end floatText("+" .. fmt(a) .. " 💰", C.gold) - notify(("Продано рыб: %d → +%s 💰"):format(b, fmt(a)), Color3.fromRGB(120, 255, 140)) + 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 @@ -4847,4 +8157,167 @@ end) remote:FireServer("RequestInventory") ]=====]) -print('DONE! 5 scripts installed. Press Play (F5).') +make('LocalScript', 'Loading', game.ReplicatedFirst, [=====[-- Loading (LocalScript) -> ReplicatedFirst +-- Экран загрузки. Закрывает картинку при входе в игру и при каждом телепорте: игрок уже стоит на месте, +-- сцена прогружается, клиент ставит свет локации — и только потом экран плавно уходит. +-- +-- FishingClient управляет экраном через атрибуты ScreenGui «LoadingScreen»: +-- Visible = true — показать (при телепорте); +-- Ready = true — свет и террейн локации выставлены; +-- StartAt / MinUntil — os.clock() начала и минимального конца показа (полоска заполняется за это время); +-- Title — подпись под названием игры (куда идём). +-- Экран уходит, когда Ready = true и минимальное время прошло. + +local Players = game:GetService("Players") +local ReplicatedFirst = game:GetService("ReplicatedFirst") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local TweenService = game:GetService("TweenService") + +local player = Players.LocalPlayer +pcall(function() ReplicatedFirst:RemoveDefaultLoadingScreen() end) + +local GOLD = Color3.fromRGB(255, 205, 90) +local TIPS = { + "Чем реже рыба, тем быстрее бегает метка — нужна точность!", + "Улучшай удочку в магазине: рыба клюёт быстрее, удача выше.", + "Собери все виды одной редкости — получишь награду в коллекции (C).", + "Каждый день заходи за наградой из сундука в лобби.", + "Новые миры открываются с уровнем: следи за опытом!", +} + +local function new(class, props) + local o = Instance.new(class) + for k, v in pairs(props) do + if k ~= "Parent" then + o[k] = v + end + end + o.Parent = props.Parent + return o +end + +local gui = new("ScreenGui", { + Name = "LoadingScreen", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 200, + ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = player:WaitForChild("PlayerGui"), +}) +-- фон: арт лобби (временная заглушка); пока картинка грузится, виден тёплый закатный градиент +local BG_IMAGE = "rbxassetid://118616665961176" +local root = new("CanvasGroup", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.fromRGB(255, 190, 120), BorderSizePixel = 0, Parent = gui }) +new("UIGradient", { + Rotation = 90, + Color = ColorSequence.new(Color3.fromRGB(120, 200, 255), Color3.fromRGB(255, 170, 110)), + Parent = root, +}) +local bg = new("ImageLabel", { + Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, Image = BG_IMAGE, + ScaleType = Enum.ScaleType.Crop, Parent = root, +}) +task.spawn(function() + pcall(function() game:GetService("ContentProvider"):PreloadAsync({ bg }) end) +end) + +-- плашка снизу: куда идём, полоска загрузки, совет +local panel = new("Frame", { + AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -28), Size = UDim2.fromOffset(560, 118), + BackgroundColor3 = Color3.fromRGB(70, 40, 22), BackgroundTransparency = 0.18, BorderSizePixel = 0, Parent = root, +}) +new("UICorner", { CornerRadius = UDim.new(0, 18), Parent = panel }) +new("UIStroke", { Color = GOLD, Thickness = 3, Transparency = 0.1, Parent = panel }) +new("UIGradient", { + Rotation = 90, + Color = ColorSequence.new(Color3.fromRGB(150, 95, 50), Color3.fromRGB(95, 55, 28)), + Parent = panel, +}) +local float = new("TextLabel", { + AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(44, 32), Size = UDim2.fromOffset(46, 46), + BackgroundTransparency = 1, Text = "🎣", TextScaled = true, Font = Enum.Font.FredokaOne, Parent = panel, +}) +local title = new("TextLabel", { + Position = UDim2.fromOffset(78, 12), Size = UDim2.new(1, -96, 0, 38), BackgroundTransparency = 1, + Text = "", TextColor3 = Color3.fromRGB(255, 240, 200), TextScaled = true, TextXAlignment = Enum.TextXAlignment.Left, + Font = Enum.Font.FredokaOne, Parent = panel, +}) +new("UIStroke", { Color = Color3.fromRGB(60, 30, 10), Thickness = 2, Parent = title }) +local barBack = new("Frame", { + AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 62), Size = UDim2.new(1, -36, 0, 16), + BackgroundColor3 = Color3.fromRGB(40, 22, 10), BackgroundTransparency = 0.15, BorderSizePixel = 0, Parent = panel, +}) +new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = barBack }) +local bar = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = GOLD, BorderSizePixel = 0, Parent = barBack }) +new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = bar }) +new("UIGradient", { Color = ColorSequence.new(Color3.fromRGB(255, 230, 120), Color3.fromRGB(255, 160, 60)), Parent = bar }) +local tip = new("TextLabel", { + Position = UDim2.fromOffset(18, 86), Size = UDim2.new(1, -36, 0, 22), BackgroundTransparency = 1, + Text = "", TextColor3 = Color3.fromRGB(255, 228, 185), TextScaled = true, + Font = Enum.Font.GothamMedium, Parent = panel, +}) + +local rng = Random.new() +local function showTip() + tip.Text = "💡 " .. TIPS[rng:NextInteger(1, #TIPS)] +end + +-- при входе: экран виден сразу, минимум — из FishConfig, когда он загрузится +local now = os.clock() +gui:SetAttribute("Visible", true) +gui:SetAttribute("Ready", false) +gui:SetAttribute("StartAt", now) +gui:SetAttribute("MinUntil", now + 3) +gui:SetAttribute("Title", "Загрузка…") +showTip() + +task.spawn(function() + if not game:IsLoaded() then + game.Loaded:Wait() + end + local ok, Config = pcall(require, ReplicatedStorage:WaitForChild("FishConfig")) + if ok and Config.Loading then + gui:SetAttribute("MinUntil", gui:GetAttribute("StartAt") + Config.Loading.firstJoin) + end +end) + +local hiding = false +gui:GetAttributeChangedSignal("Visible"):Connect(function() + -- новый телепорт мог прийти, пока экран ещё уходил: тогда возвращаем его + if gui:GetAttribute("Visible") and (hiding or not gui.Enabled) then + hiding = false + showTip() + gui.Enabled = true + TweenService:Create(root, TweenInfo.new(0.25), { GroupTransparency = 0 }):Play() + end +end) +gui:GetAttributeChangedSignal("Title"):Connect(function() + title.Text = gui:GetAttribute("Title") or "" +end) +title.Text = gui:GetAttribute("Title") + +RunService.RenderStepped:Connect(function() + if not gui.Enabled then + return + end + local t = os.clock() + float.Rotation = math.sin(t * 2.2) * 12 + float.Position = UDim2.fromOffset(44, 32 + math.sin(t * 3) * 3) + local startAt, minUntil = gui:GetAttribute("StartAt") or t, gui:GetAttribute("MinUntil") or t + local p = math.clamp((t - startAt) / math.max(0.01, minUntil - startAt), 0, 1) + local ready = gui:GetAttribute("Ready") == true + if not ready then + p = math.min(p, 0.95) -- пока локация не готова, полоска не доходит до конца + end + bar.Size = UDim2.fromScale(p, 1) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if ready and hrp and t >= minUntil and not hiding then + hiding = true + local tw = TweenService:Create(root, TweenInfo.new(0.6), { GroupTransparency = 1 }) + tw.Completed:Connect(function() + if hiding then + gui.Enabled = false + gui:SetAttribute("Visible", false) + end + end) + tw:Play() + end +end) +]=====]) +print('DONE! 8 scripts installed. Press Play (F5).') diff --git a/install/LOW_POLY_LANDSCAPE.lua b/install/LOW_POLY_LANDSCAPE.lua new file mode 100644 index 0000000..2796c29 --- /dev/null +++ b/install/LOW_POLY_LANDSCAPE.lua @@ -0,0 +1,107 @@ +-- Apply to the baked World1Map in Edit mode. +-- Toolbox assets: DaveCam456 / 11751641277; FracturedSkies / 2128776869. +local V,CF=Vector3.new,CFrame.new +local terrain=workspace.Terrain +local map=workspace.World1Map +local lib=game.ServerStorage.LandscapeAssetLibrary +local ms=game:GetService('MaterialService') +for x=-288,287,48 do + terrain:ReplaceMaterial(Region3.new(V(x,-24,1212),V(x+48,160,1788)):ExpandToGrid(4),4,Enum.Material.Rock,Enum.Material.Slate) + task.wait() +end +local colors={Snow=Color3.fromRGB(127,163,63),Salt=Color3.fromRGB(191,155,105),Rock=Color3.fromRGB(132,139,155),Slate=Color3.fromRGB(132,139,155)} +for name,color in colors do + local material=Enum.Material[name] + local variant=ms:FindFirstChild('LowPolyFlat'..name) or Instance.new('MaterialVariant') + variant.Name='LowPolyFlat'..name;variant.BaseMaterial=material + variant.ColorMap='rbxasset://textures/SelfView/whiteRect.png' + variant.RoughnessMap='rbxasset://textures/SelfView/whiteRect.png' + variant.NormalMap='';variant.MetalnessMap='';variant.StudsPerTile=32;variant.Parent=ms + ms:SetBaseMaterialOverride(material,variant.Name);terrain:SetMaterialColor(material,color) +end +local old=map:FindFirstChild('LowPolyRockwork');if old then old:Destroy() end +local folder=Instance.new('Folder');folder.Name='LowPolyRockwork';folder.Parent=map +folder:SetAttribute('CliffCreator','DaveCam456') +folder:SetAttribute('CliffAssetId','11751641277') +folder:SetAttribute('RockCreator','FracturedSkies') +folder:SetAttribute('RockAssetId','2128776869') +local cliff=lib.LowPolyRockyCliff:FindFirstChildWhichIsA('MeshPart',true) +local mountain=lib.MountainBorder:FindFirstChildWhichIsA('MeshPart',true) +local stones={} +for _,p in lib.LowPolyRockPack:GetDescendants() do if p:IsA('MeshPart') then table.insert(stones,p) end end +table.sort(stones,function(a,b) return a.Name1530) and not (x< -58 and x> -95 and z>1430 and z<1494) and not (x> -24 and x<8 and z<1440) + if g>-1 and g<7 and clear then + local hit=workspace:Raycast(V(x,180,z),V(0,-230,0),rp) + if hit then + local s=rng:NextNumber(3,7) + place(stones[i%#stones+1],'ShoreBoulder',hit.Position+V(0,s*0.18,0),V(s,s*0.8,s*0.9),rng:NextNumber(0,6.28)) + end + end +end +-- Put trees on the new rock surfaces instead of leaving them inside the mountains. +local rockRay=RaycastParams.new();rockRay.FilterType=Enum.RaycastFilterType.Include;rockRay.FilterDescendantsInstances={folder,terrain};rockRay.IgnoreWater=true +local moved=0 +for _,tree in map.LandscapeDetails:GetChildren() do + if tree:IsA('Model') and tree.Name=='Pine' then + local c,s=tree:GetBoundingBox() + local base=c.Y-s.Y/2 + local hit=workspace:Raycast(V(c.X,220,c.Z),V(0,-260,0),rockRay) + if hit and math.abs(hit.Position.Y-base)>0.5 then tree:PivotTo(tree:GetPivot()+V(0,hit.Position.Y-base-0.3,0));moved+=1 end + end +end +for _,n in {'AssetPreview','MountainPreview'} do local preview=workspace:FindFirstChild(n);if preview then preview:Destroy() end end +map:SetAttribute('LandscapeStyle','LowPolyMatte') +local small=map.SmallCabin +local sc,ss=small:GetBoundingBox() +local shore=workspace:Raycast(V(-8,180,1438),V(0,-220,0),rp) +local sy=math.max(3.5,shore and shore.Position.Y or 3.5) +small:PivotTo(small:GetPivot()+V(-8-sc.X,sy-(sc.Y-ss.Y/2),1438-sc.Z)) +return {rocks=#folder:GetChildren(),treesGrounded=moved} + + diff --git a/install/REBUILD_LANDSCAPE.lua b/install/REBUILD_LANDSCAPE.lua new file mode 100644 index 0000000..b43dedf --- /dev/null +++ b/install/REBUILD_LANDSCAPE.lua @@ -0,0 +1,170 @@ +-- Run in Studio Edit mode. Rebuilds only World1 landscape; keep a scene backup first. +local V, CF = Vector3.new, CFrame.new +local terrain, map = workspace.Terrain, workspace.World1Map +local W = V(0,0,1500) +local lakes = require(game.ReplicatedStorage.FishConfig).Worlds[1].lakes +local path = {{-24,62,4},{-64,52,5},{-87,32,7},{-100,4,10},{-106,-27,17},{-103,-57,27},{-91,-83,37},{-66,-92,46},{-39,-105,54},{-46,-123,60}} +local function gap(x,z) + local g=1e5 + for _,l in lakes do g=math.min(g,math.sqrt((x-l[1])^2+(z-l[2])^2)-l[3]) end + return g +end +local function pathInfo(x,z) + local best,h=1e5,4 + for i=2,#path do + local a,b=path[i-1],path[i]; local dx,dz=b[1]-a[1],b[2]-a[2] + local t=math.clamp(((x-a[1])*dx+(z-a[2])*dz)/(dx*dx+dz*dz),0,1) + local d=math.sqrt((x-a[1]-dx*t)^2+(z-a[2]-dz*t)^2) + if d0 then + m=Enum.Material.Rock + if bottom>h-7 then + m=(slope>1.05 and h>14) and Enum.Material.Rock or Enum.Material.Snow + if pd<4.5 and g>2 then m=Enum.Material.Salt end + if g<3 then m=Enum.Material.Sand end + end + elseif g<0 and bottom<0 then m=Enum.Material.Water; o=1 end + mats[ix][iy][iz],occ[ix][iy][iz]=m,o + end + end end + terrain:WriteVoxels(region,4,mats,occ) + task.wait() + end +end +local old=map:FindFirstChild('LandscapeDetails'); if old then old:Destroy() end +local details=Instance.new('Folder');details.Name='LandscapeDetails';details.Parent=map +local rng=Random.new(103) +local function part(name,size,cf,color,material,parent) + local p=Instance.new('Part'); p.Name=name;p.Size=size;p.CFrame=cf;p.Color=color;p.Material=material or Enum.Material.SmoothPlastic;p.Anchored=true;p.TopSurface=Enum.SurfaceType.Smooth;p.BottomSurface=Enum.SurfaceType.Smooth;p.Parent=parent or details;return p +end +local wood=Color3.fromRGB(125,78,43) +local function beam(a,b,width,color,parent) + return part('Rail',V(width,width,(b-a).Magnitude),CFrame.lookAt((a+b)/2,b),color or wood,Enum.Material.Wood,parent) +end +-- Move existing assets, keeping game markers and identifiers intact. +local tower=map.Watchtower +local tc,ts=tower:GetBoundingBox() +tower:PivotTo(tower:GetPivot()+V(-46-tc.X,60-(tc.Y-ts.Y/2),1377-tc.Z)) +local cabin=map.BigCabin +local bc,bs=cabin:GetBoundingBox() +cabin:PivotTo(cabin:GetPivot()+V(-89-bc.X,8-(bc.Y-bs.Y/2),1512-bc.Z)) +local small=map.SmallCabin;local sc,sz=small:GetBoundingBox() +small:PivotTo(small:GetPivot()+V(-24-sc.X,5-(sc.Y-sz.Y/2),1416-sc.Z)) +-- An upper river runs beneath the existing bridge to the waterfall lip. +terrain:FillBlock(CF(46,34,1394),V(12,4,54),Enum.Material.Water) +terrain:FillBlock(CF(46,40,1394),V(12,8,54),Enum.Material.Air) +-- Cliff buttresses flank the falling water and support both bridge ends. +for _,b in {{27,17,1422,20,34,24},{68,17,1423,23,34,27}} do + terrain:FillBlock(CF(b[1],b[2],b[3]),V(b[4],b[5],b[6]),Enum.Material.Rock) + terrain:FillBlock(CF(b[1],35,b[3]-5),V(b[4],4,b[6]-10),Enum.Material.Snow) +end +-- Trail fencing follows the graded path, leaving the entrance open. +for i=3,#path do + local a,b=path[i-1],path[i] + local av,bv=V(a[1],a[3],a[2]),V(b[1],b[3],b[2]) + local dir=V(b[1]-a[1],0,b[2]-a[2]).Unit;local side=V(-dir.Z,0,dir.X)*6 + local steps=math.ceil((bv-av).Magnitude/9) + for _,sign in {-1,1} do + local prev + for j=0,steps do + local p=W+av:Lerp(bv,j/steps)+side*sign + part('TrailPost',V(0.65,3.7,0.65),CF(p+V(0,1.6,0)),wood,Enum.Material.Wood) + if prev then beam(prev+V(0,2.7,0),p+V(0,2.7,0),0.4);beam(prev+V(0,1.3,0),p+V(0,1.3,0),0.3) end + prev=p + end + end +end +-- Restore the established low-poly evergreen style from World1Builder. +local crownRotation=CFrame.Angles(math.rad(-35.264),0,0)*CFrame.Angles(0,0,math.rad(45)) +local count=0 +for i=1,520 do + local x,z=rng:NextNumber(-235,235),rng:NextNumber(-235,235) + local g=gap(x,z);local pd=pathInfo(x,z);local h=height(x,z) + local blocked=(x>-38 and x<38 and z>42 and z<100) or (math.abs(x+80)<29 and math.abs(z+50)<26) or (math.abs(x+24)<16 and math.abs(z+84)<15) or (math.abs(x+46)<20 and math.abs(z+123)<18) or (x>12 and x<86 and z< -65 and z> -152) + if g>10 and pd>12 and not blocked and h<100 then + local tree=Instance.new('Model');tree.Name='Pine' + local ht=rng:NextNumber(17,32);local p=W+V(x,h-0.5,z) + part('Trunk',V(ht*0.065,ht*0.55,ht*0.065),CF(p+V(0,ht*0.25,0)),Color3.fromRGB(91,65,39),Enum.Material.Wood,tree) + for tier=0,3 do + local s=ht*(0.43-tier*0.075) + local leaf=part('Needles',V(s,s,s),CF(p+V(0,ht*(0.3+tier*0.18),0))*CFrame.Angles(0,i*1.73,0)*crownRotation,Color3.fromRGB(43+tier*11,91+tier*12,51+tier*3),nil,tree) + leaf.CanCollide=false + end + tree.Parent=details;count+=1 + end + if i%40==0 then task.wait() end +end +-- Shore rocks and low shrubs frame the lake without hiding the main landmarks. +for i=1,250 do + local x,z=rng:NextNumber(-125,125),rng:NextNumber(-145,90) + local g=gap(x,z);local pd=pathInfo(x,z) + if g>2 and g<13 and pd>9 and not (math.abs(x)<25 and z>35) and not (x>20 and x<78 and z< -60) then + local h=height(x,z);local s=rng:NextNumber(2,6) + local p=part('ShoreRock',V(s,s*0.65,s*0.8),CF(W+V(x,h,z))*CFrame.Angles(0.2,i,0.3),Color3.fromRGB(115,125,132)) + if i%2==0 then + for j=1,3 do local q=part('Shrub',V(2.8,2.8,2.8),CF(W+V(x+j*1.1,h+1,z-2)),Color3.fromRGB(91+j*12,138+j*8,51));q.Shape=Enum.PartType.Ball;q.CanCollide=false end + end + end +end +local lighting=game:GetService('Lighting');lighting.ClockTime=15.2;lighting.Brightness=2.5;lighting.Ambient=Color3.fromRGB(125,137,145);lighting.OutdoorAmbient=Color3.fromRGB(145,152,139) +workspace.CurrentCamera.CFrame=CFrame.lookAt(V(8,17,1575),V(-10,25,1435)) +map:SetAttribute('LandscapeRevision','ReferenceLandscape_v1') +return {trees=count,details=#details:GetDescendants(),pathPoints=#path} + + diff --git a/install/REPLACE_LANDSCAPE_TREES.lua b/install/REPLACE_LANDSCAPE_TREES.lua new file mode 100644 index 0000000..d6a22d9 --- /dev/null +++ b/install/REPLACE_LANDSCAPE_TREES.lua @@ -0,0 +1,37 @@ +-- Requires the generated SpruceTree template, retained in ServerStorage after use. +local source=workspace:FindFirstChild('SpruceTree') or game.ServerStorage:FindFirstChild('SpruceTree') +assert(source,'Generate or restore SpruceTree first') +local template=Instance.new('Model');template.Name='SpruceTemplate' +for _,p in source:GetDescendants() do + if p:IsA('BasePart') then + local q=p:Clone();q.Anchored=true + if q.Name:find('Foliage') then q.CanCollide=false;q.Material=Enum.Material.SmoothPlastic;q.UsePartColor=true end + q.Parent=template + end +end +local templateBounds=template:GetBoundingBox() +template.WorldPivot=CFrame.new(templateBounds.Position) +local rng=Random.new(58) +local folder=workspace.World1Map.LandscapeDetails +local n=0 +for _,tree in folder:GetChildren() do + if tree.Name=='Pine' and tree:IsA('Model') then + local trunk=tree:FindFirstChild('Trunk') + if trunk then + local base=trunk.Position-Vector3.new(0,trunk.Size.Y/2,0) + local copy=template:Clone();copy.Name='Pine';copy:ScaleTo(rng:NextNumber(0.75,1.25)) + local cf,size=copy:GetBoundingBox() + copy:PivotTo(CFrame.new(base+Vector3.new(0,size.Y/2,0))*CFrame.Angles(0,rng:NextNumber(0,6.28),0)) + local c,s=copy:GetBoundingBox();copy:PivotTo(copy:GetPivot()+Vector3.new(base.X-c.X,base.Y-(c.Y-s.Y/2),base.Z-c.Z)) + local shade=rng:NextNumber(-0.03,0.04) + for _,p in copy:GetChildren() do + if p.Name:find('Foliage') then local k=tonumber(p.Name:match('%d+')) or 1;p.Color=Color3.fromRGB(50+k*5,95+k*7,44+k*4):Lerp(Color3.fromRGB(120,145,60),math.max(0,shade*7)) end + end + copy.Parent=folder;tree:Destroy();n+=1 + if n%25==0 then task.wait() end + end + end +end +template:Destroy();source.Parent=game.ServerStorage +return {replaced=n} + diff --git a/install/UPDATE_SCRIPTS.lua b/install/UPDATE_SCRIPTS.lua new file mode 100644 index 0000000..ba54126 --- /dev/null +++ b/install/UPDATE_SCRIPTS.lua @@ -0,0 +1,9080 @@ +-- Обновляет скрипты игры. Карту (Workspace.FishingMap) НЕ трогает. +local function put(class, name, parent, src) + local s = parent:FindFirstChild(name) + if s and s.ClassName ~= class then s:Destroy() s = nil end + if not s then s = Instance.new(class) s.Name = name s.Parent = parent end + s.Source = src + print('OK', parent.Name .. '/' .. name) +end +put('ModuleScript', 'FishConfig', game.ReplicatedStorage, [=====[-- FishConfig (ModuleScript) -> ReplicatedStorage +-- Все настройки игры. Меняй цифры здесь, чтобы настроить баланс. + +local Config = {} + +Config.GameName = "Клёвое место" + +---------------------------------------------------------------- миры +-- center = центр мира на карте; mult = множитель наград коллекции +Config.Worlds = { + { + id = "World1", name = "Тихое озеро", icon = "🌊", level = 1, mult = 1, + center = Vector3.new(0, 0, 1500), color = Color3.fromRGB(60, 200, 255), + desc = "Спокойное лесное озеро. Отличное место, чтобы начать.", + clock = 16.2, + waterY = 0, + lakes = { { 0, -15, 62 }, { -42, 8, 34 }, { 44, 2, 36 }, { 0, 22, 30 }, { 48, -50, 22 } }, -- { x, z, радиус } от центра + -- внешний вид только этого мира (применяет клиент при входе, при выходе возвращает как было) + tint = Color3.fromRGB(255, 247, 236), + -- свет и эффекты: свойства Lighting и его эффектов; чего здесь нет, остаётся как в MapBuilder + look = { + lighting = { + Brightness = 2.6, ExposureCompensation = -0.15, + Ambient = Color3.fromRGB(62, 66, 84), OutdoorAmbient = Color3.fromRGB(105, 112, 132), + ColorShift_Top = Color3.fromRGB(255, 232, 196), + EnvironmentDiffuseScale = 0.6, EnvironmentSpecularScale = 0.8, + }, + -- дымка вдали: Density — сколько тумана, Haze — насколько он плотный у горизонта + atmosphere = { + Density = 0.38, Offset = 0.1, Haze = 1.2, Glare = 0.15, + Color = Color3.fromRGB(188, 204, 224), Decay = Color3.fromRGB(196, 176, 160), + }, + color = { Saturation = 0.28, Contrast = 0.2, Brightness = -0.02 }, + bloom = { Intensity = 0.45, Size = 28, Threshold = 1.2 }, + sunRays = { Intensity = 0.06, Spread = 0.6 }, + -- лёгкое размытие дальнего плана + dof = { Enabled = true, FarIntensity = 0.2, FocusDistance = 60, InFocusRadius = 120, NearIntensity = 0 }, + }, + -- земля мира залита материалом Snow (ровный, без травинок), дорожки — Salt; здесь они перекрашиваются + terrainColors = { + Snow = Color3.fromRGB(127, 163, 63), Salt = Color3.fromRGB(191, 155, 105), + Rock = Color3.fromRGB(132, 139, 155), Slate = Color3.fromRGB(132, 139, 155), + Mud = Color3.fromRGB(78, 110, 92), Sand = Color3.fromRGB(205, 190, 140), + }, + }, + { + id = "World2", name = "Тропический остров", icon = "🏝", level = 8, mult = 4, + center = Vector3.new(1500, 0, 0), color = Color3.fromRGB(255, 190, 70), + desc = "Бирюзовое море, пальмы и яркая рифовая рыба.", + clock = 13, + waterY = 0, + sea = 119, -- всё дальше этого радиуса от центра — море + }, + { + id = "World3", name = "Ледяной фьорд", icon = "❄", level = 18, mult = 12, + center = Vector3.new(-1500, 0, 0), color = Color3.fromRGB(150, 220, 255), + desc = "Рыбалка в лунках среди льдов и северного сияния.", + clock = 18.3, + waterY = 1, + lakes = { { 0, 0, 70 }, { -55, 30, 45 }, { 55, -25, 50 }, { 5, -70, 40 } }, -- подо льдом + holes = { + { 0, 40 }, { -22, 18 }, { 22, 12 }, { 0, -12 }, { -30, -30 }, { 30, 40 }, { -60, 35 }, + { -45, 15 }, { 55, -25 }, { 75, -5 }, { 40, -50 }, { 5, -75 }, { -15, -60 }, { 25, -80 }, + }, + holeRadius = 6, + -- цвета террейна общие на весь плейс, а в нём сохранены цвета «Тихого озера» (зелёный Snow) — + -- поэтому снег фьорда задаём явно + terrainColors = { Snow = Color3.fromRGB(205, 212, 228) }, + }, + { + id = "World4", name = "Вулкан", icon = "🌋", level = 30, mult = 30, soon = true, + center = Vector3.new(0, 0, -1500), color = Color3.fromRGB(255, 90, 40), + desc = "Рыбалка в лаве. Скоро!", + }, +} +Config.WorldRadius = 260 + +-- экран загрузки: при входе в игру и при каждом телепорте игрок уже стоит на месте, сцена прогружается +-- и свет локации ставится под ним; картинку видно только после этого (секунды — минимум показа) +Config.Loading = { + firstJoin = 3, + teleport = 2.5, +} + +-- лобби: те же поля внешнего вида, что у миров (clock, tint, look, terrainColors); клиент применяет их вне миров +Config.Lobby = { + id = "Lobby", + clock = 16.3, -- предвечернее солнце: тени длиннее, свет теплее + tint = Color3.fromRGB(255, 242, 228), + look = { + lighting = { + Brightness = 2.0, ExposureCompensation = -0.3, + Ambient = Color3.fromRGB(64, 60, 72), OutdoorAmbient = Color3.fromRGB(120, 114, 124), + ColorShift_Top = Color3.fromRGB(255, 224, 186), + EnvironmentDiffuseScale = 0.5, EnvironmentSpecularScale = 0.5, + GlobalShadows = true, + }, + -- тёплая дымка: дальние холмы за скалами тонут в ней + atmosphere = { + Density = 0.4, Offset = 0.18, Haze = 1.6, Glare = 0.25, + Color = Color3.fromRGB(222, 212, 204), Decay = Color3.fromRGB(186, 160, 150), + }, + color = { Saturation = 0.18, Contrast = 0.14, Brightness = -0.04 }, + bloom = { Intensity = 0.3, Size = 24, Threshold = 1.8 }, + sunRays = { Intensity = 0.05, Spread = 0.7 }, + dof = { Enabled = true, FarIntensity = 0.18, FocusDistance = 55, InFocusRadius = 95, NearIntensity = 0 }, + -- мягкий тонмаппинг вместо Retro: светлая плитка и вывески не выгорают в белое + grading = { TonemapperPreset = Enum.TonemapperPreset.Default }, + }, + terrainColors = { + Grass = Color3.fromRGB(104, 150, 72), Ground = Color3.fromRGB(120, 98, 74), Rock = Color3.fromRGB(140, 126, 130), + }, +} + +function Config.WorldAt(pos) + for _, w in ipairs(Config.Worlds) do + if not w.soon then + local d = Vector3.new(pos.X - w.center.X, 0, pos.Z - w.center.Z).Magnitude + if d < Config.WorldRadius then + return w + end + end + end + return nil +end + +-- куда бросать из этой точки (единичный вектор по горизонтали): к центру ближайшего озера или лунки, +-- а если ближе море — от центра острова к морю +function Config.CastDirection(world, pos) + if not world then + return nil + end + local x, z = pos.X - world.center.X, pos.Z - world.center.Z + local best, bestGap + local function consider(dir, gap) + if dir.Magnitude > 0.1 and (not bestGap or gap < bestGap) then + best, bestGap = dir.Unit, gap + end + end + if world.holes then + for _, h in ipairs(world.holes) do + consider(Vector3.new(h[1] - x, 0, h[2] - z), math.sqrt((h[1] - x) ^ 2 + (h[2] - z) ^ 2) - (world.holeRadius or 6)) + end + end + for _, l in ipairs(world.lakes or {}) do + if not world.holes then -- в Мире 3 озёра подо льдом, бросаем только в лунки + consider(Vector3.new(l[1] - x, 0, l[2] - z), math.sqrt((l[1] - x) ^ 2 + (l[2] - z) ^ 2) - l[3]) + end + end + if world.sea then + consider(Vector3.new(x, 0, z), world.sea - math.sqrt(x * x + z * z)) + end + return best +end + +-- расстояние по горизонтали от точки до ближайшей воды (0 — над водой: на причале или в воде) +function Config.WaterGap(world, pos) + if not world then + return math.huge + end + local x, z = pos.X - world.center.X, pos.Z - world.center.Z + local gap = math.huge + if world.holes then + for _, h in ipairs(world.holes) do + gap = math.min(gap, math.sqrt((h[1] - x) ^ 2 + (h[2] - z) ^ 2) - (world.holeRadius or 6)) + end + else + for _, l in ipairs(world.lakes or {}) do + gap = math.min(gap, math.sqrt((l[1] - x) ^ 2 + (l[2] - z) ^ 2) - l[3]) + end + end + if world.sea then + gap = math.min(gap, world.sea - math.sqrt(x * x + z * z)) + end + return math.max(0, gap) +end + +-- можно ли закидывать отсюда (pos — центр персонажа): стоим на берегу или платформе +-- и до воды не дальше Config.CastReach. Возвращает true или текст подсказки. +-- humanoid можно не передавать (на сервере его состояние ненадёжно) — тогда проверяем только по высоте. +function Config.CanCastFrom(world, pos, humanoid) + if not world then + return "🌍 Тут нет рыбы" + end + local inWater = pos.Y < (world.waterY or 0) + 2 -- у плывущего персонажа центр почти на уровне воды + if humanoid then + inWater = inWater or humanoid:GetState() == Enum.HumanoidStateType.Swimming or humanoid.FloorMaterial == Enum.Material.Water + end + if inWater then + return "🏊 Выйди из воды" + end + if humanoid and humanoid.FloorMaterial == Enum.Material.Air then + return "Встань на землю" + end + if Config.WaterGap(world, pos) > Config.CastReach then + return "🌊 Подойди к воде" + end + return true +end + +-- есть ли вода в этой точке мира (озеро, море или лунка) +function Config.IsWater(world, pos) + if not world then + return false + end + local x, z = pos.X - world.center.X, pos.Z - world.center.Z + if world.holes then + local r = world.holeRadius or 6 + for _, h in ipairs(world.holes) do + if (x - h[1]) ^ 2 + (z - h[2]) ^ 2 <= r * r then + return true + end + end + return false + end + if world.sea and math.sqrt(x * x + z * z) >= world.sea then + return true + end + for _, l in ipairs(world.lakes or {}) do + if (x - l[1]) ^ 2 + (z - l[2]) ^ 2 <= (l[3] - 1) ^ 2 then + return true + end + end + return false +end + +---------------------------------------------------------------- редкости +Config.Rarities = { + Common = { name = "Обычная", rank = 1, weight = 55, color = Color3.fromRGB(215, 220, 225) }, + Uncommon = { name = "Необычная", rank = 2, weight = 27, color = Color3.fromRGB(95, 225, 115) }, + Rare = { name = "Редкая", rank = 3, weight = 11, color = Color3.fromRGB(70, 160, 255) }, + Epic = { name = "Эпическая", rank = 4, weight = 4.5, color = Color3.fromRGB(185, 90, 255) }, + Legendary = { name = "Легендарная", rank = 5, weight = 1.2, color = Color3.fromRGB(255, 185, 35) }, + Mythic = { name = "Мифическая", rank = 6, weight = 0.25, color = Color3.fromRGB(255, 80, 150) }, +} +Config.RarityOrder = { "Common", "Uncommon", "Rare", "Epic", "Legendary", "Mythic" } + +---------------------------------------------------------------- мутации +Config.Mutations = { + { id = "Rainbow", name = "Радужная", chance = 0.002, mult = 10, color = Color3.fromRGB(255, 120, 230) }, + { id = "Golden", name = "Золотая", chance = 0.010, mult = 5, color = Color3.fromRGB(255, 205, 60) }, + { id = "Shiny", name = "Блестящая", chance = 0.040, mult = 2, color = Color3.fromRGB(170, 240, 255) }, +} + +---------------------------------------------------------------- рыба +-- shape: classic, long, tall, flat, ray, puffer, shark, eel, sword, angler, jelly, sturgeon +-- color2 = второй цвет (плавники/узор); stripes/spots/whiskers/spikes/glow — украшения модели +local function F(t) + return t +end + +Config.Zones = { + World1 = { + fish = { + F({ id = "Karas", name = "Карась", rarity = "Common", price = 5, xp = 8, minW = 0.2, maxW = 1.2, size = 1.0, shape = "tall", color = Color3.fromRGB(205, 170, 75), color2 = Color3.fromRGB(170, 120, 50) }), + F({ id = "Plotva", name = "Плотва", rarity = "Common", price = 6, xp = 8, minW = 0.1, maxW = 0.8, size = 0.9, shape = "classic", color = Color3.fromRGB(195, 200, 210), color2 = Color3.fromRGB(220, 80, 60) }), + F({ id = "Ersh", name = "Ёрш", rarity = "Common", price = 7, xp = 9, minW = 0.1, maxW = 0.4, size = 0.8, shape = "classic", color = Color3.fromRGB(135, 125, 75), color2 = Color3.fromRGB(95, 85, 50), spikes = true, spots = 6 }), + F({ id = "Okun", name = "Окунь", rarity = "Uncommon", price = 15, xp = 18, minW = 0.3, maxW = 1.5, size = 1.0, shape = "classic", color = Color3.fromRGB(150, 180, 70), color2 = Color3.fromRGB(230, 90, 40), stripes = 5, spikes = true }), + F({ id = "Lesh", name = "Лещ", rarity = "Uncommon", price = 18, xp = 20, minW = 0.5, maxW = 3.0, size = 1.2, shape = "tall", color = Color3.fromRGB(175, 145, 95), color2 = Color3.fromRGB(120, 95, 60) }), + F({ id = "Lin", name = "Линь", rarity = "Uncommon", price = 20, xp = 22, minW = 0.4, maxW = 2.5, size = 1.1, shape = "classic", color = Color3.fromRGB(95, 125, 55), color2 = Color3.fromRGB(60, 85, 35) }), + F({ id = "Shuka", name = "Щука", rarity = "Rare", price = 45, xp = 45, minW = 1.0, maxW = 8.0, size = 1.5, shape = "long", color = Color3.fromRGB(110, 140, 85), color2 = Color3.fromRGB(200, 210, 150), spots = 12 }), + F({ id = "Sudak", name = "Судак", rarity = "Rare", price = 50, xp = 48, minW = 1.0, maxW = 6.0, size = 1.4, shape = "long", color = Color3.fromRGB(165, 165, 135), color2 = Color3.fromRGB(80, 80, 70), stripes = 6, spikes = true }), + F({ id = "Som", name = "Сом", rarity = "Epic", price = 130, xp = 110, minW = 5.0, maxW = 40, size = 2.0, shape = "long", color = Color3.fromRGB(75, 75, 90), color2 = Color3.fromRGB(180, 175, 160), whiskers = true }), + F({ id = "Koi", name = "Карп кои", rarity = "Epic", price = 150, xp = 120, minW = 2.0, maxW = 9.0, size = 1.4, shape = "classic", color = Color3.fromRGB(250, 245, 240), color2 = Color3.fromRGB(240, 110, 40), spots = 7, whiskers = true }), + F({ id = "Gold", name = "Золотая рыбка", rarity = "Legendary", price = 500, xp = 350, minW = 0.1, maxW = 0.5, size = 0.9, shape = "classic", color = Color3.fromRGB(255, 195, 40), color2 = Color3.fromRGB(255, 120, 30), glow = true, bigTail = true }), + F({ id = "Crystal", name = "Хрустальный осётр", rarity = "Mythic", price = 2000, xp = 900, minW = 10, maxW = 60, size = 2.0, shape = "sturgeon", color = Color3.fromRGB(150, 230, 255), color2 = Color3.fromRGB(230, 250, 255), glow = true, glass = true }), + }, + }, + World2 = { + fish = { + F({ id = "Clown", name = "Рыба-клоун", rarity = "Common", price = 18, xp = 18, minW = 0.1, maxW = 0.4, size = 0.8, shape = "classic", color = Color3.fromRGB(255, 120, 30), color2 = Color3.fromRGB(255, 255, 255), stripes = 3 }), + F({ id = "Sergeant", name = "Рыба-сержант", rarity = "Common", price = 20, xp = 18, minW = 0.2, maxW = 0.9, size = 0.9, shape = "tall", color = Color3.fromRGB(240, 230, 110), color2 = Color3.fromRGB(40, 40, 45), stripes = 5 }), + F({ id = "Mullet", name = "Барабулька", rarity = "Common", price = 22, xp = 20, minW = 0.1, maxW = 0.6, size = 0.9, shape = "classic", color = Color3.fromRGB(235, 110, 100), color2 = Color3.fromRGB(255, 220, 120), whiskers = true }), + F({ id = "Angel", name = "Рыба-ангел", rarity = "Uncommon", price = 45, xp = 40, minW = 0.3, maxW = 1.5, size = 1.0, shape = "tall", color = Color3.fromRGB(60, 120, 230), color2 = Color3.fromRGB(255, 220, 40), stripes = 4, bigFins = true }), + F({ id = "Puffer", name = "Иглобрюх", rarity = "Uncommon", price = 50, xp = 42, minW = 0.3, maxW = 2.0, size = 1.0, shape = "puffer", color = Color3.fromRGB(230, 205, 140), color2 = Color3.fromRGB(110, 90, 60), spots = 10 }), + F({ id = "Parrot", name = "Рыба-попугай", rarity = "Uncommon", price = 55, xp = 45, minW = 1.0, maxW = 5.0, size = 1.2, shape = "classic", color = Color3.fromRGB(60, 210, 190), color2 = Color3.fromRGB(240, 90, 180), spots = 5 }), + F({ id = "Ray", name = "Скат", rarity = "Rare", price = 120, xp = 90, minW = 3.0, maxW = 25, size = 1.6, shape = "ray", color = Color3.fromRGB(110, 115, 140), color2 = Color3.fromRGB(230, 230, 240), spots = 14 }), + F({ id = "Barracuda", name = "Барракуда", rarity = "Rare", price = 130, xp = 95, minW = 2.0, maxW = 20, size = 1.7, shape = "long", color = Color3.fromRGB(175, 185, 200), color2 = Color3.fromRGB(60, 70, 85), stripes = 8 }), + F({ id = "Swordfish", name = "Рыба-меч", rarity = "Epic", price = 350, xp = 220, minW = 30, maxW = 200, size = 2.0, shape = "sword", color = Color3.fromRGB(55, 75, 130), color2 = Color3.fromRGB(200, 210, 230) }), + F({ id = "Moray", name = "Мурена", rarity = "Epic", price = 320, xp = 210, minW = 2.0, maxW = 15, size = 1.8, shape = "eel", color = Color3.fromRGB(80, 140, 60), color2 = Color3.fromRGB(230, 220, 90), spots = 12 }), + F({ id = "Shark", name = "Рифовая акула", rarity = "Legendary", price = 1200, xp = 700, minW = 40, maxW = 180, size = 2.4, shape = "shark", color = Color3.fromRGB(110, 125, 145), color2 = Color3.fromRGB(235, 235, 240) }), + F({ id = "SunJelly", name = "Солнечная медуза", rarity = "Mythic", price = 5000, xp = 2000, minW = 1.0, maxW = 8.0, size = 1.8, shape = "jelly", color = Color3.fromRGB(255, 200, 80), color2 = Color3.fromRGB(255, 120, 200), glow = true, glass = true }), + }, + }, + World3 = { + fish = { + F({ id = "Cod", name = "Треска", rarity = "Common", price = 55, xp = 40, minW = 1.0, maxW = 10, size = 1.2, shape = "classic", color = Color3.fromRGB(150, 150, 110), color2 = Color3.fromRGB(230, 225, 200), spots = 14, whiskers = true }), + F({ id = "Herring", name = "Сельдь", rarity = "Common", price = 50, xp = 38, minW = 0.2, maxW = 0.8, size = 0.9, shape = "long", color = Color3.fromRGB(150, 175, 205), color2 = Color3.fromRGB(70, 100, 140) }), + F({ id = "Capelin", name = "Мойва", rarity = "Common", price = 48, xp = 36, minW = 0.05, maxW = 0.2, size = 0.7, shape = "classic", color = Color3.fromRGB(170, 200, 190), color2 = Color3.fromRGB(80, 120, 110) }), + F({ id = "Flounder", name = "Камбала", rarity = "Uncommon", price = 140, xp = 90, minW = 0.5, maxW = 4.0, size = 1.2, shape = "flat", color = Color3.fromRGB(150, 125, 90), color2 = Color3.fromRGB(230, 120, 60), spots = 10 }), + F({ id = "Redfish", name = "Морской окунь", rarity = "Uncommon", price = 150, xp = 92, minW = 0.5, maxW = 5.0, size = 1.1, shape = "classic", color = Color3.fromRGB(225, 70, 60), color2 = Color3.fromRGB(255, 160, 120), spikes = true }), + F({ id = "Char", name = "Арктический голец", rarity = "Uncommon", price = 160, xp = 95, minW = 0.5, maxW = 6.0, size = 1.2, shape = "long", color = Color3.fromRGB(120, 130, 150), color2 = Color3.fromRGB(255, 130, 150), spots = 12 }), + F({ id = "Halibut", name = "Палтус", rarity = "Rare", price = 380, xp = 200, minW = 5.0, maxW = 90, size = 1.9, shape = "flat", color = Color3.fromRGB(90, 95, 80), color2 = Color3.fromRGB(150, 150, 130), spots = 16 }), + F({ id = "Wolffish", name = "Морской волк", rarity = "Rare", price = 400, xp = 210, minW = 3.0, maxW = 20, size = 1.7, shape = "long", color = Color3.fromRGB(110, 120, 140), color2 = Color3.fromRGB(60, 65, 80), stripes = 7, teeth = true }), + F({ id = "Angler", name = "Удильщик", rarity = "Epic", price = 1100, xp = 500, minW = 5.0, maxW = 50, size = 1.6, shape = "angler", color = Color3.fromRGB(60, 50, 70), color2 = Color3.fromRGB(120, 255, 230), glow = true }), + F({ id = "IceEel", name = "Ледяная мурена", rarity = "Epic", price = 1000, xp = 480, minW = 3.0, maxW = 25, size = 1.9, shape = "eel", color = Color3.fromRGB(150, 210, 245), color2 = Color3.fromRGB(240, 250, 255), glass = true }), + F({ id = "Greenland", name = "Полярная акула", rarity = "Legendary", price = 3500, xp = 1500, minW = 200, maxW = 900, size = 2.6, shape = "shark", color = Color3.fromRGB(80, 90, 100), color2 = Color3.fromRGB(160, 170, 180) }), + F({ id = "Leviathan", name = "Ледяной левиафан", rarity = "Mythic", price = 15000, xp = 4000, minW = 500, maxW = 3000, size = 2.4, shape = "eel", color = Color3.fromRGB(110, 230, 255), color2 = Color3.fromRGB(200, 120, 255), glow = true, spikes = true }), + }, + }, +} + +---------------------------------------------------------------- удочки +-- luck = бонус удачи, speed = множитель ожидания клёва (меньше = быстрее), zone = ширина зелёной зоны +Config.Rods = { + { id = "Basic", name = "Старая удочка", price = 0, level = 1, luck = 0.00, speed = 1.00, zone = 0.22, upgradeCost = 40, style = "wood" }, + { id = "Bamboo", name = "Бамбуковая удочка", price = 150, level = 3, luck = 0.15, speed = 0.88, zone = 0.25, upgradeCost = 120, style = "bamboo" }, + { id = "Fiberglass", name = "Стеклопластиковая", price = 600, level = 5, luck = 0.30, speed = 0.78, zone = 0.27, upgradeCost = 300, style = "glass" }, + { id = "Carbon", name = "Карбоновая удочка", price = 1800, level = 8, luck = 0.55, speed = 0.68, zone = 0.29, upgradeCost = 700, style = "carbon" }, + { id = "Coral", name = "Коралловая удочка", price = 4500, level = 10, luck = 0.80, speed = 0.62, zone = 0.31, upgradeCost = 1300, style = "coral" }, + { id = "Golden", name = "Золотая удочка", price = 9000, level = 13, luck = 1.00, speed = 0.56, zone = 0.33, upgradeCost = 2200, style = "gold" }, + { id = "Frost", name = "Ледяная удочка", price = 25000, level = 18, luck = 1.40, speed = 0.50, zone = 0.35, upgradeCost = 5000, style = "frost" }, + { id = "Legend", name = "Удочка Легенды", price = 75000, level = 25, luck = 2.00, speed = 0.42, zone = 0.38, upgradeCost = 12000, style = "legend" }, +} + +Config.RodUpgrade = { maxLevel = 5, luckPerLevel = 0.08, zonePerLevel = 0.012, speedPerLevel = 0.96 } +function Config.UpgradeCost(rod, currentLevel) + return math.floor(rod.upgradeCost * (currentLevel + 1) ^ 1.5) +end + +---------------------------------------------------------------- сумки +Config.Bags = { + { id = "Pouch", name = "Холщовая сумка", price = 0, level = 1, capacity = 12, color = Color3.fromRGB(170, 140, 95) }, + { id = "Satchel", name = "Сумка рыбака", price = 150, level = 2, capacity = 25, color = Color3.fromRGB(110, 140, 80) }, + { id = "Backpack", name = "Туристический рюкзак", price = 700, level = 4, capacity = 45, color = Color3.fromRGB(60, 110, 180) }, + { id = "BigNet", name = "Огромный садок", price = 2500, level = 7, capacity = 80, color = Color3.fromRGB(200, 80, 50) }, + { id = "Chest", name = "Сундук за спиной", price = 9000, level = 12, capacity = 140, color = Color3.fromRGB(140, 90, 50) }, + { id = "Magic", name = "Магический мешок", price = 30000, level = 20, capacity = 250, color = Color3.fromRGB(120, 60, 200) }, +} + +---------------------------------------------------------------- удача +Config.LuckPerPlayerLevel = 0.02 -- +2% за уровень игрока +Config.MasteryLuck = 0.10 -- +10% навсегда за полностью собранный мир +Config.Potions = { + { id = "Luck1", name = "Зелье удачи", price = 120, bonus = 0.5, duration = 300, color = Color3.fromRGB(90, 230, 120) }, + { id = "Luck2", name = "Большое зелье удачи", price = 450, bonus = 1.0, duration = 600, color = Color3.fromRGB(255, 200, 60), level = 5 }, + { id = "Luck3", name = "Эликсир фортуны", price = 2500, bonus = 2.0, duration = 600, color = Color3.fromRGB(200, 120, 255), level = 12 }, +} + +---------------------------------------------------------------- коллекция +-- награда за то, что поймал ВСЕ виды одной редкости в мире (умножается на mult мира) +Config.CollectionRewards = { + Common = { coins = 50, xp = 40 }, + Uncommon = { coins = 120, xp = 100 }, + Rare = { coins = 300, xp = 250 }, + Epic = { coins = 800, xp = 600 }, + Legendary = { coins = 2000, xp = 1500 }, + Mythic = { coins = 6000, xp = 4000 }, +} +Config.MasteryCoins = 5000 -- за весь мир (тоже умножается на mult) + +---------------------------------------------------------------- цепочки заданий +-- короткие задания идут по очереди: награда сразу, следующее появляется мгновенно. +-- после последнего шага — бонус цепочки и следующая цепочка; каждый новый круг цели растут +-- coins/xp = награда за 1 единицу цели (умножается на цель и уровень игрока); +-- max — потолок цели, byLevel — цель растёт с уровнем игрока; +-- forms — слово после числа для 1 / 2–4 / 5+ (подставляется вместо второго %s) +local FISH, TIMES = { "рыбу", "рыбы", "рыб" }, { "раз", "раза", "раз" } +Config.QuestKinds = { + catch = { text = "Поймай %d %s", forms = FISH, coins = 5, xp = 4 }, + uncommon = { text = "Поймай %d %s «Необычная» или реже", forms = FISH, coins = 18, xp = 14 }, + rare = { text = "Поймай %d %s «Редкая» или реже", forms = FISH, coins = 60, xp = 50 }, + perfect = { text = "Подсеки %d %s без промаха", forms = TIMES, coins = 10, xp = 8 }, + perfectCast = { text = "Забрось в зелёную зону %d %s", forms = TIMES, coins = 8, xp = 6 }, + combo = { text = "Набери серию из %d рыб", coins = 12, xp = 10, max = 15 }, + sell = { text = "Продай %d %s", forms = FISH, coins = 3, xp = 3 }, + earn = { text = "Заработай %d 💰 на продаже", coins = 0.25, xp = 0.2, byLevel = true }, + buy = { text = "Купи что-нибудь в магазине", coins = 40, xp = 30, max = 1 }, + boss = { text = "Нанеси боссу %d урона", coins = 15, xp = 12 }, +} +Config.QuestChains = { + { name = "🎣 Утренний клёв", steps = { { "catch", 3 }, { "perfectCast", 2 }, { "sell", 3 }, { "catch", 5 }, { "uncommon", 1 } } }, + { name = "🔥 Без промаха", steps = { { "perfect", 3 }, { "combo", 3 }, { "catch", 6 }, { "earn", 80 }, { "combo", 5 } } }, + { name = "💎 Охота за редкостью", steps = { { "uncommon", 3 }, { "perfectCast", 3 }, { "rare", 1 }, { "sell", 8 }, { "buy", 1 } } }, + { name = "🏆 Мастер озера", steps = { { "combo", 6 }, { "catch", 10 }, { "perfect", 6 }, { "rare", 2 }, { "earn", 300 } } }, +} +Config.QuestTierGrowth = 0.5 -- каждый следующий круг цепочек: цели ×(1 + 0.5 · номер круга) +Config.ChainBonus = { coins = 120, xp = 100, potion = "Luck1" } -- за всю цепочку (растёт с уровнем и кругом) + +---------------------------------------------------------------- серия улова +-- каждая рыба подряд без срыва: +10% к цене и опыту следующей, до ×2; +-- срыв, ушедшая рыба или timeout секунд без улова — серия сгорает +Config.Combo = { step = 0.1, max = 2.0, timeout = 90 } + +---------------------------------------------------------------- босс озера +-- раз в interval секунд в мир, где больше всего игроков, приплывает босс. Его ловят всем сервером: +-- каждая пойманная там рыба наносит урон = ранг редкости (+1 за подсечку без промаха). +-- Если за duration секунд урона хватило — награда всем, кто помог (× mult мира, минимум 40% за малый вклад) +Config.Boss = { + firstDelay = 240, interval = 600, duration = 180, + hpPerPlayer = 12, + reward = { coins = 300, xp = 250, potion = "Luck1" }, + worlds = { + World1 = { name = "Сом-великан", fish = "Som", mutation = "Golden", scale = 5 }, + World2 = { name = "Королевская акула", fish = "Shark", mutation = "Golden", scale = 3 }, + World3 = { name = "Ледяной левиафан", fish = "Leviathan", mutation = "Rainbow", scale = 2.5 }, + }, +} + +-- ежедневная награда (7 дней по кругу), монеты растут с уровнем +Config.DailyRewards = { + { coins = 100 }, + { coins = 200 }, + { coins = 300, potion = "Luck1" }, + { coins = 450 }, + { coins = 600, potion = "Luck1" }, + { coins = 800 }, + { coins = 1500, potion = "Luck2" }, +} + +---------------------------------------------------------------- события на сервере +Config.Events = { + { id = "Bite", name = "⚡ Клёвый час", desc = "Рыба клюёт в 2 раза быстрее", duration = 180, speed = 0.5 }, + { id = "Luck", name = "🍀 Удачный ветер", desc = "Удача +50% для всех", duration = 180, luck = 0.5 }, + { id = "Stars", name = "🌟 Звездопад", desc = "Мутации в 3 раза чаще", duration = 180, mutation = 3 }, + { id = "Fair", name = "💰 Рыбная ярмарка", desc = "Рыба продаётся на 50% дороже", duration = 180, sell = 1.5 }, +} +Config.EventFirstDelay = 120 +Config.EventGapMin = 420 +Config.EventGapMax = 720 + +---------------------------------------------------------------- время суток +-- одни сутки длятся length секунд реального времени; время общее для всего сервера +Config.DayNight = { + enabled = true, + length = 1200, -- 20 минут на сутки + startClock = 9, -- во сколько начинается день при запуске сервера + nightLuck = 0.10, -- ночью удача +10% +} + +-- время на часах в момент serverTime (workspace:GetServerTimeNow()), dayStart — атрибут workspace "DayStart" +function Config.ClockAt(serverTime, dayStart) + local d = Config.DayNight + return (d.startClock + (serverTime - (dayStart or serverTime)) / d.length * 24) % 24 +end + +-- 0 днём, 1 глубокой ночью, плавно на рассвете и закате +function Config.Nightness(clock) + if clock >= 7 and clock <= 17.5 then + return 0 + elseif clock > 17.5 and clock < 20 then + return (clock - 17.5) / 2.5 + elseif clock >= 5 and clock < 7 then + return 1 - (clock - 5) / 2 + end + return 1 +end + +function Config.IsNight(clock) + return Config.Nightness(clock) >= 0.5 +end + +---------------------------------------------------------------- погода +-- меняется на всём сервере; weight — как часто выпадает, duration — сколько длится (секунды) +-- luck / speed / mutation — бонусы к рыбалке, пока погода держится +-- names — как погода называется в отдельных мирах (во фьорде вместо дождя снег) +Config.Weathers = { + { id = "Clear", name = "Ясно", icon = "☀", weight = 40, duration = { 240, 420 } }, + { id = "Cloudy", name = "Пасмурно", icon = "☁", weight = 25, duration = { 180, 360 }, luck = 0.05, desc = "Удача +5%" }, + { id = "Rain", name = "Дождь", icon = "🌧", weight = 20, duration = { 150, 300 }, speed = 0.85, desc = "Клюёт на 15% быстрее", + names = { World3 = "Снегопад" } }, + { id = "Storm", name = "Гроза", icon = "⛈", weight = 8, duration = { 120, 240 }, luck = 0.25, speed = 0.9, desc = "Удача +25%", + names = { World3 = "Метель" } }, + { id = "Fog", name = "Туман", icon = "🌫", weight = 7, duration = { 150, 300 }, mutation = 1.5, desc = "Мутации ×1.5" }, +} + +function Config.WeatherById(id) + for _, w in ipairs(Config.Weathers) do + if w.id == id then + return w + end + end + return Config.Weathers[1] +end + +---------------------------------------------------------------- звуки +-- ID из Creator Store: эффекты — Pro Sound Effects (официальная библиотека Roblox), +-- музыка — APM и DistroKid (лицензированы для Roblox). volume — громкость, pitch — разброс высоты +local function S(id, volume, extra) + local t = extra or {} + t.id = "rbxassetid://" .. id + t.volume = volume + return t +end +Config.Sounds = { + -- музыка + musicLobby = S(137023744071437, 0.35), -- The Ancient Lutes | Medieval Tavern Music + musicLobby2 = S(116079409060113, 0.35), -- The Lute Lament | Medieval Tavern Music + musicLake = S(1838853377, 0.3), -- Harp Fantasy + musicLake2 = S(86472274853159, 0.3), -- Calm Fantasy Atmosphere + musicNight = S(140195397978848, 0.3), -- Moonlit Meadow Whisper + -- окружение (петли) + birdsLake = S(9112877174, 0.35), -- Squam Lake 1 + birdsPark = S(9113444360, 0.25), -- Birds Park 2 + birdsJungle = S(9114892930, 0.3), -- Jungle Birds Ambience 3 + crickets = S(9112764573, 0.3), -- Crickets Night 3 + lakeWater = S(9116203162, 0.25), -- Lake Lap Water Movement 2 + wind = S(9113286782, 0.18), -- Barstow Wind Light Blustery Low Howl 1 + rainLight = S(9112852668, 0.45), -- Rain Continuous Drizzle 1 + rainHeavy = S(9112853287, 0.55), -- Rain Heavy 1 + fire = S(9112780193, 0.6, { roll = 30 }), -- Fireplace Constant Burning Flame 1 (слышно у костра) + thunder = { "rbxassetid://9116282875", "rbxassetid://9116282646", "rbxassetid://9116282791", "rbxassetid://9116282544" }, + -- рыбалка + cast = S(9120718279, 0.5, { pitch = { 0.9, 1.1 } }), -- Whoosh Fast Swish By 1 + bite = S(9112751536, 0.7, { pitch = { 0.9, 1.15 } }), -- Bubble Bloop High Pitched Cute 1 + reel = S(9114454019, 0.4), -- Fishing Reel 4 (петля, пока тянешь) + catchSplash = S(9119293555, 0.6), -- Small Splash Shallow Water + catch = S(9126073001, 0.5), -- Bell Tone Ding + fanfare = S(1836473422, 0.45), -- Victory Fanfare Sting (редкая рыба) + sparkle = S(9114369623, 0.5), -- Fairy Dust 1 (мутация) + escape = S(9117944976, 0.5), -- Puddle Splash 2 (сорвалась) + -- интерфейс + click = S(15675032796, 0.5), -- Roblox_UI_Small_Click + open = S(9117231552, 0.45), -- Paper Scroll Unroll Handle 4 + coins = S(9113849306, 0.6), -- Coins Or Keys Jingle 1 + levelUp = S(1840525342, 0.5), -- Harp Glissando (A) + quest = S(9126073318, 0.5), -- Bell Tone Ding 2 +} +Config.DefaultVolume = { music = 0.6, sfx = 0.8 } + +---------------------------------------------------------------- донат (Robux) +-- ВАЖНО: впиши сюда ID своих пропусков и товаров с create.roblox.com. +-- Пока id = 0, кнопка покупки покажет подсказку, что товар не настроен. +Config.GamePasses = { + { key = "VIP", id = 0, robux = 199, icon = "👑", name = "VIP", desc = "+25% удачи и монет, корона над головой" }, + { key = "DoubleCoins", id = 0, robux = 299, icon = "💰", name = "x2 Монеты", desc = "Вся рыба продаётся в 2 раза дороже" }, + { key = "LuckyCharm", id = 0, robux = 349, icon = "🍀", name = "Талисман удачи", desc = "+50% удачи навсегда" }, + { key = "BigBag", id = 0, robux = 149, icon = "🎒", name = "Бездонная сумка", desc = "+100 мест в любой сумке" }, +} +Config.Products = { + { key = "Coins1", id = 0, robux = 49, icon = "🪙", name = "Мешок монет", desc = "+1 000 монет (больше с уровнем)", coins = 1000 }, + { key = "Coins2", id = 0, robux = 199, icon = "💰", name = "Сундук монет", desc = "+5 000 монет (больше с уровнем)", coins = 5000 }, + { key = "Coins3", id = 0, robux = 599, icon = "🏆", name = "Гора золота", desc = "+20 000 монет (больше с уровнем)", coins = 20000 }, + { key = "Luck", id = 0, robux = 99, icon = "🧪", name = "Супер-зелье удачи", desc = "+200% удачи на 15 минут", boost = 2.0, duration = 900 }, +} + +---------------------------------------------------------------- рыбалка +Config.BiteTimeMin = 3 +Config.BiteTimeMax = 7 +Config.BiteTimeout = 12 +Config.MaxMisses = 2 +-- заброс: держишь ЛКМ — сила ездит 0 → 1 → 0 → …; от силы в момент отпускания зависит дальность +Config.CastChargeTime = 1.3 -- секунд на проход шкалы в одну сторону +Config.CastMinDist, Config.CastMaxDist = 6, 28 +Config.CastReach = 7 -- закидывать можно не дальше ~2 м (7 studs) от воды +Config.CastPerfect = { 0.72, 0.86 } -- зелёная зона шкалы +Config.CastPerfectLuck = 1.2 -- множитель удачи за попадание в зелёную зону + +-- обучение: линия-подсказка ведёт по шагам 0 → 1 → 2 → 3, на 4 обучение пройдено +-- 0 — табличка «Как играть», 1 — портал в Мир 1, 2 — причал (поймать рыбу), 3 — скупка (продать) +Config.TutorialDone = 4 +function Config.HitsNeeded(rank) + return math.ceil(rank / 2) +end +function Config.XPForLevel(level) + return 60 + level * 60 +end + +---------------------------------------------------------------- помощники +function Config.Find(list, id) + for _, item in ipairs(list) do + if item.id == id or item.key == id then + return item + end + end + return nil +end + +function Config.FindFish(fishId) + for zoneId, zone in pairs(Config.Zones) do + for _, f in ipairs(zone.fish) do + if f.id == fishId then + return f, zoneId + end + end + end + return nil +end + +function Config.RodStats(rodId, upgradeLevel) + local rod = Config.Find(Config.Rods, rodId) or Config.Rods[1] + local u = Config.RodUpgrade + upgradeLevel = upgradeLevel or 0 + return { + luck = rod.luck + u.luckPerLevel * upgradeLevel, + speed = rod.speed * (u.speedPerLevel ^ upgradeLevel), + zone = rod.zone + u.zonePerLevel * upgradeLevel, + } +end + +return Config +]=====]) +put('ModuleScript', 'GameModels', game.ReplicatedStorage, [=====[-- GameModels (ModuleScript) -> ReplicatedStorage +-- Строит 3D-модели из деталей: удочки, сумки, рыбу, поплавок. +-- Используется сервером (инструмент, витрины, рыба в руках) и клиентом (иконки). + +local Config = require(script.Parent:WaitForChild("FishConfig")) + +local M = {} +local V = Vector3.new +local SP, NEON, METAL, GLASS = Enum.Material.SmoothPlastic, Enum.Material.Neon, Enum.Material.Metal, Enum.Material.Glass + +---------------------------------------------------------------- помощники + +local function newPart(parent, props, class) + local p = Instance.new(class or "Part") + if props.Shape then + p.Shape = props.Shape + end + p.Anchored = false + p.CanCollide = false + p.CanQuery = false + p.CanTouch = false + p.Massless = true + p.TopSurface = Enum.SurfaceType.Smooth + p.BottomSurface = Enum.SurfaceType.Smooth + p.Material = SP + for k, v in pairs(props) do + if k ~= "Shape" then + p[k] = v + end + end + p.Parent = parent + return p +end + +local function cyl(parent, a, b, dia, props) + props = props or {} + props.Shape = Enum.PartType.Cylinder + props.Size = V(math.max(0.02, (b - a).Magnitude), dia, dia) + props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0) + return newPart(parent, props) +end + +local function ball(parent, pos, dia, props) + props = props or {} + props.Shape = Enum.PartType.Ball + props.Size = V(dia, dia, dia) + props.CFrame = CFrame.new(pos) + return newPart(parent, props) +end + +local function oval(parent, size, cf, props) + props = props or {} + props.Size = size + props.CFrame = cf + local p = newPart(parent, props) + local mesh = Instance.new("SpecialMesh") + mesh.MeshType = Enum.MeshType.Sphere + mesh.Parent = p + return p +end + +local function block(parent, size, cf, props) + props = props or {} + props.Size = size + props.CFrame = cf + return newPart(parent, props) +end + +local function wedge(parent, size, cf, props) + props = props or {} + props.Size = size + props.CFrame = cf + return newPart(parent, props, "WedgePart") +end + +local function finish(model, root, anchored) + for _, p in ipairs(model:GetDescendants()) do + if p:IsA("BasePart") and p ~= root then + local w = Instance.new("Weld") + w.Part0 = root + w.Part1 = p + w.C0 = root.CFrame:Inverse() * p.CFrame + w.Parent = p + p.Anchored = anchored and true or false + end + end + root.Anchored = anchored and true or false + model.PrimaryPart = root + return model +end + +local function lighten(c, t) + return c:Lerp(Color3.new(1, 1, 1), t) +end +local function darken(c, t) + return c:Lerp(Color3.new(0, 0, 0), t) +end +local function C(r, g, b) + return Color3.fromRGB(r, g, b) +end + +local function sparkles(parent, color, rate) + local att = Instance.new("Attachment") + att.Parent = parent + local pe = Instance.new("ParticleEmitter") + pe.Texture = "rbxasset://textures/particles/sparkles_main.dds" + pe.Rate = rate or 6 + pe.Lifetime = NumberRange.new(0.6, 1.0) + pe.Speed = NumberRange.new(0.5, 1) + pe.Size = NumberSequence.new(0.25, 0) + pe.LightEmission = 1 + pe.Color = ColorSequence.new(color) + pe.Parent = att + return pe +end + +---------------------------------------------------------------- удочки +-- Рука в (0,0,0), удочка смотрит в -Z и изгибается вверх (+Y). + +local STYLES = { + wood = { blank = C(125, 90, 60), mat = Enum.Material.Wood, grip = C(80, 55, 35), gripMat = Enum.Material.Fabric, wrap = C(175, 175, 175), reel = C(95, 95, 100) }, + bamboo = { blank = C(215, 190, 105), mat = Enum.Material.Wood, grip = C(120, 90, 50), gripMat = Enum.Material.Fabric, wrap = C(70, 120, 60), reel = C(85, 85, 90), nodes = C(150, 120, 60) }, + glass = { blank = C(60, 130, 215), mat = SP, grip = C(35, 35, 40), gripMat = Enum.Material.Fabric, wrap = C(240, 240, 245), reel = C(60, 60, 70) }, + carbon = { blank = C(30, 30, 35), mat = SP, grip = C(195, 155, 105), gripMat = Enum.Material.Sand, wrap = C(220, 50, 50), reel = C(45, 45, 50) }, + coral = { blank = C(255, 130, 110), blank2 = C(255, 225, 210), mat = SP, grip = C(40, 170, 170), gripMat = Enum.Material.Fabric, wrap = C(40, 200, 200), reel = C(240, 240, 235), gem = C(255, 120, 160) }, + gold = { blank = C(255, 200, 50), mat = METAL, grip = C(120, 30, 30), gripMat = Enum.Material.Fabric, wrap = C(255, 255, 255), reel = C(230, 180, 50), gem = C(255, 40, 60), sparkle = C(255, 220, 90) }, + frost = { blank = C(170, 225, 255), mat = GLASS, grip = C(230, 240, 250), gripMat = Enum.Material.Fabric, wrap = C(90, 170, 255), reel = C(200, 230, 250), gem = C(120, 240, 255), sparkle = C(170, 240, 255) }, + legend = { blank = C(60, 25, 90), blank2 = C(110, 50, 170), mat = SP, grip = C(25, 20, 35), gripMat = Enum.Material.Fabric, wrap = C(255, 200, 60), wrapNeon = true, reel = C(40, 30, 60), gem = C(255, 90, 220), sparkle = C(255, 150, 240) }, +} + +function M.buildRod(rodId, upgradeLevel, anchored) + local rod = Config.Find(Config.Rods, rodId) or Config.Rods[1] + local st = STYLES[rod.style] or STYLES.wood + upgradeLevel = upgradeLevel or 0 + local model = Instance.new("Model") + model.Name = rod.name + + local handle = newPart(model, { Name = "Handle", Size = V(0.3, 0.3, 1.8), CFrame = CFrame.new(), Transparency = 1 }) + local wrapMat = (st.wrapNeon or upgradeLevel >= 5) and NEON or METAL + local back = V(0, 0, 1) + + -- торец и камень + ball(model, V(0, 0, 1.05), 0.42, { Color = st.reel, Material = METAL }) + if st.gem then + ball(model, V(0, 0, 1.25), 0.26, { Color = st.gem, Material = NEON }) + end + -- задняя рукоять: кольца (пробка/обмотка) + for i = 0, 6 do + local z0 = 1.0 - i * 0.185 + cyl(model, V(0, 0, z0), V(0, 0, z0 - 0.185), i % 2 == 0 and 0.34 or 0.33, { + Color = i % 2 == 0 and st.grip or darken(st.grip, 0.12), Material = st.gripMat, + }) + end + -- катушкодержатель + cyl(model, V(0, 0, -0.3), V(0, 0, -0.95), 0.27, { Color = st.reel, Material = METAL }) + cyl(model, V(0, 0, -0.3), V(0, 0, -0.42), 0.32, { Color = st.wrap, Material = wrapMat }) + cyl(model, V(0, 0, -0.83), V(0, 0, -0.95), 0.32, { Color = st.wrap, Material = wrapMat }) + -- передняя рукоять + cyl(model, V(0, 0, -0.95), V(0, 0, -1.45), 0.29, { Color = st.grip, Material = st.gripMat }) + cyl(model, V(0, 0, -1.45), V(0, 0, -1.55), 0.25, { Color = st.wrap, Material = wrapMat }) + + -- катушка (безынерционная): ножка, корпус, шпуля, дужка, ручка + block(model, V(0.1, 0.42, 0.22), CFrame.new(0, -0.3, -0.62), { Color = st.reel, Material = METAL }) + oval(model, V(0.46, 0.5, 0.7), CFrame.new(0, -0.68, -0.58), { Color = st.reel, Material = METAL }) + local spoolCF = CFrame.new(0, -0.68, -1.02) * CFrame.Angles(0, math.rad(90), 0) + newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(0.34, 0.44, 0.44), CFrame = spoolCF, Color = C(235, 235, 230), Material = SP }) + newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(0.06, 0.5, 0.5), CFrame = spoolCF * CFrame.new(0.18, 0, 0), Color = st.wrap, Material = wrapMat }) + local bail = {} + for i = 0, 6 do + local a = math.rad(200 + i * 23) + table.insert(bail, V(math.cos(a) * 0.3, -0.68 + math.sin(a) * 0.3, -1.2)) + end + for i = 1, #bail - 1 do + cyl(model, bail[i], bail[i + 1], 0.04, { Color = C(200, 200, 205), Material = METAL }) + end + cyl(model, V(0.24, -0.68, -0.58), V(0.5, -0.86, -0.58), 0.07, { Color = st.reel, Material = METAL }) + ball(model, V(0.54, -0.9, -0.5), 0.19, { Color = st.grip, Material = SP }) + + -- бланк: 8 колен с плавным изгибом и шарами на стыках + local angles = { 6, 9, 12, 16, 20, 25, 30, 36 } + local lengths = { 1.2, 1.15, 1.1, 1.0, 0.95, 0.9, 0.85, 0.8 } + local p = V(0, 0, -1.55) + local lastSeg + for i = 1, #angles do + local a = math.rad(angles[i]) + local d = V(0, math.sin(a), -math.cos(a)) + local q = p + d * lengths[i] + local dia = 0.2 - (i - 1) * 0.019 + local color = (st.blank2 and i % 2 == 0) and st.blank2 or st.blank + lastSeg = cyl(model, p, q, dia, { Color = color, Material = st.mat }) + ball(model, q, dia * 0.97, { Color = color, Material = st.mat }) + if st.nodes then + cyl(model, q - d * 0.04, q + d * 0.04, dia + 0.05, { Color = st.nodes, Material = Enum.Material.Wood }) + end + -- полоски улучшений на первых коленах + if i <= 2 then + for s = 1, upgradeLevel do + if (s <= 3 and i == 1) or (s > 3 and i == 2) then + local t = 0.25 + ((s - 1) % 3) * 0.22 + local c = p:Lerp(q, t) + cyl(model, c - d * 0.035, c + d * 0.035, dia + 0.045, { Color = C(255, 215, 80), Material = NEON }) + end + end + end + -- пропускные кольца на чётных стыках + if i % 2 == 0 then + local n = V(0, d.Z, -d.Y) -- вниз, перпендикулярно бланку + local ringD = 0.24 - i * 0.017 + cyl(model, q - d * 0.06, q + d * 0.06, dia + 0.05, { Color = st.wrap, Material = wrapMat }) + cyl(model, q, q + n * 0.12, 0.035, { Color = C(200, 200, 205), Material = METAL }) + local c = q + n * (0.12 + ringD / 2) + newPart(model, { + Shape = Enum.PartType.Cylinder, Size = V(0.03, ringD, ringD), + CFrame = CFrame.lookAt(c, c + d) * CFrame.Angles(0, math.rad(90), 0), + Color = C(205, 205, 210), Material = METAL, + }) + end + p = q + end + ball(model, p, 0.09, { Color = st.wrap, Material = wrapMat }) + + local tip = Instance.new("Attachment") + tip.Name = "Tip" + tip.Position = p + tip.Parent = handle + local lineStart = Instance.new("Attachment") + lineStart.Name = "LineStart" + lineStart.Position = V(0, -0.68, -1.2) + lineStart.Parent = handle + local line = Instance.new("Beam") + line.Attachment0 = lineStart + line.Attachment1 = tip + line.Width0 = 0.025 + line.Width1 = 0.02 + line.FaceCamera = true + line.Color = ColorSequence.new(C(245, 245, 245)) + line.Parent = handle + + if upgradeLevel >= 3 or st.sparkle then + sparkles(lastSeg, st.sparkle or st.wrap, 6) + end + return finish(model, handle, anchored) +end + +---------------------------------------------------------------- сумки на спину +-- Корень "Root" у спины; +Z = от спины назад. + +local BAG_SIZES = { + Pouch = V(1.3, 1.3, 0.6), + Satchel = V(1.5, 1.5, 0.7), + Backpack = V(1.7, 2.0, 0.9), + BigNet = V(1.9, 2.2, 1.0), + Chest = V(2.0, 1.6, 1.2), + Magic = V(1.8, 2.2, 1.1), +} + +function M.buildBag(bagId, anchored) + local bag = Config.Find(Config.Bags, bagId) or Config.Bags[1] + local s = BAG_SIZES[bag.id] or BAG_SIZES.Pouch + local model = Instance.new("Model") + model.Name = "BackBag" + local root = newPart(model, { Name = "Root", Size = V(0.2, 0.2, 0.2), CFrame = CFrame.new(), Transparency = 1 }) + + if bag.id == "Chest" then + block(model, V(s.X, s.Y * 0.7, s.Z), CFrame.new(0, -s.Y * 0.15, s.Z / 2), { Color = bag.color, Material = Enum.Material.WoodPlanks }) + oval(model, V(s.X, s.Y * 0.6, s.Z), CFrame.new(0, s.Y * 0.2, s.Z / 2), { Color = darken(bag.color, 0.15), Material = Enum.Material.WoodPlanks }) + for _, x in ipairs({ -s.X * 0.35, s.X * 0.35 }) do + block(model, V(0.15, s.Y * 1.02, s.Z + 0.06), CFrame.new(x, 0, s.Z / 2), { Color = C(200, 170, 70), Material = METAL }) + end + block(model, V(0.35, 0.4, 0.1), CFrame.new(0, 0, s.Z + 0.05), { Color = C(230, 190, 70), Material = METAL }) + sparkles(root, C(255, 220, 90), 3) + return finish(model, root, anchored) + end + + oval(model, V(s.X, s.Y, s.Z * 1.1), CFrame.new(0, 0, s.Z / 2), { Color = bag.color, Material = Enum.Material.Fabric }) + block(model, V(s.X * 0.95, s.Y * 0.3, s.Z * 0.9), CFrame.new(0, s.Y * 0.33, s.Z / 2), { Color = darken(bag.color, 0.25), Material = Enum.Material.Fabric }) + block(model, V(s.X * 0.6, s.Y * 0.32, 0.16), CFrame.new(0, -s.Y * 0.15, s.Z + 0.04), { Color = darken(bag.color, 0.12), Material = Enum.Material.Fabric }) + block(model, V(0.26, 0.2, 0.06), CFrame.new(0, s.Y * 0.2, s.Z * 0.98), { Color = C(230, 190, 70), Material = METAL }) + for _, x in ipairs({ -1, 1 }) do + block(model, V(0.16, s.Y * 0.9, 0.06), CFrame.new(x * s.X * 0.3, 0, s.Z * 0.95), { Color = darken(bag.color, 0.35), Material = Enum.Material.Fabric }) + end + if bag.id == "Backpack" or bag.id == "BigNet" then + newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(s.X + 0.1, 0.55, 0.55), CFrame = CFrame.new(0, s.Y / 2 + 0.15, s.Z / 2), Color = C(70, 120, 70), Material = Enum.Material.Fabric }) + end + if bag.id == "BigNet" then + oval(model, V(0.15, 0.7, 0.5), CFrame.new(0.4, s.Y / 2 + 0.5, s.Z * 0.6) * CFrame.Angles(0, 0, math.rad(15)), { Color = C(255, 190, 50) }) + end + if bag.id == "Magic" then + newPart(model, { Shape = Enum.PartType.Cylinder, Size = V(0.05, 0.7, 0.7), CFrame = CFrame.new(0, -0.1, s.Z + 0.06) * CFrame.Angles(0, math.rad(90), 0), Color = C(255, 150, 255), Material = NEON }) + sparkles(root, C(220, 150, 255), 5) + end + return finish(model, root, anchored) +end + +---------------------------------------------------------------- рыба +-- Голова смотрит в +X, спина в +Y, бок к зрителю в +Z. + +local function seededRng(id) + local n = 0 + for i = 1, #id do + n += string.byte(id, i) * i + end + return Random.new(n) +end + +-- полуширина эллипсоида (L,H,W) в точке x,y +local function halfWidth(L, H, W, x, y) + local k = 1 - (2 * x / L) ^ 2 - (2 * y / H) ^ 2 + return k > 0 and (W / 2) * math.sqrt(k) or 0 +end + +local function addEyes(model, x, y, zHalf, size) + for _, sgn in ipairs({ -1, 1 }) do + ball(model, V(x, y, sgn * zHalf), size, { Color = C(250, 250, 250) }) + ball(model, V(x + size * 0.12, y, sgn * (zHalf + size * 0.3)), size * 0.55, { Color = C(15, 15, 20) }) + end +end + +function M.buildFish(fishId, mutationId, scale, anchored) + local fish = Config.FindFish(fishId) or Config.Zones.World1.fish[1] + local s = (scale or 1) * fish.size + local c1, c2 = fish.color, fish.color2 or darken(fish.color, 0.3) + local mat = SP + local glow = fish.glow + if mutationId == "Golden" then + c1, c2, mat = C(255, 205, 60), C(230, 150, 30), METAL + elseif mutationId == "Shiny" then + c1, c2, glow = lighten(c1, 0.35), lighten(c2, 0.35), true + elseif mutationId == "Rainbow" then + c1, c2, glow = C(255, 120, 220), C(90, 230, 255), true + end + if fish.glass and not mutationId then + mat = GLASS + end + local finMat = glow and NEON or mat + local rng = seededRng(fish.id) + local model = Instance.new("Model") + model.Name = fish.name + local shape = fish.shape or "classic" + local root + + if shape == "flat" then + -- камбала: плоская, «верх» смотрит на зрителя (+Z) + root = oval(model, V(2 * s, 1.3 * s, 0.22 * s), CFrame.new(), { Name = "Body", Color = c1, Material = mat }) + oval(model, V(2.2 * s, 1.5 * s, 0.08 * s), CFrame.new(0, 0, -0.02 * s), { Color = darken(c1, 0.2), Material = finMat }) + oval(model, V(0.45 * s, 0.6 * s, 0.06 * s), CFrame.new(-1.15 * s, 0, 0), { Color = darken(c1, 0.2), Material = finMat }) + for i = 1, fish.spots or 0 do + local x, y = rng:NextNumber(-0.7, 0.7) * s, rng:NextNumber(-0.45, 0.45) * s + oval(model, V(0.14 * s, 0.14 * s, 0.05 * s), CFrame.new(x, y, 0.1 * s), { Color = c2 }) + end + ball(model, V(0.62 * s, 0.14 * s, 0.11 * s), 0.16 * s, { Color = C(250, 250, 250) }) + ball(model, V(0.5 * s, -0.05 * s, 0.11 * s), 0.16 * s, { Color = C(250, 250, 250) }) + ball(model, V(0.62 * s, 0.14 * s, 0.17 * s), 0.08 * s, { Color = C(15, 15, 20) }) + ball(model, V(0.5 * s, -0.05 * s, 0.17 * s), 0.08 * s, { Color = C(15, 15, 20) }) + return finish(model, root, anchored) + end + + if shape == "ray" then + root = block(model, V(1.5 * s, 1.5 * s, 0.14 * s), CFrame.Angles(0, 0, math.rad(45)), { Name = "Body", Color = c1, Material = mat }) + oval(model, V(1.4 * s, 0.9 * s, 0.32 * s), CFrame.new(0.1 * s, 0, 0.02 * s), { Color = c1, Material = mat }) + cyl(model, V(-0.9 * s, 0, 0), V(-2.4 * s, 0.1 * s, 0), 0.08 * s, { Color = darken(c1, 0.2), Material = mat }) + for i = 1, fish.spots or 0 do + ball(model, V(rng:NextNumber(-0.6, 0.6) * s, rng:NextNumber(-0.6, 0.6) * s, 0.12 * s), 0.1 * s, { Color = c2 }) + end + ball(model, V(0.45 * s, 0.22 * s, 0.14 * s), 0.14 * s, { Color = C(20, 20, 25) }) + ball(model, V(0.45 * s, -0.22 * s, 0.14 * s), 0.14 * s, { Color = C(20, 20, 25) }) + return finish(model, root, anchored) + end + + if shape == "eel" then + local n, L = 10, 3.4 * s + local seg = L / n + local prev + for i = 0, n - 1 do + local x = L / 2 - i * seg + local y = math.sin(i * 0.8) * 0.22 * s + local d = (0.5 - i * 0.035) * s + local part = oval(model, V(seg * 1.7, d, d * 0.85), CFrame.new(x, y, 0), { Color = c1, Material = mat, Name = i == 0 and "Body" or "Seg" }) + if i == 0 then + root = part + end + if i > 0 then + oval(model, V(seg * 1.4, d * 0.5, d * 0.2), CFrame.new(x, y + d * 0.45, 0), { Color = c2, Material = finMat }) + if fish.spikes and i % 2 == 0 then + block(model, V(0.06 * s, d * 0.6, 0.06 * s), CFrame.new(x, y + d * 0.75, 0), { Color = c2, Material = NEON }) + end + end + if fish.spots and i > 0 and i % 2 == 1 then + ball(model, V(x, y + d * 0.1, d * 0.4), d * 0.25, { Color = c2 }) + end + prev = part + end + addEyes(model, L / 2 + seg * 0.3, 0.12 * s, 0.17 * s, 0.13 * s) + oval(model, V(0.1 * s, 0.08 * s, 0.3 * s), CFrame.new(L / 2 + seg * 0.75, -0.08 * s, 0), { Color = C(30, 20, 20) }) + return finish(model, root, anchored) + end + + if shape == "jelly" then + root = oval(model, V(1.6 * s, 1.1 * s, 1.6 * s), CFrame.new(0, 0.35 * s, 0), { Name = "Body", Color = c1, Material = GLASS, Transparency = 0.2 }) + oval(model, V(0.8 * s, 0.5 * s, 0.8 * s), CFrame.new(0, 0.3 * s, 0), { Color = c2, Material = NEON }) + oval(model, V(1.75 * s, 0.14 * s, 1.75 * s), CFrame.new(0, -0.15 * s, 0), { Color = c2, Material = finMat }) + for i = 0, 7 do + local a = i / 8 * math.pi * 2 + local base = V(math.cos(a) * 0.6 * s, -0.15 * s, math.sin(a) * 0.6 * s) + local p1 = base + V(math.sin(i) * 0.15 * s, -0.7 * s, 0) + local p2 = p1 + V(-math.sin(i) * 0.2 * s, -0.7 * s, math.cos(i) * 0.1 * s) + cyl(model, base, p1, 0.07 * s, { Color = c2, Material = NEON }) + cyl(model, p1, p2, 0.05 * s, { Color = c1, Material = NEON }) + end + return finish(model, root, anchored) + end + + -- тело-эллипсоид для остальных форм + local L, H, W = 2 * s, 0.9 * s, 0.45 * s + if shape == "long" or shape == "sturgeon" then + L, H, W = 2.6 * s, 0.6 * s, 0.5 * s + elseif shape == "tall" then + L, H, W = 1.7 * s, 1.25 * s, 0.38 * s + elseif shape == "shark" then + L, H, W = 3 * s, 0.75 * s, 0.7 * s + elseif shape == "sword" then + L, H, W = 2.4 * s, 0.75 * s, 0.5 * s + elseif shape == "puffer" then + L, H, W = 1.4 * s, 1.3 * s, 1.3 * s + elseif shape == "angler" then + L, H, W = 1.6 * s, 1.3 * s, 1.1 * s + end + + root = oval(model, V(L, H, W), CFrame.new(), { Name = "Body", Color = c1, Material = mat }) + if shape ~= "puffer" and shape ~= "angler" then + oval(model, V(L * 0.82, H * 0.55, W * 1.03), CFrame.new(L * 0.03, -H * 0.2, 0), { Color = lighten(c1, 0.45), Material = mat }) + end + + -- хвост + if shape == "shark" then + oval(model, V(L * 0.25, H * 1.0, W * 0.12), CFrame.new(-L * 0.56, H * 0.32, 0) * CFrame.Angles(0, 0, math.rad(-35)), { Color = c1, Material = mat }) + oval(model, V(L * 0.17, H * 0.6, W * 0.12), CFrame.new(-L * 0.54, -H * 0.22, 0) * CFrame.Angles(0, 0, math.rad(35)), { Color = c1, Material = mat }) + else + local th = fish.bigTail and 0.95 or 0.62 + oval(model, V(L * 0.22, H * 0.36, W * 0.5), CFrame.new(-L * 0.44, 0, 0), { Color = c1, Material = mat }) + for _, sgn in ipairs({ 1, -1 }) do + oval(model, V(L * 0.28, H * th, W * 0.14), CFrame.new(-L * 0.58, sgn * H * 0.22, 0) * CFrame.Angles(0, 0, math.rad(-sgn * 32)), { Color = c2, Material = finMat }) + end + end + + -- спинной плавник + if shape == "shark" then + wedge(model, V(W * 0.14, H * 0.95, L * 0.2), CFrame.new(-L * 0.02, H * 0.78, 0) * CFrame.Angles(0, math.rad(-90), 0), { Color = c1, Material = mat }) + elseif shape == "sword" then + oval(model, V(L * 0.5, H * 1.2, W * 0.1), CFrame.new(L * 0.05, H * 0.65, 0), { Color = c2, Material = finMat }) + elseif shape ~= "puffer" then + local big = fish.bigFins and 1.8 or 1 + oval(model, V(L * 0.42, H * 0.45 * big, W * 0.12), CFrame.new(-L * 0.06, H * 0.4 * (fish.bigFins and 1.3 or 1), 0), { Color = c2, Material = finMat }) + oval(model, V(L * 0.22, H * 0.3 * big, W * 0.1), CFrame.new(-L * 0.2, -H * 0.42 * (fish.bigFins and 1.3 or 1), 0), { Color = c2, Material = finMat }) + end + if fish.spikes and shape ~= "puffer" then + for i = 0, 4 do + local x = -L * 0.2 + i * L * 0.08 + block(model, V(0.05 * s, H * 0.3, 0.05 * s), CFrame.new(x, H * 0.55, 0) * CFrame.Angles(0, 0, math.rad(-15)), { Color = darken(c2, 0.3) }) + end + end + -- грудные плавники + for _, sgn in ipairs({ -1, 1 }) do + oval(model, V(L * 0.2, H * 0.14, W * 0.06), CFrame.new(L * 0.12, -H * 0.15, sgn * W * 0.48) * CFrame.Angles(0, math.rad(sgn * 25), math.rad(-20)), { Color = c2, Material = finMat }) + end + + -- узоры + if fish.stripes then + for i = 1, fish.stripes do + local x = -L * 0.3 + (i - 0.5) * (L * 0.6 / fish.stripes) + local hh = (H / 2) * math.sqrt(math.max(0, 1 - (2 * x / L) ^ 2)) + local hw = (W / 2) * math.sqrt(math.max(0, 1 - (2 * x / L) ^ 2)) + oval(model, V(L * 0.06, hh * 2.04, hw * 2.08), CFrame.new(x, 0, 0), { Color = c2, Material = mat }) + end + end + if fish.spots then + for i = 1, fish.spots do + local x = rng:NextNumber(-0.35, 0.3) * L + local y = rng:NextNumber(-0.1, 0.35) * H + local z = halfWidth(L, H, W, x, y) + if z > 0 then + local sgn = (i % 2 == 0) and 1 or -1 + ball(model, V(x, y, sgn * z * 0.96), 0.13 * s, { Color = c2 }) + end + end + end + + -- глаза и рот + local ex, ey = L * 0.32, H * 0.12 + local ez = halfWidth(L, H, W, ex, ey) + local eyeSize = (shape == "puffer") and H * 0.3 or ((shape == "angler") and H * 0.14 or math.max(0.12 * s, H * 0.22)) + addEyes(model, ex, ey, ez * 0.92, eyeSize) + if shape == "angler" then + oval(model, V(L * 0.12, H * 0.5, W * 0.85), CFrame.new(L * 0.46, -H * 0.12, 0), { Color = C(25, 15, 20) }) + for i = -2, 2 do + wedge(model, V(0.05 * s, 0.16 * s, 0.06 * s), CFrame.new(L * 0.5, H * 0.08, i * W * 0.12) * CFrame.Angles(math.rad(180), 0, 0), { Color = C(250, 250, 240) }) + end + local a, b, c = V(L * 0.3, H * 0.48, 0), V(L * 0.55, H * 0.95, 0), V(L * 0.78, H * 0.85, 0) + cyl(model, a, b, 0.05 * s, { Color = c1 }) + cyl(model, b, c, 0.045 * s, { Color = c1 }) + local lure = ball(model, c, 0.26 * s, { Color = c2, Material = NEON }) + local light = Instance.new("PointLight") + light.Color = c2 + light.Range = 8 + light.Brightness = 2 + light.Parent = lure + else + oval(model, V(L * 0.05, H * 0.12, W * 0.35), CFrame.new(L * 0.49, -H * 0.08, 0), { Color = C(40, 25, 25) }) + end + if fish.teeth then + for i = -1, 1 do + wedge(model, V(0.05 * s, 0.12 * s, 0.05 * s), CFrame.new(L * 0.5, -H * 0.02, i * W * 0.12) * CFrame.Angles(math.rad(180), 0, 0), { Color = C(250, 250, 240) }) + end + end + if fish.whiskers then + for _, sgn in ipairs({ -1, 1 }) do + cyl(model, V(L * 0.46, -H * 0.12, sgn * W * 0.15), V(L * 0.62, -H * 0.42, sgn * W * 0.45), 0.04 * s, { Color = c2 }) + end + end + if shape == "sword" then + cyl(model, V(L * 0.45, 0, 0), V(L * 0.45 + L * 0.7, H * 0.03, 0), H * 0.08, { Color = c2, Material = mat }) + elseif shape == "sturgeon" then + oval(model, V(L * 0.22, H * 0.45, W * 0.45), CFrame.new(L * 0.52, -H * 0.08, 0), { Color = c1, Material = mat }) + for i = 0, 6 do + block(model, V(0.16 * s, 0.16 * s, 0.1 * s), CFrame.new(L * 0.3 - i * L * 0.11, H * 0.47, 0) * CFrame.Angles(0, 0, math.rad(45)), { Color = c2, Material = finMat }) + end + for _, sgn in ipairs({ -1, 1 }) do + cyl(model, V(L * 0.55, -H * 0.25, sgn * W * 0.1), V(L * 0.6, -H * 0.55, sgn * W * 0.15), 0.035 * s, { Color = c2 }) + end + elseif shape == "puffer" then + for i = 1, 30 do + local y = 1 - (i - 0.5) / 30 * 2 + local r = math.sqrt(1 - y * y) + local th = i * 2.4 + local dir = V(math.cos(th) * r, y, math.sin(th) * r) + local base = V(dir.X * L / 2, dir.Y * H / 2, dir.Z * W / 2) + cyl(model, base, base + dir * 0.28 * s, 0.05 * s, { Color = darken(c2, 0.1) }) + end + end + if glow then + sparkles(root, c2, 4) + end + return finish(model, root, anchored) +end + +---------------------------------------------------------------- поплавок + +function M.buildBobber() + local model = Instance.new("Model") + model.Name = "Bobber" + local root = newPart(model, { Name = "Root", Shape = Enum.PartType.Ball, Size = V(0.7, 0.7, 0.7), CFrame = CFrame.new(), Color = C(255, 255, 255) }) + newPart(model, { Shape = Enum.PartType.Ball, Size = V(0.72, 0.72, 0.72), CFrame = CFrame.new(0, 0.2, 0), Color = C(230, 40, 40) }) + newPart(model, { Size = V(0.07, 0.6, 0.07), CFrame = CFrame.new(0, 0.75, 0), Color = C(230, 40, 40) }) + finish(model, root, false) + root.Anchored = true + return model +end + +return M +]=====]) +put('Script', 'GameServer', game.ServerScriptService, [=====[-- GameServer (Script) -> ServerScriptService +-- Логика игры: данные, удача, рыбалка с анимацией, сумка, магазин, улучшения, +-- коллекция с наградами, задания, ежедневная награда, события, миры, донат. + +local Players = game:GetService("Players") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local DataStoreService = game:GetService("DataStoreService") +local ProximityPromptService = game:GetService("ProximityPromptService") +local TweenService = game:GetService("TweenService") +local RunService = game:GetService("RunService") +local MarketplaceService = game:GetService("MarketplaceService") +local Debris = game:GetService("Debris") + +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) +local Models = require(ReplicatedStorage:WaitForChild("GameModels")) + +local remote = ReplicatedStorage:FindFirstChild("GameEvent") or Instance.new("RemoteEvent") +remote.Name = "GameEvent" +remote.Parent = ReplicatedStorage + +local rng = Random.new() +local GOLD = Color3.fromRGB(255, 220, 80) +local RED = Color3.fromRGB(255, 120, 120) +local GREEN = Color3.fromRGB(120, 255, 140) +local SPLASH_SOUND = "rbxasset://sounds/impact_water.mp3" + +---------------------------------------------------------------- данные + +local store = nil +pcall(function() + store = DataStoreService:GetDataStore("FishingGame_v2") +end) + +local profiles = {} +local loadedOk = {} +local passes = {} + +local function defaultData() + return { + coins = 0, level = 1, xp = 0, + rod = "Basic", rods = { Basic = true }, rodLevels = {}, + bag = "Pouch", bags = { Pouch = true }, + items = {}, discovered = {}, claimed = {}, + chain = { index = 1, step = 1, progress = 0, tier = 0 }, daily = { last = 0, streak = 0 }, + boostUntil = 0, boostBonus = 0, + totalCaught = 0, nextUid = 1, receipts = {}, + settings = { music = Config.DefaultVolume.music, sfx = Config.DefaultVolume.sfx }, + } +end + +local function loadData(player) + local data = defaultData() + if not store then + return data, false + end + local ok, saved = pcall(function() + return store:GetAsync("player_" .. player.UserId) + end) + if not ok then + warn("Не удалось загрузить данные " .. player.Name .. ": " .. tostring(saved)) + return data, false + end + if type(saved) == "table" then + for k, v in pairs(saved) do + data[k] = v + end + end + return data, true +end + +local function saveData(player) + local data = profiles[player] + if not store or not data or not loadedOk[player] then + return + end + local ok, err = pcall(function() + store:SetAsync("player_" .. player.UserId, data) + end) + if not ok then + warn("Не удалось сохранить данные " .. player.Name .. ": " .. tostring(err)) + end +end + +---------------------------------------------------------------- пропуска и события + +local function hasPass(player, key) + return passes[player] ~= nil and passes[player][key] == true +end + +local function loadPasses(player) + passes[player] = {} + for _, gp in ipairs(Config.GamePasses) do + if gp.id and gp.id > 0 then + local ok, owns = pcall(function() + return MarketplaceService:UserOwnsGamePassAsync(player.UserId, gp.id) + end) + if ok and owns then + passes[player][gp.key] = true + end + end + end +end + +local currentEvent = nil +local function ev(field, default) + return (currentEvent and currentEvent[field]) or default +end + +-- погода и время суток (их ведёт WeatherServer через атрибуты workspace) +local function weather() + return Config.WeatherById(workspace:GetAttribute("Weather")) +end +local function isNight() + if not Config.DayNight.enabled then + return false + end + return Config.IsNight(Config.ClockAt(workspace:GetServerTimeNow(), workspace:GetAttribute("DayStart"))) +end + +---------------------------------------------------------------- расчёты + +local function rodLevel(data, rodId) + return data.rodLevels[rodId or data.rod] or 0 +end + +local function boostActive(data) + return data.boostUntil > os.time() and data.boostBonus or 0 +end + +local function masteryCount(data) + local n = 0 + for key in pairs(data.claimed) do + if string.find(key, ":Master", 1, true) then + n += 1 + end + end + return n +end + +local function totalLuck(player, data) + local stats = Config.RodStats(data.rod, rodLevel(data)) + local l = 1 + stats.luck + (data.level - 1) * Config.LuckPerPlayerLevel + boostActive(data) + masteryCount(data) * Config.MasteryLuck + if hasPass(player, "VIP") then + l += 0.25 + end + if hasPass(player, "LuckyCharm") then + l += 0.5 + end + return l + ev("luck", 0) + (weather().luck or 0) + (isNight() and Config.DayNight.nightLuck or 0) +end + +local function bagCapacity(player, data) + local bag = Config.Find(Config.Bags, data.bag) or Config.Bags[1] + return bag.capacity + (hasPass(player, "BigBag") and 100 or 0) +end + +local function sellMult(player) + local m = ev("sell", 1) + if hasPass(player, "VIP") then + m *= 1.25 + end + if hasPass(player, "DoubleCoins") then + m *= 2 + end + return m +end + +local function notify(player, text, color) + remote:FireClient(player, "Notify", text, color or Color3.new(1, 1, 1)) +end + +local function today() + return math.floor(os.time() / 86400) +end + +local function sendInventory(player) + local data = profiles[player] + if data then + remote:FireClient(player, "Inventory", data.items, data.discovered, data.claimed) + end +end + +---------------------------------------------------------------- цепочки заданий + +local function levelMult(data) + return 1 + (data.level - 1) * 0.25 +end + +local function currentChain(data) + local c = data.chain + local chain = Config.QuestChains[(c.index - 1) % #Config.QuestChains + 1] + return chain, chain.steps[c.step] +end + +local function stepGoal(data, step) + local kind = Config.QuestKinds[step[1]] + local g = step[2] * (1 + Config.QuestTierGrowth * data.chain.tier) + if kind.byLevel then + g *= levelMult(data) + end + g = math.ceil(g) + return kind.max and math.min(g, kind.max) or g +end + +local function stepReward(data, step, goal) + local kind = Config.QuestKinds[step[1]] + local m = levelMult(data) + return math.max(10, math.floor(kind.coins * goal * m)), math.max(10, math.floor(kind.xp * goal * m)) +end + +local function chainBonus(data) + local b = Config.ChainBonus + local m = levelMult(data) * (1 + Config.QuestTierGrowth * data.chain.tier) + return math.floor(b.coins * m), math.floor(b.xp * m), b.potion and Config.Find(Config.Potions, b.potion) +end + +local function sendQuests(player) + local data = profiles[player] + if not data then + return + end + local chain = currentChain(data) + local steps = {} + for i, st in ipairs(chain.steps) do + local goal = stepGoal(data, st) + local coins, xp = stepReward(data, st, goal) + steps[i] = { kind = st[1], goal = goal, coins = coins, xp = xp } + end + local bCoins, bXp, potion = chainBonus(data) + local t = today() + remote:FireClient(player, "Quests", { + name = chain.name, round = data.chain.tier + 1, step = data.chain.step, progress = data.chain.progress, + steps = steps, bonus = { coins = bCoins, xp = bXp, potion = potion and potion.name }, + }, { + available = data.daily.last < t, + streak = data.daily.streak, + nextStreak = (data.daily.last == t - 1) and (data.daily.streak % 7 + 1) or ((data.daily.last < t) and 1 or data.daily.streak), + }) +end + +local function updateStats(player) + local data = profiles[player] + if not data then + return + end + local bagValue = 0 + for _, item in ipairs(data.items) do + bagValue += item.value + end + local owned, lv, bags, ps = {}, {}, {}, {} + for id in pairs(data.rods) do + table.insert(owned, id) + table.insert(lv, id .. ":" .. rodLevel(data, id)) + end + for id in pairs(data.bags) do + table.insert(bags, id) + end + for key in pairs(passes[player] or {}) do + table.insert(ps, key) + end + + player:SetAttribute("Coins", data.coins) + player:SetAttribute("Level", data.level) + player:SetAttribute("XP", data.xp) + player:SetAttribute("XPNeed", Config.XPForLevel(data.level)) + player:SetAttribute("Rod", data.rod) + player:SetAttribute("RodLevel", rodLevel(data)) + player:SetAttribute("RodLevels", table.concat(lv, ",")) + player:SetAttribute("OwnedRods", table.concat(owned, ",")) + player:SetAttribute("Bag", data.bag) + player:SetAttribute("OwnedBags", table.concat(bags, ",")) + player:SetAttribute("BagCount", #data.items) + player:SetAttribute("BagCap", bagCapacity(player, data)) + player:SetAttribute("BagValue", math.floor(bagValue * sellMult(player))) + player:SetAttribute("Luck", math.floor(totalLuck(player, data) * 100 + 0.5)) + player:SetAttribute("BoostBonus", boostActive(data)) + player:SetAttribute("BoostLeft", math.max(0, data.boostUntil - os.time())) + player:SetAttribute("TotalCaught", data.totalCaught) + -- шаг обучения (линия-подсказка); у старых игроков без поля, уже ловивших рыбу, обучение пройдено + player:SetAttribute("Tutorial", data.tutorial or (data.totalCaught > 0 and Config.TutorialDone or 0)) + player:SetAttribute("Mastery", masteryCount(data)) + player:SetAttribute("Passes", table.concat(ps, ",")) + + local ls = player:FindFirstChild("leaderstats") + if ls then + ls["Монеты"].Value = data.coins + ls["Уровень"].Value = data.level + ls["Улов"].Value = data.totalCaught + end +end + +local function addXp(player, data, amount) + data.xp += amount + local leveled = false + while data.xp >= Config.XPForLevel(data.level) do + data.xp -= Config.XPForLevel(data.level) + data.level += 1 + leveled = true + end + if leveled then + notify(player, "⭐ Уровень " .. data.level .. "!", GOLD) + for _, w in ipairs(Config.Worlds) do + if w.level == data.level and not w.soon then + notify(player, "🌍 Открыт: " .. w.icon .. " " .. w.name, w.color) + end + end + end +end + +local function applyPotion(data, bonus, duration) + data.boostBonus = math.max(boostActive(data), bonus) + data.boostUntil = math.max(os.time(), data.boostUntil) + duration +end + +---------------------------------------------------------------- задания: прогресс цепочки + +-- у старых сохранений вместо цепочки были три случайных задания +local function ensureChain(data) + if type(data.chain) ~= "table" then + data.chain = { index = 1, step = 1, progress = 0, tier = 0 } + end + data.quests = nil +end + +-- absolute = true: amount — текущее значение (серия), а не прибавка +local function questProgress(player, kind, amount, absolute) + local data = profiles[player] + if not data then + return + end + local chain, step = currentChain(data) + if step[1] ~= kind then + return + end + local c = data.chain + c.progress = absolute and math.max(c.progress, amount) or c.progress + amount + local goal = stepGoal(data, step) + if c.progress >= goal then + -- награда сразу, следующий шаг тоже сразу + local coins, xp = stepReward(data, step, goal) + data.coins += coins + addXp(player, data, xp) + remote:FireClient(player, "QuestDone", kind, goal, coins, xp) + c.step += 1 + c.progress = 0 + if c.step > #chain.steps then + local bCoins, bXp, potion = chainBonus(data) + data.coins += bCoins + addXp(player, data, bXp) + if potion then + applyPotion(data, potion.bonus, potion.duration) + end + remote:FireClient(player, "ChainDone", chain.name, bCoins, bXp, potion and potion.name) + c.index += 1 + c.step = 1 + if (c.index - 1) % #Config.QuestChains == 0 then + c.tier += 1 + end + end + updateStats(player) + end + sendQuests(player) +end + +local function claimDaily(player) + local data = profiles[player] + if not data then + return + end + local t = today() + if data.daily.last >= t then + notify(player, "🎁 Приходи завтра", Color3.fromRGB(255, 200, 120)) + return + end + local streak = (data.daily.last == t - 1) and (data.daily.streak % 7 + 1) or 1 + local r = Config.DailyRewards[streak] + local coins = math.floor(r.coins * (1 + (data.level - 1) * 0.2)) + data.coins += coins + local extra = "" + if r.potion then + local p = Config.Find(Config.Potions, r.potion) + if p then + applyPotion(data, p.bonus, p.duration) + extra = " + " .. p.name + end + end + data.daily = { last = t, streak = streak } + updateStats(player) + sendQuests(player) + notify(player, ("🎁 День %d: +%d 💰%s"):format(streak, coins, extra), GOLD) +end + +---------------------------------------------------------------- коллекция + +local function claimCollection(player, worldId, rarity) + local data = profiles[player] + local world = data and Config.Find(Config.Worlds, worldId) + local zone = world and Config.Zones[worldId] + if not zone or type(rarity) ~= "string" then + return + end + local key = worldId .. ":" .. rarity + if data.claimed[key] then + return + end + for _, f in ipairs(zone.fish) do + if (rarity == "Master" or f.rarity == rarity) and not data.discovered[f.id] then + notify(player, "Сначала поймай всех", RED) + return + end + end + data.claimed[key] = true + if rarity == "Master" then + local coins = Config.MasteryCoins * world.mult + data.coins += coins + notify(player, ("🏆 «%s» собран! +%d 💰"):format(world.name, coins), GOLD) + else + local r = Config.CollectionRewards[rarity] + if not r then + return + end + data.coins += r.coins * world.mult + addXp(player, data, r.xp * world.mult) + notify(player, ("📖 +%d 💰 +%d XP"):format(r.coins * world.mult, r.xp * world.mult), GREEN) + end + updateStats(player) + sendInventory(player) +end + +---------------------------------------------------------------- удочка, сумка, VIP на персонаже + +local REST_ANGLE = 30 +local function gripCF(angle) + return (CFrame.Angles(math.rad(angle), 0, 0) * CFrame.new(0, 0, -0.3)):Inverse() +end +local function tweenGrip(tool, angle, t) + if not tool or not tool.Parent then + return nil + end + local tw = TweenService:Create(tool, TweenInfo.new(t, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), { Grip = gripCF(angle) }) + tw:Play() + return tw +end +local function gripSequence(tool, steps) + task.spawn(function() + for _, s in ipairs(steps) do + local tw = tweenGrip(tool, s[1], s[2]) + if not tw then + return + end + tw.Completed:Wait() + end + end) +end + +local function findRodTool(player) + for _, container in ipairs({ player.Character, player:FindFirstChild("Backpack") }) do + if container then + for _, child in ipairs(container:GetChildren()) do + if child:IsA("Tool") and child:GetAttribute("IsRod") then + return child + end + end + end + end + return nil +end + +local function giveRodTool(player) + local data = profiles[player] + local backpack = player:FindFirstChild("Backpack") + if not data or not backpack then + return + end + local old = findRodTool(player) + local wasEquipped = old ~= nil and old.Parent == player.Character + if old then + old:Destroy() + end + local rod = Config.Find(Config.Rods, data.rod) or Config.Rods[1] + local lvl = rodLevel(data) + local model = Models.buildRod(rod.id, lvl, false) + local tool = Instance.new("Tool") + tool.Name = rod.name .. (lvl > 0 and (" +" .. lvl) or "") + tool.ToolTip = "Кликни у воды, чтобы закинуть" + tool.CanBeDropped = false + tool.Grip = gripCF(REST_ANGLE) + tool:SetAttribute("IsRod", true) + for _, child in ipairs(model:GetChildren()) do + child.Parent = tool + end + model:Destroy() + tool.Parent = backpack + if wasEquipped then + local hum = player.Character and player.Character:FindFirstChildOfClass("Humanoid") + if hum then + hum:EquipTool(tool) + end + end +end + +local function attachBag(player) + local data = profiles[player] + local char = player.Character + if not data or not char then + return + end + local old = char:FindFirstChild("BackBag") + if old then + old:Destroy() + end + local torso = char:FindFirstChild("UpperTorso") or char:FindFirstChild("Torso") + if not torso then + return + end + local bag = Models.buildBag(data.bag, false) + local offset = CFrame.new(0, 0.1, torso.Size.Z / 2) + bag:PivotTo(torso.CFrame * offset) + local w = Instance.new("Weld") + w.Part0 = torso + w.Part1 = bag.PrimaryPart + w.C0 = offset + w.Parent = bag.PrimaryPart + bag.Parent = char +end + +local function vipTag(player) + local head = player.Character and player.Character:FindFirstChild("Head") + if not head or not hasPass(player, "VIP") or head:FindFirstChild("VipTag") then + return + end + local bb = Instance.new("BillboardGui") + bb.Name = "VipTag" + bb.Size = UDim2.fromOffset(120, 30) + bb.StudsOffset = Vector3.new(0, 2.6, 0) + bb.MaxDistance = 80 + bb.Parent = head + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = Color3.fromRGB(255, 210, 60) + t.TextStrokeTransparency = 0.2 + t.Text = "👑 VIP" + t.Parent = bb +end + +---------------------------------------------------------------- эффекты + +local function playSound(parent, id, volume) + local snd = Instance.new("Sound") + snd.SoundId = id + snd.Volume = volume or 0.6 + snd.Parent = parent + snd:Play() + Debris:AddItem(snd, 3) +end + +local function splash(part, count) + local att = Instance.new("Attachment") + att.Parent = part + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(Color3.fromRGB(220, 240, 255)) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Size = NumberSequence.new(0.4, 0.1) + pe.Lifetime = NumberRange.new(0.4, 0.7) + pe.Speed = NumberRange.new(6, 10) + pe.SpreadAngle = Vector2.new(40, 40) + pe.Acceleration = Vector3.new(0, -35, 0) + pe.Enabled = false + pe.Parent = att + pe:Emit(count or 20) + Debris:AddItem(att, 2) +end + +-- рыба вылетает из воды, летит к игроку и показывается над головой +-- шлейф за летящим предметом — эффект быстрого движения (ширина — расстояние между точками крепления) +local TRAIL_COLOR = Color3.fromRGB(215, 245, 255) +local function addTrail(part, width) + local a0 = Instance.new("Attachment") + a0.Position = Vector3.new(0, width / 2, 0) + a0.Parent = part + local a1 = Instance.new("Attachment") + a1.Position = Vector3.new(0, -width / 2, 0) + a1.Parent = part + local trail = Instance.new("Trail") + trail.Attachment0, trail.Attachment1 = a0, a1 + trail.FaceCamera = true + trail.Lifetime = 0.35 + trail.MinLength = 0.05 + trail.LightEmission = 0.7 + trail.Color = ColorSequence.new(TRAIL_COLOR) + trail.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.1), NumberSequenceKeypoint.new(1, 1) }) + trail.WidthScale = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(1, 0) }) + trail.Parent = part + return trail +end + +local function showFishFlight(player, fish, fromPos) + local head = player.Character and player.Character:FindFirstChild("Head") + if not head then + return + end + local model = Models.buildFish(fish.id, fish.mutation, 0.9, true) + model:PivotTo(CFrame.new(fromPos)) + model.Parent = workspace + -- шлейф на отдельной невидимой детали: рыба крутится, а шлейф должен оставаться ровным + local carrier = Instance.new("Part") + carrier.Anchored, carrier.CanCollide, carrier.CanQuery, carrier.CanTouch = true, false, false, false + carrier.Transparency = 1 + carrier.Size = Vector3.new(0.2, 0.2, 0.2) + carrier.CFrame = CFrame.new(fromPos) + carrier.Parent = model + local trail = addTrail(carrier, 1.8) + task.spawn(function() + local t0, dur = os.clock(), 0.55 + while head.Parent do + local a = math.min(1, (os.clock() - t0) / dur) + local target = head.Position + Vector3.new(0, 2.8, 0) + local p = fromPos:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * 8, 0) + model:PivotTo(CFrame.new(p) * CFrame.Angles(0, 0, a * math.pi * 2)) + carrier.CFrame = CFrame.new(p) + if a >= 1 then + break + end + RunService.Heartbeat:Wait() + end + trail.Enabled = false + local t1 = os.clock() + while head.Parent and os.clock() - t1 < 1.8 do + model:PivotTo(CFrame.new(head.Position + Vector3.new(0, 2.8, 0)) * CFrame.Angles(0, os.clock() * 3, math.rad(-15))) + RunService.Heartbeat:Wait() + end + model:Destroy() + end) +end + +---------------------------------------------------------------- рыбалка + +local fishing = {} + +-- серия улова (на время игры, не сохраняется) +local combo, comboUntil = {}, {} +local function setCombo(player, n) + combo[player] = n + comboUntil[player] = n > 0 and os.time() + Config.Combo.timeout or nil + player:SetAttribute("Combo", n) + player:SetAttribute("ComboEnds", n > 0 and workspace:GetServerTimeNow() + Config.Combo.timeout or nil) +end +local function breakCombo(player) + if (combo[player] or 0) >= 2 then + remote:FireClient(player, "ComboLost", combo[player]) + end + setCombo(player, 0) +end + +-- босс озера: { world, def, hp, max, dmg = { [player] = урон } } +local boss = nil +local function bossHit(player, world, dmg) + if not boss or boss.hp <= 0 or not world or world.id ~= boss.world.id then + return + end + boss.hp = math.max(0, boss.hp - dmg) + boss.dmg[player] = (boss.dmg[player] or 0) + dmg + workspace:SetAttribute("BossHP", boss.hp) + remote:FireClient(player, "BossHit", dmg) + questProgress(player, "boss", dmg) +end + +-- ищем воду по карте мира из FishConfig (не зависит от террейна) в сторону центра ближайшего озера: +-- сначала на дальности, которую задала сила заброса, потом всё дальше от неё +local function findWater(hrp, world, power) + local look = Config.CastDirection(world, hrp.Position) + if not look then + look = hrp.CFrame.LookVector * Vector3.new(1, 0, 1) + look = look.Magnitude > 0.01 and look.Unit or Vector3.new(0, 0, -1) + end + local want = Config.CastMinDist + (Config.CastMaxDist - Config.CastMinDist) * power + for off = 0, 26, 2 do + for _, d in ipairs({ want - off, want + off }) do + if d >= 4 and d <= Config.CastMaxDist + 2 then + local p = hrp.Position + look * d + if Config.IsWater(world, p) then + return Vector3.new(p.X, world.waterY or 0, p.Z), d + end + end + end + end + return nil +end + +-- вытягивание пустого поплавка: быстро летит к кончику удочки со шлейфом и исчезает +local function reelBobber(bobber, tool) + local root = bobber and bobber.PrimaryPart + local tip = tool and tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip") + if not root or not tip then + if bobber then + bobber:Destroy() + end + return + end + local trail = bobber:FindFirstChildWhichIsA("Trail", true) + if trail then + trail.Enabled = true + else + addTrail(root, 1.2) + end + local from = root.Position + task.spawn(function() + local t0, dur = os.clock(), 0.3 + while bobber.Parent and tip.Parent do + local a = math.min(1, (os.clock() - t0) / dur) + bobber:PivotTo(CFrame.new(from:Lerp(tip.WorldPosition, a) + Vector3.new(0, math.sin(a * math.pi) * 2.5, 0))) + if a >= 1 then + break + end + RunService.Heartbeat:Wait() + end + bobber:Destroy() + end) +end + +local function stopFishing(player, tellClient) + local s = fishing[player] + if not s then + return + end + fishing[player] = nil + if s.tween then + s.tween:Cancel() + end + if s.bobber then + if s.stage == "casting" then + s.bobber:Destroy() -- ещё летит: его двигает flyBobber + else + reelBobber(s.bobber, s.tool) + end + end + if s.tool then + tweenGrip(s.tool, REST_ANGLE, 0.3) + end + if tellClient then + remote:FireClient(player, "Cancel") + end +end + +local function rollFish(player, data, worldId, luckMult) + local zone = Config.Zones[worldId] + if not zone then + return nil + end + local luck = totalLuck(player, data) * (luckMult or 1) + local bonus = luck - 1 + local weights, total = {}, 0 + for i, f in ipairs(zone.fish) do + local r = Config.Rarities[f.rarity] + local w = r.weight * math.max(0.2, 1 + bonus * (r.rank - 1)) + if r.rank == 1 then + w = r.weight / math.max(1, luck) + end + weights[i] = w + total += w + end + local roll = rng:NextNumber() * total + local chosen = zone.fish[1] + for i, f in ipairs(zone.fish) do + roll -= weights[i] + if roll <= 0 then + chosen = f + break + end + end + local mutation = nil + for _, m in ipairs(Config.Mutations) do + if rng:NextNumber() < m.chance * luck * ev("mutation", 1) * (weather().mutation or 1) then + mutation = m + break + end + end + local wf = rng:NextNumber() ^ 2.2 + local weight = chosen.minW + (chosen.maxW - chosen.minW) * wf + return { + id = chosen.id, + name = chosen.name, + rarity = chosen.rarity, + weight = math.floor(weight * 100) / 100, + value = math.floor(chosen.price * (0.75 + 0.9 * wf) * (mutation and mutation.mult or 1) + 0.5), + xp = chosen.xp * (mutation and 2 or 1), + mutation = mutation and mutation.id or nil, + world = worldId, + } +end + +local function flyBobber(s, tool, target, dur, arc) + local tip = tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip") + local start = tip and tip.WorldPosition or (target + Vector3.new(0, 6, 0)) + local bobber = Models.buildBobber() + bobber:PivotTo(CFrame.new(start)) + bobber.Parent = workspace + s.bobber = bobber + local trail = addTrail(bobber.PrimaryPart, 1.2) + if tip then + local a1 = Instance.new("Attachment") + a1.Position = Vector3.new(0, 0.9, 0) + a1.Parent = bobber.PrimaryPart + local line = Instance.new("Beam") + line.Attachment0 = tip + line.Attachment1 = a1 + line.Width0 = 0.035 + line.Width1 = 0.035 + line.FaceCamera = true + line.Color = ColorSequence.new(Color3.fromRGB(245, 245, 245)) + line.Parent = bobber + end + local t0 = os.clock() + while bobber.Parent do + local a = math.min(1, (os.clock() - t0) / dur) + bobber:PivotTo(CFrame.new(start:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * arc, 0))) + if a >= 1 then + break + end + RunService.Heartbeat:Wait() + end + trail.Enabled = false -- на воде поплавок качается, шлейф уже не нужен + if bobber.Parent then + splash(bobber.PrimaryPart, 18) + playSound(bobber.PrimaryPart, SPLASH_SOUND, 0.5) + end +end + +local function onCast(player, power) + power = math.clamp(tonumber(power) or 0.6, 0, 1) + local data = profiles[player] + if not data then + return + end + if fishing[player] then + stopFishing(player, true) + return + end + local char = player.Character + local hrp = char and char:FindFirstChild("HumanoidRootPart") + local tool = char and char:FindFirstChildOfClass("Tool") + if not hrp or not tool or not tool:GetAttribute("IsRod") then + remote:FireClient(player, "CastFail") + return + end + local world = Config.WorldAt(hrp.Position) + local can = Config.CanCastFrom(world, hrp.Position) + if can ~= true then + remote:FireClient(player, "CastFail") + notify(player, can, Color3.fromRGB(255, 200, 120)) + return + end + local target, dist = findWater(hrp, world, power) + if not target then + remote:FireClient(player, "CastFail") + notify(player, "🌊 Подойди к воде", Color3.fromRGB(255, 200, 120)) + return + end + if #data.items >= bagCapacity(player, data) then + remote:FireClient(player, "CastFail") + notify(player, "🎒 Сумка полна!", RED) + return + end + + local stats = Config.RodStats(data.rod, rodLevel(data)) + local perfect = power >= Config.CastPerfect[1] and power <= Config.CastPerfect[2] + local fish = rollFish(player, data, world.id, perfect and Config.CastPerfectLuck or 1) + if not fish then + remote:FireClient(player, "CastFail") + return + end + local s = { stage = "casting", fish = fish, tool = tool, perfect = perfect } + fishing[player] = s + -- замах игрок уже сделал, пока держал кнопку (у себя на клиенте); здесь только бросок вперёд + local throw = { windup = 0.15, flight = 0.35 + dist * 0.018, arc = 2 + dist * 0.3, perfect = perfect } + local splashAt = target + Vector3.new(0, 0.15, 0) + remote:FireClient(player, "Cast", splashAt, throw) -- клиенту для камеры + + task.spawn(function() + local tw = tweenGrip(tool, 8, throw.windup) + if tw then + tw.Completed:Wait() + end + if fishing[player] ~= s then + return + end + flyBobber(s, tool, splashAt, throw.flight, throw.arc) + tweenGrip(tool, REST_ANGLE - 5, 0.4) + if fishing[player] ~= s then + if s.bobber then + s.bobber:Destroy() + end + return + end + s.stage = "waiting" + + local waitTime = rng:NextNumber(Config.BiteTimeMin, Config.BiteTimeMax) * stats.speed * ev("speed", 1) * (weather().speed or 1) + task.wait(waitTime) + if fishing[player] ~= s then + return + end + s.stage = "bite" + s.biteAt = os.clock() + if s.bobber and s.bobber.PrimaryPart then + local root = s.bobber.PrimaryPart + splash(root, 25) + playSound(root, SPLASH_SOUND, 0.35) + s.tween = TweenService:Create(root, TweenInfo.new(0.18, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, -1, true), { + CFrame = root.CFrame - Vector3.new(0, 0.55, 0), + }) + s.tween:Play() + end + -- удочка дёргается, пока идёт вываживание + task.spawn(function() + local up = true + while fishing[player] == s and s.stage == "bite" do + tweenGrip(tool, up and 38 or 18, 0.12) + up = not up + task.wait(0.13) + end + end) + local rank = Config.Rarities[fish.rarity].rank + remote:FireClient(player, "Bite", { + speed = 0.55 + 0.22 * (rank - 1), + zoneWidth = math.max(0.07, stats.zone - 0.02 * (rank - 1)), + hits = Config.HitsNeeded(rank), + misses = Config.MaxMisses, + timeout = Config.BiteTimeout, + }) + task.wait(Config.BiteTimeout + 0.5) + if fishing[player] == s and s.stage == "bite" then + stopFishing(player, false) + remote:FireClient(player, "Escaped") + notify(player, "🐟 Рыба ушла", RED) + breakCombo(player) + end + end) +end + +local function onCatch(player, success, misses) + local s = fishing[player] + local data = profiles[player] + if not s or not data or s.stage ~= "bite" then + return + end + local fromPos = s.bobber and s.bobber.PrimaryPart and s.bobber.PrimaryPart.Position + s.stage = "done" + local tool = s.tool + fishing[player] = nil + if s.tween then + s.tween:Cancel() + end + local failed = success ~= true or os.clock() - s.biteAt > Config.BiteTimeout + 1 + if failed then + reelBobber(s.bobber, tool) + elseif s.bobber then + s.bobber:Destroy() -- вместо поплавка к игроку летит рыба + end + + if failed then + gripSequence(tool, { { REST_ANGLE, 0.3 } }) + remote:FireClient(player, "Escaped") + notify(player, "🐟 Сорвалась!", RED) + breakCombo(player) + return + end + gripSequence(tool, { { 85, 0.15 }, { REST_ANGLE, 0.45 } }) + + -- серия: каждая рыба подряд дороже и даёт больше опыта + local fish = s.fish + local streak = combo[player] or 0 + local comboMult = math.min(Config.Combo.max, 1 + Config.Combo.step * streak) + fish.value = math.floor(fish.value * comboMult + 0.5) + fish.xp = math.floor(fish.xp * comboMult + 0.5) + setCombo(player, streak + 1) + table.insert(data.items, { + uid = data.nextUid, id = fish.id, name = fish.name, rarity = fish.rarity, + weight = fish.weight, value = fish.value, mutation = fish.mutation, + }) + data.nextUid += 1 + data.totalCaught += 1 + + local rec = data.discovered[fish.id] + local isNew, isRecord = rec == nil, false + if not rec then + rec = { count = 0, best = 0 } + data.discovered[fish.id] = rec + end + rec.count += 1 + if fish.weight > rec.best then + isRecord = not isNew + rec.best = fish.weight + end + + addXp(player, data, fish.xp * (isNew and 2 or 1)) + updateStats(player) + sendInventory(player) + if fromPos then + showFishFlight(player, fish, fromPos) + end + remote:FireClient(player, "Caught", fish, { new = isNew, record = isRecord, combo = comboMult, streak = streak + 1 }) + + local rank = Config.Rarities[fish.rarity].rank + questProgress(player, "catch", 1) + if rank >= 2 then + questProgress(player, "uncommon", 1) + end + if rank >= 3 then + questProgress(player, "rare", 1) + end + if misses == 0 then + questProgress(player, "perfect", 1) + end + if s.perfect then + questProgress(player, "perfectCast", 1) + end + questProgress(player, "combo", streak + 1, true) + + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + bossHit(player, hrp and Config.WorldAt(hrp.Position), rank + (misses == 0 and 1 or 0)) +end + +---------------------------------------------------------------- скупка + +local sellPoints = nil +local function nearSeller(player) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if not hrp then + return false + end + if not sellPoints then + sellPoints = {} + local map = workspace:FindFirstChild("FishingMap") + if map then + for _, d in ipairs(map:GetDescendants()) do + if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then + table.insert(sellPoints, d.Parent) + end + end + end + end + for _, p in ipairs(sellPoints) do + if (p.Position - hrp.Position).Magnitude < 28 then + return true + end + end + return false +end + +local function sellItems(player, filterUid) + local data = profiles[player] + if not data then + return + end + local mult = sellMult(player) + local total, count, keep = 0, 0, {} + for _, item in ipairs(data.items) do + if filterUid == nil or item.uid == filterUid then + total += math.floor(item.value * mult) + count += 1 + else + table.insert(keep, item) + end + end + if count == 0 then + if filterUid == nil then + notify(player, "🎒 Сумка пуста", Color3.fromRGB(255, 200, 120)) + end + return + end + data.items = keep + data.coins += total + updateStats(player) + sendInventory(player) + remote:FireClient(player, "Sold", total, count) + questProgress(player, "sell", count) + questProgress(player, "earn", total) +end + +---------------------------------------------------------------- магазин + +local function buy(player, kind, id) + local data = profiles[player] + if not data or type(id) ~= "string" then + return + end + if kind == "Upgrade" then + local rod = Config.Find(Config.Rods, id) + if not rod or not data.rods[id] then + return + end + local lvl = rodLevel(data, id) + if lvl >= Config.RodUpgrade.maxLevel then + notify(player, "★★★★★ Максимум", GOLD) + return + end + local cost = Config.UpgradeCost(rod, lvl) + if data.coins < cost then + notify(player, "Нужно " .. cost .. " 💰", RED) + return + end + data.coins -= cost + data.rodLevels[id] = lvl + 1 + if data.rod == id then + stopFishing(player, true) + giveRodTool(player) + end + updateStats(player) + notify(player, ("✨ %s улучшена до +%d!"):format(rod.name, lvl + 1), GOLD) + questProgress(player, "buy", 1) + return + end + if kind == "Potion" then + local potion = Config.Find(Config.Potions, id) + if not potion then + return + end + if potion.level and data.level < potion.level then + notify(player, "🔒 Нужен ур. " .. potion.level, RED) + return + end + if data.coins < potion.price then + notify(player, "Нужно " .. potion.price .. " 💰", RED) + return + end + data.coins -= potion.price + applyPotion(data, potion.bonus, potion.duration) + updateStats(player) + notify(player, ("🍀 +%d%% удачи, %d мин"):format(potion.bonus * 100, potion.duration / 60), GREEN) + questProgress(player, "buy", 1) + return + end + local list, owned + if kind == "Rod" then + list, owned = Config.Rods, data.rods + elseif kind == "Bag" then + list, owned = Config.Bags, data.bags + else + return + end + local item = Config.Find(list, id) + if not item then + return + end + local bought = false + if not owned[id] then + if data.level < item.level then + notify(player, "🔒 Нужен ур. " .. item.level, RED) + return + end + if data.coins < item.price then + notify(player, "Нужно " .. item.price .. " 💰", RED) + return + end + data.coins -= item.price + owned[id] = true + bought = true + notify(player, "✅ " .. item.name, GREEN) + end + if kind == "Rod" then + data.rod = id + stopFishing(player, true) + giveRodTool(player) + else + data.bag = id + attachBag(player) + end + updateStats(player) + if bought then + questProgress(player, "buy", 1) + end +end + +---------------------------------------------------------------- телепорт + +local TELEPORT_FADE = 0.3 -- сколько клиент затемняет экран перед переносом +local teleporting = {} +Players.PlayerRemoving:Connect(function(p) + teleporting[p] = nil +end) + +local function teleportTo(player, worldId) + local data = profiles[player] + local char = player.Character + if not data or not char or type(worldId) ~= "string" then + return + end + local markerName + if worldId == "Lobby" then + markerName = "LobbySpawn" + else + local world = Config.Find(Config.Worlds, worldId) + if not world then + return + end + if world.soon then + notify(player, world.icon .. " " .. world.name .. " — скоро!", world.color) + return + end + if data.level < world.level then + notify(player, ("🔒 %s: ур. %d"):format(world.name, world.level), RED) + return + end + markerName = world.id .. "Spawn" + end + local map = workspace:FindFirstChild("FishingMap") + local m = map and map:FindFirstChild(markerName, true) -- маркеры могут лежать в папках уровня (World1Map) + if m and not teleporting[player] then + -- клиент затемняет экран, переносим уже в темноте: свет новой локации ставится до того, как её видно + teleporting[player] = true + stopFishing(player, true) + remote:FireClient(player, "TeleportFade", worldId, TELEPORT_FADE) + task.wait(TELEPORT_FADE) + teleporting[player] = nil + char = player.Character + if char and char.Parent then + char:PivotTo(m.CFrame + Vector3.new(0, 3, 0)) + end + end +end + +---------------------------------------------------------------- подсказки NPC + +local TIPS = { + World1 = { + "Рыба клюёт быстрее с хорошей удочкой. Улучшай её в магазине!", + "Говорят, в этом озере живёт хрустальный осётр… Мифическая рыба!", + "Собери всех рыб одной редкости — получишь награду в коллекции (клавиша C).", + "Чем реже рыба, тем быстрее бегает метка. Нужна точность!", + }, + World2 = { + "Скаты любят мелководье, а акулы — глубину за причалом.", + "Солнечная медуза светится по ночам… Если поймаешь — ты легенда!", + "Блестящая рыба стоит вдвое дороже, золотая — в пять раз, радужная — в десять!", + }, + World3 = { + "Ищи лунки во льду — только там можно рыбачить.", + "Ледяной левиафан… Я видел его тень подо льдом. Один раз.", + "Удильщик светится в темноте. Смотри внимательно!", + }, +} + +local function talk(player) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + local world = hrp and Config.WorldAt(hrp.Position) + local list = TIPS[world and world.id or "World1"] or TIPS.World1 + notify(player, "💬 «" .. list[rng:NextInteger(1, #list)] .. "»", Color3.fromRGB(255, 235, 190)) +end + +ProximityPromptService.PromptTriggered:Connect(function(prompt, player) + local action = prompt:GetAttribute("Action") + if action == "Shop" then + remote:FireClient(player, "OpenShop") + elseif action == "Sell" then + sellItems(player, nil) + elseif action == "Portal" then + teleportTo(player, prompt:GetAttribute("World")) + elseif action == "Talk" then + talk(player) + elseif action == "Daily" then + claimDaily(player) + remote:FireClient(player, "OpenQuests") + elseif action == "RobuxPasses" then + remote:FireClient(player, "OpenRobux", "passes") + elseif action == "RobuxProducts" then + remote:FireClient(player, "OpenRobux", "products") + end +end) + +---------------------------------------------------------------- события от клиента + +remote.OnServerEvent:Connect(function(player, action, a, b) + if action == "Cast" then + onCast(player, a) + elseif action == "Tutorial" then + -- шаги обучения идут только вперёд + local data = profiles[player] + local step = math.floor(tonumber(a) or 0) + if data and step > (player:GetAttribute("Tutorial") or 0) and step <= Config.TutorialDone then + data.tutorial = step + player:SetAttribute("Tutorial", step) + end + elseif action == "Catch" then + onCatch(player, a, b) + elseif action == "Cancel" then + stopFishing(player, false) + elseif action == "Buy" then + buy(player, a, b) + elseif action == "SellOne" then + if type(a) ~= "number" then + return + end + if nearSeller(player) then + sellItems(player, a) + else + notify(player, "💰 Только у скупщика", Color3.fromRGB(255, 200, 120)) + end + elseif action == "SellAll" then + if nearSeller(player) then + sellItems(player, nil) + else + notify(player, "💰 Только у скупщика", Color3.fromRGB(255, 200, 120)) + end + elseif action == "Teleport" then + teleportTo(player, a) + elseif action == "ClaimCollection" then + claimCollection(player, a, b) + elseif action == "ClaimDaily" then + claimDaily(player) + elseif action == "RequestInventory" then + sendInventory(player) + sendQuests(player) + elseif action == "Settings" then + -- громкость музыки и эффектов (0..1), сохраняется вместе с прогрессом + local data = profiles[player] + local music, sfx = tonumber(a), tonumber(b) + if data and music and sfx then + data.settings = { music = math.clamp(music, 0, 1), sfx = math.clamp(sfx, 0, 1) } + player:SetAttribute("VolMusic", data.settings.music) + player:SetAttribute("VolSfx", data.settings.sfx) + end + end +end) + +---------------------------------------------------------------- донат + +MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, purchased) + if not purchased then + return + end + for _, gp in ipairs(Config.GamePasses) do + if gp.id == passId then + passes[player] = passes[player] or {} + passes[player][gp.key] = true + notify(player, "✅ " .. gp.icon .. " " .. gp.name, GOLD) + if gp.key == "VIP" then + vipTag(player) + end + updateStats(player) + end + end +end) + +MarketplaceService.ProcessReceipt = function(info) + local player = Players:GetPlayerByUserId(info.PlayerId) + local data = player and profiles[player] + if not data then + return Enum.ProductPurchaseDecision.NotProcessedYet + end + for _, id in ipairs(data.receipts) do + if id == info.PurchaseId then + return Enum.ProductPurchaseDecision.PurchaseGranted + end + end + local product + for _, p in ipairs(Config.Products) do + if p.id == info.ProductId then + product = p + end + end + if not product then + return Enum.ProductPurchaseDecision.NotProcessedYet + end + if product.coins then + local coins = math.floor(product.coins * (1 + (data.level - 1) * 0.15)) + data.coins += coins + notify(player, ("Спасибо! +%d 💰"):format(coins), GOLD) + end + if product.boost then + applyPotion(data, product.boost, product.duration) + notify(player, ("🍀 +%d%% удачи, %d мин"):format(product.boost * 100, product.duration / 60), GOLD) + end + table.insert(data.receipts, info.PurchaseId) + if #data.receipts > 50 then + table.remove(data.receipts, 1) + end + updateStats(player) + saveData(player) + return Enum.ProductPurchaseDecision.PurchaseGranted +end + +---------------------------------------------------------------- события на сервере + +task.spawn(function() + task.wait(Config.EventFirstDelay) + while true do + currentEvent = Config.Events[rng:NextInteger(1, #Config.Events)] + workspace:SetAttribute("Event", currentEvent.id) + workspace:SetAttribute("EventEnds", workspace:GetServerTimeNow() + currentEvent.duration) + for _, p in ipairs(Players:GetPlayers()) do + notify(p, "🎉 " .. currentEvent.name, GOLD) + updateStats(p) + end + task.wait(currentEvent.duration) + currentEvent = nil + workspace:SetAttribute("Event", nil) + for _, p in ipairs(Players:GetPlayers()) do + updateStats(p) + end + task.wait(rng:NextInteger(Config.EventGapMin, Config.EventGapMax)) + end +end) + +---------------------------------------------------------------- босс озера + +local function playerWorld(p) + local hrp = p.Character and p.Character:FindFirstChild("HumanoidRootPart") + return hrp and Config.WorldAt(hrp.Position) +end + +local function setBossAttrs() + workspace:SetAttribute("BossWorld", boss and boss.world.id or nil) + workspace:SetAttribute("BossName", boss and boss.def.name or nil) + workspace:SetAttribute("BossHP", boss and boss.hp or nil) + workspace:SetAttribute("BossMax", boss and boss.max or nil) + workspace:SetAttribute("BossEnds", boss and boss.ends or nil) +end + +local function finishBoss(won) + local b = boss + boss = nil + setBossAttrs() + local helpers, best, bestDmg = 0, nil, 0 + for p, d in pairs(b.dmg) do + if p.Parent then + helpers += 1 + if d > bestDmg then + best, bestDmg = p, d + end + end + end + if not won then + for _, p in ipairs(Players:GetPlayers()) do + remote:FireClient(p, "BossDone", false, b.def.name) + end + return + end + local R = Config.Boss.reward + local fair = b.max / math.max(1, helpers) -- «честная доля» урона на одного + local potion = R.potion and Config.Find(Config.Potions, R.potion) + for p, d in pairs(b.dmg) do + local data = p.Parent and profiles[p] + if data then + local share = 0.4 + 0.6 * math.min(1, d / fair) + local coins = math.floor(R.coins * b.world.mult * share * levelMult(data)) + local xp = math.floor(R.xp * b.world.mult * share) + data.coins += coins + addXp(p, data, xp) + if potion then + applyPotion(data, potion.bonus, potion.duration) + end + updateStats(p) + remote:FireClient(p, "BossReward", coins, xp, potion and potion.name) + end + end + for _, p in ipairs(Players:GetPlayers()) do + remote:FireClient(p, "BossDone", true, b.def.name, best and best.DisplayName, bestDmg) + end +end + +task.spawn(function() + task.wait(Config.Boss.firstDelay) + while true do + -- мир, где сейчас больше всего игроков + local counts = {} + for _, p in ipairs(Players:GetPlayers()) do + local w = playerWorld(p) + if w and Config.Boss.worlds[w.id] then + counts[w.id] = (counts[w.id] or 0) + 1 + end + end + local bestId, n = nil, 0 + for id, c in pairs(counts) do + if c > n then + bestId, n = id, c + end + end + if not bestId then + task.wait(30) -- никого нет в мирах: попробуем позже + else + local world = Config.Find(Config.Worlds, bestId) + local max = Config.Boss.hpPerPlayer * n + boss = { + world = world, def = Config.Boss.worlds[bestId], hp = max, max = max, dmg = {}, + ends = workspace:GetServerTimeNow() + Config.Boss.duration, + } + setBossAttrs() + for _, p in ipairs(Players:GetPlayers()) do + remote:FireClient(p, "BossStart", boss.def.name, world.icon .. " " .. world.name) + end + local t0 = os.clock() + while boss and boss.hp > 0 and os.clock() - t0 < Config.Boss.duration do + task.wait(0.25) + end + if boss then + finishBoss(boss.hp <= 0) + end + task.wait(Config.Boss.interval) + end + end +end) + +---------------------------------------------------------------- игроки + +local function onPlayerAdded(player) + local ls = Instance.new("Folder") + ls.Name = "leaderstats" + ls.Parent = player + for _, name in ipairs({ "Монеты", "Уровень", "Улов" }) do + local v = Instance.new("IntValue") + v.Name = name + v.Parent = ls + end + + local data, ok = loadData(player) + if not player.Parent then + return + end + loadPasses(player) + ensureChain(data) + profiles[player] = data + loadedOk[player] = ok + local settings = type(data.settings) == "table" and data.settings or {} + player:SetAttribute("VolMusic", tonumber(settings.music) or Config.DefaultVolume.music) + player:SetAttribute("VolSfx", tonumber(settings.sfx) or Config.DefaultVolume.sfx) + updateStats(player) + sendInventory(player) + sendQuests(player) + + local function onCharacter() + stopFishing(player, false) + task.wait(0.3) + giveRodTool(player) + attachBag(player) + vipTag(player) + end + player.CharacterAdded:Connect(onCharacter) + if player.Character then + task.spawn(onCharacter) + end +end + +Players.PlayerAdded:Connect(onPlayerAdded) +for _, p in ipairs(Players:GetPlayers()) do + task.spawn(onPlayerAdded, p) +end + +Players.PlayerRemoving:Connect(function(player) + stopFishing(player, false) + combo[player], comboUntil[player] = nil, nil + saveData(player) + profiles[player] = nil + loadedOk[player] = nil + passes[player] = nil +end) + +game:BindToClose(function() + for _, p in ipairs(Players:GetPlayers()) do + saveData(p) + end +end) + +-- погода и ночь меняют удачу: пересчитываем её у всех, когда они меняются +local function refreshAllStats() + for _, p in ipairs(Players:GetPlayers()) do + updateStats(p) + end +end +workspace:GetAttributeChangedSignal("Weather"):Connect(refreshAllStats) + +-- таймер зелий + автосохранение +task.spawn(function() + local t = 0 + local wasNight = isNight() + while true do + task.wait(1) + t += 1 + local night = isNight() + if night ~= wasNight then + wasNight = night + refreshAllStats() + end + for _, p in ipairs(Players:GetPlayers()) do + local data = profiles[p] + if data and data.boostUntil > os.time() - 2 then + updateStats(p) + end + -- серия сгорает, если долго нет улова (пока рыба на крючке — ждём) + if comboUntil[p] and os.time() > comboUntil[p] and not fishing[p] then + breakCombo(p) + end + end + if t % 60 == 0 then + for _, p in ipairs(Players:GetPlayers()) do + saveData(p) + end + end + end +end) +]=====]) +put('Script', 'MapBuilder', game.ServerScriptService, [=====[-- MapBuilder (Script) -> ServerScriptService +-- При запуске игры: свет, точка появления в лобби, карта и NPC. +-- Карту (лобби и все миры) строит модуль WorldBuilder. Обычно она уже собрана в Studio и +-- сохранена в плейсе (Workspace.FishingMap) — тогда берём её как есть, правки руками сохраняются. +-- Если карты в плейсе нет, строим её здесь тем же модулем. + +local Workspace = game:GetService("Workspace") + +local WorldBuilder = require(script.Parent:WaitForChild("WorldBuilder")) + +WorldBuilder.applyLighting() + +---------------------------------------------------------------- точка появления в лобби + +local spawn = Workspace:FindFirstChildOfClass("SpawnLocation") +if not spawn then + spawn = Instance.new("SpawnLocation") + spawn.Parent = Workspace +end +spawn.Anchored = true +spawn.Size = Vector3.new(8, 0.2, 8) +spawn.CFrame = CFrame.new(0, 1.15, 57) +spawn.Transparency = 1 +spawn.Duration = 0 +for _, d in ipairs(spawn:GetChildren()) do + if d:IsA("Decal") or d:IsA("Texture") then + d.Transparency = 1 + end +end + +---------------------------------------------------------------- карта + +local map = Workspace:FindFirstChild("FishingMap") or WorldBuilder.build() +WorldBuilder.prepareRuntime(map) +]=====]) +put('Script', 'WeatherServer', game.ServerScriptService, [=====[-- WeatherServer (Script) -> ServerScriptService +-- Общие для всего сервера время суток и погода. Ничего не рисует — только выставляет атрибуты workspace: +-- DayStart — серверное время начала суток (часы считает Config.ClockAt) +-- Weather — id погоды из Config.Weathers +-- WeatherEnds — когда сменится (workspace:GetServerTimeNow()) +-- Небо, дождь, звуки и свет делает клиент (Ambience), бонусы к рыбалке учитывает GameServer. + +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) + +local rng = Random.new() + +if Config.DayNight.enabled then + workspace:SetAttribute("DayStart", workspace:GetServerTimeNow()) +end + +local function pickWeather(previous) + local total = 0 + for _, w in ipairs(Config.Weathers) do + if w.id ~= previous then + total += w.weight + end + end + local roll = rng:NextNumber() * total + for _, w in ipairs(Config.Weathers) do + if w.id ~= previous then + roll -= w.weight + if roll <= 0 then + return w + end + end + end + return Config.Weathers[1] +end + +task.spawn(function() + -- первая погода всегда ясная: новичок видит мир чистым + local current = Config.Weathers[1] + while true do + local duration = rng:NextInteger(current.duration[1], current.duration[2]) + workspace:SetAttribute("Weather", current.id) + workspace:SetAttribute("WeatherEnds", workspace:GetServerTimeNow() + duration) + task.wait(duration) + current = pickWeather(current.id) + end +end) +]=====]) +put('ModuleScript', 'World1Builder', game.ServerScriptService, [=====[-- World1Builder (ModuleScript) -> ServerScriptService +-- Генератор локации «Тихое озеро» (Мир 1). Им ОДИН РАЗ собирают уровень прямо в Roblox Studio, +-- в режиме редактирования, а дальше уровень правится руками как обычные детали и модели. +-- Команда для Command Bar (строка внизу Studio): +-- require(game.ServerScriptService.World1Builder:Clone()).bake() +-- bake() стирает старую папку Workspace.World1Map и террейн этого мира и строит всё заново. +-- Обычно уровень собирается вместе со всей картой: WorldBuilder.bake() (см. README). +-- Если папки World1Map в плейсе нет, WorldBuilder строит уровень этим же модулем. +-- +-- Что нужно игре от уровня (не удаляйте и не переименовывайте): +-- маркеры World1Spawn, GuideFishSpot, GuideSell, World1NpcSeller, World1NpcGrandpa — невидимые +-- плитки; их можно двигать, NPC и точка появления встанут туда при запуске; +-- атрибут GuideTarget = "Pier" (модель MainDock) и "Sell" (модель BaitShop) — подсветка в обучении; +-- ProximityPrompt с атрибутом Action = "Sell" на прилавке и портал «В лобби» (Action = "Portal"); +-- деталь World1Bestiary — доска «Кто водится в озере», текст на неё пишет MapBuilder при запуске. +-- Форма воды для заброса берётся из FishConfig (Worlds[1].lakes) — если меняете озеро руками, +-- поправьте там круги, иначе игра будет считать водой старые места. + +local Workspace = game:GetService("Workspace") +local ReplicatedStorage = game:GetService("ReplicatedStorage") + +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) + +local V = Vector3.new +local terrain = Workspace.Terrain +local W1 = Config.Worlds[1] +local W = W1.center -- центр Мира 1 +local GROUND_Y = 4 -- верх земли +local WATER_Y = W1.waterY -- поверхность воды +local LAKES = W1.lakes -- озеро из кругов { x, z, радиус } от W + +-- холмы: { x, z, радиус, высота центра шара } — верх холма = высота центра + радиус +local HILLS = { + { -78, -138, 62, -22 }, -- холм с вышкой + { -175, -55, 58, -34 }, { 175, -165, 62, -30 }, { -175, 160, 52, -32 }, + { 180, 130, 48, -30 }, { 10, -225, 60, -34 }, { -60, 175, 45, -28 }, { 95, 190, 40, -26 }, +} +-- тропинка на холм к вышке (точки от W) +local HILL_PATH = { { -22, -76 }, { -40, -92 }, { -28, -106 }, { -52, -114 }, { -44, -127 }, { -66, -131 } } +-- «трава» — материал Snow: у него нет травинок и почти нет рисунка, получается ровная мультяшная +-- поверхность. В зелёный (а дорожки из Salt — в коричневый) его красит клиент только в этом мире. +local GROUND_MAT, PATH_MAT = Enum.Material.Snow, Enum.Material.Salt + +local Builder = {} + +-- вода ниже WATER_Y и воздух над ней прямо по вокселям (Fill* с Air иногда оставляет песок над водой) +function Builder.carveLake(l) + local region = Region3.new(W + V(l[1] - l[3], WATER_Y - 12, l[2] - l[3]), W + V(l[1] + l[3], WATER_Y + 16, l[2] + l[3])):ExpandToGrid(4) + local mats, occ = terrain:ReadVoxels(region, 4) + local size = mats.Size + local corner = region.CFrame.Position - region.Size / 2 + local center = W + V(l[1], 0, l[2]) + for x = 1, size.X do + for y = 1, size.Y do + for z = 1, size.Z do + local c = corner + V(x - 0.5, y - 0.5, z - 0.5) * 4 + if (V(c.X, 0, c.Z) - center).Magnitude <= l[3] then + local water = c.Y < WATER_Y + mats[x][y][z] = water and Enum.Material.Water or Enum.Material.Air + occ[x][y][z] = water and 1 or 0 + end + end + end + end + terrain:WriteVoxels(region, 4, mats, occ) +end + +-- высота земли с учётом холмов: считаем по формуле (лучи по только что залитому террейну ненадёжны) +local function hillY(x, z) + local y = GROUND_Y + for _, h in ipairs(HILLS) do + local d2 = (x - h[1]) ^ 2 + (z - h[2]) ^ 2 + if d2 < h[3] ^ 2 then + y = math.max(y, h[4] + math.sqrt(h[3] ^ 2 - d2)) + end + end + return y +end + +local function inLake(x, z, extra) + for _, l in ipairs(LAKES) do + if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + (extra or 0) then + return true + end + end + return false +end + +---------------------------------------------------------------- террейн +local function buildTerrain() + terrain:FillBlock(CFrame.new(W + V(0, -10, 0)), V(500, 28, 500), GROUND_MAT) + for _, h in ipairs(HILLS) do + terrain:FillBall(W + V(h[1], h[4], h[2]), h[3], GROUND_MAT) + end + -- порядок важен: узкая песчаная кромка → выемка → ил → вода + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -10, l[2])), 28, l[3] + 3, Enum.Material.Sand) + end + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], 11, l[2])), 18, l[3] + 2, Enum.Material.Air) + end + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], 10, l[2])), 20, l[3] + 1, Enum.Material.Air) + end + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -18, l[2])), 12, l[3], Enum.Material.Mud) + end + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -6, l[2])), 12, l[3], Enum.Material.Water) + end + for _, l in ipairs(LAKES) do + Builder.carveLake(l) + end + -- земляные дорожки: меняем материал травы на материал дорожки, объём не меняется + local function dirtPath(points, width) + for i = 2, #points do + local a, b = points[i - 1], points[i] + local len = math.sqrt((b[1] - a[1]) ^ 2 + (b[2] - a[2]) ^ 2) + for s = 0, len, 2 do + local x, z = a[1] + (b[1] - a[1]) * s / len, a[2] + (b[2] - a[2]) * s / len + local half = V(width / 2, 3, width / 2) + local p = W + V(x, hillY(x, z), z) + terrain:ReplaceMaterial(Region3.new(p - half, p + half):ExpandToGrid(4), 4, GROUND_MAT, PATH_MAT) + end + end + end + dirtPath(HILL_PATH, 4) + dirtPath({ { 0, 84 }, { 0, 64 } }, 6) -- площадка у корня причала + dirtPath({ { 8, -84 }, { 8, -100 } }, 4) -- к домику у мостков +end + +---------------------------------------------------------------- детали +-- parent — куда положить папку World1Map (Workspace при сборке в Studio, FishingMap при запуске игры) +-- makePortal — WorldBuilder.portalModel: ставит модель портала из шаблона (без него строится старое кольцо) +function Builder.build(parent, makePortal) + buildTerrain() + + local rng = Random.new(7) + local map = Instance.new("Folder") + map.Name = "World1Map" + + -------------------------------------------------- помощники + local function P(props) + local p = Instance.new("Part") + if props.Shape then + p.Shape = props.Shape + end + p.Anchored = true + p.TopSurface = Enum.SurfaceType.Smooth + p.BottomSurface = Enum.SurfaceType.Smooth + for k, v in pairs(props) do + if k ~= "Parent" and k ~= "Shape" then + p[k] = v + end + end + p.Parent = props.Parent or map + return p + end + local function vcyl(pos, h, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(h, d, d) + props.CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)) + return P(props) + end + local function ball(pos, d, props) + props.Shape = Enum.PartType.Ball + props.Size = V(d, d, d) + props.Position = pos + return P(props) + end + -- цилиндр между двумя точками (брёвна, балки, перила, вёсла) + local function rod(a, b, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(math.max(0.05, (b - a).Magnitude), d, d) + props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0) + return P(props) + end + local function surfaceText(part, face, text, color) + local sg = Instance.new("SurfaceGui") + sg.Face = face + sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud + sg.PixelsPerStud = 40 + sg.LightInfluence = 0 + sg.Parent = part + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = color + t.TextStrokeTransparency = 1 + t.Text = text + t.Parent = sg + end + local function prompt(target, actionText, objectText, action) + local pp = Instance.new("ProximityPrompt") + pp.ActionText = actionText + pp.ObjectText = objectText + pp.HoldDuration = 0 + pp.MaxActivationDistance = 14 + pp.RequiresLineOfSight = false + pp:SetAttribute("Action", action) + pp.Parent = target + return pp + end + local function marker(name, cf) + return P({ Name = name, Size = V(4, 1, 4), CFrame = cf, Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false }) + end + + local COL = { + plank = Color3.fromRGB(196, 140, 88), plankDark = Color3.fromRGB(160, 110, 68), + log = Color3.fromRGB(156, 102, 60), logDark = Color3.fromRGB(105, 70, 44), + rope = Color3.fromRGB(218, 184, 128), roof = Color3.fromRGB(62, 104, 78), stone = Color3.fromRGB(150, 146, 150), + rock = Color3.fromRGB(150, 146, 162), rockDark = Color3.fromRGB(112, 108, 128), moss = Color3.fromRGB(108, 152, 72), + pine = Color3.fromRGB(58, 126, 70), pineDark = Color3.fromRGB(30, 82, 52), + leaf = Color3.fromRGB(110, 170, 64), leafDark = Color3.fromRGB(72, 136, 56), + glow = Color3.fromRGB(255, 200, 120), awnA = Color3.fromRGB(46, 106, 72), awnB = Color3.fromRGB(242, 232, 204), + banner = Color3.fromRGB(40, 92, 62), metal = Color3.fromRGB(48, 44, 42), water = Color3.fromRGB(70, 200, 195), + } + local WOOD, PLANKS, SMOOTH = Enum.Material.Wood, Enum.Material.WoodPlanks, Enum.Material.SmoothPlastic + -- куб, повёрнутый вершиной вверх: три грани сходятся в острый пик (ёлки, горы, обломки скал) + local CUBE_UP = CFrame.Angles(math.rad(-35.264), 0, 0) * CFrame.Angles(0, 0, math.rad(45)) + + -- столб с кронштейном и висящим фонарём; facing — куда смотрит кронштейн + local function postLantern(base, facing, h) + h = h or 8 + local top = base + V(0, h, 0) + vcyl(base + V(0, h / 2, 0), h, 0.8, { Color = COL.logDark, Material = WOOD }) + rod(top - V(0, 0.3, 0), top + facing * 2.4 - V(0, 0.3, 0), 0.35, { Color = COL.logDark, Material = WOOD }) + local hang = top + facing * 2 - V(0, 1.8, 0) + rod(hang + V(0, 0.9, 0), top + facing * 2 - V(0, 0.3, 0), 0.08, { Color = COL.metal, Material = Enum.Material.Metal, CanCollide = false }) + P({ Size = V(1.2, 0.3, 1.2), Position = hang + V(0, 0.85, 0), Color = COL.metal, Material = Enum.Material.Metal, CanCollide = false }) + local glass = P({ Size = V(0.9, 1.3, 0.9), Position = hang, Color = COL.glow, Material = Enum.Material.Neon, CanCollide = false, CastShadow = false }) + P({ Size = V(1.2, 0.3, 1.2), Position = hang - V(0, 0.8, 0), Color = COL.metal, Material = Enum.Material.Metal, CanCollide = false }) + local light = Instance.new("PointLight") + light.Range = 18 + light.Brightness = 1.5 + light.Color = COL.glow + light.Parent = glass + end + + -- low-poly ёлка: ствол и ярусы-«ромбы» (кубы вершиной вверх), к верху меньше + local function pine(pos, h, tiers) + tiers = tiers or 3 + vcyl(pos + V(0, h * 0.15, 0), h * 0.3, math.max(0.8, h * 0.07), { Color = COL.logDark, Material = WOOD, CastShadow = false }) + local shade = rng:NextNumber(0, 0.3) + for i = 0, tiers - 1 do + local t = tiers > 1 and i / (tiers - 1) or 1 + local s = h * (0.42 - 0.22 * t) + P({ + Size = V(s, s, s), + CFrame = CFrame.new(pos + V(0, h * (0.34 + 0.48 * t), 0)) * CFrame.Angles(0, rng:NextNumber(0, 6.28), 0) * CUBE_UP, + Color = COL.pineDark:Lerp(COL.pine, 0.2 + 0.5 * t + shade), Material = SMOOTH, CanCollide = false, + }) + end + end + + -- круглое лиственное дерево + local function leafy(pos, s) + vcyl(pos + V(0, s * 0.4, 0), s * 0.8, s * 0.14, { Color = COL.log, Material = WOOD }) + local c = COL.leafDark:Lerp(COL.leaf, rng:NextNumber(0.3, 1)) + ball(pos + V(0, s * 1.05, 0), s * 0.95, { Color = c, Material = SMOOTH, CanCollide = false }) + ball(pos + V(s * 0.38, s * 0.85, s * 0.1), s * 0.65, { Color = c:Lerp(COL.leaf, 0.3), Material = SMOOTH, CanCollide = false }) + ball(pos + V(-s * 0.35, s * 0.9, -s * 0.2), s * 0.6, { Color = c:Lerp(COL.leafDark, 0.3), Material = SMOOTH, CanCollide = false }) + end + + -- угловатый low-poly камень + local function rock(pos, s, col) + return P({ + Size = V(s, s * rng:NextNumber(0.55, 0.85), s * rng:NextNumber(0.7, 1)), + CFrame = CFrame.new(pos) * CFrame.Angles(rng:NextNumber(-0.4, 0.4), rng:NextNumber(0, 6.28), rng:NextNumber(-0.4, 0.4)), + Color = (col or COL.rock):Lerp(COL.rockDark, rng:NextNumber(0, 0.6)), Material = SMOOTH, + }) + end + -- острый обломок скалы (куб вершиной вверх), наполовину утоплен + local function crag(pos, s) + return P({ + Size = V(s, s, s), + CFrame = CFrame.new(pos) * CFrame.Angles(rng:NextNumber(-0.2, 0.2), rng:NextNumber(0, 6.28), rng:NextNumber(-0.2, 0.2)) * CUBE_UP, + Color = COL.rock:Lerp(COL.rockDark, rng:NextNumber(0, 0.6)), Material = SMOOTH, + }) + end + + -- рогоз: несколько стеблей с коричневыми «початками» и листья + local function cattails(pos) + for _ = 1, rng:NextInteger(3, 6) do + local p = pos + V(rng:NextNumber(-1.3, 1.3), 0, rng:NextNumber(-1.3, 1.3)) + local top = p + V(rng:NextNumber(-0.4, 0.4), rng:NextNumber(3.5, 6), rng:NextNumber(-0.4, 0.4)) + rod(p, top, 0.16, { Color = Color3.fromRGB(96, 140, 62), Material = SMOOTH, CanCollide = false, CastShadow = false }) + local dir = (top - p).Unit + rod(top - dir * 2, top - dir * 0.6, 0.5, { Color = Color3.fromRGB(122, 74, 40), Material = SMOOTH, CanCollide = false, CastShadow = false }) + end + for _ = 1, 3 do + P({ + Size = V(0.35, rng:NextNumber(3, 4.5), 0.08), + CFrame = CFrame.new(pos + V(0, 1.6, 0)) * CFrame.Angles(0, rng:NextNumber(0, 6.28), rng:NextNumber(-0.35, 0.35)), + Color = Color3.fromRGB(110, 160, 70), Material = SMOOTH, CanCollide = false, CastShadow = false, + }) + end + end + + -- круглая свая с намотанным канатом; y0 — низ (под водой), top — верх сваи + local function ropePost(x, z, y0, top, d, parent) + d = d or 1.6 + vcyl(W + V(x, (y0 + top) / 2, z), top - y0, d, { Color = COL.log, Material = WOOD, Parent = parent }) + vcyl(W + V(x, top + 0.1, z), 0.2, d * 0.9, { Color = COL.plankDark, Material = WOOD, Parent = parent }) + for i = 1, 3 do + vcyl(W + V(x, top - 0.5 - i * 0.38, z), 0.3, d + 0.25, { Color = COL.rope, Material = Enum.Material.Fabric, CanCollide = false, Parent = parent }) + end + end + + -- маленькие мостки: доски поперёк и сваи + local function smallDock(x, z0, z1, w, y) + local dir = z1 > z0 and 1 or -1 + for z = z0, z1, dir * 1.6 do + P({ Size = V(w, 0.45, 1.45), Position = W + V(x, y - 0.22, z), Color = COL.plank:Lerp(COL.plankDark, rng:NextNumber(0, 0.6)), Material = PLANKS }) + end + for z = z0 + dir * 2, z1, dir * 6 do + for _, s in ipairs({ -1, 1 }) do + vcyl(W + V(x + s * (w / 2 - 0.3), y - 4, z), 8, 0.8, { Color = COL.logDark, Material = WOOD }) + end + end + end + + -- бревенчатый дом: стены из брёвен, двускатная зелёная крыша, тёплые окна, труба с дымом, крыльцо. + -- cf — центр пола на земле, сторона -Z (LookVector) — фасад с дверью + local function logCabin(name, cf, w, d, wallH) + local house = Instance.new("Model") + house.Name = name + house.Parent = map + local function part(props) + props.Parent = house + return P(props) + end + local LOG = 1.25 + local rows = math.floor(wallH / LOG) + local wallTop = 1 + rows * LOG + local function at(x, y, z) + return (cf * CFrame.new(x, y, z)).Position + end + part({ Size = V(w + 1.5, 1, d + 1.5), CFrame = cf * CFrame.new(0, 0.5, 0), Color = COL.stone, Material = Enum.Material.Slate }) + for r = 0, rows - 1 do + local y = 1 + LOG / 2 + r * LOG + local col = (r % 2 == 0) and COL.log or COL.log:Lerp(COL.logDark, 0.3) + for _, s in ipairs({ -1, 1 }) do + rod(at(-w / 2 - 0.9, y, s * d / 2), at(w / 2 + 0.9, y, s * d / 2), LOG, { Color = col, Material = WOOD, Parent = house }) + rod(at(s * w / 2, y, -d / 2 - 0.9), at(s * w / 2, y, d / 2 + 0.9), LOG, { Color = col, Material = WOOD, Parent = house }) + end + end + -- фронтоны (по бокам) — брёвна всё короче к коньку + local a = math.rad(34) + local rise = (d / 2) * math.tan(a) + for k = 0, math.floor(rise / LOG) - 1 do + local y = wallTop + LOG / 2 + k * LOG + local half = (d / 2) * (1 - (k + 1) * LOG / rise) + if half > 0.6 then + for _, s in ipairs({ -1, 1 }) do + rod(at(s * w / 2, y, -half), at(s * w / 2, y, half), LOG, { Color = COL.log:Lerp(COL.logDark, 0.15), Material = WOOD, Parent = house }) + end + end + end + -- крыша: два ската, конёк вдоль X + local run = d / 2 + 1.6 + for _, s in ipairs({ -1, 1 }) do + part({ Size = V(w + 3, 0.7, run / math.cos(a)), CFrame = cf * CFrame.new(0, wallTop + run * math.tan(a) / 2 + 0.35, s * run / 2) * CFrame.Angles(s * a, 0, 0), Color = COL.roof, Material = SMOOTH }) + end + part({ Size = V(w + 3.2, 0.6, 0.9), CFrame = cf * CFrame.new(0, wallTop + run * math.tan(a) + 0.2, 0), Color = COL.roof:Lerp(Color3.new(0, 0, 0), 0.25), Material = SMOOTH }) + -- дверь и окна с тёплым светом + part({ Size = V(3, 5.2, 0.5), CFrame = cf * CFrame.new(0, 3.6, -d / 2 - 0.7), Color = COL.logDark, Material = PLANKS }) + for i, wdw in ipairs({ { -w / 4, -d / 2 - 0.65, 0 }, { w / 4, -d / 2 - 0.65, 0 }, { -w / 2 - 0.65, 0, 90 }, { w / 2 + 0.65, 0, 90 } }) do + local wcf = cf * CFrame.new(wdw[1], 4.6, wdw[2]) * CFrame.Angles(0, math.rad(wdw[3]), 0) + part({ Size = V(3, 2.6, 0.4), CFrame = wcf, Color = COL.logDark, Material = WOOD }) + local g = part({ Size = V(2.4, 2, 0.45), CFrame = wcf, Color = COL.glow, Material = Enum.Material.Neon, CastShadow = false }) + part({ Size = V(0.2, 2, 0.5), CFrame = wcf, Color = COL.logDark, Material = WOOD }) + if i == 1 then + local l = Instance.new("PointLight") + l.Range = 14 + l.Brightness = 1 + l.Color = COL.glow + l.Parent = g + end + end + -- крыльцо + part({ Size = V(w * 0.55, 0.6, 4), CFrame = cf * CFrame.new(0, 1.1, -d / 2 - 2.8), Color = COL.plank, Material = PLANKS }) + for _, s in ipairs({ -1, 1 }) do + vcyl(at(s * w * 0.25, 4.2, -d / 2 - 4.4), 6.2, 0.6, { Color = COL.log, Material = WOOD, Parent = house }) + end + part({ Size = V(w * 0.62, 0.5, 4.8), CFrame = cf * CFrame.new(0, 7.3, -d / 2 - 2.6) * CFrame.Angles(-math.rad(14), 0, 0), Color = COL.roof, Material = SMOOTH }) + -- труба с дымом + local ch = at(w / 2 - 2.2, 0, d / 4) + local chTop = wallTop + rise + 3 + part({ Size = V(2.2, chTop, 2.2), Position = ch + V(0, chTop / 2, 0), Color = Color3.fromRGB(150, 110, 95), Material = Enum.Material.Brick }) + local smokeAt = part({ Size = V(1, 1, 1), Position = ch + V(0, chTop + 0.5, 0), Transparency = 1, CanCollide = false, CanQuery = false }) + local smoke = Instance.new("ParticleEmitter") + smoke.Texture = "rbxasset://textures/particles/smoke_main.dds" + smoke.Color = ColorSequence.new(Color3.fromRGB(235, 235, 235)) + smoke.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1.5), NumberSequenceKeypoint.new(1, 6) }) + smoke.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.4), NumberSequenceKeypoint.new(1, 1) }) + smoke.Lifetime = NumberRange.new(4, 6) + smoke.Rate = 4 + smoke.Speed = NumberRange.new(2, 3) + smoke.SpreadAngle = Vector2.new(10, 10) + smoke.Acceleration = V(1, 0.4, 0) + smoke.Parent = smokeAt + end + + -------------------------------------------------- прибытие, причал, лавка + local DOCK = { z0 = 64, z1 = 36, w = 12 } -- от берега (z0) в воду (z1), по оси X = 0 + local DECK_Y = GROUND_Y + 0.6 -- верх настила + local spawnAt = W + V(0, DECK_Y, 60) + marker("World1Spawn", CFrame.lookAt(spawnAt + V(0, 1, 0), spawnAt + V(0, 1, -10))) + marker("GuideFishSpot", CFrame.new(W + V(0, DECK_Y + 0.5, DOCK.z1 + 3))) + + -- главный причал: доски поперёк, толстые сваи с канатом по краям, ящик для снастей + do + local dock = Instance.new("Model") + dock.Name = "MainDock" + dock:SetAttribute("GuideTarget", "Pier") -- подсвечивается на шаге обучения + dock.Parent = map + for z = DOCK.z1 + 0.8, DOCK.z0 - 0.8, 1.6 do + P({ + Size = V(DOCK.w + rng:NextNumber(-0.3, 0.3), 0.5, 1.48), Position = W + V(0, DECK_Y - 0.25, z), + Color = COL.plank:Lerp(COL.plankDark, rng:NextNumber(0, 0.7)), Material = PLANKS, Parent = dock, + }) + end + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.8, 0.8, DOCK.z0 - DOCK.z1), Position = W + V(s * (DOCK.w / 2 - 1), DECK_Y - 0.9, (DOCK.z0 + DOCK.z1) / 2), Color = COL.logDark, Material = WOOD, Parent = dock }) + for z = DOCK.z1 + 1, DOCK.z0 - 2, 8 do + ropePost(s * (DOCK.w / 2 - 0.2), z, -6, DECK_Y + 2.4, 1.7, dock) + end + end + local tb = W + V(-3.4, DECK_Y, 46) + P({ Size = V(2.6, 1.3, 1.5), Position = tb + V(0, 0.65, 0), Color = Color3.fromRGB(120, 142, 124), Material = SMOOTH, Parent = dock }) + P({ Size = V(2.7, 0.35, 1.6), Position = tb + V(0, 1.45, 0), Color = Color3.fromRGB(96, 116, 100), Material = SMOOTH, Parent = dock }) + rod(tb + V(-0.7, 1.65, 0), tb + V(0.7, 1.65, 0), 0.18, { Color = COL.metal, Material = Enum.Material.Metal, Parent = dock }) + P({ Size = V(0.35, 0.35, 0.1), Position = tb + V(0, 1.2, -0.8), Color = Color3.fromRGB(230, 190, 70), Material = Enum.Material.Metal, Parent = dock }) + P({ Size = V(2, 2, 2), CFrame = CFrame.new(W + V(-4.2, DECK_Y + 1, 49.5)) * CFrame.Angles(0, 0.25, 0), Color = COL.plankDark, Material = PLANKS, Parent = dock }) + end + + -- лавка рыбака (скупка) слева от корня причала, прилавком к причалу: тент, вывеска, поплавки, + -- воблеры, бочки и ящики, фонарь на столбе. Продавца ставит MapBuilder на маркер World1NpcSeller. + do + local cf = CFrame.lookAt(W + V(-15, GROUND_Y, 60), W + V(0, GROUND_Y, 57)) + local shop = Instance.new("Model") + shop.Name = "BaitShop" + shop:SetAttribute("GuideTarget", "Sell") -- подсвечивается на шаге обучения + shop.Parent = map + local function at(x, y, z) + return cf * CFrame.new(x, y, z) + end + local function part(props) + props.Parent = shop + return P(props) + end + part({ Size = V(14, 0.8, 10), CFrame = at(0, 0.4, 0), Color = COL.plankDark, Material = PLANKS }) + part({ Size = V(14, 9, 0.8), CFrame = at(0, 5, 4.6), Color = COL.plank, Material = PLANKS }) + for _, s in ipairs({ -1, 1 }) do + part({ Size = V(0.8, 9, 10), CFrame = at(s * 6.6, 5, 0), Color = COL.plank, Material = PLANKS }) + part({ Size = V(1.2, 10.4, 1.2), CFrame = at(s * 6.6, 5.2, -4.8), Color = COL.logDark, Material = WOOD }) + end + part({ Size = V(15.5, 0.7, 11), CFrame = at(0, 10.4, 0), Color = COL.logDark, Material = PLANKS }) + local counter = part({ Name = "Counter", Size = V(12, 3.4, 2.4), CFrame = at(0, 2.5, -3.6), Color = COL.plank, Material = PLANKS }) + part({ Size = V(13, 0.4, 3), CFrame = at(0, 4.4, -3.6), Color = COL.logDark, Material = WOOD }) + prompt(counter, "Продать всю рыбу", "Скупка", "Sell") + -- полосатый тент и фестончики + local n = 8 + for i = 0, n - 1 do + local c = (i % 2 == 0) and COL.awnA or COL.awnB + local x = -7.5 + (i + 0.5) * 15 / n + part({ Size = V(15 / n + 0.02, 0.25, 5), CFrame = at(x, 9.7, -6.9) * CFrame.Angles(math.rad(-24), 0, 0), Color = c, Material = Enum.Material.Fabric }) + part({ Shape = Enum.PartType.Cylinder, Size = V(0.25, 15 / n, 15 / n), CFrame = at(x, 8.7, -9.25) * CFrame.Angles(0, math.rad(90), 0), Color = c, Material = Enum.Material.Fabric, CanCollide = false }) + end + -- вывеска над тентом + local sign = part({ Size = V(8, 3, 0.5), CFrame = at(0, 12.6, -4.9), Color = COL.plank, Material = PLANKS }) + part({ Size = V(8.6, 3.6, 0.3), CFrame = at(0, 12.6, -4.6), Color = COL.logDark, Material = WOOD }) + surfaceText(sign, Enum.NormalId.Front, "🐟 СКУПКА", Color3.fromRGB(60, 40, 25)) + -- воблеры на задней стене + for i, c in ipairs({ Color3.fromRGB(90, 200, 80), Color3.fromRGB(245, 210, 60), Color3.fromRGB(245, 140, 50), Color3.fromRGB(70, 150, 230), Color3.fromRGB(230, 70, 70) }) do + local x = -4.4 + (i - 1) * 2.2 + part({ Size = V(0.08, 1.4, 0.08), CFrame = at(x, 8.4, 4.05), Color = COL.metal, CanCollide = false }) + part({ Size = V(0.55, 1.6, 0.5), CFrame = at(x, 7, 4.0), Color = c, Material = SMOOTH, CanCollide = false }) + part({ Size = V(0.3, 0.5, 0.45), CFrame = at(x, 6, 4.0), Color = c:Lerp(Color3.new(1, 1, 1), 0.4), Material = SMOOTH, CanCollide = false }) + end + -- поплавки и ящички на прилавке + for i = 0, 3 do + local p = at(-4.5 + i * 1.3, 5.05, -3.4).Position + ball(p, 0.9, { Color = Color3.fromRGB(225, 50, 45), Material = SMOOTH, Parent = shop, CanCollide = false }) + ball(p + V(0, 0.55, 0), 0.6, { Color = Color3.fromRGB(250, 250, 250), Material = SMOOTH, Parent = shop, CanCollide = false }) + end + part({ Size = V(2.2, 1, 1.4), CFrame = at(2.6, 5.1, -3.5), Color = Color3.fromRGB(120, 140, 125), Material = SMOOTH }) + part({ Size = V(1.6, 0.8, 1.2), CFrame = at(4.8, 5, -3.4), Color = COL.plankDark, Material = PLANKS }) + -- бочки и ящики сбоку + for i, off in ipairs({ { 8.6, -2.6 }, { 9.2, 0.6 } }) do + local p = at(off[1], 1.7, off[2]).Position + vcyl(p, 3.4, 2.8, { Color = COL.log, Material = WOOD, Parent = shop }) + for _, dy in ipairs({ -1, 1 }) do + vcyl(p + V(0, dy, 0), 0.3, 2.95, { Color = COL.metal, Material = Enum.Material.Metal, Parent = shop, CanCollide = false }) + end + if i == 2 then + part({ Size = V(2.2, 2.2, 2.2), CFrame = at(9, 4.5, 0.6) * CFrame.Angles(0, 0.3, 0), Color = COL.plankDark, Material = PLANKS }) + end + end + part({ Size = V(2.6, 2.6, 2.6), CFrame = at(-9, 1.3, -1.5) * CFrame.Angles(0, 0.2, 0), Color = COL.plankDark, Material = PLANKS }) + marker("World1NpcSeller", at(0, 3.9, 1.6)) + marker("GuideSell", cf * CFrame.new(0, 0, -9)) + postLantern(at(-7.8, 0, -6.2).Position, (cf.LookVector * V(1, 0, 1)).Unit, 9) + end + leafy(W + V(-27, GROUND_Y, 70), 13) -- большое дерево над лавкой, как на макете + postLantern(W + V(7.5, GROUND_Y, 66), V(-1, 0, 0), 8) + + -- деревянная лодка с вёслами справа от причала у двух свай + do + local cf = CFrame.new(W + V(12.5, WATER_Y + 0.25, 46)) * CFrame.Angles(0, math.rad(12), 0) + local boat = Instance.new("Model") + boat.Name = "Rowboat" + boat.Parent = map + local hull, inner = Color3.fromRGB(150, 92, 52), Color3.fromRGB(196, 140, 88) + P({ Size = V(3.4, 0.4, 8.4), CFrame = cf, Color = inner, Material = PLANKS, Parent = boat }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.4, 1.7, 8.6), CFrame = cf * CFrame.new(s * 1.95, 0.7, 0.2) * CFrame.Angles(0, 0, math.rad(-s * 14)), Color = hull, Material = WOOD, Parent = boat }) + P({ Size = V(0.4, 1.7, 3), CFrame = cf * CFrame.new(s * 1.05, 0.8, -5) * CFrame.Angles(0, math.rad(s * 38), 0), Color = hull, Material = WOOD, Parent = boat }) + P({ Size = V(0.5, 0.3, 8.6), CFrame = cf * CFrame.new(s * 2.2, 1.6, 0.2), Color = COL.logDark, Material = WOOD, Parent = boat }) + local a = (cf * CFrame.new(s * 1.6, 1.4, 0.2)).Position + local b = (cf * CFrame.new(s * 5.2, -0.1, 1.4)).Position + rod(a, b, 0.22, { Color = COL.plank, Material = WOOD, CanCollide = false, Parent = boat }) + P({ Size = V(0.15, 0.9, 1.9), CFrame = CFrame.lookAt(b, b + (b - a)) * CFrame.Angles(0, math.rad(90), 0), Color = COL.plank, Material = WOOD, CanCollide = false, Parent = boat }) + end + P({ Size = V(4.4, 1.7, 0.4), CFrame = cf * CFrame.new(0, 0.7, 4.5), Color = hull, Material = WOOD, Parent = boat }) + for _, z in ipairs({ -1.6, 1.8 }) do + P({ Size = V(3.8, 0.3, 1.1), CFrame = cf * CFrame.new(0, 1.1, z), Color = inner, Material = PLANKS, Parent = boat }) + end + ropePost(9.8, 52, -6, 3.4, 1.4, boat) + ropePost(16, 40, -6, 2.8, 1.4, boat) + end + + -- за спиной игрока: портал в лобби, место деда-рыбака, доска «Кто водится в озере» + do + local baseCF = CFrame.lookAt(W + V(15, GROUND_Y, 86), W + V(0, GROUND_Y, 62)) + local color = Color3.fromRGB(255, 200, 80) + local portalModel = Instance.new("Model") + portalModel.Name = "PortalToLobby" + portalModel.Parent = map + local center = baseCF * CFrame.new(0, 10, 0) + local fancy = makePortal and makePortal(baseCF, color, "PortalModel_Lobby", portalModel) + local disc + if fancy then + -- модель из шаблона; невидимый якорь держит подсказку, подпись и искры + disc = P({ + Name = "Portal_Lobby", Size = V(1, 1, 1), CFrame = center * CFrame.Angles(0, math.rad(90), 0), + Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false, Parent = portalModel, + }) + else + P({ Size = V(17, 1, 9), CFrame = baseCF * CFrame.new(0, 0.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(95, 100, 115), Parent = portalModel }) + P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130), Parent = portalModel }) + local R, n = 7, 20 + for i = 0, n - 1 do + local a = (i + 0.5) / n * math.pi * 2 + P({ Size = V(2 * math.pi * R / n + 0.4, 1.7, 1.7), CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(80, 85, 100), Parent = portalModel }) + if i % 2 == 0 then + P({ Size = V(0.6, 0.6, 1.9), CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R + 0.95, 0), Material = Enum.Material.Neon, Color = color, Parent = portalModel }) + end + end + disc = P({ + Name = "Portal_Lobby", Shape = Enum.PartType.Cylinder, Size = V(0.3, 2 * R - 1, 2 * R - 1), CFrame = center * CFrame.Angles(0, math.rad(90), 0), + Material = Enum.Material.Neon, Color = color, Transparency = 0.3, CanCollide = false, Parent = portalModel, + }) + end + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + pe.LightEmission = 1 + pe.Rate = 25 + pe.Lifetime = NumberRange.new(1, 1.8) + pe.Speed = NumberRange.new(0.5, 2) + pe.SpreadAngle = Vector2.new(180, 180) + pe.Size = NumberSequence.new(0.5, 0) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Parent = disc + local bb = Instance.new("BillboardGui") + bb.Size = UDim2.fromOffset(250, 64) + bb.StudsOffset = V(0, fancy and 7 or 10, 0) + bb.MaxDistance = 160 + bb.LightInfluence = 0 + bb.Parent = disc + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = color:Lerp(Color3.new(1, 1, 1), 0.4) + t.TextStrokeTransparency = 0.15 + t.Text = "🏠 В лобби" + t.Parent = bb + prompt(disc, "Перейти", "🏠 В лобби", "Portal"):SetAttribute("World", "Lobby") + end + marker("World1NpcGrandpa", CFrame.lookAt(W + V(9, GROUND_Y + 3, 72), W + V(0, GROUND_Y + 3, 62))) + do + local cf = CFrame.lookAt(W + V(-12, GROUND_Y, 80), W + V(0, GROUND_Y, 62)) + for _, x in ipairs({ -5.5, 5.5 }) do + P({ Size = V(0.8, 10, 0.8), CFrame = cf * CFrame.new(x, 5, 0.3), Material = WOOD, Color = COL.logDark }) + end + P({ Name = "World1Bestiary", Size = V(12, 9, 0.5), CFrame = cf * CFrame.new(0, 6.5, 0), Material = PLANKS, Color = Color3.fromRGB(70, 48, 32) }) + end + + -------------------------------------------------- дальний берег: дом, холм с тропинкой и вышкой + logCabin("BigCabin", CFrame.lookAt(W + V(-58, GROUND_Y, -62), W + V(-20, GROUND_Y, 10)), 16, 12, 8) + postLantern(W + V(-44, GROUND_Y, -58), V(1, 0, 0), 8) + + -- столб-вывеска с зелёным знаменем и белой рыбой у начала тропинки + do + local base = W + V(-17, GROUND_Y, -80) + vcyl(base + V(0, 6, 0), 12, 0.9, { Color = COL.logDark, Material = WOOD }) + rod(base + V(0, 11.4, 0), base + V(3.6, 11.4, 0), 0.5, { Color = COL.logDark, Material = WOOD }) + local flag = P({ Size = V(3, 5, 0.2), CFrame = CFrame.lookAt(base + V(2.2, 8.6, 0), base + V(2.2, 8.6, 10)), Color = COL.banner, Material = Enum.Material.Fabric, CanCollide = false }) + surfaceText(flag, Enum.NormalId.Front, "🐟", Color3.new(1, 1, 1)) + surfaceText(flag, Enum.NormalId.Back, "🐟", Color3.new(1, 1, 1)) + end + + -- забор вдоль тропинки и фонари + do + local posts = {} + for i = 2, #HILL_PATH do + local a, b = HILL_PATH[i - 1], HILL_PATH[i] + local dx, dz = b[1] - a[1], b[2] - a[2] + local len = math.sqrt(dx * dx + dz * dz) + local nx, nz = -dz / len, dx / len -- влево от направления + for s = 0, len - 0.1, 4.5 do + local x, z = a[1] + dx * s / len + nx * 3, a[2] + dz * s / len + nz * 3 + table.insert(posts, W + V(x, hillY(x, z), z)) + end + end + for i, p in ipairs(posts) do + vcyl(p + V(0, 1.3, 0), 3, 0.45, { Color = COL.log, Material = WOOD }) + local q = posts[i + 1] + if q and (q - p).Magnitude < 8 then + for _, h in ipairs({ 1.2, 2.3 }) do + rod(p + V(0, h, 0), q + V(0, h, 0), 0.3, { Color = COL.log, Material = WOOD, CanCollide = false }) + end + end + end + for _, i in ipairs({ 2, 4 }) do + local x, z = HILL_PATH[i][1] + 3, HILL_PATH[i][2] + postLantern(W + V(x, hillY(x, z), z), V(-1, 0, 0), 7) + end + end + + -- смотровая вышка на вершине холма с зелёным флагом + do + local tower = Instance.new("Model") + tower.Name = "Watchtower" + tower.Parent = map + local c = W + V(-76, hillY(-76, -136) - 0.5, -136) + local H = 14 + local function wood(props) + props.Parent = tower + return props + end + for _, sx in ipairs({ -1, 1 }) do + for _, sz in ipairs({ -1, 1 }) do + rod(c + V(sx * 4.2, 0, sz * 4.2), c + V(sx * 3.2, H, sz * 3.2), 1.1, wood({ Color = COL.log, Material = WOOD })) + end + end + for _, y in ipairs({ 4.5, 9 }) do + for _, s in ipairs({ -1, 1 }) do + local k = 4.2 - y / H + rod(c + V(-k, y, s * k), c + V(k, y - 3, s * k), 0.4, wood({ Color = COL.logDark, Material = WOOD, CanCollide = false })) + rod(c + V(s * k, y, -k), c + V(s * k, y - 3, k), 0.4, wood({ Color = COL.logDark, Material = WOOD, CanCollide = false })) + end + end + P(wood({ Size = V(9, 0.6, 9), Position = c + V(0, H, 0), Color = COL.plank, Material = PLANKS })) + for _, s in ipairs({ -1, 1 }) do + P(wood({ Size = V(9, 1.4, 0.3), Position = c + V(0, H + 1.2, s * 4.4), Color = COL.log, Material = WOOD })) + P(wood({ Size = V(0.3, 1.4, 9), Position = c + V(s * 4.4, H + 1.2, 0), Color = COL.log, Material = WOOD })) + end + for _, sx in ipairs({ -1, 1 }) do + for _, sz in ipairs({ -1, 1 }) do + vcyl(c + V(sx * 4.2, H + 2.6, sz * 4.2), 5.2, 0.4, wood({ Color = COL.log, Material = WOOD })) + end + end + for _, s in ipairs({ -1, 1 }) do + P(wood({ Size = V(11, 0.5, 6.4), CFrame = CFrame.new(c + V(0, H + 6.2, s * 2.7)) * CFrame.Angles(s * math.rad(30), 0, 0), Color = COL.roof, Material = SMOOTH })) + end + vcyl(c + V(0, H + 10.5, 0), 7, 0.25, wood({ Color = COL.logDark, Material = WOOD })) + local flag = P(wood({ Size = V(4, 2.6, 0.15), CFrame = CFrame.new(c + V(2.1, H + 12.6, 0)), Color = COL.banner, Material = Enum.Material.Fabric, CanCollide = false })) + surfaceText(flag, Enum.NormalId.Front, "🐟", Color3.new(1, 1, 1)) + surfaceText(flag, Enum.NormalId.Back, "🐟", Color3.new(1, 1, 1)) + end + + -------------------------------------------------- северо-восток: домик с мостками, скала, водопад, мост + logCabin("SmallCabin", CFrame.lookAt(W + V(8, GROUND_Y, -96), W + V(4, GROUND_Y, 0)), 11, 9, 7) + smallDock(8, -86, -68, 6, GROUND_Y + 0.4) + postLantern(W + V(10.6, GROUND_Y + 0.4, -70), V(-1, 0, 0), 6) + + local CLIFF_FRONT = -66 -- передняя кромка скалы по Z + local RIVER_X, RIVER_W, LIP_Y = 48, 10, 35 -- русло реки над водопадом и высота уступа + local cliff = Instance.new("Model") + cliff.Name = "Cliff" + cliff.Parent = map + do + -- скала уступами: три ряда блоков всё выше к заднему плану; у русла — вровень с уступом водопада + local rows = { { CLIFF_FRONT, 14, 22 }, { CLIFF_FRONT - 18, 26, 34 }, { CLIFF_FRONT - 40, 38, 50 } } -- { кромка, мин. высота, макс. высота } + for ri, row in ipairs(rows) do + local x = 28 + while x < 116 do + local w = rng:NextNumber(11, 16) + local cx = x + w / 2 + if math.abs(cx - RIVER_X) > RIVER_W / 2 + w / 2 - 1 then + local h = rng:NextNumber(row[2], row[3]) + if ri <= 2 and math.abs(cx - RIVER_X) < 16 then + h = LIP_Y + rng:NextNumber(-0.5, 1.5) -- берега реки вровень с уступом: на них стоит мост + end + local d = rng:NextNumber(18, 24) + local cf = CFrame.new(W + V(cx, h / 2, row[1] - d / 2)) * CFrame.Angles(rng:NextNumber(-0.06, 0.06), rng:NextNumber(-0.25, 0.25), rng:NextNumber(-0.06, 0.06)) + P({ Size = V(w, h, d), CFrame = cf, Color = COL.rock:Lerp(COL.rockDark, rng:NextNumber(0, 0.5)), Material = SMOOTH, Parent = cliff }) + P({ Size = V(w - 1, 1.2, d - 1), CFrame = cf * CFrame.new(0, h / 2 + 0.3, 0), Color = COL.moss:Lerp(COL.leaf, rng:NextNumber(0, 0.5)), Material = SMOOTH, Parent = cliff }) + -- острые обломки на кромке и на гранях — чтобы скала не выглядела ровной стеной + for _ = 1, 2 do + local s = rng:NextNumber(5, 9) + local cr = crag((cf * CFrame.new(rng:NextNumber(-w / 2, w / 2), rng:NextNumber(-h / 2, h / 2 - 2), -d / 2 + s * 0.2)).Position, s) + cr.Parent = cliff + end + if rng:NextNumber() < 0.7 then + pine((cf * CFrame.new(rng:NextNumber(-w / 4, w / 4), h / 2 + 0.8, rng:NextNumber(-d / 4, d / 4))).Position, rng:NextNumber(12, 20), 3) + end + end + x += w - 0.5 + end + end + for x = 30, 112, 9 do + local cr = crag(W + V(x + rng:NextNumber(-3, 3), 2, CLIFF_FRONT + rng:NextNumber(0, 3)), rng:NextNumber(6, 11)) + cr.Parent = cliff + end + -- ложе реки и стена за водопадом, река наверху + P({ Size = V(RIVER_W + 4, LIP_Y, 70), Position = W + V(RIVER_X, LIP_Y / 2, CLIFF_FRONT - 35), Color = COL.rockDark, Material = SMOOTH, Parent = cliff }) + P({ Size = V(RIVER_W, 0.8, 70), Position = W + V(RIVER_X, LIP_Y + 0.4, CLIFF_FRONT - 35), Color = COL.water, Material = Enum.Material.Glass, Transparency = 0.15, CanCollide = false, Parent = cliff }) + for z = CLIFF_FRONT - 4, CLIFF_FRONT - 66, -7 do + for _, s in ipairs({ -1, 1 }) do + rock(W + V(RIVER_X + s * (RIVER_W / 2 + 0.5), LIP_Y + 1, z + rng:NextNumber(-2, 2)), rng:NextNumber(2.5, 4.5)).Parent = cliff + end + end + end + + -- водопад: полупрозрачная «простыня», бегущие вниз струи (Beam с текстурой), пена и туман внизу + do + local fall = Instance.new("Model") + fall.Name = "Waterfall" + fall.Parent = map + local zf = CLIFF_FRONT - 1.2 + local sheet = P({ + Size = V(RIVER_W - 1, LIP_Y + 0.8, 1), Position = W + V(RIVER_X, LIP_Y / 2, zf), + Color = Color3.fromRGB(170, 236, 240), Material = Enum.Material.Glass, Transparency = 0.25, CanCollide = false, CastShadow = false, Parent = fall, + }) + for i = 0, 4 do + local x = -RIVER_W / 2 + 1.5 + i * (RIVER_W - 3) / 4 + local a0 = Instance.new("Attachment") + a0.Position = V(x, LIP_Y / 2, -0.6) + a0.Parent = sheet + local a1 = Instance.new("Attachment") + a1.Position = V(x + rng:NextNumber(-0.5, 0.5), -LIP_Y / 2, -0.6) + a1.Parent = sheet + local b = Instance.new("Beam") + b.Attachment0, b.Attachment1 = a0, a1 + b.Texture = "rbxasset://textures/particles/smoke_main.dds" + b.TextureMode = Enum.TextureMode.Wrap + b.TextureLength = 5 + b.TextureSpeed = rng:NextNumber(1.6, 2.4) + b.Width0, b.Width1 = 2.6, 3.2 + b.FaceCamera = true + b.LightEmission = 0.35 + b.Color = ColorSequence.new(Color3.new(1, 1, 1)) + b.Transparency = NumberSequence.new(0.25) + b.Parent = sheet + end + for _ = 1, 9 do + vcyl(W + V(RIVER_X + rng:NextNumber(-6, 6), WATER_Y + 0.2, zf + rng:NextNumber(0.5, 6)), 0.5, rng:NextNumber(3, 6), { + Color = Color3.fromRGB(240, 252, 252), Material = SMOOTH, Transparency = 0.15, CanCollide = false, CastShadow = false, Parent = fall, + }) + end + local function mistAt(pos, size, rate, s0, s1) + local holder = P({ Size = size, Position = pos, Transparency = 1, CanCollide = false, CanQuery = false, Parent = fall }) + local mist = Instance.new("ParticleEmitter") + mist.Texture = "rbxasset://textures/particles/smoke_main.dds" + mist.Color = ColorSequence.new(Color3.new(1, 1, 1)) + mist.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0, s0), NumberSequenceKeypoint.new(1, s1) }) + mist.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.45), NumberSequenceKeypoint.new(1, 1) }) + mist.Lifetime = NumberRange.new(2, 3.5) + mist.Rate = rate + mist.Speed = NumberRange.new(2, 5) + mist.SpreadAngle = Vector2.new(70, 70) + mist.Parent = holder + end + mistAt(W + V(RIVER_X, WATER_Y + 1, zf + 2), V(RIVER_W, 1, 2), 14, 4, 11) + mistAt(W + V(RIVER_X, LIP_Y, zf), V(RIVER_W, 1, 1), 5, 2, 5) + end + + -- арочный деревянный мост через реку над водопадом + do + local bridge = Instance.new("Model") + bridge.Name = "Bridge" + bridge.Parent = map + local z, x0, x1, y0, rise = CLIFF_FRONT - 22, RIVER_X - 11, RIVER_X + 11, LIP_Y + 1, 3.2 + local N = 12 + local function arc(t) + return W + V(x0 + (x1 - x0) * t, y0 + math.sin(t * math.pi) * rise, z) + end + for i = 0, N - 1 do + local a, b = arc(i / N), arc((i + 1) / N) + P({ Size = V((b - a).Magnitude + 0.1, 0.5, 5), CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0), Color = COL.plank:Lerp(COL.plankDark, (i % 2) * 0.4), Material = PLANKS, Parent = bridge }) + end + for _, s in ipairs({ -1, 1 }) do + local prev + for i = 0, N, 2 do + local p = arc(i / N) + V(0, 0, s * 2.3) + vcyl(p + V(0, 1.4, 0), 2.8, 0.4, { Color = COL.log, Material = WOOD, Parent = bridge }) + if prev then + rod(prev + V(0, 2.6, 0), p + V(0, 2.6, 0), 0.32, { Color = COL.log, Material = WOOD, Parent = bridge }) + end + prev = p + end + end + end + + -------------------------------------------------- у воды: камни, рогоз, кувшинки + local function nearDock(x, z) + return math.abs(x) < 9 and z > 28 and z < 70 + end + local function inCliff(x, z) + return x > 24 and x < 118 and z < -58 and z > -150 + end + for _, l in ipairs(LAKES) do + for _ = 1, 9 do + local a = rng:NextNumber(0, math.pi * 2) + local r = l[3] + rng:NextNumber(-1, 2.5) + local x, z = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r + if not inLake(x, z, -4) and not nearDock(x, z) and not inCliff(x, z) then + rock(W + V(x, rng:NextNumber(0.5, 2.5), z), rng:NextNumber(2.5, 5.5)) + end + end + for _ = 1, 5 do + local a = rng:NextNumber(0, math.pi * 2) + local r = l[3] + rng:NextNumber(-1.5, 0.5) + local x, z = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r + if not inLake(x, z, -3) and not nearDock(x, z) and not inCliff(x, z) then + cattails(W + V(x, WATER_Y - 0.5, z)) + end + end + end + for _, p in ipairs({ { 11, 55 }, { 15, 52 }, { -9, 53 }, { 20, 47 } }) do -- рогоз в правом нижнем углу кадра + cattails(W + V(p[1], WATER_Y - 0.5, p[2])) + end + for _ = 1, 14 do -- кувшинки группами + local l = LAKES[rng:NextInteger(1, #LAKES)] + local a = rng:NextNumber(0, math.pi * 2) + local r = l[3] * rng:NextNumber(0.5, 0.88) + local cx, cz = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r + for _ = 1, rng:NextInteger(2, 5) do + local x, z = cx + rng:NextNumber(-3, 3), cz + rng:NextNumber(-3, 3) + if inLake(x, z, -2) and not nearDock(x, z) and not (x > 6 and x < 20 and z > 36 and z < 56) then + local size = rng:NextNumber(2, 3.4) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.15, size, size), CFrame = CFrame.new(W + V(x, WATER_Y + 0.12, z)) * CFrame.Angles(0, 0, math.rad(90)), Color = Color3.fromRGB(78, 168, 70):Lerp(Color3.fromRGB(110, 190, 80), rng:NextNumber()), Material = SMOOTH, CanCollide = false, CastShadow = false }) + if rng:NextNumber() < 0.35 then + ball(W + V(x + 0.3, WATER_Y + 0.45, z), 0.8, { Color = Color3.fromRGB(255, 150, 195), Material = SMOOTH, CanCollide = false, CastShadow = false }) + ball(W + V(x + 0.3, WATER_Y + 0.75, z), 0.4, { Color = Color3.fromRGB(255, 235, 120), Material = SMOOTH, CanCollide = false, CastShadow = false }) + end + end + end + end + + -------------------------------------------------- лес, кусты, цветы + local function nearPath(x, z, dist) + for i = 2, #HILL_PATH do + local a, b = HILL_PATH[i - 1], HILL_PATH[i] + local abx, abz = b[1] - a[1], b[2] - a[2] + local t = math.clamp(((x - a[1]) * abx + (z - a[2]) * abz) / (abx * abx + abz * abz), 0, 1) + if (x - a[1] - abx * t) ^ 2 + (z - a[2] - abz * t) ^ 2 < dist * dist then + return true + end + end + return false + end + local function freeSpot(x, z) + if math.abs(x) > 236 or math.abs(z) > 236 or inLake(x, z, 6) or inCliff(x, z) or nearPath(x, z, 6) then + return false + end + if x > -32 and x < 30 and z > 44 and z < 100 then -- прибытие, лавка, портал + return false + end + for _, c in ipairs({ { -58, -62, 16 }, { 8, -96, 13 }, { -76, -136, 11 }, { -17, -80, 5 } }) do + if (x - c[1]) ^ 2 + (z - c[2]) ^ 2 < c[3] * c[3] then + return false + end + end + return not (x > 2 and x < 14 and z > -100 and z < -64) -- мостки у домика + end + + local placed = 0 + for _ = 1, 700 do + if placed >= 210 then + break + end + local x, z = rng:NextNumber(-236, 236), rng:NextNumber(-236, 236) + -- за озером лес гуще, перед ним (за спиной игрока) реже + if (z < 0 or rng:NextNumber() < 0.45) and freeSpot(x, z) then + local far = math.max(math.abs(x), math.abs(z)) > 150 + pine(W + V(x, hillY(x, z) - 0.3, z), far and rng:NextNumber(22, 32) or rng:NextNumber(15, 25), far and 2 or 3) + placed += 1 + end + end + for _ = 1, 25 do -- лиственные деревья у берегов + local l = LAKES[rng:NextInteger(1, #LAKES)] + local a = rng:NextNumber(0, math.pi * 2) + local r = l[3] + rng:NextNumber(8, 18) + local x, z = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r + if freeSpot(x, z) then + leafy(W + V(x, hillY(x, z) - 0.3, z), rng:NextNumber(8, 12)) + end + end + for _ = 1, 50 do -- кусты + local x, z = rng:NextNumber(-150, 150), rng:NextNumber(-150, 120) + if freeSpot(x, z) then + local y = hillY(x, z) + local c = COL.leafDark:Lerp(COL.leaf, rng:NextNumber()) + for _ = 1, 3 do + ball(W + V(x + rng:NextNumber(-1.5, 1.5), y + 0.8, z + rng:NextNumber(-1.5, 1.5)), rng:NextNumber(2.5, 4), { Color = c, Material = SMOOTH, CanCollide = false }) + end + end + end + for _ = 1, 80 do -- цветы + local x, z = rng:NextNumber(-120, 120), rng:NextNumber(-140, 110) + if freeSpot(x, z) or nearPath(x, z, 6) and not nearPath(x, z, 3) then + ball(W + V(x, hillY(x, z) + 0.4, z), 0.6, { + Color = ({ Color3.fromRGB(255, 120, 150), Color3.fromRGB(255, 230, 90), Color3.fromRGB(245, 245, 255), Color3.fromRGB(190, 140, 255) })[rng:NextInteger(1, 4)], + Material = SMOOTH, CanCollide = false, CastShadow = false, + }) + end + end + -- отдельные детали (деревья, камни, кусты, фонари) — в папку Decor, чтобы в Explorer было видно + -- главное: модели и маркеры World1*/Guide* + local decor = Instance.new("Folder") + decor.Name = "Decor" + decor.Parent = map + for _, c in ipairs(map:GetChildren()) do + if c:IsA("BasePart") and not c.Name:match("^World1") and not c.Name:match("^Guide") then + c.Parent = decor + end + end + + -------------------------------------------------- горизонт: горы и облака + do + local horizon = Instance.new("Folder") + horizon.Name = "Horizon" + horizon.Parent = map + -- гора — несколько острых пиков (кубы вершиной вверх) разного размера + local function mountain(a, dist, s) + local base = W + V(math.cos(a) * dist, 0, math.sin(a) * dist) + for k = 1, 3 do + local ss = k == 1 and s or s * rng:NextNumber(0.45, 0.7) + local off = k == 1 and V(0, 0, 0) or V(rng:NextNumber(-0.7, 0.7) * s, 0, rng:NextNumber(-0.4, 0.4) * s) + local apex = ss * rng:NextNumber(0.55, 0.75) -- высота пика над землёй + P({ + Size = V(ss, ss, ss), + CFrame = CFrame.new(base + off + V(0, apex - ss * 0.866, 0)) * CFrame.Angles(rng:NextNumber(-0.1, 0.1), rng:NextNumber(0, 6.28), rng:NextNumber(-0.1, 0.1)) * CUBE_UP, + Color = Color3.fromRGB(152, 166, 190):Lerp(Color3.fromRGB(118, 134, 164), rng:NextNumber()), Material = SMOOTH, + CanCollide = false, CanQuery = false, CastShadow = false, Parent = horizon, + }) + end + end + for i = 0, 13 do -- север (за озером) — крупнее и плотнее + mountain(math.rad(-160 + i * 10 + rng:NextNumber(-4, 4)), rng:NextNumber(340, 470), rng:NextNumber(130, 220)) + end + for i = 0, 9 do -- остальные стороны + mountain(math.rad(20 + i * 16 + rng:NextNumber(-5, 5)), rng:NextNumber(360, 480), rng:NextNumber(100, 160)) + end + for _ = 1, 9 do + local c = W + V(rng:NextNumber(-380, 380), rng:NextNumber(170, 230), rng:NextNumber(-420, 200)) + for _ = 1, rng:NextInteger(4, 6) do + ball(c + V(rng:NextNumber(-30, 30), rng:NextNumber(-5, 8), rng:NextNumber(-12, 12)), rng:NextNumber(22, 42), { + Color = Color3.new(1, 1, 1), Material = SMOOTH, CanCollide = false, CanQuery = false, CastShadow = false, Parent = horizon, + }) + end + end + end + + -- невидимые стены по краю мира + for _, w in ipairs({ + { V(0, 0, 245), V(500, 120, 2) }, + { V(0, 0, -245), V(500, 120, 2) }, + { V(245, 0, 0), V(2, 120, 500) }, + { V(-245, 0, 0), V(2, 120, 500) }, + }) do + P({ Name = "WorldWall", Size = w[2], Position = W + w[1] + V(0, 50, 0), Transparency = 1, CanQuery = false }) + end + + map.Parent = parent + return map +end + +-- сборка в Studio: стирает старую папку и террейн мира, строит заново прямо в Workspace +function Builder.bake() + local old = Workspace:FindFirstChild("World1Map") + if old then + old:Destroy() + end + terrain:FillBlock(CFrame.new(W + V(0, 30, 0)), V(504, 120, 504), Enum.Material.Air) + local map = Builder.build(Workspace) + print(("✅ «Тихое озеро» собрано: Workspace.World1Map, деталей: %d. Сохраните плейс (Ctrl+S)."):format(#map:GetDescendants())) + return map +end + +return Builder +]=====]) +put('ModuleScript', 'WorldBuilder', game.ServerScriptService, [=====[-- WorldBuilder (ModuleScript) -> ServerScriptService +-- Строит всю карту: лобби и все миры (папка Workspace.FishingMap + террейн миров). +-- Карту собирают ОДИН РАЗ прямо в Roblox Studio, в режиме редактирования, и сохраняют плейс: +-- после этого всё видно в редакторе и правится руками как обычные детали и модели. +-- Команда для Command Bar (строка внизу Studio): +-- require(game.ServerScriptService.WorldBuilder:Clone()).bake() +-- bake() стирает Workspace.FishingMap и террейн миров и строит всё заново. +-- Если FishingMap в плейсе нет, MapBuilder при запуске игры строит карту этим же модулем. +-- +-- Что нужно игре от карты (не удаляйте и не переименовывайте): +-- маркеры-плитки (*Spawn, Guide*, LobbySpawn) — их можно двигать; +-- детали NpcSpot / World1Npc* с атрибутом NpcName — на них при запуске встают NPC +-- (полупрозрачные фигуры в редакторе, в игре скрыты); внешность — в атрибутах детали; +-- доски с атрибутом Bestiary — текст «кто водится» пишется при запуске по FishConfig; +-- ProximityPrompt с атрибутом Action (Shop, Sell, Portal, Daily, Talk, ...). + +local Workspace = game:GetService("Workspace") +local ServerStorage = game:GetService("ServerStorage") +local Lighting = game:GetService("Lighting") +local Players = game:GetService("Players") +local RunService = game:GetService("RunService") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local ServerScriptService = game:GetService("ServerScriptService") + +-- в Command Bar require кэширует модули: берём копии, чтобы подхватывать свежие правки из Rojo +-- (копия на время загрузки лежит рядом с оригиналом — модули ищут соседей через script.Parent) +local function load(module) + if RunService:IsRunning() then + return require(module) + end + local copy = module:Clone() + copy.Parent = module.Parent + local ok, result = pcall(require, copy) + copy:Destroy() + if not ok then + error(result, 0) + end + return result +end +local Config = load(ReplicatedStorage:WaitForChild("FishConfig")) +local Models = load(ReplicatedStorage:WaitForChild("GameModels")) +local World1Builder = load(ServerScriptService:WaitForChild("World1Builder")) + +local V = Vector3.new +local terrain = Workspace.Terrain +local GROUND_Y = 4 -- верх земли в мирах (запасная высота для groundY) +local FLOOR = 1 -- верх пола лобби + +local Builder = {} +local map -- папка FishingMap, которую сейчас строим +local rng = Random.new(7) + +---------------------------------------------------------------- свет и атмосфера + +local function ensure(class, parent, props) + local obj = parent:FindFirstChildOfClass(class) or Instance.new(class) + for k, v in pairs(props) do + obj[k] = v + end + obj.Parent = parent + return obj +end + +-- Базовый свет при запуске игры (совпадает со светом лобби). Под каждую локацию его меняет клиент +-- по полям look из FishConfig, пока игрок за экраном загрузки. +function Builder.applyLighting() + Lighting.ClockTime = 16.3 + Lighting.Brightness = 2.0 + Lighting.ExposureCompensation = -0.3 + Lighting.Ambient = Color3.fromRGB(64, 60, 72) + Lighting.OutdoorAmbient = Color3.fromRGB(120, 114, 124) + Lighting.ColorShift_Top = Color3.fromRGB(255, 224, 186) + Lighting.EnvironmentDiffuseScale = 0.5 + Lighting.EnvironmentSpecularScale = 0.5 + Lighting.GlobalShadows = true + ensure("Atmosphere", Lighting, { + Density = 0.4, Offset = 0.18, Glare = 0.25, Haze = 1.6, + Color = Color3.fromRGB(222, 212, 204), Decay = Color3.fromRGB(186, 160, 150), + }) + ensure("BloomEffect", Lighting, { Intensity = 0.3, Size = 24, Threshold = 1.8 }) + ensure("ColorCorrectionEffect", Lighting, { + Saturation = 0.18, Contrast = 0.14, Brightness = -0.04, TintColor = Color3.fromRGB(255, 242, 228), + }) + ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.7 }) + -- размытие дальнего плана включают миры и лобби через look.dof + ensure("DepthOfFieldEffect", Lighting, { Enabled = false, FarIntensity = 0.18, FocusDistance = 55, InFocusRadius = 95, NearIntensity = 0 }) +end + +---------------------------------------------------------------- помощники + +local function P(props) + local p = Instance.new("Part") + if props.Shape then + p.Shape = props.Shape + end + p.Anchored = true + p.TopSurface = Enum.SurfaceType.Smooth + p.BottomSurface = Enum.SurfaceType.Smooth + for k, v in pairs(props) do + if k ~= "Parent" and k ~= "Shape" then + p[k] = v + end + end + p.Parent = props.Parent or map + return p +end + +local function vcyl(pos, h, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(h, d, d) + props.CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)) + return P(props) +end + +local function ball(pos, d, props) + props.Shape = Enum.PartType.Ball + props.Size = V(d, d, d) + props.Position = pos + return P(props) +end + +local function surfaceText(part, face, text, color, extra) + local sg = Instance.new("SurfaceGui") + sg.Face = face + sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud + sg.PixelsPerStud = 40 + sg.LightInfluence = 0 + sg.Parent = part + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.RichText = true + t.TextColor3 = color or Color3.new(1, 1, 1) + t.TextStrokeTransparency = 0.4 + t.Text = text + t.Parent = sg + local pad = Instance.new("UIPadding") + pad.PaddingLeft = UDim.new(0.05, 0) + pad.PaddingRight = UDim.new(0.05, 0) + pad.PaddingTop = UDim.new(0.06, 0) + pad.PaddingBottom = UDim.new(0.06, 0) + pad.Parent = t + for k, v in pairs(extra or {}) do + t[k] = v + end + return t +end + +local function billboard(target, text, color, offsetY, width) + local bb = Instance.new("BillboardGui") + bb.Size = UDim2.fromOffset(width or 300, 64) + bb.StudsOffset = V(0, offsetY or 5, 0) + bb.MaxDistance = 160 + bb.LightInfluence = 0 + bb.Parent = target + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = color or Color3.new(1, 1, 1) + t.TextStrokeTransparency = 0.15 + t.Text = text + t.Parent = bb + return bb +end + +local function prompt(target, actionText, objectText, action, dist) + local pp = Instance.new("ProximityPrompt") + pp.ActionText = actionText + pp.ObjectText = objectText + pp.HoldDuration = 0 + pp.MaxActivationDistance = dist or 13 + pp.RequiresLineOfSight = false + pp:SetAttribute("Action", action) + pp.Parent = target + return pp +end + +local function marker(name, cf) + return P({ Name = name, Size = V(4, 1, 4), CFrame = cf, Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false }) +end + +local function lobbyCliffs() + local template = ServerStorage:FindFirstChild("FishingCliffTemplate") + if not template or not template:IsA("Model") then + warn("FishingCliffTemplate отсутствует; используем низкую изгородь лобби") + for deg = 0, 359, 7 do + local a = math.rad(deg) + local p = V(math.cos(a) * 82, FLOOR + 2, math.sin(a) * 82) + P({ Size = V(10.5, 4, 3), CFrame = CFrame.lookAt(p, V(0, p.Y, 0)), Material = Enum.Material.Grass, Color = Color3.fromRGB(60, 130, 55) }) + end + return + end + + local ring = Instance.new("Folder") + ring.Name = "LobbyCliffs" + ring.Parent = map + local count = 24 + local tiers = { + { name = "LobbyCliff", radius = 88, scale = 1.4, baseY = FLOOR }, + { name = "LobbyCliffUpper", radius = 104, scale = 2.2, baseY = FLOOR + 10 }, + } + for _, tier in ipairs(tiers) do + for i = 1, count do + local angle = (i - 1) * 2 * math.pi / count + local radial = V(math.cos(angle), 0, math.sin(angle)) + local center = V(radial.X * tier.radius, tier.baseY, radial.Z * tier.radius) + local model = template:Clone() + model.Name = string.format("%s_%02d", tier.name, i) + model:ScaleTo(tier.scale) + local facing = CFrame.lookAt(center, center + radial) + local rotation = facing - facing.Position + model:PivotTo(CFrame.new(center) * rotation) + local boxCF, boxSize = model:GetBoundingBox() + local targetBoxCenter = V(center.X, tier.baseY + boxSize.Y / 2, center.Z) + model:PivotTo(model:GetPivot() + (targetBoxCenter - boxCF.Position)) + model.Parent = ring + end + end +end + +local function rockTopPosition(cliffs, radial, desiredRadius, radiusOffsets) + local params = RaycastParams.new() + params.FilterType = Enum.RaycastFilterType.Include + params.FilterDescendantsInstances = { cliffs } + for _, offset in ipairs(radiusOffsets) do + local radius = desiredRadius + offset + local origin = V(radial.X * radius, 128, radial.Z * radius) + local hit = Workspace:Raycast(origin, V(0, -180, 0), params) + if hit then + return hit.Position + end + end + return V(radial.X * desiredRadius, FLOOR, radial.Z * desiredRadius) +end + +local function placeModelOnRock(model, position, yaw) + local rotation = CFrame.Angles(0, yaw, 0) + model:PivotTo(CFrame.new(position) * rotation) + local boxCF, boxSize = model:GetBoundingBox() + local targetBoxCenter = V(position.X, position.Y + boxSize.Y / 2, position.Z) + model:PivotTo(model:GetPivot() + (targetBoxCenter - boxCF.Position)) +end + +local function lobbyTrees() + local templates = ServerStorage:FindFirstChild("LobbyTreeTemplates") + local cliffs = map:FindFirstChild("LobbyCliffs") + if not templates or not cliffs then + warn("LobbyTreeTemplates или LobbyCliffs отсутствует; деревья лобби пропущены") + return + end + local treeTypes = { "LargeCanopy", "Pine", "RoundCanopy" } + local treeScale = { LargeCanopy = 1, Pine = 1.25, RoundCanopy = 1.2 } + local folder = Instance.new("Folder") + folder.Name = "LobbyTrees" + folder.Parent = map + for layer = 1, 2 do + local baseRadius = layer == 1 and 84 or 96 + local radiusOffsets = { 0, -2, 2, -4, 4, -6, 6 } + for i = 1, 18 do + local degrees = (i - 1) * 20 + 10 + (layer == 2 and 10 or 0) + local angle = math.rad(degrees) + local radial = V(math.cos(angle), 0, math.sin(angle)) + local position = rockTopPosition(cliffs, radial, baseRadius, radiusOffsets) + local kind = treeTypes[(i + layer - 2) % #treeTypes + 1] + local template = templates:FindFirstChild(kind) + if template and template:IsA("Model") then + local model = template:Clone() + model.Name = string.format("LobbyTree_L%d_%02d_%s", layer, i, kind) + model:ScaleTo(treeScale[kind]) + placeModelOnRock(model, position, math.rad((i * 47 + layer * 23) % 360)) + for _, part in ipairs(model:GetDescendants()) do + if part:IsA("BasePart") then part.Anchored = true end + end + model.Parent = folder + end + end + end +end + +local function lobbyRockPlants() + local templates = ServerStorage:FindFirstChild("LobbyRockPlantTemplates") + local cliffs = map:FindFirstChild("LobbyCliffs") + if not templates or not cliffs then + warn("LobbyRockPlantTemplates или LobbyCliffs отсутствует; растительность скал пропущена") + return + end + local folder = Instance.new("Folder") + folder.Name = "LobbyRockPlants" + folder.Parent = map + local clusterAngles = { + { layer = 1, degrees = 45 }, { layer = 1, degrees = 135 }, + { layer = 1, degrees = 225 }, { layer = 1, degrees = 315 }, + { layer = 2, degrees = 0 }, { layer = 2, degrees = 90 }, + { layer = 2, degrees = 180 }, { layer = 2, degrees = 270 }, + } + local tuftKinds = { "GrassTuft", "BladeGrass", "GrassTuft", "FlowerPatch", "GrassTuft", "WideGrass" } + local tuftScales = { GrassTuft = 1.15, BladeGrass = 1.45, FlowerPatch = 1.1, WideGrass = 0.55 } + local offsets = { { 0, 0 }, { -2.2, 0 }, { 2.2, 0 }, { 0, -2.2 }, { 0, 2.2 }, { 1.6, 1.6 } } + local rayParams = RaycastParams.new() + rayParams.FilterType = Enum.RaycastFilterType.Include + rayParams.FilterDescendantsInstances = { cliffs } + for clusterIndex, cluster in ipairs(clusterAngles) do + local baseRadius = cluster.layer == 1 and 84 or 96 + local baseAngle = math.rad(cluster.degrees) + local radial = V(math.cos(baseAngle), 0, math.sin(baseAngle)) + local tangent = V(-radial.Z, 0, radial.X) + local basePos = rockTopPosition(cliffs, radial, baseRadius, { 0, -2, 2, -4, 4, -6, 6 }) + local bush = Instance.new("Model") + bush.Name = string.format("GrassBush_%02d_L%d", clusterIndex, cluster.layer) + for i, offset in ipairs(offsets) do + local xz = basePos + radial * offset[1] + tangent * offset[2] + local plantPos + for _, correction in ipairs({ 0, -2, 2, -4, 4 }) do + local candidate = xz + radial * correction + local hit = Workspace:Raycast(V(candidate.X, 128, candidate.Z), V(0, -180, 0), rayParams) + if hit then plantPos = hit.Position; break end + end + if plantPos then + local kind = tuftKinds[i] + local template = templates:FindFirstChild(kind) + if template and template:IsA("Model") then + local plant = template:Clone() + plant.Name = kind .. "_" .. i + plant:ScaleTo(tuftScales[kind]) + placeModelOnRock(plant, plantPos, math.rad((clusterIndex * 37 + i * 53) % 360)) + for _, part in ipairs(plant:GetDescendants()) do + if part:IsA("BasePart") then part.Anchored = true end + end + plant.Parent = bush + end + end + end + bush.Parent = folder + end +end +-- холмы и горы за скалами лобби (террейн), ельники на склонах и кольцо тумана за горами. +-- К горизонту холмы выше, чтобы из лобби было видно не пустоту, а гряду в дымке. +local function lobbyHillHeight(x, z) + local r = math.sqrt(x * x + z * z) + if r < 120 then + return nil + end + local t = math.clamp((r - 120) / 220, 0, 1) + local base = 22 + 90 * t ^ 0.85 + local n = math.noise(x / 95, z / 95, 1.7) * 30 + math.noise(x / 38, z / 38, 5.1) * 9 + local peak = math.max(0, math.noise(x / 150, z / 150, 9.3)) * 70 * t + local edge = math.clamp((r - 120) / 12, 0, 1) + return (base + n * (0.35 + 0.65 * t) + peak) * edge +end + +local function lobbyHills() + local R, Y0, Y1, CH = 384, -8, 232, 64 + for cx = -R, R - CH, CH do + for cz = -R, R - CH, CH do + -- чанк целиком внутри лобби пропускаем + local far = math.sqrt(math.max(cx * cx, (cx + CH) ^ 2) + math.max(cz * cz, (cz + CH) ^ 2)) + if far >= 120 then + local region = Region3.new(V(cx, Y0, cz), V(cx + CH, Y1, cz + CH)) + local nx, ny, nz = CH / 4, (Y1 - Y0) / 4, CH / 4 + local mats, occs = {}, {} + for i = 1, nx do + mats[i], occs[i] = {}, {} + for j = 1, ny do + mats[i][j], occs[i][j] = {}, {} + end + for k = 1, nz do + local x, z = cx + (i - 0.5) * 4, cz + (k - 0.5) * 4 + local h = (math.sqrt(x * x + z * z) <= R) and lobbyHillHeight(x, z) or nil + for j = 1, ny do + local yb = Y0 + (j - 1) * 4 + local occ = h and math.clamp((h - yb) / 4, 0, 1) or 0 + local m = Enum.Material.Air + if occ > 0 then + if yb > h - 6 then + m = h > 118 and Enum.Material.Rock or Enum.Material.Grass + else + m = Enum.Material.Ground + end + end + mats[i][j][k], occs[i][j][k] = m, occ + end + end + end + terrain:WriteVoxels(region, 4, mats, occs) + end + end + end + + -- ельники пятнами на склонах + local pines = ServerStorage:FindFirstChild("OldPines") + local forest = Instance.new("Folder") + forest.Name = "LobbyHillForest" + forest.Parent = map + if pines and #pines:GetChildren() > 0 then + local templates = pines:GetChildren() + local frng = Random.new(1104) + local placed = {} + for _ = 1, 4000 do + if #placed >= 170 then break end + local a = frng:NextNumber(0, math.pi * 2) + local r = frng:NextNumber(132, 300) + local x, z = math.cos(a) * r, math.sin(a) * r + -- высоту берём из той же формулы: лучи по только что залитому террейну в редакторе ненадёжны + local h = lobbyHillHeight(x, z) + local slope = h and math.max(math.abs((lobbyHillHeight(x + 4, z) or h) - h), math.abs((lobbyHillHeight(x, z + 4) or h) - h)) / 4 + if h and h <= 118 and slope < 0.8 and math.noise(x / 60, z / 60, 3.3) > -0.05 then + local ground = V(x, h, z) + local ok = true + for _, q in ipairs(placed) do + if (q - ground).Magnitude < 9 then ok = false break end + end + if ok then + local m = templates[frng:NextInteger(1, #templates)]:Clone() + for _, d in ipairs(m:GetDescendants()) do + if d:IsA("LuaSourceContainer") then + d:Destroy() + elseif d:IsA("BasePart") then + d.Anchored = true + d.CanCollide = false + d.CastShadow = false + end + end + m:ScaleTo(m:GetScale() * frng:NextNumber(0.8, 1.5)) + m:PivotTo(CFrame.new(ground) * CFrame.Angles(0, frng:NextNumber(0, math.pi * 2), 0)) + local bcf, bsz = m:GetBoundingBox() + m:PivotTo(m:GetPivot() + V(0, ground.Y - (bcf.Position.Y - bsz.Y / 2) - 1, 0)) + m.Parent = forest + table.insert(placed, ground) + end + end + end + end + + -- туман за горами: медленные крупные клубы по двум кольцам + local haze = Instance.new("Folder") + haze.Name = "LobbyHaze" + haze.Parent = map + for ring, cfg in ipairs({ { r = 150, n = 28, y = 18, size = 45 }, { r = 250, n = 36, y = 40, size = 70 } }) do + for i = 1, cfg.n do + local a = (i - 1) / cfg.n * math.pi * 2 + local x, z = math.cos(a) * cfg.r, math.sin(a) * cfg.r + local h = lobbyHillHeight(x, z) or 0 + local anchor = Instance.new("Part") + anchor.Name = "HazeAnchor" + anchor.Anchored = true + anchor.CanCollide = false + anchor.CanQuery = false + anchor.CanTouch = false + anchor.Transparency = 1 + anchor.Size = V(30, 4, 30) + anchor.CFrame = CFrame.new(x, h + cfg.y, z) + anchor.Parent = haze + local pe = Instance.new("ParticleEmitter") + pe.Texture = "rbxasset://textures/particles/smoke_main.dds" + pe.Color = ColorSequence.new(Color3.fromRGB(236, 228, 220)) + pe.LightEmission = 0.15 + pe.LightInfluence = 0.6 + pe.Rate = ring == 1 and 0.5 or 0.35 + pe.Lifetime = NumberRange.new(16, 22) + pe.Speed = NumberRange.new(0.3, 0.8) + pe.SpreadAngle = Vector2.new(60, 60) + pe.Rotation = NumberRange.new(0, 360) + pe.RotSpeed = NumberRange.new(-4, 4) + pe.Size = NumberSequence.new({ + NumberSequenceKeypoint.new(0, cfg.size * 0.7), + NumberSequenceKeypoint.new(1, cfg.size * 1.2), + }) + pe.Transparency = NumberSequence.new({ + NumberSequenceKeypoint.new(0, 1), + NumberSequenceKeypoint.new(0.3, 0.8), + NumberSequenceKeypoint.new(0.7, 0.82), + NumberSequenceKeypoint.new(1, 1), + }) + pe.Parent = anchor + end + end +end + +-- высота земли: читаем воксели столбца (лучи по только что залитому террейну ненадёжны, особенно в редакторе) +local function groundY(x, z) + local region = Region3.new(V(x - 1, -128, z - 1), V(x + 1, 160, z + 1)):ExpandToGrid(4) + local ok, mats, occ = pcall(terrain.ReadVoxels, terrain, region, 4) + if ok then + local bottom = region.CFrame.Position.Y - region.Size.Y / 2 + for y = mats.Size.Y, 1, -1 do + local m = mats[1][y][1] + if m ~= Enum.Material.Air and m ~= Enum.Material.Water then + return bottom + (y - 1 + occ[1][y][1]) * 4, m + end + end + end + return GROUND_Y +end + +local function lamp(pos, color) + vcyl(pos + V(0, 4.5, 0), 9, 0.5, { Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + P({ Size = V(1.4, 0.3, 1.4), Position = pos + V(0, 9.1, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + local bulb = P({ Size = V(1, 1.4, 1), Position = pos + V(0, 9.95, 0), Material = Enum.Material.Neon, Color = color or Color3.fromRGB(255, 215, 150) }) + P({ Size = V(1.5, 0.35, 1.5), Position = pos + V(0, 10.8, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + local light = Instance.new("PointLight") + light.Range = 16 + light.Brightness = 1.2 + light.Color = color or Color3.fromRGB(255, 210, 150) + light.Parent = bulb +end + +local function tree(pos, kind) + if kind == "pine" then + local h = rng:NextNumber(8, 12) + vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(95, 65, 40), Material = Enum.Material.Wood }) + for i = 0, 3 do + ball(pos + V(0, h * 0.4 + i * 2.8, 0), 10 - i * 2.2, { Color = Color3.fromRGB(35, 100 + i * 10, 55), Material = Enum.Material.Grass }) + end + else + local birch = kind == "birch" + local h = rng:NextNumber(7, 10) + vcyl(pos + V(0, h / 2, 0), h, 1.5, { + Color = birch and Color3.fromRGB(225, 222, 210) or Color3.fromRGB(105, 72, 45), + Material = Enum.Material.Wood, + }) + local leaf = birch and Color3.fromRGB(150, 195, 80) or Color3.fromRGB(65, rng:NextInteger(135, 165), 60) + local s = rng:NextNumber(9, 12) + ball(pos + V(0, h + s * 0.25, 0), s, { Color = leaf, Material = Enum.Material.Grass }) + ball(pos + V(s * 0.35, h - 0.5, s * 0.1), s * 0.7, { Color = leaf, Material = Enum.Material.Grass }) + ball(pos + V(-s * 0.3, h - 0.2, -s * 0.2), s * 0.65, { Color = leaf, Material = Enum.Material.Grass }) + end +end + +local function bush(pos) + local c = Color3.fromRGB(55, rng:NextInteger(120, 150), 55) + for i = 1, 3 do + ball(pos + V(rng:NextNumber(-1.5, 1.5), 1, rng:NextNumber(-1.5, 1.5)), rng:NextNumber(2.5, 4), { Color = c, Material = Enum.Material.Grass }) + end + if rng:NextNumber() < 0.5 then + for i = 1, 4 do + ball(pos + V(rng:NextNumber(-1.8, 1.8), rng:NextNumber(1.5, 2.6), rng:NextNumber(-1.8, 1.8)), 0.5, { + Color = ({ Color3.fromRGB(255, 120, 150), Color3.fromRGB(255, 230, 90), Color3.fromRGB(240, 240, 255) })[rng:NextInteger(1, 3)], + CanCollide = false, + }) + end + end +end + +local function bench(cf) + local seat = Instance.new("Seat") + seat.Anchored = true + seat.Size = V(5, 0.4, 1.6) + seat.CFrame = cf * CFrame.new(0, 1.6, 0) + seat.Material = Enum.Material.WoodPlanks + seat.Color = Color3.fromRGB(150, 105, 65) + seat.TopSurface = Enum.SurfaceType.Smooth + seat.Parent = map + for _, x in ipairs({ -2.1, 2.1 }) do + P({ Size = V(0.4, 1.4, 1.4), CFrame = cf * CFrame.new(x, 0.7, 0), Color = Color3.fromRGB(50, 50, 55), Material = Enum.Material.Metal }) + end + P({ Size = V(5, 1.3, 0.3), CFrame = cf * CFrame.new(0, 2.6, 0.75) * CFrame.Angles(math.rad(-10), 0, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 105, 65) }) +end + +-- место NPC: полупрозрачная фигура в редакторе; сам NPC встаёт сюда при запуске (prepareRuntime) +local function setNpc(part, name, colors, action, actionText) + part:SetAttribute("NpcName", name) + part:SetAttribute("SkinColor", colors.skin) + part:SetAttribute("ShirtColor", colors.shirt) + part:SetAttribute("PantsColor", colors.pants) + part:SetAttribute("HatColor", colors.hat) + part:SetAttribute("NpcAction", action) + part:SetAttribute("NpcActionText", actionText) + part.Size = V(2, 5, 1) + part.Color = colors.shirt + part.Transparency = 0.5 + part.CanCollide = false + part.CanQuery = false + part.CanTouch = false + return part +end + +local function npc(name, cf, colors, action, actionText) + return setNpc(P({ Name = "NpcSpot", CFrame = cf }), name, colors, action, actionText) +end + +-- доска «кто водится»: атрибуты Bestiary (зона), BestiaryTitle, BestiaryHex; текст пишется заново при запуске +local function writeBestiary(board) + local old = board:FindFirstChild("BestiaryText") + if old then + old:Destroy() + end + local zone = Config.Zones[board:GetAttribute("Bestiary")] + if not zone then + return + end + local lines = { ("%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 + +-- Лавки в стиле low poly: без фотореалистичных текстур (доски, ткань), плоские цвета с разбросом оттенков. +-- Большие дощатые панели (стены, пол, крыша) режутся на отдельные доски, шарики-гирлянды становятся +-- ромбиками-флажками, неоновая рамка вывески — матовой золотой. frame — CFrame лавки (для флажков), может быть nil. +local LOWPOLY_FLAT = { + [Enum.Material.WoodPlanks] = true, [Enum.Material.Wood] = true, [Enum.Material.Fabric] = true, + [Enum.Material.Metal] = true, [Enum.Material.Brick] = true, [Enum.Material.Plastic] = true, +} + +local function lowPolyShade(c, lrng, spread) + local k = 1 + lrng:NextNumber(-spread, spread) + return Color3.new(math.clamp(c.R * k, 0, 1), math.clamp(c.G * k, 0, 1), math.clamp(c.B * k, 0, 1)) +end + +local function lowPolyPlanks(p, lrng) + local s = p.Size + local dims = { s.X, s.Y, s.Z } + local thin = 1 + for i = 2, 3 do + if dims[i] < dims[thin] then thin = i end + end + -- режем вдоль самой длинной горизонтальной оси (кроме тонкой): стены — вертикальные доски, пол — продольные + local axis = (thin ~= 1 and (thin == 3 or s.X >= s.Z)) and 1 or 3 + local len = dims[axis] + local n = math.max(2, math.floor(len / 1.8 + 0.5)) + local w = len / n + for i = 1, n do + local off = -len / 2 + w * (i - 0.5) + local depth = lrng:NextNumber(-0.06, 0.06) + local o = { 0, 0, 0 } + o[axis] = off + o[thin] = depth + local size = { s.X, s.Y, s.Z } + size[axis] = w + local plank = Instance.new("Part") + plank.Name = "Plank" + plank.Anchored = true + plank.TopSurface, plank.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth + plank.Material = Enum.Material.SmoothPlastic + plank.Size = V(size[1], size[2], size[3]) + plank.CFrame = p.CFrame * CFrame.new(o[1], o[2], o[3]) + plank.Color = lowPolyShade(p.Color, lrng, 0.09) + plank.CanCollide, plank.CastShadow, plank.CanQuery = p.CanCollide, p.CastShadow, p.CanQuery + plank.Parent = p.Parent + end + p:Destroy() +end + +function Builder.lowPolyParts(parts, frame, seed) + local lrng = Random.new(seed or 5) + for _, p in ipairs(parts) do + if p:IsA("BasePart") and p.Parent and p.Transparency < 0.5 and not p.Name:find("Npc") then + local isBlock = p.ClassName == "Part" and p.Shape == Enum.PartType.Block + if p.Material == Enum.Material.Fabric and p.ClassName == "Part" and p.Shape == Enum.PartType.Ball and frame then + -- шарик гирлянды → ромбик-флажок, повёрнутый к покупателям + local d = p.Size.X + local flag = Instance.new("Part") + flag.Name = "Pennant" + flag.Anchored = true + flag.CanCollide = false + flag.Material = Enum.Material.SmoothPlastic + flag.Size = V(d * 1.15, d * 1.15, 0.25) + flag.CFrame = CFrame.new(p.Position) * (frame - frame.Position) * CFrame.Angles(0, 0, math.rad(45)) + flag.Color = p.Color + flag.Parent = p.Parent + p:Destroy() + elseif p.Material == Enum.Material.Neon and math.max(p.Size.X, p.Size.Y, p.Size.Z) > 4 then + p.Material = Enum.Material.SmoothPlastic -- рамка вывески: без свечения + p.Color = Color3.fromRGB(214, 160, 70) + elseif p.Material == Enum.Material.WoodPlanks and isBlock and #p:GetChildren() == 0 + and math.min(p.Size.X, p.Size.Y, p.Size.Z) <= 1.2 and math.max(p.Size.X, p.Size.Z) >= 4 then + lowPolyPlanks(p, lrng) + elseif LOWPOLY_FLAT[p.Material] then + p.Material = Enum.Material.SmoothPlastic + p.Color = lowPolyShade(p.Color, lrng, 0.06) + end + end + end +end + +-- детали лавки, построенной stall(cf): всё, что лежит в её габаритах прямо в папке parent +function Builder.stallParts(cf, parent) + local list = {} + for _, p in ipairs(parent:GetChildren()) do + if p:IsA("BasePart") then + local l = cf:PointToObjectSpace(p.Position) + if math.abs(l.X) <= 15.5 and l.Y >= -0.5 and l.Y <= 21 and l.Z >= -14.5 and l.Z <= 9.5 then + table.insert(list, p) + end + end + end + return list +end + +-- лавка: cf стоит на полу, сторона -Z смотрит на покупателей +local function stall(cf, opt) + local function at(x, y, z) + return cf * CFrame.new(x, y, z) + end + local wall, dark = opt.wall, opt.wall:Lerp(Color3.new(0, 0, 0), 0.3) + + P({ Size = V(24, 1, 17), CFrame = at(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 120, 80) }) + P({ Size = V(24, 13, 1), CFrame = at(0, 7.5, 8), Material = Enum.Material.WoodPlanks, Color = wall }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(1, 13, 17), CFrame = at(s * 11.5, 7.5, 0), Material = Enum.Material.WoodPlanks, Color = wall }) + P({ Size = V(1.5, 14.5, 1.5), CFrame = at(s * 11.6, 7.25, -8.3), Material = Enum.Material.Wood, Color = dark }) + end + P({ Size = V(26, 1, 19), CFrame = at(0, 14.5, 0), Material = Enum.Material.WoodPlanks, Color = dark }) + -- полосатый навес + for i = 0, 7 do + P({ + Size = V(3, 0.35, 6), + CFrame = at(-10.5 + i * 3, 13.1, -10.6) * CFrame.Angles(math.rad(-22), 0, 0), + Material = Enum.Material.Fabric, + Color = (i % 2 == 0) and opt.stripeA or opt.stripeB, + }) + ball(at(-10.5 + i * 3, 11.9, -13.3).Position, 0.9, { Color = (i % 2 == 0) and opt.stripeA or opt.stripeB, Material = Enum.Material.Fabric }) + end + -- прилавок + local counter = P({ Size = V(18, 4, 3), CFrame = at(0, 3, -4), Material = Enum.Material.WoodPlanks, Color = wall }) + P({ Size = V(19, 0.5, 3.8), CFrame = at(0, 5.25, -4), Material = Enum.Material.Wood, Color = dark }) + -- вывеска + local board = P({ Size = V(20, 4.5, 0.6), CFrame = at(0, 17.6, -9.2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 45, 30) }) + P({ Size = V(20.8, 5.3, 0.3), CFrame = at(0, 17.6, -8.9), Material = Enum.Material.Neon, Color = opt.glow }) + for _, x in ipairs({ -8, 8 }) do + P({ Size = V(0.6, 3, 0.6), CFrame = at(x, 15.5, -9.2), Material = Enum.Material.Wood, Color = dark }) + end + surfaceText(board, Enum.NormalId.Front, opt.title, opt.titleColor) + -- фонарики + for _, x in ipairs({ -9.5, 9.5 }) do + local l = P({ Size = V(0.8, 1.1, 0.8), CFrame = at(x, 11.2, -9.4), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 210, 140) }) + local light = Instance.new("PointLight") + light.Range = 14 + light.Brightness = 1 + light.Color = Color3.fromRGB(255, 210, 150) + light.Parent = l + end + -- бочки по бокам + for _, s in ipairs({ -1, 1 }) do + vcyl(at(s * 14.5, 2.6, -5).Position, 3.2, 2.6, { Color = Color3.fromRGB(130, 85, 50), Material = Enum.Material.Wood }) + vcyl(at(s * 14.5, 2.6, -5).Position, 0.3, 2.75, { Color = Color3.fromRGB(70, 70, 75), Material = Enum.Material.Metal }) + end + + prompt(counter, opt.promptText, opt.promptObject, opt.action, 14) + if opt.npcName then + npc(opt.npcName, at(0, 4, 1.5), opt.npcColors) + end + if opt.decor then + opt.decor(at) + end + Builder.lowPolyParts(Builder.stallParts(cf, map), cf, math.floor(cf.Position.X + cf.Position.Z)) + return counter +end + +-- Модель портала из ServerStorage.FishingPortalTemplate, перекрашенная в цвет мира и +-- поставленная основанием на baseCF. Без шаблона возвращает nil (тогда строится старое кольцо). +function Builder.portalModel(baseCF, color, name, parent) + local template = ServerStorage:FindFirstChild("FishingPortalTemplate") + if not (template and template:IsA("Model")) then + return nil + end + local model = template:Clone() + model.Name = name + for _, part in ipairs(model:GetDescendants()) do + if part:IsA("BasePart") then + local c = part.Color + local isGreen = c.G > c.R * 1.15 and c.G > c.B * 1.10 and c.G > 0.25 + if part.Material == Enum.Material.Neon then + part.Color = color + elseif isGreen then + part.Color = color:Lerp(Color3.fromRGB(55, 65, 75), 0.30) + part.Material = Enum.Material.SmoothPlastic + end + elseif part:IsA("ParticleEmitter") then + part.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + end + end + + local pivot = template:GetPivot() + local boxCFrame, boxSize = template:GetBoundingBox() + local boxBottom = pivot:PointToObjectSpace(Vector3.new( + boxCFrame.Position.X, + boxCFrame.Position.Y - boxSize.Y / 2, + boxCFrame.Position.Z + )).Y + model:PivotTo(baseCF * CFrame.new(0, -boxBottom, 0)) + model.Parent = parent + return model +end + +local function portal(baseCF, title, color, worldId, locked) + -- Все порталы, и в лобби, и возвратные в мирах, используют модель автора из ServerStorage. + do + local model = Builder.portalModel(baseCF, color, "PortalModel_" .. worldId, map) + if model then + -- Этот невидимый якорь сохраняет ProximityPrompt и подпись мира. + local disc = P({ + Name = "Portal_" .. worldId, + Size = V(1, 1, 1), + CFrame = baseCF * CFrame.new(0, 10, 0), + Transparency = 1, + CanCollide = false, + CanQuery = false, + CanTouch = false, + }) + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + pe.LightEmission = 1 + pe.Rate = 25 + pe.Lifetime = NumberRange.new(1, 1.8) + pe.Speed = NumberRange.new(0.5, 2) + pe.SpreadAngle = Vector2.new(180, 180) + pe.Size = NumberSequence.new(0.5, 0) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Parent = disc + billboard(disc, title, color:Lerp(Color3.new(1, 1, 1), 0.4), 7, 200) + if locked then + billboard(disc, "🔒", Color3.new(1, 1, 1), 0, 120) + end + local pp = prompt(disc, locked and "Посмотреть" or "Перейти", title, "Portal", 14) + pp:SetAttribute("World", worldId) + return disc + end + end + + local center = baseCF * CFrame.new(0, 10, 0) + P({ Size = V(17, 1, 9), CFrame = baseCF * CFrame.new(0, 0.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(95, 100, 115) }) + P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130) }) + local R, n = 7, 20 + for i = 0, n - 1 do + local a = (i + 0.5) / n * math.pi * 2 + P({ + Size = V(2 * math.pi * R / n + 0.4, 1.7, 1.7), + CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R, 0), + Material = Enum.Material.Slate, + Color = Color3.fromRGB(80, 85, 100), + }) + if i % 2 == 0 then + P({ + Size = V(0.6, 0.6, 1.9), + CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R + 0.95, 0), + Material = Enum.Material.Neon, + Color = color, + }) + end + end + local disc = P({ + Name = "Portal_" .. worldId, + Shape = Enum.PartType.Cylinder, + Size = V(0.3, 2 * R - 1, 2 * R - 1), + CFrame = center * CFrame.Angles(0, math.rad(90), 0), + Material = Enum.Material.Neon, + Color = color, + Transparency = 0.3, + CanCollide = false, + }) + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + pe.LightEmission = 1 + pe.Rate = 25 + pe.Lifetime = NumberRange.new(1, 1.8) + pe.Speed = NumberRange.new(0.5, 2) + pe.SpreadAngle = Vector2.new(180, 180) + pe.Size = NumberSequence.new(0.5, 0) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Parent = disc + billboard(disc, title, color:Lerp(Color3.new(1, 1, 1), 0.4), 10, 250) + if locked then + billboard(disc, "🔒", Color3.new(1, 1, 1), 0, 120) + end + local pp = prompt(disc, locked and "Посмотреть" or "Перейти", title, "Portal", 14) + pp:SetAttribute("World", worldId) + return disc +end + +local function banner(pos, color, icon, text) + local look = CFrame.lookAt(pos, V(0, pos.Y, 0)) -- смотрит в центр лобби + vcyl(pos + V(0, 8, 0), 16, 0.7, { Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal }) + ball(pos + V(0, 16.3, 0), 1.2, { Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal }) + P({ Size = V(5.2, 0.4, 0.4), CFrame = look * CFrame.new(0, 15, -0.6), Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal }) + local flag = P({ Size = V(4.6, 8, 0.25), CFrame = look * CFrame.new(0, 10.8, -0.6), Color = color, Material = Enum.Material.Fabric, CanCollide = false }) + P({ Size = V(4.6, 0.5, 0.3), CFrame = look * CFrame.new(0, 6.6, -0.6), Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal }) + local label = icon .. "\n" .. text + surfaceText(flag, Enum.NormalId.Front, label, Color3.new(1, 1, 1)) + surfaceText(flag, Enum.NormalId.Back, label, Color3.new(1, 1, 1)) +end + +local function arch(cf, span, height, title, color) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(4, height, 4), CFrame = cf * CFrame.new(s * span / 2, height / 2, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) + P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, height + 0.6, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 195, 60) }) + P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, 0.6, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(150, 145, 140) }) + end + local beam = P({ Size = V(span + 6, 6, 2.5), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(60, 85, 140) }) + P({ Size = V(span + 7, 7, 2), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.Neon, Color = color }) + surfaceText(beam, Enum.NormalId.Front, title, Color3.fromRGB(255, 230, 120)) + surfaceText(beam, Enum.NormalId.Back, title, Color3.fromRGB(255, 230, 120)) +end + +---------------------------------------------------------------- сборка карты + +function Builder.build() + rng = Random.new(7) + map = Instance.new("Folder") + map.Name = "FishingMap" + local zonesFolder = Instance.new("Folder") + zonesFolder.Name = "FishingZones" + zonesFolder.Parent = map + local world1Prebuilt = Workspace:FindFirstChild("World1Map") + + ---------------------------------------------------------------- ЛОББИ + + P({ Shape = Enum.PartType.Cylinder, Size = V(1, 170, 170), CFrame = CFrame.new(0, 0.5, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Cobblestone, Color = Color3.fromRGB(190, 180, 165) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 74, 74), CFrame = CFrame.new(0, 0.52, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Marble, Color = Color3.fromRGB(232, 226, 214) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 78, 78), CFrame = CFrame.new(0, 0.51, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.SmoothPlastic, Color = Color3.fromRGB(60, 120, 190) }) + -- дорожки-лучи к лавкам и порталам + for _, a in ipairs({ 0, 90, 180, 270 }) do + local r = math.rad(a) + P({ Size = V(10, 1.0, 48), CFrame = CFrame.new(math.cos(r) * 60, 0.52, math.sin(r) * 60) * CFrame.Angles(0, -r + math.pi / 2, 0), Material = Enum.Material.Marble, Color = Color3.fromRGB(225, 218, 205) }) + end + + marker("LobbySpawn", CFrame.new(0, FLOOR + 2, 57)) -- на дорожке за табличкой «Как играть»: сначала она, дальше портал в Мир 1 + + -- фонтан со статуей золотой рыбы + vcyl(V(0, FLOOR + 1, 0), 2, 24, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) + vcyl(V(0, FLOOR + 1.6, 0), 1.0, 21, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 }) + vcyl(V(0, FLOOR + 4, 0), 6, 3, { Material = Enum.Material.Slate, Color = Color3.fromRGB(190, 185, 175) }) + local bowl = vcyl(V(0, FLOOR + 7.3, 0), 1, 9, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) + vcyl(V(0, FLOOR + 7.75, 0), 0.2, 8, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 }) + do + local statue = Models.buildFish("Gold", "Golden", 3.2, true) + statue:PivotTo(CFrame.new(0, FLOOR + 12, 0) * CFrame.Angles(0, math.rad(30), math.rad(40))) + statue.Parent = map + local sp = Instance.new("ParticleEmitter") + sp.Texture = "rbxasset://textures/particles/sparkles_main.dds" + sp.Rate = 12 + sp.LightEmission = 1 + sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90)) + sp.Size = NumberSequence.new(0.6, 0) + sp.Lifetime = NumberRange.new(1, 1.5) + sp.SpreadAngle = Vector2.new(180, 180) + sp.Speed = NumberRange.new(1, 2) + sp.Parent = statue.PrimaryPart + -- струи воды + local att = Instance.new("Attachment") + att.Position = V(0.6, 0, 0) -- у повёрнутого цилиндра ось X смотрит вверх + att.Orientation = V(0, 0, -90) -- направить струю вверх + att.Parent = bowl + local water = Instance.new("ParticleEmitter") + water.Color = ColorSequence.new(Color3.fromRGB(200, 235, 255)) + water.Transparency = NumberSequence.new(0.3, 1) + water.Size = NumberSequence.new(0.6, 1.2) + water.Rate = 60 + water.Lifetime = NumberRange.new(1.2, 1.5) + water.Speed = NumberRange.new(10, 12) + water.SpreadAngle = Vector2.new(25, 25) + water.Acceleration = V(0, -25, 0) + water.Parent = att + end + -- скамейки по внешнему краю площади, между порталами, лицом к фонтану + for _, deg in ipairs({ 45, 135, 225, 315 }) do + local a = math.rad(deg) + for _, side in ipairs({ -1, 1 }) do + local b = a + side * math.rad(9) + bench(CFrame.lookAt(V(math.cos(b) * 34, FLOOR, math.sin(b) * 34), V(0, FLOOR, 0))) + end + end + + -- фонари по кругу (у спавна — за спиной игрока, чтобы не закрывали табличку и сундук) + for i = 0, 7 do + local deg = i * 45 + 22.5 + if deg ~= 67.5 and deg ~= 112.5 then + local a = math.rad(deg) + lamp(V(math.cos(a) * 40, FLOOR, math.sin(a) * 40)) + end + end + lamp(V(7, FLOOR, 48)) -- левый фонарь стоит за табличкой «Как играть» + + -- клумбы с деревьями + for _, deg in ipairs({ 225, 315 }) do + local a = math.rad(deg) + local p = V(math.cos(a) * 58, FLOOR, math.sin(a) * 58) + vcyl(p + V(0, 1, 0), 2, 12, { Material = Enum.Material.Brick, Color = Color3.fromRGB(150, 95, 70) }) + vcyl(p + V(0, 1.6, 0), 1.0, 11, { Material = Enum.Material.Grass, Color = Color3.fromRGB(70, 140, 60) }) + tree(p + V(0, 2, 0), "round") + for j = 1, 5 do + local b = rng:NextNumber(0, math.pi * 2) + ball(p + V(math.cos(b) * 4, 2.4, math.sin(b) * 4), 0.8, { Color = ({ Color3.fromRGB(255, 110, 140), Color3.fromRGB(255, 220, 80), Color3.fromRGB(170, 120, 255) })[rng:NextInteger(1, 3)] }) + end + end + + -- баннеры + local bannerData = { + { 15, Color3.fromRGB(40, 110, 200), "🎣", "Лови!" }, + { 70, Color3.fromRGB(240, 140, 40), "🐟", "Продавай" }, + { 110, Color3.fromRGB(40, 110, 200), "⭐", "Качайся" }, + { 165, Color3.fromRGB(240, 140, 40), "🍀", "Удача" }, + { 205, Color3.fromRGB(40, 110, 200), "🏆", "Рекорды" }, + { 335, Color3.fromRGB(240, 140, 40), "💎", "Мифика" }, + } + for _, b in ipairs(bannerData) do + local a = math.rad(b[1]) + banner(V(math.cos(a) * 74, FLOOR, math.sin(a) * 74), b[2], b[3], b[4]) + end + + -- высокий скальный контур закрывает горизонт и удерживает игроков в лобби + lobbyCliffs() + lobbyTrees() + lobbyRockPlants() + lobbyHills() + + -- магазин (запад) и скупка (восток) + stall(CFrame.lookAt(V(-62, FLOOR, 0), V(0, FLOOR, 0)), { + title = "🎣 УДОЧКИ И СНАРЯЖЕНИЕ", + titleColor = Color3.fromRGB(255, 230, 120), + wall = Color3.fromRGB(185, 130, 85), + stripeA = Color3.fromRGB(215, 55, 55), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(255, 170, 60), + action = "Shop", + promptText = "Открыть магазин", + promptObject = "Магазин", + npcName = "Продавец Михалыч", + npcColors = { skin = Color3.fromRGB(234, 184, 146), shirt = Color3.fromRGB(200, 60, 50), pants = Color3.fromRGB(60, 70, 100), hat = Color3.fromRGB(90, 110, 60) }, + decor = function(at) + -- витрина удочек на задней стене + for i, rod in ipairs(Config.Rods) do + local x = -8 + (i - 1) * 4 + local m = Models.buildRod(rod.id, 0, true) + m:PivotTo(at(x, 3, 7) * CFrame.Angles(math.rad(80), 0, 0)) + m.Parent = map + local plaque = P({ Size = V(3.6, 1.6, 0.2), CFrame = at(x, 11.7, 7.4), Material = Enum.Material.Wood, Color = Color3.fromRGB(60, 40, 25) }) + surfaceText(plaque, Enum.NormalId.Front, rod.name .. "\n" .. (rod.price > 0 and (rod.price .. " 💰") or "бесплатно"), Color3.fromRGB(255, 235, 180)) + end + end, + }) + + stall(CFrame.lookAt(V(62, FLOOR, 0), V(0, FLOOR, 0)), { + title = "💰 СКУПКА РЫБЫ", + titleColor = Color3.fromRGB(150, 255, 160), + wall = Color3.fromRGB(110, 150, 175), + stripeA = Color3.fromRGB(50, 150, 80), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(80, 230, 120), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщица Зина", + npcColors = { skin = Color3.fromRGB(240, 195, 160), shirt = Color3.fromRGB(60, 120, 170), pants = Color3.fromRGB(50, 50, 60), hat = Color3.fromRGB(230, 230, 230) }, + decor = function(at) + -- лёд с рыбой на прилавке + P({ Size = V(10, 0.4, 3), CFrame = at(-3, 5.7, -4), Material = Enum.Material.Glass, Color = Color3.fromRGB(200, 235, 255), Transparency = 0.2 }) + for i, id in ipairs({ "Karas", "Okun", "Shuka" }) do + local f = Models.buildFish(id, nil, 0.9, true) + f:PivotTo(at(-6.5 + i * 2.5, 6.2, -4) * CFrame.Angles(math.rad(90), 0, math.rad(90))) + f.Parent = map + end + -- весы + P({ Size = V(2, 0.5, 2), CFrame = at(6, 5.75, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) }) + P({ Size = V(0.3, 1.4, 0.3), CFrame = at(6, 6.7, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 2.4, 2.4), CFrame = at(6, 7.45, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(200, 200, 205) }) + -- ящики с уловом + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(3, 2, 3), CFrame = at(s * 14.5, 2, 2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) }) + local f = Models.buildFish(s < 0 and "Lesh" or "Sudak", nil, 0.7, true) + f:PivotTo(at(s * 14.5, 3.3, 2) * CFrame.Angles(math.rad(90), 0, 0)) + f.Parent = map + end + end, + }) + + -- арка с названием + arch(CFrame.lookAt(V(0, FLOOR, -66), V(0, FLOOR, 0)), 84, 24, "🎣 " .. string.upper(Config.GameName) .. " 🎣", Color3.fromRGB(255, 190, 60)) + + -- порталы по кругу у фонтана, лицом наружу; первый (бесплатный) мир — прямо перед точкой появления + local PORTAL_R = 19 + for i, w in ipairs(Config.Worlds) do + local title = w.icon .. " " .. w.name .. (w.level > 1 and (" (ур. " .. w.level .. ")") or "") + local a = math.rad(90 - (i - 1) * 90) -- 90° = сторона спавна (+Z) + local pos = V(math.cos(a) * PORTAL_R, FLOOR, math.sin(a) * PORTAL_R) + local disc = portal(CFrame.lookAt(pos, V(pos.X * 2, FLOOR, pos.Z * 2)), title, w.color, w.id, w.soon) + if i == 1 then + disc:SetAttribute("GuideTarget", "Portal") + marker("GuidePortal", CFrame.new(pos.X * 1.3, FLOOR, pos.Z * 1.3)) -- точка перед порталом для линии-подсказки + end + end + + -- невидимая стена по кругу: из лобби не уйти + for deg = 0, 359, 5 do + local a = math.rad(deg) + local p = V(math.cos(a) * 86, 30, math.sin(a) * 86) + P({ Size = V(8, 60, 2), CFrame = CFrame.lookAt(p, V(0, 30, 0)), Transparency = 1, CanQuery = false }) + end + + -- донат-лавки + stall(CFrame.lookAt(V(41, FLOOR, 41), V(0, FLOOR, 0)), { + title = "💎 ПРЕМИУМ", + titleColor = Color3.fromRGB(255, 220, 120), + wall = Color3.fromRGB(120, 70, 170), + stripeA = Color3.fromRGB(255, 200, 60), + stripeB = Color3.fromRGB(150, 80, 210), + glow = Color3.fromRGB(255, 200, 60), + action = "RobuxPasses", + promptText = "Открыть", + promptObject = "Премиум-пропуска", + npcName = "Барон Злотов", + npcColors = { skin = Color3.fromRGB(230, 185, 150), shirt = Color3.fromRGB(110, 40, 140), pants = Color3.fromRGB(30, 30, 40), hat = Color3.fromRGB(255, 200, 60) }, + decor = function(at) + -- сундук с самоцветами + P({ Size = V(4, 2, 2.5), CFrame = at(-5, 6.5, -4), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(120, 75, 40) }) + P({ Size = V(4.2, 0.4, 2.7), CFrame = at(-5, 7.6, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) }) + for i, c in ipairs({ Color3.fromRGB(255, 60, 90), Color3.fromRGB(80, 200, 255), Color3.fromRGB(120, 255, 120), Color3.fromRGB(200, 100, 255) }) do + P({ Size = V(0.7, 0.7, 0.7), CFrame = at(-6.5 + i * 0.75, 8.1, -4) * CFrame.Angles(0.6, i, 0.6), Material = Enum.Material.Neon, Color = c }) + end + P({ Size = V(3, 4, 0.3), CFrame = at(5, 7.5, -4.8), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 200, 60) }) + end, + }) + stall(CFrame.lookAt(V(-41, FLOOR, 41), V(0, FLOOR, 0)), { + title = "🪙 СОКРОВИЩНИЦА", + titleColor = Color3.fromRGB(255, 235, 140), + wall = Color3.fromRGB(200, 160, 70), + stripeA = Color3.fromRGB(230, 180, 40), + stripeB = Color3.fromRGB(255, 250, 230), + glow = Color3.fromRGB(255, 220, 90), + action = "RobuxProducts", + promptText = "Открыть", + promptObject = "Наборы монет", + npcName = "Купчиха Злата", + npcColors = { skin = Color3.fromRGB(240, 200, 165), shirt = Color3.fromRGB(220, 170, 50), pants = Color3.fromRGB(90, 50, 30), hat = Color3.fromRGB(180, 40, 40) }, + decor = function(at) + -- горки монет + for i = 0, 4 do + for j = 0, 3 - (i % 3) do + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 0.9, 0.9), CFrame = at(-7 + i * 1.2, 5.6 + j * 0.2, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 205, 60) }) + end + end + for _, s in ipairs({ -1, 1 }) do + ball(at(s * 14.5, 2.2, 2).Position, 2.6, { Color = Color3.fromRGB(190, 160, 110), Material = Enum.Material.Fabric }) + ball(at(s * 14.5, 3.5, 2).Position, 1.2, { Color = Color3.fromRGB(255, 205, 60), Material = Enum.Material.Metal }) + end + end, + }) + + -- сундук с ежедневной наградой + do + local cf = CFrame.lookAt(V(14, FLOOR, 34), V(0, FLOOR, 50)) + local base = P({ Size = V(5, 3, 3.2), CFrame = cf * CFrame.new(0, 1.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 90, 50) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 3.2, 3.2), CFrame = cf * CFrame.new(0, 3, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 105, 60) }) + for _, x in ipairs({ -1.8, 1.8 }) do + P({ Size = V(0.4, 4.9, 3.4), CFrame = cf * CFrame.new(x, 2.3, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) }) + end + P({ Size = V(0.9, 1.1, 0.3), CFrame = cf * CFrame.new(0, 2.8, -1.7), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 220, 90) }) + local sp = Instance.new("ParticleEmitter") + sp.Texture = "rbxasset://textures/particles/sparkles_main.dds" + sp.Rate = 8 + sp.LightEmission = 1 + sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90)) + sp.Size = NumberSequence.new(0.5, 0) + sp.Parent = base + billboard(base, "🎁 Ежедневная награда", Color3.fromRGB(255, 220, 120), 5, 260) + prompt(base, "Забрать", "Сундук", "Daily", 12) + end + + -- табличка «Как играть» + do + -- слева от дорожки за точкой появления, лицом к камере игрока; фонарь — за табличкой + local pos = V(-12, FLOOR, 48) + local cf = CFrame.lookAt(pos, V(0, FLOOR, 64)) + lamp((cf * CFrame.new(0, 0, 2.5)).Position) + marker("GuideBoard", cf * CFrame.new(0, 0, -6)) -- перед табличкой, для линии-подсказки + for _, x in ipairs({ -6.5, 6.5 }) do + P({ Size = V(0.8, 9, 0.8), CFrame = cf * CFrame.new(x, 4.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Size = V(14, 8, 0.5), CFrame = cf * CFrame.new(0, 6, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + board:SetAttribute("GuideTarget", "Board") -- подсвечивается на шаге обучения + surfaceText(board, Enum.NormalId.Front, + "КАК ИГРАТЬ\n1. Портал «Мир 1» или кнопка 🌍 Миры\n2. Удочка — клавиша 1, у воды зажми ЛКМ и отпусти\n3. Клюёт → кликай в зелёную зону\n4. 🎒 Сумка — B, 📜 Задания — Q\n5. Собирай коллекцию — получай награды!", + Color3.fromRGB(255, 245, 225), { TextXAlignment = Enum.TextXAlignment.Left }) + end + + ---------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО + do + -- отдельно собранное раньше «Тихое озеро» (Workspace.World1Map) переносим в карту, иначе строим заново + local w1map = world1Prebuilt or World1Builder.build(map, Builder.portalModel) + w1map.Parent = map + local baitShop = not world1Prebuilt and w1map:FindFirstChild("BaitShop", true) + if baitShop then + Builder.lowPolyParts(baitShop:GetDescendants(), baitShop:GetPivot(), 11) + end + -- NPC встают на маркеры — их можно двигать в Studio + local seller = w1map:FindFirstChild("World1NpcSeller", true) + if seller and not seller:GetAttribute("NpcName") then + setNpc(seller, "Скупщик Гриша", { + skin = Color3.fromRGB(234, 190, 150), shirt = Color3.fromRGB(236, 228, 210), + pants = Color3.fromRGB(70, 110, 76), hat = Color3.fromRGB(226, 196, 122), + }) + end + local grandpa = w1map:FindFirstChild("World1NpcGrandpa", true) + if grandpa and not grandpa:GetAttribute("NpcName") then + setNpc(grandpa, "Дед Петрович", { + skin = Color3.fromRGB(225, 175, 140), shirt = Color3.fromRGB(110, 120, 80), pants = Color3.fromRGB(70, 60, 45), hat = Color3.fromRGB(90, 110, 60), + }, "Talk", "Поговорить") + end + local board = w1map:FindFirstChild("World1Bestiary", true) + if board and not board:GetAttribute("Bestiary") then + setBestiary(board, "World1", "🐟 КТО ВОДИТСЯ В ОЗЕРЕ", "#9BE7FF") + end + end + + -- причал (используется в Мире 2): настил и сваи; возвращает настил + local function pier(center, size) + local deck = P({ Size = size, Position = center, Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) }) + local alongZ = size.Z > size.X + local len = alongZ and size.Z or size.X + local wid = alongZ and size.X or size.Z + for d = -len / 2 + 1, len / 2 - 1, 6 do + for _, s in ipairs({ -1, 1 }) do + local off = alongZ and V(s * (wid / 2 - 0.4), 0, d) or V(d, 0, s * (wid / 2 - 0.4)) + vcyl(center + off + V(0, -6, 0), 13, 0.9, { Color = Color3.fromRGB(100, 70, 45), Material = Enum.Material.Wood }) + end + end + return deck + end + + ---------------------------------------------------------------- помощники для новых миров + + local function cylA(a, b, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(math.max(0.05, (b - a).Magnitude), d, d) + props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0) + return P(props) + end + + local function worldWalls(center) + for _, w in ipairs({ + { V(0, 0, 245), V(500, 160, 2) }, + { V(0, 0, -245), V(500, 160, 2) }, + { V(245, 0, 0), V(2, 160, 500) }, + { V(-245, 0, 0), V(2, 160, 500) }, + }) do + P({ Size = w[2], Position = center + w[1] + V(0, 60, 0), Transparency = 1, CanQuery = false }) + end + end + + local function bestiary(pos, lookAt, worldId, title, titleHex) + local cf = CFrame.lookAt(pos, lookAt) + for _, x in ipairs({ -6, 6 }) do + P({ Size = V(0.8, 11, 0.8), CFrame = cf * CFrame.new(x, 5.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Name = worldId .. "Bestiary", Size = V(13, 10, 0.5), CFrame = cf * CFrame.new(0, 7, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + setBestiary(board, worldId, title, titleHex) + end + + local function campfire(c) + for i = 0, 7 do + local a = i / 8 * math.pi * 2 + ball(c + V(math.cos(a) * 2.2, 0.3, math.sin(a) * 2.2), 1, { Color = Color3.fromRGB(120, 120, 125), Material = Enum.Material.Rock }) + end + for i = 0, 2 do + P({ Shape = Enum.PartType.Cylinder, Size = V(3, 0.6, 0.6), CFrame = CFrame.new(c + V(0, 0.4, 0)) * CFrame.Angles(0, i * math.pi / 3, 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 35) }) + end + local base = P({ Size = V(1, 1, 1), Position = c + V(0, 0.8, 0), Transparency = 1, CanCollide = false }) + local fire = Instance.new("Fire") + fire.Size = 5 + fire.Heat = 9 + fire.Parent = base + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 160, 80) + light.Range = 20 + light.Brightness = 2 + light.Parent = base + end + + local function torch(pos) + cylA(pos, pos + V(0, 5, 0), 0.35, { Color = Color3.fromRGB(170, 130, 70), Material = Enum.Material.Wood }) + local top = P({ Size = V(0.8, 0.8, 0.8), Position = pos + V(0, 5.3, 0), Color = Color3.fromRGB(90, 60, 30), Material = Enum.Material.Wood }) + local fire = Instance.new("Fire") + fire.Size = 3 + fire.Heat = 6 + fire.Parent = top + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 170, 90) + light.Range = 14 + light.Parent = top + end + + ---------------------------------------------------------------- МИР 2: ТРОПИЧЕСКИЙ ОСТРОВ + + do + local W2 = Config.Worlds[2].center + local leafColors = { Color3.fromRGB(60, 160, 60), Color3.fromRGB(85, 185, 70) } + + -- море, мелководье уступами, песчаный пляж, зелёный остров, холм + terrain:FillBlock(CFrame.new(W2 + V(0, -34, 0)), V(520, 8, 520), Enum.Material.Sand) + terrain:FillBlock(CFrame.new(W2 + V(0, -15, 0)), V(520, 30, 520), Enum.Material.Water) + terrain:FillCylinder(CFrame.new(W2 + V(0, -17, 0)), 28, 140, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -15, 0)), 32, 118, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -14, 0)), 34, 106, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -13.5, 0)), 35, 88, Enum.Material.Grass) + terrain:FillBall(W2 + V(20, -20, -30), 32, Enum.Material.Grass) + terrain:FillCylinder(CFrame.new(W2 + V(0, 2, 40)), 4, 14, Enum.Material.Sandstone) + + local function palm(pos) + local h = rng:NextNumber(12, 18) + local a = rng:NextNumber(0, math.pi * 2) + local dir = V(math.cos(a), 0, math.sin(a)) + local p = pos + for i = 1, 6 do + local t = i / 6 + local q = pos + V(0, h * t, 0) + dir * (t * t * h * 0.3) + local d = 1.4 - t * 0.45 + cylA(p, q, d, { Color = Color3.fromRGB(150, 115, 70), Material = Enum.Material.Wood }) + ball(q, d, { Color = Color3.fromRGB(130, 100, 60), Material = Enum.Material.Wood }) + p = q + end + for k = 0, 7 do + local b = k / 8 * math.pi * 2 + rng:NextNumber(-0.2, 0.2) + local ld = V(math.cos(b), 0, math.sin(b)) + local mid = p + ld * 3.5 + V(0, 0.8, 0) + local tipP = p + ld * 7 + V(0, -2.2, 0) + for _, seg in ipairs({ { p, mid }, { mid, tipP } }) do + P({ Size = V(2, 0.15, (seg[2] - seg[1]).Magnitude), CFrame = CFrame.lookAt((seg[1] + seg[2]) / 2, seg[2]), Material = Enum.Material.Grass, Color = leafColors[k % 2 + 1], CanCollide = false }) + end + end + for _ = 1, 3 do + ball(p + V(rng:NextNumber(-0.7, 0.7), -0.7, rng:NextNumber(-0.7, 0.7)), 0.9, { Color = Color3.fromRGB(110, 75, 40) }) + end + end + + local function tikiHut(pos, look) + local cf = CFrame.lookAt(pos, look) + P({ Size = V(12, 1, 12), CFrame = cf * CFrame.new(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 120, 75) }) + for _, c in ipairs({ { -5, -5 }, { 5, -5 }, { -5, 5 }, { 5, 5 } }) do + vcyl((cf * CFrame.new(c[1], 4.5, c[2])).Position, 8, 0.8, { Color = Color3.fromRGB(200, 175, 100), Material = Enum.Material.Wood }) + end + for i = 0, 4 do + vcyl((cf * CFrame.new(0, 8.8 + i * 1.2, 0)).Position, 1.4, 16 - i * 3.2, { Color = Color3.fromRGB(205, 170, 95), Material = Enum.Material.Grass }) + end + local bar = P({ Size = V(7, 3, 1.5), CFrame = cf * CFrame.new(0, 2.5, -3), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 95, 55) }) + billboard(bar, "🍹", Color3.new(1, 1, 1), 3, 60) + end + + local function umbrella(pos, color) + cylA(pos, pos + V(0, 7, 0), 0.25, { Color = Color3.fromRGB(235, 235, 235), Material = Enum.Material.Metal }) + vcyl(pos + V(0, 7, 0), 0.6, 9, { Color = color, Material = Enum.Material.Fabric }) + vcyl(pos + V(0, 7.5, 0), 0.6, 4.5, { Color = Color3.new(1, 1, 1), Material = Enum.Material.Fabric }) + P({ Size = V(2.2, 0.5, 6), CFrame = CFrame.new(pos + V(3.5, 0.6, 0)) * CFrame.Angles(0, rng:NextNumber(-0.5, 0.5), 0), Color = Color3.fromRGB(245, 245, 240), Material = Enum.Material.Fabric }) + P({ Size = V(2.25, 0.52, 1.2), CFrame = CFrame.new(pos + V(3.5, 0.62, 1.5)), Color = color, Material = Enum.Material.Fabric }) + end + + local coralColors = { Color3.fromRGB(255, 110, 150), Color3.fromRGB(255, 150, 60), Color3.fromRGB(170, 90, 255), Color3.fromRGB(255, 220, 80), Color3.fromRGB(80, 220, 200) } + local function coral(pos) + local c = coralColors[rng:NextInteger(1, #coralColors)] + for _ = 1, rng:NextInteger(3, 5) do + local dir = V(rng:NextNumber(-0.5, 0.5), 1, rng:NextNumber(-0.5, 0.5)).Unit + local h = rng:NextNumber(1.5, 3.5) + cylA(pos, pos + dir * h, 0.45, { Color = c, CanCollide = false }) + ball(pos + dir * h, 0.75, { Color = c:Lerp(Color3.new(1, 1, 1), 0.3), CanCollide = false }) + end + end + + local function starfish(pos) + local c = Color3.fromRGB(255, rng:NextInteger(90, 150), 60) + ball(pos, 0.7, { Color = c, CanCollide = false }) + for k = 0, 4 do + local a = k / 5 * math.pi * 2 + P({ Size = V(0.35, 0.2, 1.1), CFrame = CFrame.new(pos) * CFrame.Angles(0, a, 0) * CFrame.new(0, 0, -0.6), Color = c, CanCollide = false }) + end + end + + local spawn2 = W2 + V(0, 4, 40) + marker("World2Spawn", CFrame.lookAt(spawn2 + V(0, 1, 0), spawn2 + V(0, 1, -10))) + arch(CFrame.new(W2 + V(0, 4, 24)), 14, 11, "🏝 ТРОПИЧЕСКИЙ ОСТРОВ", Color3.fromRGB(255, 190, 70)) + portal(CFrame.lookAt(W2 + V(-32, 4, 60), spawn2), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") + stall(CFrame.lookAt(W2 + V(32, 4, 62), spawn2), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(150, 255, 220), + wall = Color3.fromRGB(200, 170, 110), + stripeA = Color3.fromRGB(40, 180, 170), + stripeB = Color3.fromRGB(255, 250, 230), + glow = Color3.fromRGB(80, 230, 200), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщик Мигель", + npcColors = { skin = Color3.fromRGB(190, 140, 100), shirt = Color3.fromRGB(240, 120, 60), pants = Color3.fromRGB(240, 230, 200), hat = Color3.fromRGB(230, 210, 150) }, + }) + bestiary(W2 + V(-18, 4, 22), spawn2, "World2", "🐠 КТО ВОДИТСЯ У ОСТРОВА", "#FFD27A") + npc("Капитан Боря", CFrame.lookAt(W2 + V(10, 6, 100), W2 + V(0, 6, 120)), { + skin = Color3.fromRGB(225, 175, 140), shirt = Color3.fromRGB(240, 240, 240), pants = Color3.fromRGB(30, 40, 80), hat = Color3.fromRGB(30, 30, 60), + }, "Talk", "Поговорить") + + pier(W2 + V(0, 3.2, 125), V(8, 0.6, 50)) + pier(W2 + V(125, 3.2, -10), V(50, 0.6, 8)) + for _, z in ipairs({ 105, 125, 145 }) do + torch(W2 + V(4.5, 3.5, z)) + end + for _, x in ipairs({ 110, 140 }) do + torch(W2 + V(x, 3.5, -14.5)) + end + tikiHut(W2 + V(-50, groundY(W2.X - 50, W2.Z - 20), -20), W2) + tikiHut(W2 + V(-20, groundY(W2.X - 20, W2.Z - 65), -65), W2) + campfire(W2 + V(-10, 4, 55)) + for _, deg in ipairs({ 200, 222, 318, 340 }) do + local a = math.rad(deg) + local x, z = math.cos(a) * 99, math.sin(a) * 99 + umbrella(W2 + V(x, groundY(W2.X + x, W2.Z + z), z), coralColors[rng:NextInteger(1, #coralColors)]) + end + + local function free2(x, z) + local r = math.sqrt(x * x + z * z) + if r > 100 then + return false + end + if (V(x, 0, z) - V(0, 0, 45)).Magnitude < 28 then + return false + end + for _, p in ipairs({ { 32, 62 }, { -32, 60 }, { -50, -20 }, { -20, -65 }, { -18, 22 }, { -10, 55 } }) do + if (V(x, 0, z) - V(p[1], 0, p[2])).Magnitude < 16 then + return false + end + end + return true + end + local count = 0 + for _ = 1, 300 do + if count >= 40 then + break + end + local x, z = rng:NextNumber(-100, 100), rng:NextNumber(-100, 100) + if free2(x, z) then + palm(W2 + V(x, groundY(W2.X + x, W2.Z + z) - 0.5, z)) + count += 1 + end + end + for _ = 1, 35 do + local a = rng:NextNumber(0, math.pi * 2) + local r = rng:NextNumber(121, 138) + local x, z = math.cos(a) * r, math.sin(a) * r + if not (math.abs(x) < 8 and z > 0) and not (math.abs(z + 10) < 8 and x > 0) then + coral(W2 + V(x, groundY(W2.X + x, W2.Z + z) - 0.3, z)) + end + end + for _ = 1, 12 do + local a = rng:NextNumber(0, math.pi * 2) + local r = rng:NextNumber(107, 115) + local x, z = math.cos(a) * r, math.sin(a) * r + starfish(W2 + V(x, groundY(W2.X + x, W2.Z + z) + 0.1, z)) + end + worldWalls(W2) + end + + ---------------------------------------------------------------- МИР 3: ЛЕДЯНОЙ ФЬОРД + + do + local W3 = Config.Worlds[3].center + local LAKES3 = Config.Worlds[3].lakes + local HOLES = Config.Worlds[3].holes + + terrain:FillBlock(CFrame.new(W3 + V(0, -10, 0)), V(500, 28, 500), Enum.Material.Snow) + for i = 0, 13 do + local a = i / 14 * math.pi * 2 + local r = rng:NextNumber(215, 235) + local rad = rng:NextNumber(50, 70) + local c = W3 + V(math.cos(a) * r, -15, math.sin(a) * r) + terrain:FillBall(c, rad, Enum.Material.Rock) + terrain:FillBall(c + V(0, rad * 0.35, 0), rad * 0.7, Enum.Material.Snow) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], 16, l[2])), 30, l[3] + 4, Enum.Material.Air) + end + -- вода не вытесняет снег и лёд, поэтому место под неё сначала вырезаем воздухом + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -19, l[2])), 10, l[3], Enum.Material.Mud) + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -7, l[2])), 14, l[3], Enum.Material.Air) + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -7, l[2])), 14, l[3], Enum.Material.Water) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -1, l[2])), 4, l[3], Enum.Material.Glacier) + end + -- лунки режем прямо по вокселям: тонкая заливка в 4 стада не перекрывает ячейку льда целиком + local holeR = Config.Worlds[3].holeRadius or 6 + local waterY3 = Config.Worlds[3].waterY + for _, h in ipairs(HOLES) do + local c = W3 + V(h[1], 0, h[2]) + local region = Region3.new(c + V(-holeR, -12, -holeR), c + V(holeR, 8, holeR)):ExpandToGrid(4) + local mats, occ = terrain:ReadVoxels(region, 4) + local corner = region.CFrame.Position - region.Size / 2 + for x = 1, mats.Size.X do + for y = 1, mats.Size.Y do + for z = 1, mats.Size.Z do + local p = corner + V(x - 0.5, y - 0.5, z - 0.5) * 4 + if (V(p.X, 0, p.Z) - V(c.X, 0, c.Z)).Magnitude <= holeR then + local water = p.Y < waterY3 + mats[x][y][z] = water and Enum.Material.Water or Enum.Material.Air + occ[x][y][z] = water and 1 or 0 + end + end + end + end + terrain:WriteVoxels(region, 4, mats, occ) + end + + local function snowPine(pos) + local h = rng:NextNumber(8, 13) + vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(90, 62, 40), Material = Enum.Material.Wood }) + for i = 0, 3 do + local s = 10 - i * 2.2 + local y = h * 0.4 + i * 2.8 + ball(pos + V(0, y, 0), s, { Color = Color3.fromRGB(35, 85 + i * 8, 60), Material = Enum.Material.Grass }) + ball(pos + V(0, y + s * 0.3, 0), s * 0.75, { Color = Color3.fromRGB(240, 245, 255), Material = Enum.Material.Snow }) + end + end + + local function igloo(pos, look) + local cf = CFrame.lookAt(pos, look) + P({ Shape = Enum.PartType.Ball, Size = V(14, 14, 14), CFrame = cf, Material = Enum.Material.Snow, Color = Color3.fromRGB(240, 245, 255) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 5, 5), CFrame = cf * CFrame.new(0, 1.2, -7) * CFrame.Angles(0, math.rad(90), 0), Material = Enum.Material.Snow, Color = Color3.fromRGB(235, 240, 250) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 3.6, 3.6), CFrame = cf * CFrame.new(0, 1.2, -9.55) * CFrame.Angles(0, math.rad(90), 0), Color = Color3.fromRGB(20, 25, 35) }) + end + + local function tent(pos, look) + local cf = CFrame.lookAt(pos, look) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.2, 5, 6), CFrame = cf * CFrame.new(s * 1.6, 2.2, 0) * CFrame.Angles(0, 0, math.rad(s * 35)), Material = Enum.Material.Fabric, Color = Color3.fromRGB(230, 110, 40) }) + end + vcyl((cf * CFrame.new(0, 0.9, -4.5)).Position, 1.6, 1.4, { Color = Color3.fromRGB(110, 80, 50), Material = Enum.Material.Wood }) + end + + local function crystal(pos) + for _ = 1, 5 do + local h = rng:NextNumber(3, 8) + P({ + Size = V(1.2, h, 1.2), + CFrame = CFrame.new(pos + V(rng:NextNumber(-2, 2), h / 2 - 0.5, rng:NextNumber(-2, 2))) * CFrame.Angles(rng:NextNumber(-0.4, 0.4), rng:NextNumber(0, 3), rng:NextNumber(-0.4, 0.4)), + Material = Enum.Material.Neon, Color = Color3.fromRGB(140, 230, 255), Transparency = 0.15, + }) + end + end + + local function snowman(pos) + ball(pos + V(0, 2, 0), 4, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + ball(pos + V(0, 5, 0), 3, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + ball(pos + V(0, 7.3, 0), 2.2, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + cylA(pos + V(0, 7.3, -1), pos + V(0, 7.2, -2), 0.3, { Color = Color3.fromRGB(255, 130, 30) }) + for _, x in ipairs({ -0.4, 0.4 }) do + ball(pos + V(x, 7.7, -0.95), 0.3, { Color = Color3.fromRGB(20, 20, 20) }) + end + vcyl(pos + V(0, 8.6, 0), 1.2, 1.4, { Color = Color3.fromRGB(30, 30, 35) }) + vcyl(pos + V(0, 8.1, 0), 0.2, 2.2, { Color = Color3.fromRGB(30, 30, 35) }) + end + + -- лунки: льдинки по краю и флажки + for i, h in ipairs(HOLES) do + local c = W3 + V(h[1], 1.2, h[2]) + for k = 0, 7 do + local a = k / 8 * math.pi * 2 + P({ Size = V(1.2, 0.6, 1.2), CFrame = CFrame.new(c + V(math.cos(a) * 6.6, 0, math.sin(a) * 6.6)) * CFrame.Angles(0, a, 0.2), Material = Enum.Material.Ice, Color = Color3.fromRGB(200, 235, 255) }) + end + if i % 3 == 1 then + cylA(c + V(6, -0.2, 6), c + V(6, 4, 6), 0.15, { Color = Color3.fromRGB(80, 60, 40) }) + P({ Size = V(1.4, 0.9, 0.1), Position = c + V(6.75, 3.5, 6), Material = Enum.Material.Fabric, Color = Color3.fromRGB(220, 40, 40) }) + end + if i % 4 == 0 then + tent(c + V(-9, -0.2, 0), c) + end + end + + local spawn3 = W3 + V(0, 4, 120) + marker("World3Spawn", CFrame.lookAt(spawn3 + V(0, 1, 0), spawn3 + V(0, 1, -10))) + arch(CFrame.new(W3 + V(0, 4, 104)), 14, 11, "❄ ЛЕДЯНОЙ ФЬОРД", Color3.fromRGB(150, 220, 255)) + portal(CFrame.lookAt(W3 + V(-32, 4, 140), spawn3), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") + stall(CFrame.lookAt(W3 + V(32, 4, 138), spawn3), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(180, 230, 255), + wall = Color3.fromRGB(120, 95, 75), + stripeA = Color3.fromRGB(60, 120, 200), + stripeB = Color3.fromRGB(245, 250, 255), + glow = Color3.fromRGB(140, 210, 255), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщица Нина", + npcColors = { skin = Color3.fromRGB(240, 205, 175), shirt = Color3.fromRGB(180, 40, 50), pants = Color3.fromRGB(40, 40, 60), hat = Color3.fromRGB(240, 240, 250) }, + }) + bestiary(W3 + V(-20, 4, 100), spawn3, "World3", "❄ КТО ВОДИТСЯ ПОДО ЛЬДОМ", "#BFEAFF") + npc("Полярник Саша", CFrame.lookAt(W3 + V(12, 7, 88), W3 + V(0, 7, 60)), { + skin = Color3.fromRGB(230, 190, 160), shirt = Color3.fromRGB(230, 120, 30), pants = Color3.fromRGB(50, 55, 70), hat = Color3.fromRGB(200, 40, 40), + }, "Talk", "Поговорить") + igloo(W3 + V(-45, 4, 95), W3 + V(0, 4, 110)) + campfire(W3 + V(20, 4, 108)) + snowman(W3 + V(42, 4, 100)) + for _, p in ipairs({ { -85, -45 }, { 90, 30 }, { -25, -110 }, { 70, -90 }, { -95, 60 } }) do + crystal(W3 + V(p[1], groundY(W3.X + p[1], W3.Z + p[2]), p[2])) + end + + local function free3(x, z) + for _, l in ipairs(LAKES3) do + if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + 12 then + return false + end + end + if (V(x, 0, z) - V(0, 0, 120)).Magnitude < 40 then + return false + end + if (V(x, 0, z) - V(-45, 0, 95)).Magnitude < 14 then + return false + end + return true + end + local count = 0 + for _ = 1, 400 do + if count >= 80 then + break + end + local x, z = rng:NextNumber(-200, 200), rng:NextNumber(-200, 200) + if free3(x, z) then + snowPine(W3 + V(x, groundY(W3.X + x, W3.Z + z) - 0.5, z)) + count += 1 + end + end + + -- северное сияние + for i = 0, 7 do + P({ + Size = V(55, 26, 0.6), + CFrame = CFrame.new(W3 + V(-175 + i * 50, 150 + math.sin(i * 1.3) * 10, -150 + math.cos(i * 0.9) * 25)) * CFrame.Angles(math.rad(10), math.rad(i * 8 - 28), 0), + Material = Enum.Material.Neon, + Color = (i % 3 == 0) and Color3.fromRGB(170, 90, 255) or Color3.fromRGB(80, 255, 170), + Transparency = 0.6, CanCollide = false, CanQuery = false, CastShadow = false, + }) + end + worldWalls(W3) + end + + ---------------------------------------------------------------- проверка воды + -- Если вода в террейне не создалась (бывает в некоторых плейсах/настройках), + -- ставим поверхность воды из деталей, чтобы озёра и море точно были видны. + + local function terrainHasWater(pos) + local region = Region3.new(pos - V(2, 2, 2), pos + V(2, 2, 2)):ExpandToGrid(4) + local ok, mats = pcall(function() + return terrain:ReadVoxels(region, 4) + end) + if not ok then + return true + end + for _, plane in ipairs(mats) do + for _, column in ipairs(plane) do + for _, m in ipairs(column) do + if m == Enum.Material.Water then + return true + end + end + end + end + return false + end + + local function waterPlane(pos, diameter, color) + return P({ + Name = "WaterSurface", + Shape = Enum.PartType.Cylinder, + Size = V(0.4, diameter, diameter), + CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)), + Color = color, + Material = Enum.Material.SmoothPlastic, + Reflectance = 0.08, + CanCollide = false, + CanQuery = false, + CanTouch = false, + CastShadow = false, + }) + end + + do + local w1, w2, w3 = Config.Worlds[1], Config.Worlds[2], Config.Worlds[3] + -- Мир 1: каждое озеро; нет воды — заливаем ещё раз, не помогло — поверхность из деталей. + -- Повторяем через несколько секунд на случай, если террейн перезаписал другой скрипт. + local planes = {} + -- материал вокселя (читаем воксели, а не лучом: физика террейна обновляется с задержкой) + local function voxelAt(pos) + local region = Region3.new(pos - V(1, 1, 1), pos + V(1, 1, 1)):ExpandToGrid(4) + local ok, mats = pcall(function() + return terrain:ReadVoxels(region, 4) + end) + return ok and mats[1] and mats[1][1] and mats[1][1][1] or nil + end + -- в центре озера: под поверхностью вода, над ней пусто + local function lakeState(l) + local c = w1.center + V(l[1], w1.waterY, l[2]) + return voxelAt(c - V(0, 2, 0)), voxelAt(c + V(0, 2, 0)) + end + local function lakeOk(below, above) + return below == nil or (below == Enum.Material.Water and above == Enum.Material.Air) + end + local function ensureLakeWater() + for i, l in ipairs(w1.lakes) do + local below, above = lakeState(l) + if not planes[i] and not lakeOk(below, above) then + warn(("[MapBuilder] Озеро %d Мира 1: под водой %s, над водой %s — заливаю заново"):format(i, tostring(below), tostring(above))) + World1Builder.carveLake(l) + below, above = lakeState(l) + if not lakeOk(below, above) then + warn(("[MapBuilder] Озеро %d Мира 1: всё ещё %s / %s — ставлю запасную поверхность воды"):format(i, tostring(below), tostring(above))) + planes[i] = waterPlane(w1.center + V(l[1], w1.waterY + 0.05, l[2]), l[3] * 2, Color3.fromRGB(30, 120, 150)) + end + end + end + end + -- уровень, собранный и поправленный руками в Studio, не трогаем: озеро там могли поменять намеренно + if not world1Prebuilt then + ensureLakeWater() + if RunService:IsRunning() then + task.delay(5, ensureLakeWater) + end + end + if not terrainHasWater(w2.center + V(180, -4, 0)) then + warn("[MapBuilder] Вода в террейне Мира 2 не создалась — ставлю запасную поверхность воды") + waterPlane(w2.center + V(0, w2.waterY, 0), 500, Color3.fromRGB(40, 180, 190)) + end + local h = w3.holes[1] + if not terrainHasWater(w3.center + V(h[1], -1, h[2])) then + warn("[MapBuilder] Вода в лунках Мира 3 не создалась — ставлю запасную поверхность воды") + for _, hole in ipairs(w3.holes) do + waterPlane(w3.center + V(hole[1], w3.waterY + 0.05, hole[2]), w3.holeRadius * 2, Color3.fromRGB(25, 75, 110)) + end + end + end + + map.Parent = Workspace + return map +end + +---------------------------------------------------------------- сборка в Studio + +function Builder.bake() + assert(not RunService:IsRunning(), "Собирайте карту в режиме редактирования, а не во время Play") + local old = Workspace:FindFirstChild("FishingMap") + if old then + -- «Тихое озеро» правят руками: переносим его в новую карту как есть (чтобы собрать заново — удалите World1Map) + local w1 = old:FindFirstChild("World1Map") + if w1 then + w1.Parent = Workspace + end + old:Destroy() + end + -- собранное раньше «Тихое озеро» (Workspace.World1Map) сохраняем вместе с его террейном + local keepWorld1 = Workspace:FindFirstChild("World1Map") ~= nil + for i = 1, 3 do + if i ~= 1 or not keepWorld1 then + terrain:FillBlock(CFrame.new(Config.Worlds[i].center + V(0, 30, 0)), V(680, 260, 680), Enum.Material.Air) + end + end + Builder.applyLighting() + local built = Builder.build() + print(("✅ Карта собрана: Workspace.FishingMap, деталей: %d. Сохраните плейс (Ctrl+S)."):format(#built:GetDescendants())) + return built +end + +---------------------------------------------------------------- при запуске игры + +local function spawnNpc(spot, parent) + local function color(name, default) + return spot:GetAttribute(name) or default + end + local name = spot:GetAttribute("NpcName") + local colors = { + skin = color("SkinColor", Color3.fromRGB(234, 184, 146)), + shirt = color("ShirtColor", Color3.fromRGB(200, 60, 50)), + pants = color("PantsColor", Color3.fromRGB(60, 70, 100)), + hat = color("HatColor", Color3.fromRGB(90, 110, 60)), + } + local ok, rig = pcall(function() + local d = Instance.new("HumanoidDescription") + d.HeadColor = colors.skin + d.LeftArmColor = colors.skin + d.RightArmColor = colors.skin + d.TorsoColor = colors.shirt + d.LeftLegColor = colors.pants + d.RightLegColor = colors.pants + return Players:CreateHumanoidModelFromDescription(d, Enum.HumanoidRigType.R15) + end) + if not ok or not rig then + warn("NPC не создан: " .. tostring(rig)) + return nil + end + rig.Name = name + local hum = rig:FindFirstChildOfClass("Humanoid") + hum.DisplayName = name + hum.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff + hum.NameDisplayDistance = 60 + local root = rig:FindFirstChild("HumanoidRootPart") + root.Anchored = true + rig:PivotTo(spot.CFrame) + rig.Parent = parent + + local head = rig:FindFirstChild("Head") + if head then + if not head:FindFirstChildOfClass("Decal") then + local face = Instance.new("Decal") + face.Name = "face" + face.Texture = "rbxasset://textures/face.png" + face.Parent = head + end + -- панама рыбака + local function hatPart(size, offset, shape) + local p = Instance.new("Part") + p.Shape = shape + p.Size = size + p.CanCollide = false + p.Massless = true + p.Color = colors.hat + p.Material = Enum.Material.Fabric + p.CFrame = head.CFrame * offset + local w = Instance.new("Weld") + w.Part0 = head + w.Part1 = p + w.C0 = head.CFrame:Inverse() * p.CFrame + w.Parent = p + p.Parent = rig + end + hatPart(V(0.15, 2.0, 2.0), CFrame.new(0, 0.55, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder) + hatPart(V(0.6, 1.35, 1.35), CFrame.new(0, 0.85, 0) * CFrame.Angles(0, 0, math.rad(90)), Enum.PartType.Cylinder) + end + local action = spot:GetAttribute("NpcAction") + if action then + prompt(root, spot:GetAttribute("NpcActionText") or "Поговорить", name, action, 14) + end + return rig +end + +-- NPC встают на свои детали-места, доски «кто водится» получают актуальный список рыб +function Builder.prepareRuntime(root) + local spots, boards = {}, {} + for _, d in ipairs(root:GetDescendants()) do + if d:IsA("BasePart") then + if d:GetAttribute("NpcName") then + table.insert(spots, d) + elseif d:GetAttribute("Bestiary") then + table.insert(boards, d) + end + end + end + for _, spot in ipairs(spots) do + spot.Transparency = 1 + spawnNpc(spot, root) + end + for _, board in ipairs(boards) do + writeBestiary(board) + end +end + +return Builder +]=====]) +put('LocalScript', 'Ambience', game.StarterPlayer.StarterPlayerScripts, [=====[-- Ambience (LocalScript) -> StarterPlayer > StarterPlayerScripts +-- Атмосфера у этого игрока: время суток, ночной свет, тучи, дождь/снег, молнии, музыка и звуки окружения, +-- плашка «погода и время» на экране. Время и погоду задаёт сервер (WeatherServer) атрибутами workspace. +-- Свет локации (Config.Worlds[*].look) ставит FishingClient; здесь всё накладывается поверх: +-- свои эффекты цвета живут в камере, поэтому не мешают настройкам локаций. + +local Players = game:GetService("Players") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local TweenService = game:GetService("TweenService") +local Lighting = game:GetService("Lighting") + +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) +local Audio = require(script.Parent:WaitForChild("Audio")) + +local player = Players.LocalPlayer +local terrain = workspace.Terrain +local rng = Random.new() +local WHITE = Color3.new(1, 1, 1) + +local function new(class, props) + local o = Instance.new(class) + for k, v in pairs(props) do + if k ~= "Parent" then + o[k] = v + end + end + o.Parent = props.Parent + return o +end + +local function clockNow() + return Config.ClockAt(workspace:GetServerTimeNow(), workspace:GetAttribute("DayStart")) +end + +local function currentPlace() + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if not hrp then + return nil, "Lobby" + end + local w = Config.WorldAt(hrp.Position) + return w, w and w.id or "Lobby" +end + +local function currentWeather() + return Config.WeatherById(workspace:GetAttribute("Weather")) +end + +---------------------------------------------------------------- вид погоды + +-- cc — поправка цвета поверх света локации; cover/density/cloud — облака; rain — частиц в секунду +local LOOK = { + Clear = { cover = 0.4, density = 0.45, cloud = Color3.fromRGB(255, 255, 255), rain = 0, + cc = { Brightness = 0, Saturation = 0, Contrast = 0, TintColor = WHITE } }, + Cloudy = { cover = 0.78, density = 0.6, cloud = Color3.fromRGB(215, 218, 226), rain = 0, + cc = { Brightness = -0.03, Saturation = -0.1, Contrast = 0, TintColor = Color3.fromRGB(236, 239, 246) } }, + Rain = { cover = 0.88, density = 0.75, cloud = Color3.fromRGB(165, 170, 182), rain = 350, rainSound = "rainLight", + cc = { Brightness = -0.06, Saturation = -0.18, Contrast = 0.02, TintColor = Color3.fromRGB(214, 224, 240) } }, + Storm = { cover = 0.96, density = 0.9, cloud = Color3.fromRGB(105, 110, 124), rain = 900, rainSound = "rainHeavy", lightning = true, + cc = { Brightness = -0.12, Saturation = -0.3, Contrast = 0.06, TintColor = Color3.fromRGB(190, 200, 226) } }, + Fog = { cover = 0.6, density = 0.5, cloud = Color3.fromRGB(232, 232, 238), rain = 0, + cc = { Brightness = 0.02, Saturation = -0.22, Contrast = -0.05, TintColor = Color3.fromRGB(234, 238, 242) } }, +} + +-- эффекты в камере: действуют только у этого игрока и не путаются с эффектами Lighting +local camera = workspace.CurrentCamera +local weatherCC = new("ColorCorrectionEffect", { Name = "WeatherCC", Parent = camera }) +local nightCC = new("ColorCorrectionEffect", { Name = "NightCC", Parent = camera }) +workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function() + camera = workspace.CurrentCamera + weatherCC.Parent = camera + nightCC.Parent = camera +end) + +local clouds = terrain:FindFirstChildOfClass("Clouds") or new("Clouds", { Parent = terrain }) + +-- дождь (а во фьорде — снег) сыплется из невидимой плиты над камерой +local rainPart = new("Part", { + Name = "RainFX", Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false, + Transparency = 1, Size = Vector3.new(110, 1, 110), Parent = workspace, +}) +local rain = new("ParticleEmitter", { + Texture = "rbxasset://textures/SelfView/whiteRect.png", + Rate = 0, Lifetime = NumberRange.new(1.1, 1.4), Speed = NumberRange.new(55, 70), + EmissionDirection = Enum.NormalId.Bottom, SpreadAngle = Vector2.new(4, 4), + Orientation = Enum.ParticleOrientation.VelocityParallel, + Size = NumberSequence.new(0.07), Squash = NumberSequence.new(2.5), + Color = ColorSequence.new(Color3.fromRGB(200, 215, 235)), Transparency = NumberSequence.new(0.45), + LightInfluence = 1, + Parent = rainPart, +}) + +local function rainStyle(snowy) + if snowy then + rain.Speed = NumberRange.new(6, 10) + rain.Lifetime = NumberRange.new(5, 7) + rain.Size = NumberSequence.new(0.22) + rain.Squash = NumberSequence.new(0) + rain.SpreadAngle = Vector2.new(25, 25) + rain.Orientation = Enum.ParticleOrientation.FacingCamera + rain.Color = ColorSequence.new(WHITE) + rain.Transparency = NumberSequence.new(0.1) + else + rain.Speed = NumberRange.new(55, 70) + rain.Lifetime = NumberRange.new(1.1, 1.4) + rain.Size = NumberSequence.new(0.07) + rain.Squash = NumberSequence.new(2.5) + rain.SpreadAngle = Vector2.new(4, 4) + rain.Orientation = Enum.ParticleOrientation.VelocityParallel + rain.Color = ColorSequence.new(Color3.fromRGB(200, 215, 235)) + rain.Transparency = NumberSequence.new(0.45) + end +end + +local appliedWeather, appliedPlace = nil, nil +local function applyWeather(instant) + local w = currentWeather() + local _, placeId = currentPlace() + if appliedWeather == w.id and appliedPlace == placeId and not instant then + return + end + appliedWeather, appliedPlace = w.id, placeId + local look = LOOK[w.id] or LOOK.Clear + local info = TweenInfo.new(instant and 0 or 6) + TweenService:Create(weatherCC, info, look.cc):Play() + TweenService:Create(clouds, info, { Cover = look.cover, Density = look.density }):Play() -- цвет туч ставит главный цикл (с учётом ночи) + local snowy = placeId == "World3" + rainStyle(snowy) + rain.Rate = snowy and look.rain * 0.35 or look.rain +end + +---------------------------------------------------------------- молнии + +task.spawn(function() + while true do + task.wait(rng:NextNumber(6, 16)) + local w = currentWeather() + local _, placeId = currentPlace() + if LOOK[w.id] and LOOK[w.id].lightning and placeId ~= "World3" then + -- двойная вспышка, гром приходит чуть позже (молния далеко) + local base = weatherCC.Brightness + for _ = 1, 2 do + weatherCC.Brightness = base + 0.45 + task.wait(0.06) + weatherCC.Brightness = base + task.wait(0.09) + end + local far = rng:NextNumber() + task.delay(0.2 + far * 1.4, function() + local list = Config.Sounds.thunder + Audio.playId(list[rng:NextInteger(1, #list)], 0.9 - far * 0.5, "ambient") + end) + end + end +end) + +---------------------------------------------------------------- музыка + +local tracks = {} +local function track(name) + if not tracks[name] then + tracks[name] = Audio.loop(name, "music") + end + return tracks[name] +end + +local currentTrack = nil +local function musicFor(placeId, night) + if night and placeId ~= "World2" then + return "musicNight" + end + if placeId == "Lobby" then + return (math.floor(workspace:GetServerTimeNow() / 600) % 2 == 0) and "musicLobby" or "musicLobby2" + elseif placeId == "World1" then + return (math.floor(workspace:GetServerTimeNow() / 600) % 2 == 0) and "musicLake" or "musicLake2" + elseif placeId == "World3" then + return "musicNight" + end + return "musicLake2" +end + +---------------------------------------------------------------- звуки окружения + +local ambient = {} +for _, name in ipairs({ "birdsLake", "birdsPark", "birdsJungle", "crickets", "lakeWater", "wind", "rainLight", "rainHeavy" }) do + ambient[name] = Audio.loop(name, "ambient") +end + +-- какие петли и насколько громко звучат сейчас +local function ambientMix(placeId, night, w) + local mix = {} + local day = not night + mix.birdsLake = (day and placeId == "World1") and 1 or 0 + mix.birdsPark = (day and placeId == "Lobby") and 1 or 0 + mix.birdsJungle = (day and placeId == "World2") and 1 or 0 + mix.crickets = (night and placeId ~= "World3") and 1 or 0 + mix.lakeWater = (placeId == "World1" or placeId == "World2") and 1 or 0 + local wind = 1 + if placeId == "World3" then + wind = 2.5 + end + if w.id == "Storm" then + wind *= 2 + end + mix.wind = wind + local wet = placeId ~= "World3" + mix.rainLight = (wet and w.id == "Rain") and 1 or 0 + mix.rainHeavy = (wet and w.id == "Storm") and 1 or 0 + -- в дождь птицы прячутся + if w.id == "Rain" or w.id == "Storm" then + mix.birdsLake, mix.birdsPark, mix.birdsJungle = 0, 0, 0 + end + return mix +end + +-- треск у каждого костра на карте (звук в самом костре: слышно только рядом) +task.spawn(function() + local map = workspace:WaitForChild("FishingMap", 60) + if not map then + return + end + task.wait(3) + local def = Config.Sounds.fire + for _, d in ipairs(map:GetDescendants()) do + if d:IsA("Fire") and d.Parent and d.Parent:IsA("BasePart") then + new("Sound", { + Name = "FireCrackle", SoundId = def.id, Volume = def.volume, Looped = true, Playing = true, + RollOffMode = Enum.RollOffMode.InverseTapered, RollOffMinDistance = 6, RollOffMaxDistance = def.roll or 30, + SoundGroup = Audio.groups.ambient, Parent = d.Parent, + }) + end + end +end) + +---------------------------------------------------------------- плашка «погода и время» + +local hud = new("ScreenGui", { Name = "WeatherHud", ResetOnSpawn = false, IgnoreGuiInset = false, Parent = player:WaitForChild("PlayerGui") }) +local pill = new("Frame", { + Size = UDim2.fromOffset(230, 46), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 74), + BackgroundColor3 = Color3.fromRGB(20, 22, 34), BackgroundTransparency = 0.2, Parent = hud, +}) +new("UICorner", { CornerRadius = UDim.new(0, 12), Parent = pill }) +local pillStroke = new("UIStroke", { Color = Color3.fromRGB(200, 160, 90), Thickness = 1.5, Transparency = 0.3, Parent = pill }) +local line1 = new("TextLabel", { + Size = UDim2.new(1, -16, 0, 24), Position = UDim2.fromOffset(10, 2), BackgroundTransparency = 1, + Font = Enum.Font.FredokaOne, TextSize = 18, TextColor3 = WHITE, TextXAlignment = Enum.TextXAlignment.Left, + Text = "", Parent = pill, +}) +local line2 = new("TextLabel", { + Size = UDim2.new(1, -16, 0, 16), Position = UDim2.fromOffset(10, 26), BackgroundTransparency = 1, + Font = Enum.Font.GothamMedium, TextSize = 12, TextColor3 = Color3.fromRGB(150, 230, 160), TextXAlignment = Enum.TextXAlignment.Left, + Text = "", Parent = pill, +}) +-- на узком экране плашка меньше +local function fitPill() + local small = camera and camera.ViewportSize.X < 700 + pill.Size = small and UDim2.fromOffset(170, 40) or UDim2.fromOffset(230, 46) + line1.TextSize = small and 15 or 18 + line2.TextSize = small and 10 or 12 +end +fitPill() + +local function weatherName(w, placeId) + return (w.names and w.names[placeId]) or w.name +end + +local lastShownWeather = nil +local function refreshPill(clock, night, w, placeId) + local h = math.floor(clock) + local m = math.floor((clock - h) * 60) + line1.Text = ("%s %s · %s %02d:%02d"):format(w.icon, weatherName(w, placeId), night and "🌙" or "☀", h, m) + local bonus = {} + if w.desc then + table.insert(bonus, w.desc) + end + if night then + table.insert(bonus, ("Ночь: удача +%d%%"):format(math.floor(Config.DayNight.nightLuck * 100 + 0.5))) + end + line2.Text = #bonus > 0 and table.concat(bonus, " · ") or "Спокойная погода" + if lastShownWeather ~= w.id then + -- погода сменилась: плашка вспыхивает + if lastShownWeather ~= nil then + pillStroke.Color = Color3.fromRGB(255, 220, 120) + pillStroke.Transparency = 0 + TweenService:Create(pillStroke, TweenInfo.new(2.5), { Color = Color3.fromRGB(200, 160, 90), Transparency = 0.3 }):Play() + end + lastShownWeather = w.id + end +end + +---------------------------------------------------------------- главный цикл + +-- часы двигаются каждый кадр (плавно), остальное проверяется раз в полсекунды +RunService.RenderStepped:Connect(function() + if Config.DayNight.enabled then + Lighting.ClockTime = clockNow() + end + if camera then + rainPart.CFrame = CFrame.new(camera.CFrame.Position + Vector3.new(0, 35, 0)) + end +end) + +workspace:GetAttributeChangedSignal("Weather"):Connect(function() + applyWeather(false) +end) +applyWeather(true) + +task.spawn(function() + while true do + local clock = clockNow() + local nightness = Config.DayNight.enabled and Config.Nightness(clock) or 0 + local night = nightness >= 0.5 + local w = currentWeather() + local _, placeId = currentPlace() + + -- ночь: темнее, холоднее, менее насыщенно + nightCC.Brightness = -0.1 * nightness + nightCC.Saturation = -0.18 * nightness + nightCC.TintColor = WHITE:Lerp(Color3.fromRGB(165, 185, 255), nightness) + clouds.Color = (LOOK[w.id] or LOOK.Clear).cloud:Lerp(Color3.fromRGB(40, 45, 60), nightness * 0.8) + + applyWeather(false) -- смена локации меняет дождь на снег и обратно + + -- музыка: плавная смена трека, в грозу тише + local want = musicFor(placeId, night) + local duck = (w.id == "Storm") and 0.5 or 1 + if currentTrack ~= want then + if currentTrack then + Audio.fade(track(currentTrack), 0, 3) + end + currentTrack = want + end + Audio.fade(track(want), duck, 3) + + for name, factor in pairs(ambientMix(placeId, night, w)) do + Audio.fade(ambient[name], factor, 3) + end + + fitPill() + refreshPill(clock, night, w, placeId) + task.wait(0.5) + end +end) +]=====]) +put('ModuleScript', 'Audio', game.StarterPlayer.StarterPlayerScripts, [=====[-- Audio (ModuleScript) -> StarterPlayer > StarterPlayerScripts +-- Звуки у этого игрока. Три группы громкости: музыка, эффекты и окружение (окружение — по громкости эффектов). +-- Громкость берётся из атрибутов игрока VolMusic / VolSfx (их выставляет и сохраняет сервер). +-- Audio.play(name) — разовый звук из Config.Sounds +-- Audio.loop(name, group) — петля (молчит, пока не вызвать Audio.fade) +-- Audio.fade(sound, factor) — плавно к громкости «базовая × factor» (0 — тишина, звук ставится на паузу) + +local Players = game:GetService("Players") +local SoundService = game:GetService("SoundService") +local TweenService = game:GetService("TweenService") +local ReplicatedStorage = game:GetService("ReplicatedStorage") + +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) +local player = Players.LocalPlayer +local rng = Random.new() + +local Audio = {} + +local function group(name) + local g = SoundService:FindFirstChild(name) + if not g then + g = Instance.new("SoundGroup") + g.Name = name + g.Parent = SoundService + end + return g +end +Audio.groups = { + music = group("MusicGroup"), + sfx = group("SfxGroup"), + ambient = group("AmbientGroup"), +} + +local function applyVolumes() + local music = player:GetAttribute("VolMusic") or Config.DefaultVolume.music + local sfx = player:GetAttribute("VolSfx") or Config.DefaultVolume.sfx + Audio.groups.music.Volume = music + Audio.groups.sfx.Volume = sfx + Audio.groups.ambient.Volume = sfx +end +applyVolumes() +player:GetAttributeChangedSignal("VolMusic"):Connect(applyVolumes) +player:GetAttributeChangedSignal("VolSfx"):Connect(applyVolumes) + +function Audio.play(name, volumeMult) + local def = Config.Sounds[name] + if not def or not def.id then + return nil + end + local s = Instance.new("Sound") + s.SoundId = def.id + s.Volume = (def.volume or 0.5) * (volumeMult or 1) + if def.pitch then + s.PlaybackSpeed = rng:NextNumber(def.pitch[1], def.pitch[2]) + end + s.SoundGroup = Audio.groups.sfx + s.Parent = SoundService + s:Play() + s.Ended:Connect(function() + s:Destroy() + end) + task.delay(30, function() + if s.Parent then + s:Destroy() + end + end) + return s +end + +-- разовый звук по прямому id (например, случайный раскат грома из списка) +function Audio.playId(id, volume, groupName) + local s = Instance.new("Sound") + s.SoundId = id + s.Volume = volume or 0.5 + s.SoundGroup = Audio.groups[groupName or "sfx"] + s.Parent = SoundService + s:Play() + s.Ended:Connect(function() + s:Destroy() + end) + return s +end + +function Audio.loop(name, groupName) + local def = Config.Sounds[name] + if not def then + return nil + end + local s = Instance.new("Sound") + s.Name = name + s.SoundId = def.id + s.Looped = true + s.Volume = 0 + s.SoundGroup = Audio.groups[groupName or "ambient"] + s:SetAttribute("BaseVolume", def.volume or 0.5) + s.Parent = SoundService + return s +end + +local fades = {} +function Audio.fade(s, factor, time) + if not s then + return + end + local target = (s:GetAttribute("BaseVolume") or 0.5) * (factor or 0) + if fades[s] and fades[s].target == target then + return + end + if fades[s] then + fades[s].tween:Cancel() + end + if target > 0 and not s.IsPlaying then + s:Resume() + if not s.IsPlaying then + s:Play() + end + end + local tw = TweenService:Create(s, TweenInfo.new(time or 2), { Volume = target }) + fades[s] = { tween = tw, target = target } + tw.Completed:Connect(function(state) + if state == Enum.PlaybackState.Completed and target <= 0.001 then + s:Pause() + end + end) + tw:Play() +end + +return Audio +]=====]) +put('LocalScript', 'FishingClient', game.StarterPlayer.StarterPlayerScripts, [=====[-- FishingClient (LocalScript) -> StarterPlayer > StarterPlayerScripts +-- Интерфейс: HUD, сумка, коллекция с наградами, миры, задания, ежедневная награда, +-- магазин, улучшения, удача, донат, событие, мини-игра, атмосфера миров. + +local Players = game:GetService("Players") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local TweenService = game:GetService("TweenService") +local UserInputService = game:GetService("UserInputService") +local MarketplaceService = game:GetService("MarketplaceService") +local Lighting = game:GetService("Lighting") + +local player = Players.LocalPlayer +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) +local Models = require(ReplicatedStorage:WaitForChild("GameModels")) +local Audio = require(script.Parent:WaitForChild("Audio")) +local remote = ReplicatedStorage:WaitForChild("GameEvent") +local reelSound = Audio.loop("reel", "sfx") -- трещотка катушки, пока идёт вываживание + +---------------------------------------------------------------- стиль + +local C = { + bg = Color3.fromRGB(18, 24, 40), + panel = Color3.fromRGB(30, 38, 62), + panel2 = Color3.fromRGB(44, 56, 90), + gold = Color3.fromRGB(255, 200, 70), + green = Color3.fromRGB(60, 190, 95), + blue = Color3.fromRGB(60, 135, 230), + red = Color3.fromRGB(215, 65, 65), + purple = Color3.fromRGB(150, 90, 220), + grey = Color3.fromRGB(75, 82, 102), + text = Color3.new(1, 1, 1), + muted = Color3.fromRGB(170, 180, 205), + line = Color3.fromRGB(90, 110, 165), +} +local TITLE = Enum.Font.FredokaOne +local BODY = Enum.Font.GothamBold +local BODY2 = Enum.Font.GothamMedium +local WHITE, BLACK = Color3.new(1, 1, 1), Color3.new(0, 0, 0) +local DING = "rbxasset://sounds/electronicpingshort.wav" + +---------------------------------------------------------------- помощники UI + +local function new(class, props, children) + local obj = Instance.new(class) + local parent + for k, v in pairs(props or {}) do + if k == "Parent" then + parent = v + else + obj[k] = v + end + end + for _, c in ipairs(children or {}) do + c.Parent = obj + end + if parent then + obj.Parent = parent + end + return obj +end +local function corner(r) + return new("UICorner", { CornerRadius = UDim.new(0, r or 10) }) +end +local function stroke(color, th, tr) + return new("UIStroke", { Color = color, Thickness = th or 2, Transparency = tr or 0, ApplyStrokeMode = Enum.ApplyStrokeMode.Border }) +end +local function gradient(a, b, rot) + return new("UIGradient", { Color = ColorSequence.new(a, b), Rotation = rot or 90 }) +end +local function text(props) + local d = { + BackgroundTransparency = 1, Font = BODY, TextColor3 = C.text, TextSize = 16, + TextXAlignment = Enum.TextXAlignment.Left, TextYAlignment = Enum.TextYAlignment.Center, + } + for k, v in pairs(props) do + d[k] = v + end + return new("TextLabel", d) +end +local function btn(props, onClick) + local d = { AutoButtonColor = true, Font = TITLE, TextColor3 = C.text, TextSize = 18, BackgroundColor3 = C.blue, Text = "" } + for k, v in pairs(props) do + d[k] = v + end + local b = new("TextButton", d, { corner(10), new("UIGradient", { Color = ColorSequence.new(WHITE, Color3.fromRGB(195, 195, 195)), Rotation = 90 }) }) + if onClick then + b.MouseButton1Click:Connect(function(...) + Audio.play("click") + onClick(...) + end) + end + return b +end +local function clear(container) + for _, c in ipairs(container:GetChildren()) do + if c:IsA("GuiObject") then + c:Destroy() + end + end +end +local function fmt(n) + local s = tostring(math.floor(n)) + local out = s:reverse():gsub("(%d%d%d)", "%1 "):reverse() + return (out:gsub("^ ", "")) +end +local function stars(n) + return string.rep("★", n) .. string.rep("☆", Config.RodUpgrade.maxLevel - n) +end +local function hex(c) + return "#" .. c:ToHex() +end +local function timeStr(sec) + sec = math.max(0, math.floor(sec)) + return ("%d:%02d"):format(math.floor(sec / 60), sec % 60) +end +local function attrSet(name) + local set = {} + for id in string.gmatch(player:GetAttribute(name) or "", "[^,]+") do + set[id] = true + end + return set +end +local function rodLevels() + local t = {} + for id, lv in string.gmatch(player:GetAttribute("RodLevels") or "", "([^,:]+):(%d+)") do + t[id] = tonumber(lv) + end + return t +end +local function playUiSound(id, vol) + local s = Instance.new("Sound") + s.SoundId = id + s.Volume = vol or 0.5 + s.Parent = workspace.CurrentCamera + s:Play() + game:GetService("Debris"):AddItem(s, 3) +end + +local function viewport(parent, model, dir, zoom) + local vf = new("ViewportFrame", { + Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, + Ambient = Color3.fromRGB(175, 175, 185), LightColor = WHITE, LightDirection = Vector3.new(-0.4, -1, -0.6), + Parent = parent, + }) + model.Parent = vf + local cf, size = model:GetBoundingBox() + local cam = Instance.new("Camera") + cam.FieldOfView = 30 + local dist = (size.Magnitude / 2) / math.tan(math.rad(15)) * (zoom or 0.9) + cam.CFrame = CFrame.lookAt(cf.Position + dir.Unit * dist, cf.Position) + cam.Parent = vf + vf.CurrentCamera = cam + return vf +end +local FISH_VIEW = Vector3.new(0.12, 0.15, 1) +local ROD_VIEW = Vector3.new(1, 0.1, 0.05) +local BAG_VIEW = Vector3.new(0.6, 0.25, 1) + +local function silhouette(model) + for _, p in ipairs(model:GetDescendants()) do + if p:IsA("BasePart") then + p.Color = Color3.fromRGB(10, 12, 20) + p.Material = Enum.Material.SmoothPlastic + elseif p:IsA("ParticleEmitter") or p:IsA("PointLight") then + p:Destroy() + end + end + return model +end + +---------------------------------------------------------------- корень + +local gui = new("ScreenGui", { + Name = "FishingUI", ResetOnSpawn = false, IgnoreGuiInset = false, + ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = player:WaitForChild("PlayerGui"), +}) + +---------------------------------------------------------------- HUD + +local hud = new("Frame", { + Size = UDim2.fromOffset(290, 172), Position = UDim2.fromOffset(12, 10), BackgroundColor3 = WHITE, Parent = gui, +}, { corner(16), stroke(C.line, 2, 0.35), gradient(C.panel2, C.bg, 90), + new("UIPadding", { PaddingLeft = UDim.new(0, 14), PaddingRight = UDim.new(0, 14), PaddingTop = UDim.new(0, 10) }) }) +local coinsText = text({ Size = UDim2.new(1, 0, 0, 32), Font = TITLE, TextSize = 30, TextColor3 = C.gold, Text = "💰 0", TextStrokeTransparency = 0.6, Parent = hud }) +local lvlBadge = new("Frame", { Size = UDim2.fromOffset(36, 36), Position = UDim2.fromOffset(0, 38), BackgroundColor3 = WHITE, Parent = hud }, + { corner(18), gradient(Color3.fromRGB(255, 225, 110), Color3.fromRGB(235, 145, 30), 90), stroke(Color3.fromRGB(120, 70, 10), 2, 0.2) }) +local lvlText = text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 19, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = Color3.fromRGB(70, 40, 0), Text = "1", Parent = lvlBadge }) +local xpBack = new("Frame", { Size = UDim2.new(1, -46, 0, 18), Position = UDim2.fromOffset(46, 47), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = hud }, { corner(9) }) +local xpFill = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = WHITE, Parent = xpBack }, { corner(9), gradient(Color3.fromRGB(110, 225, 255), Color3.fromRGB(60, 110, 255), 0) }) +local xpText = text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 2, Text = "", TextStrokeTransparency = 0.5, Parent = xpBack }) +local luckText = text({ Size = UDim2.new(1, 0, 0, 22), Position = UDim2.fromOffset(0, 82), TextSize = 16, RichText = true, TextColor3 = Color3.fromRGB(130, 255, 150), Text = "", Parent = hud }) +local bagText = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 106), TextSize = 14, Font = BODY2, Text = "", Parent = hud }) +local rodText = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 128), TextSize = 14, Font = BODY2, TextColor3 = C.muted, RichText = true, Text = "", Parent = hud }) + +-- баннер события (справа сверху) +local eventBanner = new("Frame", { + Size = UDim2.fromOffset(280, 58), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 10), + BackgroundColor3 = WHITE, Visible = false, Parent = gui, +}, { corner(14), stroke(C.gold, 2, 0.1), gradient(Color3.fromRGB(90, 60, 20), C.bg, 90) }) +local eventTitle = text({ Size = UDim2.new(1, -20, 0, 26), Position = UDim2.fromOffset(12, 4), Font = TITLE, TextSize = 19, TextColor3 = C.gold, Text = "", Parent = eventBanner }) +local eventDesc = text({ Size = UDim2.new(1, -20, 0, 20), Position = UDim2.fromOffset(12, 30), Font = BODY2, TextSize = 13, TextColor3 = C.text, Text = "", Parent = eventBanner }) + +-- кнопки слева +local side = new("Frame", { + Size = UDim2.fromOffset(70, 380), AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0, 12, 0.5, 60), + BackgroundTransparency = 1, Parent = gui, +}, { new("UIListLayout", { Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + +local sideDots = {} +local function sideButton(order, icon, label, key, color, onClick) + local b = btn({ Size = UDim2.fromOffset(68, 68), BackgroundColor3 = color, LayoutOrder = order, Parent = side }, onClick) + stroke(color:Lerp(BLACK, 0.45), 3).Parent = b + text({ Size = UDim2.new(1, 0, 0, 36), Position = UDim2.fromOffset(0, 3), TextSize = 28, TextXAlignment = Enum.TextXAlignment.Center, Text = icon, Parent = b }) + text({ Size = UDim2.new(1, 0, 0, 18), Position = UDim2.fromOffset(0, 44), Font = TITLE, TextSize = 13, TextXAlignment = Enum.TextXAlignment.Center, Text = label, TextStrokeTransparency = 0.5, Parent = b }) + if key and not UserInputService.TouchEnabled then + local tag = new("Frame", { Size = UDim2.fromOffset(20, 20), Position = UDim2.new(1, -14, 0, -6), BackgroundColor3 = C.bg, Parent = b }, { corner(6), stroke(C.gold, 1.5) }) + text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, Text = key, Parent = tag }) + end + local dot = new("Frame", { Size = UDim2.fromOffset(16, 16), Position = UDim2.new(0, -5, 0, -5), BackgroundColor3 = C.red, Visible = false, ZIndex = 3, Parent = b }, { corner(8), stroke(WHITE, 2) }) + sideDots[label] = dot + return b +end + +---------------------------------------------------------------- уведомления +-- мультяшный стиль подсказок: крупный круглый шрифт без обводки на мягкой «дымке» — +-- тёмная подложка, которая плавно растворяется к краям; появляются «пружинкой» + +local SOFT_EDGES = NumberSequence.new({ + NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.18, 0.62), + NumberSequenceKeypoint.new(0.82, 0.62), NumberSequenceKeypoint.new(1, 1), +}) +-- жирный округлый шрифт с кириллицей (у FredokaOne кириллицы нет — Roblox подставляет тонкий шрифт) +local HINT_FONT = Font.new("rbxasset://fonts/families/Nunito.json", Enum.FontWeight.Heavy) +-- плашка-дымка (Frame) с текстом внутри; градиент только на плашке, на текст он не действует +local function softPlate(props, textProps) + local plate = new("Frame", props) + plate.BackgroundColor3 = BLACK + plate.BackgroundTransparency = 0 + corner(30).Parent = plate + new("UIGradient", { Transparency = SOFT_EDGES, Parent = plate }) + new("UIPadding", { PaddingLeft = UDim.new(0, 48), PaddingRight = UDim.new(0, 48), Parent = plate }) + local d = { Size = UDim2.fromScale(0, 1), AutomaticSize = Enum.AutomaticSize.X, TextXAlignment = Enum.TextXAlignment.Center, Parent = plate } + for k, v in pairs(textProps) do + d[k] = v + end + local label = text(d) + label.FontFace = HINT_FONT + return plate, label +end +local function popIn(obj, from) + local sc = obj:FindFirstChildOfClass("UIScale") or new("UIScale", { Parent = obj }) + sc.Scale = from or 0.4 + TweenService:Create(sc, TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play() +end +local function wobble(obj, deg, period) + obj.Rotation = -deg + TweenService:Create(obj, TweenInfo.new(period, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true), { Rotation = deg }):Play() +end + +-- уведомления — под подсказкой обучения, которая стоит в самом верху +local toasts = new("Frame", { + Size = UDim2.new(0, 900, 0, 200), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 84), + BackgroundTransparency = 1, Parent = gui, +}, { new("UIListLayout", { Padding = UDim.new(0, 6), HorizontalAlignment = Enum.HorizontalAlignment.Center, SortOrder = Enum.SortOrder.LayoutOrder }) }) +local toastOrder = 0 +local toastTimers = {} + +local function notify(msg, color) + -- такое же сообщение уже на экране — не дублируем, а продлеваем его + for _, c in ipairs(toasts:GetChildren()) do + if c:IsA("Frame") and c:GetAttribute("Msg") == msg then + toastTimers[c] = (toastTimers[c] or 0) + 1 + local my = toastTimers[c] + task.delay(3.2, function() + if c.Parent and toastTimers[c] == my then + c:Destroy() + end + end) + return + end + end + toastOrder += 1 + local items = {} + for _, c in ipairs(toasts:GetChildren()) do + if c:IsA("Frame") then + table.insert(items, c) + end + end + if #items >= 3 then + items[1]:Destroy() + end + local t, l = softPlate( + { Size = UDim2.new(0, 0, 0, 54), AutomaticSize = Enum.AutomaticSize.X, LayoutOrder = toastOrder, Parent = toasts }, + { TextSize = 30, TextColor3 = color or WHITE, Text = msg } + ) + popIn(t) + t:SetAttribute("Msg", msg) + toastTimers[t] = 0 + task.delay(3.2, function() + if t.Parent and toastTimers[t] == 0 then + TweenService:Create(t, TweenInfo.new(0.4), { BackgroundTransparency = 1 }):Play() + TweenService:Create(l, TweenInfo.new(0.4), { TextTransparency = 1 }):Play() + task.wait(0.45) + t:Destroy() + end + end) +end + +-- карточка пойманной рыбы +local catchCard = new("Frame", { + Size = UDim2.fromOffset(400, 128), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, -220), + BackgroundColor3 = WHITE, Visible = false, Parent = gui, +}, { corner(18) }) +local catchStroke = stroke(WHITE, 3) +catchStroke.Parent = catchCard +local catchGrad = gradient(C.panel2, C.bg, 90) +catchGrad.Parent = catchCard +local catchView = new("Frame", { Size = UDim2.fromOffset(130, 108), Position = UDim2.fromOffset(10, 10), BackgroundColor3 = C.bg, BackgroundTransparency = 0.3, Parent = catchCard }, { corner(14) }) +local catchHeader = text({ Size = UDim2.new(1, -160, 0, 20), Position = UDim2.fromOffset(152, 10), Font = TITLE, TextSize = 15, TextColor3 = C.muted, Text = "", Parent = catchCard }) +local catchName = text({ Size = UDim2.new(1, -160, 0, 30), Position = UDim2.fromOffset(152, 30), Font = TITLE, TextSize = 26, Text = "", TextStrokeTransparency = 0.6, Parent = catchCard }) +local catchInfo = text({ Size = UDim2.new(1, -160, 0, 20), Position = UDim2.fromOffset(152, 64), TextSize = 15, RichText = true, Text = "", Parent = catchCard }) +local catchValue = text({ Size = UDim2.new(1, -160, 0, 26), Position = UDim2.fromOffset(152, 90), Font = TITLE, TextSize = 21, TextColor3 = C.gold, Text = "", Parent = catchCard }) +local catchToken = 0 + +local function showCatch(fish, extra) + catchToken += 1 + local my = catchToken + local r = Config.Rarities[fish.rarity] + local mut = fish.mutation and Config.Find(Config.Mutations, fish.mutation) + clear(catchView) + viewport(catchView, Models.buildFish(fish.id, fish.mutation, 1, true), FISH_VIEW, 0.75) + catchStroke.Color = mut and mut.color or r.color + catchGrad.Color = ColorSequence.new(r.color:Lerp(C.bg, 0.55), C.bg) + catchHeader.Text = extra and extra.new and "🆕 НОВЫЙ ВИД! Опыт x2" or (extra and extra.record and "🏆 НОВЫЙ РЕКОРД!" or "ПОЙМАНА РЫБА") + catchHeader.TextColor3 = (extra and (extra.new or extra.record)) and C.gold or C.muted + catchName.Text = fish.name + catchName.TextColor3 = r.color + catchInfo.Text = ("%s%s · %.2f кг"):format( + hex(r.color), r.name, mut and (" · " .. mut.name .. " x" .. mut.mult .. "") or "", fish.weight) + catchValue.Text = ("💰 %s ⭐ +%d XP%s"):format(fmt(fish.value), fish.xp * ((extra and extra.new) and 2 or 1), + (extra and extra.combo and extra.combo > 1.001) and (" 🔥 x%.1f"):format(extra.combo) or "") + catchCard.Visible = true + TweenService:Create(catchCard, TweenInfo.new(0.45, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Position = UDim2.new(0.5, 0, 0, 120) }):Play() + task.delay(3.4, function() + if my == catchToken then + local tw = TweenService:Create(catchCard, TweenInfo.new(0.35, Enum.EasingStyle.Quad, Enum.EasingDirection.In), { Position = UDim2.new(0.5, 0, 0, -220) }) + tw:Play() + tw.Completed:Wait() + if my == catchToken then + catchCard.Visible = false + end + end + end) +end + +local function floatText(msg, color) + local l = text({ + Size = UDim2.fromOffset(400, 60), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.42), + Font = TITLE, TextSize = 46, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = color, + TextStrokeTransparency = 0.2, Text = msg, Parent = gui, + }) + TweenService:Create(l, TweenInfo.new(1.4, Enum.EasingStyle.Quad), { Position = UDim2.fromScale(0.5, 0.3), TextTransparency = 1, TextStrokeTransparency = 1 }):Play() + task.delay(1.5, function() + l:Destroy() + end) +end + +---------------------------------------------------------------- статус и мини-игра + +-- вверху, на месте подсказки обучения (она во время рыбалки скрыта) +local statusLabel = softPlate( + { Size = UDim2.fromOffset(0, 64), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 12), Visible = false, Parent = gui }, + { TextSize = 36, Text = "🎣 Ждём клёв…" } +) +wobble(statusLabel, 1.2, 1.4) +local mgFrame = new("Frame", { + Size = UDim2.fromOffset(480, 124), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -100), + BackgroundColor3 = WHITE, Visible = false, Parent = gui, +}, { corner(16), stroke(C.gold, 2.5, 0.1), gradient(C.panel2, C.bg, 90) }) +text({ + Size = UDim2.new(1, 0, 0, 30), Position = UDim2.fromOffset(0, 6), Font = TITLE, TextSize = 24, + TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, TextStrokeTransparency = 0.5, + Text = "❗ КЛЮЁТ! Кликай, когда метка в зелёной зоне", Parent = mgFrame, +}) +local bar = new("Frame", { Size = UDim2.new(1, -30, 0, 36), Position = UDim2.fromOffset(15, 42), BackgroundColor3 = Color3.fromRGB(22, 28, 46), ClipsDescendants = true, Parent = mgFrame }, { corner(9), stroke(BLACK, 1.5, 0.4) }) +local zoneF = new("Frame", { Size = UDim2.fromScale(0.25, 1), BackgroundColor3 = WHITE, BorderSizePixel = 0, Parent = bar }, { gradient(Color3.fromRGB(130, 245, 150), Color3.fromRGB(35, 165, 75), 90) }) +local markerF = new("Frame", { Size = UDim2.new(0, 8, 1, 4), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0, 0.5), BackgroundColor3 = WHITE, ZIndex = 3, Parent = bar }, { corner(4), stroke(BLACK, 2) }) +local pipsText = text({ Size = UDim2.new(0.5, -15, 0, 24), Position = UDim2.fromOffset(15, 84), Font = TITLE, TextSize = 19, RichText = true, Text = "", Parent = mgFrame }) +local missText = text({ Size = UDim2.new(0.5, -15, 0, 24), Position = UDim2.new(0.5, 0, 0, 84), Font = TITLE, TextSize = 19, TextXAlignment = Enum.TextXAlignment.Right, RichText = true, Text = "", Parent = mgFrame }) +local timeBar = new("Frame", { Size = UDim2.new(1, -30, 0, 5), Position = UDim2.fromOffset(15, 112), BackgroundColor3 = C.gold, BorderSizePixel = 0, Parent = mgFrame }, { corner(3) }) + +---------------------------------------------------------------- окна + +local openWindow = nil + +local function makeWindow(title, accent, tabs) + local w = { pages = {}, tabButtons = {}, current = nil } + local frame = new("Frame", { + Size = UDim2.fromScale(0.92, 0.82), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.53), + BackgroundColor3 = WHITE, Visible = false, Parent = gui, + }, { corner(20), stroke(accent, 3, 0.05), gradient(C.panel, C.bg, 90), new("UISizeConstraint", { MaxSize = Vector2.new(760, 540) }) }) + local scale = new("UIScale", { Parent = frame }) + local header = new("Frame", { Size = UDim2.new(1, 0, 0, 56), BackgroundColor3 = WHITE, Parent = frame }, { corner(20), gradient(accent, accent:Lerp(BLACK, 0.35), 90) }) + new("Frame", { Size = UDim2.new(1, 0, 0, 20), Position = UDim2.new(0, 0, 1, -20), BackgroundColor3 = accent:Lerp(BLACK, 0.3), BorderSizePixel = 0, Parent = header }) + text({ Size = UDim2.new(1, -80, 1, 0), Position = UDim2.fromOffset(20, 0), Font = TITLE, TextSize = 30, Text = title, TextStrokeTransparency = 0.5, ZIndex = 2, Parent = header }) + btn({ Size = UDim2.fromOffset(42, 42), Position = UDim2.new(1, -52, 0, 7), BackgroundColor3 = C.red, Text = "✕", TextSize = 22, ZIndex = 3, Parent = header }, function() + w.close() + end) + local hasTabs = #tabs > 1 + local tabBar = new("Frame", { Size = UDim2.new(1, -28, 0, 42), Position = UDim2.fromOffset(14, 66), BackgroundTransparency = 1, Visible = hasTabs, Parent = frame }, + { new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + local top = hasTabs and 116 or 68 + local body = new("Frame", { Size = UDim2.new(1, -28, 1, -(top + 12)), Position = UDim2.fromOffset(14, top), BackgroundTransparency = 1, Parent = frame }) + w.frame = frame + + function w.setTab(id) + w.current = id + for k, page in pairs(w.pages) do + page.Visible = (k == id) + end + for k, b in pairs(w.tabButtons) do + b.BackgroundColor3 = (k == id) and accent or C.panel2 + end + if w.render then + w.render(id) + end + end + for i, t in ipairs(tabs) do + w.pages[t.id] = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, Visible = false, Parent = body }) + w.tabButtons[t.id] = btn({ Size = UDim2.new(1 / #tabs, -8, 1, 0), Text = t.label, TextSize = 18, BackgroundColor3 = C.panel2, LayoutOrder = i, Parent = tabBar }, function() + w.setTab(t.id) + end) + end + function w.open(tab) + if openWindow and openWindow ~= w then + openWindow.close() + end + openWindow = w + if not frame.Visible then + Audio.play("open") + end + frame.Visible = true + scale.Scale = 0.85 + TweenService:Create(scale, TweenInfo.new(0.25, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play() + w.setTab(tab or w.current or tabs[1].id) + end + function w.close() + frame.Visible = false + if openWindow == w then + openWindow = nil + end + end + function w.isOpen() + return frame.Visible + end + function w.toggle(tab) + if frame.Visible and (tab == nil or w.current == tab) then + w.close() + else + w.open(tab) + end + end + function w.refresh() + if frame.Visible and w.render then + w.render(w.current) + end + end + return w +end + +local function scrollArea(parent, cell, topOffset) + local sf = new("ScrollingFrame", { + Size = UDim2.new(1, 0, 1, -(topOffset or 0)), Position = UDim2.fromOffset(0, topOffset or 0), + BackgroundTransparency = 1, BorderSizePixel = 0, ScrollBarThickness = 6, ScrollBarImageColor3 = C.muted, + AutomaticCanvasSize = Enum.AutomaticSize.Y, CanvasSize = UDim2.new(), Parent = parent, + }, { new("UIPadding", { PaddingRight = UDim.new(0, 10), PaddingTop = UDim.new(0, 4), PaddingLeft = UDim.new(0, 2), PaddingBottom = UDim.new(0, 8) }) }) + if cell then + new("UIGridLayout", { CellSize = cell, CellPadding = UDim2.fromOffset(10, 10), SortOrder = Enum.SortOrder.LayoutOrder, Parent = sf }) + else + new("UIListLayout", { Padding = UDim.new(0, 10), SortOrder = Enum.SortOrder.LayoutOrder, Parent = sf }) + end + return sf +end + +local function itemRow(parent, order, o) + local row = new("Frame", { Size = UDim2.new(1, -4, 0, 100), BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent }, + { corner(14), stroke(o.strokeColor or C.line, 2, o.strokeColor and 0 or 0.45), gradient(C.panel2, C.panel, 90) }) + local view = new("Frame", { Size = UDim2.fromOffset(124, 84), Position = UDim2.fromOffset(8, 8), BackgroundColor3 = o.iconBg or C.bg, Parent = row }, { corner(10) }) + if o.model then + viewport(view, o.model, o.dir, o.zoom) + elseif o.icon then + text({ Size = UDim2.fromScale(1, 1), TextSize = 48, TextXAlignment = Enum.TextXAlignment.Center, Text = o.icon, Parent = view }) + end + text({ Size = UDim2.new(1, -300, 0, 28), Position = UDim2.fromOffset(144, 8), Font = TITLE, TextSize = 22, Text = o.title, TextColor3 = o.titleColor or C.text, RichText = true, TextTruncate = Enum.TextTruncate.AtEnd, Parent = row }) + text({ + Size = UDim2.new(1, -300, 0, 56), Position = UDim2.fromOffset(144, 38), Font = BODY2, TextSize = 14, TextColor3 = C.muted, + RichText = true, TextWrapped = true, TextYAlignment = Enum.TextYAlignment.Top, Text = o.lines, Parent = row, + }) + btn({ + Size = UDim2.fromOffset(140, 50), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 0), + Text = o.buttonText, BackgroundColor3 = o.buttonColor, AutoButtonColor = o.active, TextSize = 19, Parent = row, + }, o.active and o.onClick or nil) + return row +end + +local function progressBar(parent, pos, size, frac, color) + local back = new("Frame", { Size = size, Position = pos, BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = parent }, { corner(7) }) + new("Frame", { Size = UDim2.fromScale(math.clamp(frac, 0, 1), 1), BackgroundColor3 = color, Parent = back }, { corner(7) }) + return back +end + +---------------------------------------------------------------- данные с сервера + +local inventory, discovered, claimed = {}, {}, {} +local chain, daily = nil, { available = false, streak = 0, nextStreak = 1 } + +---------------------------------------------------------------- магазин + +local shopWin = makeWindow("🎣 Магазин Михалыча", Color3.fromRGB(215, 120, 40), { + { id = "rods", label = "🎣 Удочки" }, + { id = "upgrade", label = "✨ Улучшение" }, + { id = "bags", label = "🎒 Сумки" }, + { id = "luck", label = "🍀 Удача" }, +}) +local shopLists = { + rods = scrollArea(shopWin.pages.rods), + upgrade = scrollArea(shopWin.pages.upgrade), + bags = scrollArea(shopWin.pages.bags), + luck = scrollArea(shopWin.pages.luck), +} + +local function statLine(s) + return ("🍀 Удача +%d%% ⏱ Клёв x%.2f 🎯 Зона %d%%"):format(math.floor(s.luck * 100 + 0.5), s.speed, math.floor(s.zone * 100 + 0.5)) +end +local function buyButton(price, level, myLevel, coins) + if myLevel < level then + return "🔒 Ур. " .. level, C.grey, false + end + return "💰 " .. fmt(price), coins >= price and C.green or Color3.fromRGB(150, 95, 60), true +end + +shopWin.render = function(tab) + local list = shopLists[tab] + if not list then + return + end + clear(list) + local myLevel = player:GetAttribute("Level") or 1 + local coins = player:GetAttribute("Coins") or 0 + local levels = rodLevels() + + if tab == "rods" then + local owned = attrSet("OwnedRods") + for i, rod in ipairs(Config.Rods) do + local lv = levels[rod.id] or 0 + local equipped = player:GetAttribute("Rod") == rod.id + local bText, bColor, active + if equipped then + bText, bColor, active = "Надето ✓", C.grey, false + elseif owned[rod.id] then + bText, bColor, active = "Надеть", C.blue, true + else + bText, bColor, active = buyButton(rod.price, rod.level, myLevel, coins) + end + itemRow(list, i, { + model = Models.buildRod(rod.id, lv, true), dir = ROD_VIEW, zoom = 0.6, + title = rod.name .. (owned[rod.id] and (" " .. stars(lv) .. "") or ""), + lines = statLine(Config.RodStats(rod.id, lv)) .. "\n" .. (owned[rod.id] and "Куплена" or ("Нужен уровень " .. rod.level)), + strokeColor = equipped and C.gold or nil, + buttonText = bText, buttonColor = bColor, active = active, + onClick = function() + remote:FireServer("Buy", "Rod", rod.id) + end, + }) + end + elseif tab == "upgrade" then + text({ + Size = UDim2.new(1, -4, 0, 40), LayoutOrder = 0, TextSize = 14, Font = BODY2, TextColor3 = C.muted, TextWrapped = true, + Text = "Каждое улучшение даёт +" .. math.floor(Config.RodUpgrade.luckPerLevel * 100) .. "% удачи, ускоряет клёв и расширяет зелёную зону. Максимум — " .. stars(Config.RodUpgrade.maxLevel), + Parent = list, + }) + local owned = attrSet("OwnedRods") + local order = 0 + for _, rod in ipairs(Config.Rods) do + if owned[rod.id] then + order += 1 + local lv = levels[rod.id] or 0 + local now = Config.RodStats(rod.id, lv) + local maxed = lv >= Config.RodUpgrade.maxLevel + local lines + if maxed then + lines = statLine(now) .. "\nМаксимальное улучшение!" + else + local nxt = Config.RodStats(rod.id, lv + 1) + lines = ("🍀 +%d%% → +%d%% ⏱ x%.2f → x%.2f\n🎯 %d%% → %d%%"):format( + math.floor(now.luck * 100 + 0.5), math.floor(nxt.luck * 100 + 0.5), now.speed, nxt.speed, + math.floor(now.zone * 100 + 0.5), math.floor(nxt.zone * 100 + 0.5)) + end + local cost = Config.UpgradeCost(rod, lv) + itemRow(list, order, { + model = Models.buildRod(rod.id, lv, true), dir = ROD_VIEW, zoom = 0.6, + title = rod.name .. " " .. stars(lv) .. "", + lines = lines, + strokeColor = player:GetAttribute("Rod") == rod.id and C.gold or nil, + buttonText = maxed and "MAX ★" or ("✨ " .. fmt(cost)), + buttonColor = maxed and C.grey or (coins >= cost and Color3.fromRGB(190, 120, 255) or Color3.fromRGB(110, 80, 140)), + active = not maxed, + onClick = function() + remote:FireServer("Buy", "Upgrade", rod.id) + end, + }) + end + end + elseif tab == "bags" then + local owned = attrSet("OwnedBags") + local bonus = attrSet("Passes").BigBag and 100 or 0 + for i, bag in ipairs(Config.Bags) do + local equipped = player:GetAttribute("Bag") == bag.id + local bText, bColor, active + if equipped then + bText, bColor, active = "Надето ✓", C.grey, false + elseif owned[bag.id] then + bText, bColor, active = "Надеть", C.blue, true + else + bText, bColor, active = buyButton(bag.price, bag.level, myLevel, coins) + end + itemRow(list, i, { + model = Models.buildBag(bag.id, true), dir = BAG_VIEW, zoom = 0.8, + title = bag.name, + lines = ("🎒 Вмещает %d рыб%s\n%s"):format(bag.capacity + bonus, bonus > 0 and " (с пропуском)" or "", owned[bag.id] and "Куплена" or ("Нужен уровень " .. bag.level)), + strokeColor = equipped and C.gold or nil, + buttonText = bText, buttonColor = bColor, active = active, + onClick = function() + remote:FireServer("Buy", "Bag", bag.id) + end, + }) + end + elseif tab == "luck" then + local lv = levels[player:GetAttribute("Rod") or "Basic"] or 0 + local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic") or Config.Rods[1] + local boost = player:GetAttribute("BoostBonus") or 0 + local total = player:GetAttribute("Luck") or 100 + local ps = attrSet("Passes") + local evId = workspace:GetAttribute("Event") + local event = evId and Config.Find(Config.Events, evId) + local mutLine = {} + for _, m in ipairs(Config.Mutations) do + table.insert(mutLine, ("%s %.1f%%"):format(hex(m.color), m.name, math.min(100, m.chance * total / 100 * ((event and event.mutation) or 1) * 100))) + end + local lines = { + ("🍀 Твоя удача: %d%%"):format(total), + ("Базовая 100%% · 🎣 Удочка +%d%% · ✨ Улучшения +%d%%"):format(math.floor(rod.luck * 100 + 0.5), math.floor(lv * Config.RodUpgrade.luckPerLevel * 100 + 0.5)), + ("⭐ Уровень +%d%% · 🏆 Мастерство миров +%d%%"):format(math.floor(((player:GetAttribute("Level") or 1) - 1) * Config.LuckPerPlayerLevel * 100 + 0.5), math.floor((player:GetAttribute("Mastery") or 0) * Config.MasteryLuck * 100 + 0.5)), + ("🧪 Зелье +%d%%%s · 👑 Пропуска +%d%%%s"):format(math.floor(boost * 100 + 0.5), boost > 0 and (" (" .. timeStr(player:GetAttribute("BoostLeft") or 0) .. ")") or "", + (ps.VIP and 25 or 0) + (ps.LuckyCharm and 50 or 0), (event and event.luck) and (" · 🎉 Событие +" .. event.luck * 100 .. "%") or ""), + "Шанс мутаций: " .. table.concat(mutLine, " · "), + } + local info = new("Frame", { Size = UDim2.new(1, -4, 0, 160), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = list }, + { corner(14), stroke(Color3.fromRGB(90, 220, 120), 2, 0.2), gradient(Color3.fromRGB(35, 70, 55), C.panel, 90), new("UIPadding", { PaddingLeft = UDim.new(0, 16), PaddingTop = UDim.new(0, 10), PaddingRight = UDim.new(0, 16) }) }) + text({ Size = UDim2.fromScale(1, 1), TextSize = 15, RichText = true, TextYAlignment = Enum.TextYAlignment.Top, TextWrapped = true, Text = table.concat(lines, "\n"), Parent = info }) + for i, p in ipairs(Config.Potions) do + local bText, bColor, active = buyButton(p.price, p.level or 1, myLevel, coins) + itemRow(list, i, { + icon = "🧪", iconBg = p.color:Lerp(C.bg, 0.6), + title = p.name, titleColor = p.color, + lines = ("Удача +%d%% на %d мин.\nРедкая рыба и мутации попадаются чаще!"):format(p.bonus * 100, p.duration / 60), + buttonText = bText, buttonColor = bColor, active = active, + onClick = function() + remote:FireServer("Buy", "Potion", p.id) + end, + }) + end + end +end + +---------------------------------------------------------------- сумка и коллекция + +local bagWin = makeWindow("🎒 Сумка", Color3.fromRGB(60, 140, 220), { + { id = "fish", label = "🐟 Улов" }, + { id = "dex", label = "📖 Коллекция" }, +}) + +local fishHeader = new("Frame", { Size = UDim2.new(1, 0, 0, 50), BackgroundColor3 = WHITE, Parent = bagWin.pages.fish }, { corner(12), gradient(C.panel2, C.panel, 90) }) +local fishSummary = text({ Size = UDim2.new(1, -200, 1, 0), Position = UDim2.fromOffset(14, 0), Font = TITLE, TextSize = 19, RichText = true, Text = "", Parent = fishHeader }) +btn({ Size = UDim2.fromOffset(170, 38), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0), BackgroundColor3 = C.green, Text = "💰 Продать всё", TextSize = 18, Parent = fishHeader }, function() + remote:FireServer("SellAll") +end) +local fishGrid = scrollArea(bagWin.pages.fish, UDim2.fromOffset(132, 176), 60) + +local dexWorld = "World1" +local dexTabs = new("Frame", { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1, Parent = bagWin.pages.dex }, + { new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, Padding = UDim.new(0, 8) }) }) +local dexList = scrollArea(bagWin.pages.dex, nil, 46) +local dexTabButtons = {} + +local function fishCard(parent, order, rarityColor, strokeColor) + return new("Frame", { BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent }, + { corner(14), stroke(strokeColor or rarityColor, 2.5, 0.05), gradient(rarityColor:Lerp(C.bg, 0.55), C.panel, 90) }) +end + +local function rewardButton(parent, state, label, onClick) + local color = (state == "ready") and C.green or C.grey + return btn({ + Size = UDim2.fromOffset(150, 34), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0), + BackgroundColor3 = color, AutoButtonColor = state == "ready", Text = label, TextSize = 16, Parent = parent, + }, state == "ready" and onClick or nil) +end + +local function renderDex() + clear(dexList) + for id, b in pairs(dexTabButtons) do + b.BackgroundColor3 = (id == dexWorld) and C.purple or C.panel2 + end + local world = Config.Find(Config.Worlds, dexWorld) + local all = Config.Zones[dexWorld].fish + local found = 0 + for _, f in ipairs(all) do + if discovered[f.id] then + found += 1 + end + end + + -- мастерство мира + local head = new("Frame", { Size = UDim2.new(1, -4, 0, 56), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = dexList }, + { corner(12), stroke(C.gold, 2, 0.3), gradient(Color3.fromRGB(70, 55, 20), C.panel, 90) }) + text({ + Size = UDim2.new(1, -180, 1, 0), Position = UDim2.fromOffset(14, 0), Font = TITLE, TextSize = 17, RichText = true, TextWrapped = true, + Text = ("%s %s — %d / %d\nСобери всех: +%s 💰 и +%d%% удачи навсегда"):format( + world.icon, world.name, found, #all, fmt(Config.MasteryCoins * world.mult), math.floor(Config.MasteryLuck * 100 + 0.5)), + Parent = head, + }) + local mKey = dexWorld .. ":Master" + rewardButton(head, claimed[mKey] and "done" or (found == #all and "ready" or "locked"), + claimed[mKey] and "Получено ✓" or (found == #all and "🏆 Забрать" or "🔒 Не собрано"), function() + remote:FireServer("ClaimCollection", dexWorld, "Master") + end) + + for ri, rarity in ipairs(Config.RarityOrder) do + local group = {} + for _, f in ipairs(all) do + if f.rarity == rarity then + table.insert(group, f) + end + end + if #group > 0 then + local r = Config.Rarities[rarity] + local have = 0 + for _, f in ipairs(group) do + if discovered[f.id] then + have += 1 + end + end + local section = new("Frame", { Size = UDim2.new(1, -4, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, LayoutOrder = ri, Parent = dexList }, + { new("UIListLayout", { Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder }) }) + local hdr = new("Frame", { Size = UDim2.new(1, 0, 0, 44), BackgroundColor3 = WHITE, LayoutOrder = 0, Parent = section }, + { corner(10), gradient(r.color:Lerp(C.bg, 0.5), C.panel, 0) }) + local reward = Config.CollectionRewards[rarity] + text({ + Size = UDim2.new(1, -180, 1, 0), Position = UDim2.fromOffset(12, 0), Font = TITLE, TextSize = 17, RichText = true, + Text = ("%s %d/%d +%s 💰 +%s XP"):format( + hex(r.color), r.name, have, #group, fmt(reward.coins * world.mult), fmt(reward.xp * world.mult)), + Parent = hdr, + }) + local key = dexWorld .. ":" .. rarity + rewardButton(hdr, claimed[key] and "done" or (have == #group and "ready" or "locked"), + claimed[key] and "Получено ✓" or (have == #group and "🎁 Забрать" or ("🔒 " .. have .. "/" .. #group)), function() + remote:FireServer("ClaimCollection", dexWorld, rarity) + end) + local grid = new("Frame", { Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundTransparency = 1, LayoutOrder = 1, Parent = section }, + { new("UIGridLayout", { CellSize = UDim2.fromOffset(124, 150), CellPadding = UDim2.fromOffset(8, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + for i, f in ipairs(group) do + local rec = discovered[f.id] + local card = fishCard(grid, i, rec and r.color or C.grey) + local view = new("Frame", { Size = UDim2.new(1, -12, 0, 76), Position = UDim2.fromOffset(6, 6), BackgroundTransparency = 1, Parent = card }) + local model = Models.buildFish(f.id, nil, 1, true) + viewport(view, rec and model or silhouette(model), FISH_VIEW, 0.72) + text({ Size = UDim2.new(1, -10, 0, 20), Position = UDim2.fromOffset(6, 84), Font = TITLE, TextSize = 15, TextColor3 = rec and r.color or C.muted, Text = rec and f.name or "???", TextTruncate = Enum.TextTruncate.AtEnd, Parent = card }) + text({ + Size = UDim2.new(1, -10, 0, 40), Position = UDim2.fromOffset(6, 104), Font = BODY2, TextSize = 12, TextColor3 = C.muted, TextWrapped = true, + TextYAlignment = Enum.TextYAlignment.Top, + Text = rec and ("Поймано: %d\nРекорд: %.2f кг"):format(rec.count, rec.best) or "Ещё не поймана", Parent = card, + }) + end + end + end +end + +for i, w in ipairs(Config.Worlds) do + if not w.soon then + dexTabButtons[w.id] = btn({ Size = UDim2.new(0, 170, 1, 0), Text = w.icon .. " " .. w.name, TextSize = 15, BackgroundColor3 = C.panel2, LayoutOrder = i, Parent = dexTabs }, function() + dexWorld = w.id + renderDex() + end) + end +end + +bagWin.render = function(tab) + if tab == "fish" then + clear(fishGrid) + local total = 0 + for _, it in ipairs(inventory) do + total += it.value + end + fishSummary.Text = ("🐟 %d / %d · 💰 ≈%s"):format(#inventory, player:GetAttribute("BagCap") or 0, fmt(player:GetAttribute("BagValue") or total)) + if #inventory == 0 then + text({ Size = UDim2.fromOffset(400, 60), Font = TITLE, TextSize = 20, TextColor3 = C.muted, TextWrapped = true, Text = "Сумка пуста. Иди к воде и поймай рыбу! 🎣", Parent = fishGrid }) + return + end + local sorted = table.clone(inventory) + table.sort(sorted, function(a, b) + return a.value > b.value + end) + for i, it in ipairs(sorted) do + local r = Config.Rarities[it.rarity] or Config.Rarities.Common + local mut = it.mutation and Config.Find(Config.Mutations, it.mutation) + local card = fishCard(fishGrid, i, r.color, mut and mut.color) + local view = new("Frame", { Size = UDim2.new(1, -12, 0, 84), Position = UDim2.fromOffset(6, 6), BackgroundTransparency = 1, Parent = card }) + viewport(view, Models.buildFish(it.id, it.mutation, 1, true), FISH_VIEW, 0.72) + if mut then + local tag = new("Frame", { Size = UDim2.fromOffset(0, 20), AutomaticSize = Enum.AutomaticSize.X, Position = UDim2.fromOffset(6, 6), BackgroundColor3 = mut.color, ZIndex = 3, Parent = card }, + { corner(6), new("UIPadding", { PaddingLeft = UDim.new(0, 6), PaddingRight = UDim.new(0, 6) }) }) + text({ Size = UDim2.new(0, 0, 1, 0), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 13, TextColor3 = C.bg, Text = mut.name, ZIndex = 4, Parent = tag }) + end + text({ Size = UDim2.new(1, -10, 0, 20), Position = UDim2.fromOffset(6, 92), Font = TITLE, TextSize = 16, TextColor3 = r.color, Text = it.name, TextTruncate = Enum.TextTruncate.AtEnd, Parent = card }) + text({ Size = UDim2.new(1, -10, 0, 16), Position = UDim2.fromOffset(6, 112), Font = BODY2, TextSize = 13, TextColor3 = C.muted, Text = ("%.2f кг · %s"):format(it.weight, r.name), Parent = card }) + btn({ Size = UDim2.new(1, -12, 0, 32), Position = UDim2.fromOffset(6, 136), BackgroundColor3 = C.green, Text = "💰 " .. fmt(it.value), TextSize = 17, Parent = card }, function() + remote:FireServer("SellOne", it.uid) + end) + end + elseif tab == "dex" then + renderDex() + end +end + +---------------------------------------------------------------- миры + +local worldsWin = makeWindow("🌍 Миры", Color3.fromRGB(40, 160, 200), { { id = "list", label = "Миры" } }) +local worldsList = scrollArea(worldsWin.pages.list) + +local function currentWorld() + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + return hrp and Config.WorldAt(hrp.Position) +end + +worldsWin.render = function() + clear(worldsList) + local myLevel = player:GetAttribute("Level") or 1 + local here = currentWorld() + itemRow(worldsList, 0, { + icon = "🏠", iconBg = Color3.fromRGB(90, 70, 30), + title = "Лобби", titleColor = C.gold, + lines = "Магазин удочек, скупка, донат-лавки и ежедневный сундук.", + buttonText = here == nil and "Вы здесь" or "🌀 Телепорт", buttonColor = here == nil and C.grey or C.blue, active = here ~= nil, + onClick = function() + remote:FireServer("Teleport", "Lobby") + worldsWin.close() + end, + }) + for i, w in ipairs(Config.Worlds) do + local zone = Config.Zones[w.id] + local total, found = 0, 0 + if zone then + for _, f in ipairs(zone.fish) do + total += 1 + if discovered[f.id] then + found += 1 + end + end + end + local bText, bColor, active + if w.soon then + bText, bColor, active = "Скоро…", C.grey, false + elseif myLevel < w.level then + bText, bColor, active = "🔒 Ур. " .. w.level, C.grey, false + elseif here and here.id == w.id then + bText, bColor, active = "Вы здесь", C.grey, false + else + bText, bColor, active = "🌀 Телепорт", C.blue, true + end + itemRow(worldsList, i, { + icon = w.icon, iconBg = w.color:Lerp(C.bg, 0.6), + title = w.name, titleColor = w.color, + lines = w.desc .. "\n" .. (w.soon and "В разработке" or ("Уровень: %d · Рыб поймано: %d / %d · Награды x%d"):format(w.level, found, total, w.mult)), + strokeColor = (here and here.id == w.id) and C.gold or nil, + buttonText = bText, buttonColor = bColor, active = active, + onClick = function() + remote:FireServer("Teleport", w.id) + worldsWin.close() + end, + }) + end +end + +---------------------------------------------------------------- задания и ежедневная награда + +local questWin = makeWindow("📜 Задания", Color3.fromRGB(200, 140, 40), { + { id = "quests", label = "📜 Задания" }, + { id = "daily", label = "🎁 Ежедневно" }, +}) +local questList = scrollArea(questWin.pages.quests) +local dailyPage = questWin.pages.daily + +local function questText(kind, goal) + local t = Config.QuestKinds[kind] + if not t then + return kind + end + if t.forms then + local m10, m100 = goal % 10, goal % 100 + local i = (m10 == 1 and m100 ~= 11) and 1 or ((m10 >= 2 and m10 <= 4 and (m100 < 12 or m100 > 14)) and 2 or 3) + return t.text:format(goal, t.forms[i]) + end + return string.find(t.text, "%%d") and t.text:format(goal) or t.text +end + +questWin.render = function(tab) + if tab == "quests" then + clear(questList) + if not chain then + return + end + text({ + Size = UDim2.new(1, -4, 0, 30), LayoutOrder = 0, Font = TITLE, TextSize = 22, RichText = true, + Text = ("%s круг %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 + text({ + Size = UDim2.new(1, 0, 0, 30), Font = TITLE, TextSize = 20, RichText = true, + Text = ("🔥 Серия: %d дн. Заходи каждый день — награда растёт!"):format(daily.streak), Parent = dailyPage, + }) + local row = new("Frame", { Size = UDim2.new(1, 0, 0, 150), Position = UDim2.fromOffset(0, 40), BackgroundTransparency = 1, Parent = dailyPage }, + { new("UIGridLayout", { CellSize = UDim2.new(1 / 7, -8, 1, 0), CellPadding = UDim2.fromOffset(8, 0) }) }) + for d, r in ipairs(Config.DailyRewards) do + local isNext = d == daily.nextStreak and daily.available + local passed = d <= daily.streak and not (daily.available and daily.nextStreak == 1) + local cell = new("Frame", { BackgroundColor3 = WHITE, Parent = row }, + { corner(12), stroke(isNext and C.gold or C.line, isNext and 3 or 2, isNext and 0 or 0.4), gradient(isNext and Color3.fromRGB(90, 70, 20) or C.panel2, C.panel, 90) }) + text({ Size = UDim2.new(1, 0, 0, 24), Position = UDim2.fromOffset(0, 6), Font = TITLE, TextSize = 15, TextXAlignment = Enum.TextXAlignment.Center, Text = "День " .. d, Parent = cell }) + text({ Size = UDim2.new(1, 0, 0, 44), Position = UDim2.fromOffset(0, 32), TextSize = 32, TextXAlignment = Enum.TextXAlignment.Center, Text = passed and "✅" or (r.potion and "🧪" or "💰"), Parent = cell }) + text({ + Size = UDim2.new(1, -6, 0, 50), Position = UDim2.fromOffset(3, 80), Font = BODY2, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, TextWrapped = true, TextColor3 = C.gold, + Text = fmt(r.coins * (1 + (myLevel - 1) * 0.2)) .. " 💰" .. (r.potion and "\n+ зелье" or ""), Parent = cell, + }) + end + btn({ + Size = UDim2.fromOffset(260, 54), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 210), + BackgroundColor3 = daily.available and C.green or C.grey, AutoButtonColor = daily.available, + Text = daily.available and "🎁 Забрать награду" or "Приходи завтра!", TextSize = 22, Parent = dailyPage, + }, daily.available and function() + remote:FireServer("ClaimDaily") + end or nil) + end +end + +---------------------------------------------------------------- донат + +local robuxWin = makeWindow("💎 Премиум", Color3.fromRGB(150, 80, 210), { + { id = "passes", label = "👑 Пропуска" }, + { id = "products", label = "🪙 Наборы" }, +}) +local robuxLists = { passes = scrollArea(robuxWin.pages.passes), products = scrollArea(robuxWin.pages.products) } + +robuxWin.render = function(tab) + local list = robuxLists[tab] + clear(list) + local owned = attrSet("Passes") + local items = tab == "passes" and Config.GamePasses or Config.Products + for i, it in ipairs(items) do + local has = tab == "passes" and owned[it.key] + itemRow(list, i, { + icon = it.icon, iconBg = Color3.fromRGB(70, 40, 100), + title = it.name, titleColor = C.gold, + lines = it.desc .. (tab == "passes" and "\nДействует навсегда" or ""), + strokeColor = has and C.gold or nil, + buttonText = has and "Куплено ✓" or ("R$ " .. it.robux), buttonColor = has and C.grey or C.green, active = not has, + onClick = function() + if not it.id or it.id == 0 then + notify("⚙ Товар не настроен", Color3.fromRGB(255, 200, 120)) + return + end + if tab == "passes" then + MarketplaceService:PromptGamePassPurchase(player, it.id) + else + MarketplaceService:PromptProductPurchase(player, it.id) + end + end, + }) + end +end + +---------------------------------------------------------------- настройки звука + +local settingsWin = makeWindow("⚙ Настройки", Color3.fromRGB(150, 120, 80), { { id = "sound", label = "Звук" } }) +local settingsPage = settingsWin.pages.sound +local volumes = { + music = player:GetAttribute("VolMusic") or Config.DefaultVolume.music, + sfx = player:GetAttribute("VolSfx") or Config.DefaultVolume.sfx, +} + +local function setVolume(key, value) + volumes[key] = math.clamp(math.floor(value * 10 + 0.5) / 10, 0, 1) + -- сразу у себя (слышно без задержки), сервер сохранит и подтвердит + player:SetAttribute(key == "music" and "VolMusic" or "VolSfx", volumes[key]) + remote:FireServer("Settings", volumes.music, volumes.sfx) + settingsWin.refresh() +end + +settingsWin.render = function() + clear(settingsPage) + for i, row in ipairs({ { "music", "🎵 Музыка" }, { "sfx", "🔊 Звуки и окружение" } }) do + local key, label = row[1], row[2] + local f = new("Frame", { Size = UDim2.new(1, -4, 0, 70), Position = UDim2.fromOffset(0, (i - 1) * 82), BackgroundColor3 = WHITE, Parent = settingsPage }, + { corner(14), stroke(C.line, 2, 0.45), gradient(C.panel2, C.panel, 90) }) + text({ Size = UDim2.new(1, -260, 1, 0), Position = UDim2.fromOffset(18, 0), Font = TITLE, TextSize = 21, Text = label, Parent = f }) + btn({ Size = UDim2.fromOffset(52, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -170, 0.5, 0), BackgroundColor3 = C.grey, Text = "−", TextSize = 26, Parent = f }, function() + setVolume(key, volumes[key] - 0.1) + end) + text({ Size = UDim2.fromOffset(90, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -74, 0.5, 0), Font = TITLE, TextSize = 22, + TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, Text = math.floor(volumes[key] * 100 + 0.5) .. "%", Parent = f }) + btn({ Size = UDim2.fromOffset(52, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -14, 0.5, 0), BackgroundColor3 = C.green, Text = "+", TextSize = 26, Parent = f }, function() + setVolume(key, volumes[key] + 0.1) + end) + end +end +-- сервер прислал сохранённую громкость +player:GetAttributeChangedSignal("VolMusic"):Connect(function() + volumes.music = player:GetAttribute("VolMusic") or volumes.music + settingsWin.refresh() +end) +player:GetAttributeChangedSignal("VolSfx"):Connect(function() + volumes.sfx = player:GetAttribute("VolSfx") or volumes.sfx + settingsWin.refresh() +end) + +---------------------------------------------------------------- боковые кнопки + +sideButton(1, "🎒", "Сумка", "B", Color3.fromRGB(60, 140, 220), function() + bagWin.toggle("fish") +end) +sideButton(2, "📖", "Рыбы", "C", Color3.fromRGB(150, 90, 220), function() + bagWin.toggle("dex") +end) +sideButton(3, "🌍", "Миры", "M", Color3.fromRGB(40, 160, 200), function() + worldsWin.toggle() +end) +sideButton(4, "📜", "Задания", "Q", Color3.fromRGB(210, 150, 40), function() + questWin.toggle() +end) +sideButton(5, "💎", "Донат", nil, Color3.fromRGB(150, 80, 210), function() + robuxWin.toggle() +end) +sideButton(6, "⚙", "Звук", nil, Color3.fromRGB(150, 120, 80), function() + settingsWin.toggle() +end) + +local function refreshDots() + -- задания цепочки награждаются сами, точка — только для ежедневной награды + sideDots["Задания"].Visible = daily.available + local c = false + for _, w in ipairs(Config.Worlds) do + local zone = Config.Zones[w.id] + if zone then + for _, rarity in ipairs(Config.RarityOrder) do + local any, all = false, true + for _, f in ipairs(zone.fish) do + if f.rarity == rarity then + any = true + if not discovered[f.id] then + all = false + end + end + end + if any and all and not claimed[w.id .. ":" .. rarity] then + c = true + end + end + end + end + sideDots["Рыбы"].Visible = c +end + +---------------------------------------------------------------- HUD: обновление + +local function refreshHud() + local xp = player:GetAttribute("XP") or 0 + local need = player:GetAttribute("XPNeed") or 100 + coinsText.Text = "💰 " .. fmt(player:GetAttribute("Coins") or 0) + lvlText.Text = tostring(player:GetAttribute("Level") or 1) + xpText.Text = ("%d / %d XP"):format(xp, need) + TweenService:Create(xpFill, TweenInfo.new(0.3), { Size = UDim2.fromScale(math.clamp(xp / need, 0, 1), 1) }):Play() + local boost = player:GetAttribute("BoostBonus") or 0 + luckText.Text = ("🍀 Удача %d%%%s"):format(player:GetAttribute("Luck") or 100, + boost > 0 and (" 🧪 +%d%% %s"):format(boost * 100, timeStr(player:GetAttribute("BoostLeft") or 0)) or "") + local count, cap = player:GetAttribute("BagCount") or 0, player:GetAttribute("BagCap") or 10 + bagText.Text = ("🎒 %d / %d · ≈ %s 💰"):format(count, cap, fmt(player:GetAttribute("BagValue") or 0)) + bagText.TextColor3 = count >= cap and Color3.fromRGB(255, 120, 120) or C.text + local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic") + rodText.Text = ("🎣 %s %s"):format(rod and rod.name or "", stars(player:GetAttribute("RodLevel") or 0)) +end + +local pending = false +player.AttributeChanged:Connect(function(name) + refreshHud() + if name == "BoostLeft" and not (shopWin.isOpen() and shopWin.current == "luck") then + return + end + if not pending then + pending = true + task.defer(function() + pending = false + shopWin.refresh() + robuxWin.refresh() + if worldsWin.isOpen() then + worldsWin.refresh() + end + end) + end +end) +refreshHud() + +---------------------------------------------------------------- рыбалка + +local state = "idle" +local mg = { pos = 0, dir = 1, speed = 1, zoneStart = 0.4, zoneWidth = 0.25, hits = 0, need = 1, misses = 0, maxMisses = 2, deadline = 0, timeout = 10 } + +-- с начала зарядки и до конца рыбалки персонажем не управляем: не ходит, не прыгает, не поворачивается +local ContextActionService = game:GetService("ContextActionService") +local MOVE_KEYS = { + Enum.KeyCode.W, Enum.KeyCode.A, Enum.KeyCode.S, Enum.KeyCode.D, Enum.KeyCode.Space, + Enum.KeyCode.Up, Enum.KeyCode.Down, Enum.KeyCode.Left, Enum.KeyCode.Right, + Enum.KeyCode.Thumbstick1, Enum.KeyCode.ButtonA, +} +local controls +local movementLocked = false +local function setMovementLocked(locked) + if not controls then + local pm = player:FindFirstChild("PlayerScripts") and player.PlayerScripts:FindFirstChild("PlayerModule") + local ok, mod = pcall(require, pm) + controls = ok and mod and mod:GetControls() or nil + end + if controls then + if locked then + controls:Disable() + else + controls:Enable() + end + end + if locked ~= movementLocked then + movementLocked = locked + if locked then + ContextActionService:BindActionAtPriority("FishingLock", function() + return Enum.ContextActionResult.Sink + end, false, Enum.ContextActionPriority.High.Value + 100, table.unpack(MOVE_KEYS)) + else + ContextActionService:UnbindAction("FishingLock") + end + end + local hum = player.Character and player.Character:FindFirstChildOfClass("Humanoid") + if hum then + hum.AutoRotate = not locked + hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, not locked) + if locked then + hum:Move(Vector3.zero) + end + end +end + +local function easeInOut(a) + return a < 0.5 and 4 * a * a * a or 1 - (-2 * a + 2) ^ 3 / 2 +end +local function easeOut(a) + return 1 - (1 - a) ^ 3 +end + +---------------------------------------------------------------- заброс: зарядка, шкала силы, наклон удочки +-- держишь ЛКМ — сила растёт, удочка уходит назад; отпустил — бросок на дальность по силе + +local REST_ANGLE, BACK_ANGLE = 30, 110 -- удочка в покое (как в GameServer) и в полном замахе +local function gripCF(angle) + return (CFrame.Angles(math.rad(angle), 0, 0) * CFrame.new(0, 0, -0.3)):Inverse() +end + +local charge = nil -- { t0, tool } +local castTool = nil -- удочка последнего броска: вернуть её в покой, если бросок не удался +-- сила ездит туда-сюда: 0 → 1 за CastChargeTime, потом обратно к 0 и снова вверх, пока держишь ЛКМ +local function chargePower() + if not charge then + return 0 + end + local t = ((os.clock() - charge.t0) / Config.CastChargeTime) % 2 + return t <= 1 and t or 2 - t +end +local function inPerfect(v) + return v >= Config.CastPerfect[1] and v <= Config.CastPerfect[2] +end + +-- шкала-дуга справа от персонажа: внизу слабый бросок, вверху сильный, зелёная зона — бонус удачи +local GAUGE_R, GAUGE_DEG, GAUGE_N = 190, 110, 32 +local gauge = new("Frame", { + Size = UDim2.fromOffset(150, 280), AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0.57, 0, 0.48, 0), + BackgroundTransparency = 1, Visible = false, Parent = gui, +}) +local GAUGE_C = Vector2.new(110 - GAUGE_R, 140) -- центр окружности левее рамки: дуга выгнута вправо +local function arcPoint(v, r) + local th = math.rad(-GAUGE_DEG / 2 + GAUGE_DEG * v) + return GAUGE_C + Vector2.new(math.cos(th) * r, -math.sin(th) * r), -math.deg(th) +end +do + local segLen = 2 * math.pi * GAUGE_R * (GAUGE_DEG / 360) / GAUGE_N + for _, layer in ipairs({ { 46, 4, BLACK }, { 34, 1 } }) do -- чёрная обводка, потом цветные секции + for i = 0, GAUGE_N - 1 do + local v = (i + 0.5) / GAUGE_N + local pos, rot = arcPoint(v, GAUGE_R) + local color = layer[3] + or ((v < 0.12 or v > 0.94) and C.red) + or (inPerfect(v) and Color3.fromRGB(110, 235, 60)) + or Color3.fromRGB(40, 70, 95) + new("Frame", { + Size = UDim2.fromOffset(layer[1], segLen + layer[2]), AnchorPoint = Vector2.new(0.5, 0.5), + Position = UDim2.fromOffset(pos.X, pos.Y), Rotation = rot, BorderSizePixel = 0, + BackgroundColor3 = color, Parent = gauge, + }) + end + end +end +local needle = new("Frame", { + Size = UDim2.fromOffset(64, 8), AnchorPoint = Vector2.new(0.5, 0.5), BackgroundColor3 = WHITE, + BorderSizePixel = 0, ZIndex = 3, Parent = gauge, +}, { corner(4), stroke(BLACK, 2) }) +local multLabel = text({ + Size = UDim2.fromOffset(110, 40), AnchorPoint = Vector2.new(0.5, 1), Font = TITLE, TextSize = 34, + Text = "×" .. Config.CastPerfectLuck, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 4, + Visible = false, Parent = gauge, +}) +new("UIStroke", { Color = BLACK, Thickness = 3, Parent = multLabel }) +do + local top = arcPoint(1, GAUGE_R) + multLabel.Position = UDim2.fromOffset(top.X + 10, top.Y - 18) +end + +local function updateCharge() + local p = chargePower() + local pos, rot = arcPoint(p, GAUGE_R) + needle.Position = UDim2.fromOffset(pos.X, pos.Y) + needle.Rotation = rot + local good = inPerfect(p) + multLabel.Visible = good + needle.BackgroundColor3 = good and Color3.fromRGB(190, 255, 150) or WHITE + if charge.tool and charge.tool.Parent then + charge.tool.Grip = gripCF(REST_ANGLE + (BACK_ANGLE - REST_ANGLE) * easeOut(p)) + end +end + +---------------------------------------------------------------- камера при забросе +-- зарядка: камера уходит в сторону от персонажа и отъезжает тем дальше, чем сильнее замах; +-- бросок: камера сбоку разгоняется за поплавком; потом сверху-сбоку держит в кадре игрока и поплавок + +local CAM_IN, CAM_SETTLE, CAM_RETURN = 0.35, 0.8, 0.6 +local UP = Vector3.new(0, 1, 0) +local fishCam = nil + +local function sideCF(fc, p) + return CFrame.lookAt(fc.hrp + fc.r * (9 + 3 * p) - fc.f * (3 + 2 * p) + UP * (3 + 1.5 * p), fc.hrp + fc.f * 6 + UP) +end +local function chaseCF(fc, p) + return CFrame.lookAt(p + fc.r * 9 - fc.f * 5 + UP * 3, p + fc.f * 3) +end +local function restCF(fc) + local d = ((fc.target - fc.hrp) * Vector3.new(1, 0, 1)).Magnitude + local mid = fc.hrp:Lerp(fc.target, 0.5) + return CFrame.lookAt(mid + fc.r * (8 + d * 0.55) - fc.f * 4 + UP * (6 + d * 0.25), fc.hrp:Lerp(fc.target, 0.6)) +end + +local function fishCamStep() + local fc = fishCam + local cam = workspace.CurrentCamera + if not fc or not cam then + return + end + if fc.returning then + local a = math.min(1, (os.clock() - fc.returning) / CAM_RETURN) + local e = easeInOut(a) + cam.CFrame = fc.leaveCF:Lerp(fc.origCF, e) + cam.FieldOfView = fc.leaveFov + (fc.origFov - fc.leaveFov) * e + if a >= 1 then + RunService:UnbindFromRenderStep("FishCam") + cam.CameraType = Enum.CameraType.Custom + fishCam = nil + end + return + end + local now = os.clock() + local cf, fov + if not fc.castT0 then + -- зарядка: плавно уходим в вид сбоку; чем сильнее замах, тем дальше камера и шире обзор + -- после отпускания ЛКМ, пока ждём ответ сервера, держим набранную силу + local p = charge and chargePower() or (fc.power or 0) + fc.power = p + local e = easeOut(math.min(1, (now - fc.t0) / CAM_IN)) + cf = fc.origCF:Lerp(sideCF(fc, p), e) + fov = fc.origFov + 12 * p * e + else + local th = fc.throw + local t = now - fc.castT0 + local lunge = fc.fromCF + fc.f * 1.5 + if t < th.windup then + -- рывок удочки вперёд: камера подаётся следом + local e = easeOut(t / th.windup) + cf = fc.fromCF:Lerp(lunge, e) + fov = fc.fromFov + 4 * e + elseif t < th.windup + th.flight then + if not fc.start then + fc.start = (fc.tip and fc.tip.Parent and fc.tip.WorldPosition) or (fc.hrp + fc.f * 2 + UP * 4) + end + local a = (t - th.windup) / th.flight + local p = fc.start:Lerp(fc.target, a) + UP * (math.sin(a * math.pi) * th.arc) -- та же дуга, что у поплавка + local e = easeInOut(a) + cf = lunge:Lerp(chaseCF(fc, p), e) + fov = (fc.fromFov + 4) + ((fc.origFov - 6) - (fc.fromFov + 4)) * e + else + local e = easeOut(math.min(1, (t - th.windup - th.flight) / CAM_SETTLE)) + local sway = Vector3.new(math.sin(now * 0.7) * 0.5, math.sin(now * 1.1) * 0.25, 0) + if state == "bite" then + sway += Vector3.new(math.random() - 0.5, math.random() - 0.5, 0) * 0.15 + end + cf = chaseCF(fc, fc.target):Lerp(restCF(fc) + sway, e) + fov = fc.origFov - 6 + 6 * e + end + end + cam.CFrame = cf + cam.FieldOfView = fov +end + +-- начало зарядки: dir — куда полетит поплавок (к центру озера) +local function startChargeCam(tool, dir) + local cam = workspace.CurrentCamera + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if not cam or not hrp then + return + end + fishCam = { + t0 = os.clock(), hrp = hrp.Position, f = dir, r = dir:Cross(UP), + tip = tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip"), + -- если камера ещё возвращалась с прошлого заброса, возвращаться будем туда же + origCF = fishCam and fishCam.origCF or cam.CFrame, + origFov = fishCam and fishCam.origFov or cam.FieldOfView, + } + cam.CameraType = Enum.CameraType.Scriptable + RunService:UnbindFromRenderStep("FishCam") + RunService:BindToRenderStep("FishCam", Enum.RenderPriority.Camera.Value + 1, fishCamStep) +end + +-- сервер принял бросок: target — куда упадёт поплавок, throw — тайминги и высота дуги +local function startCastCam(target, throw) + local cam = workspace.CurrentCamera + if not fishCam or fishCam.returning or not cam or typeof(target) ~= "Vector3" or type(throw) ~= "table" then + return + end + fishCam.castT0 = os.clock() + fishCam.target = target + fishCam.throw = throw + fishCam.fromCF = cam.CFrame + fishCam.fromFov = cam.FieldOfView +end + +local function stopFishCam() + local cam = workspace.CurrentCamera + if not fishCam or fishCam.returning or not cam then + return + end + fishCam.returning = os.clock() + fishCam.leaveCF = cam.CFrame + fishCam.leaveFov = cam.FieldOfView +end + +local reelToken +local function setState(s) + if s ~= "charging" and charge then + -- зарядку прервали (убрал удочку и т.п.): удочку обратно в покой + if charge.tool.Parent then + charge.tool.Grip = gripCF(REST_ANGLE) + end + charge = nil + end + state = s + Audio.fade(reelSound, s == "bite" and 1 or 0, s == "bite" and 0.2 or 0.4) + statusLabel.Visible = (s == "waiting") + mgFrame.Visible = (s == "bite") + gauge.Visible = (s == "charging") + setMovementLocked(s ~= "idle") + if s == "idle" then + stopFishCam() + elseif s == "reeling" then + -- на случай, если сервер не ответит на вытаскивание: не оставляем игрока замороженным + local token = {} + reelToken = token + task.delay(4, function() + if state == "reeling" and reelToken == token then + setState("idle") + end + end) + end +end +local function updatePips() + pipsText.Text = "🎯 " .. string.rep("●", mg.hits) .. string.rep("●", mg.need - mg.hits) + missText.Text = string.rep("✖", mg.misses) .. string.rep("❤️", mg.maxMisses - mg.misses) +end +local function flash(color) + bar.BackgroundColor3 = color + TweenService:Create(bar, TweenInfo.new(0.35), { BackgroundColor3 = Color3.fromRGB(22, 28, 46) }):Play() +end +local function placeZone() + mg.zoneStart = math.random() * (1 - mg.zoneWidth) + zoneF.Size = UDim2.fromScale(mg.zoneWidth, 1) + zoneF.Position = UDim2.fromScale(mg.zoneStart, 0) +end + +-- ЛКМ зажата: персонаж разворачивается к центру озера, начинается зарядка +local function startCharge(tool) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if not hrp then + return + end + local world = Config.WorldAt(hrp.Position) + -- из воды и издалека не заряжаем вовсе: сразу подсказка + local can = Config.CanCastFrom(world, hrp.Position, player.Character:FindFirstChildOfClass("Humanoid")) + if can ~= true then + notify(can, Color3.fromRGB(255, 200, 120)) + return + end + local dir = Config.CastDirection(world, hrp.Position) + if not dir then + dir = hrp.CFrame.LookVector * Vector3.new(1, 0, 1) + dir = dir.Magnitude > 0.01 and dir.Unit or Vector3.new(0, 0, -1) + end + hrp.CFrame = CFrame.lookAt(hrp.Position, hrp.Position + dir) + charge = { t0 = os.clock(), tool = tool } + setState("charging") + startChargeCam(tool, dir) + updateCharge() +end + +-- ЛКМ отпущена: бросок с набранной силой +local function releaseCast() + if state ~= "charging" or not charge then + return + end + local power = chargePower() + castTool = charge.tool + charge = nil -- удочку не возвращаем: сервер сам сделает рывок вперёд + setState("casting") + remote:FireServer("Cast", power) +end + +local function onActivate() + if state == "waiting" then + remote:FireServer("Cancel") + setState("idle") + elseif state == "bite" then + local inZone = mg.pos >= mg.zoneStart and mg.pos <= mg.zoneStart + mg.zoneWidth + if inZone then + mg.hits += 1 + flash(Color3.fromRGB(60, 160, 80)) + if mg.hits >= mg.need then + setState("reeling") + remote:FireServer("Catch", true, mg.misses) + return + end + mg.speed *= 1.12 + placeZone() + else + mg.misses += 1 + flash(Color3.fromRGB(170, 50, 50)) + if mg.misses >= mg.maxMisses then + setState("reeling") + remote:FireServer("Catch", false, mg.misses) + return + end + end + updatePips() + end +end + +local hooked = setmetatable({}, { __mode = "k" }) +local function hookTool(tool) + if hooked[tool] or not tool:IsA("Tool") or not tool:GetAttribute("IsRod") then + return + end + hooked[tool] = true + tool.Activated:Connect(function() + if state == "idle" then + startCharge(tool) + else + onActivate() + end + end) + tool.Deactivated:Connect(releaseCast) + tool.Unequipped:Connect(function() + if state == "waiting" or state == "bite" or state == "casting" then + remote:FireServer("Cancel") + end + setState("idle") + end) +end +local function watch(container) + for _, c in ipairs(container:GetChildren()) do + hookTool(c) + end + container.ChildAdded:Connect(hookTool) +end +player.ChildAdded:Connect(function(c) + if c:IsA("Backpack") then + watch(c) + end +end) +if player:FindFirstChild("Backpack") then + watch(player.Backpack) +end +player.CharacterAdded:Connect(function(char) + setState("idle") + watch(char) +end) +if player.Character then + watch(player.Character) +end + +RunService.RenderStepped:Connect(function() + if state == "charging" and charge then + updateCharge() + end +end) + +RunService.RenderStepped:Connect(function(dt) + if state ~= "bite" then + return + end + mg.pos += mg.dir * mg.speed * dt + if mg.pos >= 1 then + mg.pos, mg.dir = 1, -1 + elseif mg.pos <= 0 then + mg.pos, mg.dir = 0, 1 + end + markerF.Position = UDim2.fromScale(mg.pos, 0.5) + local left = math.max(0, mg.deadline - os.clock()) + timeBar.Size = UDim2.new(left / mg.timeout, -30 * left / mg.timeout, 0, 5) + if left <= 0 then + setState("reeling") + remote:FireServer("Catch", false, mg.misses) + end +end) + +UserInputService.InputBegan:Connect(function(input, processed) + if processed then + return + end + local k = input.KeyCode + if k == Enum.KeyCode.B then + bagWin.toggle("fish") + elseif k == Enum.KeyCode.C then + bagWin.toggle("dex") + elseif k == Enum.KeyCode.M then + worldsWin.toggle() + elseif k == Enum.KeyCode.Q then + questWin.toggle() + end +end) + +---------------------------------------------------------------- атмосфера миров (только у этого игрока) + +local snowPart = new("Part", { + Name = "SnowFX", Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false, + Transparency = 1, Size = Vector3.new(90, 1, 90), Parent = workspace, +}) +local snow = new("ParticleEmitter", { + Rate = 0, Lifetime = NumberRange.new(5, 7), Speed = NumberRange.new(4, 7), + EmissionDirection = Enum.NormalId.Bottom, SpreadAngle = Vector2.new(15, 15), + Size = NumberSequence.new(0.25), Color = ColorSequence.new(WHITE), LightEmission = 0.3, + Parent = snowPart, +}) +local lastWorldId = "none" +local terrain = workspace.Terrain + +-- то, что мир может поменять под себя (оттенок, цвета травы и песка); вода не трогается — она из свойств Terrain +local DEFAULT_LOOK = { tint = Color3.new(1, 1, 1) } +local defaultTerrainColors = nil + +-- world.look: свет и эффекты мира; при выходе свойства возвращаются к тем, что были до первого входа +local lookTargets = { + lighting = function() return Lighting end, + atmosphere = function() return Lighting:FindFirstChildOfClass("Atmosphere") end, + color = function() return Lighting:FindFirstChildOfClass("ColorCorrectionEffect") end, + bloom = function() return Lighting:FindFirstChildOfClass("BloomEffect") end, + sunRays = function() return Lighting:FindFirstChildOfClass("SunRaysEffect") end, + dof = function() + return Lighting:FindFirstChildOfClass("DepthOfFieldEffect") + or new("DepthOfFieldEffect", { Enabled = false, Parent = Lighting }) + end, + grading = function() return Lighting:FindFirstChildOfClass("ColorGradingEffect") end, +} +local lookDefaults = {} +-- лобби настраивается так же, как миры +local lookSources = table.clone(Config.Worlds) +table.insert(lookSources, Config.Lobby) + +-- смена света: плавно или сразу (за экраном загрузки) +local lookTweens = {} +local function setLook(obj, goal, instant) + if instant then + for prop, v in pairs(goal) do + obj[prop] = v + end + else + local tw = TweenService:Create(obj, TweenInfo.new(2), goal) + table.insert(lookTweens, tw) + tw:Play() + end +end + +-- погода сгущает дымку поверх настроек локации (туман — сильно, дождь и гроза — слегка) +local WEATHER_ATMO = { + Fog = { Density = 0.22, Haze = 1.5 }, + Rain = { Density = 0.06, Haze = 0.4 }, + Storm = { Density = 0.12, Haze = 0.8 }, +} +local function weatherAtmo(prop) + local add = WEATHER_ATMO[workspace:GetAttribute("Weather") or ""] + return (add and add[prop]) or 0 +end + +local function applyLook(world, instant) + -- исходные значения запоминаем до первой правки; эффект мог ещё не прийти с сервера, тогда в следующий раз + for _, w in ipairs(lookSources) do + for section, props in pairs(w.look or {}) do + local obj = lookTargets[section] and lookTargets[section]() + if obj then + lookDefaults[section] = lookDefaults[section] or {} + for prop in pairs(props) do + if lookDefaults[section][prop] == nil then + lookDefaults[section][prop] = obj[prop] + end + end + end + end + end + local look = (world and world.look) or {} + for section, defaults in pairs(lookDefaults) do + local obj = lookTargets[section]() + if obj then + local goal = {} + for prop, def in pairs(defaults) do + local v = look[section] and look[section][prop] + if v == nil then v = def end + if section == "atmosphere" and typeof(v) == "number" then + v += weatherAtmo(prop) + end + -- плавно меняются только числа и цвета; флаги и режимы (EnumItem) ставим сразу + local kind = typeof(v) + if kind == "number" or kind == "Color3" then goal[prop] = v else obj[prop] = v end + end + setLook(obj, goal, instant) + end + end +end + +local function applyAmbience(world, instant) + -- прошлая плавная смена ещё может идти — она перебила бы новые значения + for _, tw in ipairs(lookTweens) do + tw:Cancel() + end + table.clear(lookTweens) + world = world or Config.Lobby + -- при смене суток часы двигает Ambience; иначе у каждой локации своё время + if not Config.DayNight.enabled then + setLook(Lighting, { ClockTime = (world and world.clock) or 14.5 }, instant) + end + local cc = Lighting:FindFirstChildOfClass("ColorCorrectionEffect") + if cc then + setLook(cc, { TintColor = (world and world.tint) or DEFAULT_LOOK.tint }, instant) + end + -- цвета материалов террейна общие для всей карты, поэтому меняем их только у себя и возвращаем при выходе + if not defaultTerrainColors then + defaultTerrainColors = {} + for _, name in ipairs({ "Snow", "Salt", "Mud", "Sand", "Rock", "Slate", "Grass", "Ground" }) do + defaultTerrainColors[name] = terrain:GetMaterialColor(Enum.Material[name]) + end + end + local colors = (world and world.terrainColors) or {} + for name, def in pairs(defaultTerrainColors) do + terrain:SetMaterialColor(Enum.Material[name], colors[name] or def) + end + local atm = Lighting:FindFirstChildOfClass("Atmosphere") + if atm then + local frost = world and world.id == "World3" + setLook(atm, { + Density = frost and 0.38 or 0.25, + Color = frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232), + }, instant) + end + applyLook(world, instant) + snow.Rate = (world and world.id == "World3") and 140 or 0 +end + +-- тёмные силуэты рыб под прозрачной водой «Тихого озера», медленно плавают по кругу (только у этого игрока) +do + local w1 = Config.Worlds[1] + local fishList = Config.Zones.World1.fish + local frng = Random.new(11) + local folder = new("Folder", { Name = "FishShadows", Parent = workspace }) + local swimmers = {} + for i = 1, 10 do + local l = w1.lakes[(i - 1) % #w1.lakes + 1] + local ok, model = pcall(Models.buildFish, fishList[(i - 1) % #fishList + 1].id, nil, frng:NextNumber(1.3, 2), true) + if ok and model then + for _, d in ipairs(model:GetDescendants()) do + if d:IsA("BasePart") then + d.Color = Color3.fromRGB(22, 70, 74) + d.Material = Enum.Material.SmoothPlastic + d.Transparency = 0.5 + d.CanCollide, d.CanQuery, d.CanTouch, d.CastShadow = false, false, false, false + elseif d:IsA("Decal") or d:IsA("ParticleEmitter") or d:IsA("Light") then + d:Destroy() + end + end + model.Parent = folder + table.insert(swimmers, { + model = model, + c = w1.center + Vector3.new(l[1] + frng:NextNumber(-l[3], l[3]) * 0.25, w1.waterY - frng:NextNumber(1.4, 2.4), l[2] + frng:NextNumber(-l[3], l[3]) * 0.25), + r = l[3] * frng:NextNumber(0.25, 0.55), a = frng:NextNumber(0, math.pi * 2), + w = frng:NextNumber(0.08, 0.18) * (frng:NextNumber() < 0.5 and -1 or 1), + }) + end + end + local acc = 0 + RunService.Heartbeat:Connect(function(dt) + acc += dt + if acc < 1 / 30 then + return + end + local step = acc + acc = 0 + local w = currentWorld() + if not (w and w.id == "World1") then + return + end + for _, s in ipairs(swimmers) do + s.a += s.w * step + local pos = s.c + Vector3.new(math.cos(s.a) * s.r, math.sin(s.a * 3) * 0.2, math.sin(s.a) * s.r) + local dir = Vector3.new(-math.sin(s.a), 0, math.cos(s.a)) * math.sign(s.w) + -- голова рыбы смотрит в +X модели, поэтому разворачиваем на 90° + s.model:PivotTo(CFrame.lookAt(pos, pos + dir) * CFrame.Angles(0, math.rad(90), 0)) + end + end) +end + +-- экран загрузки (ReplicatedFirst/Loading): при входе и телепорте свет локации ставится, пока он закрывает картинку +local loadingGui = player:WaitForChild("PlayerGui"):WaitForChild("LoadingScreen", 10) +local function loadingVisible() + return loadingGui ~= nil and loadingGui.Enabled +end + +local function placeTitle(w) + return w and (w.icon .. " " .. w.name) or "🏠 Лобби" +end + +local function enterWorld(w, instant) + lastWorldId = w and w.id or "lobby" + applyAmbience(w, instant) + if w then + -- название локации — когда экран загрузки уже ушёл + task.spawn(function() + while loadingVisible() do + task.wait(0.1) + end + notify(w.icon .. " " .. w.name, w.color) + end) + end +end + +-- погода сменилась: плавно пересчитываем дымку текущей локации +workspace:GetAttributeChangedSignal("Weather"):Connect(function() + if lastWorldId ~= "none" and not loadingVisible() then + applyAmbience(currentWorld(), false) + end +end) + +-- новый уровень — арфа +do + local lastLevel = player:GetAttribute("Level") + player:GetAttributeChangedSignal("Level"):Connect(function() + local lv = player:GetAttribute("Level") + if lastLevel and lv and lv > lastLevel then + Audio.play("levelUp") + end + lastLevel = lv + end) +end + +-- первое появление: ждём персонажа, ставим свет его локации сразу и отпускаем экран загрузки +task.spawn(function() + local char = player.Character or player.CharacterAdded:Wait() + char:WaitForChild("HumanoidRootPart", 30) + local w = currentWorld() + enterWorld(w, true) + if loadingGui then + loadingGui:SetAttribute("Title", placeTitle(w)) + loadingGui:SetAttribute("Ready", true) + end +end) + +-- телепорт: экран загрузки закрывает картинку, сервер переносит персонажа, свет новой локации ставится сразу +local teleportToken = 0 +local function teleportLoading(targetId, delay) + teleportToken += 1 + local token = teleportToken + local target = Config.Find(Config.Worlds, targetId) + if loadingGui then + local now = os.clock() + loadingGui:SetAttribute("Ready", false) + loadingGui:SetAttribute("StartAt", now) + loadingGui:SetAttribute("MinUntil", now + Config.Loading.teleport) + loadingGui:SetAttribute("Title", placeTitle(target)) + loadingGui:SetAttribute("Visible", true) + end + task.spawn(function() + -- ждём, пока персонаж окажется в новой локации (или сдаёмся через пару секунд) + local deadline = os.clock() + delay + 3 + local w + repeat + task.wait() + w = currentWorld() + until (w and w.id or "Lobby") == targetId or os.clock() > deadline or token ~= teleportToken + if token ~= teleportToken then + return + end + enterWorld(w, true) + if loadingGui then + loadingGui:SetAttribute("Ready", true) + end + end) +end + +task.spawn(function() + while true do + local w = currentWorld() + local id = w and w.id or "lobby" + if id ~= lastWorldId and lastWorldId ~= "none" and not loadingVisible() then + enterWorld(w, false) -- без телепорта (например, после возрождения): плавно + end + local cam = workspace.CurrentCamera + if cam then + snowPart.CFrame = CFrame.new(cam.CFrame.Position + Vector3.new(0, 25, 0)) + end + -- баннер события + local evId = workspace:GetAttribute("Event") + local event = evId and Config.Find(Config.Events, evId) + if event then + eventBanner.Visible = true + eventTitle.Text = event.name .. " " .. timeStr((workspace:GetAttribute("EventEnds") or 0) - workspace:GetServerTimeNow()) + eventDesc.Text = event.desc + else + eventBanner.Visible = false + end + task.wait(0.5) + end +end) + +---------------------------------------------------------------- обучение: линия-подсказка +-- белые «стрелки» бегут по земле от игрока к цели текущего шага (см. Config.TutorialDone) + +local GUIDE_N, GUIDE_GAP, GUIDE_SPEED = 32, 3, 7 -- сколько стрелок, шаг между ними, скорость бега +local guideStep = 0 -- шаг, отправленный на сервер (атрибут Tutorial может прийти чуть позже) + +-- крупная мультяшная подсказка под уведомлениями: покачивается, при смене шага «выпрыгивает» +local guideHint, guideHintText = softPlate( + { Size = UDim2.fromOffset(0, 70), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 10), Visible = false, Parent = gui }, + { TextSize = 42, Text = "" } +) +wobble(guideHint, 1.2, 1.6) +local lastHint = nil + +local guideFolder = new("Folder", { Name = "TutorialGuide", Parent = workspace }) +local chevrons = {} +for i = 1, GUIDE_N do + local arms = {} + for k = 1, 2 do + arms[k] = new("Part", { + Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false, CastShadow = false, + Material = Enum.Material.Neon, Color = Color3.fromRGB(70, 195, 255), Size = Vector3.new(0.5, 0.5, 2), Transparency = 1, + Parent = guideFolder, + }) + end + chevrons[i] = arms +end +-- два объёмных бруска стрелки «>» острием вперёд (по -Z) +local GUIDE_HEIGHT = 2.2 -- стрелки висят в воздухе над землёй +local ARM_CF = {} +for k, s in ipairs({ -1, 1 }) do + local center = Vector3.new(s * 0.65, 0, -0.15) + ARM_CF[k] = CFrame.lookAt(center, center + Vector3.new(s * 1.3, 0, 1.5)) +end +local function hideChevrons(from) + for i = from, GUIDE_N do + chevrons[i][1].Transparency = 1 + chevrons[i][2].Transparency = 1 + end +end + +local guideRay = RaycastParams.new() +guideRay.FilterType = Enum.RaycastFilterType.Exclude +guideRay.RespectCanCollide = true +guideRay.IgnoreWater = false + +local function tutorialStep() + return math.max(player:GetAttribute("Tutorial") or 0, guideStep) +end +local function advanceTutorial(step) + if step > tutorialStep() then + guideStep = step + remote:FireServer("Tutorial", step) + if step >= Config.TutorialDone then + notify("🎓 Обучение пройдено!", C.gold) + end + end +end + +local function guideMarker(name) + local map = workspace:FindFirstChild("FishingMap") + local m = map and map:FindFirstChild(name, true) -- маркеры могут лежать в папках уровня (World1Map) + return m and m.Position +end + +-- объект цели обводится мягким светящимся контуром (атрибут GuideTarget ставит MapBuilder); +-- Occluded: то, что стоит перед объектом (персонаж на мостике), не перекрашивается +local guideHighlight = new("Highlight", { + FillColor = Color3.fromRGB(150, 225, 255), OutlineColor = Color3.fromRGB(190, 240, 255), + DepthMode = Enum.HighlightDepthMode.Occluded, Enabled = false, Parent = guideFolder, +}) +local guideObjects, guideScanAt = {}, {} +local function guideObject(key) + local obj = guideObjects[key] + if obj and obj.Parent then + return obj + end + -- карта большая: если объекта нет (ещё не загрузился), ищем заново не чаще раза в 2 секунды + if guideScanAt[key] and os.clock() - guideScanAt[key] < 2 then + return nil + end + guideScanAt[key] = os.clock() + local map = workspace:FindFirstChild("FishingMap") + if not map then + return nil + end + for _, d in ipairs(map:GetDescendants()) do + if d:GetAttribute("GuideTarget") == key then + guideObjects[key] = d + return d + end + end + return nil +end + +-- первый подход к табличке: камера крупно на табличку, управление и весь интерфейс убраны; +-- кнопка «Далее» плавно возвращает камеру, интерфейс и управление +local StarterGui = game:GetService("StarterGui") +local BOARD_CAM_TIME, BOARD_FOV = 0.8, 70 +local boardView = nil +local closeBoardView +-- кнопка в отдельном ScreenGui: основной интерфейс на это время выключается целиком +local boardGui = new("ScreenGui", { Name = "BoardView", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 50, Enabled = false, Parent = player:WaitForChild("PlayerGui") }) +btn({ + Size = UDim2.fromOffset(240, 60), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -40), + BackgroundColor3 = C.green, Text = "Далее ▶", TextSize = 26, Parent = boardGui, +}, function() + closeBoardView() +end) + +local function setInterfaceHidden(hidden) + gui.Enabled = not hidden + boardGui.Enabled = hidden + pcall(function() + StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, not hidden) + end) + -- надписи над объектами (порталы, лавки) тоже прячем, потом возвращаем как было + if hidden then + boardView.billboards = {} + local map = workspace:FindFirstChild("FishingMap") + for _, d in ipairs(map and map:GetDescendants() or {}) do + if d:IsA("BillboardGui") and d.Enabled then + d.Enabled = false + table.insert(boardView.billboards, d) + end + end + elseif boardView and boardView.billboards then + for _, d in ipairs(boardView.billboards) do + d.Enabled = true + end + boardView.billboards = nil + end +end + +local function boardCamStep() + local bv, cam = boardView, workspace.CurrentCamera + if not bv or not cam then + return + end + local e = easeInOut(math.min(1, (os.clock() - bv.t0) / BOARD_CAM_TIME)) + cam.CFrame = bv.fromCF:Lerp(bv.toCF, e) + cam.FieldOfView = bv.fromFov + (bv.toFov - bv.fromFov) * e + if bv.returning and e >= 1 then + RunService:UnbindFromRenderStep("BoardCam") + cam.CameraType = Enum.CameraType.Custom + setInterfaceHidden(false) + boardView = nil + setMovementLocked(false) + end +end + +local function openBoardView(board) + local cam = workspace.CurrentCamera + -- отходим ровно настолько, чтобы табличка целиком влезла в кадр (по высоте и по ширине) с небольшим запасом + local half = math.tan(math.rad(BOARD_FOV / 2)) + local aspect = cam.ViewportSize.X / math.max(1, cam.ViewportSize.Y) + local dist = math.max((board.Size.Y / 2) / half, (board.Size.X / 2) / (half * aspect)) * 1.15 + boardView = { + t0 = os.clock(), origCF = cam.CFrame, origFov = cam.FieldOfView, + fromCF = cam.CFrame, fromFov = cam.FieldOfView, + -- надписи на лицевой стороне (Front), она смотрит по LookVector + toCF = CFrame.lookAt(board.Position + board.CFrame.LookVector * dist, board.Position), toFov = BOARD_FOV, + } + setMovementLocked(true) + setInterfaceHidden(true) + cam.CameraType = Enum.CameraType.Scriptable + RunService:UnbindFromRenderStep("BoardCam") + RunService:BindToRenderStep("BoardCam", Enum.RenderPriority.Camera.Value + 1, boardCamStep) +end + +closeBoardView = function() + local cam = workspace.CurrentCamera + if not boardView or boardView.returning or not cam then + return + end + boardGui.Enabled = false -- кнопка пропадает сразу, остальной интерфейс — когда камера вернётся + boardView.returning = true + boardView.t0 = os.clock() + boardView.fromCF, boardView.fromFov = cam.CFrame, cam.FieldOfView + boardView.toCF, boardView.toFov = boardView.origCF, boardView.origFov + advanceTutorial(1) +end + +-- скупка «Тихого озера»: ведём к прилавку с подсказкой «Продать» внутри лавки (GuideTarget = "Sell"), +-- поэтому стрелка идёт за лавкой, куда бы её ни переставили; маркер GuideSell — запасной вариант +local function sellTargetW1() + local shop = guideObject("Sell") + if shop then + for _, d in ipairs(shop:GetDescendants()) do + if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then + local p = d.Parent + local at = (p:IsA("BasePart") and p.Position) or (p:IsA("Attachment") and p.WorldPosition) + if at then + return at + end + end + end + return shop:IsA("Model") and shop:GetPivot().Position or shop.Position + end + return guideMarker("GuideSell") +end + +-- маршрут для текущего шага: точки ломаной (без игрока), подсказка и что подсветить; nil — линию не показываем +local function guideRoute(step, pos, world) + local inW1 = world and world.id == "World1" + if step == 0 and not world then + return { guideMarker("GuideBoard") }, "📋 Прочитай табличку", "Board" + elseif not world then -- шаги 1–3 из лобби: сначала в портал + return { guideMarker("GuidePortal") }, "🌊 Иди в портал", "Portal" + elseif step == 2 and inW1 then + return { guideMarker("GuideFishSpot") }, "🎣 Зажми ЛКМ у воды", "Pier" + elseif step == 3 and inW1 then + return { sellTargetW1() }, "💰 Продай рыбу", "Sell" -- лавка у самого причала, идём напрямую + end + return nil +end + +-- ближайшая скупка в этом мире (или в лобби): прилавки с ProximityPrompt Action = "Sell" +local nearestSell +do +local sellSpots, sellScanAt = {}, -math.huge +nearestSell = function(pos, world) + if #sellSpots == 0 and os.clock() - sellScanAt > 3 then + sellScanAt = os.clock() + local map = workspace:FindFirstChild("FishingMap") + for _, d in ipairs(map and map:GetDescendants() or {}) do + if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then + local p = d.Parent + local at = (p:IsA("BasePart") and p.Position) or (p:IsA("Attachment") and p.WorldPosition) or (p:IsA("Model") and p:GetPivot().Position) + if at then + table.insert(sellSpots, at) + end + end + end + end + local best, bestD = nil, nil + for _, at in ipairs(sellSpots) do + if Config.WorldAt(at) == world then + local d = (at - pos).Magnitude + if not bestD or d < bestD then + best, bestD = at, d + end + end + end + return best +end +end + +RunService.RenderStepped:Connect(function() + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + local step = tutorialStep() + -- пока сервер не прислал шаг (данные ещё грузятся), обучение не показываем; + -- после обучения линия ведёт к скупщику, когда сумка полна + local tutorialOn = player:GetAttribute("Tutorial") ~= nil and step < Config.TutorialDone + local bagFull = (player:GetAttribute("BagCount") or 0) >= (player:GetAttribute("BagCap") or math.huge) + if not hrp or not (tutorialOn or bagFull) then + guideHint.Visible = false + guideHighlight.Enabled = false + hideChevrons(1) + return + end + if boardView then -- смотрим на табличку: ни линии, ни подсказок + guideHint.Visible = false + guideHighlight.Enabled = false + hideChevrons(1) + return + end + local pos = hrp.Position + local world = Config.WorldAt(pos) + + -- переходы между шагами + if not tutorialOn then + -- обучение пройдено, остаётся только дорога к скупщику + elseif step <= 1 and world and world.id == "World1" then + advanceTutorial(2) + elseif step == 0 then + local board = guideMarker("GuideBoard") + if board and (board - pos).Magnitude < 9 and state == "idle" then + local obj = guideObject("Board") + if obj then + openBoardView(obj) -- шаг засчитается по кнопке «Далее» + return + end + advanceTutorial(1) + end + elseif step == 2 and (player:GetAttribute("TotalCaught") or 0) > 0 then + advanceTutorial(3) + end + step = tutorialStep() + + local route, hint, key + if tutorialOn then + route, hint, key = guideRoute(step, pos, world) + end + if not route and bagFull then + local inW1 = world and world.id == "World1" + local at = (inW1 and sellTargetW1()) or nearestSell(pos, world) + route, hint, key = at and { at } or nil, "🎒 Сумка полна — продай рыбу!", inW1 and "Sell" or nil + end + guideHintText.Text = hint or "" + local showHint = hint ~= nil and state == "idle" + if showHint and (hint ~= lastHint or not guideHint.Visible) then + popIn(guideHint, 0.5) + end + lastHint = hint + guideHint.Visible = showHint + local target = (key and state == "idle") and guideObject(key) or nil + guideHighlight.Adornee = target or nil + guideHighlight.Enabled = target ~= nil + if target then + local pulse = (math.sin(os.clock() * 4) + 1) / 2 -- мягкое мигание + guideHighlight.FillTransparency = 0.86 + 0.1 * pulse -- лёгкое «дыхание», цвет объекта виден + guideHighlight.OutlineTransparency = 0.1 + 0.45 * pulse + end + if not route or #route == 0 or state ~= "idle" then + hideChevrons(1) + return + end + + -- ломаная от ног игрока через точки маршрута + local pts = { pos - Vector3.new(0, 3, 0) } + for _, p in ipairs(route) do + table.insert(pts, p) + end + local lens, total = {}, 0 + for i = 2, #pts do + local d = ((pts[i] - pts[i - 1]) * Vector3.new(1, 0, 1)).Magnitude + lens[i] = math.max(d, 0.001) + total += d + end + if total < 4 then + hideChevrons(1) -- уже на месте + return + end + + guideRay.FilterDescendantsInstances = { player.Character, guideFolder } + local phase = (os.clock() * GUIDE_SPEED) % GUIDE_GAP + local seg, segStart = 2, 0 + for i = 1, GUIDE_N do + local d = 2 + phase + (i - 1) * GUIDE_GAP + if d > total - 1 then + hideChevrons(i) + break + end + while seg < #pts and d > segStart + lens[seg] do + segStart += lens[seg] + seg += 1 + end + local a, b = pts[seg - 1], pts[seg] + local p = a:Lerp(b, (d - segStart) / lens[seg]) + local dir = (b - a) * Vector3.new(1, 0, 1) + local hit = workspace:Raycast(p + Vector3.new(0, 4, 0), Vector3.new(0, -12, 0), guideRay) + -- висят в воздухе и слегка покачиваются волной + local y = (hit and hit.Position.Y or p.Y) + GUIDE_HEIGHT + math.sin(os.clock() * 4 - d * 0.5) * 0.25 + local base = CFrame.lookAt(Vector3.new(p.X, y, p.Z), Vector3.new(p.X, y, p.Z) + dir) + -- у игрока и у цели стрелки плавно проявляются и гаснут + local fade = math.max(0, 1 - math.min(d - 2, total - 1 - d) / 2.5) + local tr = 0.05 + 0.95 * fade + for k = 1, 2 do + chevrons[i][k].CFrame = base * ARM_CF[k] + chevrons[i][k].Transparency = tr + end + end +end) + +---------------------------------------------------------------- цели на экране: серия, трекер, босс, покупка у скупщика +-- в отдельной функции: у основного скрипта почти исчерпан лимит в 200 локальных переменных + +local refreshTracker, bestOffer, showOffer +local offerState = { bagWasFull = false } -- была ли сумка полной перед продажей (тогда первым предлагаем сумку побольше) +;(function() +local CENTER = Enum.TextXAlignment.Center +local RIGHT = Enum.TextXAlignment.Right +local FIRE = Color3.fromRGB(255, 150, 60) + +-- серия улова — справа от HUD; полоска показывает, сколько осталось до того, как серия сгорит +local comboBox = new("Frame", { + Size = UDim2.fromOffset(140, 66), Position = UDim2.fromOffset(310, 10), BackgroundColor3 = WHITE, Visible = false, Parent = gui, +}, { corner(14), stroke(FIRE, 2, 0.1), gradient(Color3.fromRGB(110, 50, 20), C.bg, 90) }) +local comboMultText = text({ Size = UDim2.new(1, 0, 0, 34), Position = UDim2.fromOffset(0, 3), Font = TITLE, TextSize = 28, TextXAlignment = CENTER, TextColor3 = Color3.fromRGB(255, 195, 95), TextStrokeTransparency = 0.5, Text = "", Parent = comboBox }) +local comboSub = text({ Size = UDim2.new(1, 0, 0, 16), Position = UDim2.fromOffset(0, 36), Font = BODY2, TextSize = 12, TextXAlignment = CENTER, TextColor3 = C.muted, Text = "", Parent = comboBox }) +local comboBack = new("Frame", { Size = UDim2.new(1, -20, 0, 5), Position = UDim2.new(0, 10, 1, -10), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = comboBox }, { corner(3) }) +local comboFill = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = FIRE, BorderSizePixel = 0, Parent = comboBack }, { corner(3) }) + +local function refreshCombo(pop) + local n = player:GetAttribute("Combo") or 0 + comboBox.Visible = n > 0 + if n > 0 then + -- множитель следующей рыбы (сервер считает так же) + comboMultText.Text = ("🔥 x%.1f"):format(math.min(Config.Combo.max, 1 + Config.Combo.step * n)) + comboSub.Text = ("серия %d · не упусти!"):format(n) + if pop then + popIn(comboBox, 0.6) + end + end +end +player:GetAttributeChangedSignal("Combo"):Connect(function() + refreshCombo(true) +end) +refreshCombo(false) + +-- правая колонка: босс и цели +local rightCol = new("Frame", { + Size = UDim2.fromOffset(300, 0), AutomaticSize = Enum.AutomaticSize.Y, AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 10), + BackgroundTransparency = 1, Parent = gui, +}, { new("UIListLayout", { Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + +local bossBox = new("Frame", { Size = UDim2.fromOffset(300, 78), BackgroundColor3 = WHITE, Visible = false, LayoutOrder = 1, Parent = rightCol }, + { corner(14), stroke(C.red, 2.5, 0.05), gradient(Color3.fromRGB(110, 30, 40), C.bg, 90) }) +local bossTitle = text({ Size = UDim2.new(1, -80, 0, 24), Position = UDim2.fromOffset(12, 5), Font = TITLE, TextSize = 18, TextColor3 = Color3.fromRGB(255, 205, 120), TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = bossBox }) +local bossTime = text({ Size = UDim2.fromOffset(60, 24), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 5), Font = TITLE, TextSize = 17, TextXAlignment = RIGHT, Text = "", Parent = bossBox }) +local bossBack = new("Frame", { Size = UDim2.new(1, -24, 0, 18), Position = UDim2.fromOffset(12, 32), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = bossBox }, { corner(9) }) +local bossFill = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = WHITE, Parent = bossBack }, { corner(9), gradient(Color3.fromRGB(255, 120, 90), Color3.fromRGB(190, 30, 50), 0) }) +local bossHpText = text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = CENTER, ZIndex = 2, TextStrokeTransparency = 0.5, Text = "", Parent = bossBack }) +local bossHint = text({ Size = UDim2.new(1, -24, 0, 18), Position = UDim2.fromOffset(12, 54), Font = BODY2, TextSize = 12, TextColor3 = C.muted, Text = "", Parent = bossBox }) + +local tracker = new("Frame", { Size = UDim2.fromOffset(300, 0), AutomaticSize = Enum.AutomaticSize.Y, BackgroundColor3 = WHITE, LayoutOrder = 2, Parent = rightCol }, { + corner(14), stroke(C.line, 2, 0.35), gradient(C.panel2, C.bg, 90), + new("UIPadding", { PaddingLeft = UDim.new(0, 12), PaddingRight = UDim.new(0, 12), PaddingTop = UDim.new(0, 8), PaddingBottom = UDim.new(0, 10) }), + new("UIListLayout", { Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder }), +}) +text({ Size = UDim2.new(1, 0, 0, 20), LayoutOrder = 0, Font = TITLE, TextSize = 16, TextColor3 = C.muted, Text = "🎯 Цели", Parent = tracker }) + +local function trackerLine(order, onClick) + local root = new("TextButton", { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1, AutoButtonColor = false, Text = "", LayoutOrder = order, Parent = tracker }) + local label = text({ Size = UDim2.new(1, 0, 0, 22), Font = BODY, TextSize = 14, RichText = true, TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = root }) + local back = new("Frame", { Size = UDim2.new(1, 0, 0, 8), Position = UDim2.fromOffset(0, 26), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = root }, { corner(4) }) + local fill = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = C.gold, BorderSizePixel = 0, Parent = back }, { corner(4) }) + if onClick then + root.MouseButton1Click:Connect(onClick) + end + return { root = root, label = label, back = back, fill = fill } +end +local function setLine(line, txt, frac, color) + line.root.Visible = txt ~= nil + if not txt then + return + end + line.label.Text = txt + line.back.Visible = frac ~= nil + line.root.Size = UDim2.new(1, 0, 0, frac and 38 or 22) + if frac then + line.fill.Size = UDim2.fromScale(math.clamp(frac, 0, 1), 1) + line.fill.BackgroundColor3 = color or C.gold + end +end + +local questLine = trackerLine(1, function() + questWin.open("quests") +end) +local buyLine = trackerLine(2, function() + shopWin.open("rods") +end) +local dexLine = trackerLine(3, function() + bagWin.open("dex") +end) +local bagLine = trackerLine(4, function() + bagWin.open("fish") +end) + +local function plural(n, one, few, many) + local m10, m100 = n % 10, n % 100 + if m10 == 1 and m100 ~= 11 then + return one + elseif m10 >= 2 and m10 <= 4 and (m100 < 12 or m100 > 14) then + return few + end + return many +end + +-- ближайшая покупка: следующая удочка, а когда все куплены — улучшение текущей +local function buyGoal() + local coins, lvl = player:GetAttribute("Coins") or 0, player:GetAttribute("Level") or 1 + local owned = attrSet("OwnedRods") + for _, r in ipairs(Config.Rods) do + if not owned[r.id] then + if lvl < r.level then + return ("🎣 %s · 🔒 нужен ур. %d"):format(r.name, r.level), lvl / r.level, C.blue + elseif coins >= r.price then + return ("🎣 %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) + Audio.play("coins") + end + hideOffer() +end) +btn({ Size = UDim2.fromOffset(26, 26), Position = UDim2.new(1, -18, 0, -8), BackgroundColor3 = C.red, Text = "✕", TextSize = 14, Parent = offerCard }, hideOffer) + +bestOffer = function(bagWasFull) + local coins, lvl = player:GetAttribute("Coins") or 0, player:GetAttribute("Level") or 1 + local options = {} + local bag = Config.Find(Config.Bags, player:GetAttribute("Bag") or "Pouch") + local ownedBags = attrSet("OwnedBags") + for _, b in ipairs(Config.Bags) do + if not ownedBags[b.id] and b.capacity > (bag and bag.capacity or 0) and lvl >= b.level and coins >= b.price then + table.insert(options, { kind = "Bag", id = b.id, icon = "🎒", title = b.name, price = b.price, prio = bagWasFull and 3 or 1, + desc = ("%d мест вместо %d — реже бегать к скупщику"):format(b.capacity, bag and bag.capacity or 0) }) + break + end + end + local ownedRods = attrSet("OwnedRods") + local bestRod = nil + for _, r in ipairs(Config.Rods) do + if not ownedRods[r.id] and lvl >= r.level and coins >= r.price then + bestRod = r -- удочки по возрастанию цены: берём самую сильную из доступных + end + end + if bestRod then + table.insert(options, { kind = "Rod", id = bestRod.id, icon = "🎣", title = bestRod.name, price = bestRod.price, prio = 2, + desc = ("Удача +%d%%, клюёт быстрее, шире зелёная зона"):format(bestRod.luck * 100) }) + end + local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic") + local rl = player:GetAttribute("RodLevel") or 0 + if rod and rl < Config.RodUpgrade.maxLevel then + local cost = Config.UpgradeCost(rod, rl) + if coins >= cost then + table.insert(options, { kind = "Upgrade", id = rod.id, icon = "✨", title = ("%s +%d"):format(rod.name, rl + 1), price = cost, prio = 1.5, + desc = "Больше удачи и шире зелёная зона" }) + end + end + local potion = Config.Potions[1] + if coins >= potion.price and (player:GetAttribute("BoostBonus") or 0) == 0 then + table.insert(options, { kind = "Potion", id = potion.id, icon = "🧪", title = potion.name, price = potion.price, prio = 0.5, + desc = ("+%d%% удачи на %d мин"):format(potion.bonus * 100, potion.duration / 60) }) + end + table.sort(options, function(x, y) + return x.prio > y.prio + end) + return options[1] +end + +showOffer = function(o) + offerToken += 1 + local my = offerToken + offerItem = o + offerIcon.Text = o.icon + offerTitle.Text = o.title + offerDesc.Text = o.desc + offerBuy.Text = ("Купить · %s 💰"):format(fmt(o.price)) + offerCard.Visible = true + popIn(offerCard, 0.6) + task.delay(9, function() + if my == offerToken then + hideOffer() + end + end) +end + +player:GetAttributeChangedSignal("BagCount"):Connect(function() + if (player:GetAttribute("BagCount") or 0) >= (player:GetAttribute("BagCap") or math.huge) then + offerState.bagWasFull = true + end +end) +end)() + +---------------------------------------------------------------- события от сервера + +remote.OnClientEvent:Connect(function(action, a, b, c, d) + if action == "Notify" then + notify(a, b) + elseif action == "TeleportFade" then + teleportLoading(a, b) + elseif action == "Cast" then + Audio.play("cast") + setState("waiting") + startCastCam(a, b) + elseif action == "CastFail" or action == "Cancel" or action == "Escaped" then + if action == "Escaped" then + Audio.play("escape") + end + if action == "CastFail" and castTool and castTool.Parent then + castTool.Grip = gripCF(REST_ANGLE) -- сервер удочку не трогал, а у нас она в замахе + end + setState("idle") + elseif action == "Bite" then + mg.speed = a.speed + mg.zoneWidth = a.zoneWidth + mg.need = a.hits + mg.hits = 0 + mg.misses = 0 + mg.maxMisses = a.misses + mg.timeout = a.timeout + mg.deadline = os.clock() + a.timeout + mg.pos, mg.dir = 0, 1 + placeZone() + updatePips() + Audio.play("bite") + setState("bite") + elseif action == "Caught" then + setState("idle") + showCatch(a, b) + Audio.play("catchSplash") + local r = Config.Rarities[a.rarity] + Audio.play((r and r.rank >= 4) and "fanfare" or "catch") + if a.mutation then + Audio.play("sparkle") + end + elseif action == "Sold" then + Audio.play("coins") + if tutorialStep() == 3 then + advanceTutorial(Config.TutorialDone) + end + floatText("+" .. fmt(a) .. " 💰", C.gold) + notify(("💰 +%s"):format(fmt(a)), Color3.fromRGB(120, 255, 140)) + -- монеты приходят атрибутом чуть позже события, поэтому предложение — с задержкой + local wasFull = offerState.bagWasFull + offerState.bagWasFull = false + -- продать можно и с заброшенной удочкой; не мешаем только мини-игре поклёвки (она тоже внизу экрана) + task.delay(0.5, function() + local t0 = os.clock() + while state == "bite" and os.clock() - t0 < 10 do + task.wait(0.3) + end + local o = state ~= "bite" and bestOffer(wasFull) + if o then + showOffer(o) + end + end) + elseif action == "Inventory" then + inventory = a or {} + discovered = b or {} + claimed = c or {} + bagWin.refresh() + refreshDots() + refreshTracker() + elseif action == "Quests" then + chain = a + daily = b or daily + questWin.refresh() + refreshDots() + refreshTracker() + elseif action == "QuestDone" then + notify(("✅ %s +%s 💰 +%s XP"):format(questText(a, b), fmt(c), fmt(d or 0)), Color3.fromRGB(120, 255, 140)) + Audio.play("quest") + elseif action == "ChainDone" then + floatText("🏆 Цепочка пройдена!", C.gold) + notify(("🎁 %s: +%s 💰 +%s XP%s"):format(a, fmt(b), fmt(c), d and (" + " .. d) or ""), C.gold) + Audio.play("fanfare") + elseif action == "ComboLost" then + notify(("💔 Серия из %d прервана"):format(a), Color3.fromRGB(255, 130, 110)) + elseif action == "BossStart" then + notify(("👑 %s в мире «%s»! Ловите всем сервером"):format(a, b), C.gold) + Audio.play("quest") + elseif action == "BossHit" then + floatText(("⚔ -%d боссу"):format(a), Color3.fromRGB(255, 130, 100)) + elseif action == "BossDone" then + if a then + notify(("🏆 %s пойман всем сервером!%s"):format(b, c and (" Лучший: " .. c) or ""), C.gold) + else + notify(("🌊 %s ушёл на глубину…"):format(b), C.muted) + end + elseif action == "BossReward" then + notify(("🎁 За босса: +%s 💰 +%s XP%s"):format(fmt(a), fmt(b), c and (" + " .. c) or ""), Color3.fromRGB(120, 255, 140)) + elseif action == "OpenShop" then + shopWin.open("rods") + elseif action == "OpenQuests" then + questWin.open("daily") + elseif action == "OpenRobux" then + robuxWin.open(a) + end +end) + +remote:FireServer("RequestInventory") +]=====]) +put('LocalScript', 'Loading', game.ReplicatedFirst, [=====[-- Loading (LocalScript) -> ReplicatedFirst +-- Экран загрузки. Закрывает картинку при входе в игру и при каждом телепорте: игрок уже стоит на месте, +-- сцена прогружается, клиент ставит свет локации — и только потом экран плавно уходит. +-- +-- FishingClient управляет экраном через атрибуты ScreenGui «LoadingScreen»: +-- Visible = true — показать (при телепорте); +-- Ready = true — свет и террейн локации выставлены; +-- StartAt / MinUntil — os.clock() начала и минимального конца показа (полоска заполняется за это время); +-- Title — подпись под названием игры (куда идём). +-- Экран уходит, когда Ready = true и минимальное время прошло. + +local Players = game:GetService("Players") +local ReplicatedFirst = game:GetService("ReplicatedFirst") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local TweenService = game:GetService("TweenService") + +local player = Players.LocalPlayer +pcall(function() ReplicatedFirst:RemoveDefaultLoadingScreen() end) + +local GOLD = Color3.fromRGB(255, 205, 90) +local TIPS = { + "Чем реже рыба, тем быстрее бегает метка — нужна точность!", + "Улучшай удочку в магазине: рыба клюёт быстрее, удача выше.", + "Собери все виды одной редкости — получишь награду в коллекции (C).", + "Каждый день заходи за наградой из сундука в лобби.", + "Новые миры открываются с уровнем: следи за опытом!", +} + +local function new(class, props) + local o = Instance.new(class) + for k, v in pairs(props) do + if k ~= "Parent" then + o[k] = v + end + end + o.Parent = props.Parent + return o +end + +local gui = new("ScreenGui", { + Name = "LoadingScreen", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 200, + ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = player:WaitForChild("PlayerGui"), +}) +-- фон: арт лобби (временная заглушка); пока картинка грузится, виден тёплый закатный градиент +local BG_IMAGE = "rbxassetid://118616665961176" +local root = new("CanvasGroup", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.fromRGB(255, 190, 120), BorderSizePixel = 0, Parent = gui }) +new("UIGradient", { + Rotation = 90, + Color = ColorSequence.new(Color3.fromRGB(120, 200, 255), Color3.fromRGB(255, 170, 110)), + Parent = root, +}) +local bg = new("ImageLabel", { + Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, Image = BG_IMAGE, + ScaleType = Enum.ScaleType.Crop, Parent = root, +}) +task.spawn(function() + pcall(function() game:GetService("ContentProvider"):PreloadAsync({ bg }) end) +end) + +-- плашка снизу: куда идём, полоска загрузки, совет +local panel = new("Frame", { + AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -28), Size = UDim2.fromOffset(560, 118), + BackgroundColor3 = Color3.fromRGB(70, 40, 22), BackgroundTransparency = 0.18, BorderSizePixel = 0, Parent = root, +}) +new("UICorner", { CornerRadius = UDim.new(0, 18), Parent = panel }) +new("UIStroke", { Color = GOLD, Thickness = 3, Transparency = 0.1, Parent = panel }) +new("UIGradient", { + Rotation = 90, + Color = ColorSequence.new(Color3.fromRGB(150, 95, 50), Color3.fromRGB(95, 55, 28)), + Parent = panel, +}) +local float = new("TextLabel", { + AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(44, 32), Size = UDim2.fromOffset(46, 46), + BackgroundTransparency = 1, Text = "🎣", TextScaled = true, Font = Enum.Font.FredokaOne, Parent = panel, +}) +local title = new("TextLabel", { + Position = UDim2.fromOffset(78, 12), Size = UDim2.new(1, -96, 0, 38), BackgroundTransparency = 1, + Text = "", TextColor3 = Color3.fromRGB(255, 240, 200), TextScaled = true, TextXAlignment = Enum.TextXAlignment.Left, + Font = Enum.Font.FredokaOne, Parent = panel, +}) +new("UIStroke", { Color = Color3.fromRGB(60, 30, 10), Thickness = 2, Parent = title }) +local barBack = new("Frame", { + AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 62), Size = UDim2.new(1, -36, 0, 16), + BackgroundColor3 = Color3.fromRGB(40, 22, 10), BackgroundTransparency = 0.15, BorderSizePixel = 0, Parent = panel, +}) +new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = barBack }) +local bar = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = GOLD, BorderSizePixel = 0, Parent = barBack }) +new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = bar }) +new("UIGradient", { Color = ColorSequence.new(Color3.fromRGB(255, 230, 120), Color3.fromRGB(255, 160, 60)), Parent = bar }) +local tip = new("TextLabel", { + Position = UDim2.fromOffset(18, 86), Size = UDim2.new(1, -36, 0, 22), BackgroundTransparency = 1, + Text = "", TextColor3 = Color3.fromRGB(255, 228, 185), TextScaled = true, + Font = Enum.Font.GothamMedium, Parent = panel, +}) + +local rng = Random.new() +local function showTip() + tip.Text = "💡 " .. TIPS[rng:NextInteger(1, #TIPS)] +end + +-- при входе: экран виден сразу, минимум — из FishConfig, когда он загрузится +local now = os.clock() +gui:SetAttribute("Visible", true) +gui:SetAttribute("Ready", false) +gui:SetAttribute("StartAt", now) +gui:SetAttribute("MinUntil", now + 3) +gui:SetAttribute("Title", "Загрузка…") +showTip() + +task.spawn(function() + if not game:IsLoaded() then + game.Loaded:Wait() + end + local ok, Config = pcall(require, ReplicatedStorage:WaitForChild("FishConfig")) + if ok and Config.Loading then + gui:SetAttribute("MinUntil", gui:GetAttribute("StartAt") + Config.Loading.firstJoin) + end +end) + +local hiding = false +gui:GetAttributeChangedSignal("Visible"):Connect(function() + -- новый телепорт мог прийти, пока экран ещё уходил: тогда возвращаем его + if gui:GetAttribute("Visible") and (hiding or not gui.Enabled) then + hiding = false + showTip() + gui.Enabled = true + TweenService:Create(root, TweenInfo.new(0.25), { GroupTransparency = 0 }):Play() + end +end) +gui:GetAttributeChangedSignal("Title"):Connect(function() + title.Text = gui:GetAttribute("Title") or "" +end) +title.Text = gui:GetAttribute("Title") + +RunService.RenderStepped:Connect(function() + if not gui.Enabled then + return + end + local t = os.clock() + float.Rotation = math.sin(t * 2.2) * 12 + float.Position = UDim2.fromOffset(44, 32 + math.sin(t * 3) * 3) + local startAt, minUntil = gui:GetAttribute("StartAt") or t, gui:GetAttribute("MinUntil") or t + local p = math.clamp((t - startAt) / math.max(0.01, minUntil - startAt), 0, 1) + local ready = gui:GetAttribute("Ready") == true + if not ready then + p = math.min(p, 0.95) -- пока локация не готова, полоска не доходит до конца + end + bar.Size = UDim2.fromScale(p, 1) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if ready and hrp and t >= minUntil and not hiding then + hiding = true + local tw = TweenService:Create(root, TweenInfo.new(0.6), { GroupTransparency = 1 }) + tw.Completed:Connect(function() + if hiding then + gui.Enabled = false + gui:SetAttribute("Visible", false) + end + end) + tw:Play() + end +end) +]=====]) +print('DONE! Скрипты обновлены (11 шт). Нажми Ctrl+S, потом Play (F5).') diff --git a/src/ReplicatedFirst/Loading.client.lua b/src/ReplicatedFirst/Loading.client.lua new file mode 100644 index 0000000..b7e62fb --- /dev/null +++ b/src/ReplicatedFirst/Loading.client.lua @@ -0,0 +1,162 @@ +-- Loading (LocalScript) -> ReplicatedFirst +-- Экран загрузки. Закрывает картинку при входе в игру и при каждом телепорте: игрок уже стоит на месте, +-- сцена прогружается, клиент ставит свет локации — и только потом экран плавно уходит. +-- +-- FishingClient управляет экраном через атрибуты ScreenGui «LoadingScreen»: +-- Visible = true — показать (при телепорте); +-- Ready = true — свет и террейн локации выставлены; +-- StartAt / MinUntil — os.clock() начала и минимального конца показа (полоска заполняется за это время); +-- Title — подпись под названием игры (куда идём). +-- Экран уходит, когда Ready = true и минимальное время прошло. + +local Players = game:GetService("Players") +local ReplicatedFirst = game:GetService("ReplicatedFirst") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local TweenService = game:GetService("TweenService") + +local player = Players.LocalPlayer +pcall(function() ReplicatedFirst:RemoveDefaultLoadingScreen() end) + +local GOLD = Color3.fromRGB(255, 205, 90) +local TIPS = { + "Чем реже рыба, тем быстрее бегает метка — нужна точность!", + "Улучшай удочку в магазине: рыба клюёт быстрее, удача выше.", + "Собери все виды одной редкости — получишь награду в коллекции (C).", + "Каждый день заходи за наградой из сундука в лобби.", + "Новые миры открываются с уровнем: следи за опытом!", +} + +local function new(class, props) + local o = Instance.new(class) + for k, v in pairs(props) do + if k ~= "Parent" then + o[k] = v + end + end + o.Parent = props.Parent + return o +end + +local gui = new("ScreenGui", { + Name = "LoadingScreen", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 200, + ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = player:WaitForChild("PlayerGui"), +}) +-- фон: арт лобби (временная заглушка); пока картинка грузится, виден тёплый закатный градиент +local BG_IMAGE = "rbxassetid://118616665961176" +local root = new("CanvasGroup", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.fromRGB(255, 190, 120), BorderSizePixel = 0, Parent = gui }) +new("UIGradient", { + Rotation = 90, + Color = ColorSequence.new(Color3.fromRGB(120, 200, 255), Color3.fromRGB(255, 170, 110)), + Parent = root, +}) +local bg = new("ImageLabel", { + Size = UDim2.fromScale(1, 1), BackgroundTransparency = 1, Image = BG_IMAGE, + ScaleType = Enum.ScaleType.Crop, Parent = root, +}) +task.spawn(function() + pcall(function() game:GetService("ContentProvider"):PreloadAsync({ bg }) end) +end) + +-- плашка снизу: куда идём, полоска загрузки, совет +local panel = new("Frame", { + AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -28), Size = UDim2.fromOffset(560, 118), + BackgroundColor3 = Color3.fromRGB(70, 40, 22), BackgroundTransparency = 0.18, BorderSizePixel = 0, Parent = root, +}) +new("UICorner", { CornerRadius = UDim.new(0, 18), Parent = panel }) +new("UIStroke", { Color = GOLD, Thickness = 3, Transparency = 0.1, Parent = panel }) +new("UIGradient", { + Rotation = 90, + Color = ColorSequence.new(Color3.fromRGB(150, 95, 50), Color3.fromRGB(95, 55, 28)), + Parent = panel, +}) +local float = new("TextLabel", { + AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(44, 32), Size = UDim2.fromOffset(46, 46), + BackgroundTransparency = 1, Text = "🎣", TextScaled = true, Font = Enum.Font.FredokaOne, Parent = panel, +}) +local title = new("TextLabel", { + Position = UDim2.fromOffset(78, 12), Size = UDim2.new(1, -96, 0, 38), BackgroundTransparency = 1, + Text = "", TextColor3 = Color3.fromRGB(255, 240, 200), TextScaled = true, TextXAlignment = Enum.TextXAlignment.Left, + Font = Enum.Font.FredokaOne, Parent = panel, +}) +new("UIStroke", { Color = Color3.fromRGB(60, 30, 10), Thickness = 2, Parent = title }) +local barBack = new("Frame", { + AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 62), Size = UDim2.new(1, -36, 0, 16), + BackgroundColor3 = Color3.fromRGB(40, 22, 10), BackgroundTransparency = 0.15, BorderSizePixel = 0, Parent = panel, +}) +new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = barBack }) +local bar = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = GOLD, BorderSizePixel = 0, Parent = barBack }) +new("UICorner", { CornerRadius = UDim.new(1, 0), Parent = bar }) +new("UIGradient", { Color = ColorSequence.new(Color3.fromRGB(255, 230, 120), Color3.fromRGB(255, 160, 60)), Parent = bar }) +local tip = new("TextLabel", { + Position = UDim2.fromOffset(18, 86), Size = UDim2.new(1, -36, 0, 22), BackgroundTransparency = 1, + Text = "", TextColor3 = Color3.fromRGB(255, 228, 185), TextScaled = true, + Font = Enum.Font.GothamMedium, Parent = panel, +}) + +local rng = Random.new() +local function showTip() + tip.Text = "💡 " .. TIPS[rng:NextInteger(1, #TIPS)] +end + +-- при входе: экран виден сразу, минимум — из FishConfig, когда он загрузится +local now = os.clock() +gui:SetAttribute("Visible", true) +gui:SetAttribute("Ready", false) +gui:SetAttribute("StartAt", now) +gui:SetAttribute("MinUntil", now + 3) +gui:SetAttribute("Title", "Загрузка…") +showTip() + +task.spawn(function() + if not game:IsLoaded() then + game.Loaded:Wait() + end + local ok, Config = pcall(require, ReplicatedStorage:WaitForChild("FishConfig")) + if ok and Config.Loading then + gui:SetAttribute("MinUntil", gui:GetAttribute("StartAt") + Config.Loading.firstJoin) + end +end) + +local hiding = false +gui:GetAttributeChangedSignal("Visible"):Connect(function() + -- новый телепорт мог прийти, пока экран ещё уходил: тогда возвращаем его + if gui:GetAttribute("Visible") and (hiding or not gui.Enabled) then + hiding = false + showTip() + gui.Enabled = true + TweenService:Create(root, TweenInfo.new(0.25), { GroupTransparency = 0 }):Play() + end +end) +gui:GetAttributeChangedSignal("Title"):Connect(function() + title.Text = gui:GetAttribute("Title") or "" +end) +title.Text = gui:GetAttribute("Title") + +RunService.RenderStepped:Connect(function() + if not gui.Enabled then + return + end + local t = os.clock() + float.Rotation = math.sin(t * 2.2) * 12 + float.Position = UDim2.fromOffset(44, 32 + math.sin(t * 3) * 3) + local startAt, minUntil = gui:GetAttribute("StartAt") or t, gui:GetAttribute("MinUntil") or t + local p = math.clamp((t - startAt) / math.max(0.01, minUntil - startAt), 0, 1) + local ready = gui:GetAttribute("Ready") == true + if not ready then + p = math.min(p, 0.95) -- пока локация не готова, полоска не доходит до конца + end + bar.Size = UDim2.fromScale(p, 1) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if ready and hrp and t >= minUntil and not hiding then + hiding = true + local tw = TweenService:Create(root, TweenInfo.new(0.6), { GroupTransparency = 1 }) + tw.Completed:Connect(function() + if hiding then + gui.Enabled = false + gui:SetAttribute("Visible", false) + end + end) + tw:Play() + end +end) diff --git a/src/ReplicatedStorage/FishConfig.lua b/src/ReplicatedStorage/FishConfig.lua index 901ae13..f6f02bf 100644 --- a/src/ReplicatedStorage/FishConfig.lua +++ b/src/ReplicatedStorage/FishConfig.lua @@ -12,15 +12,42 @@ Config.Worlds = { id = "World1", name = "Тихое озеро", icon = "🌊", level = 1, mult = 1, center = Vector3.new(0, 0, 1500), color = Color3.fromRGB(60, 200, 255), desc = "Спокойное лесное озеро. Отличное место, чтобы начать.", - clock = 14.5, water = Color3.fromRGB(20, 95, 115), + clock = 16.2, waterY = 0, - lakes = { { 0, 0, 55 }, { -45, 15, 40 }, { 45, -10, 42 }, { 10, -42, 34 }, { -22, 40, 28 } }, -- { x, z, радиус } от центра + lakes = { { 0, -15, 62 }, { -42, 8, 34 }, { 44, 2, 36 }, { 0, 22, 30 }, { 48, -50, 22 } }, -- { x, z, радиус } от центра + -- внешний вид только этого мира (применяет клиент при входе, при выходе возвращает как было) + tint = Color3.fromRGB(255, 247, 236), + -- свет и эффекты: свойства Lighting и его эффектов; чего здесь нет, остаётся как в MapBuilder + look = { + lighting = { + Brightness = 2.6, ExposureCompensation = -0.15, + Ambient = Color3.fromRGB(62, 66, 84), OutdoorAmbient = Color3.fromRGB(105, 112, 132), + ColorShift_Top = Color3.fromRGB(255, 232, 196), + EnvironmentDiffuseScale = 0.6, EnvironmentSpecularScale = 0.8, + }, + -- дымка вдали: Density — сколько тумана, Haze — насколько он плотный у горизонта + atmosphere = { + Density = 0.38, Offset = 0.1, Haze = 1.2, Glare = 0.15, + Color = Color3.fromRGB(188, 204, 224), Decay = Color3.fromRGB(196, 176, 160), + }, + color = { Saturation = 0.28, Contrast = 0.2, Brightness = -0.02 }, + bloom = { Intensity = 0.45, Size = 28, Threshold = 1.2 }, + sunRays = { Intensity = 0.06, Spread = 0.6 }, + -- лёгкое размытие дальнего плана + dof = { Enabled = true, FarIntensity = 0.2, FocusDistance = 60, InFocusRadius = 120, NearIntensity = 0 }, + }, + -- земля мира залита материалом Snow (ровный, без травинок), дорожки — Salt; здесь они перекрашиваются + terrainColors = { + Snow = Color3.fromRGB(127, 163, 63), Salt = Color3.fromRGB(191, 155, 105), + Rock = Color3.fromRGB(132, 139, 155), Slate = Color3.fromRGB(132, 139, 155), + Mud = Color3.fromRGB(78, 110, 92), Sand = Color3.fromRGB(205, 190, 140), + }, }, { id = "World2", name = "Тропический остров", icon = "🏝", level = 8, mult = 4, center = Vector3.new(1500, 0, 0), color = Color3.fromRGB(255, 190, 70), desc = "Бирюзовое море, пальмы и яркая рифовая рыба.", - clock = 13, water = Color3.fromRGB(35, 175, 185), + clock = 13, waterY = 0, sea = 119, -- всё дальше этого радиуса от центра — море }, @@ -28,7 +55,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 = { @@ -36,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, @@ -45,6 +75,43 @@ Config.Worlds = { } Config.WorldRadius = 260 +-- экран загрузки: при входе в игру и при каждом телепорте игрок уже стоит на месте, сцена прогружается +-- и свет локации ставится под ним; картинку видно только после этого (секунды — минимум показа) +Config.Loading = { + firstJoin = 3, + teleport = 2.5, +} + +-- лобби: те же поля внешнего вида, что у миров (clock, tint, look, terrainColors); клиент применяет их вне миров +Config.Lobby = { + id = "Lobby", + clock = 16.3, -- предвечернее солнце: тени длиннее, свет теплее + tint = Color3.fromRGB(255, 242, 228), + look = { + lighting = { + Brightness = 2.0, ExposureCompensation = -0.3, + Ambient = Color3.fromRGB(64, 60, 72), OutdoorAmbient = Color3.fromRGB(120, 114, 124), + ColorShift_Top = Color3.fromRGB(255, 224, 186), + EnvironmentDiffuseScale = 0.5, EnvironmentSpecularScale = 0.5, + GlobalShadows = true, + }, + -- тёплая дымка: дальние холмы за скалами тонут в ней + atmosphere = { + Density = 0.4, Offset = 0.18, Haze = 1.6, Glare = 0.25, + Color = Color3.fromRGB(222, 212, 204), Decay = Color3.fromRGB(186, 160, 150), + }, + color = { Saturation = 0.18, Contrast = 0.14, Brightness = -0.04 }, + bloom = { Intensity = 0.3, Size = 24, Threshold = 1.8 }, + sunRays = { Intensity = 0.05, Spread = 0.7 }, + dof = { Enabled = true, FarIntensity = 0.18, FocusDistance = 55, InFocusRadius = 95, NearIntensity = 0 }, + -- мягкий тонмаппинг вместо Retro: светлая плитка и вывески не выгорают в белое + grading = { TonemapperPreset = Enum.TonemapperPreset.Default }, + }, + terrainColors = { + Grass = Color3.fromRGB(104, 150, 72), Ground = Color3.fromRGB(120, 98, 74), Rock = Color3.fromRGB(140, 126, 130), + }, +} + function Config.WorldAt(pos) for _, w in ipairs(Config.Worlds) do if not w.soon then @@ -57,6 +124,80 @@ function Config.WorldAt(pos) return nil end +-- куда бросать из этой точки (единичный вектор по горизонтали): к центру ближайшего озера или лунки, +-- а если ближе море — от центра острова к морю +function Config.CastDirection(world, pos) + if not world then + return nil + end + local x, z = pos.X - world.center.X, pos.Z - world.center.Z + local best, bestGap + local function consider(dir, gap) + if dir.Magnitude > 0.1 and (not bestGap or gap < bestGap) then + best, bestGap = dir.Unit, gap + end + end + if world.holes then + for _, h in ipairs(world.holes) do + consider(Vector3.new(h[1] - x, 0, h[2] - z), math.sqrt((h[1] - x) ^ 2 + (h[2] - z) ^ 2) - (world.holeRadius or 6)) + end + end + for _, l in ipairs(world.lakes or {}) do + if not world.holes then -- в Мире 3 озёра подо льдом, бросаем только в лунки + consider(Vector3.new(l[1] - x, 0, l[2] - z), math.sqrt((l[1] - x) ^ 2 + (l[2] - z) ^ 2) - l[3]) + end + end + if world.sea then + consider(Vector3.new(x, 0, z), world.sea - math.sqrt(x * x + z * z)) + end + return best +end + +-- расстояние по горизонтали от точки до ближайшей воды (0 — над водой: на причале или в воде) +function Config.WaterGap(world, pos) + if not world then + return math.huge + end + local x, z = pos.X - world.center.X, pos.Z - world.center.Z + local gap = math.huge + if world.holes then + for _, h in ipairs(world.holes) do + gap = math.min(gap, math.sqrt((h[1] - x) ^ 2 + (h[2] - z) ^ 2) - (world.holeRadius or 6)) + end + else + for _, l in ipairs(world.lakes or {}) do + gap = math.min(gap, math.sqrt((l[1] - x) ^ 2 + (l[2] - z) ^ 2) - l[3]) + end + end + if world.sea then + gap = math.min(gap, world.sea - math.sqrt(x * x + z * z)) + end + return math.max(0, gap) +end + +-- можно ли закидывать отсюда (pos — центр персонажа): стоим на берегу или платформе +-- и до воды не дальше Config.CastReach. Возвращает true или текст подсказки. +-- humanoid можно не передавать (на сервере его состояние ненадёжно) — тогда проверяем только по высоте. +function Config.CanCastFrom(world, pos, humanoid) + if not world then + return "🌍 Тут нет рыбы" + end + local inWater = pos.Y < (world.waterY or 0) + 2 -- у плывущего персонажа центр почти на уровне воды + if humanoid then + inWater = inWater or humanoid:GetState() == Enum.HumanoidStateType.Swimming or humanoid.FloorMaterial == Enum.Material.Water + end + if inWater then + return "🏊 Выйди из воды" + end + if humanoid and humanoid.FloorMaterial == Enum.Material.Air then + return "Встань на землю" + end + if Config.WaterGap(world, pos) > Config.CastReach then + return "🌊 Подойди к воде" + end + return true +end + -- есть ли вода в этой точке мира (озеро, море или лунка) function Config.IsWater(world, pos) if not world then @@ -208,19 +349,55 @@ 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.QuestSlots = 3 +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" } -- за всю цепочку (растёт с уровнем и кругом) --- ежедневная награда (7 дней по кругу), монеты растут с уровнем +---------------------------------------------------------------- серия улова +-- каждая рыба подряд без срыва: +10% к цене и опыту следующей, до ×2; +-- срыв, ушедшая рыба или timeout секунд без улова — серия сгорает +Config.Combo = { step = 0.1, max = 2.0, timeout = 90 } + +---------------------------------------------------------------- босс озера +-- раз в interval секунд в мир, где больше всего игроков, приплывает босс. Его ловят всем сервером: +-- каждая пойманная там рыба наносит урон = ранг редкости (+1 за подсечку без промаха). +-- Если за duration секунд урона хватило — награда всем, кто помог (× mult мира, минимум 40% за малый вклад) +Config.Boss = { + firstDelay = 240, interval = 600, duration = 180, + hpPerPlayer = 12, + reward = { coins = 300, xp = 250, potion = "Luck1" }, + worlds = { + World1 = { name = "Сом-великан", fish = "Som", mutation = "Golden", scale = 5 }, + World2 = { name = "Королевская акула", fish = "Shark", mutation = "Golden", scale = 3 }, + World3 = { name = "Ледяной левиафан", fish = "Leviathan", mutation = "Rainbow", scale = 2.5 }, + }, +} + +-- ежедневная награда (7 дней по кругу), серебро растёт с уровнем Config.DailyRewards = { { coins = 100 }, { coins = 200 }, @@ -236,25 +413,124 @@ Config.Events = { { id = "Bite", name = "⚡ Клёвый час", desc = "Рыба клюёт в 2 раза быстрее", duration = 180, speed = 0.5 }, { id = "Luck", name = "🍀 Удачный ветер", desc = "Удача +50% для всех", duration = 180, luck = 0.5 }, { id = "Stars", name = "🌟 Звездопад", desc = "Мутации в 3 раза чаще", duration = 180, mutation = 3 }, - { id = "Fair", name = "💰 Рыбная ярмарка", desc = "Рыба продаётся на 50% дороже", duration = 180, sell = 1.5 }, + { id = "Fair", name = "🐟 Рыбная ярмарка", desc = "Рыба продаётся на 50% дороже", duration = 180, sell = 1.5 }, } Config.EventFirstDelay = 120 Config.EventGapMin = 420 Config.EventGapMax = 720 +---------------------------------------------------------------- время суток +-- одни сутки длятся length секунд реального времени; время общее для всего сервера +Config.DayNight = { + enabled = true, + length = 1200, -- 20 минут на сутки + startClock = 9, -- во сколько начинается день при запуске сервера + nightLuck = 0.10, -- ночью удача +10% +} + +-- время на часах в момент serverTime (workspace:GetServerTimeNow()), dayStart — атрибут workspace "DayStart" +function Config.ClockAt(serverTime, dayStart) + local d = Config.DayNight + return (d.startClock + (serverTime - (dayStart or serverTime)) / d.length * 24) % 24 +end + +-- 0 днём, 1 глубокой ночью, плавно на рассвете и закате +function Config.Nightness(clock) + if clock >= 7 and clock <= 17.5 then + return 0 + elseif clock > 17.5 and clock < 20 then + return (clock - 17.5) / 2.5 + elseif clock >= 5 and clock < 7 then + return 1 - (clock - 5) / 2 + end + return 1 +end + +function Config.IsNight(clock) + return Config.Nightness(clock) >= 0.5 +end + +---------------------------------------------------------------- погода +-- меняется на всём сервере; weight — как часто выпадает, duration — сколько длится (секунды) +-- luck / speed / mutation — бонусы к рыбалке, пока погода держится +-- names — как погода называется в отдельных мирах (во фьорде вместо дождя снег) +Config.Weathers = { + { id = "Clear", name = "Ясно", icon = "☀", weight = 40, duration = { 240, 420 } }, + { id = "Cloudy", name = "Пасмурно", icon = "☁", weight = 25, duration = { 180, 360 }, luck = 0.05, desc = "Удача +5%" }, + { id = "Rain", name = "Дождь", icon = "🌧", weight = 20, duration = { 150, 300 }, speed = 0.85, desc = "Клюёт на 15% быстрее", + names = { World3 = "Снегопад" } }, + { id = "Storm", name = "Гроза", icon = "⛈", weight = 8, duration = { 120, 240 }, luck = 0.25, speed = 0.9, desc = "Удача +25%", + names = { World3 = "Метель" } }, + { id = "Fog", name = "Туман", icon = "🌫", weight = 7, duration = { 150, 300 }, mutation = 1.5, desc = "Мутации ×1.5" }, +} + +function Config.WeatherById(id) + for _, w in ipairs(Config.Weathers) do + if w.id == id then + return w + end + end + return Config.Weathers[1] +end + +---------------------------------------------------------------- звуки +-- ID из Creator Store: эффекты — Pro Sound Effects (официальная библиотека Roblox), +-- музыка — APM и DistroKid (лицензированы для Roblox). volume — громкость, pitch — разброс высоты +local function S(id, volume, extra) + local t = extra or {} + t.id = "rbxassetid://" .. id + t.volume = volume + return t +end +Config.Sounds = { + -- музыка + musicLobby = S(137023744071437, 0.35), -- The Ancient Lutes | Medieval Tavern Music + musicLobby2 = S(116079409060113, 0.35), -- The Lute Lament | Medieval Tavern Music + musicLake = S(1838853377, 0.3), -- Harp Fantasy + musicLake2 = S(86472274853159, 0.3), -- Calm Fantasy Atmosphere + musicNight = S(140195397978848, 0.3), -- Moonlit Meadow Whisper + -- окружение (петли) + birdsLake = S(9112877174, 0.35), -- Squam Lake 1 + birdsPark = S(9113444360, 0.25), -- Birds Park 2 + birdsJungle = S(9114892930, 0.3), -- Jungle Birds Ambience 3 + crickets = S(9112764573, 0.3), -- Crickets Night 3 + lakeWater = S(9116203162, 0.25), -- Lake Lap Water Movement 2 + wind = S(9113286782, 0.18), -- Barstow Wind Light Blustery Low Howl 1 + rainLight = S(9112852668, 0.45), -- Rain Continuous Drizzle 1 + rainHeavy = S(9112853287, 0.55), -- Rain Heavy 1 + fire = S(9112780193, 0.6, { roll = 30 }), -- Fireplace Constant Burning Flame 1 (слышно у костра) + thunder = { "rbxassetid://9116282875", "rbxassetid://9116282646", "rbxassetid://9116282791", "rbxassetid://9116282544" }, + -- рыбалка + cast = S(9120718279, 0.5, { pitch = { 0.9, 1.1 } }), -- Whoosh Fast Swish By 1 + bite = S(9112751536, 0.7, { pitch = { 0.9, 1.15 } }), -- Bubble Bloop High Pitched Cute 1 + reel = S(9114454019, 0.4), -- Fishing Reel 4 (петля, пока тянешь) + catchSplash = S(9119293555, 0.6), -- Small Splash Shallow Water + catch = S(9126073001, 0.5), -- Bell Tone Ding + fanfare = S(1836473422, 0.45), -- Victory Fanfare Sting (редкая рыба) + sparkle = S(9114369623, 0.5), -- Fairy Dust 1 (мутация) + escape = S(9117944976, 0.5), -- Puddle Splash 2 (сорвалась) + -- интерфейс + click = S(15675032796, 0.5), -- Roblox_UI_Small_Click + open = S(9117231552, 0.45), -- Paper Scroll Unroll Handle 4 + coins = S(9113849306, 0.6), -- Coins Or Keys Jingle 1 + levelUp = S(1840525342, 0.5), -- Harp Glissando (A) + quest = S(9126073318, 0.5), -- Bell Tone Ding 2 +} +Config.DefaultVolume = { music = 0.6, sfx = 0.8 } + ---------------------------------------------------------------- донат (Robux) -- ВАЖНО: впиши сюда ID своих пропусков и товаров с create.roblox.com. -- Пока id = 0, кнопка покупки покажет подсказку, что товар не настроен. Config.GamePasses = { - { key = "VIP", id = 0, robux = 199, icon = "👑", name = "VIP", desc = "+25% удачи и монет, корона над головой" }, - { key = "DoubleCoins", id = 0, robux = 299, icon = "💰", name = "x2 Монеты", desc = "Вся рыба продаётся в 2 раза дороже" }, + { key = "VIP", id = 0, robux = 199, icon = "👑", name = "VIP", desc = "+25% удачи и серебра, корона над головой" }, + { key = "DoubleCoins", id = 0, robux = 299, icon = "⚪", name = "x2 Серебро", desc = "Вся рыба продаётся в 2 раза дороже" }, { key = "LuckyCharm", id = 0, robux = 349, icon = "🍀", name = "Талисман удачи", desc = "+50% удачи навсегда" }, { key = "BigBag", id = 0, robux = 149, icon = "🎒", name = "Бездонная сумка", desc = "+100 мест в любой сумке" }, } Config.Products = { - { key = "Coins1", id = 0, robux = 49, icon = "🪙", name = "Мешок монет", desc = "+1 000 монет (больше с уровнем)", coins = 1000 }, - { key = "Coins2", id = 0, robux = 199, icon = "💰", name = "Сундук монет", desc = "+5 000 монет (больше с уровнем)", coins = 5000 }, - { key = "Coins3", id = 0, robux = 599, icon = "🏆", name = "Гора золота", desc = "+20 000 монет (больше с уровнем)", coins = 20000 }, + { key = "Coins1", id = 0, robux = 49, icon = "👝", name = "Кошель серебра", desc = "+1 000 серебра (больше с уровнем)", coins = 1000 }, + { key = "Coins2", id = 0, robux = 199, icon = "⚪", name = "Сундук серебра", desc = "+5 000 серебра (больше с уровнем)", coins = 5000 }, + { key = "Coins3", id = 0, robux = 599, icon = "🏆", name = "Гора золота", desc = "+20 000 серебра (больше с уровнем)", coins = 20000 }, { key = "Luck", id = 0, robux = 99, icon = "🧪", name = "Супер-зелье удачи", desc = "+200% удачи на 15 минут", boost = 2.0, duration = 900 }, } @@ -263,11 +539,118 @@ Config.BiteTimeMin = 3 Config.BiteTimeMax = 7 Config.BiteTimeout = 12 Config.MaxMisses = 2 +-- заброс: держишь ЛКМ — сила ездит 0 → 1 → 0 → …; от силы в момент отпускания зависит дальность +Config.CastChargeTime = 1.3 -- секунд на проход шкалы в одну сторону +Config.CastMinDist, Config.CastMaxDist = 6, 28 +Config.CastReach = 7 -- закидывать можно не дальше ~2 м (7 studs) от воды +Config.CastPerfect = { 0.72, 0.86 } -- зелёная зона шкалы +Config.CastPerfectLuck = 1.2 -- множитель удачи за попадание в зелёную зону + +-- обучение: линия-подсказка ведёт по шагам 0 → 1 → 2 → 3, на 4 обучение пройдено +-- 0 — табличка «Как играть», 1 — портал в Мир 1, 2 — причал (поймать рыбу), 3 — скупка (продать) +Config.TutorialDone = 4 function Config.HitsNeeded(rank) return math.ceil(rank / 2) end +-- опыт до следующего уровня: до 8-го ≈ 3 600 (1,5–2 часа вместе с заказами гильдии); +-- у старых сохранений уровень не понижается — копится только опыт внутри уровня function Config.XPForLevel(level) - return 60 + level * 60 + return math.floor(50 * level ^ 1.6) +end + +---------------------------------------------------------------- гильдия рыбаков +-- три валюты: серебро (coins в данных), жемчуг (pearls), печати гильдии (seals — копятся для ранга) +Config.Pearls = { + mutation = { Shiny = 1, Golden = 3, Rainbow = 10 }, -- за пойманную рыбу с мутацией + boss = 5, -- за победу над боссом + daily7 = 5, -- 7-й день ежедневной награды + rankUp = 10, -- за новый ранг +} + +-- ранги: seals — сколько печатей нужно накопить, trial — испытание у Старейшины, +-- orders — заказов на доске, traps — ловушек, discount — скидка у торговцев +-- trial.kind: deliver (сдать рыбу из сумки), catch (поймать с условием), bossWin (участие в победе над боссом), +-- dex (собрать коллекцию мира) +Config.Guild = { + elder = "Старейшина Ворон", + ranks = { + { id = "F", name = "Ученик", seals = 0, orders = 3, color = Color3.fromRGB(150, 150, 150), + unlocks = "Мир 1, доска заказов" }, + { id = "E", name = "Подмастерье", seals = 30, orders = 4, color = Color3.fromRGB(90, 190, 90), auto = true, + trial = { kind = "deliver", fish = "Okun", count = 5, text = "Сдать 5 окуней" }, + unlocks = "🎣 Автоловля, 4-й заказ на доске" }, + { id = "D", name = "Рыбак", seals = 120, orders = 4, color = Color3.fromRGB(70, 130, 230), auto = true, traps = 1, + trial = { kind = "catch", minRank = 3, weathers = { Rain = true, Storm = true }, count = 1, text = "Поймать «Редкую» рыбу в дождь или грозу" }, + unlocks = "🏝 Мир 2 (и ур. 8), 🧺 ловушка" }, + { id = "C", name = "Опытный рыбак", seals = 350, orders = 4, color = Color3.fromRGB(150, 80, 200), auto = true, traps = 2, discount = 0.05, + trial = { kind = "bossWin", count = 1, text = "Помочь одолеть босса озера" }, + unlocks = "🧺 2 ловушки, скидка у торговцев 5%" }, + { id = "B", name = "Мастер", seals = 900, orders = 4, color = Color3.fromRGB(200, 50, 45), auto = true, traps = 3, discount = 0.05, + trial = { kind = "dex", world = "World1", text = "Собрать всю коллекцию «Тихого озера»" }, + unlocks = "❄ Мир 3 (и ур. 18), 🧺 3 ловушки" }, + { id = "A", name = "Магистр", seals = 2000, orders = 4, color = Color3.fromRGB(230, 180, 60), auto = true, traps = 3, discount = 0.10, + trial = { kind = "catch", minRank = 4, night = true, count = 1, text = "Поймать «Эпическую» рыбу ночью" }, + unlocks = "Титул «Магистр», скидка 10%" }, + { id = "S", name = "Легенда", seals = 4500, orders = 4, color = Color3.fromRGB(255, 120, 200), auto = true, traps = 3, discount = 0.10, autoNoCap = true, + trial = { kind = "catch", minRank = 6, count = 1, text = "Поймать «Мифическую» рыбу" }, + unlocks = "Золотой жетон, автоловля без ограничения редкости" }, + }, + -- миры требуют и уровень, и ранг (номер в списке ranks) + worldRank = { World2 = 3, World3 = 5 }, + elderDistance = 22, -- взять испытание / сдать рыбу — рядом со Старейшиной или доской +} + +-- заказы гильдии: личные, обновляются каждые period секунд (окно floor(os.time()/period)), +-- один заказ можно перебросить за rerollPearls жемчуга. Награда растёт с рангом +Config.Orders = { + period = 10800, + rerollPearls = 2, + pearlChance = 0.2, pearlsMin = 1, pearlsMax = 3, + coinsPerSeal = 12, -- серебро за заказ = печати × это × (1 + 0.5 · (ранг − 1)) + -- weight — как часто выпадает; seals — печати {мин, макс} + kinds = { + deliver = { weight = 3, seals = { 5, 12 } }, + heavy = { weight = 2, seals = { 8, 16 } }, + weather = { weight = 1, seals = { 10, 20 } }, + night = { weight = 1, seals = { 10, 22 } }, + combo = { weight = 2, seals = { 8, 18 } }, + perfect = { weight = 2, seals = { 6, 14 } }, + }, +} + +-- наживка: 1 слот, 1 штука тратится на заброс. price — за пачку из pack штук; currency = "pearls" — за жемчуг +Config.Baits = { + { id = "Worm", name = "Червь", icon = "🐛", price = 40, pack = 10, speed = 0.9, desc = "Клюёт на 10% быстрее" }, + { id = "Larva", name = "Мотыль", icon = "🦐", price = 90, pack = 10, luck = 0.15, desc = "Удача +15%" }, + { id = "Firefly", name = "Светлячок", icon = "✨", price = 120, pack = 10, nightLuck = 0.30, desc = "Ночью удача +30% (вместо +10%)" }, + { id = "Blood", name = "Кровавая приманка", icon = "🩸", price = 400, pack = 10, rareWeight = 1.5, rank = 3, desc = "Редкие и выше попадаются в 1,5 раза чаще" }, + { id = "Pearl", name = "Жемчужная блесна", icon = "🦪", price = 5, pack = 5, mutation = 2, currency = "pearls", desc = "Шанс мутаций ×2" }, +} + +-- автоловля (с ранга E): сервер сам забрасывает и вытаскивает, но со штрафами +Config.AutoFish = { + luck = 0.6, -- удача ×0.6 + maxRarity = 3, -- не выше «Редкой» (ранг S снимает) + slower = 1.5, -- каждая поимка на 50% дольше + reel = 2.5, -- секунд «вываживания» вместо мини-игры +} + +-- ловушки-вентери (с ранга D): 1 рыба Мира 1 каждые every секунд, не больше max, копятся и офлайн +Config.Traps = { + every = 900, max = 16, + world = "World1", rarities = { Common = 3, Uncommon = 1 }, -- вес редкостей +} + +-- отдых: пока игрока нет, копится двойной опыт — 1 минута за каждые perOffline минут офлайн, не больше max +Config.Rest = { perOffline = 4, max = 3600, mult = 2 } + +function Config.RankById(id) + for i, r in ipairs(Config.Guild.ranks) do + if r.id == id then + return r, i + end + end + return nil end ---------------------------------------------------------------- помощники diff --git a/src/ServerScriptService/GameServer.server.lua b/src/ServerScriptService/GameServer.server.lua index 49b933f..3257f64 100644 --- a/src/ServerScriptService/GameServer.server.lua +++ b/src/ServerScriptService/GameServer.server.lua @@ -13,6 +13,7 @@ local Debris = game:GetService("Debris") local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) local Models = require(ReplicatedStorage:WaitForChild("GameModels")) +local Guild = require(script.Parent:WaitForChild("Guild")) local remote = ReplicatedStorage:FindFirstChild("GameEvent") or Instance.new("RemoteEvent") remote.Name = "GameEvent" @@ -41,9 +42,12 @@ 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 = {}, + settings = { music = Config.DefaultVolume.music, sfx = Config.DefaultVolume.sfx }, + -- гильдия: жемчуг, печати, отдых (ранг, заказы, наживку, ловушки дополняет Guild.defaults) + pearls = 0, seals = 0, rest = 0, } end @@ -105,6 +109,17 @@ local function ev(field, default) return (currentEvent and currentEvent[field]) or default end +-- погода и время суток (их ведёт WeatherServer через атрибуты workspace) +local function weather() + return Config.WeatherById(workspace:GetAttribute("Weather")) +end +local function isNight() + if not Config.DayNight.enabled then + return false + end + return Config.IsNight(Config.ClockAt(workspace:GetServerTimeNow(), workspace:GetAttribute("DayStart"))) +end + ---------------------------------------------------------------- расчёты local function rodLevel(data, rodId) @@ -134,7 +149,7 @@ local function totalLuck(player, data) if hasPass(player, "LuckyCharm") then l += 0.5 end - return l + ev("luck", 0) + return l + ev("luck", 0) + (weather().luck or 0) + (isNight() and Config.DayNight.nightLuck or 0) end local function bagCapacity(player, data) @@ -168,13 +183,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), @@ -219,12 +279,15 @@ local function updateStats(player) player:SetAttribute("BoostBonus", boostActive(data)) player:SetAttribute("BoostLeft", math.max(0, data.boostUntil - os.time())) player:SetAttribute("TotalCaught", data.totalCaught) + -- шаг обучения (линия-подсказка); у старых игроков без поля, уже ловивших рыбу, обучение пройдено + player:SetAttribute("Tutorial", data.tutorial or (data.totalCaught > 0 and Config.TutorialDone or 0)) player:SetAttribute("Mastery", masteryCount(data)) player:SetAttribute("Passes", table.concat(ps, ",")) + Guild.attrs(player, data) local ls = player:FindFirstChild("leaderstats") if ls then - ls["Монеты"].Value = data.coins + ls["Серебро"].Value = data.coins ls["Уровень"].Value = data.level ls["Улов"].Value = data.totalCaught end @@ -239,93 +302,73 @@ local function addXp(player, data, amount) leveled = true end if leveled then - notify(player, "⭐ Новый уровень: " .. data.level .. "! Удача +" .. math.floor(Config.LuckPerPlayerLevel * 100) .. "%", GOLD) + notify(player, "⭐ Уровень " .. data.level .. "!", GOLD) for _, w in ipairs(Config.Worlds) do if w.level == data.level and not w.soon then - notify(player, "🌍 Открыт новый мир: " .. w.icon .. " " .. w.name .. "!", w.color) + notify(player, "🌍 Открыт: " .. w.icon .. " " .. w.name, w.color) end end end end +Guild.init({ + profiles = profiles, notify = notify, updateStats = updateStats, addXp = addXp, sendInventory = sendInventory, + bagCapacity = bagCapacity, isNight = isNight, weather = weather, remote = remote, +}) + local function applyPotion(data, bonus, duration) data.boostBonus = math.max(boostActive(data), bonus) data.boostUntil = math.max(os.time(), data.boostUntil) + duration end ----------------------------------------------------------------- задания +---------------------------------------------------------------- задания: прогресс цепочки -local function 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) @@ -335,7 +378,7 @@ local function claimDaily(player) end local t = today() if data.daily.last >= t then - notify(player, "🎁 Сегодня награда уже получена. Приходи завтра!", Color3.fromRGB(255, 200, 120)) + notify(player, "🎁 Приходи завтра", Color3.fromRGB(255, 200, 120)) return end local streak = (data.daily.last == t - 1) and (data.daily.streak % 7 + 1) or 1 @@ -351,9 +394,13 @@ local function claimDaily(player) end end data.daily = { last = t, streak = streak } + if streak == 7 then + data.pearls += Config.Pearls.daily7 + extra ..= (" + %d 🦪"):format(Config.Pearls.daily7) + end updateStats(player) sendQuests(player) - notify(player, ("🎁 День %d: +%d 💰%s"):format(streak, coins, extra), GOLD) + notify(player, ("🎁 День %d: +%d ⚪%s"):format(streak, coins, extra), GOLD) end ---------------------------------------------------------------- коллекция @@ -371,7 +418,7 @@ local function claimCollection(player, worldId, rarity) end for _, f in ipairs(zone.fish) do if (rarity == "Master" or f.rarity == rarity) and not data.discovered[f.id] then - notify(player, "Сначала поймай всех рыб этой группы!", RED) + notify(player, "Сначала поймай всех", RED) return end end @@ -379,7 +426,7 @@ local function claimCollection(player, worldId, rarity) if rarity == "Master" then local coins = Config.MasteryCoins * world.mult data.coins += coins - notify(player, ("🏆 Мир «%s» собран! +%d 💰 и +%d%% удачи навсегда"):format(world.name, coins, math.floor(Config.MasteryLuck * 100 + 0.5)), GOLD) + notify(player, ("🏆 «%s» собран! +%d ⚪"):format(world.name, coins), GOLD) else local r = Config.CollectionRewards[rarity] if not r then @@ -387,7 +434,7 @@ local function claimCollection(player, worldId, rarity) end data.coins += r.coins * world.mult addXp(player, data, r.xp * world.mult) - notify(player, ("📖 Коллекция «%s»: +%d 💰 +%d XP"):format(Config.Rarities[rarity].name, r.coins * world.mult, r.xp * world.mult), GREEN) + notify(player, ("📖 +%d ⚪ +%d XP"):format(r.coins * world.mult, r.xp * world.mult), GREEN) end updateStats(player) sendInventory(player) @@ -541,6 +588,28 @@ local function splash(part, count) end -- рыба вылетает из воды, летит к игроку и показывается над головой +-- шлейф за летящим предметом — эффект быстрого движения (ширина — расстояние между точками крепления) +local TRAIL_COLOR = Color3.fromRGB(215, 245, 255) +local function addTrail(part, width) + local a0 = Instance.new("Attachment") + a0.Position = Vector3.new(0, width / 2, 0) + a0.Parent = part + local a1 = Instance.new("Attachment") + a1.Position = Vector3.new(0, -width / 2, 0) + a1.Parent = part + local trail = Instance.new("Trail") + trail.Attachment0, trail.Attachment1 = a0, a1 + trail.FaceCamera = true + trail.Lifetime = 0.35 + trail.MinLength = 0.05 + trail.LightEmission = 0.7 + trail.Color = ColorSequence.new(TRAIL_COLOR) + trail.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.1), NumberSequenceKeypoint.new(1, 1) }) + trail.WidthScale = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(1, 0) }) + trail.Parent = part + return trail +end + local function showFishFlight(player, fish, fromPos) local head = player.Character and player.Character:FindFirstChild("Head") if not head then @@ -549,6 +618,14 @@ local function showFishFlight(player, fish, fromPos) local model = Models.buildFish(fish.id, fish.mutation, 0.9, true) model:PivotTo(CFrame.new(fromPos)) model.Parent = workspace + -- шлейф на отдельной невидимой детали: рыба крутится, а шлейф должен оставаться ровным + local carrier = Instance.new("Part") + carrier.Anchored, carrier.CanCollide, carrier.CanQuery, carrier.CanTouch = true, false, false, false + carrier.Transparency = 1 + carrier.Size = Vector3.new(0.2, 0.2, 0.2) + carrier.CFrame = CFrame.new(fromPos) + carrier.Parent = model + local trail = addTrail(carrier, 1.8) task.spawn(function() local t0, dur = os.clock(), 0.55 while head.Parent do @@ -556,11 +633,13 @@ local function showFishFlight(player, fish, fromPos) local target = head.Position + Vector3.new(0, 2.8, 0) local p = fromPos:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * 8, 0) model:PivotTo(CFrame.new(p) * CFrame.Angles(0, 0, a * math.pi * 2)) + carrier.CFrame = CFrame.new(p) if a >= 1 then break end RunService.Heartbeat:Wait() end + trail.Enabled = false local t1 = os.clock() while head.Parent and os.clock() - t1 < 1.8 do model:PivotTo(CFrame.new(head.Position + Vector3.new(0, 2.8, 0)) * CFrame.Angles(0, os.clock() * 3, math.rad(-15))) @@ -574,22 +653,87 @@ end local fishing = {} --- ищем воду перед игроком по карте мира из FishConfig (не зависит от террейна) -local function findWater(hrp, world) - local look = hrp.CFrame.LookVector * Vector3.new(1, 0, 1) - if look.Magnitude < 0.01 then - look = Vector3.new(0, 0, -1) +-- серия улова (на время игры, не сохраняется) +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 - look = look.Unit - for _, d in ipairs({ 14, 11, 17, 8, 20, 6, 24, 4 }) do - local p = hrp.Position + look * d - if Config.IsWater(world, p) then - return Vector3.new(p.X, world.waterY or 0, p.Z) + setCombo(player, 0) +end + +-- босс озера: { world, def, hp, max, dmg = { [player] = урон } } +local boss = nil +local function bossHit(player, world, dmg) + if not boss or boss.hp <= 0 or not world or world.id ~= boss.world.id then + return + end + boss.hp = math.max(0, boss.hp - dmg) + boss.dmg[player] = (boss.dmg[player] or 0) + dmg + workspace:SetAttribute("BossHP", boss.hp) + remote:FireClient(player, "BossHit", dmg) + questProgress(player, "boss", dmg) +end + +-- ищем воду по карте мира из FishConfig (не зависит от террейна) в сторону центра ближайшего озера: +-- сначала на дальности, которую задала сила заброса, потом всё дальше от неё +local function findWater(hrp, world, power) + local look = Config.CastDirection(world, hrp.Position) + if not look then + look = hrp.CFrame.LookVector * Vector3.new(1, 0, 1) + look = look.Magnitude > 0.01 and look.Unit or Vector3.new(0, 0, -1) + end + local want = Config.CastMinDist + (Config.CastMaxDist - Config.CastMinDist) * power + for off = 0, 26, 2 do + for _, d in ipairs({ want - off, want + off }) do + if d >= 4 and d <= Config.CastMaxDist + 2 then + local p = hrp.Position + look * d + if Config.IsWater(world, p) then + return Vector3.new(p.X, world.waterY or 0, p.Z), d + end + end end end return nil end +-- вытягивание пустого поплавка: быстро летит к кончику удочки со шлейфом и исчезает +local function reelBobber(bobber, tool) + local root = bobber and bobber.PrimaryPart + local tip = tool and tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip") + if not root or not tip then + if bobber then + bobber:Destroy() + end + return + end + local trail = bobber:FindFirstChildWhichIsA("Trail", true) + if trail then + trail.Enabled = true + else + addTrail(root, 1.2) + end + local from = root.Position + task.spawn(function() + local t0, dur = os.clock(), 0.3 + while bobber.Parent and tip.Parent do + local a = math.min(1, (os.clock() - t0) / dur) + bobber:PivotTo(CFrame.new(from:Lerp(tip.WorldPosition, a) + Vector3.new(0, math.sin(a * math.pi) * 2.5, 0))) + if a >= 1 then + break + end + RunService.Heartbeat:Wait() + end + bobber:Destroy() + end) +end + local function stopFishing(player, tellClient) local s = fishing[player] if not s then @@ -600,7 +744,11 @@ local function stopFishing(player, tellClient) s.tween:Cancel() end if s.bobber then - s.bobber:Destroy() + if s.stage == "casting" then + s.bobber:Destroy() -- ещё летит: его двигает flyBobber + else + reelBobber(s.bobber, s.tool) + end end if s.tool then tweenGrip(s.tool, REST_ANGLE, 0.3) @@ -610,12 +758,19 @@ local function stopFishing(player, tellClient) end end -local function rollFish(player, data, worldId) +-- mods: { bait = наживка из Config.Baits, maxRank = потолок редкости (автоловля) } +local function rollFish(player, data, worldId, luckMult, mods) local zone = Config.Zones[worldId] if not zone then return nil end - local luck = totalLuck(player, data) + mods = mods or {} + local bait = mods.bait + local base = totalLuck(player, data) + (bait and bait.luck or 0) + if bait and bait.nightLuck and isNight() then + base += bait.nightLuck - Config.DayNight.nightLuck -- светлячок: ночью +30% вместо обычных +10% + end + local luck = base * (luckMult or 1) local bonus = luck - 1 local weights, total = {}, 0 for i, f in ipairs(zone.fish) do @@ -624,6 +779,12 @@ local function rollFish(player, data, worldId) if r.rank == 1 then w = r.weight / math.max(1, luck) end + if bait and bait.rareWeight and r.rank >= 3 then + w *= bait.rareWeight + end + if mods.maxRank and r.rank > mods.maxRank then + w = 0 + end weights[i] = w total += w end @@ -638,7 +799,7 @@ local function rollFish(player, data, worldId) end local mutation = nil for _, m in ipairs(Config.Mutations) do - if rng:NextNumber() < m.chance * luck * ev("mutation", 1) then + if rng:NextNumber() < m.chance * luck * ev("mutation", 1) * (weather().mutation or 1) * (bait and bait.mutation or 1) then mutation = m break end @@ -657,13 +818,14 @@ local function rollFish(player, data, worldId) } end -local function flyBobber(s, tool, target) +local function flyBobber(s, tool, target, dur, arc) local tip = tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip") local start = tip and tip.WorldPosition or (target + Vector3.new(0, 6, 0)) local bobber = Models.buildBobber() bobber:PivotTo(CFrame.new(start)) bobber.Parent = workspace s.bobber = bobber + local trail = addTrail(bobber.PrimaryPart, 1.2) if tip then local a1 = Instance.new("Attachment") a1.Position = Vector3.new(0, 0.9, 0) @@ -677,26 +839,37 @@ local function flyBobber(s, tool, target) line.Color = ColorSequence.new(Color3.fromRGB(245, 245, 245)) line.Parent = bobber end - local t0, dur = os.clock(), 0.55 + local t0 = os.clock() while bobber.Parent do local a = math.min(1, (os.clock() - t0) / dur) - bobber:PivotTo(CFrame.new(start:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * 6, 0))) + bobber:PivotTo(CFrame.new(start:Lerp(target, a) + Vector3.new(0, math.sin(a * math.pi) * arc, 0))) if a >= 1 then break end RunService.Heartbeat:Wait() end + trail.Enabled = false -- на воде поплавок качается, шлейф уже не нужен if bobber.Parent then splash(bobber.PrimaryPart, 18) playSound(bobber.PrimaryPart, SPLASH_SOUND, 0.5) end end -local function onCast(player) +local autoFishing = {} -- [player] = токен работающей автоловли +local setAutoFish, grantFish -- объявлены ниже + +local function onCast(player, power) + power = math.clamp(tonumber(power) or 0.6, 0, 1) local data = profiles[player] if not data then return end + if autoFishing[player] then + -- клик удочкой во время автоловли — выключить её + setAutoFish(player, false) + remote:FireClient(player, "CastFail") + return + end if fishing[player] then stopFishing(player, true) return @@ -709,42 +882,48 @@ local function onCast(player) return end local world = Config.WorldAt(hrp.Position) - local target = world and findWater(hrp, world) + local can = Config.CanCastFrom(world, hrp.Position) + if can ~= true then + remote:FireClient(player, "CastFail") + notify(player, can, Color3.fromRGB(255, 200, 120)) + return + end + local target, dist = findWater(hrp, world, power) if not target then remote:FireClient(player, "CastFail") - notify(player, world and "Повернись лицом к воде (или к лунке)!" or "Здесь нет рыбы — иди в один из миров 🌍", Color3.fromRGB(255, 200, 120)) + notify(player, "🌊 Подойди к воде", Color3.fromRGB(255, 200, 120)) return end if #data.items >= bagCapacity(player, data) then remote:FireClient(player, "CastFail") - notify(player, "🎒 Сумка полна! Продай рыбу в скупке.", RED) + notify(player, "🎒 Сумка полна!", RED) return end local stats = Config.RodStats(data.rod, rodLevel(data)) - local fish = rollFish(player, data, world.id) + local perfect = power >= Config.CastPerfect[1] and power <= Config.CastPerfect[2] + local bait = Guild.useBait(player, data) -- 1 штука наживки на заброс + local fish = rollFish(player, data, world.id, perfect and Config.CastPerfectLuck or 1, { bait = bait }) if not fish then 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 - remote:FireClient(player, "Cast") + -- замах игрок уже сделал, пока держал кнопку (у себя на клиенте); здесь только бросок вперёд + local throw = { windup = 0.15, flight = 0.35 + dist * 0.018, arc = 2 + dist * 0.3, perfect = perfect } + local splashAt = target + Vector3.new(0, 0.15, 0) + remote:FireClient(player, "Cast", splashAt, throw) -- клиенту для камеры task.spawn(function() - -- замах назад и бросок вперёд - local tw = tweenGrip(tool, 100, 0.25) - if tw then - tw.Completed:Wait() - end - tw = tweenGrip(tool, 8, 0.15) + local tw = tweenGrip(tool, 8, throw.windup) if tw then tw.Completed:Wait() end if fishing[player] ~= s then return end - flyBobber(s, tool, target + Vector3.new(0, 0.15, 0)) + flyBobber(s, tool, splashAt, throw.flight, throw.arc) tweenGrip(tool, REST_ANGLE - 5, 0.4) if fishing[player] ~= s then if s.bobber then @@ -754,7 +933,7 @@ local function onCast(player) end s.stage = "waiting" - local waitTime = rng:NextNumber(Config.BiteTimeMin, Config.BiteTimeMax) * stats.speed * ev("speed", 1) + local waitTime = rng:NextNumber(Config.BiteTimeMin, Config.BiteTimeMax) * stats.speed * ev("speed", 1) * (weather().speed or 1) * (bait and bait.speed or 1) task.wait(waitTime) if fishing[player] ~= s then return @@ -791,7 +970,8 @@ local function onCast(player) if fishing[player] == s and s.stage == "bite" then stopFishing(player, false) remote:FireClient(player, "Escaped") - notify(player, "Рыба ушла… не успел вытащить.", RED) + notify(player, "🐟 Рыба ушла", RED) + breakCombo(player) end end) end @@ -809,19 +989,37 @@ local function onCatch(player, success, misses) if s.tween then s.tween:Cancel() end - if s.bobber then - s.bobber:Destroy() + local failed = success ~= true or os.clock() - s.biteAt > Config.BiteTimeout + 1 + if failed then + reelBobber(s.bobber, tool) + elseif s.bobber then + s.bobber:Destroy() -- вместо поплавка к игроку летит рыба end - if success ~= true or os.clock() - s.biteAt > Config.BiteTimeout + 1 then + if failed then gripSequence(tool, { { REST_ANGLE, 0.3 } }) remote:FireClient(player, "Escaped") - notify(player, "Рыба сорвалась!", RED) + notify(player, "🐟 Сорвалась!", RED) + breakCombo(player) return end gripSequence(tool, { { 85, 0.15 }, { REST_ANGLE, 0.45 } }) + grantFish(player, data, s.fish, { perfect = s.perfect, misses = misses, fromPos = fromPos }) +end - local fish = s.fish +-- рыба поймана (руками или автоловлей): в сумку, опыт, коллекция, задания, гильдия, босс. +-- ctx: { perfect, misses, fromPos, auto }; у автоловли нет серии и бонусов за точность +grantFish = function(player, data, fish, ctx) + local streak = combo[player] or 0 + local comboMult = 1 + if not ctx.auto then + -- серия: каждая рыба подряд дороже и даёт больше опыта + 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) + end + fish.xp = math.floor(fish.xp * Guild.xpMult(data)) -- бонус отдыха: двойной опыт 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, @@ -844,24 +1042,172 @@ local function onCatch(player, success, misses) addXp(player, data, fish.xp * (isNew and 2 or 1)) updateStats(player) sendInventory(player) - if fromPos then - showFishFlight(player, fish, fromPos) + if ctx.fromPos then + showFishFlight(player, fish, ctx.fromPos) end - remote:FireClient(player, "Caught", fish, { new = isNew, record = isRecord }) + remote:FireClient(player, "Caught", fish, { new = isNew, record = isRecord, combo = comboMult, streak = ctx.auto and 0 or streak + 1, auto = ctx.auto }) 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) + if not ctx.auto then + if ctx.misses == 0 then + questProgress(player, "perfect", 1) + end + if ctx.perfect then + questProgress(player, "perfectCast", 1) + end + questProgress(player, "combo", streak + 1, true) end - if fish.mutation then - questProgress(player, "mutation", 1) + Guild.onCatch(player, data, fish, { + weather = workspace:GetAttribute("Weather"), night = isNight(), + perfect = ctx.perfect and not ctx.auto, streak = (not ctx.auto) and streak + 1 or 0, + }) + + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + bossHit(player, hrp and Config.WorldAt(hrp.Position), rank + (ctx.misses == 0 and 1 or 0)) +end + +---------------------------------------------------------------- автоловля (с ранга E) +-- сервер сам забрасывает и вытаскивает: удача ×0.6, не выше «Редкой», без серии и бонуса заброса, +-- каждая поимка на 50% дольше. Стоп — полная сумка, отошёл от места, сменил мир, убрал удочку + +local function autoFishLoop(player, token) + local A = Config.AutoFish + local home = nil -- где включили: отошёл дальше 10 studs или сменил мир — стоп + local function stop(reason) + if autoFishing[player] == token then + setAutoFish(player, false, reason) + end end - if misses == 0 then - questProgress(player, "perfect", 1) + while autoFishing[player] == token do + local data = profiles[player] + local char = player.Character + local hrp = char and char:FindFirstChild("HumanoidRootPart") + local tool = char and char:FindFirstChildOfClass("Tool") + if not data or not hrp then + return stop(nil) + end + if not tool or not tool:GetAttribute("IsRod") then + return stop("🎣 Автоловля: возьми удочку в руки") + end + local world = Config.WorldAt(hrp.Position) + if not world or Config.CanCastFrom(world, hrp.Position) ~= true then + return stop("🌊 Автоловля: встань у воды") + end + home = home or { pos = hrp.Position, world = world.id } + if world.id ~= home.world or (hrp.Position - home.pos).Magnitude > 10 then + return stop("🎣 Автоловля остановлена: ты отошёл") + end + if #data.items >= bagCapacity(player, data) then + return stop("🎒 Сумка полна — автоловля остановлена") + end + local target, dist = findWater(hrp, world, 0.6) + if not target then + return stop("🌊 Автоловля: встань у воды") + end + if fishing[player] then + task.wait(0.5) + continue + end + + local bait = Guild.useBait(player, data) + local fish = rollFish(player, data, world.id, A.luck, { bait = bait, maxRank = (not Guild.rank(data).autoNoCap) and A.maxRarity or nil }) + local s = { stage = "casting", fish = fish, tool = tool, auto = true } + fishing[player] = s + local splashAt = target + Vector3.new(0, 0.15, 0) + local tw = tweenGrip(tool, 8, 0.15) + if tw then + tw.Completed:Wait() + end + if fishing[player] == s then + flyBobber(s, tool, splashAt, 0.35 + dist * 0.018, 2 + dist * 0.3) + tweenGrip(tool, REST_ANGLE - 5, 0.4) + end + if fishing[player] ~= s then + if s.bobber then + s.bobber:Destroy() + end + continue + end + s.stage = "waiting" + local stats = Config.RodStats(data.rod, rodLevel(data)) + local waitTime = rng:NextNumber(Config.BiteTimeMin, Config.BiteTimeMax) * stats.speed * ev("speed", 1) + * (weather().speed or 1) * (bait and bait.speed or 1) * A.slower + local t0, bit = os.clock(), false + while fishing[player] == s and autoFishing[player] == token and os.clock() - t0 < waitTime + A.reel do + local h = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if not h or (h.Position - home.pos).Magnitude > 10 then + break + end + if not bit and os.clock() - t0 >= waitTime then + -- клюёт: всплеск и удочка дёргается до конца «вываживания» + bit = true + if s.bobber and s.bobber.PrimaryPart then + splash(s.bobber.PrimaryPart, 25) + playSound(s.bobber.PrimaryPart, SPLASH_SOUND, 0.35) + end + end + if bit then + tweenGrip(tool, (math.floor(os.clock() * 8) % 2 == 0) and 38 or 18, 0.12) + end + task.wait(0.13) + end + if fishing[player] ~= s or autoFishing[player] ~= token or not bit or os.clock() - t0 < waitTime + A.reel - 0.05 then + if fishing[player] == s then + stopFishing(player, false) + end + continue -- наверху цикла проверим, почему прервались (отошёл, выключил) + end + fishing[player] = nil + local fromPos = s.bobber and s.bobber.PrimaryPart and s.bobber.PrimaryPart.Position + if s.bobber then + s.bobber:Destroy() + end + gripSequence(tool, { { 85, 0.15 }, { REST_ANGLE, 0.45 } }) + grantFish(player, data, fish, { auto = true, fromPos = fromPos }) + task.wait(1.2) + end +end + +setAutoFish = function(player, on, reason) + local data = profiles[player] + if on then + if not data then + return + end + if not Guild.rank(data).auto then + notify(player, "🔒 Автоловля — с ранга гильдии E", RED) + player:SetAttribute("AutoFish", false) + return + end + if autoFishing[player] then + return + end + if fishing[player] then + stopFishing(player, true) + end + local token = {} + autoFishing[player] = token + player:SetAttribute("AutoFish", true) + notify(player, "🎣 Автоловля включена", GREEN) + task.spawn(autoFishLoop, player, token) + else + player:SetAttribute("AutoFish", false) + if not autoFishing[player] then + return + end + autoFishing[player] = nil + local s = fishing[player] + if s and s.auto then + stopFishing(player, false) + end + notify(player, reason or "🎣 Автоловля выключена", Color3.fromRGB(255, 200, 120)) end end @@ -909,7 +1255,7 @@ local function sellItems(player, filterUid) end if count == 0 then if filterUid == nil then - notify(player, "Нечего продавать — сначала поймай рыбу!", Color3.fromRGB(255, 200, 120)) + notify(player, "🎒 Сумка пуста", Color3.fromRGB(255, 200, 120)) end return end @@ -918,6 +1264,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 @@ -935,12 +1282,12 @@ local function buy(player, kind, id) end local lvl = rodLevel(data, id) if lvl >= Config.RodUpgrade.maxLevel then - notify(player, "Удочка уже улучшена до максимума ★★★★★", GOLD) + notify(player, "★★★★★ Максимум", GOLD) return end - local cost = Config.UpgradeCost(rod, lvl) + local cost = Guild.price(data, Config.UpgradeCost(rod, lvl)) -- скидка ранга гильдии if data.coins < cost then - notify(player, "Не хватает монет: нужно " .. cost .. " 💰", RED) + notify(player, "Нужно " .. cost .. " ⚪", RED) return end data.coins -= cost @@ -951,6 +1298,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 @@ -959,17 +1307,19 @@ local function buy(player, kind, id) return end if potion.level and data.level < potion.level then - notify(player, "Нужен уровень " .. potion.level .. "!", RED) + notify(player, "🔒 Нужен ур. " .. potion.level, RED) return end - if data.coins < potion.price then - notify(player, "Не хватает монет: нужно " .. potion.price .. " 💰", RED) + local price = Guild.price(data, potion.price) + if data.coins < price then + notify(player, "Нужно " .. price .. " ⚪", RED) return end - data.coins -= potion.price + data.coins -= price applyPotion(data, potion.bonus, potion.duration) updateStats(player) - notify(player, ("🍀 %s: удача +%d%% на %d мин"):format(potion.name, potion.bonus * 100, potion.duration / 60), GREEN) + notify(player, ("🍀 +%d%% удачи, %d мин"):format(potion.bonus * 100, potion.duration / 60), GREEN) + questProgress(player, "buy", 1) return end local list, owned @@ -984,18 +1334,21 @@ 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) + notify(player, "🔒 Нужен ур. " .. item.level, RED) return end - if data.coins < item.price then - notify(player, "Не хватает монет: нужно " .. item.price .. " 💰", RED) + local price = Guild.price(data, item.price) + if data.coins < price then + notify(player, "Нужно " .. price .. " ⚪", RED) return end - data.coins -= item.price + data.coins -= price owned[id] = true - notify(player, "Куплено: " .. item.name .. "!", GREEN) + bought = true + notify(player, "✅ " .. item.name, GREEN) end if kind == "Rod" then data.rod = id @@ -1006,10 +1359,19 @@ local function buy(player, kind, id) attachBag(player) end updateStats(player) + if bought then + questProgress(player, "buy", 1) + end end ---------------------------------------------------------------- телепорт +local TELEPORT_FADE = 0.3 -- сколько клиент затемняет экран перед переносом +local teleporting = {} +Players.PlayerRemoving:Connect(function(p) + teleporting[p] = nil +end) + local function teleportTo(player, worldId) local data = profiles[player] local char = player.Character @@ -1025,20 +1387,33 @@ local function teleportTo(player, worldId) return end if world.soon then - notify(player, world.icon .. " " .. world.name .. " скоро откроется! Следи за обновлениями.", world.color) + notify(player, world.icon .. " " .. world.name .. " — скоро!", world.color) return end if data.level < world.level then - notify(player, ("🔒 %s откроется на %d уровне"):format(world.name, world.level), RED) + notify(player, ("🔒 %s: ур. %d"):format(world.name, world.level), RED) + return + end + local okRank, why = Guild.canEnter(data, world.id) + if not okRank then + notify(player, why, RED) return end markerName = world.id .. "Spawn" end local map = workspace:FindFirstChild("FishingMap") - local m = map and map:FindFirstChild(markerName) - if m then + local m = map and map:FindFirstChild(markerName, true) -- маркеры могут лежать в папках уровня (World1Map) + if m and not teleporting[player] then + -- клиент затемняет экран, переносим уже в темноте: свет новой локации ставится до того, как её видно + teleporting[player] = true stopFishing(player, true) - char:PivotTo(m.CFrame + Vector3.new(0, 3, 0)) + remote:FireClient(player, "TeleportFade", worldId, TELEPORT_FADE) + task.wait(TELEPORT_FADE) + teleporting[player] = nil + char = player.Character + if char and char.Parent then + char:PivotTo(m.CFrame + Vector3.new(0, 3, 0)) + end end end @@ -1087,6 +1462,10 @@ ProximityPromptService.PromptTriggered:Connect(function(prompt, player) remote:FireClient(player, "OpenRobux", "passes") elseif action == "RobuxProducts" then remote:FireClient(player, "OpenRobux", "products") + elseif action == "Guild" or action == "Orders" or action == "Bait" or action == "Traps" then + -- Старейшина, доска заказов, лавка наживки: окно гильдии на нужной вкладке + Guild.sendState(player) + remote:FireClient(player, "OpenGuild", ({ Guild = "rank", Orders = "orders", Bait = "bait", Traps = "traps" })[action]) end end) @@ -1094,7 +1473,15 @@ end) remote.OnServerEvent:Connect(function(player, action, a, b) if action == "Cast" then - onCast(player) + onCast(player, a) + elseif action == "Tutorial" then + -- шаги обучения идут только вперёд + local data = profiles[player] + local step = math.floor(tonumber(a) or 0) + if data and step > (player:GetAttribute("Tutorial") or 0) and step <= Config.TutorialDone then + data.tutorial = step + player:SetAttribute("Tutorial", step) + end elseif action == "Catch" then onCatch(player, a, b) elseif action == "Cancel" then @@ -1108,25 +1495,36 @@ remote.OnServerEvent:Connect(function(player, action, a, b) if nearSeller(player) then sellItems(player, a) else - notify(player, "Продавать можно только у скупщика 💰", Color3.fromRGB(255, 200, 120)) + notify(player, "⚪ Только у скупщика", Color3.fromRGB(255, 200, 120)) end elseif action == "SellAll" then if nearSeller(player) then sellItems(player, nil) else - notify(player, "Продавать можно только у скупщика 💰", Color3.fromRGB(255, 200, 120)) + notify(player, "⚪ Только у скупщика", Color3.fromRGB(255, 200, 120)) end elseif action == "Teleport" then teleportTo(player, a) elseif action == "ClaimCollection" then claimCollection(player, a, b) - elseif action == "ClaimQuest" then - claimQuest(player, a) elseif action == "ClaimDaily" then claimDaily(player) elseif action == "RequestInventory" then sendInventory(player) sendQuests(player) + elseif action == "Settings" then + -- громкость музыки и эффектов (0..1), сохраняется вместе с прогрессом + local data = profiles[player] + local music, sfx = tonumber(a), tonumber(b) + if data and music and sfx then + data.settings = { music = math.clamp(music, 0, 1), sfx = math.clamp(sfx, 0, 1) } + player:SetAttribute("VolMusic", data.settings.music) + player:SetAttribute("VolSfx", data.settings.sfx) + end + elseif action == "AutoFish" then + setAutoFish(player, a == true) + else + Guild.onAction(player, action, a, b) end end) @@ -1140,7 +1538,7 @@ MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passI if gp.id == passId then passes[player] = passes[player] or {} passes[player][gp.key] = true - notify(player, "Спасибо за покупку! " .. gp.icon .. " " .. gp.name .. " активирован", GOLD) + notify(player, "✅ " .. gp.icon .. " " .. gp.name, GOLD) if gp.key == "VIP" then vipTag(player) end @@ -1172,11 +1570,11 @@ MarketplaceService.ProcessReceipt = function(info) if product.coins then local coins = math.floor(product.coins * (1 + (data.level - 1) * 0.15)) data.coins += coins - notify(player, ("Спасибо! +%d 💰"):format(coins), GOLD) + notify(player, ("Спасибо! +%d ⚪"):format(coins), GOLD) end if product.boost then applyPotion(data, product.boost, product.duration) - notify(player, ("Спасибо! Удача +%d%% на %d мин"):format(product.boost * 100, product.duration / 60), GOLD) + notify(player, ("🍀 +%d%% удачи, %d мин"):format(product.boost * 100, product.duration / 60), GOLD) end table.insert(data.receipts, info.PurchaseId) if #data.receipts > 50 then @@ -1196,7 +1594,7 @@ task.spawn(function() workspace:SetAttribute("Event", currentEvent.id) workspace:SetAttribute("EventEnds", workspace:GetServerTimeNow() + currentEvent.duration) for _, p in ipairs(Players:GetPlayers()) do - notify(p, "🎉 Событие: " .. currentEvent.name .. " — " .. currentEvent.desc, GOLD) + notify(p, "🎉 " .. currentEvent.name, GOLD) updateStats(p) end task.wait(currentEvent.duration) @@ -1209,13 +1607,113 @@ 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 + Guild.onBossWin(p, data) + updateStats(p) + remote:FireClient(p, "BossReward", coins, xp, potion and potion.name) + end + end + for _, p in ipairs(Players:GetPlayers()) do + remote:FireClient(p, "BossDone", true, b.def.name, best and best.DisplayName, bestDmg) + end +end + +task.spawn(function() + task.wait(Config.Boss.firstDelay) + while true do + -- мир, где сейчас больше всего игроков + local counts = {} + for _, p in ipairs(Players:GetPlayers()) do + local w = playerWorld(p) + if w and Config.Boss.worlds[w.id] then + counts[w.id] = (counts[w.id] or 0) + 1 + end + end + local bestId, n = nil, 0 + for id, c in pairs(counts) do + if c > n then + bestId, n = id, c + end + end + if not bestId then + task.wait(30) -- никого нет в мирах: попробуем позже + else + local world = Config.Find(Config.Worlds, bestId) + local max = Config.Boss.hpPerPlayer * n + boss = { + world = world, def = Config.Boss.worlds[bestId], hp = max, max = max, dmg = {}, + ends = workspace:GetServerTimeNow() + Config.Boss.duration, + } + setBossAttrs() + for _, p in ipairs(Players:GetPlayers()) do + remote:FireClient(p, "BossStart", boss.def.name, world.icon .. " " .. world.name) + end + local t0 = os.clock() + while boss and boss.hp > 0 and os.clock() - t0 < Config.Boss.duration do + task.wait(0.25) + end + if boss then + finishBoss(boss.hp <= 0) + end + task.wait(Config.Boss.interval) + end + end +end) + ---------------------------------------------------------------- игроки local function onPlayerAdded(player) local ls = Instance.new("Folder") ls.Name = "leaderstats" ls.Parent = player - for _, name in ipairs({ "Монеты", "Уровень", "Улов" }) do + for _, name in ipairs({ "Серебро", "Уровень", "Улов" }) do local v = Instance.new("IntValue") v.Name = name v.Parent = ls @@ -1226,12 +1724,18 @@ local function onPlayerAdded(player) return end loadPasses(player) - ensureQuests(data) + ensureChain(data) + Guild.defaults(data) + Guild.onJoin(player, data) profiles[player] = data loadedOk[player] = ok + local settings = type(data.settings) == "table" and data.settings or {} + player:SetAttribute("VolMusic", tonumber(settings.music) or Config.DefaultVolume.music) + player:SetAttribute("VolSfx", tonumber(settings.sfx) or Config.DefaultVolume.sfx) updateStats(player) sendInventory(player) sendQuests(player) + Guild.sendState(player) local function onCharacter() stopFishing(player, false) @@ -1239,6 +1743,7 @@ local function onPlayerAdded(player) giveRodTool(player) attachBag(player) vipTag(player) + Guild.badge(player) end player.CharacterAdded:Connect(onCharacter) if player.Character then @@ -1253,6 +1758,11 @@ end Players.PlayerRemoving:Connect(function(player) stopFishing(player, false) + combo[player], comboUntil[player] = nil, nil + autoFishing[player] = nil + if profiles[player] then + Guild.onLeave(profiles[player]) + end saveData(player) profiles[player] = nil loadedOk[player] = nil @@ -1261,21 +1771,46 @@ end) game:BindToClose(function() for _, p in ipairs(Players:GetPlayers()) do + if profiles[p] then + Guild.onLeave(profiles[p]) + end saveData(p) end end) +-- погода и ночь меняют удачу: пересчитываем её у всех, когда они меняются +local function refreshAllStats() + for _, p in ipairs(Players:GetPlayers()) do + updateStats(p) + end +end +workspace:GetAttributeChangedSignal("Weather"):Connect(refreshAllStats) + -- таймер зелий + автосохранение task.spawn(function() local t = 0 + local wasNight = isNight() while true do task.wait(1) t += 1 + local night = isNight() + if night ~= wasNight then + wasNight = night + refreshAllStats() + end for _, p in ipairs(Players:GetPlayers()) do local data = profiles[p] if data and data.boostUntil > os.time() - 2 then updateStats(p) end + -- бонус отдыха тратится, пока игрок рыбачит + if data and (fishing[p] or autoFishing[p]) then + Guild.spendRest(p, data, 1) + 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/src/ServerScriptService/Guild.lua b/src/ServerScriptService/Guild.lua new file mode 100644 index 0000000..9b877ab --- /dev/null +++ b/src/ServerScriptService/Guild.lua @@ -0,0 +1,838 @@ +-- Guild (ModuleScript) -> ServerScriptService +-- Гильдия рыбаков: ранги F–S, печати и жемчуг, испытания у Старейшины, личные заказы на доске, +-- наживка, ловушки-вентери, бонус отдыха и жетон ранга над головой. +-- Данные игрока хранит GameServer (profiles); он же вызывает отсюда хуки (улов, вход, статы). + +local Players = game:GetService("Players") +local ReplicatedStorage = game:GetService("ReplicatedStorage") + +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) + +local Guild = {} +local api -- функции GameServer: profiles, notify, updateStats, addXp, sendInventory, bagCapacity, isNight, weather, remote +local RANKS = Config.Guild.ranks +local GOLD = Color3.fromRGB(255, 214, 120) +local RED = Color3.fromRGB(255, 120, 120) +local GREEN = Color3.fromRGB(150, 230, 130) + +function Guild.init(a) + api = a + -- только в Studio: проверки из командной строки/MCP (ServerStorage.GuildDebug:Invoke("get", player, "seals")) + if game:GetService("RunService"):IsStudio() then + local f = Instance.new("BindableFunction") + f.Name = "GuildDebug" + f.OnInvoke = function(op, player, key, value, extra) + local data = api.profiles[player] + if not data then + return nil + end + if op == "get" then + return data[key] + elseif op == "set" then + data[key] = value + api.updateStats(player) + elseif op == "addItem" then + key.uid = data.nextUid + data.nextUid += 1 + table.insert(data.items, key) + api.sendInventory(player) + api.updateStats(player) + elseif op == "action" then + Guild.onAction(player, key, value, extra) + elseif op == "orders" then + Guild.refreshOrders(data, player) + return data.orders.list + end + return true + end + f.Parent = game:GetService("ServerStorage") + end +end + +---------------------------------------------------------------- данные + +-- новые поля (старые сохранения грузятся: чего нет — дополняем) +function Guild.defaults(data) + data.pearls = data.pearls or 0 + data.seals = data.seals or 0 + data.trial = data.trial -- { rank = номер ранга, progress = n } или nil + if type(data.orders) ~= "table" then + data.orders = { window = -1, list = {} } + end + if type(data.bait) ~= "table" then + data.bait = { equipped = nil, counts = {} } + end + data.bait.counts = data.bait.counts or {} + if type(data.traps) ~= "table" then + data.traps = {} + end + data.rest = data.rest or 0 + if not data.rank then + -- сохранение до гильдии: кто уже дошёл до дальних миров, сохраняет к ним доступ + local lvl = data.level or 1 + data.rank = (lvl >= 18 and 5) or (lvl >= 8 and 3) or 1 + if data.rank > 1 then + data.seals = math.max(data.seals, RANKS[data.rank].seals) + end + end +end + +-- данные игрока (для проверок из Studio) +function Guild.profile(player) + return api.profiles[player] +end + +function Guild.rank(data) + return RANKS[math.clamp(data.rank or 1, 1, #RANKS)], data.rank or 1 +end + +local function nearSpot(player, attr) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + local map = workspace:FindFirstChild("FishingMap") + if not hrp or not map then + return false + end + for _, d in ipairs(map:GetDescendants()) do + if d:IsA("BasePart") and d:GetAttribute(attr) then + if (d.Position - hrp.Position).Magnitude <= Config.Guild.elderDistance then + return true + end + end + end + return false +end + +---------------------------------------------------------------- жетон ранга над головой + +function Guild.badge(player) + local data = api.profiles[player] + local head = player.Character and player.Character:FindFirstChild("Head") + if not data or not head then + return + end + local r = Guild.rank(data) + local bb = head:FindFirstChild("RankBadge") + if not bb then + bb = Instance.new("BillboardGui") + bb.Name = "RankBadge" + bb.Size = UDim2.fromOffset(46, 52) + bb.StudsOffset = Vector3.new(0, 2.4, 0) + bb.MaxDistance = 70 + bb.LightInfluence = 0 + bb.Parent = head + -- щит: ромб с золотой каймой и буквой + local shield = Instance.new("Frame") + shield.Name = "Shield" + shield.Size = UDim2.fromOffset(34, 34) + shield.AnchorPoint = Vector2.new(0.5, 0.5) + shield.Position = UDim2.fromScale(0.5, 0.5) + shield.Rotation = 45 + shield.Parent = bb + local c = Instance.new("UICorner") + c.CornerRadius = UDim.new(0, 6) + c.Parent = shield + local s = Instance.new("UIStroke") + s.Color = Color3.fromRGB(218, 172, 92) + s.Thickness = 3 + s.Parent = shield + local g = Instance.new("UIGradient") + g.Color = ColorSequence.new(Color3.new(1, 1, 1), Color3.fromRGB(150, 150, 150)) + g.Rotation = 45 + g.Parent = shield + local t = Instance.new("TextLabel") + t.Name = "Letter" + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.FontFace = Font.new("rbxasset://fonts/families/Merriweather.json", Enum.FontWeight.Heavy) + t.TextScaled = true + t.TextColor3 = Color3.new(1, 1, 1) + t.TextStrokeTransparency = 0.2 + t.TextStrokeColor3 = Color3.fromRGB(40, 28, 20) + t.ZIndex = 2 + t.Parent = bb + end + bb.Shield.BackgroundColor3 = r.color + bb.Shield.UIGradient.Color = r.id == "S" + and ColorSequence.new({ + ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 120, 120)), ColorSequenceKeypoint.new(0.35, Color3.fromRGB(255, 230, 120)), + ColorSequenceKeypoint.new(0.7, Color3.fromRGB(120, 230, 255)), ColorSequenceKeypoint.new(1, Color3.fromRGB(220, 130, 255)), + }) + or ColorSequence.new(Color3.new(1, 1, 1), Color3.fromRGB(150, 150, 150)) + bb.Shield.UIStroke.Color = (r.id == "S" or r.id == "A") and Color3.fromRGB(255, 225, 130) or Color3.fromRGB(218, 172, 92) + bb.Letter.Text = r.id + -- корона VIP — над жетоном + local vip = head:FindFirstChild("VipTag") + if vip then + vip.StudsOffset = Vector3.new(0, 4, 0) + end +end + +---------------------------------------------------------------- состояние для клиента + +local function orderText(o) + local f = o.fish and Config.FindFish(o.fish) + if o.kind == "deliver" then + return ("Сдай %d × %s"):format(o.count, f and f.name or "?") + elseif o.kind == "heavy" then + return ("Принеси %s тяжелее %.1f кг"):format(f and f.name or "?", o.minW) + elseif o.kind == "weather" then + return ("Поймай %d рыб в дождь или грозу"):format(o.count) + elseif o.kind == "night" then + return ("Поймай %d «Необычных» или реже ночью"):format(o.count) + elseif o.kind == "combo" then + return ("Набери серию из %d рыб"):format(o.count) + elseif o.kind == "perfect" then + return ("Сделай %d забросов в зелёную зону"):format(o.count) + end + return o.kind +end +Guild.orderText = orderText + +local function trialState(data) + local nextRank = RANKS[(data.rank or 1) + 1] + if not nextRank then + return nil + end + local active = data.trial and data.trial.rank == data.rank + 1 + local t = nextRank.trial + local goal = t.count or 1 + local progress = active and data.trial.progress or 0 + if t.kind == "dex" then + local zone = Config.Zones[t.world] + goal, progress = #zone.fish, 0 + for _, f in ipairs(zone.fish) do + if data.discovered[f.id] then + progress += 1 + end + end + end + return { + rank = data.rank + 1, text = t.text, active = active, progress = progress, goal = goal, + ready = data.seals >= nextRank.seals, + } +end + +function Guild.sendState(player) + local data = api.profiles[player] + if not data then + return + end + Guild.refreshOrders(data, player) + local list = {} + for i, o in ipairs(data.orders.list) do + list[i] = { + kind = o.kind, text = orderText(o), progress = o.progress, count = o.count, done = o.done, + seals = o.seals, coins = o.coins, pearls = o.pearls, deliver = (o.kind == "deliver" or o.kind == "heavy"), + } + end + local now = os.time() + local traps = {} + for i, t0 in ipairs(data.traps) do + traps[i] = math.min(Config.Traps.max, math.floor((now - t0) / Config.Traps.every)) + end + api.remote:FireClient(player, "Guild", { + trial = trialState(data), + orders = list, + ordersEnd = (data.orders.window + 1) * Config.Orders.period, + traps = traps, trapSlots = Guild.rank(data).traps or 0, trapEvery = Config.Traps.every, trapMax = Config.Traps.max, + baits = data.bait.counts, bait = data.bait.equipped, + }) +end + +-- атрибуты игрока (HUD и окна читают их) +function Guild.attrs(player, data) + local r, idx = Guild.rank(data) + player:SetAttribute("Pearls", data.pearls) + player:SetAttribute("Seals", data.seals) + player:SetAttribute("GuildRank", r.id) + player:SetAttribute("RankIdx", idx) + local nextRank = RANKS[idx + 1] + player:SetAttribute("SealsNext", nextRank and nextRank.seals or nil) + player:SetAttribute("RestLeft", math.floor(data.rest)) + player:SetAttribute("Bait", data.bait.equipped) + player:SetAttribute("BaitCount", data.bait.equipped and (data.bait.counts[data.bait.equipped] or 0) or 0) + local ready = 0 + for _, t0 in ipairs(data.traps) do + ready += math.min(Config.Traps.max, math.floor((os.time() - t0) / Config.Traps.every)) + end + player:SetAttribute("TrapFish", ready) +end + +---------------------------------------------------------------- ранги и испытания + +local function rankUp(player, data) + data.rank += 1 + data.trial = nil + data.pearls += Config.Pearls.rankUp + local r = RANKS[data.rank] + -- новые ловушки начинают копить с этого момента + while #data.traps < (r.traps or 0) do + table.insert(data.traps, os.time()) + end + api.remote:FireClient(player, "RankUp", r.id, r.name, r.unlocks, Config.Pearls.rankUp) + for _, p in ipairs(Players:GetPlayers()) do + api.notify(p, ("⚔ %s получил ранг %s — «%s»!"):format(player.DisplayName, r.id, r.name), GOLD) + end + Guild.badge(player) + api.updateStats(player) + Guild.sendState(player) +end + +local function trialProgress(player, data, amount) + local st = data.trial + local nextRank = RANKS[data.rank + 1] + if not st or not nextRank or st.rank ~= data.rank + 1 then + return + end + st.progress = (st.progress or 0) + amount + if st.progress >= (nextRank.trial.count or 1) then + rankUp(player, data) + else + Guild.sendState(player) + end +end + +local function checkDexTrial(player, data) + local st = data.trial + local nextRank = RANKS[data.rank + 1] + if st and nextRank and st.rank == data.rank + 1 and nextRank.trial.kind == "dex" then + local s = trialState(data) + if s.progress >= s.goal then + rankUp(player, data) + end + end +end + +local function takeTrial(player, data) + local nextRank = RANKS[data.rank + 1] + if not nextRank then + api.notify(player, "👑 Ты уже Легенда гильдии!", GOLD) + return + end + if data.seals < nextRank.seals then + api.notify(player, ("📜 Нужно %d печатей (у тебя %d)"):format(nextRank.seals, data.seals), RED) + return + end + if not nearSpot(player, "GuildElder") then + api.notify(player, "⚔ Испытание выдаёт " .. Config.Guild.elder .. " — он в здании гильдии в лобби", Color3.fromRGB(255, 200, 120)) + return + end + local t = nextRank.trial + if t.kind == "deliver" then + -- сдать рыбу из сумки сразу, если она есть + local have, keep = 0, {} + for _, item in ipairs(data.items) do + if item.id == t.fish and have < t.count then + have += 1 + else + table.insert(keep, item) + end + end + if have < t.count then + local f = Config.FindFish(t.fish) + api.notify(player, ("🐟 Принеси %d × %s (в сумке %d)"):format(t.count, f and f.name or t.fish, have), RED) + data.trial = { rank = data.rank + 1, progress = 0 } + Guild.sendState(player) + return + end + data.items = keep + api.sendInventory(player) + data.trial = { rank = data.rank + 1, progress = 0 } + trialProgress(player, data, t.count) + return + end + if not (data.trial and data.trial.rank == data.rank + 1) then + data.trial = { rank = data.rank + 1, progress = 0 } + api.notify(player, "⚔ Испытание принято: " .. t.text, GOLD) + end + if t.kind == "dex" then + checkDexTrial(player, data) + end + Guild.sendState(player) +end + +---------------------------------------------------------------- заказы + +local function pick(rng, weights) + local total = 0 + for _, w in pairs(weights) do + total += w + end + local roll = rng:NextNumber() * total + for k, w in pairs(weights) do + roll -= w + if roll <= 0 then + return k + end + end + return next(weights) +end + +-- рыба для заказов: из миров, куда игрок уже может попасть +local function fishPool(data, rarities) + local pool = {} + for _, w in ipairs(Config.Worlds) do + local zone = Config.Zones[w.id] + local needRank = Config.Guild.worldRank[w.id] or 1 + if zone and not w.soon and data.level >= w.level and data.rank >= needRank then + for _, f in ipairs(zone.fish) do + if rarities[f.rarity] then + table.insert(pool, f) + end + end + end + end + return pool +end + +local function makeOrder(data, rng) + local O = Config.Orders + local weights = {} + for k, v in pairs(O.kinds) do + weights[k] = v.weight + end + -- порядок ключей в pairs не задан: сортируем, чтобы при одном зерне выпадало одно и то же + local kind + do + local keys = {} + for k in pairs(weights) do + table.insert(keys, k) + end + table.sort(keys) + local total = 0 + for _, k in ipairs(keys) do + total += weights[k] + end + local roll = rng:NextNumber() * total + for _, k in ipairs(keys) do + roll -= weights[k] + if roll <= 0 then + kind = k + break + end + end + kind = kind or keys[1] + end + local r = data.rank or 1 + local hard = rng:NextNumber() -- сложность заказа 0..1 + local o = { kind = kind, progress = 0, done = false } + if kind == "deliver" then + local pool = fishPool(data, r >= 3 and { Common = true, Uncommon = true, Rare = true } or { Common = true, Uncommon = true }) + local f = pool[rng:NextInteger(1, #pool)] + local rank = Config.Rarities[f.rarity].rank + o.fish = f.id + o.count = math.max(1, math.floor((rank == 1 and 5 or (rank == 2 and 3 or 1)) * (0.7 + hard * 0.8) + 0.5)) + elseif kind == "heavy" then + local pool = fishPool(data, { Uncommon = true, Rare = true }) + local f = pool[rng:NextInteger(1, #pool)] + o.fish = f.id + o.count = 1 + o.minW = math.floor((f.minW + (f.maxW - f.minW) * (0.25 + hard * 0.3)) * 10) / 10 + elseif kind == "weather" then + o.count = 2 + math.floor(hard * 3) + r + elseif kind == "night" then + o.count = 1 + math.floor(hard * 2) + math.floor(r / 2) + elseif kind == "combo" then + o.count = math.min(15, 4 + math.floor(hard * 4) + r) + elseif kind == "perfect" then + o.count = 3 + math.floor(hard * 4) + r + end + local s = O.kinds[kind].seals + o.seals = math.floor(s[1] + (s[2] - s[1]) * hard + 0.5) + (r - 1) * 2 + o.coins = math.floor(o.seals * O.coinsPerSeal * (1 + 0.5 * (r - 1))) + o.pearls = rng:NextNumber() < O.pearlChance and rng:NextInteger(O.pearlsMin, O.pearlsMax) or 0 + return o +end + +-- новое окно (каждые 3 часа) — новые заказы; на ранге E и выше их 4 +function Guild.refreshOrders(data, player) + local window = math.floor(os.time() / Config.Orders.period) + local want = Guild.rank(data).orders + if data.orders.window ~= window then + local seed = ((player and player.UserId or 0) % 100000) * 7919 + window + local rng = Random.new(seed) + data.orders = { window = window, list = {} } + local seen = {} + for i = 1, want do + -- без повторов: один и тот же тип с той же рыбой не выпадает дважды + local o + for _ = 1, 6 do + o = makeOrder(data, rng) + if not seen[o.kind .. (o.fish or "")] then + break + end + end + seen[o.kind .. (o.fish or "")] = true + data.orders.list[i] = o + end + else + -- ранг вырос посреди окна: добавляем недостающий заказ + local seen = {} + for _, o in ipairs(data.orders.list) do + seen[o.kind .. (o.fish or "")] = true + end + while #data.orders.list < want do + local o + for _ = 1, 6 do + o = makeOrder(data, Random.new()) + if not seen[o.kind .. (o.fish or "")] then + break + end + end + seen[o.kind .. (o.fish or "")] = true + table.insert(data.orders.list, o) + end + end +end + +local function finishOrder(player, data, o) + o.done = true + data.seals += o.seals + data.coins += o.coins + data.pearls += o.pearls + api.notify(player, ("📜 Заказ выполнен! +%d печатей +%d ⚪%s"):format(o.seals, o.coins, o.pearls > 0 and (" +" .. o.pearls .. " 🦪") or ""), GOLD) + api.remote:FireClient(player, "OrderDone") + local nextRank = RANKS[data.rank + 1] + if nextRank and data.seals >= nextRank.seals and data.seals - o.seals < nextRank.seals then + api.notify(player, ("⚔ Печатей хватает на ранг %s! Иди к Старейшине за испытанием"):format(nextRank.id), GOLD) + end + api.updateStats(player) + Guild.sendState(player) +end + +local function deliverOrder(player, data, i) + Guild.refreshOrders(data, player) + local o = data.orders.list[i] + if not o or o.done or (o.kind ~= "deliver" and o.kind ~= "heavy") then + return + end + if not nearSpot(player, "OrderBoard") then + api.notify(player, "📜 Рыбу сдают у доски заказов в здании гильдии", Color3.fromRGB(255, 200, 120)) + return + end + local need = o.count - o.progress + local keep = {} + -- сдаём сначала самую дешёвую подходящую рыбу + local fit = {} + for _, item in ipairs(data.items) do + if item.id == o.fish and (not o.minW or item.weight >= o.minW) then + table.insert(fit, item) + end + end + table.sort(fit, function(a, b) + return a.value < b.value + end) + local take = {} + for k = 1, math.min(need, #fit) do + take[fit[k].uid] = true + end + local given = 0 + for _, item in ipairs(data.items) do + if take[item.uid] then + given += 1 + else + table.insert(keep, item) + end + end + if given == 0 then + local f = Config.FindFish(o.fish) + api.notify(player, ("🎒 В сумке нет подходящей рыбы: %s"):format(f and f.name or o.fish), RED) + return + end + data.items = keep + o.progress += given + api.sendInventory(player) + if o.progress >= o.count then + finishOrder(player, data, o) + else + api.updateStats(player) + Guild.sendState(player) + end +end + +local function rerollOrder(player, data, i) + Guild.refreshOrders(data, player) + local o = data.orders.list[i] + if not o or o.done then + return + end + local cost = Config.Orders.rerollPearls + if data.pearls < cost then + api.notify(player, ("🦪 Нужно %d жемчуга"):format(cost), RED) + return + end + data.pearls -= cost + data.orders.list[i] = makeOrder(data, Random.new()) + api.updateStats(player) + Guild.sendState(player) +end + +---------------------------------------------------------------- улов: заказы, испытания, жемчуг + +-- ctx: { weather = id, night = bool, perfect = bool (заброс в зелёную зону), streak = n, auto = bool } +function Guild.onCatch(player, data, fish, ctx) + local rank = Config.Rarities[fish.rarity].rank + -- жемчуг за мутацию + local pearls = fish.mutation and Config.Pearls.mutation[fish.mutation] or 0 + if pearls > 0 then + data.pearls += pearls + api.notify(player, ("🦪 +%d жемчуга за мутацию!"):format(pearls), Color3.fromRGB(235, 225, 245)) + end + local rainy = ctx.weather == "Rain" or ctx.weather == "Storm" + -- заказы «по ходу» + Guild.refreshOrders(data, player) + local changed = false + for _, o in ipairs(data.orders.list) do + if not o.done then + local add = 0 + if o.kind == "weather" and rainy then + add = 1 + elseif o.kind == "night" and ctx.night and rank >= 2 then + add = 1 + elseif o.kind == "perfect" and ctx.perfect then + add = 1 + elseif o.kind == "combo" and (ctx.streak or 0) > o.progress then + o.progress = math.min(o.count, ctx.streak) + changed = true + if o.progress >= o.count then + finishOrder(player, data, o) + end + end + if add > 0 then + o.progress = math.min(o.count, o.progress + add) + changed = true + if o.progress >= o.count then + finishOrder(player, data, o) + end + end + end + end + -- испытание + local nextRank = RANKS[data.rank + 1] + if data.trial and nextRank and data.trial.rank == data.rank + 1 then + local t = nextRank.trial + if t.kind == "catch" and rank >= (t.minRank or 1) + and (not t.weathers or t.weathers[ctx.weather]) + and (not t.night or ctx.night) then + trialProgress(player, data, 1) + elseif t.kind == "dex" then + checkDexTrial(player, data) + end + end + if changed or pearls > 0 then + Guild.sendState(player) + end +end + +-- победа над боссом: испытание ранга C и жемчуг +function Guild.onBossWin(player, data) + data.pearls += Config.Pearls.boss + api.notify(player, ("🦪 +%d жемчуга за босса!"):format(Config.Pearls.boss), Color3.fromRGB(235, 225, 245)) + local nextRank = RANKS[data.rank + 1] + if data.trial and nextRank and data.trial.rank == data.rank + 1 and nextRank.trial.kind == "bossWin" then + trialProgress(player, data, 1) + end +end + +---------------------------------------------------------------- миры, скидки + +function Guild.canEnter(data, worldId) + local need = Config.Guild.worldRank[worldId] + if need and (data.rank or 1) < need then + return false, ("🔒 Нужен ранг гильдии %s"):format(RANKS[need].id) + end + return true +end + +function Guild.price(data, price) + local d = Guild.rank(data).discount or 0 + return math.floor(price * (1 - d) + 0.5) +end + +---------------------------------------------------------------- наживка + +function Guild.bait(data) + local id = data.bait.equipped + if id and (data.bait.counts[id] or 0) > 0 then + return Config.Find(Config.Baits, id) + end + return nil +end + +-- тратим 1 штуку на заброс; кончилась — слот пустеет +function Guild.useBait(player, data) + local b = Guild.bait(data) + if not b then + return nil + end + data.bait.counts[b.id] -= 1 + if data.bait.counts[b.id] <= 0 then + data.bait.counts[b.id] = nil + data.bait.equipped = nil + api.notify(player, b.icon .. " " .. b.name .. " закончился", Color3.fromRGB(255, 200, 120)) + end + player:SetAttribute("BaitCount", data.bait.equipped and (data.bait.counts[data.bait.equipped] or 0) or 0) + player:SetAttribute("Bait", data.bait.equipped) + return b +end + +local function buyBait(player, data, id) + local b = Config.Find(Config.Baits, id) + if not b then + return + end + if b.rank and data.rank < b.rank then + api.notify(player, ("🔒 Нужен ранг гильдии %s"):format(RANKS[b.rank].id), RED) + return + end + if b.currency == "pearls" then + if data.pearls < b.price then + api.notify(player, ("Нужно %d 🦪"):format(b.price), RED) + return + end + data.pearls -= b.price + else + local price = Guild.price(data, b.price) + if data.coins < price then + api.notify(player, ("Нужно %d ⚪"):format(price), RED) + return + end + data.coins -= price + end + data.bait.counts[b.id] = (data.bait.counts[b.id] or 0) + b.pack + if not Guild.bait(data) then + data.bait.equipped = b.id + end + api.notify(player, ("%s +%d × %s"):format(b.icon, b.pack, b.name), GREEN) + api.updateStats(player) + Guild.sendState(player) +end + +local function equipBait(player, data, id) + if id == nil or id == "" then + data.bait.equipped = nil + elseif (data.bait.counts[id] or 0) > 0 then + data.bait.equipped = id + else + return + end + api.updateStats(player) + Guild.sendState(player) +end + +---------------------------------------------------------------- ловушки + +local function rollTrapFish(rng) + local T = Config.Traps + local rarity = pick(rng, T.rarities) + local pool = {} + for _, f in ipairs(Config.Zones[T.world].fish) do + if f.rarity == rarity then + table.insert(pool, f) + end + end + local f = pool[rng:NextInteger(1, #pool)] + local wf = rng:NextNumber() ^ 2.2 + return { + id = f.id, name = f.name, rarity = f.rarity, + weight = math.floor((f.minW + (f.maxW - f.minW) * wf) * 100) / 100, + value = math.floor(f.price * (0.75 + 0.9 * wf) + 0.5), + } +end + +local function collectTraps(player, data) + local T = Config.Traps + local now = os.time() + local cap = api.bagCapacity(player, data) + local rng = Random.new() + local got = 0 + for i, t0 in ipairs(data.traps) do + local ready = math.min(T.max, math.floor((now - t0) / T.every)) + local take = math.min(ready, cap - #data.items) + for _ = 1, take do + local f = rollTrapFish(rng) + f.uid = data.nextUid + data.nextUid += 1 + table.insert(data.items, f) + local rec = data.discovered[f.id] + if not rec then + data.discovered[f.id] = { count = 1, best = f.weight } + else + rec.count += 1 + end + end + got += take + -- что не влезло, остаётся в ловушке; полная ловушка дальше не копит + local left = ready - take + data.traps[i] = now - left * T.every + end + if got == 0 then + api.notify(player, #data.traps == 0 and "🧺 Ловушки — с ранга D" or ((#data.items >= cap) and "🎒 Сумка полна!" or "🧺 В ловушках пока пусто"), Color3.fromRGB(255, 200, 120)) + else + data.totalCaught += got + api.notify(player, ("🧺 Из ловушек: +%d рыб"):format(got), GREEN) + api.sendInventory(player) + end + api.updateStats(player) + Guild.sendState(player) +end + +---------------------------------------------------------------- отдых + +function Guild.onJoin(player, data) + local last = data.lastOnline + if last and last > 0 then + local away = os.time() - last + data.rest = math.min(Config.Rest.max, (data.rest or 0) + away / Config.Rest.perOffline) + end + -- ловушки по рангу (старые сохранения, ранг выдан миграцией) + while #data.traps < (Guild.rank(data).traps or 0) do + table.insert(data.traps, os.time()) + end +end + +function Guild.onLeave(data) + data.lastOnline = os.time() +end + +-- множитель опыта: двойной, пока есть отдых +function Guild.xpMult(data) + return (data.rest or 0) > 0 and Config.Rest.mult or 1 +end + +-- отдых тратится секундами, пока игрок рыбачит +function Guild.spendRest(player, data, seconds) + if (data.rest or 0) > 0 then + data.rest = math.max(0, data.rest - seconds) + player:SetAttribute("RestLeft", math.floor(data.rest)) + end +end + +---------------------------------------------------------------- события от клиента + +function Guild.onAction(player, action, a, b) + local data = api.profiles[player] + if not data then + return false + end + if action == "GuildState" then + Guild.sendState(player) + elseif action == "TakeTrial" then + takeTrial(player, data) + elseif action == "DeliverOrder" then + deliverOrder(player, data, tonumber(a)) + elseif action == "RerollOrder" then + rerollOrder(player, data, tonumber(a)) + elseif action == "BuyBait" then + buyBait(player, data, a) + elseif action == "EquipBait" then + equipBait(player, data, a) + elseif action == "CollectTraps" then + collectTraps(player, data) + else + return false + end + return true +end + +return Guild diff --git a/src/ServerScriptService/MapBuilder.server.lua b/src/ServerScriptService/MapBuilder.server.lua index fcf9e41..5c9f643 100644 --- a/src/ServerScriptService/MapBuilder.server.lua +++ b/src/ServerScriptService/MapBuilder.server.lua @@ -1,87 +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 }) - ----------------------------------------------------------------- вода - -local terrain = Workspace.Terrain --- низкое отражение, иначе вода «засвечивается» небом и выглядит белой -terrain.WaterColor = Color3.fromRGB(20, 95, 115) -terrain.WaterTransparency = 0.2 -terrain.WaterReflectance = 0.08 -terrain.WaterWaveSize = 0.1 -terrain.WaterWaveSpeed = 8 - ----------------------------------------------------------------- МИР 1: террейн (строится всегда) - -local W = V(0, 0, 1500) -- центр Мира 1 -local GROUND_Y = 4 -- верх земли -local WATER_Y = 0 -- поверхность воды - --- озеро из нескольких кругов: { x, z, радиус } -local LAKES = Config.Worlds[1].lakes - -terrain:FillBlock(CFrame.new(W + V(0, -10, 0)), V(500, 28, 500), Enum.Material.Grass) --- холмы по краям -for _, h in ipairs({ { -190, 160, 50 }, { 185, 175, 45 }, { -175, -175, 60 }, { 190, -150, 55 }, { 0, -215, 50 }, { -215, 0, 40 }, { 215, 30, 42 } }) do - terrain:FillBall(W + V(h[1], -14, h[2]), h[3], Enum.Material.Grass) -end --- порядок важен: песок → выемка → ил → вода -for _, l in ipairs(LAKES) do - terrain:FillCylinder(CFrame.new(W + V(l[1], -10, l[2])), 28, l[3] + 11, Enum.Material.Sand) -end -for _, l in ipairs(LAKES) do - terrain:FillCylinder(CFrame.new(W + V(l[1], 11, l[2])), 18, l[3] + 7, Enum.Material.Air) -end -for _, l in ipairs(LAKES) do - terrain:FillCylinder(CFrame.new(W + V(l[1], 10, l[2])), 20, l[3] + 2, Enum.Material.Air) -end -for _, l in ipairs(LAKES) do - terrain:FillCylinder(CFrame.new(W + V(l[1], -18, l[2])), 12, l[3], Enum.Material.Mud) -end -for _, l in ipairs(LAKES) do - terrain:FillCylinder(CFrame.new(W + V(l[1], -6, l[2])), 12, l[3], Enum.Material.Water) -end --- дорожка от точки прибытия к причалу и площадка -terrain:FillBlock(CFrame.new(W + V(0, 2, 100)), V(8, 4, 44), Enum.Material.Ground) -terrain:FillCylinder(CFrame.new(W + V(0, 2, 130)), 4, 17, Enum.Material.Cobblestone) +WorldBuilder.applyLighting() ---------------------------------------------------------------- точка появления в лобби @@ -91,8 +18,8 @@ if not spawn then spawn.Parent = Workspace end spawn.Anchored = true -spawn.Size = V(8, 0.2, 8) -spawn.CFrame = CFrame.new(0, 1.15, 50) +spawn.Size = Vector3.new(8, 0.2, 8) +spawn.CFrame = CFrame.new(0, 1.15, 57) spawn.Transparency = 1 spawn.Duration = 0 for _, d in ipairs(spawn:GetChildren()) do @@ -101,1305 +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, 50)) - --- фонтан со статуей золотой рыбы -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 i = 0, 5 do - local a = math.rad(i * 60 + 30) - bench(CFrame.lookAt(V(math.cos(a) * 17, FLOOR, math.sin(a) * 17), V(math.cos(a) * 30, FLOOR, math.sin(a) * 30))) -end - --- фонари по кругу -for i = 0, 7 do - local a = math.rad(i * 45 + 22.5) - lamp(V(math.cos(a) * 40, FLOOR, math.sin(a) * 40)) -end - --- клумбы с деревьями -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, -}) - --- порталы во все миры и арка с названием -local portalCF = CFrame.lookAt(V(0, FLOOR, -66), V(0, FLOOR, 0)) -arch(portalCF, 84, 24, "🎣 " .. string.upper(Config.GameName) .. " 🎣", Color3.fromRGB(255, 190, 60)) -for i, w in ipairs(Config.Worlds) do - local title = w.icon .. " " .. w.name .. (w.level > 1 and (" (ур. " .. w.level .. ")") or "") - portal(portalCF * CFrame.new(-27 + (i - 1) * 18, 0, 0), title, w.color, w.id, w.soon) -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(-14, FLOOR, 34) - local cf = CFrame.lookAt(pos, V(0, FLOOR, 50)) - 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) }) - 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: ТИХОЕ ОЗЕРО (детали) - -local function inLake(x, z, extra) - for _, l in ipairs(LAKES) do - if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + (extra or 0) then - return true - end - end - return false -end - --- прибытие -local arrive = W + V(0, GROUND_Y, 128) -marker("World1Spawn", CFrame.lookAt(arrive + V(0, 1, 0), arrive + V(0, 1, -10))) -arch(CFrame.new(W + V(0, GROUND_Y, 112)), 14, 11, "🌊 ТИХОЕ ОЗЕРО", Color3.fromRGB(80, 200, 255)) -portal(CFrame.lookAt(W + V(-26, GROUND_Y, 140), arrive), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") -stall(CFrame.lookAt(W + V(30, GROUND_Y, 140), arrive), { - title = "💰 СКУПКА", - titleColor = Color3.fromRGB(150, 255, 160), - wall = Color3.fromRGB(150, 115, 80), - 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(200, 150, 110), shirt = Color3.fromRGB(70, 130, 80), pants = Color3.fromRGB(60, 50, 40), hat = Color3.fromRGB(200, 170, 110) }, -}) - --- доска «Кто водится в озере» -do - local pos = W + V(-16, GROUND_Y, 104) - local cf = CFrame.lookAt(pos, W + V(0, GROUND_Y, 120)) - 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 = { "🐟 КТО ВОДИТСЯ В ОЗЕРЕ" } - 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 - --- костёр с брёвнами -do - local c = W + V(14, GROUND_Y, 118) - 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 fireBase = 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 = fireBase - local light = Instance.new("PointLight") - light.Color = Color3.fromRGB(255, 160, 80) - light.Range = 20 - light.Brightness = 2 - light.Parent = fireBase - for _, a in ipairs({ 0, 2.1, 4.2 }) do - local p = c + V(math.cos(a) * 6, 0.6, math.sin(a) * 6) - P({ Shape = Enum.PartType.Cylinder, Size = V(5, 1.4, 1.4), CFrame = CFrame.lookAt(p, c) * CFrame.Angles(0, math.rad(90), 0) * CFrame.Angles(0, math.rad(90), 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(115, 80, 50) }) - end -end - --- дед-рыбак с подсказками -npc("Дед Петрович", CFrame.lookAt(W + V(-7, GROUND_Y + 3, 80), W + V(0, GROUND_Y + 3, 95)), { - 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", "Поговорить") - --- домик рыбака -do - local cf = CFrame.lookAt(W + V(-34, GROUND_Y, 100), W + V(0, GROUND_Y, 100)) - local logC = Color3.fromRGB(130, 90, 55) - P({ Size = V(14, 1, 12), CFrame = cf * CFrame.new(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(110, 80, 50) }) - P({ Size = V(14, 8, 1), CFrame = cf * CFrame.new(0, 5, 5.5), Material = Enum.Material.Wood, Color = logC }) - for _, s in ipairs({ -1, 1 }) do - P({ Size = V(1, 8, 12), CFrame = cf * CFrame.new(s * 6.5, 5, 0), Material = Enum.Material.Wood, Color = logC }) - P({ Size = V(5, 8, 1), CFrame = cf * CFrame.new(s * 4.5, 5, -5.5), Material = Enum.Material.Wood, Color = logC }) - P({ Size = V(16, 1, 8.8), CFrame = cf * CFrame.new(0, 11.2, s * 3.4) * CFrame.Angles(math.rad(-s * 38), 0, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 60, 45) }) - end - P({ Size = V(4, 2, 1), CFrame = cf * CFrame.new(0, 8, -5.5), Material = Enum.Material.Wood, Color = logC }) - P({ Size = V(2.2, 2, 0.3), CFrame = cf * CFrame.new(-4.5, 5.5, -6.05), Material = Enum.Material.Glass, Color = Color3.fromRGB(255, 225, 150), Transparency = 0.2 }) - P({ Size = V(14, 3, 1), CFrame = cf * CFrame.new(0, 10.5, 5.5), Material = Enum.Material.Wood, Color = logC }) -end - --- причалы -local function pier(center, size) - 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 -end -pier(W + V(0, GROUND_Y + 0.2, 58), V(8, 0.6, 42)) -pier(W + V(-86, GROUND_Y + 0.2, 15), V(34, 0.6, 7)) -pier(W + V(86, GROUND_Y + 0.2, -10), V(34, 0.6, 7)) -lamp(W + V(-3.5, GROUND_Y + 0.5, 40), Color3.fromRGB(255, 220, 160)) -lamp(W + V(-70, GROUND_Y + 0.5, 18), Color3.fromRGB(255, 220, 160)) -lamp(W + V(70, GROUND_Y + 0.5, -13), Color3.fromRGB(255, 220, 160)) - --- лодка у западного причала -do - local cf = CFrame.new(W + V(-74, WATER_Y + 0.3, 24)) * CFrame.Angles(0, math.rad(15), 0) - local hull = Color3.fromRGB(170, 70, 50) - P({ Size = V(4, 0.5, 9), CFrame = cf, Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 100, 65) }) - for _, s in ipairs({ -1, 1 }) do - P({ Size = V(0.4, 1.4, 9), CFrame = cf * CFrame.new(s * 2, 0.7, 0), Material = Enum.Material.Wood, Color = hull }) - P({ Size = V(4.4, 1.4, 0.4), CFrame = cf * CFrame.new(0, 0.7, s * 4.5), Material = Enum.Material.Wood, Color = hull }) - end - P({ Size = V(4, 0.3, 1.2), CFrame = cf * CFrame.new(0, 1, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 100, 65) }) -end - --- кувшинки и камыши -for _, l in ipairs(LAKES) do - for _ = 1, 7 do - local a, d = rng:NextNumber(0, math.pi * 2), rng:NextNumber(6, l[3] - 5) - local x, z = l[1] + math.cos(a) * d, l[2] + math.sin(a) * d - local size = rng:NextNumber(2, 3.5) - P({ Shape = Enum.PartType.Cylinder, Size = V(0.15, size, size), CFrame = CFrame.new(W + V(x, WATER_Y + 0.28, z)) * CFrame.Angles(0, 0, math.rad(90)), Color = Color3.fromRGB(70, 150, 60), CanCollide = false }) - if rng:NextNumber() < 0.4 then - ball(W + V(x + 0.3, WATER_Y + 0.55, z), 0.7, { Color = Color3.fromRGB(255, 150, 190), CanCollide = false }) - end - end - for _ = 1, 9 do - local a = rng:NextNumber(0, math.pi * 2) - local x, z = l[1] + math.cos(a) * (l[3] + 1.2), l[2] + math.sin(a) * (l[3] + 1.2) - local inOther = false - for _, o in ipairs(LAKES) do - if o ~= l and (V(x, 0, z) - V(o[1], 0, o[2])).Magnitude < o[3] + 1 then - inOther = true - end - end - if not inOther and not (math.abs(x) < 6 and z > 30) then - for _ = 1, 5 do - local h = rng:NextNumber(3, 5) - local p = W + V(x + rng:NextNumber(-1.2, 1.2), WATER_Y + h / 2 - 0.5, z + rng:NextNumber(-1.2, 1.2)) - P({ Size = V(0.18, h, 0.18), Position = p, Color = Color3.fromRGB(85, 130, 50), CanCollide = false }) - P({ Size = V(0.35, 0.9, 0.35), Position = p + V(0, h / 2 - 0.3, 0), Color = Color3.fromRGB(110, 70, 40), CanCollide = false }) - end - end - end -end - --- деревья, кусты, камни -local function freeSpot(x, z) - if inLake(x, z, 14) then - return false - end - if (V(x, 0, z) - V(0, 0, 128)).Magnitude < 34 then - return false - end - if math.abs(x) < 9 and z > 70 and z < 125 then - return false - end - if (V(x, 0, z) - V(-34, 0, 100)).Magnitude < 14 then - return false - end - return true -end - -local placed = 0 -for _ = 1, 400 do - if placed >= 110 then - break - end - local x, z = rng:NextNumber(-230, 230), rng:NextNumber(-230, 230) - if freeSpot(x, z) then - local y = groundY(W.X + x, W.Z + z) - local roll = rng:NextNumber() - tree(W + V(x, y - 0.5, z), roll < 0.35 and "pine" or (roll < 0.5 and "birch" or "round")) - placed += 1 - end -end -for _ = 1, 60 do - local x, z = rng:NextNumber(-200, 200), rng:NextNumber(-200, 200) - if freeSpot(x, z) then - bush(W + V(x, groundY(W.X + x, W.Z + z) - 0.6, z)) - end -end -for _, l in ipairs(LAKES) do - for _ = 1, 4 do - local a = rng:NextNumber(0, math.pi * 2) - local x, z = l[1] + math.cos(a) * (l[3] + 8), l[2] + math.sin(a) * (l[3] + 8) - if not inLake(x, z, 3) and not (math.abs(x) < 8 and z > 30) then - local s = rng:NextNumber(2.5, 5) - P({ Size = V(s, s * 0.7, s * 0.9), CFrame = CFrame.new(W + V(x, groundY(W.X + x, W.Z + z), z)) * CFrame.Angles(rng:NextNumber(0, 1), rng:NextNumber(0, 6), rng:NextNumber(0, 1)), Material = Enum.Material.Rock, Color = Color3.fromRGB(125, 125, 130) }) - end - end -end - --- фонари вдоль дорожки -for _, z in ipairs({ 84, 100 }) do - lamp(W + V(6, GROUND_Y, z)) - lamp(W + V(-6, GROUND_Y, z)) -end - --- невидимые стены по краю мира -for _, w in ipairs({ - { V(0, 0, 245), V(500, 120, 2) }, - { V(0, 0, -245), V(500, 120, 2) }, - { V(245, 0, 0), V(2, 120, 500) }, - { V(-245, 0, 0), V(2, 120, 500) }, -}) do - P({ Size = w[2], Position = W + w[1] + V(0, 40, 0), Transparency = 1 }) -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] - if not terrainHasWater(w1.center + V(0, -4, 0)) then - warn("[MapBuilder] Вода в террейне Мира 1 не создалась — ставлю запасную поверхность воды") - waterPlane(w1.center + V(0, w1.waterY, 0), 490, Color3.fromRGB(30, 120, 150)) - 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/WeatherServer.server.lua b/src/ServerScriptService/WeatherServer.server.lua new file mode 100644 index 0000000..c6f2712 --- /dev/null +++ b/src/ServerScriptService/WeatherServer.server.lua @@ -0,0 +1,46 @@ +-- WeatherServer (Script) -> ServerScriptService +-- Общие для всего сервера время суток и погода. Ничего не рисует — только выставляет атрибуты workspace: +-- DayStart — серверное время начала суток (часы считает Config.ClockAt) +-- Weather — id погоды из Config.Weathers +-- WeatherEnds — когда сменится (workspace:GetServerTimeNow()) +-- Небо, дождь, звуки и свет делает клиент (Ambience), бонусы к рыбалке учитывает GameServer. + +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) + +local rng = Random.new() + +if Config.DayNight.enabled then + workspace:SetAttribute("DayStart", workspace:GetServerTimeNow()) +end + +local function pickWeather(previous) + local total = 0 + for _, w in ipairs(Config.Weathers) do + if w.id ~= previous then + total += w.weight + end + end + local roll = rng:NextNumber() * total + for _, w in ipairs(Config.Weathers) do + if w.id ~= previous then + roll -= w.weight + if roll <= 0 then + return w + end + end + end + return Config.Weathers[1] +end + +task.spawn(function() + -- первая погода всегда ясная: новичок видит мир чистым + local current = Config.Weathers[1] + while true do + local duration = rng:NextInteger(current.duration[1], current.duration[2]) + workspace:SetAttribute("Weather", current.id) + workspace:SetAttribute("WeatherEnds", workspace:GetServerTimeNow() + duration) + task.wait(duration) + current = pickWeather(current.id) + end +end) diff --git a/src/ServerScriptService/World1Builder.lua b/src/ServerScriptService/World1Builder.lua new file mode 100644 index 0000000..0625b98 --- /dev/null +++ b/src/ServerScriptService/World1Builder.lua @@ -0,0 +1,1009 @@ +-- World1Builder (ModuleScript) -> ServerScriptService +-- Генератор локации «Тихое озеро» (Мир 1). Им ОДИН РАЗ собирают уровень прямо в Roblox Studio, +-- в режиме редактирования, а дальше уровень правится руками как обычные детали и модели. +-- Команда для Command Bar (строка внизу Studio): +-- require(game.ServerScriptService.World1Builder:Clone()).bake() +-- bake() стирает старую папку Workspace.World1Map и террейн этого мира и строит всё заново. +-- Обычно уровень собирается вместе со всей картой: WorldBuilder.bake() (см. README). +-- Если папки World1Map в плейсе нет, WorldBuilder строит уровень этим же модулем. +-- +-- Что нужно игре от уровня (не удаляйте и не переименовывайте): +-- маркеры World1Spawn, GuideFishSpot, GuideSell, World1NpcSeller, World1NpcGrandpa — невидимые +-- плитки; их можно двигать, NPC и точка появления встанут туда при запуске; +-- атрибут GuideTarget = "Pier" (модель MainDock) и "Sell" (модель BaitShop) — подсветка в обучении; +-- ProximityPrompt с атрибутом Action = "Sell" на прилавке и портал «В лобби» (Action = "Portal"); +-- деталь World1Bestiary — доска «Кто водится в озере», текст на неё пишет MapBuilder при запуске. +-- Форма воды для заброса берётся из FishConfig (Worlds[1].lakes) — если меняете озеро руками, +-- поправьте там круги, иначе игра будет считать водой старые места. + +local Workspace = game:GetService("Workspace") +local ReplicatedStorage = game:GetService("ReplicatedStorage") + +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) + +local V = Vector3.new +local terrain = Workspace.Terrain +local W1 = Config.Worlds[1] +local W = W1.center -- центр Мира 1 +local GROUND_Y = 4 -- верх земли +local WATER_Y = W1.waterY -- поверхность воды +local LAKES = W1.lakes -- озеро из кругов { x, z, радиус } от W + +-- холмы: { x, z, радиус, высота центра шара } — верх холма = высота центра + радиус +local HILLS = { + { -78, -138, 62, -22 }, -- холм с вышкой + { -175, -55, 58, -34 }, { 175, -165, 62, -30 }, { -175, 160, 52, -32 }, + { 180, 130, 48, -30 }, { 10, -225, 60, -34 }, { -60, 175, 45, -28 }, { 95, 190, 40, -26 }, +} +-- тропинка на холм к вышке (точки от W) +local HILL_PATH = { { -22, -76 }, { -40, -92 }, { -28, -106 }, { -52, -114 }, { -44, -127 }, { -66, -131 } } +-- «трава» — материал Snow: у него нет травинок и почти нет рисунка, получается ровная мультяшная +-- поверхность. В зелёный (а дорожки из Salt — в коричневый) его красит клиент только в этом мире. +local GROUND_MAT, PATH_MAT = Enum.Material.Snow, Enum.Material.Salt + +local Builder = {} + +-- вода ниже WATER_Y и воздух над ней прямо по вокселям (Fill* с Air иногда оставляет песок над водой) +function Builder.carveLake(l) + local region = Region3.new(W + V(l[1] - l[3], WATER_Y - 12, l[2] - l[3]), W + V(l[1] + l[3], WATER_Y + 16, l[2] + l[3])):ExpandToGrid(4) + local mats, occ = terrain:ReadVoxels(region, 4) + local size = mats.Size + local corner = region.CFrame.Position - region.Size / 2 + local center = W + V(l[1], 0, l[2]) + for x = 1, size.X do + for y = 1, size.Y do + for z = 1, size.Z do + local c = corner + V(x - 0.5, y - 0.5, z - 0.5) * 4 + if (V(c.X, 0, c.Z) - center).Magnitude <= l[3] then + local water = c.Y < WATER_Y + mats[x][y][z] = water and Enum.Material.Water or Enum.Material.Air + occ[x][y][z] = water and 1 or 0 + end + end + end + end + terrain:WriteVoxels(region, 4, mats, occ) +end + +-- высота земли с учётом холмов: считаем по формуле (лучи по только что залитому террейну ненадёжны) +local function hillY(x, z) + local y = GROUND_Y + for _, h in ipairs(HILLS) do + local d2 = (x - h[1]) ^ 2 + (z - h[2]) ^ 2 + if d2 < h[3] ^ 2 then + y = math.max(y, h[4] + math.sqrt(h[3] ^ 2 - d2)) + end + end + return y +end + +local function inLake(x, z, extra) + for _, l in ipairs(LAKES) do + if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + (extra or 0) then + return true + end + end + return false +end + +---------------------------------------------------------------- террейн +local function buildTerrain() + terrain:FillBlock(CFrame.new(W + V(0, -10, 0)), V(500, 28, 500), GROUND_MAT) + for _, h in ipairs(HILLS) do + terrain:FillBall(W + V(h[1], h[4], h[2]), h[3], GROUND_MAT) + end + -- порядок важен: узкая песчаная кромка → выемка → ил → вода + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -10, l[2])), 28, l[3] + 3, Enum.Material.Sand) + end + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], 11, l[2])), 18, l[3] + 2, Enum.Material.Air) + end + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], 10, l[2])), 20, l[3] + 1, Enum.Material.Air) + end + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -18, l[2])), 12, l[3], Enum.Material.Mud) + end + for _, l in ipairs(LAKES) do + terrain:FillCylinder(CFrame.new(W + V(l[1], -6, l[2])), 12, l[3], Enum.Material.Water) + end + for _, l in ipairs(LAKES) do + Builder.carveLake(l) + end + -- земляные дорожки: меняем материал травы на материал дорожки, объём не меняется + local function dirtPath(points, width) + for i = 2, #points do + local a, b = points[i - 1], points[i] + local len = math.sqrt((b[1] - a[1]) ^ 2 + (b[2] - a[2]) ^ 2) + for s = 0, len, 2 do + local x, z = a[1] + (b[1] - a[1]) * s / len, a[2] + (b[2] - a[2]) * s / len + local half = V(width / 2, 3, width / 2) + local p = W + V(x, hillY(x, z), z) + terrain:ReplaceMaterial(Region3.new(p - half, p + half):ExpandToGrid(4), 4, GROUND_MAT, PATH_MAT) + end + end + end + dirtPath(HILL_PATH, 4) + dirtPath({ { 0, 84 }, { 0, 64 } }, 6) -- площадка у корня причала + dirtPath({ { 8, -84 }, { 8, -100 } }, 4) -- к домику у мостков +end + +---------------------------------------------------------------- детали +-- parent — куда положить папку World1Map (Workspace при сборке в Studio, FishingMap при запуске игры) +-- makePortal — WorldBuilder.portalModel: ставит модель портала из шаблона (без него строится старое кольцо) +function Builder.build(parent, makePortal) + buildTerrain() + + local rng = Random.new(7) + local map = Instance.new("Folder") + map.Name = "World1Map" + + -------------------------------------------------- помощники + local function P(props) + local p = Instance.new("Part") + if props.Shape then + p.Shape = props.Shape + end + p.Anchored = true + p.TopSurface = Enum.SurfaceType.Smooth + p.BottomSurface = Enum.SurfaceType.Smooth + for k, v in pairs(props) do + if k ~= "Parent" and k ~= "Shape" then + p[k] = v + end + end + p.Parent = props.Parent or map + return p + end + local function vcyl(pos, h, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(h, d, d) + props.CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)) + return P(props) + end + local function ball(pos, d, props) + props.Shape = Enum.PartType.Ball + props.Size = V(d, d, d) + props.Position = pos + return P(props) + end + -- цилиндр между двумя точками (брёвна, балки, перила, вёсла) + local function rod(a, b, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(math.max(0.05, (b - a).Magnitude), d, d) + props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0) + return P(props) + end + local function surfaceText(part, face, text, color) + local sg = Instance.new("SurfaceGui") + sg.Face = face + sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud + sg.PixelsPerStud = 40 + sg.LightInfluence = 0 + sg.Parent = part + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = color + t.TextStrokeTransparency = 1 + t.Text = text + t.Parent = sg + end + local function prompt(target, actionText, objectText, action) + local pp = Instance.new("ProximityPrompt") + pp.ActionText = actionText + pp.ObjectText = objectText + pp.HoldDuration = 0 + pp.MaxActivationDistance = 14 + pp.RequiresLineOfSight = false + pp:SetAttribute("Action", action) + pp.Parent = target + return pp + end + local function marker(name, cf) + return P({ Name = name, Size = V(4, 1, 4), CFrame = cf, Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false }) + end + + local COL = { + plank = Color3.fromRGB(196, 140, 88), plankDark = Color3.fromRGB(160, 110, 68), + log = Color3.fromRGB(156, 102, 60), logDark = Color3.fromRGB(105, 70, 44), + rope = Color3.fromRGB(218, 184, 128), roof = Color3.fromRGB(62, 104, 78), stone = Color3.fromRGB(150, 146, 150), + rock = Color3.fromRGB(150, 146, 162), rockDark = Color3.fromRGB(112, 108, 128), moss = Color3.fromRGB(108, 152, 72), + pine = Color3.fromRGB(58, 126, 70), pineDark = Color3.fromRGB(30, 82, 52), + leaf = Color3.fromRGB(110, 170, 64), leafDark = Color3.fromRGB(72, 136, 56), + glow = Color3.fromRGB(255, 200, 120), awnA = Color3.fromRGB(46, 106, 72), awnB = Color3.fromRGB(242, 232, 204), + banner = Color3.fromRGB(40, 92, 62), metal = Color3.fromRGB(48, 44, 42), water = Color3.fromRGB(70, 200, 195), + } + local WOOD, PLANKS, SMOOTH = Enum.Material.Wood, Enum.Material.WoodPlanks, Enum.Material.SmoothPlastic + -- куб, повёрнутый вершиной вверх: три грани сходятся в острый пик (ёлки, горы, обломки скал) + local CUBE_UP = CFrame.Angles(math.rad(-35.264), 0, 0) * CFrame.Angles(0, 0, math.rad(45)) + + -- столб с кронштейном и висящим фонарём; facing — куда смотрит кронштейн + local function postLantern(base, facing, h) + h = h or 8 + local top = base + V(0, h, 0) + vcyl(base + V(0, h / 2, 0), h, 0.8, { Color = COL.logDark, Material = WOOD }) + rod(top - V(0, 0.3, 0), top + facing * 2.4 - V(0, 0.3, 0), 0.35, { Color = COL.logDark, Material = WOOD }) + local hang = top + facing * 2 - V(0, 1.8, 0) + rod(hang + V(0, 0.9, 0), top + facing * 2 - V(0, 0.3, 0), 0.08, { Color = COL.metal, Material = Enum.Material.Metal, CanCollide = false }) + P({ Size = V(1.2, 0.3, 1.2), Position = hang + V(0, 0.85, 0), Color = COL.metal, Material = Enum.Material.Metal, CanCollide = false }) + local glass = P({ Size = V(0.9, 1.3, 0.9), Position = hang, Color = COL.glow, Material = Enum.Material.Neon, CanCollide = false, CastShadow = false }) + P({ Size = V(1.2, 0.3, 1.2), Position = hang - V(0, 0.8, 0), Color = COL.metal, Material = Enum.Material.Metal, CanCollide = false }) + local light = Instance.new("PointLight") + light.Range = 18 + light.Brightness = 1.5 + light.Color = COL.glow + light.Parent = glass + end + + -- low-poly ёлка: ствол и ярусы-«ромбы» (кубы вершиной вверх), к верху меньше + local function pine(pos, h, tiers) + tiers = tiers or 3 + vcyl(pos + V(0, h * 0.15, 0), h * 0.3, math.max(0.8, h * 0.07), { Color = COL.logDark, Material = WOOD, CastShadow = false }) + local shade = rng:NextNumber(0, 0.3) + for i = 0, tiers - 1 do + local t = tiers > 1 and i / (tiers - 1) or 1 + local s = h * (0.42 - 0.22 * t) + P({ + Size = V(s, s, s), + CFrame = CFrame.new(pos + V(0, h * (0.34 + 0.48 * t), 0)) * CFrame.Angles(0, rng:NextNumber(0, 6.28), 0) * CUBE_UP, + Color = COL.pineDark:Lerp(COL.pine, 0.2 + 0.5 * t + shade), Material = SMOOTH, CanCollide = false, + }) + end + end + + -- круглое лиственное дерево + local function leafy(pos, s) + vcyl(pos + V(0, s * 0.4, 0), s * 0.8, s * 0.14, { Color = COL.log, Material = WOOD }) + local c = COL.leafDark:Lerp(COL.leaf, rng:NextNumber(0.3, 1)) + ball(pos + V(0, s * 1.05, 0), s * 0.95, { Color = c, Material = SMOOTH, CanCollide = false }) + ball(pos + V(s * 0.38, s * 0.85, s * 0.1), s * 0.65, { Color = c:Lerp(COL.leaf, 0.3), Material = SMOOTH, CanCollide = false }) + ball(pos + V(-s * 0.35, s * 0.9, -s * 0.2), s * 0.6, { Color = c:Lerp(COL.leafDark, 0.3), Material = SMOOTH, CanCollide = false }) + end + + -- угловатый low-poly камень + local function rock(pos, s, col) + return P({ + Size = V(s, s * rng:NextNumber(0.55, 0.85), s * rng:NextNumber(0.7, 1)), + CFrame = CFrame.new(pos) * CFrame.Angles(rng:NextNumber(-0.4, 0.4), rng:NextNumber(0, 6.28), rng:NextNumber(-0.4, 0.4)), + Color = (col or COL.rock):Lerp(COL.rockDark, rng:NextNumber(0, 0.6)), Material = SMOOTH, + }) + end + -- острый обломок скалы (куб вершиной вверх), наполовину утоплен + local function crag(pos, s) + return P({ + Size = V(s, s, s), + CFrame = CFrame.new(pos) * CFrame.Angles(rng:NextNumber(-0.2, 0.2), rng:NextNumber(0, 6.28), rng:NextNumber(-0.2, 0.2)) * CUBE_UP, + Color = COL.rock:Lerp(COL.rockDark, rng:NextNumber(0, 0.6)), Material = SMOOTH, + }) + end + + -- рогоз: несколько стеблей с коричневыми «початками» и листья + local function cattails(pos) + for _ = 1, rng:NextInteger(3, 6) do + local p = pos + V(rng:NextNumber(-1.3, 1.3), 0, rng:NextNumber(-1.3, 1.3)) + local top = p + V(rng:NextNumber(-0.4, 0.4), rng:NextNumber(3.5, 6), rng:NextNumber(-0.4, 0.4)) + rod(p, top, 0.16, { Color = Color3.fromRGB(96, 140, 62), Material = SMOOTH, CanCollide = false, CastShadow = false }) + local dir = (top - p).Unit + rod(top - dir * 2, top - dir * 0.6, 0.5, { Color = Color3.fromRGB(122, 74, 40), Material = SMOOTH, CanCollide = false, CastShadow = false }) + end + for _ = 1, 3 do + P({ + Size = V(0.35, rng:NextNumber(3, 4.5), 0.08), + CFrame = CFrame.new(pos + V(0, 1.6, 0)) * CFrame.Angles(0, rng:NextNumber(0, 6.28), rng:NextNumber(-0.35, 0.35)), + Color = Color3.fromRGB(110, 160, 70), Material = SMOOTH, CanCollide = false, CastShadow = false, + }) + end + end + + -- круглая свая с намотанным канатом; y0 — низ (под водой), top — верх сваи + local function ropePost(x, z, y0, top, d, parent) + d = d or 1.6 + vcyl(W + V(x, (y0 + top) / 2, z), top - y0, d, { Color = COL.log, Material = WOOD, Parent = parent }) + vcyl(W + V(x, top + 0.1, z), 0.2, d * 0.9, { Color = COL.plankDark, Material = WOOD, Parent = parent }) + for i = 1, 3 do + vcyl(W + V(x, top - 0.5 - i * 0.38, z), 0.3, d + 0.25, { Color = COL.rope, Material = Enum.Material.Fabric, CanCollide = false, Parent = parent }) + end + end + + -- маленькие мостки: доски поперёк и сваи + local function smallDock(x, z0, z1, w, y) + local dir = z1 > z0 and 1 or -1 + for z = z0, z1, dir * 1.6 do + P({ Size = V(w, 0.45, 1.45), Position = W + V(x, y - 0.22, z), Color = COL.plank:Lerp(COL.plankDark, rng:NextNumber(0, 0.6)), Material = PLANKS }) + end + for z = z0 + dir * 2, z1, dir * 6 do + for _, s in ipairs({ -1, 1 }) do + vcyl(W + V(x + s * (w / 2 - 0.3), y - 4, z), 8, 0.8, { Color = COL.logDark, Material = WOOD }) + end + end + end + + -- бревенчатый дом: стены из брёвен, двускатная зелёная крыша, тёплые окна, труба с дымом, крыльцо. + -- cf — центр пола на земле, сторона -Z (LookVector) — фасад с дверью + local function logCabin(name, cf, w, d, wallH) + local house = Instance.new("Model") + house.Name = name + house.Parent = map + local function part(props) + props.Parent = house + return P(props) + end + local LOG = 1.25 + local rows = math.floor(wallH / LOG) + local wallTop = 1 + rows * LOG + local function at(x, y, z) + return (cf * CFrame.new(x, y, z)).Position + end + part({ Size = V(w + 1.5, 1, d + 1.5), CFrame = cf * CFrame.new(0, 0.5, 0), Color = COL.stone, Material = Enum.Material.Slate }) + for r = 0, rows - 1 do + local y = 1 + LOG / 2 + r * LOG + local col = (r % 2 == 0) and COL.log or COL.log:Lerp(COL.logDark, 0.3) + for _, s in ipairs({ -1, 1 }) do + rod(at(-w / 2 - 0.9, y, s * d / 2), at(w / 2 + 0.9, y, s * d / 2), LOG, { Color = col, Material = WOOD, Parent = house }) + rod(at(s * w / 2, y, -d / 2 - 0.9), at(s * w / 2, y, d / 2 + 0.9), LOG, { Color = col, Material = WOOD, Parent = house }) + end + end + -- фронтоны (по бокам) — брёвна всё короче к коньку + local a = math.rad(34) + local rise = (d / 2) * math.tan(a) + for k = 0, math.floor(rise / LOG) - 1 do + local y = wallTop + LOG / 2 + k * LOG + local half = (d / 2) * (1 - (k + 1) * LOG / rise) + if half > 0.6 then + for _, s in ipairs({ -1, 1 }) do + rod(at(s * w / 2, y, -half), at(s * w / 2, y, half), LOG, { Color = COL.log:Lerp(COL.logDark, 0.15), Material = WOOD, Parent = house }) + end + end + end + -- крыша: два ската, конёк вдоль X + local run = d / 2 + 1.6 + for _, s in ipairs({ -1, 1 }) do + part({ Size = V(w + 3, 0.7, run / math.cos(a)), CFrame = cf * CFrame.new(0, wallTop + run * math.tan(a) / 2 + 0.35, s * run / 2) * CFrame.Angles(s * a, 0, 0), Color = COL.roof, Material = SMOOTH }) + end + part({ Size = V(w + 3.2, 0.6, 0.9), CFrame = cf * CFrame.new(0, wallTop + run * math.tan(a) + 0.2, 0), Color = COL.roof:Lerp(Color3.new(0, 0, 0), 0.25), Material = SMOOTH }) + -- дверь и окна с тёплым светом + part({ Size = V(3, 5.2, 0.5), CFrame = cf * CFrame.new(0, 3.6, -d / 2 - 0.7), Color = COL.logDark, Material = PLANKS }) + for i, wdw in ipairs({ { -w / 4, -d / 2 - 0.65, 0 }, { w / 4, -d / 2 - 0.65, 0 }, { -w / 2 - 0.65, 0, 90 }, { w / 2 + 0.65, 0, 90 } }) do + local wcf = cf * CFrame.new(wdw[1], 4.6, wdw[2]) * CFrame.Angles(0, math.rad(wdw[3]), 0) + part({ Size = V(3, 2.6, 0.4), CFrame = wcf, Color = COL.logDark, Material = WOOD }) + local g = part({ Size = V(2.4, 2, 0.45), CFrame = wcf, Color = COL.glow, Material = Enum.Material.Neon, CastShadow = false }) + part({ Size = V(0.2, 2, 0.5), CFrame = wcf, Color = COL.logDark, Material = WOOD }) + if i == 1 then + local l = Instance.new("PointLight") + l.Range = 14 + l.Brightness = 1 + l.Color = COL.glow + l.Parent = g + end + end + -- крыльцо + part({ Size = V(w * 0.55, 0.6, 4), CFrame = cf * CFrame.new(0, 1.1, -d / 2 - 2.8), Color = COL.plank, Material = PLANKS }) + for _, s in ipairs({ -1, 1 }) do + vcyl(at(s * w * 0.25, 4.2, -d / 2 - 4.4), 6.2, 0.6, { Color = COL.log, Material = WOOD, Parent = house }) + end + part({ Size = V(w * 0.62, 0.5, 4.8), CFrame = cf * CFrame.new(0, 7.3, -d / 2 - 2.6) * CFrame.Angles(-math.rad(14), 0, 0), Color = COL.roof, Material = SMOOTH }) + -- труба с дымом + local ch = at(w / 2 - 2.2, 0, d / 4) + local chTop = wallTop + rise + 3 + part({ Size = V(2.2, chTop, 2.2), Position = ch + V(0, chTop / 2, 0), Color = Color3.fromRGB(150, 110, 95), Material = Enum.Material.Brick }) + local smokeAt = part({ Size = V(1, 1, 1), Position = ch + V(0, chTop + 0.5, 0), Transparency = 1, CanCollide = false, CanQuery = false }) + local smoke = Instance.new("ParticleEmitter") + smoke.Texture = "rbxasset://textures/particles/smoke_main.dds" + smoke.Color = ColorSequence.new(Color3.fromRGB(235, 235, 235)) + smoke.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1.5), NumberSequenceKeypoint.new(1, 6) }) + smoke.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.4), NumberSequenceKeypoint.new(1, 1) }) + smoke.Lifetime = NumberRange.new(4, 6) + smoke.Rate = 4 + smoke.Speed = NumberRange.new(2, 3) + smoke.SpreadAngle = Vector2.new(10, 10) + smoke.Acceleration = V(1, 0.4, 0) + smoke.Parent = smokeAt + end + + -------------------------------------------------- прибытие, причал, лавка + local DOCK = { z0 = 64, z1 = 36, w = 12 } -- от берега (z0) в воду (z1), по оси X = 0 + local DECK_Y = GROUND_Y + 0.6 -- верх настила + local spawnAt = W + V(0, DECK_Y, 60) + marker("World1Spawn", CFrame.lookAt(spawnAt + V(0, 1, 0), spawnAt + V(0, 1, -10))) + marker("GuideFishSpot", CFrame.new(W + V(0, DECK_Y + 0.5, DOCK.z1 + 3))) + + -- главный причал: доски поперёк, толстые сваи с канатом по краям, ящик для снастей + do + local dock = Instance.new("Model") + dock.Name = "MainDock" + dock:SetAttribute("GuideTarget", "Pier") -- подсвечивается на шаге обучения + dock.Parent = map + for z = DOCK.z1 + 0.8, DOCK.z0 - 0.8, 1.6 do + P({ + Size = V(DOCK.w + rng:NextNumber(-0.3, 0.3), 0.5, 1.48), Position = W + V(0, DECK_Y - 0.25, z), + Color = COL.plank:Lerp(COL.plankDark, rng:NextNumber(0, 0.7)), Material = PLANKS, Parent = dock, + }) + end + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.8, 0.8, DOCK.z0 - DOCK.z1), Position = W + V(s * (DOCK.w / 2 - 1), DECK_Y - 0.9, (DOCK.z0 + DOCK.z1) / 2), Color = COL.logDark, Material = WOOD, Parent = dock }) + for z = DOCK.z1 + 1, DOCK.z0 - 2, 8 do + ropePost(s * (DOCK.w / 2 - 0.2), z, -6, DECK_Y + 2.4, 1.7, dock) + end + end + local tb = W + V(-3.4, DECK_Y, 46) + P({ Size = V(2.6, 1.3, 1.5), Position = tb + V(0, 0.65, 0), Color = Color3.fromRGB(120, 142, 124), Material = SMOOTH, Parent = dock }) + P({ Size = V(2.7, 0.35, 1.6), Position = tb + V(0, 1.45, 0), Color = Color3.fromRGB(96, 116, 100), Material = SMOOTH, Parent = dock }) + rod(tb + V(-0.7, 1.65, 0), tb + V(0.7, 1.65, 0), 0.18, { Color = COL.metal, Material = Enum.Material.Metal, Parent = dock }) + P({ Size = V(0.35, 0.35, 0.1), Position = tb + V(0, 1.2, -0.8), Color = Color3.fromRGB(230, 190, 70), Material = Enum.Material.Metal, Parent = dock }) + P({ Size = V(2, 2, 2), CFrame = CFrame.new(W + V(-4.2, DECK_Y + 1, 49.5)) * CFrame.Angles(0, 0.25, 0), Color = COL.plankDark, Material = PLANKS, Parent = dock }) + end + + -- лавка рыбака (скупка) слева от корня причала, прилавком к причалу: тент, вывеска, поплавки, + -- воблеры, бочки и ящики, фонарь на столбе. Продавца ставит MapBuilder на маркер World1NpcSeller. + do + local cf = CFrame.lookAt(W + V(-15, GROUND_Y, 60), W + V(0, GROUND_Y, 57)) + local shop = Instance.new("Model") + shop.Name = "BaitShop" + shop:SetAttribute("GuideTarget", "Sell") -- подсвечивается на шаге обучения + shop.Parent = map + local function at(x, y, z) + return cf * CFrame.new(x, y, z) + end + local function part(props) + props.Parent = shop + return P(props) + end + part({ Size = V(14, 0.8, 10), CFrame = at(0, 0.4, 0), Color = COL.plankDark, Material = PLANKS }) + part({ Size = V(14, 9, 0.8), CFrame = at(0, 5, 4.6), Color = COL.plank, Material = PLANKS }) + for _, s in ipairs({ -1, 1 }) do + part({ Size = V(0.8, 9, 10), CFrame = at(s * 6.6, 5, 0), Color = COL.plank, Material = PLANKS }) + part({ Size = V(1.2, 10.4, 1.2), CFrame = at(s * 6.6, 5.2, -4.8), Color = COL.logDark, Material = WOOD }) + end + part({ Size = V(15.5, 0.7, 11), CFrame = at(0, 10.4, 0), Color = COL.logDark, Material = PLANKS }) + local counter = part({ Name = "Counter", Size = V(12, 3.4, 2.4), CFrame = at(0, 2.5, -3.6), Color = COL.plank, Material = PLANKS }) + part({ Size = V(13, 0.4, 3), CFrame = at(0, 4.4, -3.6), Color = COL.logDark, Material = WOOD }) + prompt(counter, "Продать всю рыбу", "Скупка", "Sell") + -- полосатый тент и фестончики + local n = 8 + for i = 0, n - 1 do + local c = (i % 2 == 0) and COL.awnA or COL.awnB + local x = -7.5 + (i + 0.5) * 15 / n + part({ Size = V(15 / n + 0.02, 0.25, 5), CFrame = at(x, 9.7, -6.9) * CFrame.Angles(math.rad(-24), 0, 0), Color = c, Material = Enum.Material.Fabric }) + part({ Shape = Enum.PartType.Cylinder, Size = V(0.25, 15 / n, 15 / n), CFrame = at(x, 8.7, -9.25) * CFrame.Angles(0, math.rad(90), 0), Color = c, Material = Enum.Material.Fabric, CanCollide = false }) + end + -- вывеска над тентом + local sign = part({ Size = V(8, 3, 0.5), CFrame = at(0, 12.6, -4.9), Color = COL.plank, Material = PLANKS }) + part({ Size = V(8.6, 3.6, 0.3), CFrame = at(0, 12.6, -4.6), Color = COL.logDark, Material = WOOD }) + surfaceText(sign, Enum.NormalId.Front, "🐟 СКУПКА", Color3.fromRGB(60, 40, 25)) + -- воблеры на задней стене + for i, c in ipairs({ Color3.fromRGB(90, 200, 80), Color3.fromRGB(245, 210, 60), Color3.fromRGB(245, 140, 50), Color3.fromRGB(70, 150, 230), Color3.fromRGB(230, 70, 70) }) do + local x = -4.4 + (i - 1) * 2.2 + part({ Size = V(0.08, 1.4, 0.08), CFrame = at(x, 8.4, 4.05), Color = COL.metal, CanCollide = false }) + part({ Size = V(0.55, 1.6, 0.5), CFrame = at(x, 7, 4.0), Color = c, Material = SMOOTH, CanCollide = false }) + part({ Size = V(0.3, 0.5, 0.45), CFrame = at(x, 6, 4.0), Color = c:Lerp(Color3.new(1, 1, 1), 0.4), Material = SMOOTH, CanCollide = false }) + end + -- поплавки и ящички на прилавке + for i = 0, 3 do + local p = at(-4.5 + i * 1.3, 5.05, -3.4).Position + ball(p, 0.9, { Color = Color3.fromRGB(225, 50, 45), Material = SMOOTH, Parent = shop, CanCollide = false }) + ball(p + V(0, 0.55, 0), 0.6, { Color = Color3.fromRGB(250, 250, 250), Material = SMOOTH, Parent = shop, CanCollide = false }) + end + part({ Size = V(2.2, 1, 1.4), CFrame = at(2.6, 5.1, -3.5), Color = Color3.fromRGB(120, 140, 125), Material = SMOOTH }) + part({ Size = V(1.6, 0.8, 1.2), CFrame = at(4.8, 5, -3.4), Color = COL.plankDark, Material = PLANKS }) + -- бочки и ящики сбоку + for i, off in ipairs({ { 8.6, -2.6 }, { 9.2, 0.6 } }) do + local p = at(off[1], 1.7, off[2]).Position + vcyl(p, 3.4, 2.8, { Color = COL.log, Material = WOOD, Parent = shop }) + for _, dy in ipairs({ -1, 1 }) do + vcyl(p + V(0, dy, 0), 0.3, 2.95, { Color = COL.metal, Material = Enum.Material.Metal, Parent = shop, CanCollide = false }) + end + if i == 2 then + part({ Size = V(2.2, 2.2, 2.2), CFrame = at(9, 4.5, 0.6) * CFrame.Angles(0, 0.3, 0), Color = COL.plankDark, Material = PLANKS }) + end + end + part({ Size = V(2.6, 2.6, 2.6), CFrame = at(-9, 1.3, -1.5) * CFrame.Angles(0, 0.2, 0), Color = COL.plankDark, Material = PLANKS }) + marker("World1NpcSeller", at(0, 3.9, 1.6)) + marker("GuideSell", cf * CFrame.new(0, 0, -9)) + postLantern(at(-7.8, 0, -6.2).Position, (cf.LookVector * V(1, 0, 1)).Unit, 9) + end + leafy(W + V(-27, GROUND_Y, 70), 13) -- большое дерево над лавкой, как на макете + postLantern(W + V(7.5, GROUND_Y, 66), V(-1, 0, 0), 8) + + -- деревянная лодка с вёслами справа от причала у двух свай + do + local cf = CFrame.new(W + V(12.5, WATER_Y + 0.25, 46)) * CFrame.Angles(0, math.rad(12), 0) + local boat = Instance.new("Model") + boat.Name = "Rowboat" + boat.Parent = map + local hull, inner = Color3.fromRGB(150, 92, 52), Color3.fromRGB(196, 140, 88) + P({ Size = V(3.4, 0.4, 8.4), CFrame = cf, Color = inner, Material = PLANKS, Parent = boat }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.4, 1.7, 8.6), CFrame = cf * CFrame.new(s * 1.95, 0.7, 0.2) * CFrame.Angles(0, 0, math.rad(-s * 14)), Color = hull, Material = WOOD, Parent = boat }) + P({ Size = V(0.4, 1.7, 3), CFrame = cf * CFrame.new(s * 1.05, 0.8, -5) * CFrame.Angles(0, math.rad(s * 38), 0), Color = hull, Material = WOOD, Parent = boat }) + P({ Size = V(0.5, 0.3, 8.6), CFrame = cf * CFrame.new(s * 2.2, 1.6, 0.2), Color = COL.logDark, Material = WOOD, Parent = boat }) + local a = (cf * CFrame.new(s * 1.6, 1.4, 0.2)).Position + local b = (cf * CFrame.new(s * 5.2, -0.1, 1.4)).Position + rod(a, b, 0.22, { Color = COL.plank, Material = WOOD, CanCollide = false, Parent = boat }) + P({ Size = V(0.15, 0.9, 1.9), CFrame = CFrame.lookAt(b, b + (b - a)) * CFrame.Angles(0, math.rad(90), 0), Color = COL.plank, Material = WOOD, CanCollide = false, Parent = boat }) + end + P({ Size = V(4.4, 1.7, 0.4), CFrame = cf * CFrame.new(0, 0.7, 4.5), Color = hull, Material = WOOD, Parent = boat }) + for _, z in ipairs({ -1.6, 1.8 }) do + P({ Size = V(3.8, 0.3, 1.1), CFrame = cf * CFrame.new(0, 1.1, z), Color = inner, Material = PLANKS, Parent = boat }) + end + ropePost(9.8, 52, -6, 3.4, 1.4, boat) + ropePost(16, 40, -6, 2.8, 1.4, boat) + end + + -- за спиной игрока: портал в лобби, место деда-рыбака, доска «Кто водится в озере» + do + local baseCF = CFrame.lookAt(W + V(15, GROUND_Y, 86), W + V(0, GROUND_Y, 62)) + local color = Color3.fromRGB(255, 200, 80) + local portalModel = Instance.new("Model") + portalModel.Name = "PortalToLobby" + portalModel.Parent = map + local center = baseCF * CFrame.new(0, 10, 0) + local fancy = makePortal and makePortal(baseCF, color, "PortalModel_Lobby", portalModel) + local disc + if fancy then + -- модель из шаблона; невидимый якорь держит подсказку, подпись и искры + disc = P({ + Name = "Portal_Lobby", Size = V(1, 1, 1), CFrame = center * CFrame.Angles(0, math.rad(90), 0), + Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false, Parent = portalModel, + }) + else + P({ Size = V(17, 1, 9), CFrame = baseCF * CFrame.new(0, 0.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(95, 100, 115), Parent = portalModel }) + P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130), Parent = portalModel }) + local R, n = 7, 20 + for i = 0, n - 1 do + local a = (i + 0.5) / n * math.pi * 2 + P({ Size = V(2 * math.pi * R / n + 0.4, 1.7, 1.7), CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(80, 85, 100), Parent = portalModel }) + if i % 2 == 0 then + P({ Size = V(0.6, 0.6, 1.9), CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R + 0.95, 0), Material = Enum.Material.Neon, Color = color, Parent = portalModel }) + end + end + disc = P({ + Name = "Portal_Lobby", Shape = Enum.PartType.Cylinder, Size = V(0.3, 2 * R - 1, 2 * R - 1), CFrame = center * CFrame.Angles(0, math.rad(90), 0), + Material = Enum.Material.Neon, Color = color, Transparency = 0.3, CanCollide = false, Parent = portalModel, + }) + end + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + pe.LightEmission = 1 + pe.Rate = 25 + pe.Lifetime = NumberRange.new(1, 1.8) + pe.Speed = NumberRange.new(0.5, 2) + pe.SpreadAngle = Vector2.new(180, 180) + pe.Size = NumberSequence.new(0.5, 0) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Parent = disc + local bb = Instance.new("BillboardGui") + bb.Size = UDim2.fromOffset(250, 64) + bb.StudsOffset = V(0, fancy and 7 or 10, 0) + bb.MaxDistance = 160 + bb.LightInfluence = 0 + bb.Parent = disc + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = color:Lerp(Color3.new(1, 1, 1), 0.4) + t.TextStrokeTransparency = 0.15 + t.Text = "🏠 В лобби" + t.Parent = bb + prompt(disc, "Перейти", "🏠 В лобби", "Portal"):SetAttribute("World", "Lobby") + end + marker("World1NpcGrandpa", CFrame.lookAt(W + V(9, GROUND_Y + 3, 72), W + V(0, GROUND_Y + 3, 62))) + do + local cf = CFrame.lookAt(W + V(-12, GROUND_Y, 80), W + V(0, GROUND_Y, 62)) + for _, x in ipairs({ -5.5, 5.5 }) do + P({ Size = V(0.8, 10, 0.8), CFrame = cf * CFrame.new(x, 5, 0.3), Material = WOOD, Color = COL.logDark }) + end + P({ Name = "World1Bestiary", Size = V(12, 9, 0.5), CFrame = cf * CFrame.new(0, 6.5, 0), Material = PLANKS, Color = Color3.fromRGB(70, 48, 32) }) + end + + -------------------------------------------------- дальний берег: дом, холм с тропинкой и вышкой + logCabin("BigCabin", CFrame.lookAt(W + V(-58, GROUND_Y, -62), W + V(-20, GROUND_Y, 10)), 16, 12, 8) + postLantern(W + V(-44, GROUND_Y, -58), V(1, 0, 0), 8) + + -- столб-вывеска с зелёным знаменем и белой рыбой у начала тропинки + do + local base = W + V(-17, GROUND_Y, -80) + vcyl(base + V(0, 6, 0), 12, 0.9, { Color = COL.logDark, Material = WOOD }) + rod(base + V(0, 11.4, 0), base + V(3.6, 11.4, 0), 0.5, { Color = COL.logDark, Material = WOOD }) + local flag = P({ Size = V(3, 5, 0.2), CFrame = CFrame.lookAt(base + V(2.2, 8.6, 0), base + V(2.2, 8.6, 10)), Color = COL.banner, Material = Enum.Material.Fabric, CanCollide = false }) + surfaceText(flag, Enum.NormalId.Front, "🐟", Color3.new(1, 1, 1)) + surfaceText(flag, Enum.NormalId.Back, "🐟", Color3.new(1, 1, 1)) + end + + -- забор вдоль тропинки и фонари + do + local posts = {} + for i = 2, #HILL_PATH do + local a, b = HILL_PATH[i - 1], HILL_PATH[i] + local dx, dz = b[1] - a[1], b[2] - a[2] + local len = math.sqrt(dx * dx + dz * dz) + local nx, nz = -dz / len, dx / len -- влево от направления + for s = 0, len - 0.1, 4.5 do + local x, z = a[1] + dx * s / len + nx * 3, a[2] + dz * s / len + nz * 3 + table.insert(posts, W + V(x, hillY(x, z), z)) + end + end + for i, p in ipairs(posts) do + vcyl(p + V(0, 1.3, 0), 3, 0.45, { Color = COL.log, Material = WOOD }) + local q = posts[i + 1] + if q and (q - p).Magnitude < 8 then + for _, h in ipairs({ 1.2, 2.3 }) do + rod(p + V(0, h, 0), q + V(0, h, 0), 0.3, { Color = COL.log, Material = WOOD, CanCollide = false }) + end + end + end + for _, i in ipairs({ 2, 4 }) do + local x, z = HILL_PATH[i][1] + 3, HILL_PATH[i][2] + postLantern(W + V(x, hillY(x, z), z), V(-1, 0, 0), 7) + end + end + + -- смотровая вышка на вершине холма с зелёным флагом + do + local tower = Instance.new("Model") + tower.Name = "Watchtower" + tower.Parent = map + local c = W + V(-76, hillY(-76, -136) - 0.5, -136) + local H = 14 + local function wood(props) + props.Parent = tower + return props + end + for _, sx in ipairs({ -1, 1 }) do + for _, sz in ipairs({ -1, 1 }) do + rod(c + V(sx * 4.2, 0, sz * 4.2), c + V(sx * 3.2, H, sz * 3.2), 1.1, wood({ Color = COL.log, Material = WOOD })) + end + end + for _, y in ipairs({ 4.5, 9 }) do + for _, s in ipairs({ -1, 1 }) do + local k = 4.2 - y / H + rod(c + V(-k, y, s * k), c + V(k, y - 3, s * k), 0.4, wood({ Color = COL.logDark, Material = WOOD, CanCollide = false })) + rod(c + V(s * k, y, -k), c + V(s * k, y - 3, k), 0.4, wood({ Color = COL.logDark, Material = WOOD, CanCollide = false })) + end + end + P(wood({ Size = V(9, 0.6, 9), Position = c + V(0, H, 0), Color = COL.plank, Material = PLANKS })) + for _, s in ipairs({ -1, 1 }) do + P(wood({ Size = V(9, 1.4, 0.3), Position = c + V(0, H + 1.2, s * 4.4), Color = COL.log, Material = WOOD })) + P(wood({ Size = V(0.3, 1.4, 9), Position = c + V(s * 4.4, H + 1.2, 0), Color = COL.log, Material = WOOD })) + end + for _, sx in ipairs({ -1, 1 }) do + for _, sz in ipairs({ -1, 1 }) do + vcyl(c + V(sx * 4.2, H + 2.6, sz * 4.2), 5.2, 0.4, wood({ Color = COL.log, Material = WOOD })) + end + end + for _, s in ipairs({ -1, 1 }) do + P(wood({ Size = V(11, 0.5, 6.4), CFrame = CFrame.new(c + V(0, H + 6.2, s * 2.7)) * CFrame.Angles(s * math.rad(30), 0, 0), Color = COL.roof, Material = SMOOTH })) + end + vcyl(c + V(0, H + 10.5, 0), 7, 0.25, wood({ Color = COL.logDark, Material = WOOD })) + local flag = P(wood({ Size = V(4, 2.6, 0.15), CFrame = CFrame.new(c + V(2.1, H + 12.6, 0)), Color = COL.banner, Material = Enum.Material.Fabric, CanCollide = false })) + surfaceText(flag, Enum.NormalId.Front, "🐟", Color3.new(1, 1, 1)) + surfaceText(flag, Enum.NormalId.Back, "🐟", Color3.new(1, 1, 1)) + end + + -------------------------------------------------- северо-восток: домик с мостками, скала, водопад, мост + logCabin("SmallCabin", CFrame.lookAt(W + V(8, GROUND_Y, -96), W + V(4, GROUND_Y, 0)), 11, 9, 7) + smallDock(8, -86, -68, 6, GROUND_Y + 0.4) + postLantern(W + V(10.6, GROUND_Y + 0.4, -70), V(-1, 0, 0), 6) + + local CLIFF_FRONT = -66 -- передняя кромка скалы по Z + local RIVER_X, RIVER_W, LIP_Y = 48, 10, 35 -- русло реки над водопадом и высота уступа + local cliff = Instance.new("Model") + cliff.Name = "Cliff" + cliff.Parent = map + do + -- скала уступами: три ряда блоков всё выше к заднему плану; у русла — вровень с уступом водопада + local rows = { { CLIFF_FRONT, 14, 22 }, { CLIFF_FRONT - 18, 26, 34 }, { CLIFF_FRONT - 40, 38, 50 } } -- { кромка, мин. высота, макс. высота } + for ri, row in ipairs(rows) do + local x = 28 + while x < 116 do + local w = rng:NextNumber(11, 16) + local cx = x + w / 2 + if math.abs(cx - RIVER_X) > RIVER_W / 2 + w / 2 - 1 then + local h = rng:NextNumber(row[2], row[3]) + if ri <= 2 and math.abs(cx - RIVER_X) < 16 then + h = LIP_Y + rng:NextNumber(-0.5, 1.5) -- берега реки вровень с уступом: на них стоит мост + end + local d = rng:NextNumber(18, 24) + local cf = CFrame.new(W + V(cx, h / 2, row[1] - d / 2)) * CFrame.Angles(rng:NextNumber(-0.06, 0.06), rng:NextNumber(-0.25, 0.25), rng:NextNumber(-0.06, 0.06)) + P({ Size = V(w, h, d), CFrame = cf, Color = COL.rock:Lerp(COL.rockDark, rng:NextNumber(0, 0.5)), Material = SMOOTH, Parent = cliff }) + P({ Size = V(w - 1, 1.2, d - 1), CFrame = cf * CFrame.new(0, h / 2 + 0.3, 0), Color = COL.moss:Lerp(COL.leaf, rng:NextNumber(0, 0.5)), Material = SMOOTH, Parent = cliff }) + -- острые обломки на кромке и на гранях — чтобы скала не выглядела ровной стеной + for _ = 1, 2 do + local s = rng:NextNumber(5, 9) + local cr = crag((cf * CFrame.new(rng:NextNumber(-w / 2, w / 2), rng:NextNumber(-h / 2, h / 2 - 2), -d / 2 + s * 0.2)).Position, s) + cr.Parent = cliff + end + if rng:NextNumber() < 0.7 then + pine((cf * CFrame.new(rng:NextNumber(-w / 4, w / 4), h / 2 + 0.8, rng:NextNumber(-d / 4, d / 4))).Position, rng:NextNumber(12, 20), 3) + end + end + x += w - 0.5 + end + end + for x = 30, 112, 9 do + local cr = crag(W + V(x + rng:NextNumber(-3, 3), 2, CLIFF_FRONT + rng:NextNumber(0, 3)), rng:NextNumber(6, 11)) + cr.Parent = cliff + end + -- ложе реки и стена за водопадом, река наверху + P({ Size = V(RIVER_W + 4, LIP_Y, 70), Position = W + V(RIVER_X, LIP_Y / 2, CLIFF_FRONT - 35), Color = COL.rockDark, Material = SMOOTH, Parent = cliff }) + P({ Size = V(RIVER_W, 0.8, 70), Position = W + V(RIVER_X, LIP_Y + 0.4, CLIFF_FRONT - 35), Color = COL.water, Material = Enum.Material.Glass, Transparency = 0.15, CanCollide = false, Parent = cliff }) + for z = CLIFF_FRONT - 4, CLIFF_FRONT - 66, -7 do + for _, s in ipairs({ -1, 1 }) do + rock(W + V(RIVER_X + s * (RIVER_W / 2 + 0.5), LIP_Y + 1, z + rng:NextNumber(-2, 2)), rng:NextNumber(2.5, 4.5)).Parent = cliff + end + end + end + + -- водопад: полупрозрачная «простыня», бегущие вниз струи (Beam с текстурой), пена и туман внизу + do + local fall = Instance.new("Model") + fall.Name = "Waterfall" + fall.Parent = map + local zf = CLIFF_FRONT - 1.2 + local sheet = P({ + Size = V(RIVER_W - 1, LIP_Y + 0.8, 1), Position = W + V(RIVER_X, LIP_Y / 2, zf), + Color = Color3.fromRGB(170, 236, 240), Material = Enum.Material.Glass, Transparency = 0.25, CanCollide = false, CastShadow = false, Parent = fall, + }) + for i = 0, 4 do + local x = -RIVER_W / 2 + 1.5 + i * (RIVER_W - 3) / 4 + local a0 = Instance.new("Attachment") + a0.Position = V(x, LIP_Y / 2, -0.6) + a0.Parent = sheet + local a1 = Instance.new("Attachment") + a1.Position = V(x + rng:NextNumber(-0.5, 0.5), -LIP_Y / 2, -0.6) + a1.Parent = sheet + local b = Instance.new("Beam") + b.Attachment0, b.Attachment1 = a0, a1 + b.Texture = "rbxasset://textures/particles/smoke_main.dds" + b.TextureMode = Enum.TextureMode.Wrap + b.TextureLength = 5 + b.TextureSpeed = rng:NextNumber(1.6, 2.4) + b.Width0, b.Width1 = 2.6, 3.2 + b.FaceCamera = true + b.LightEmission = 0.35 + b.Color = ColorSequence.new(Color3.new(1, 1, 1)) + b.Transparency = NumberSequence.new(0.25) + b.Parent = sheet + end + for _ = 1, 9 do + vcyl(W + V(RIVER_X + rng:NextNumber(-6, 6), WATER_Y + 0.2, zf + rng:NextNumber(0.5, 6)), 0.5, rng:NextNumber(3, 6), { + Color = Color3.fromRGB(240, 252, 252), Material = SMOOTH, Transparency = 0.15, CanCollide = false, CastShadow = false, Parent = fall, + }) + end + local function mistAt(pos, size, rate, s0, s1) + local holder = P({ Size = size, Position = pos, Transparency = 1, CanCollide = false, CanQuery = false, Parent = fall }) + local mist = Instance.new("ParticleEmitter") + mist.Texture = "rbxasset://textures/particles/smoke_main.dds" + mist.Color = ColorSequence.new(Color3.new(1, 1, 1)) + mist.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0, s0), NumberSequenceKeypoint.new(1, s1) }) + mist.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.45), NumberSequenceKeypoint.new(1, 1) }) + mist.Lifetime = NumberRange.new(2, 3.5) + mist.Rate = rate + mist.Speed = NumberRange.new(2, 5) + mist.SpreadAngle = Vector2.new(70, 70) + mist.Parent = holder + end + mistAt(W + V(RIVER_X, WATER_Y + 1, zf + 2), V(RIVER_W, 1, 2), 14, 4, 11) + mistAt(W + V(RIVER_X, LIP_Y, zf), V(RIVER_W, 1, 1), 5, 2, 5) + end + + -- арочный деревянный мост через реку над водопадом + do + local bridge = Instance.new("Model") + bridge.Name = "Bridge" + bridge.Parent = map + local z, x0, x1, y0, rise = CLIFF_FRONT - 22, RIVER_X - 11, RIVER_X + 11, LIP_Y + 1, 3.2 + local N = 12 + local function arc(t) + return W + V(x0 + (x1 - x0) * t, y0 + math.sin(t * math.pi) * rise, z) + end + for i = 0, N - 1 do + local a, b = arc(i / N), arc((i + 1) / N) + P({ Size = V((b - a).Magnitude + 0.1, 0.5, 5), CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0), Color = COL.plank:Lerp(COL.plankDark, (i % 2) * 0.4), Material = PLANKS, Parent = bridge }) + end + for _, s in ipairs({ -1, 1 }) do + local prev + for i = 0, N, 2 do + local p = arc(i / N) + V(0, 0, s * 2.3) + vcyl(p + V(0, 1.4, 0), 2.8, 0.4, { Color = COL.log, Material = WOOD, Parent = bridge }) + if prev then + rod(prev + V(0, 2.6, 0), p + V(0, 2.6, 0), 0.32, { Color = COL.log, Material = WOOD, Parent = bridge }) + end + prev = p + end + end + end + + -------------------------------------------------- у воды: камни, рогоз, кувшинки + local function nearDock(x, z) + return math.abs(x) < 9 and z > 28 and z < 70 + end + local function inCliff(x, z) + return x > 24 and x < 118 and z < -58 and z > -150 + end + for _, l in ipairs(LAKES) do + for _ = 1, 9 do + local a = rng:NextNumber(0, math.pi * 2) + local r = l[3] + rng:NextNumber(-1, 2.5) + local x, z = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r + if not inLake(x, z, -4) and not nearDock(x, z) and not inCliff(x, z) then + rock(W + V(x, rng:NextNumber(0.5, 2.5), z), rng:NextNumber(2.5, 5.5)) + end + end + for _ = 1, 5 do + local a = rng:NextNumber(0, math.pi * 2) + local r = l[3] + rng:NextNumber(-1.5, 0.5) + local x, z = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r + if not inLake(x, z, -3) and not nearDock(x, z) and not inCliff(x, z) then + cattails(W + V(x, WATER_Y - 0.5, z)) + end + end + end + for _, p in ipairs({ { 11, 55 }, { 15, 52 }, { -9, 53 }, { 20, 47 } }) do -- рогоз в правом нижнем углу кадра + cattails(W + V(p[1], WATER_Y - 0.5, p[2])) + end + for _ = 1, 14 do -- кувшинки группами + local l = LAKES[rng:NextInteger(1, #LAKES)] + local a = rng:NextNumber(0, math.pi * 2) + local r = l[3] * rng:NextNumber(0.5, 0.88) + local cx, cz = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r + for _ = 1, rng:NextInteger(2, 5) do + local x, z = cx + rng:NextNumber(-3, 3), cz + rng:NextNumber(-3, 3) + if inLake(x, z, -2) and not nearDock(x, z) and not (x > 6 and x < 20 and z > 36 and z < 56) then + local size = rng:NextNumber(2, 3.4) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.15, size, size), CFrame = CFrame.new(W + V(x, WATER_Y + 0.12, z)) * CFrame.Angles(0, 0, math.rad(90)), Color = Color3.fromRGB(78, 168, 70):Lerp(Color3.fromRGB(110, 190, 80), rng:NextNumber()), Material = SMOOTH, CanCollide = false, CastShadow = false }) + if rng:NextNumber() < 0.35 then + ball(W + V(x + 0.3, WATER_Y + 0.45, z), 0.8, { Color = Color3.fromRGB(255, 150, 195), Material = SMOOTH, CanCollide = false, CastShadow = false }) + ball(W + V(x + 0.3, WATER_Y + 0.75, z), 0.4, { Color = Color3.fromRGB(255, 235, 120), Material = SMOOTH, CanCollide = false, CastShadow = false }) + end + end + end + end + + -------------------------------------------------- лес, кусты, цветы + local function nearPath(x, z, dist) + for i = 2, #HILL_PATH do + local a, b = HILL_PATH[i - 1], HILL_PATH[i] + local abx, abz = b[1] - a[1], b[2] - a[2] + local t = math.clamp(((x - a[1]) * abx + (z - a[2]) * abz) / (abx * abx + abz * abz), 0, 1) + if (x - a[1] - abx * t) ^ 2 + (z - a[2] - abz * t) ^ 2 < dist * dist then + return true + end + end + return false + end + local function freeSpot(x, z) + if math.abs(x) > 236 or math.abs(z) > 236 or inLake(x, z, 6) or inCliff(x, z) or nearPath(x, z, 6) then + return false + end + if x > -32 and x < 30 and z > 44 and z < 100 then -- прибытие, лавка, портал + return false + end + for _, c in ipairs({ { -58, -62, 16 }, { 8, -96, 13 }, { -76, -136, 11 }, { -17, -80, 5 } }) do + if (x - c[1]) ^ 2 + (z - c[2]) ^ 2 < c[3] * c[3] then + return false + end + end + return not (x > 2 and x < 14 and z > -100 and z < -64) -- мостки у домика + end + + local placed = 0 + for _ = 1, 700 do + if placed >= 210 then + break + end + local x, z = rng:NextNumber(-236, 236), rng:NextNumber(-236, 236) + -- за озером лес гуще, перед ним (за спиной игрока) реже + if (z < 0 or rng:NextNumber() < 0.45) and freeSpot(x, z) then + local far = math.max(math.abs(x), math.abs(z)) > 150 + pine(W + V(x, hillY(x, z) - 0.3, z), far and rng:NextNumber(22, 32) or rng:NextNumber(15, 25), far and 2 or 3) + placed += 1 + end + end + for _ = 1, 25 do -- лиственные деревья у берегов + local l = LAKES[rng:NextInteger(1, #LAKES)] + local a = rng:NextNumber(0, math.pi * 2) + local r = l[3] + rng:NextNumber(8, 18) + local x, z = l[1] + math.cos(a) * r, l[2] + math.sin(a) * r + if freeSpot(x, z) then + leafy(W + V(x, hillY(x, z) - 0.3, z), rng:NextNumber(8, 12)) + end + end + for _ = 1, 50 do -- кусты + local x, z = rng:NextNumber(-150, 150), rng:NextNumber(-150, 120) + if freeSpot(x, z) then + local y = hillY(x, z) + local c = COL.leafDark:Lerp(COL.leaf, rng:NextNumber()) + for _ = 1, 3 do + ball(W + V(x + rng:NextNumber(-1.5, 1.5), y + 0.8, z + rng:NextNumber(-1.5, 1.5)), rng:NextNumber(2.5, 4), { Color = c, Material = SMOOTH, CanCollide = false }) + end + end + end + for _ = 1, 80 do -- цветы + local x, z = rng:NextNumber(-120, 120), rng:NextNumber(-140, 110) + if freeSpot(x, z) or nearPath(x, z, 6) and not nearPath(x, z, 3) then + ball(W + V(x, hillY(x, z) + 0.4, z), 0.6, { + Color = ({ Color3.fromRGB(255, 120, 150), Color3.fromRGB(255, 230, 90), Color3.fromRGB(245, 245, 255), Color3.fromRGB(190, 140, 255) })[rng:NextInteger(1, 4)], + Material = SMOOTH, CanCollide = false, CastShadow = false, + }) + end + end + -- отдельные детали (деревья, камни, кусты, фонари) — в папку Decor, чтобы в Explorer было видно + -- главное: модели и маркеры World1*/Guide* + local decor = Instance.new("Folder") + decor.Name = "Decor" + decor.Parent = map + for _, c in ipairs(map:GetChildren()) do + if c:IsA("BasePart") and not c.Name:match("^World1") and not c.Name:match("^Guide") then + c.Parent = decor + end + end + + -------------------------------------------------- горизонт: горы и облака + do + local horizon = Instance.new("Folder") + horizon.Name = "Horizon" + horizon.Parent = map + -- гора — несколько острых пиков (кубы вершиной вверх) разного размера + local function mountain(a, dist, s) + local base = W + V(math.cos(a) * dist, 0, math.sin(a) * dist) + for k = 1, 3 do + local ss = k == 1 and s or s * rng:NextNumber(0.45, 0.7) + local off = k == 1 and V(0, 0, 0) or V(rng:NextNumber(-0.7, 0.7) * s, 0, rng:NextNumber(-0.4, 0.4) * s) + local apex = ss * rng:NextNumber(0.55, 0.75) -- высота пика над землёй + P({ + Size = V(ss, ss, ss), + CFrame = CFrame.new(base + off + V(0, apex - ss * 0.866, 0)) * CFrame.Angles(rng:NextNumber(-0.1, 0.1), rng:NextNumber(0, 6.28), rng:NextNumber(-0.1, 0.1)) * CUBE_UP, + Color = Color3.fromRGB(152, 166, 190):Lerp(Color3.fromRGB(118, 134, 164), rng:NextNumber()), Material = SMOOTH, + CanCollide = false, CanQuery = false, CastShadow = false, Parent = horizon, + }) + end + end + for i = 0, 13 do -- север (за озером) — крупнее и плотнее + mountain(math.rad(-160 + i * 10 + rng:NextNumber(-4, 4)), rng:NextNumber(340, 470), rng:NextNumber(130, 220)) + end + for i = 0, 9 do -- остальные стороны + mountain(math.rad(20 + i * 16 + rng:NextNumber(-5, 5)), rng:NextNumber(360, 480), rng:NextNumber(100, 160)) + end + for _ = 1, 9 do + local c = W + V(rng:NextNumber(-380, 380), rng:NextNumber(170, 230), rng:NextNumber(-420, 200)) + for _ = 1, rng:NextInteger(4, 6) do + ball(c + V(rng:NextNumber(-30, 30), rng:NextNumber(-5, 8), rng:NextNumber(-12, 12)), rng:NextNumber(22, 42), { + Color = Color3.new(1, 1, 1), Material = SMOOTH, CanCollide = false, CanQuery = false, CastShadow = false, Parent = horizon, + }) + end + end + end + + -- невидимые стены по краю мира + for _, w in ipairs({ + { V(0, 0, 245), V(500, 120, 2) }, + { V(0, 0, -245), V(500, 120, 2) }, + { V(245, 0, 0), V(2, 120, 500) }, + { V(-245, 0, 0), V(2, 120, 500) }, + }) do + P({ Name = "WorldWall", Size = w[2], Position = W + w[1] + V(0, 50, 0), Transparency = 1, CanQuery = false }) + end + + map.Parent = parent + return map +end + +-- сборка в Studio: стирает старую папку и террейн мира, строит заново прямо в Workspace +function Builder.bake() + local old = Workspace:FindFirstChild("World1Map") + if old then + old:Destroy() + end + terrain:FillBlock(CFrame.new(W + V(0, 30, 0)), V(504, 120, 504), Enum.Material.Air) + local map = Builder.build(Workspace) + print(("✅ «Тихое озеро» собрано: Workspace.World1Map, деталей: %d. Сохраните плейс (Ctrl+S)."):format(#map:GetDescendants())) + return map +end + +return Builder diff --git a/src/ServerScriptService/WorldBuilder.lua b/src/ServerScriptService/WorldBuilder.lua new file mode 100644 index 0000000..6809e41 --- /dev/null +++ b/src/ServerScriptService/WorldBuilder.lua @@ -0,0 +1,1876 @@ +-- WorldBuilder (ModuleScript) -> ServerScriptService +-- Строит всю карту: лобби и все миры (папка Workspace.FishingMap + террейн миров). +-- Карту собирают ОДИН РАЗ прямо в Roblox Studio, в режиме редактирования, и сохраняют плейс: +-- после этого всё видно в редакторе и правится руками как обычные детали и модели. +-- Команда для Command Bar (строка внизу Studio): +-- require(game.ServerScriptService.WorldBuilder:Clone()).bake() +-- bake() стирает Workspace.FishingMap и террейн миров и строит всё заново. +-- Если FishingMap в плейсе нет, MapBuilder при запуске игры строит карту этим же модулем. +-- +-- Что нужно игре от карты (не удаляйте и не переименовывайте): +-- маркеры-плитки (*Spawn, Guide*, LobbySpawn) — их можно двигать; +-- детали NpcSpot / World1Npc* с атрибутом NpcName — на них при запуске встают NPC +-- (полупрозрачные фигуры в редакторе, в игре скрыты); внешность — в атрибутах детали; +-- доски с атрибутом Bestiary — текст «кто водится» пишется при запуске по FishConfig; +-- ProximityPrompt с атрибутом Action (Shop, Sell, Portal, Daily, Talk, ...). + +local Workspace = game:GetService("Workspace") +local ServerStorage = game:GetService("ServerStorage") +local Lighting = game:GetService("Lighting") +local Players = game:GetService("Players") +local RunService = game:GetService("RunService") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local ServerScriptService = game:GetService("ServerScriptService") + +-- в Command Bar require кэширует модули: берём копии, чтобы подхватывать свежие правки из Rojo +-- (копия на время загрузки лежит рядом с оригиналом — модули ищут соседей через script.Parent) +local function load(module) + if RunService:IsRunning() then + return require(module) + end + local copy = module:Clone() + copy.Parent = module.Parent + local ok, result = pcall(require, copy) + copy:Destroy() + if not ok then + error(result, 0) + end + return result +end +local Config = load(ReplicatedStorage:WaitForChild("FishConfig")) +local Models = load(ReplicatedStorage:WaitForChild("GameModels")) +local World1Builder = load(ServerScriptService:WaitForChild("World1Builder")) + +local V = Vector3.new +local terrain = Workspace.Terrain +local GROUND_Y = 4 -- верх земли в мирах (запасная высота для groundY) +local FLOOR = 1 -- верх пола лобби + +local Builder = {} +local map -- папка FishingMap, которую сейчас строим +local rng = Random.new(7) + +---------------------------------------------------------------- свет и атмосфера + +local function ensure(class, parent, props) + local obj = parent:FindFirstChildOfClass(class) or Instance.new(class) + for k, v in pairs(props) do + obj[k] = v + end + obj.Parent = parent + return obj +end + +-- Базовый свет при запуске игры (совпадает со светом лобби). Под каждую локацию его меняет клиент +-- по полям look из FishConfig, пока игрок за экраном загрузки. +function Builder.applyLighting() + Lighting.ClockTime = 16.3 + Lighting.Brightness = 2.0 + Lighting.ExposureCompensation = -0.3 + Lighting.Ambient = Color3.fromRGB(64, 60, 72) + Lighting.OutdoorAmbient = Color3.fromRGB(120, 114, 124) + Lighting.ColorShift_Top = Color3.fromRGB(255, 224, 186) + Lighting.EnvironmentDiffuseScale = 0.5 + Lighting.EnvironmentSpecularScale = 0.5 + Lighting.GlobalShadows = true + ensure("Atmosphere", Lighting, { + Density = 0.4, Offset = 0.18, Glare = 0.25, Haze = 1.6, + Color = Color3.fromRGB(222, 212, 204), Decay = Color3.fromRGB(186, 160, 150), + }) + ensure("BloomEffect", Lighting, { Intensity = 0.3, Size = 24, Threshold = 1.8 }) + ensure("ColorCorrectionEffect", Lighting, { + Saturation = 0.18, Contrast = 0.14, Brightness = -0.04, TintColor = Color3.fromRGB(255, 242, 228), + }) + ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.7 }) + -- размытие дальнего плана включают миры и лобби через look.dof + ensure("DepthOfFieldEffect", Lighting, { Enabled = false, FarIntensity = 0.18, FocusDistance = 55, InFocusRadius = 95, NearIntensity = 0 }) +end + +---------------------------------------------------------------- помощники + +local function P(props) + local p = Instance.new("Part") + if props.Shape then + p.Shape = props.Shape + end + p.Anchored = true + p.TopSurface = Enum.SurfaceType.Smooth + p.BottomSurface = Enum.SurfaceType.Smooth + for k, v in pairs(props) do + if k ~= "Parent" and k ~= "Shape" then + p[k] = v + end + end + p.Parent = props.Parent or map + return p +end + +local function vcyl(pos, h, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(h, d, d) + props.CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)) + return P(props) +end + +local function ball(pos, d, props) + props.Shape = Enum.PartType.Ball + props.Size = V(d, d, d) + props.Position = pos + return P(props) +end + +local function surfaceText(part, face, text, color, extra) + local sg = Instance.new("SurfaceGui") + sg.Face = face + sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud + sg.PixelsPerStud = 40 + sg.LightInfluence = 0 + sg.Parent = part + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.RichText = true + t.TextColor3 = color or Color3.new(1, 1, 1) + t.TextStrokeTransparency = 0.4 + t.Text = text + t.Parent = sg + local pad = Instance.new("UIPadding") + pad.PaddingLeft = UDim.new(0.05, 0) + pad.PaddingRight = UDim.new(0.05, 0) + pad.PaddingTop = UDim.new(0.06, 0) + pad.PaddingBottom = UDim.new(0.06, 0) + pad.Parent = t + for k, v in pairs(extra or {}) do + t[k] = v + end + return t +end + +local function billboard(target, text, color, offsetY, width) + local bb = Instance.new("BillboardGui") + bb.Size = UDim2.fromOffset(width or 300, 64) + bb.StudsOffset = V(0, offsetY or 5, 0) + bb.MaxDistance = 160 + bb.LightInfluence = 0 + bb.Parent = target + local t = Instance.new("TextLabel") + t.Size = UDim2.fromScale(1, 1) + t.BackgroundTransparency = 1 + t.Font = Enum.Font.FredokaOne + t.TextScaled = true + t.TextColor3 = color or Color3.new(1, 1, 1) + t.TextStrokeTransparency = 0.15 + t.Text = text + t.Parent = bb + return bb +end + +local function prompt(target, actionText, objectText, action, dist) + local pp = Instance.new("ProximityPrompt") + pp.ActionText = actionText + pp.ObjectText = objectText + pp.HoldDuration = 0 + pp.MaxActivationDistance = dist or 13 + pp.RequiresLineOfSight = false + pp:SetAttribute("Action", action) + pp.Parent = target + return pp +end + +local function marker(name, cf) + return P({ Name = name, Size = V(4, 1, 4), CFrame = cf, Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false }) +end + +local function lobbyCliffs() + local template = ServerStorage:FindFirstChild("FishingCliffTemplate") + if not template or not template:IsA("Model") then + warn("FishingCliffTemplate отсутствует; используем низкую изгородь лобби") + for deg = 0, 359, 7 do + local a = math.rad(deg) + local p = V(math.cos(a) * 82, FLOOR + 2, math.sin(a) * 82) + P({ Size = V(10.5, 4, 3), CFrame = CFrame.lookAt(p, V(0, p.Y, 0)), Material = Enum.Material.Grass, Color = Color3.fromRGB(60, 130, 55) }) + end + return + end + + local ring = Instance.new("Folder") + ring.Name = "LobbyCliffs" + ring.Parent = map + local count = 24 + local tiers = { + { name = "LobbyCliff", radius = 88, scale = 1.4, baseY = FLOOR }, + { name = "LobbyCliffUpper", radius = 104, scale = 2.2, baseY = FLOOR + 10 }, + } + for _, tier in ipairs(tiers) do + for i = 1, count do + local angle = (i - 1) * 2 * math.pi / count + local radial = V(math.cos(angle), 0, math.sin(angle)) + local center = V(radial.X * tier.radius, tier.baseY, radial.Z * tier.radius) + local model = template:Clone() + model.Name = string.format("%s_%02d", tier.name, i) + model:ScaleTo(tier.scale) + local facing = CFrame.lookAt(center, center + radial) + local rotation = facing - facing.Position + model:PivotTo(CFrame.new(center) * rotation) + local boxCF, boxSize = model:GetBoundingBox() + local targetBoxCenter = V(center.X, tier.baseY + boxSize.Y / 2, center.Z) + model:PivotTo(model:GetPivot() + (targetBoxCenter - boxCF.Position)) + model.Parent = ring + end + end +end + +local function rockTopPosition(cliffs, radial, desiredRadius, radiusOffsets) + local params = RaycastParams.new() + params.FilterType = Enum.RaycastFilterType.Include + params.FilterDescendantsInstances = { cliffs } + for _, offset in ipairs(radiusOffsets) do + local radius = desiredRadius + offset + local origin = V(radial.X * radius, 128, radial.Z * radius) + local hit = Workspace:Raycast(origin, V(0, -180, 0), params) + if hit then + return hit.Position + end + end + return V(radial.X * desiredRadius, FLOOR, radial.Z * desiredRadius) +end + +local function placeModelOnRock(model, position, yaw) + local rotation = CFrame.Angles(0, yaw, 0) + model:PivotTo(CFrame.new(position) * rotation) + local boxCF, boxSize = model:GetBoundingBox() + local targetBoxCenter = V(position.X, position.Y + boxSize.Y / 2, position.Z) + model:PivotTo(model:GetPivot() + (targetBoxCenter - boxCF.Position)) +end + +local function lobbyTrees() + local templates = ServerStorage:FindFirstChild("LobbyTreeTemplates") + local cliffs = map:FindFirstChild("LobbyCliffs") + if not templates or not cliffs then + warn("LobbyTreeTemplates или LobbyCliffs отсутствует; деревья лобби пропущены") + return + end + local treeTypes = { "LargeCanopy", "Pine", "RoundCanopy" } + local treeScale = { LargeCanopy = 1, Pine = 1.25, RoundCanopy = 1.2 } + local folder = Instance.new("Folder") + folder.Name = "LobbyTrees" + folder.Parent = map + for layer = 1, 2 do + local baseRadius = layer == 1 and 84 or 96 + local radiusOffsets = { 0, -2, 2, -4, 4, -6, 6 } + for i = 1, 18 do + local degrees = (i - 1) * 20 + 10 + (layer == 2 and 10 or 0) + local angle = math.rad(degrees) + local radial = V(math.cos(angle), 0, math.sin(angle)) + local position = rockTopPosition(cliffs, radial, baseRadius, radiusOffsets) + local kind = treeTypes[(i + layer - 2) % #treeTypes + 1] + local template = templates:FindFirstChild(kind) + if template and template:IsA("Model") then + local model = template:Clone() + model.Name = string.format("LobbyTree_L%d_%02d_%s", layer, i, kind) + model:ScaleTo(treeScale[kind]) + placeModelOnRock(model, position, math.rad((i * 47 + layer * 23) % 360)) + for _, part in ipairs(model:GetDescendants()) do + if part:IsA("BasePart") then part.Anchored = true end + end + model.Parent = folder + end + end + end +end + +local function lobbyRockPlants() + local templates = ServerStorage:FindFirstChild("LobbyRockPlantTemplates") + local cliffs = map:FindFirstChild("LobbyCliffs") + if not templates or not cliffs then + warn("LobbyRockPlantTemplates или LobbyCliffs отсутствует; растительность скал пропущена") + return + end + local folder = Instance.new("Folder") + folder.Name = "LobbyRockPlants" + folder.Parent = map + local clusterAngles = { + { layer = 1, degrees = 45 }, { layer = 1, degrees = 135 }, + { layer = 1, degrees = 225 }, { layer = 1, degrees = 315 }, + { layer = 2, degrees = 0 }, { layer = 2, degrees = 90 }, + { layer = 2, degrees = 180 }, { layer = 2, degrees = 270 }, + } + local tuftKinds = { "GrassTuft", "BladeGrass", "GrassTuft", "FlowerPatch", "GrassTuft", "WideGrass" } + local tuftScales = { GrassTuft = 1.15, BladeGrass = 1.45, FlowerPatch = 1.1, WideGrass = 0.55 } + local offsets = { { 0, 0 }, { -2.2, 0 }, { 2.2, 0 }, { 0, -2.2 }, { 0, 2.2 }, { 1.6, 1.6 } } + local rayParams = RaycastParams.new() + rayParams.FilterType = Enum.RaycastFilterType.Include + rayParams.FilterDescendantsInstances = { cliffs } + for clusterIndex, cluster in ipairs(clusterAngles) do + local baseRadius = cluster.layer == 1 and 84 or 96 + local baseAngle = math.rad(cluster.degrees) + local radial = V(math.cos(baseAngle), 0, math.sin(baseAngle)) + local tangent = V(-radial.Z, 0, radial.X) + local basePos = rockTopPosition(cliffs, radial, baseRadius, { 0, -2, 2, -4, 4, -6, 6 }) + local bush = Instance.new("Model") + bush.Name = string.format("GrassBush_%02d_L%d", clusterIndex, cluster.layer) + for i, offset in ipairs(offsets) do + local xz = basePos + radial * offset[1] + tangent * offset[2] + local plantPos + for _, correction in ipairs({ 0, -2, 2, -4, 4 }) do + local candidate = xz + radial * correction + local hit = Workspace:Raycast(V(candidate.X, 128, candidate.Z), V(0, -180, 0), rayParams) + if hit then plantPos = hit.Position; break end + end + if plantPos then + local kind = tuftKinds[i] + local template = templates:FindFirstChild(kind) + if template and template:IsA("Model") then + local plant = template:Clone() + plant.Name = kind .. "_" .. i + plant:ScaleTo(tuftScales[kind]) + placeModelOnRock(plant, plantPos, math.rad((clusterIndex * 37 + i * 53) % 360)) + for _, part in ipairs(plant:GetDescendants()) do + if part:IsA("BasePart") then part.Anchored = true end + end + plant.Parent = bush + end + end + end + bush.Parent = folder + end +end +-- холмы и горы за скалами лобби (террейн), ельники на склонах и кольцо тумана за горами. +-- К горизонту холмы выше, чтобы из лобби было видно не пустоту, а гряду в дымке. +local function lobbyHillHeight(x, z) + local r = math.sqrt(x * x + z * z) + if r < 120 then + return nil + end + local t = math.clamp((r - 120) / 220, 0, 1) + local base = 22 + 90 * t ^ 0.85 + local n = math.noise(x / 95, z / 95, 1.7) * 30 + math.noise(x / 38, z / 38, 5.1) * 9 + local peak = math.max(0, math.noise(x / 150, z / 150, 9.3)) * 70 * t + local edge = math.clamp((r - 120) / 12, 0, 1) + return (base + n * (0.35 + 0.65 * t) + peak) * edge +end + +local function lobbyHills() + local R, Y0, Y1, CH = 384, -8, 232, 64 + for cx = -R, R - CH, CH do + for cz = -R, R - CH, CH do + -- чанк целиком внутри лобби пропускаем + local far = math.sqrt(math.max(cx * cx, (cx + CH) ^ 2) + math.max(cz * cz, (cz + CH) ^ 2)) + if far >= 120 then + local region = Region3.new(V(cx, Y0, cz), V(cx + CH, Y1, cz + CH)) + local nx, ny, nz = CH / 4, (Y1 - Y0) / 4, CH / 4 + local mats, occs = {}, {} + for i = 1, nx do + mats[i], occs[i] = {}, {} + for j = 1, ny do + mats[i][j], occs[i][j] = {}, {} + end + for k = 1, nz do + local x, z = cx + (i - 0.5) * 4, cz + (k - 0.5) * 4 + local h = (math.sqrt(x * x + z * z) <= R) and lobbyHillHeight(x, z) or nil + for j = 1, ny do + local yb = Y0 + (j - 1) * 4 + local occ = h and math.clamp((h - yb) / 4, 0, 1) or 0 + local m = Enum.Material.Air + if occ > 0 then + if yb > h - 6 then + m = h > 118 and Enum.Material.Rock or Enum.Material.Grass + else + m = Enum.Material.Ground + end + end + mats[i][j][k], occs[i][j][k] = m, occ + end + end + end + terrain:WriteVoxels(region, 4, mats, occs) + end + end + end + + -- ельники пятнами на склонах + local pines = ServerStorage:FindFirstChild("OldPines") + local forest = Instance.new("Folder") + forest.Name = "LobbyHillForest" + forest.Parent = map + if pines and #pines:GetChildren() > 0 then + local templates = pines:GetChildren() + local frng = Random.new(1104) + local placed = {} + for _ = 1, 4000 do + if #placed >= 170 then break end + local a = frng:NextNumber(0, math.pi * 2) + local r = frng:NextNumber(132, 300) + local x, z = math.cos(a) * r, math.sin(a) * r + -- высоту берём из той же формулы: лучи по только что залитому террейну в редакторе ненадёжны + local h = lobbyHillHeight(x, z) + local slope = h and math.max(math.abs((lobbyHillHeight(x + 4, z) or h) - h), math.abs((lobbyHillHeight(x, z + 4) or h) - h)) / 4 + if h and h <= 118 and slope < 0.8 and math.noise(x / 60, z / 60, 3.3) > -0.05 then + local ground = V(x, h, z) + local ok = true + for _, q in ipairs(placed) do + if (q - ground).Magnitude < 9 then ok = false break end + end + if ok then + local m = templates[frng:NextInteger(1, #templates)]:Clone() + for _, d in ipairs(m:GetDescendants()) do + if d:IsA("LuaSourceContainer") then + d:Destroy() + elseif d:IsA("BasePart") then + d.Anchored = true + d.CanCollide = false + d.CastShadow = false + end + end + m:ScaleTo(m:GetScale() * frng:NextNumber(0.8, 1.5)) + m:PivotTo(CFrame.new(ground) * CFrame.Angles(0, frng:NextNumber(0, math.pi * 2), 0)) + local bcf, bsz = m:GetBoundingBox() + m:PivotTo(m:GetPivot() + V(0, ground.Y - (bcf.Position.Y - bsz.Y / 2) - 1, 0)) + m.Parent = forest + table.insert(placed, ground) + end + end + end + end + + -- туман за горами: медленные крупные клубы по двум кольцам + local haze = Instance.new("Folder") + haze.Name = "LobbyHaze" + haze.Parent = map + for ring, cfg in ipairs({ { r = 150, n = 28, y = 18, size = 45 }, { r = 250, n = 36, y = 40, size = 70 } }) do + for i = 1, cfg.n do + local a = (i - 1) / cfg.n * math.pi * 2 + local x, z = math.cos(a) * cfg.r, math.sin(a) * cfg.r + local h = lobbyHillHeight(x, z) or 0 + local anchor = Instance.new("Part") + anchor.Name = "HazeAnchor" + anchor.Anchored = true + anchor.CanCollide = false + anchor.CanQuery = false + anchor.CanTouch = false + anchor.Transparency = 1 + anchor.Size = V(30, 4, 30) + anchor.CFrame = CFrame.new(x, h + cfg.y, z) + anchor.Parent = haze + local pe = Instance.new("ParticleEmitter") + pe.Texture = "rbxasset://textures/particles/smoke_main.dds" + pe.Color = ColorSequence.new(Color3.fromRGB(236, 228, 220)) + pe.LightEmission = 0.15 + pe.LightInfluence = 0.6 + pe.Rate = ring == 1 and 0.5 or 0.35 + pe.Lifetime = NumberRange.new(16, 22) + pe.Speed = NumberRange.new(0.3, 0.8) + pe.SpreadAngle = Vector2.new(60, 60) + pe.Rotation = NumberRange.new(0, 360) + pe.RotSpeed = NumberRange.new(-4, 4) + pe.Size = NumberSequence.new({ + NumberSequenceKeypoint.new(0, cfg.size * 0.7), + NumberSequenceKeypoint.new(1, cfg.size * 1.2), + }) + pe.Transparency = NumberSequence.new({ + NumberSequenceKeypoint.new(0, 1), + NumberSequenceKeypoint.new(0.3, 0.8), + NumberSequenceKeypoint.new(0.7, 0.82), + NumberSequenceKeypoint.new(1, 1), + }) + pe.Parent = anchor + end + end +end + +-- высота земли: читаем воксели столбца (лучи по только что залитому террейну ненадёжны, особенно в редакторе) +local function groundY(x, z) + local region = Region3.new(V(x - 1, -128, z - 1), V(x + 1, 160, z + 1)):ExpandToGrid(4) + local ok, mats, occ = pcall(terrain.ReadVoxels, terrain, region, 4) + if ok then + local bottom = region.CFrame.Position.Y - region.Size.Y / 2 + for y = mats.Size.Y, 1, -1 do + local m = mats[1][y][1] + if m ~= Enum.Material.Air and m ~= Enum.Material.Water then + return bottom + (y - 1 + occ[1][y][1]) * 4, m + end + end + end + return GROUND_Y +end + +local function lamp(pos, color) + vcyl(pos + V(0, 4.5, 0), 9, 0.5, { Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + P({ Size = V(1.4, 0.3, 1.4), Position = pos + V(0, 9.1, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + local bulb = P({ Size = V(1, 1.4, 1), Position = pos + V(0, 9.95, 0), Material = Enum.Material.Neon, Color = color or Color3.fromRGB(255, 215, 150) }) + P({ Size = V(1.5, 0.35, 1.5), Position = pos + V(0, 10.8, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal }) + local light = Instance.new("PointLight") + light.Range = 16 + light.Brightness = 1.2 + light.Color = color or Color3.fromRGB(255, 210, 150) + light.Parent = bulb +end + +local function tree(pos, kind) + if kind == "pine" then + local h = rng:NextNumber(8, 12) + vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(95, 65, 40), Material = Enum.Material.Wood }) + for i = 0, 3 do + ball(pos + V(0, h * 0.4 + i * 2.8, 0), 10 - i * 2.2, { Color = Color3.fromRGB(35, 100 + i * 10, 55), Material = Enum.Material.Grass }) + end + else + local birch = kind == "birch" + local h = rng:NextNumber(7, 10) + vcyl(pos + V(0, h / 2, 0), h, 1.5, { + Color = birch and Color3.fromRGB(225, 222, 210) or Color3.fromRGB(105, 72, 45), + Material = Enum.Material.Wood, + }) + local leaf = birch and Color3.fromRGB(150, 195, 80) or Color3.fromRGB(65, rng:NextInteger(135, 165), 60) + local s = rng:NextNumber(9, 12) + ball(pos + V(0, h + s * 0.25, 0), s, { Color = leaf, Material = Enum.Material.Grass }) + ball(pos + V(s * 0.35, h - 0.5, s * 0.1), s * 0.7, { Color = leaf, Material = Enum.Material.Grass }) + ball(pos + V(-s * 0.3, h - 0.2, -s * 0.2), s * 0.65, { Color = leaf, Material = Enum.Material.Grass }) + end +end + +local function bush(pos) + local c = Color3.fromRGB(55, rng:NextInteger(120, 150), 55) + for i = 1, 3 do + ball(pos + V(rng:NextNumber(-1.5, 1.5), 1, rng:NextNumber(-1.5, 1.5)), rng:NextNumber(2.5, 4), { Color = c, Material = Enum.Material.Grass }) + end + if rng:NextNumber() < 0.5 then + for i = 1, 4 do + ball(pos + V(rng:NextNumber(-1.8, 1.8), rng:NextNumber(1.5, 2.6), rng:NextNumber(-1.8, 1.8)), 0.5, { + Color = ({ Color3.fromRGB(255, 120, 150), Color3.fromRGB(255, 230, 90), Color3.fromRGB(240, 240, 255) })[rng:NextInteger(1, 3)], + CanCollide = false, + }) + end + end +end + +local function bench(cf) + local seat = Instance.new("Seat") + seat.Anchored = true + seat.Size = V(5, 0.4, 1.6) + seat.CFrame = cf * CFrame.new(0, 1.6, 0) + seat.Material = Enum.Material.WoodPlanks + seat.Color = Color3.fromRGB(150, 105, 65) + seat.TopSurface = Enum.SurfaceType.Smooth + seat.Parent = map + for _, x in ipairs({ -2.1, 2.1 }) do + P({ Size = V(0.4, 1.4, 1.4), CFrame = cf * CFrame.new(x, 0.7, 0), Color = Color3.fromRGB(50, 50, 55), Material = Enum.Material.Metal }) + end + P({ Size = V(5, 1.3, 0.3), CFrame = cf * CFrame.new(0, 2.6, 0.75) * CFrame.Angles(math.rad(-10), 0, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 105, 65) }) +end + +-- место NPC: полупрозрачная фигура в редакторе; сам NPC встаёт сюда при запуске (prepareRuntime) +local function setNpc(part, name, colors, action, actionText) + part:SetAttribute("NpcName", name) + part:SetAttribute("SkinColor", colors.skin) + part:SetAttribute("ShirtColor", colors.shirt) + part:SetAttribute("PantsColor", colors.pants) + part:SetAttribute("HatColor", colors.hat) + part:SetAttribute("NpcAction", action) + part:SetAttribute("NpcActionText", actionText) + part.Size = V(2, 5, 1) + part.Color = colors.shirt + part.Transparency = 0.5 + part.CanCollide = false + part.CanQuery = false + part.CanTouch = false + return part +end + +local function npc(name, cf, colors, action, actionText) + return setNpc(P({ Name = "NpcSpot", CFrame = cf }), name, colors, action, actionText) +end + +-- доска «кто водится»: атрибуты Bestiary (зона), BestiaryTitle, BestiaryHex; текст пишется заново при запуске +local function writeBestiary(board) + local old = board:FindFirstChild("BestiaryText") + if old then + old:Destroy() + end + local zone = Config.Zones[board:GetAttribute("Bestiary")] + if not zone then + return + end + local lines = { ("%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 + +-- Лавки в стиле low poly: без фотореалистичных текстур (доски, ткань), плоские цвета с разбросом оттенков. +-- Большие дощатые панели (стены, пол, крыша) режутся на отдельные доски, шарики-гирлянды становятся +-- ромбиками-флажками, неоновая рамка вывески — матовой золотой. frame — CFrame лавки (для флажков), может быть nil. +local LOWPOLY_FLAT = { + [Enum.Material.WoodPlanks] = true, [Enum.Material.Wood] = true, [Enum.Material.Fabric] = true, + [Enum.Material.Metal] = true, [Enum.Material.Brick] = true, [Enum.Material.Plastic] = true, +} + +local function lowPolyShade(c, lrng, spread) + local k = 1 + lrng:NextNumber(-spread, spread) + return Color3.new(math.clamp(c.R * k, 0, 1), math.clamp(c.G * k, 0, 1), math.clamp(c.B * k, 0, 1)) +end + +local function lowPolyPlanks(p, lrng) + local s = p.Size + local dims = { s.X, s.Y, s.Z } + local thin = 1 + for i = 2, 3 do + if dims[i] < dims[thin] then thin = i end + end + -- режем вдоль самой длинной горизонтальной оси (кроме тонкой): стены — вертикальные доски, пол — продольные + local axis = (thin ~= 1 and (thin == 3 or s.X >= s.Z)) and 1 or 3 + local len = dims[axis] + local n = math.max(2, math.floor(len / 1.8 + 0.5)) + local w = len / n + for i = 1, n do + local off = -len / 2 + w * (i - 0.5) + local depth = lrng:NextNumber(-0.06, 0.06) + local o = { 0, 0, 0 } + o[axis] = off + o[thin] = depth + local size = { s.X, s.Y, s.Z } + size[axis] = w + local plank = Instance.new("Part") + plank.Name = "Plank" + plank.Anchored = true + plank.TopSurface, plank.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth + plank.Material = Enum.Material.SmoothPlastic + plank.Size = V(size[1], size[2], size[3]) + plank.CFrame = p.CFrame * CFrame.new(o[1], o[2], o[3]) + plank.Color = lowPolyShade(p.Color, lrng, 0.09) + plank.CanCollide, plank.CastShadow, plank.CanQuery = p.CanCollide, p.CastShadow, p.CanQuery + plank.Parent = p.Parent + end + p:Destroy() +end + +function Builder.lowPolyParts(parts, frame, seed) + local lrng = Random.new(seed or 5) + for _, p in ipairs(parts) do + if p:IsA("BasePart") and p.Parent and p.Transparency < 0.5 and not p.Name:find("Npc") then + local isBlock = p.ClassName == "Part" and p.Shape == Enum.PartType.Block + if p.Material == Enum.Material.Fabric and p.ClassName == "Part" and p.Shape == Enum.PartType.Ball and frame then + -- шарик гирлянды → ромбик-флажок, повёрнутый к покупателям + local d = p.Size.X + local flag = Instance.new("Part") + flag.Name = "Pennant" + flag.Anchored = true + flag.CanCollide = false + flag.Material = Enum.Material.SmoothPlastic + flag.Size = V(d * 1.15, d * 1.15, 0.25) + flag.CFrame = CFrame.new(p.Position) * (frame - frame.Position) * CFrame.Angles(0, 0, math.rad(45)) + flag.Color = p.Color + flag.Parent = p.Parent + p:Destroy() + elseif p.Material == Enum.Material.Neon and math.max(p.Size.X, p.Size.Y, p.Size.Z) > 4 then + p.Material = Enum.Material.SmoothPlastic -- рамка вывески: без свечения + p.Color = Color3.fromRGB(214, 160, 70) + elseif p.Material == Enum.Material.WoodPlanks and isBlock and #p:GetChildren() == 0 + and math.min(p.Size.X, p.Size.Y, p.Size.Z) <= 1.2 and math.max(p.Size.X, p.Size.Z) >= 4 then + lowPolyPlanks(p, lrng) + elseif LOWPOLY_FLAT[p.Material] then + p.Material = Enum.Material.SmoothPlastic + p.Color = lowPolyShade(p.Color, lrng, 0.06) + end + end + end +end + +-- детали лавки, построенной stall(cf): всё, что лежит в её габаритах прямо в папке parent +function Builder.stallParts(cf, parent) + local list = {} + for _, p in ipairs(parent:GetChildren()) do + if p:IsA("BasePart") then + local l = cf:PointToObjectSpace(p.Position) + if math.abs(l.X) <= 15.5 and l.Y >= -0.5 and l.Y <= 21 and l.Z >= -14.5 and l.Z <= 9.5 then + table.insert(list, p) + end + end + end + return list +end + +-- лавка: cf стоит на полу, сторона -Z смотрит на покупателей +local function stall(cf, opt) + local function at(x, y, z) + return cf * CFrame.new(x, y, z) + end + local wall, dark = opt.wall, opt.wall:Lerp(Color3.new(0, 0, 0), 0.3) + + P({ Size = V(24, 1, 17), CFrame = at(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 120, 80) }) + P({ Size = V(24, 13, 1), CFrame = at(0, 7.5, 8), Material = Enum.Material.WoodPlanks, Color = wall }) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(1, 13, 17), CFrame = at(s * 11.5, 7.5, 0), Material = Enum.Material.WoodPlanks, Color = wall }) + P({ Size = V(1.5, 14.5, 1.5), CFrame = at(s * 11.6, 7.25, -8.3), Material = Enum.Material.Wood, Color = dark }) + end + P({ Size = V(26, 1, 19), CFrame = at(0, 14.5, 0), Material = Enum.Material.WoodPlanks, Color = dark }) + -- полосатый навес + for i = 0, 7 do + P({ + Size = V(3, 0.35, 6), + CFrame = at(-10.5 + i * 3, 13.1, -10.6) * CFrame.Angles(math.rad(-22), 0, 0), + Material = Enum.Material.Fabric, + Color = (i % 2 == 0) and opt.stripeA or opt.stripeB, + }) + ball(at(-10.5 + i * 3, 11.9, -13.3).Position, 0.9, { Color = (i % 2 == 0) and opt.stripeA or opt.stripeB, Material = Enum.Material.Fabric }) + end + -- прилавок + local counter = P({ Size = V(18, 4, 3), CFrame = at(0, 3, -4), Material = Enum.Material.WoodPlanks, Color = wall }) + P({ Size = V(19, 0.5, 3.8), CFrame = at(0, 5.25, -4), Material = Enum.Material.Wood, Color = dark }) + -- вывеска + local board = P({ Size = V(20, 4.5, 0.6), CFrame = at(0, 17.6, -9.2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 45, 30) }) + P({ Size = V(20.8, 5.3, 0.3), CFrame = at(0, 17.6, -8.9), Material = Enum.Material.Neon, Color = opt.glow }) + for _, x in ipairs({ -8, 8 }) do + P({ Size = V(0.6, 3, 0.6), CFrame = at(x, 15.5, -9.2), Material = Enum.Material.Wood, Color = dark }) + end + surfaceText(board, Enum.NormalId.Front, opt.title, opt.titleColor) + -- фонарики + for _, x in ipairs({ -9.5, 9.5 }) do + local l = P({ Size = V(0.8, 1.1, 0.8), CFrame = at(x, 11.2, -9.4), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 210, 140) }) + local light = Instance.new("PointLight") + light.Range = 14 + light.Brightness = 1 + light.Color = Color3.fromRGB(255, 210, 150) + light.Parent = l + end + -- бочки по бокам + for _, s in ipairs({ -1, 1 }) do + vcyl(at(s * 14.5, 2.6, -5).Position, 3.2, 2.6, { Color = Color3.fromRGB(130, 85, 50), Material = Enum.Material.Wood }) + vcyl(at(s * 14.5, 2.6, -5).Position, 0.3, 2.75, { Color = Color3.fromRGB(70, 70, 75), Material = Enum.Material.Metal }) + end + + prompt(counter, opt.promptText, opt.promptObject, opt.action, 14) + if opt.npcName then + npc(opt.npcName, at(0, 4, 1.5), opt.npcColors) + end + if opt.decor then + opt.decor(at) + end + Builder.lowPolyParts(Builder.stallParts(cf, map), cf, math.floor(cf.Position.X + cf.Position.Z)) + return counter +end + +-- Модель портала из ServerStorage.FishingPortalTemplate, перекрашенная в цвет мира и +-- поставленная основанием на baseCF. Без шаблона возвращает nil (тогда строится старое кольцо). +function Builder.portalModel(baseCF, color, name, parent) + local template = ServerStorage:FindFirstChild("FishingPortalTemplate") + if not (template and template:IsA("Model")) then + return nil + end + local model = template:Clone() + model.Name = name + for _, part in ipairs(model:GetDescendants()) do + if part:IsA("BasePart") then + local c = part.Color + local isGreen = c.G > c.R * 1.15 and c.G > c.B * 1.10 and c.G > 0.25 + if part.Material == Enum.Material.Neon then + part.Color = color + elseif isGreen then + part.Color = color:Lerp(Color3.fromRGB(55, 65, 75), 0.30) + part.Material = Enum.Material.SmoothPlastic + end + elseif part:IsA("ParticleEmitter") then + part.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + end + end + + local pivot = template:GetPivot() + local boxCFrame, boxSize = template:GetBoundingBox() + local boxBottom = pivot:PointToObjectSpace(Vector3.new( + boxCFrame.Position.X, + boxCFrame.Position.Y - boxSize.Y / 2, + boxCFrame.Position.Z + )).Y + model:PivotTo(baseCF * CFrame.new(0, -boxBottom, 0)) + model.Parent = parent + return model +end + +local function portal(baseCF, title, color, worldId, locked) + -- Все порталы, и в лобби, и возвратные в мирах, используют модель автора из ServerStorage. + do + local model = Builder.portalModel(baseCF, color, "PortalModel_" .. worldId, map) + if model then + -- Этот невидимый якорь сохраняет ProximityPrompt и подпись мира. + local disc = P({ + Name = "Portal_" .. worldId, + Size = V(1, 1, 1), + CFrame = baseCF * CFrame.new(0, 10, 0), + Transparency = 1, + CanCollide = false, + CanQuery = false, + CanTouch = false, + }) + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + pe.LightEmission = 1 + pe.Rate = 25 + pe.Lifetime = NumberRange.new(1, 1.8) + pe.Speed = NumberRange.new(0.5, 2) + pe.SpreadAngle = Vector2.new(180, 180) + pe.Size = NumberSequence.new(0.5, 0) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Parent = disc + billboard(disc, title, color:Lerp(Color3.new(1, 1, 1), 0.4), 7, 200) + if locked then + billboard(disc, "🔒", Color3.new(1, 1, 1), 0, 120) + end + local pp = prompt(disc, locked and "Посмотреть" or "Перейти", title, "Portal", 14) + pp:SetAttribute("World", worldId) + return disc + end + end + + local center = baseCF * CFrame.new(0, 10, 0) + P({ Size = V(17, 1, 9), CFrame = baseCF * CFrame.new(0, 0.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(95, 100, 115) }) + P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130) }) + local R, n = 7, 20 + for i = 0, n - 1 do + local a = (i + 0.5) / n * math.pi * 2 + P({ + Size = V(2 * math.pi * R / n + 0.4, 1.7, 1.7), + CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R, 0), + Material = Enum.Material.Slate, + Color = Color3.fromRGB(80, 85, 100), + }) + if i % 2 == 0 then + P({ + Size = V(0.6, 0.6, 1.9), + CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R + 0.95, 0), + Material = Enum.Material.Neon, + Color = color, + }) + end + end + local disc = P({ + Name = "Portal_" .. worldId, + Shape = Enum.PartType.Cylinder, + Size = V(0.3, 2 * R - 1, 2 * R - 1), + CFrame = center * CFrame.Angles(0, math.rad(90), 0), + Material = Enum.Material.Neon, + Color = color, + Transparency = 0.3, + CanCollide = false, + }) + local pe = Instance.new("ParticleEmitter") + pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1)) + pe.LightEmission = 1 + pe.Rate = 25 + pe.Lifetime = NumberRange.new(1, 1.8) + pe.Speed = NumberRange.new(0.5, 2) + pe.SpreadAngle = Vector2.new(180, 180) + pe.Size = NumberSequence.new(0.5, 0) + pe.Transparency = NumberSequence.new(0.2, 1) + pe.Parent = disc + billboard(disc, title, color:Lerp(Color3.new(1, 1, 1), 0.4), 10, 250) + if locked then + billboard(disc, "🔒", Color3.new(1, 1, 1), 0, 120) + end + local pp = prompt(disc, locked and "Посмотреть" or "Перейти", title, "Portal", 14) + pp:SetAttribute("World", worldId) + return disc +end + +local function banner(pos, color, icon, text) + local look = CFrame.lookAt(pos, V(0, pos.Y, 0)) -- смотрит в центр лобби + vcyl(pos + V(0, 8, 0), 16, 0.7, { Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal }) + ball(pos + V(0, 16.3, 0), 1.2, { Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal }) + P({ Size = V(5.2, 0.4, 0.4), CFrame = look * CFrame.new(0, 15, -0.6), Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal }) + local flag = P({ Size = V(4.6, 8, 0.25), CFrame = look * CFrame.new(0, 10.8, -0.6), Color = color, Material = Enum.Material.Fabric, CanCollide = false }) + P({ Size = V(4.6, 0.5, 0.3), CFrame = look * CFrame.new(0, 6.6, -0.6), Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal }) + local label = icon .. "\n" .. text + surfaceText(flag, Enum.NormalId.Front, label, Color3.new(1, 1, 1)) + surfaceText(flag, Enum.NormalId.Back, label, Color3.new(1, 1, 1)) +end + +local function arch(cf, span, height, title, color) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(4, height, 4), CFrame = cf * CFrame.new(s * span / 2, height / 2, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) + P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, height + 0.6, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 195, 60) }) + P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, 0.6, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(150, 145, 140) }) + end + local beam = P({ Size = V(span + 6, 6, 2.5), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(60, 85, 140) }) + P({ Size = V(span + 7, 7, 2), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.Neon, Color = color }) + surfaceText(beam, Enum.NormalId.Front, title, Color3.fromRGB(255, 230, 120)) + surfaceText(beam, Enum.NormalId.Back, title, Color3.fromRGB(255, 230, 120)) +end + +---------------------------------------------------------------- сборка карты + +function Builder.build() + rng = Random.new(7) + map = Instance.new("Folder") + map.Name = "FishingMap" + local zonesFolder = Instance.new("Folder") + zonesFolder.Name = "FishingZones" + zonesFolder.Parent = map + local world1Prebuilt = Workspace:FindFirstChild("World1Map") + + ---------------------------------------------------------------- ЛОББИ + + P({ Shape = Enum.PartType.Cylinder, Size = V(1, 170, 170), CFrame = CFrame.new(0, 0.5, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Cobblestone, Color = Color3.fromRGB(190, 180, 165) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 74, 74), CFrame = CFrame.new(0, 0.52, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Marble, Color = Color3.fromRGB(232, 226, 214) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 78, 78), CFrame = CFrame.new(0, 0.51, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.SmoothPlastic, Color = Color3.fromRGB(60, 120, 190) }) + -- дорожки-лучи к лавкам и порталам + for _, a in ipairs({ 0, 90, 180, 270 }) do + local r = math.rad(a) + P({ Size = V(10, 1.0, 48), CFrame = CFrame.new(math.cos(r) * 60, 0.52, math.sin(r) * 60) * CFrame.Angles(0, -r + math.pi / 2, 0), Material = Enum.Material.Marble, Color = Color3.fromRGB(225, 218, 205) }) + end + + marker("LobbySpawn", CFrame.new(0, FLOOR + 2, 57)) -- на дорожке за табличкой «Как играть»: сначала она, дальше портал в Мир 1 + + -- фонтан со статуей золотой рыбы + vcyl(V(0, FLOOR + 1, 0), 2, 24, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) + vcyl(V(0, FLOOR + 1.6, 0), 1.0, 21, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 }) + vcyl(V(0, FLOOR + 4, 0), 6, 3, { Material = Enum.Material.Slate, Color = Color3.fromRGB(190, 185, 175) }) + local bowl = vcyl(V(0, FLOOR + 7.3, 0), 1, 9, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) }) + vcyl(V(0, FLOOR + 7.75, 0), 0.2, 8, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 }) + do + local statue = Models.buildFish("Gold", "Golden", 3.2, true) + statue:PivotTo(CFrame.new(0, FLOOR + 12, 0) * CFrame.Angles(0, math.rad(30), math.rad(40))) + statue.Parent = map + local sp = Instance.new("ParticleEmitter") + sp.Texture = "rbxasset://textures/particles/sparkles_main.dds" + sp.Rate = 12 + sp.LightEmission = 1 + sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90)) + sp.Size = NumberSequence.new(0.6, 0) + sp.Lifetime = NumberRange.new(1, 1.5) + sp.SpreadAngle = Vector2.new(180, 180) + sp.Speed = NumberRange.new(1, 2) + sp.Parent = statue.PrimaryPart + -- струи воды + local att = Instance.new("Attachment") + att.Position = V(0.6, 0, 0) -- у повёрнутого цилиндра ось X смотрит вверх + att.Orientation = V(0, 0, -90) -- направить струю вверх + att.Parent = bowl + local water = Instance.new("ParticleEmitter") + water.Color = ColorSequence.new(Color3.fromRGB(200, 235, 255)) + water.Transparency = NumberSequence.new(0.3, 1) + water.Size = NumberSequence.new(0.6, 1.2) + water.Rate = 60 + water.Lifetime = NumberRange.new(1.2, 1.5) + water.Speed = NumberRange.new(10, 12) + water.SpreadAngle = Vector2.new(25, 25) + water.Acceleration = V(0, -25, 0) + water.Parent = att + end + -- скамейки по внешнему краю площади, между порталами, лицом к фонтану + for _, deg in ipairs({ 45, 135, 225, 315 }) do + local a = math.rad(deg) + for _, side in ipairs({ -1, 1 }) do + local b = a + side * math.rad(9) + bench(CFrame.lookAt(V(math.cos(b) * 34, FLOOR, math.sin(b) * 34), V(0, FLOOR, 0))) + end + end + + -- фонари по кругу (у спавна — за спиной игрока, чтобы не закрывали табличку и сундук) + for i = 0, 7 do + local deg = i * 45 + 22.5 + if deg ~= 67.5 and deg ~= 112.5 then + local a = math.rad(deg) + lamp(V(math.cos(a) * 40, FLOOR, math.sin(a) * 40)) + end + end + lamp(V(7, FLOOR, 48)) -- левый фонарь стоит за табличкой «Как играть» + + -- клумбы с деревьями + for _, deg in ipairs({ 225, 315 }) do + local a = math.rad(deg) + local p = V(math.cos(a) * 58, FLOOR, math.sin(a) * 58) + vcyl(p + V(0, 1, 0), 2, 12, { Material = Enum.Material.Brick, Color = Color3.fromRGB(150, 95, 70) }) + vcyl(p + V(0, 1.6, 0), 1.0, 11, { Material = Enum.Material.Grass, Color = Color3.fromRGB(70, 140, 60) }) + tree(p + V(0, 2, 0), "round") + for j = 1, 5 do + local b = rng:NextNumber(0, math.pi * 2) + ball(p + V(math.cos(b) * 4, 2.4, math.sin(b) * 4), 0.8, { Color = ({ Color3.fromRGB(255, 110, 140), Color3.fromRGB(255, 220, 80), Color3.fromRGB(170, 120, 255) })[rng:NextInteger(1, 3)] }) + end + end + + -- баннеры + local bannerData = { + { 15, Color3.fromRGB(40, 110, 200), "🎣", "Лови!" }, + { 70, Color3.fromRGB(240, 140, 40), "🐟", "Продавай" }, + { 110, Color3.fromRGB(40, 110, 200), "⭐", "Качайся" }, + { 165, Color3.fromRGB(240, 140, 40), "🍀", "Удача" }, + { 205, Color3.fromRGB(40, 110, 200), "🏆", "Рекорды" }, + { 335, Color3.fromRGB(240, 140, 40), "💎", "Мифика" }, + } + for _, b in ipairs(bannerData) do + local a = math.rad(b[1]) + banner(V(math.cos(a) * 74, FLOOR, math.sin(a) * 74), b[2], b[3], b[4]) + end + + -- высокий скальный контур закрывает горизонт и удерживает игроков в лобби + lobbyCliffs() + lobbyTrees() + lobbyRockPlants() + lobbyHills() + + -- магазин (запад) и скупка (восток) + stall(CFrame.lookAt(V(-62, FLOOR, 0), V(0, FLOOR, 0)), { + title = "🎣 УДОЧКИ И СНАРЯЖЕНИЕ", + titleColor = Color3.fromRGB(255, 230, 120), + wall = Color3.fromRGB(185, 130, 85), + stripeA = Color3.fromRGB(215, 55, 55), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(255, 170, 60), + action = "Shop", + promptText = "Открыть магазин", + promptObject = "Магазин", + npcName = "Продавец Михалыч", + npcColors = { skin = Color3.fromRGB(234, 184, 146), shirt = Color3.fromRGB(200, 60, 50), pants = Color3.fromRGB(60, 70, 100), hat = Color3.fromRGB(90, 110, 60) }, + decor = function(at) + -- витрина удочек на задней стене + for i, rod in ipairs(Config.Rods) do + local x = -8 + (i - 1) * 4 + local m = Models.buildRod(rod.id, 0, true) + m:PivotTo(at(x, 3, 7) * CFrame.Angles(math.rad(80), 0, 0)) + m.Parent = map + local plaque = P({ Size = V(3.6, 1.6, 0.2), CFrame = at(x, 11.7, 7.4), Material = Enum.Material.Wood, Color = Color3.fromRGB(60, 40, 25) }) + surfaceText(plaque, Enum.NormalId.Front, rod.name .. "\n" .. (rod.price > 0 and (rod.price .. " 💰") or "бесплатно"), Color3.fromRGB(255, 235, 180)) + end + end, + }) + + stall(CFrame.lookAt(V(62, FLOOR, 0), V(0, FLOOR, 0)), { + title = "💰 СКУПКА РЫБЫ", + titleColor = Color3.fromRGB(150, 255, 160), + wall = Color3.fromRGB(110, 150, 175), + stripeA = Color3.fromRGB(50, 150, 80), + stripeB = Color3.fromRGB(245, 240, 230), + glow = Color3.fromRGB(80, 230, 120), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщица Зина", + npcColors = { skin = Color3.fromRGB(240, 195, 160), shirt = Color3.fromRGB(60, 120, 170), pants = Color3.fromRGB(50, 50, 60), hat = Color3.fromRGB(230, 230, 230) }, + decor = function(at) + -- лёд с рыбой на прилавке + P({ Size = V(10, 0.4, 3), CFrame = at(-3, 5.7, -4), Material = Enum.Material.Glass, Color = Color3.fromRGB(200, 235, 255), Transparency = 0.2 }) + for i, id in ipairs({ "Karas", "Okun", "Shuka" }) do + local f = Models.buildFish(id, nil, 0.9, true) + f:PivotTo(at(-6.5 + i * 2.5, 6.2, -4) * CFrame.Angles(math.rad(90), 0, math.rad(90))) + f.Parent = map + end + -- весы + P({ Size = V(2, 0.5, 2), CFrame = at(6, 5.75, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) }) + P({ Size = V(0.3, 1.4, 0.3), CFrame = at(6, 6.7, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 2.4, 2.4), CFrame = at(6, 7.45, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(200, 200, 205) }) + -- ящики с уловом + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(3, 2, 3), CFrame = at(s * 14.5, 2, 2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) }) + local f = Models.buildFish(s < 0 and "Lesh" or "Sudak", nil, 0.7, true) + f:PivotTo(at(s * 14.5, 3.3, 2) * CFrame.Angles(math.rad(90), 0, 0)) + f.Parent = map + end + end, + }) + + -- арка с названием + arch(CFrame.lookAt(V(0, FLOOR, -66), V(0, FLOOR, 0)), 84, 24, "🎣 " .. string.upper(Config.GameName) .. " 🎣", Color3.fromRGB(255, 190, 60)) + + -- порталы по кругу у фонтана, лицом наружу; первый (бесплатный) мир — прямо перед точкой появления + local PORTAL_R = 19 + for i, w in ipairs(Config.Worlds) do + local title = w.icon .. " " .. w.name .. (w.level > 1 and (" (ур. " .. w.level .. ")") or "") + local a = math.rad(90 - (i - 1) * 90) -- 90° = сторона спавна (+Z) + local pos = V(math.cos(a) * PORTAL_R, FLOOR, math.sin(a) * PORTAL_R) + local disc = portal(CFrame.lookAt(pos, V(pos.X * 2, FLOOR, pos.Z * 2)), title, w.color, w.id, w.soon) + if i == 1 then + disc:SetAttribute("GuideTarget", "Portal") + marker("GuidePortal", CFrame.new(pos.X * 1.3, FLOOR, pos.Z * 1.3)) -- точка перед порталом для линии-подсказки + end + end + + -- невидимая стена по кругу: из лобби не уйти + for deg = 0, 359, 5 do + local a = math.rad(deg) + local p = V(math.cos(a) * 86, 30, math.sin(a) * 86) + P({ Size = V(8, 60, 2), CFrame = CFrame.lookAt(p, V(0, 30, 0)), Transparency = 1, CanQuery = false }) + end + + -- донат-лавки + stall(CFrame.lookAt(V(41, FLOOR, 41), V(0, FLOOR, 0)), { + title = "💎 ПРЕМИУМ", + titleColor = Color3.fromRGB(255, 220, 120), + wall = Color3.fromRGB(120, 70, 170), + stripeA = Color3.fromRGB(255, 200, 60), + stripeB = Color3.fromRGB(150, 80, 210), + glow = Color3.fromRGB(255, 200, 60), + action = "RobuxPasses", + promptText = "Открыть", + promptObject = "Премиум-пропуска", + npcName = "Барон Злотов", + npcColors = { skin = Color3.fromRGB(230, 185, 150), shirt = Color3.fromRGB(110, 40, 140), pants = Color3.fromRGB(30, 30, 40), hat = Color3.fromRGB(255, 200, 60) }, + decor = function(at) + -- сундук с самоцветами + P({ Size = V(4, 2, 2.5), CFrame = at(-5, 6.5, -4), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(120, 75, 40) }) + P({ Size = V(4.2, 0.4, 2.7), CFrame = at(-5, 7.6, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) }) + for i, c in ipairs({ Color3.fromRGB(255, 60, 90), Color3.fromRGB(80, 200, 255), Color3.fromRGB(120, 255, 120), Color3.fromRGB(200, 100, 255) }) do + P({ Size = V(0.7, 0.7, 0.7), CFrame = at(-6.5 + i * 0.75, 8.1, -4) * CFrame.Angles(0.6, i, 0.6), Material = Enum.Material.Neon, Color = c }) + end + P({ Size = V(3, 4, 0.3), CFrame = at(5, 7.5, -4.8), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 200, 60) }) + end, + }) + stall(CFrame.lookAt(V(-41, FLOOR, 41), V(0, FLOOR, 0)), { + title = "🪙 СОКРОВИЩНИЦА", + titleColor = Color3.fromRGB(255, 235, 140), + wall = Color3.fromRGB(200, 160, 70), + stripeA = Color3.fromRGB(230, 180, 40), + stripeB = Color3.fromRGB(255, 250, 230), + glow = Color3.fromRGB(255, 220, 90), + action = "RobuxProducts", + promptText = "Открыть", + promptObject = "Наборы монет", + npcName = "Купчиха Злата", + npcColors = { skin = Color3.fromRGB(240, 200, 165), shirt = Color3.fromRGB(220, 170, 50), pants = Color3.fromRGB(90, 50, 30), hat = Color3.fromRGB(180, 40, 40) }, + decor = function(at) + -- горки монет + for i = 0, 4 do + for j = 0, 3 - (i % 3) do + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 0.9, 0.9), CFrame = at(-7 + i * 1.2, 5.6 + j * 0.2, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 205, 60) }) + end + end + for _, s in ipairs({ -1, 1 }) do + ball(at(s * 14.5, 2.2, 2).Position, 2.6, { Color = Color3.fromRGB(190, 160, 110), Material = Enum.Material.Fabric }) + ball(at(s * 14.5, 3.5, 2).Position, 1.2, { Color = Color3.fromRGB(255, 205, 60), Material = Enum.Material.Metal }) + end + end, + }) + + -- сундук с ежедневной наградой + do + local cf = CFrame.lookAt(V(14, FLOOR, 34), V(0, FLOOR, 50)) + local base = P({ Size = V(5, 3, 3.2), CFrame = cf * CFrame.new(0, 1.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 90, 50) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 3.2, 3.2), CFrame = cf * CFrame.new(0, 3, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 105, 60) }) + for _, x in ipairs({ -1.8, 1.8 }) do + P({ Size = V(0.4, 4.9, 3.4), CFrame = cf * CFrame.new(x, 2.3, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) }) + end + P({ Size = V(0.9, 1.1, 0.3), CFrame = cf * CFrame.new(0, 2.8, -1.7), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 220, 90) }) + local sp = Instance.new("ParticleEmitter") + sp.Texture = "rbxasset://textures/particles/sparkles_main.dds" + sp.Rate = 8 + sp.LightEmission = 1 + sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90)) + sp.Size = NumberSequence.new(0.5, 0) + sp.Parent = base + billboard(base, "🎁 Ежедневная награда", Color3.fromRGB(255, 220, 120), 5, 260) + prompt(base, "Забрать", "Сундук", "Daily", 12) + end + + -- табличка «Как играть» + do + -- слева от дорожки за точкой появления, лицом к камере игрока; фонарь — за табличкой + local pos = V(-12, FLOOR, 48) + local cf = CFrame.lookAt(pos, V(0, FLOOR, 64)) + lamp((cf * CFrame.new(0, 0, 2.5)).Position) + marker("GuideBoard", cf * CFrame.new(0, 0, -6)) -- перед табличкой, для линии-подсказки + for _, x in ipairs({ -6.5, 6.5 }) do + P({ Size = V(0.8, 9, 0.8), CFrame = cf * CFrame.new(x, 4.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Size = V(14, 8, 0.5), CFrame = cf * CFrame.new(0, 6, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + board:SetAttribute("GuideTarget", "Board") -- подсвечивается на шаге обучения + surfaceText(board, Enum.NormalId.Front, + "КАК ИГРАТЬ\n1. Портал «Мир 1» или кнопка 🌍 Миры\n2. Удочка — клавиша 1, у воды зажми ЛКМ и отпусти\n3. Клюёт → кликай в зелёную зону\n4. 🎒 Сумка — B, 📜 Задания — Q\n5. Собирай коллекцию — получай награды!", + Color3.fromRGB(255, 245, 225), { TextXAlignment = Enum.TextXAlignment.Left }) + end + + ---------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО + do + -- отдельно собранное раньше «Тихое озеро» (Workspace.World1Map) переносим в карту, иначе строим заново + local w1map = world1Prebuilt or World1Builder.build(map, Builder.portalModel) + w1map.Parent = map + local baitShop = not world1Prebuilt and w1map:FindFirstChild("BaitShop", true) + if baitShop then + Builder.lowPolyParts(baitShop:GetDescendants(), baitShop:GetPivot(), 11) + end + -- NPC встают на маркеры — их можно двигать в Studio + local seller = w1map:FindFirstChild("World1NpcSeller", true) + if seller and not seller:GetAttribute("NpcName") then + setNpc(seller, "Скупщик Гриша", { + skin = Color3.fromRGB(234, 190, 150), shirt = Color3.fromRGB(236, 228, 210), + pants = Color3.fromRGB(70, 110, 76), hat = Color3.fromRGB(226, 196, 122), + }) + end + local grandpa = w1map:FindFirstChild("World1NpcGrandpa", true) + if grandpa and not grandpa:GetAttribute("NpcName") then + setNpc(grandpa, "Дед Петрович", { + skin = Color3.fromRGB(225, 175, 140), shirt = Color3.fromRGB(110, 120, 80), pants = Color3.fromRGB(70, 60, 45), hat = Color3.fromRGB(90, 110, 60), + }, "Talk", "Поговорить") + end + local board = w1map:FindFirstChild("World1Bestiary", true) + if board and not board:GetAttribute("Bestiary") then + setBestiary(board, "World1", "🐟 КТО ВОДИТСЯ В ОЗЕРЕ", "#9BE7FF") + end + end + + -- причал (используется в Мире 2): настил и сваи; возвращает настил + local function pier(center, size) + local deck = P({ Size = size, Position = center, Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) }) + local alongZ = size.Z > size.X + local len = alongZ and size.Z or size.X + local wid = alongZ and size.X or size.Z + for d = -len / 2 + 1, len / 2 - 1, 6 do + for _, s in ipairs({ -1, 1 }) do + local off = alongZ and V(s * (wid / 2 - 0.4), 0, d) or V(d, 0, s * (wid / 2 - 0.4)) + vcyl(center + off + V(0, -6, 0), 13, 0.9, { Color = Color3.fromRGB(100, 70, 45), Material = Enum.Material.Wood }) + end + end + return deck + end + + ---------------------------------------------------------------- помощники для новых миров + + local function cylA(a, b, d, props) + props.Shape = Enum.PartType.Cylinder + props.Size = V(math.max(0.05, (b - a).Magnitude), d, d) + props.CFrame = CFrame.lookAt((a + b) / 2, b) * CFrame.Angles(0, math.rad(90), 0) + return P(props) + end + + local function worldWalls(center) + for _, w in ipairs({ + { V(0, 0, 245), V(500, 160, 2) }, + { V(0, 0, -245), V(500, 160, 2) }, + { V(245, 0, 0), V(2, 160, 500) }, + { V(-245, 0, 0), V(2, 160, 500) }, + }) do + P({ Size = w[2], Position = center + w[1] + V(0, 60, 0), Transparency = 1, CanQuery = false }) + end + end + + local function bestiary(pos, lookAt, worldId, title, titleHex) + local cf = CFrame.lookAt(pos, lookAt) + for _, x in ipairs({ -6, 6 }) do + P({ Size = V(0.8, 11, 0.8), CFrame = cf * CFrame.new(x, 5.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) }) + end + local board = P({ Name = worldId .. "Bestiary", Size = V(13, 10, 0.5), CFrame = cf * CFrame.new(0, 7, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) }) + setBestiary(board, worldId, title, titleHex) + end + + local function campfire(c) + for i = 0, 7 do + local a = i / 8 * math.pi * 2 + ball(c + V(math.cos(a) * 2.2, 0.3, math.sin(a) * 2.2), 1, { Color = Color3.fromRGB(120, 120, 125), Material = Enum.Material.Rock }) + end + for i = 0, 2 do + P({ Shape = Enum.PartType.Cylinder, Size = V(3, 0.6, 0.6), CFrame = CFrame.new(c + V(0, 0.4, 0)) * CFrame.Angles(0, i * math.pi / 3, 0), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 35) }) + end + local base = P({ Size = V(1, 1, 1), Position = c + V(0, 0.8, 0), Transparency = 1, CanCollide = false }) + local fire = Instance.new("Fire") + fire.Size = 5 + fire.Heat = 9 + fire.Parent = base + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 160, 80) + light.Range = 20 + light.Brightness = 2 + light.Parent = base + end + + local function torch(pos) + cylA(pos, pos + V(0, 5, 0), 0.35, { Color = Color3.fromRGB(170, 130, 70), Material = Enum.Material.Wood }) + local top = P({ Size = V(0.8, 0.8, 0.8), Position = pos + V(0, 5.3, 0), Color = Color3.fromRGB(90, 60, 30), Material = Enum.Material.Wood }) + local fire = Instance.new("Fire") + fire.Size = 3 + fire.Heat = 6 + fire.Parent = top + local light = Instance.new("PointLight") + light.Color = Color3.fromRGB(255, 170, 90) + light.Range = 14 + light.Parent = top + end + + ---------------------------------------------------------------- МИР 2: ТРОПИЧЕСКИЙ ОСТРОВ + + do + local W2 = Config.Worlds[2].center + local leafColors = { Color3.fromRGB(60, 160, 60), Color3.fromRGB(85, 185, 70) } + + -- море, мелководье уступами, песчаный пляж, зелёный остров, холм + terrain:FillBlock(CFrame.new(W2 + V(0, -34, 0)), V(520, 8, 520), Enum.Material.Sand) + terrain:FillBlock(CFrame.new(W2 + V(0, -15, 0)), V(520, 30, 520), Enum.Material.Water) + terrain:FillCylinder(CFrame.new(W2 + V(0, -17, 0)), 28, 140, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -15, 0)), 32, 118, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -14, 0)), 34, 106, Enum.Material.Sand) + terrain:FillCylinder(CFrame.new(W2 + V(0, -13.5, 0)), 35, 88, Enum.Material.Grass) + terrain:FillBall(W2 + V(20, -20, -30), 32, Enum.Material.Grass) + terrain:FillCylinder(CFrame.new(W2 + V(0, 2, 40)), 4, 14, Enum.Material.Sandstone) + + local function palm(pos) + local h = rng:NextNumber(12, 18) + local a = rng:NextNumber(0, math.pi * 2) + local dir = V(math.cos(a), 0, math.sin(a)) + local p = pos + for i = 1, 6 do + local t = i / 6 + local q = pos + V(0, h * t, 0) + dir * (t * t * h * 0.3) + local d = 1.4 - t * 0.45 + cylA(p, q, d, { Color = Color3.fromRGB(150, 115, 70), Material = Enum.Material.Wood }) + ball(q, d, { Color = Color3.fromRGB(130, 100, 60), Material = Enum.Material.Wood }) + p = q + end + for k = 0, 7 do + local b = k / 8 * math.pi * 2 + rng:NextNumber(-0.2, 0.2) + local ld = V(math.cos(b), 0, math.sin(b)) + local mid = p + ld * 3.5 + V(0, 0.8, 0) + local tipP = p + ld * 7 + V(0, -2.2, 0) + for _, seg in ipairs({ { p, mid }, { mid, tipP } }) do + P({ Size = V(2, 0.15, (seg[2] - seg[1]).Magnitude), CFrame = CFrame.lookAt((seg[1] + seg[2]) / 2, seg[2]), Material = Enum.Material.Grass, Color = leafColors[k % 2 + 1], CanCollide = false }) + end + end + for _ = 1, 3 do + ball(p + V(rng:NextNumber(-0.7, 0.7), -0.7, rng:NextNumber(-0.7, 0.7)), 0.9, { Color = Color3.fromRGB(110, 75, 40) }) + end + end + + local function tikiHut(pos, look) + local cf = CFrame.lookAt(pos, look) + P({ Size = V(12, 1, 12), CFrame = cf * CFrame.new(0, 0.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 120, 75) }) + for _, c in ipairs({ { -5, -5 }, { 5, -5 }, { -5, 5 }, { 5, 5 } }) do + vcyl((cf * CFrame.new(c[1], 4.5, c[2])).Position, 8, 0.8, { Color = Color3.fromRGB(200, 175, 100), Material = Enum.Material.Wood }) + end + for i = 0, 4 do + vcyl((cf * CFrame.new(0, 8.8 + i * 1.2, 0)).Position, 1.4, 16 - i * 3.2, { Color = Color3.fromRGB(205, 170, 95), Material = Enum.Material.Grass }) + end + local bar = P({ Size = V(7, 3, 1.5), CFrame = cf * CFrame.new(0, 2.5, -3), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 95, 55) }) + billboard(bar, "🍹", Color3.new(1, 1, 1), 3, 60) + end + + local function umbrella(pos, color) + cylA(pos, pos + V(0, 7, 0), 0.25, { Color = Color3.fromRGB(235, 235, 235), Material = Enum.Material.Metal }) + vcyl(pos + V(0, 7, 0), 0.6, 9, { Color = color, Material = Enum.Material.Fabric }) + vcyl(pos + V(0, 7.5, 0), 0.6, 4.5, { Color = Color3.new(1, 1, 1), Material = Enum.Material.Fabric }) + P({ Size = V(2.2, 0.5, 6), CFrame = CFrame.new(pos + V(3.5, 0.6, 0)) * CFrame.Angles(0, rng:NextNumber(-0.5, 0.5), 0), Color = Color3.fromRGB(245, 245, 240), Material = Enum.Material.Fabric }) + P({ Size = V(2.25, 0.52, 1.2), CFrame = CFrame.new(pos + V(3.5, 0.62, 1.5)), Color = color, Material = Enum.Material.Fabric }) + end + + local coralColors = { Color3.fromRGB(255, 110, 150), Color3.fromRGB(255, 150, 60), Color3.fromRGB(170, 90, 255), Color3.fromRGB(255, 220, 80), Color3.fromRGB(80, 220, 200) } + local function coral(pos) + local c = coralColors[rng:NextInteger(1, #coralColors)] + for _ = 1, rng:NextInteger(3, 5) do + local dir = V(rng:NextNumber(-0.5, 0.5), 1, rng:NextNumber(-0.5, 0.5)).Unit + local h = rng:NextNumber(1.5, 3.5) + cylA(pos, pos + dir * h, 0.45, { Color = c, CanCollide = false }) + ball(pos + dir * h, 0.75, { Color = c:Lerp(Color3.new(1, 1, 1), 0.3), CanCollide = false }) + end + end + + local function starfish(pos) + local c = Color3.fromRGB(255, rng:NextInteger(90, 150), 60) + ball(pos, 0.7, { Color = c, CanCollide = false }) + for k = 0, 4 do + local a = k / 5 * math.pi * 2 + P({ Size = V(0.35, 0.2, 1.1), CFrame = CFrame.new(pos) * CFrame.Angles(0, a, 0) * CFrame.new(0, 0, -0.6), Color = c, CanCollide = false }) + end + end + + local spawn2 = W2 + V(0, 4, 40) + marker("World2Spawn", CFrame.lookAt(spawn2 + V(0, 1, 0), spawn2 + V(0, 1, -10))) + arch(CFrame.new(W2 + V(0, 4, 24)), 14, 11, "🏝 ТРОПИЧЕСКИЙ ОСТРОВ", Color3.fromRGB(255, 190, 70)) + portal(CFrame.lookAt(W2 + V(-32, 4, 60), spawn2), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") + stall(CFrame.lookAt(W2 + V(32, 4, 62), spawn2), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(150, 255, 220), + wall = Color3.fromRGB(200, 170, 110), + stripeA = Color3.fromRGB(40, 180, 170), + stripeB = Color3.fromRGB(255, 250, 230), + glow = Color3.fromRGB(80, 230, 200), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщик Мигель", + npcColors = { skin = Color3.fromRGB(190, 140, 100), shirt = Color3.fromRGB(240, 120, 60), pants = Color3.fromRGB(240, 230, 200), hat = Color3.fromRGB(230, 210, 150) }, + }) + bestiary(W2 + V(-18, 4, 22), spawn2, "World2", "🐠 КТО ВОДИТСЯ У ОСТРОВА", "#FFD27A") + npc("Капитан Боря", CFrame.lookAt(W2 + V(10, 6, 100), W2 + V(0, 6, 120)), { + skin = Color3.fromRGB(225, 175, 140), shirt = Color3.fromRGB(240, 240, 240), pants = Color3.fromRGB(30, 40, 80), hat = Color3.fromRGB(30, 30, 60), + }, "Talk", "Поговорить") + + pier(W2 + V(0, 3.2, 125), V(8, 0.6, 50)) + pier(W2 + V(125, 3.2, -10), V(50, 0.6, 8)) + for _, z in ipairs({ 105, 125, 145 }) do + torch(W2 + V(4.5, 3.5, z)) + end + for _, x in ipairs({ 110, 140 }) do + torch(W2 + V(x, 3.5, -14.5)) + end + tikiHut(W2 + V(-50, groundY(W2.X - 50, W2.Z - 20), -20), W2) + tikiHut(W2 + V(-20, groundY(W2.X - 20, W2.Z - 65), -65), W2) + campfire(W2 + V(-10, 4, 55)) + for _, deg in ipairs({ 200, 222, 318, 340 }) do + local a = math.rad(deg) + local x, z = math.cos(a) * 99, math.sin(a) * 99 + umbrella(W2 + V(x, groundY(W2.X + x, W2.Z + z), z), coralColors[rng:NextInteger(1, #coralColors)]) + end + + local function free2(x, z) + local r = math.sqrt(x * x + z * z) + if r > 100 then + return false + end + if (V(x, 0, z) - V(0, 0, 45)).Magnitude < 28 then + return false + end + for _, p in ipairs({ { 32, 62 }, { -32, 60 }, { -50, -20 }, { -20, -65 }, { -18, 22 }, { -10, 55 } }) do + if (V(x, 0, z) - V(p[1], 0, p[2])).Magnitude < 16 then + return false + end + end + return true + end + local count = 0 + for _ = 1, 300 do + if count >= 40 then + break + end + local x, z = rng:NextNumber(-100, 100), rng:NextNumber(-100, 100) + if free2(x, z) then + palm(W2 + V(x, groundY(W2.X + x, W2.Z + z) - 0.5, z)) + count += 1 + end + end + for _ = 1, 35 do + local a = rng:NextNumber(0, math.pi * 2) + local r = rng:NextNumber(121, 138) + local x, z = math.cos(a) * r, math.sin(a) * r + if not (math.abs(x) < 8 and z > 0) and not (math.abs(z + 10) < 8 and x > 0) then + coral(W2 + V(x, groundY(W2.X + x, W2.Z + z) - 0.3, z)) + end + end + for _ = 1, 12 do + local a = rng:NextNumber(0, math.pi * 2) + local r = rng:NextNumber(107, 115) + local x, z = math.cos(a) * r, math.sin(a) * r + starfish(W2 + V(x, groundY(W2.X + x, W2.Z + z) + 0.1, z)) + end + worldWalls(W2) + end + + ---------------------------------------------------------------- МИР 3: ЛЕДЯНОЙ ФЬОРД + + do + local W3 = Config.Worlds[3].center + local LAKES3 = Config.Worlds[3].lakes + local HOLES = Config.Worlds[3].holes + + terrain:FillBlock(CFrame.new(W3 + V(0, -10, 0)), V(500, 28, 500), Enum.Material.Snow) + for i = 0, 13 do + local a = i / 14 * math.pi * 2 + local r = rng:NextNumber(215, 235) + local rad = rng:NextNumber(50, 70) + local c = W3 + V(math.cos(a) * r, -15, math.sin(a) * r) + terrain:FillBall(c, rad, Enum.Material.Rock) + terrain:FillBall(c + V(0, rad * 0.35, 0), rad * 0.7, Enum.Material.Snow) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], 16, l[2])), 30, l[3] + 4, Enum.Material.Air) + end + -- вода не вытесняет снег и лёд, поэтому место под неё сначала вырезаем воздухом + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -19, l[2])), 10, l[3], Enum.Material.Mud) + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -7, l[2])), 14, l[3], Enum.Material.Air) + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -7, l[2])), 14, l[3], Enum.Material.Water) + end + for _, l in ipairs(LAKES3) do + terrain:FillCylinder(CFrame.new(W3 + V(l[1], -1, l[2])), 4, l[3], Enum.Material.Glacier) + end + -- лунки режем прямо по вокселям: тонкая заливка в 4 стада не перекрывает ячейку льда целиком + local holeR = Config.Worlds[3].holeRadius or 6 + local waterY3 = Config.Worlds[3].waterY + for _, h in ipairs(HOLES) do + local c = W3 + V(h[1], 0, h[2]) + local region = Region3.new(c + V(-holeR, -12, -holeR), c + V(holeR, 8, holeR)):ExpandToGrid(4) + local mats, occ = terrain:ReadVoxels(region, 4) + local corner = region.CFrame.Position - region.Size / 2 + for x = 1, mats.Size.X do + for y = 1, mats.Size.Y do + for z = 1, mats.Size.Z do + local p = corner + V(x - 0.5, y - 0.5, z - 0.5) * 4 + if (V(p.X, 0, p.Z) - V(c.X, 0, c.Z)).Magnitude <= holeR then + local water = p.Y < waterY3 + mats[x][y][z] = water and Enum.Material.Water or Enum.Material.Air + occ[x][y][z] = water and 1 or 0 + end + end + end + end + terrain:WriteVoxels(region, 4, mats, occ) + end + + local function snowPine(pos) + local h = rng:NextNumber(8, 13) + vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(90, 62, 40), Material = Enum.Material.Wood }) + for i = 0, 3 do + local s = 10 - i * 2.2 + local y = h * 0.4 + i * 2.8 + ball(pos + V(0, y, 0), s, { Color = Color3.fromRGB(35, 85 + i * 8, 60), Material = Enum.Material.Grass }) + ball(pos + V(0, y + s * 0.3, 0), s * 0.75, { Color = Color3.fromRGB(240, 245, 255), Material = Enum.Material.Snow }) + end + end + + local function igloo(pos, look) + local cf = CFrame.lookAt(pos, look) + P({ Shape = Enum.PartType.Ball, Size = V(14, 14, 14), CFrame = cf, Material = Enum.Material.Snow, Color = Color3.fromRGB(240, 245, 255) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(5, 5, 5), CFrame = cf * CFrame.new(0, 1.2, -7) * CFrame.Angles(0, math.rad(90), 0), Material = Enum.Material.Snow, Color = Color3.fromRGB(235, 240, 250) }) + P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 3.6, 3.6), CFrame = cf * CFrame.new(0, 1.2, -9.55) * CFrame.Angles(0, math.rad(90), 0), Color = Color3.fromRGB(20, 25, 35) }) + end + + local function tent(pos, look) + local cf = CFrame.lookAt(pos, look) + for _, s in ipairs({ -1, 1 }) do + P({ Size = V(0.2, 5, 6), CFrame = cf * CFrame.new(s * 1.6, 2.2, 0) * CFrame.Angles(0, 0, math.rad(s * 35)), Material = Enum.Material.Fabric, Color = Color3.fromRGB(230, 110, 40) }) + end + vcyl((cf * CFrame.new(0, 0.9, -4.5)).Position, 1.6, 1.4, { Color = Color3.fromRGB(110, 80, 50), Material = Enum.Material.Wood }) + end + + local function crystal(pos) + for _ = 1, 5 do + local h = rng:NextNumber(3, 8) + P({ + Size = V(1.2, h, 1.2), + CFrame = CFrame.new(pos + V(rng:NextNumber(-2, 2), h / 2 - 0.5, rng:NextNumber(-2, 2))) * CFrame.Angles(rng:NextNumber(-0.4, 0.4), rng:NextNumber(0, 3), rng:NextNumber(-0.4, 0.4)), + Material = Enum.Material.Neon, Color = Color3.fromRGB(140, 230, 255), Transparency = 0.15, + }) + end + end + + local function snowman(pos) + ball(pos + V(0, 2, 0), 4, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + ball(pos + V(0, 5, 0), 3, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + ball(pos + V(0, 7.3, 0), 2.2, { Color = Color3.fromRGB(245, 248, 255), Material = Enum.Material.Snow }) + cylA(pos + V(0, 7.3, -1), pos + V(0, 7.2, -2), 0.3, { Color = Color3.fromRGB(255, 130, 30) }) + for _, x in ipairs({ -0.4, 0.4 }) do + ball(pos + V(x, 7.7, -0.95), 0.3, { Color = Color3.fromRGB(20, 20, 20) }) + end + vcyl(pos + V(0, 8.6, 0), 1.2, 1.4, { Color = Color3.fromRGB(30, 30, 35) }) + vcyl(pos + V(0, 8.1, 0), 0.2, 2.2, { Color = Color3.fromRGB(30, 30, 35) }) + end + + -- лунки: льдинки по краю и флажки + for i, h in ipairs(HOLES) do + local c = W3 + V(h[1], 1.2, h[2]) + for k = 0, 7 do + local a = k / 8 * math.pi * 2 + P({ Size = V(1.2, 0.6, 1.2), CFrame = CFrame.new(c + V(math.cos(a) * 6.6, 0, math.sin(a) * 6.6)) * CFrame.Angles(0, a, 0.2), Material = Enum.Material.Ice, Color = Color3.fromRGB(200, 235, 255) }) + end + if i % 3 == 1 then + cylA(c + V(6, -0.2, 6), c + V(6, 4, 6), 0.15, { Color = Color3.fromRGB(80, 60, 40) }) + P({ Size = V(1.4, 0.9, 0.1), Position = c + V(6.75, 3.5, 6), Material = Enum.Material.Fabric, Color = Color3.fromRGB(220, 40, 40) }) + end + if i % 4 == 0 then + tent(c + V(-9, -0.2, 0), c) + end + end + + local spawn3 = W3 + V(0, 4, 120) + marker("World3Spawn", CFrame.lookAt(spawn3 + V(0, 1, 0), spawn3 + V(0, 1, -10))) + arch(CFrame.new(W3 + V(0, 4, 104)), 14, 11, "❄ ЛЕДЯНОЙ ФЬОРД", Color3.fromRGB(150, 220, 255)) + portal(CFrame.lookAt(W3 + V(-32, 4, 140), spawn3), "🏠 В лобби", Color3.fromRGB(255, 200, 80), "Lobby") + stall(CFrame.lookAt(W3 + V(32, 4, 138), spawn3), { + title = "💰 СКУПКА", + titleColor = Color3.fromRGB(180, 230, 255), + wall = Color3.fromRGB(120, 95, 75), + stripeA = Color3.fromRGB(60, 120, 200), + stripeB = Color3.fromRGB(245, 250, 255), + glow = Color3.fromRGB(140, 210, 255), + action = "Sell", + promptText = "Продать всю рыбу", + promptObject = "Скупка", + npcName = "Скупщица Нина", + npcColors = { skin = Color3.fromRGB(240, 205, 175), shirt = Color3.fromRGB(180, 40, 50), pants = Color3.fromRGB(40, 40, 60), hat = Color3.fromRGB(240, 240, 250) }, + }) + bestiary(W3 + V(-20, 4, 100), spawn3, "World3", "❄ КТО ВОДИТСЯ ПОДО ЛЬДОМ", "#BFEAFF") + npc("Полярник Саша", CFrame.lookAt(W3 + V(12, 7, 88), W3 + V(0, 7, 60)), { + skin = Color3.fromRGB(230, 190, 160), shirt = Color3.fromRGB(230, 120, 30), pants = Color3.fromRGB(50, 55, 70), hat = Color3.fromRGB(200, 40, 40), + }, "Talk", "Поговорить") + igloo(W3 + V(-45, 4, 95), W3 + V(0, 4, 110)) + campfire(W3 + V(20, 4, 108)) + snowman(W3 + V(42, 4, 100)) + for _, p in ipairs({ { -85, -45 }, { 90, 30 }, { -25, -110 }, { 70, -90 }, { -95, 60 } }) do + crystal(W3 + V(p[1], groundY(W3.X + p[1], W3.Z + p[2]), p[2])) + end + + local function free3(x, z) + for _, l in ipairs(LAKES3) do + if (V(x, 0, z) - V(l[1], 0, l[2])).Magnitude < l[3] + 12 then + return false + end + end + if (V(x, 0, z) - V(0, 0, 120)).Magnitude < 40 then + return false + end + if (V(x, 0, z) - V(-45, 0, 95)).Magnitude < 14 then + return false + end + return true + end + local count = 0 + for _ = 1, 400 do + if count >= 80 then + break + end + local x, z = rng:NextNumber(-200, 200), rng:NextNumber(-200, 200) + if free3(x, z) then + snowPine(W3 + V(x, groundY(W3.X + x, W3.Z + z) - 0.5, z)) + count += 1 + end + end + + -- северное сияние + for i = 0, 7 do + P({ + Size = V(55, 26, 0.6), + CFrame = CFrame.new(W3 + V(-175 + i * 50, 150 + math.sin(i * 1.3) * 10, -150 + math.cos(i * 0.9) * 25)) * CFrame.Angles(math.rad(10), math.rad(i * 8 - 28), 0), + Material = Enum.Material.Neon, + Color = (i % 3 == 0) and Color3.fromRGB(170, 90, 255) or Color3.fromRGB(80, 255, 170), + Transparency = 0.6, CanCollide = false, CanQuery = false, CastShadow = false, + }) + end + worldWalls(W3) + end + + ---------------------------------------------------------------- проверка воды + -- Если вода в террейне не создалась (бывает в некоторых плейсах/настройках), + -- ставим поверхность воды из деталей, чтобы озёра и море точно были видны. + + local function terrainHasWater(pos) + local region = Region3.new(pos - V(2, 2, 2), pos + V(2, 2, 2)):ExpandToGrid(4) + local ok, mats = pcall(function() + return terrain:ReadVoxels(region, 4) + end) + if not ok then + return true + end + for _, plane in ipairs(mats) do + for _, column in ipairs(plane) do + for _, m in ipairs(column) do + if m == Enum.Material.Water then + return true + end + end + end + end + return false + end + + local function waterPlane(pos, diameter, color) + return P({ + Name = "WaterSurface", + Shape = Enum.PartType.Cylinder, + Size = V(0.4, diameter, diameter), + CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90)), + Color = color, + Material = Enum.Material.SmoothPlastic, + Reflectance = 0.08, + CanCollide = false, + CanQuery = false, + CanTouch = false, + CastShadow = false, + }) + end + + do + local w1, w2, w3 = Config.Worlds[1], Config.Worlds[2], Config.Worlds[3] + -- Мир 1: каждое озеро; нет воды — заливаем ещё раз, не помогло — поверхность из деталей. + -- Повторяем через несколько секунд на случай, если террейн перезаписал другой скрипт. + local planes = {} + -- материал вокселя (читаем воксели, а не лучом: физика террейна обновляется с задержкой) + local function voxelAt(pos) + local region = Region3.new(pos - V(1, 1, 1), pos + V(1, 1, 1)):ExpandToGrid(4) + local ok, mats = pcall(function() + return terrain:ReadVoxels(region, 4) + end) + return ok and mats[1] and mats[1][1] and mats[1][1][1] or nil + end + -- в центре озера: под поверхностью вода, над ней пусто + local function lakeState(l) + local c = w1.center + V(l[1], w1.waterY, l[2]) + return voxelAt(c - V(0, 2, 0)), voxelAt(c + V(0, 2, 0)) + end + local function lakeOk(below, above) + return below == nil or (below == Enum.Material.Water and above == Enum.Material.Air) + end + local function ensureLakeWater() + for i, l in ipairs(w1.lakes) do + local below, above = lakeState(l) + if not planes[i] and not lakeOk(below, above) then + warn(("[MapBuilder] Озеро %d Мира 1: под водой %s, над водой %s — заливаю заново"):format(i, tostring(below), tostring(above))) + World1Builder.carveLake(l) + below, above = lakeState(l) + if not lakeOk(below, above) then + warn(("[MapBuilder] Озеро %d Мира 1: всё ещё %s / %s — ставлю запасную поверхность воды"):format(i, tostring(below), tostring(above))) + planes[i] = waterPlane(w1.center + V(l[1], w1.waterY + 0.05, l[2]), l[3] * 2, Color3.fromRGB(30, 120, 150)) + end + end + end + end + -- уровень, собранный и поправленный руками в Studio, не трогаем: озеро там могли поменять намеренно + if not world1Prebuilt then + ensureLakeWater() + if RunService:IsRunning() then + task.delay(5, ensureLakeWater) + end + end + if not terrainHasWater(w2.center + V(180, -4, 0)) then + warn("[MapBuilder] Вода в террейне Мира 2 не создалась — ставлю запасную поверхность воды") + waterPlane(w2.center + V(0, w2.waterY, 0), 500, Color3.fromRGB(40, 180, 190)) + end + local h = w3.holes[1] + if not terrainHasWater(w3.center + V(h[1], -1, h[2])) then + warn("[MapBuilder] Вода в лунках Мира 3 не создалась — ставлю запасную поверхность воды") + for _, hole in ipairs(w3.holes) do + waterPlane(w3.center + V(hole[1], w3.waterY + 0.05, hole[2]), w3.holeRadius * 2, Color3.fromRGB(25, 75, 110)) + end + end + end + + map.Parent = Workspace + return map +end + +---------------------------------------------------------------- сборка в Studio + +function Builder.bake() + assert(not RunService:IsRunning(), "Собирайте карту в режиме редактирования, а не во время Play") + local old = Workspace:FindFirstChild("FishingMap") + if old then + -- «Тихое озеро» правят руками: переносим его в новую карту как есть (чтобы собрать заново — удалите World1Map) + local w1 = old:FindFirstChild("World1Map") + if w1 then + w1.Parent = Workspace + end + old:Destroy() + end + -- собранное раньше «Тихое озеро» (Workspace.World1Map) сохраняем вместе с его террейном + local keepWorld1 = Workspace:FindFirstChild("World1Map") ~= nil + for i = 1, 3 do + if i ~= 1 or not keepWorld1 then + terrain:FillBlock(CFrame.new(Config.Worlds[i].center + V(0, 30, 0)), V(680, 260, 680), Enum.Material.Air) + end + end + Builder.applyLighting() + local built = Builder.build() + print(("✅ Карта собрана: Workspace.FishingMap, деталей: %d. Сохраните плейс (Ctrl+S)."):format(#built:GetDescendants())) + return built +end + +---------------------------------------------------------------- при запуске игры + +local function spawnNpc(spot, parent) + local function color(name, default) + return spot:GetAttribute(name) or default + end + local name = spot:GetAttribute("NpcName") + local colors = { + skin = color("SkinColor", Color3.fromRGB(234, 184, 146)), + shirt = color("ShirtColor", Color3.fromRGB(200, 60, 50)), + pants = color("PantsColor", Color3.fromRGB(60, 70, 100)), + hat = color("HatColor", Color3.fromRGB(90, 110, 60)), + } + local ok, rig = pcall(function() + local d = Instance.new("HumanoidDescription") + d.HeadColor = colors.skin + d.LeftArmColor = colors.skin + d.RightArmColor = colors.skin + d.TorsoColor = colors.shirt + d.LeftLegColor = colors.pants + d.RightLegColor = colors.pants + return Players:CreateHumanoidModelFromDescription(d, Enum.HumanoidRigType.R15) + end) + if not ok or not rig then + warn("NPC не создан: " .. tostring(rig)) + return nil + end + rig.Name = name + local hum = rig:FindFirstChildOfClass("Humanoid") + hum.DisplayName = name + hum.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff + hum.NameDisplayDistance = 60 + local root = rig:FindFirstChild("HumanoidRootPart") + root.Anchored = true + rig:PivotTo(spot.CFrame) + rig.Parent = parent + + local head = rig:FindFirstChild("Head") + if head then + if not head:FindFirstChildOfClass("Decal") then + local face = Instance.new("Decal") + face.Name = "face" + face.Texture = "rbxasset://textures/face.png" + face.Parent = head + end + -- панама рыбака + local function hatPart(size, offset, shape) + local p = Instance.new("Part") + p.Shape = shape + p.Size = size + p.CanCollide = false + p.Massless = true + p.Color = colors.hat + p.Material = Enum.Material.Fabric + p.CFrame = head.CFrame * offset + local w = Instance.new("Weld") + w.Part0 = head + w.Part1 = p + w.C0 = head.CFrame:Inverse() * p.CFrame + w.Parent = p + p.Parent = rig + return p + end + if spot:GetAttribute("Look") == "Elder" then + -- Старейшина Ворон: седые волосы и борода (цвет HatColor), чёрная повязка на глазу + local function elderPart(size, offset, color, shape) + local p = hatPart(size, offset, shape or Enum.PartType.Block) + p.Color = color + p.Material = Enum.Material.SmoothPlastic + end + elderPart(V(1.25, 0.35, 1.25), CFrame.new(0, 0.55, 0.05), colors.hat) + elderPart(V(1.0, 0.75, 0.35), CFrame.new(0, -0.55, -0.5), colors.hat) + elderPart(V(0.32, 0.3, 0.08), CFrame.new(0.22, 0.12, -0.6), Color3.fromRGB(20, 20, 22)) + elderPart(V(1.24, 0.08, 1.24), CFrame.new(0, 0.18, 0) * CFrame.Angles(0, 0, math.rad(-12)), Color3.fromRGB(20, 20, 22)) + else + 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 + 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/src/StarterPlayer/StarterPlayerScripts/Ambience.client.lua b/src/StarterPlayer/StarterPlayerScripts/Ambience.client.lua new file mode 100644 index 0000000..5373d20 --- /dev/null +++ b/src/StarterPlayer/StarterPlayerScripts/Ambience.client.lua @@ -0,0 +1,336 @@ +-- Ambience (LocalScript) -> StarterPlayer > StarterPlayerScripts +-- Атмосфера у этого игрока: время суток, ночной свет, тучи, дождь/снег, молнии, музыка и звуки окружения, +-- плашка «погода и время» на экране. Время и погоду задаёт сервер (WeatherServer) атрибутами workspace. +-- Свет локации (Config.Worlds[*].look) ставит FishingClient; здесь всё накладывается поверх: +-- свои эффекты цвета живут в камере, поэтому не мешают настройкам локаций. + +local Players = game:GetService("Players") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local RunService = game:GetService("RunService") +local TweenService = game:GetService("TweenService") +local Lighting = game:GetService("Lighting") + +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) +local Audio = require(script.Parent:WaitForChild("Audio")) + +local player = Players.LocalPlayer +local terrain = workspace.Terrain +local rng = Random.new() +local WHITE = Color3.new(1, 1, 1) + +local function new(class, props) + local o = Instance.new(class) + for k, v in pairs(props) do + if k ~= "Parent" then + o[k] = v + end + end + o.Parent = props.Parent + return o +end + +local function clockNow() + return Config.ClockAt(workspace:GetServerTimeNow(), workspace:GetAttribute("DayStart")) +end + +local function currentPlace() + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if not hrp then + return nil, "Lobby" + end + local w = Config.WorldAt(hrp.Position) + return w, w and w.id or "Lobby" +end + +local function currentWeather() + return Config.WeatherById(workspace:GetAttribute("Weather")) +end + +---------------------------------------------------------------- вид погоды + +-- cc — поправка цвета поверх света локации; cover/density/cloud — облака; rain — частиц в секунду +local LOOK = { + Clear = { cover = 0.4, density = 0.45, cloud = Color3.fromRGB(255, 255, 255), rain = 0, + cc = { Brightness = 0, Saturation = 0, Contrast = 0, TintColor = WHITE } }, + Cloudy = { cover = 0.78, density = 0.6, cloud = Color3.fromRGB(215, 218, 226), rain = 0, + cc = { Brightness = -0.03, Saturation = -0.1, Contrast = 0, TintColor = Color3.fromRGB(236, 239, 246) } }, + Rain = { cover = 0.88, density = 0.75, cloud = Color3.fromRGB(165, 170, 182), rain = 350, rainSound = "rainLight", + cc = { Brightness = -0.06, Saturation = -0.18, Contrast = 0.02, TintColor = Color3.fromRGB(214, 224, 240) } }, + Storm = { cover = 0.96, density = 0.9, cloud = Color3.fromRGB(105, 110, 124), rain = 900, rainSound = "rainHeavy", lightning = true, + cc = { Brightness = -0.12, Saturation = -0.3, Contrast = 0.06, TintColor = Color3.fromRGB(190, 200, 226) } }, + Fog = { cover = 0.6, density = 0.5, cloud = Color3.fromRGB(232, 232, 238), rain = 0, + cc = { Brightness = 0.02, Saturation = -0.22, Contrast = -0.05, TintColor = Color3.fromRGB(234, 238, 242) } }, +} + +-- эффекты в камере: действуют только у этого игрока и не путаются с эффектами Lighting +local camera = workspace.CurrentCamera +local weatherCC = new("ColorCorrectionEffect", { Name = "WeatherCC", Parent = camera }) +local nightCC = new("ColorCorrectionEffect", { Name = "NightCC", Parent = camera }) +workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function() + camera = workspace.CurrentCamera + weatherCC.Parent = camera + nightCC.Parent = camera +end) + +local clouds = terrain:FindFirstChildOfClass("Clouds") or new("Clouds", { Parent = terrain }) + +-- дождь (а во фьорде — снег) сыплется из невидимой плиты над камерой +local rainPart = new("Part", { + Name = "RainFX", Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false, + Transparency = 1, Size = Vector3.new(110, 1, 110), Parent = workspace, +}) +local rain = new("ParticleEmitter", { + Texture = "rbxasset://textures/SelfView/whiteRect.png", + Rate = 0, Lifetime = NumberRange.new(1.1, 1.4), Speed = NumberRange.new(55, 70), + EmissionDirection = Enum.NormalId.Bottom, SpreadAngle = Vector2.new(4, 4), + Orientation = Enum.ParticleOrientation.VelocityParallel, + Size = NumberSequence.new(0.07), Squash = NumberSequence.new(2.5), + Color = ColorSequence.new(Color3.fromRGB(200, 215, 235)), Transparency = NumberSequence.new(0.45), + LightInfluence = 1, + Parent = rainPart, +}) + +local function rainStyle(snowy) + if snowy then + rain.Speed = NumberRange.new(6, 10) + rain.Lifetime = NumberRange.new(5, 7) + rain.Size = NumberSequence.new(0.22) + rain.Squash = NumberSequence.new(0) + rain.SpreadAngle = Vector2.new(25, 25) + rain.Orientation = Enum.ParticleOrientation.FacingCamera + rain.Color = ColorSequence.new(WHITE) + rain.Transparency = NumberSequence.new(0.1) + else + rain.Speed = NumberRange.new(55, 70) + rain.Lifetime = NumberRange.new(1.1, 1.4) + rain.Size = NumberSequence.new(0.07) + rain.Squash = NumberSequence.new(2.5) + rain.SpreadAngle = Vector2.new(4, 4) + rain.Orientation = Enum.ParticleOrientation.VelocityParallel + rain.Color = ColorSequence.new(Color3.fromRGB(200, 215, 235)) + rain.Transparency = NumberSequence.new(0.45) + end +end + +local appliedWeather, appliedPlace = nil, nil +local function applyWeather(instant) + local w = currentWeather() + local _, placeId = currentPlace() + if appliedWeather == w.id and appliedPlace == placeId and not instant then + return + end + appliedWeather, appliedPlace = w.id, placeId + local look = LOOK[w.id] or LOOK.Clear + local info = TweenInfo.new(instant and 0 or 6) + TweenService:Create(weatherCC, info, look.cc):Play() + TweenService:Create(clouds, info, { Cover = look.cover, Density = look.density }):Play() -- цвет туч ставит главный цикл (с учётом ночи) + local snowy = placeId == "World3" + rainStyle(snowy) + rain.Rate = snowy and look.rain * 0.35 or look.rain +end + +---------------------------------------------------------------- молнии + +task.spawn(function() + while true do + task.wait(rng:NextNumber(6, 16)) + local w = currentWeather() + local _, placeId = currentPlace() + if LOOK[w.id] and LOOK[w.id].lightning and placeId ~= "World3" then + -- двойная вспышка, гром приходит чуть позже (молния далеко) + local base = weatherCC.Brightness + for _ = 1, 2 do + weatherCC.Brightness = base + 0.45 + task.wait(0.06) + weatherCC.Brightness = base + task.wait(0.09) + end + local far = rng:NextNumber() + task.delay(0.2 + far * 1.4, function() + local list = Config.Sounds.thunder + Audio.playId(list[rng:NextInteger(1, #list)], 0.9 - far * 0.5, "ambient") + end) + end + end +end) + +---------------------------------------------------------------- музыка + +local tracks = {} +local function track(name) + if not tracks[name] then + tracks[name] = Audio.loop(name, "music") + end + return tracks[name] +end + +local currentTrack = nil +local function musicFor(placeId, night) + if night and placeId ~= "World2" then + return "musicNight" + end + if placeId == "Lobby" then + return (math.floor(workspace:GetServerTimeNow() / 600) % 2 == 0) and "musicLobby" or "musicLobby2" + elseif placeId == "World1" then + return (math.floor(workspace:GetServerTimeNow() / 600) % 2 == 0) and "musicLake" or "musicLake2" + elseif placeId == "World3" then + return "musicNight" + end + return "musicLake2" +end + +---------------------------------------------------------------- звуки окружения + +local ambient = {} +for _, name in ipairs({ "birdsLake", "birdsPark", "birdsJungle", "crickets", "lakeWater", "wind", "rainLight", "rainHeavy" }) do + ambient[name] = Audio.loop(name, "ambient") +end + +-- какие петли и насколько громко звучат сейчас +local function ambientMix(placeId, night, w) + local mix = {} + local day = not night + mix.birdsLake = (day and placeId == "World1") and 1 or 0 + mix.birdsPark = (day and placeId == "Lobby") and 1 or 0 + mix.birdsJungle = (day and placeId == "World2") and 1 or 0 + mix.crickets = (night and placeId ~= "World3") and 1 or 0 + mix.lakeWater = (placeId == "World1" or placeId == "World2") and 1 or 0 + local wind = 1 + if placeId == "World3" then + wind = 2.5 + end + if w.id == "Storm" then + wind *= 2 + end + mix.wind = wind + local wet = placeId ~= "World3" + mix.rainLight = (wet and w.id == "Rain") and 1 or 0 + mix.rainHeavy = (wet and w.id == "Storm") and 1 or 0 + -- в дождь птицы прячутся + if w.id == "Rain" or w.id == "Storm" then + mix.birdsLake, mix.birdsPark, mix.birdsJungle = 0, 0, 0 + end + return mix +end + +-- треск у каждого костра на карте (звук в самом костре: слышно только рядом) +task.spawn(function() + local map = workspace:WaitForChild("FishingMap", 60) + if not map then + return + end + task.wait(3) + local def = Config.Sounds.fire + for _, d in ipairs(map:GetDescendants()) do + if d:IsA("Fire") and d.Parent and d.Parent:IsA("BasePart") then + new("Sound", { + Name = "FireCrackle", SoundId = def.id, Volume = def.volume, Looped = true, Playing = true, + RollOffMode = Enum.RollOffMode.InverseTapered, RollOffMinDistance = 6, RollOffMaxDistance = def.roll or 30, + SoundGroup = Audio.groups.ambient, Parent = d.Parent, + }) + end + end +end) + +---------------------------------------------------------------- плашка «погода и время» + +-- в стиле интерфейса (UiTheme): тёмное дерево с золотой рамкой; масштаб — как у основного интерфейса +local Theme = require(script.Parent:WaitForChild("UiTheme")) +local hud = new("ScreenGui", { Name = "WeatherHud", ResetOnSpawn = false, IgnoreGuiInset = false, Parent = player:WaitForChild("PlayerGui") }) +local pill = new("Frame", { + Size = UDim2.fromOffset(230, 48), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 74), + BackgroundColor3 = Theme.C.woodDark, BackgroundTransparency = 0.08, Parent = Theme.followScale(hud), +}) +new("UICorner", { CornerRadius = UDim.new(0, 8), Parent = pill }) +local pillStroke = new("UIStroke", { Color = Theme.C.goldDark, Thickness = 2, Transparency = 0, Parent = pill }) +local line1 = new("TextLabel", { + Size = UDim2.new(1, -16, 0, 24), Position = UDim2.fromOffset(10, 3), BackgroundTransparency = 1, + FontFace = Theme.TITLE_FACE, TextSize = 16, TextColor3 = Theme.C.parchment, TextXAlignment = Enum.TextXAlignment.Left, + Text = "", Parent = pill, +}) +local line2 = new("TextLabel", { + Size = UDim2.new(1, -16, 0, 16), Position = UDim2.fromOffset(10, 27), BackgroundTransparency = 1, + FontFace = Theme.BODY2_FACE, TextSize = 12, TextColor3 = Color3.fromRGB(170, 215, 140), TextXAlignment = Enum.TextXAlignment.Left, + Text = "", Parent = pill, +}) + +local function weatherName(w, placeId) + return (w.names and w.names[placeId]) or w.name +end + +local lastShownWeather = nil +local function refreshPill(clock, night, w, placeId) + local h = math.floor(clock) + local m = math.floor((clock - h) * 60) + line1.Text = ("%s %s · %s %02d:%02d"):format(w.icon, weatherName(w, placeId), night and "🌙" or "☀", h, m) + local bonus = {} + if w.desc then + table.insert(bonus, w.desc) + end + if night then + table.insert(bonus, ("Ночь: удача +%d%%"):format(math.floor(Config.DayNight.nightLuck * 100 + 0.5))) + end + line2.Text = #bonus > 0 and table.concat(bonus, " · ") or "Спокойная погода" + if lastShownWeather ~= w.id then + -- погода сменилась: плашка вспыхивает + if lastShownWeather ~= nil then + pillStroke.Color = Color3.fromRGB(255, 220, 120) + pillStroke.Transparency = 0 + TweenService:Create(pillStroke, TweenInfo.new(2.5), { Color = Theme.C.goldDark, Transparency = 0 }):Play() + end + lastShownWeather = w.id + end +end + +---------------------------------------------------------------- главный цикл + +-- часы двигаются каждый кадр (плавно), остальное проверяется раз в полсекунды +RunService.RenderStepped:Connect(function() + if Config.DayNight.enabled then + Lighting.ClockTime = clockNow() + end + if camera then + rainPart.CFrame = CFrame.new(camera.CFrame.Position + Vector3.new(0, 35, 0)) + end +end) + +workspace:GetAttributeChangedSignal("Weather"):Connect(function() + applyWeather(false) +end) +applyWeather(true) + +task.spawn(function() + while true do + local clock = clockNow() + local nightness = Config.DayNight.enabled and Config.Nightness(clock) or 0 + local night = nightness >= 0.5 + local w = currentWeather() + local _, placeId = currentPlace() + + -- ночь: темнее, холоднее, менее насыщенно + nightCC.Brightness = -0.1 * nightness + nightCC.Saturation = -0.18 * nightness + nightCC.TintColor = WHITE:Lerp(Color3.fromRGB(165, 185, 255), nightness) + clouds.Color = (LOOK[w.id] or LOOK.Clear).cloud:Lerp(Color3.fromRGB(40, 45, 60), nightness * 0.8) + + applyWeather(false) -- смена локации меняет дождь на снег и обратно + + -- музыка: плавная смена трека, в грозу тише + local want = musicFor(placeId, night) + local duck = (w.id == "Storm") and 0.5 or 1 + if currentTrack ~= want then + if currentTrack then + Audio.fade(track(currentTrack), 0, 3) + end + currentTrack = want + end + Audio.fade(track(want), duck, 3) + + for name, factor in pairs(ambientMix(placeId, night, w)) do + Audio.fade(ambient[name], factor, 3) + end + + refreshPill(clock, night, w, placeId) + task.wait(0.5) + end +end) diff --git a/src/StarterPlayer/StarterPlayerScripts/Audio.lua b/src/StarterPlayer/StarterPlayerScripts/Audio.lua new file mode 100644 index 0000000..139951d --- /dev/null +++ b/src/StarterPlayer/StarterPlayerScripts/Audio.lua @@ -0,0 +1,128 @@ +-- Audio (ModuleScript) -> StarterPlayer > StarterPlayerScripts +-- Звуки у этого игрока. Три группы громкости: музыка, эффекты и окружение (окружение — по громкости эффектов). +-- Громкость берётся из атрибутов игрока VolMusic / VolSfx (их выставляет и сохраняет сервер). +-- Audio.play(name) — разовый звук из Config.Sounds +-- Audio.loop(name, group) — петля (молчит, пока не вызвать Audio.fade) +-- Audio.fade(sound, factor) — плавно к громкости «базовая × factor» (0 — тишина, звук ставится на паузу) + +local Players = game:GetService("Players") +local SoundService = game:GetService("SoundService") +local TweenService = game:GetService("TweenService") +local ReplicatedStorage = game:GetService("ReplicatedStorage") + +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) +local player = Players.LocalPlayer +local rng = Random.new() + +local Audio = {} + +local function group(name) + local g = SoundService:FindFirstChild(name) + if not g then + g = Instance.new("SoundGroup") + g.Name = name + g.Parent = SoundService + end + return g +end +Audio.groups = { + music = group("MusicGroup"), + sfx = group("SfxGroup"), + ambient = group("AmbientGroup"), +} + +local function applyVolumes() + local music = player:GetAttribute("VolMusic") or Config.DefaultVolume.music + local sfx = player:GetAttribute("VolSfx") or Config.DefaultVolume.sfx + Audio.groups.music.Volume = music + Audio.groups.sfx.Volume = sfx + Audio.groups.ambient.Volume = sfx +end +applyVolumes() +player:GetAttributeChangedSignal("VolMusic"):Connect(applyVolumes) +player:GetAttributeChangedSignal("VolSfx"):Connect(applyVolumes) + +function Audio.play(name, volumeMult) + local def = Config.Sounds[name] + if not def or not def.id then + return nil + end + local s = Instance.new("Sound") + s.SoundId = def.id + s.Volume = (def.volume or 0.5) * (volumeMult or 1) + if def.pitch then + s.PlaybackSpeed = rng:NextNumber(def.pitch[1], def.pitch[2]) + end + s.SoundGroup = Audio.groups.sfx + s.Parent = SoundService + s:Play() + s.Ended:Connect(function() + s:Destroy() + end) + task.delay(30, function() + if s.Parent then + s:Destroy() + end + end) + return s +end + +-- разовый звук по прямому id (например, случайный раскат грома из списка) +function Audio.playId(id, volume, groupName) + local s = Instance.new("Sound") + s.SoundId = id + s.Volume = volume or 0.5 + s.SoundGroup = Audio.groups[groupName or "sfx"] + s.Parent = SoundService + s:Play() + s.Ended:Connect(function() + s:Destroy() + end) + return s +end + +function Audio.loop(name, groupName) + local def = Config.Sounds[name] + if not def then + return nil + end + local s = Instance.new("Sound") + s.Name = name + s.SoundId = def.id + s.Looped = true + s.Volume = 0 + s.SoundGroup = Audio.groups[groupName or "ambient"] + s:SetAttribute("BaseVolume", def.volume or 0.5) + s.Parent = SoundService + return s +end + +local fades = {} +function Audio.fade(s, factor, time) + if not s then + return + end + local target = (s:GetAttribute("BaseVolume") or 0.5) * (factor or 0) + if fades[s] and fades[s].target == target then + return + end + if fades[s] then + fades[s].tween:Cancel() + end + if target > 0 and not s.IsPlaying then + s:Resume() + if not s.IsPlaying then + s:Play() + end + end + local tw = TweenService:Create(s, TweenInfo.new(time or 2), { Volume = target }) + fades[s] = { tween = tw, target = target } + tw.Completed:Connect(function(state) + if state == Enum.PlaybackState.Completed and target <= 0.001 then + s:Pause() + end + end) + tw:Play() +end + +return Audio diff --git a/src/StarterPlayer/StarterPlayerScripts/FishingClient.client.lua b/src/StarterPlayer/StarterPlayerScripts/FishingClient.client.lua index 7ed6e80..d81cecc 100644 --- a/src/StarterPlayer/StarterPlayerScripts/FishingClient.client.lua +++ b/src/StarterPlayer/StarterPlayerScripts/FishingClient.client.lua @@ -13,29 +13,19 @@ local Lighting = game:GetService("Lighting") local player = Players.LocalPlayer local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) local Models = require(ReplicatedStorage:WaitForChild("GameModels")) +local Audio = require(script.Parent:WaitForChild("Audio")) local remote = ReplicatedStorage:WaitForChild("GameEvent") +local reelSound = Audio.loop("reel", "sfx") -- трещотка катушки, пока идёт вываживание ---------------------------------------------------------------- стиль -local C = { - bg = Color3.fromRGB(18, 24, 40), - panel = Color3.fromRGB(30, 38, 62), - panel2 = Color3.fromRGB(44, 56, 90), - gold = Color3.fromRGB(255, 200, 70), - green = Color3.fromRGB(60, 190, 95), - blue = Color3.fromRGB(60, 135, 230), - red = Color3.fromRGB(215, 65, 65), - purple = Color3.fromRGB(150, 90, 220), - grey = Color3.fromRGB(75, 82, 102), - text = Color3.new(1, 1, 1), - muted = Color3.fromRGB(170, 180, 205), - line = Color3.fromRGB(90, 110, 165), -} -local TITLE = Enum.Font.FredokaOne +-- палитра, шрифты и украшения — в модуле UiTheme («средневековая гильдия») +local Theme = require(script.Parent:WaitForChild("UiTheme")) +local C = Theme.C +local TITLE = Enum.Font.FredokaOne -- в new() подменяется на шрифт с кириллицей (Theme.FACES) local BODY = Enum.Font.GothamBold local BODY2 = Enum.Font.GothamMedium local WHITE, BLACK = Color3.new(1, 1, 1), Color3.new(0, 0, 0) -local DING = "rbxasset://sounds/electronicpingshort.wav" ---------------------------------------------------------------- помощники UI @@ -45,6 +35,8 @@ local function new(class, props, children) for k, v in pairs(props or {}) do if k == "Parent" then parent = v + elseif k == "Font" and Theme.FACES[v] then + obj.FontFace = Theme.FACES[v] else obj[k] = v end @@ -77,13 +69,20 @@ local function text(props) return new("TextLabel", d) end local function btn(props, onClick) - local d = { AutoButtonColor = true, Font = TITLE, TextColor3 = C.text, TextSize = 18, BackgroundColor3 = C.blue, Text = "" } + -- дерево/сургуч с золотой окантовкой; цвет кнопки задаёт BackgroundColor3, градиент даёт объём + local d = { AutoButtonColor = true, Font = TITLE, TextColor3 = C.text, TextSize = 18, BackgroundColor3 = C.blue, Text = "", TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.55 } for k, v in pairs(props) do d[k] = v end - local b = new("TextButton", d, { corner(10), new("UIGradient", { Color = ColorSequence.new(WHITE, Color3.fromRGB(195, 195, 195)), Rotation = 90 }) }) + local b = new("TextButton", d, { + corner(8), new("UIGradient", { Color = ColorSequence.new(Color3.fromRGB(255, 240, 215), Color3.fromRGB(165, 150, 135)), Rotation = 90 }), + new("UIStroke", { Color = C.gold, Thickness = 1.5, Transparency = 0.15, ApplyStrokeMode = Enum.ApplyStrokeMode.Border }), + }) if onClick then - b.MouseButton1Click:Connect(onClick) + b.MouseButton1Click:Connect(function(...) + Audio.play("click") + onClick(...) + end) end return b end @@ -148,9 +147,7 @@ local function viewport(parent, model, dir, zoom) vf.CurrentCamera = cam return vf end -local FISH_VIEW = Vector3.new(0.12, 0.15, 1) -local ROD_VIEW = Vector3.new(1, 0.1, 0.05) -local BAG_VIEW = Vector3.new(0.6, 0.25, 1) +local VIEW = { fish = Vector3.new(0.12, 0.15, 1), rod = Vector3.new(1, 0.1, 0.05), bag = Vector3.new(0.6, 0.25, 1) } local function silhouette(model) for _, p in ipairs(model:GetDescendants()) do @@ -170,44 +167,56 @@ local gui = new("ScreenGui", { Name = "FishingUI", ResetOnSpawn = false, IgnoreGuiInset = false, ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = player:WaitForChild("PlayerGui"), }) +-- холст с масштабом под экран: всё ниже кладём в него, а не прямо в ScreenGui +local screen = Theme.scaleRoot(gui) ---------------------------------------------------------------- HUD +-- hud — содержимое; его родитель — деревянная панель с рамкой и заклёпками (её двигает раскладка) local hud = new("Frame", { - Size = UDim2.fromOffset(290, 172), Position = UDim2.fromOffset(12, 10), BackgroundColor3 = WHITE, Parent = gui, -}, { corner(16), stroke(C.line, 2, 0.35), gradient(C.panel2, C.bg, 90), - new("UIPadding", { PaddingLeft = UDim.new(0, 14), PaddingRight = UDim.new(0, 14), PaddingTop = UDim.new(0, 10) }) }) -local coinsText = text({ Size = UDim2.new(1, 0, 0, 32), Font = TITLE, TextSize = 30, TextColor3 = C.gold, Text = "💰 0", TextStrokeTransparency = 0.6, Parent = hud }) -local lvlBadge = new("Frame", { Size = UDim2.fromOffset(36, 36), Position = UDim2.fromOffset(0, 38), BackgroundColor3 = WHITE, Parent = hud }, - { corner(18), gradient(Color3.fromRGB(255, 225, 110), Color3.fromRGB(235, 145, 30), 90), stroke(Color3.fromRGB(120, 70, 10), 2, 0.2) }) -local lvlText = text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 19, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = Color3.fromRGB(70, 40, 0), Text = "1", Parent = lvlBadge }) -local xpBack = new("Frame", { Size = UDim2.new(1, -46, 0, 18), Position = UDim2.fromOffset(46, 47), BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = hud }, { corner(9) }) -local xpFill = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = WHITE, Parent = xpBack }, { corner(9), gradient(Color3.fromRGB(110, 225, 255), Color3.fromRGB(60, 110, 255), 0) }) -local xpText = text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 2, Text = "", TextStrokeTransparency = 0.5, Parent = xpBack }) -local luckText = text({ Size = UDim2.new(1, 0, 0, 22), Position = UDim2.fromOffset(0, 82), TextSize = 16, RichText = true, TextColor3 = Color3.fromRGB(130, 255, 150), Text = "", Parent = hud }) -local bagText = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 106), TextSize = 14, Font = BODY2, Text = "", Parent = hud }) -local rodText = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 128), TextSize = 14, Font = BODY2, TextColor3 = C.muted, RichText = true, Text = "", Parent = hud }) + Size = UDim2.new(1, -28, 1, -10), Position = UDim2.fromOffset(14, 10), BackgroundTransparency = 1, + Parent = new("Frame", { + Name = "Hud", Size = UDim2.fromOffset(290, 172), Position = UDim2.fromOffset(12, 10), BackgroundColor3 = WHITE, Parent = screen, + }, { corner(10), stroke(C.goldDark, 2.5, 0), Theme.woodGradient(C.wood, C.woodDark) }), +}) +Theme.innerBorder(hud.Parent, 5, 7, C.gold, 0.5) +Theme.rivets(hud.Parent, 8, 6) +local H = {} -- элементы HUD (в таблице: у скрипта лимит 200 локальных переменных) +H.coins = text({ Size = UDim2.new(1, 0, 0, 32), Font = TITLE, TextSize = 28, TextColor3 = C.silver, Text = "⚪ 0", TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.3, Parent = hud }) +H.lvlBadge = new("Frame", { Size = UDim2.fromOffset(36, 36), Position = UDim2.fromOffset(0, 38), BackgroundColor3 = WHITE, Rotation = 45, Parent = hud }, + { corner(6), gradient(C.goldBright, C.goldDark, 90), stroke(C.ink, 2, 0.1) }) +H.lvl = text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 17, Rotation = -45, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.ink, Text = "1", Parent = H.lvlBadge }) +H.xpBack = new("Frame", { Size = UDim2.new(1, -46, 0, 18), Position = UDim2.fromOffset(46, 47), BackgroundColor3 = C.dark, Parent = hud }, { corner(4), stroke(C.goldDark, 1.5, 0.2) }) +H.xpFill = new("Frame", { Size = UDim2.fromScale(0, 1), BackgroundColor3 = WHITE, Parent = H.xpBack }, { corner(4), gradient(C.goldBright, Color3.fromRGB(196, 128, 48), 0) }) +H.xpText = text({ Size = UDim2.fromScale(1, 1), TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 2, Text = "", TextStrokeTransparency = 0.5, Parent = H.xpBack }) +H.luck = text({ Size = UDim2.new(1, 0, 0, 22), Position = UDim2.fromOffset(0, 82), TextSize = 16, RichText = true, TextColor3 = Color3.fromRGB(130, 255, 150), Text = "", Parent = hud }) +H.bag = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 106), TextSize = 14, Font = BODY2, Text = "", Parent = hud }) +H.rod = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 128), TextSize = 14, Font = BODY2, TextColor3 = C.muted, RichText = true, Text = "", Parent = hud }) -- баннер события (справа сверху) local eventBanner = new("Frame", { Size = UDim2.fromOffset(280, 58), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 10), - BackgroundColor3 = WHITE, Visible = false, Parent = gui, + BackgroundColor3 = WHITE, Visible = false, Parent = screen, }, { corner(14), stroke(C.gold, 2, 0.1), gradient(Color3.fromRGB(90, 60, 20), C.bg, 90) }) local eventTitle = text({ Size = UDim2.new(1, -20, 0, 26), Position = UDim2.fromOffset(12, 4), Font = TITLE, TextSize = 19, TextColor3 = C.gold, Text = "", Parent = eventBanner }) local eventDesc = text({ Size = UDim2.new(1, -20, 0, 20), Position = UDim2.fromOffset(12, 30), Font = BODY2, TextSize = 13, TextColor3 = C.text, Text = "", Parent = eventBanner }) -- кнопки слева +-- столбик на компьютере, сетка 2×N на телефоне (раскладка — в applyLayout ниже) local side = new("Frame", { Size = UDim2.fromOffset(70, 380), AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0, 12, 0.5, 60), - BackgroundTransparency = 1, Parent = gui, -}, { new("UIListLayout", { Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + BackgroundTransparency = 1, Parent = screen, +}, { new("UIGridLayout", { CellSize = UDim2.fromOffset(68, 68), CellPadding = UDim2.fromOffset(8, 8), FillDirectionMaxCells = 1, SortOrder = Enum.SortOrder.LayoutOrder }) }) local sideDots = {} local function sideButton(order, icon, label, key, color, onClick) - local b = btn({ Size = UDim2.fromOffset(68, 68), BackgroundColor3 = color, LayoutOrder = order, Parent = side }, onClick) - stroke(color:Lerp(BLACK, 0.45), 3).Parent = b - text({ Size = UDim2.new(1, 0, 0, 36), Position = UDim2.fromOffset(0, 3), TextSize = 28, TextXAlignment = Enum.TextXAlignment.Center, Text = icon, Parent = b }) - text({ Size = UDim2.new(1, 0, 0, 18), Position = UDim2.fromOffset(0, 44), Font = TITLE, TextSize = 13, TextXAlignment = Enum.TextXAlignment.Center, Text = label, TextStrokeTransparency = 0.5, Parent = b }) + -- деревянная плитка; цвет раздела — полоска-лента снизу + local b = btn({ Size = UDim2.fromOffset(68, 68), BackgroundColor3 = C.woodLight, LayoutOrder = order, Parent = side }, onClick) + b:FindFirstChildOfClass("UIStroke").Color = C.goldDark + b:FindFirstChildOfClass("UIStroke").Thickness = 2.5 + new("Frame", { Size = UDim2.new(1, -10, 0, 4), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -4), BackgroundColor3 = color, BorderSizePixel = 0, Parent = b }, { corner(2) }) + text({ Size = UDim2.fromScale(1, 0.5), Position = UDim2.fromScale(0, 0.06), TextScaled = true, TextXAlignment = Enum.TextXAlignment.Center, Text = icon, Parent = b }) + text({ Size = UDim2.fromScale(1, 0.24), Position = UDim2.fromScale(0, 0.6), Font = TITLE, TextScaled = true, TextXAlignment = Enum.TextXAlignment.Center, Text = label, TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.3, Parent = b }) if key and not UserInputService.TouchEnabled then local tag = new("Frame", { Size = UDim2.fromOffset(20, 20), Position = UDim2.new(1, -14, 0, -6), BackgroundColor3 = C.bg, Parent = b }, { corner(6), stroke(C.gold, 1.5) }) text({ Size = UDim2.fromScale(1, 1), Font = TITLE, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, Text = key, Parent = tag }) @@ -218,10 +227,46 @@ local function sideButton(order, icon, label, key, color, onClick) end ---------------------------------------------------------------- уведомления +-- мультяшный стиль подсказок: крупный круглый шрифт без обводки на мягкой «дымке» — +-- тёмная подложка, которая плавно растворяется к краям; появляются «пружинкой» +local SOFT_EDGES = NumberSequence.new({ + NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.18, 0.62), + NumberSequenceKeypoint.new(0.82, 0.62), NumberSequenceKeypoint.new(1, 1), +}) +-- жирный округлый шрифт с кириллицей (у FredokaOne кириллицы нет — Roblox подставляет тонкий шрифт) +local HINT_FONT = Theme.HINT_FACE +-- плашка-дымка (Frame) с текстом внутри; градиент только на плашке, на текст он не действует. +-- Цвет — тёмное дерево +local function softPlate(props, textProps) + local plate = new("Frame", props) + plate.BackgroundColor3 = C.woodDark + plate.BackgroundTransparency = 0 + corner(30).Parent = plate + new("UIGradient", { Transparency = SOFT_EDGES, Parent = plate }) + new("UIPadding", { PaddingLeft = UDim.new(0, 48), PaddingRight = UDim.new(0, 48), Parent = plate }) + local d = { Size = UDim2.fromScale(0, 1), AutomaticSize = Enum.AutomaticSize.X, TextXAlignment = Enum.TextXAlignment.Center, Parent = plate } + for k, v in pairs(textProps) do + d[k] = v + end + local label = text(d) + label.FontFace = HINT_FONT + return plate, label +end +local function popIn(obj, from) + local sc = obj:FindFirstChildOfClass("UIScale") or new("UIScale", { Parent = obj }) + sc.Scale = from or 0.4 + TweenService:Create(sc, TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play() +end +local function wobble(obj, deg, period) + obj.Rotation = -deg + TweenService:Create(obj, TweenInfo.new(period, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true), { Rotation = deg }):Play() +end + +-- уведомления — под подсказкой обучения, которая стоит в самом верху local toasts = new("Frame", { - Size = UDim2.new(0, 560, 0, 200), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 8), - BackgroundTransparency = 1, Parent = gui, + Size = UDim2.new(0, 900, 0, 200), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 84), + BackgroundTransparency = 1, ZIndex = 30, Parent = screen, }, { new("UIListLayout", { Padding = UDim.new(0, 6), HorizontalAlignment = Enum.HorizontalAlignment.Center, SortOrder = Enum.SortOrder.LayoutOrder }) }) local toastOrder = 0 local toastTimers = {} @@ -250,11 +295,11 @@ local function notify(msg, color) if #items >= 3 then items[1]:Destroy() end - local t = new("Frame", { - Size = UDim2.new(0, 0, 0, 38), AutomaticSize = Enum.AutomaticSize.X, BackgroundColor3 = C.bg, - BackgroundTransparency = 0.15, LayoutOrder = toastOrder, Parent = toasts, - }, { corner(12), stroke(color or WHITE, 2, 0.2), new("UIPadding", { PaddingLeft = UDim.new(0, 16), PaddingRight = UDim.new(0, 16) }) }) - local l = text({ Size = UDim2.new(0, 0, 1, 0), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 19, TextColor3 = color or WHITE, Text = msg, Parent = t }) + local t, l = softPlate( + { Size = UDim2.new(0, 0, 0, 54), AutomaticSize = Enum.AutomaticSize.X, LayoutOrder = toastOrder, Parent = toasts }, + { TextSize = 30, TextColor3 = color or C.text, Text = msg } + ) + popIn(t) t:SetAttribute("Msg", msg) toastTimers[t] = 0 task.delay(3.2, function() @@ -270,8 +315,10 @@ end -- карточка пойманной рыбы local catchCard = new("Frame", { Size = UDim2.fromOffset(400, 128), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, -220), - BackgroundColor3 = WHITE, Visible = false, Parent = gui, -}, { corner(18) }) + BackgroundColor3 = WHITE, Visible = false, ZIndex = 25, Parent = screen, +}, { corner(10) }) +Theme.innerBorder(catchCard, 6, 6, C.gold, 0.5) +Theme.rivets(catchCard, 8, 6) local catchStroke = stroke(WHITE, 3) catchStroke.Parent = catchCard local catchGrad = gradient(C.panel2, C.bg, 90) @@ -289,7 +336,7 @@ local function showCatch(fish, extra) local r = Config.Rarities[fish.rarity] local mut = fish.mutation and Config.Find(Config.Mutations, fish.mutation) clear(catchView) - viewport(catchView, Models.buildFish(fish.id, fish.mutation, 1, true), FISH_VIEW, 0.75) + viewport(catchView, Models.buildFish(fish.id, fish.mutation, 1, true), VIEW.fish, 0.75) catchStroke.Color = mut and mut.color or r.color catchGrad.Color = ColorSequence.new(r.color:Lerp(C.bg, 0.55), C.bg) catchHeader.Text = extra and extra.new and "🆕 НОВЫЙ ВИД! Опыт x2" or (extra and extra.record and "🏆 НОВЫЙ РЕКОРД!" or "ПОЙМАНА РЫБА") @@ -298,7 +345,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() @@ -317,7 +365,7 @@ local function floatText(msg, color) local l = text({ Size = UDim2.fromOffset(400, 60), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.42), Font = TITLE, TextSize = 46, TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = color, - TextStrokeTransparency = 0.2, Text = msg, Parent = gui, + TextStrokeTransparency = 0.2, Text = msg, Parent = screen, }) TweenService:Create(l, TweenInfo.new(1.4, Enum.EasingStyle.Quad), { Position = UDim2.fromScale(0.5, 0.3), TextTransparency = 1, TextStrokeTransparency = 1 }):Play() task.delay(1.5, function() @@ -327,23 +375,26 @@ end ---------------------------------------------------------------- статус и мини-игра -local statusLabel = text({ - Size = UDim2.fromOffset(460, 34), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -110), - Font = TITLE, TextSize = 22, TextXAlignment = Enum.TextXAlignment.Center, TextStrokeTransparency = 0.3, - Text = "🎣 Ждём поклёвку… (клик — смотать)", Visible = false, Parent = gui, -}) +-- вверху, на месте подсказки обучения (она во время рыбалки скрыта) +local statusLabel = softPlate( + { Size = UDim2.fromOffset(0, 64), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 12), Visible = false, Parent = screen }, + { TextSize = 36, Text = "🎣 Ждём клёв…" } +) +wobble(statusLabel, 1.2, 1.4) local mgFrame = new("Frame", { Size = UDim2.fromOffset(480, 124), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -100), - BackgroundColor3 = WHITE, Visible = false, Parent = gui, -}, { corner(16), stroke(C.gold, 2.5, 0.1), gradient(C.panel2, C.bg, 90) }) + BackgroundColor3 = WHITE, Visible = false, Parent = screen, +}, { corner(10), stroke(C.goldDark, 3, 0), Theme.woodGradient(C.wood, C.woodDark) }) +Theme.innerBorder(mgFrame, 5, 7, C.gold, 0.4) +Theme.rivets(mgFrame, 9, 6) text({ - Size = UDim2.new(1, 0, 0, 30), Position = UDim2.fromOffset(0, 6), Font = TITLE, TextSize = 24, - TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, TextStrokeTransparency = 0.5, - Text = "❗ КЛЮЁТ! Кликай, когда метка в зелёной зоне", Parent = mgFrame, + Size = UDim2.new(1, 0, 0, 30), Position = UDim2.fromOffset(0, 6), Font = TITLE, TextSize = 22, + TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.goldBright, TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.3, + Text = UserInputService.TouchEnabled and "❗ КЛЮЁТ! Жми, когда метка в зелёной зоне" or "❗ КЛЮЁТ! Кликай, когда метка в зелёной зоне", Parent = mgFrame, }) -local bar = new("Frame", { Size = UDim2.new(1, -30, 0, 36), Position = UDim2.fromOffset(15, 42), BackgroundColor3 = Color3.fromRGB(22, 28, 46), ClipsDescendants = true, Parent = mgFrame }, { corner(9), stroke(BLACK, 1.5, 0.4) }) -local zoneF = new("Frame", { Size = UDim2.fromScale(0.25, 1), BackgroundColor3 = WHITE, BorderSizePixel = 0, Parent = bar }, { gradient(Color3.fromRGB(130, 245, 150), Color3.fromRGB(35, 165, 75), 90) }) -local markerF = new("Frame", { Size = UDim2.new(0, 8, 1, 4), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0, 0.5), BackgroundColor3 = WHITE, ZIndex = 3, Parent = bar }, { corner(4), stroke(BLACK, 2) }) +local bar = new("Frame", { Size = UDim2.new(1, -30, 0, 36), Position = UDim2.fromOffset(15, 42), BackgroundColor3 = C.dark, ClipsDescendants = true, Parent = mgFrame }, { corner(5), stroke(C.goldDark, 2, 0) }) +local zoneF = new("Frame", { Size = UDim2.fromScale(0.25, 1), BackgroundColor3 = WHITE, BorderSizePixel = 0, Parent = bar }, { gradient(Color3.fromRGB(150, 220, 110), Color3.fromRGB(56, 116, 52), 90) }) +local markerF = new("Frame", { Size = UDim2.new(0, 8, 1, 4), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0, 0.5), BackgroundColor3 = C.parchment, ZIndex = 3, Parent = bar }, { corner(3), stroke(C.ink, 2) }) local pipsText = text({ Size = UDim2.new(0.5, -15, 0, 24), Position = UDim2.fromOffset(15, 84), Font = TITLE, TextSize = 19, RichText = true, Text = "", Parent = mgFrame }) local missText = text({ Size = UDim2.new(0.5, -15, 0, 24), Position = UDim2.new(0.5, 0, 0, 84), Font = TITLE, TextSize = 19, TextXAlignment = Enum.TextXAlignment.Right, RichText = true, Text = "", Parent = mgFrame }) local timeBar = new("Frame", { Size = UDim2.new(1, -30, 0, 5), Position = UDim2.fromOffset(15, 112), BackgroundColor3 = C.gold, BorderSizePixel = 0, Parent = mgFrame }, { corner(3) }) @@ -354,31 +405,54 @@ local openWindow = nil local function makeWindow(title, accent, tabs) local w = { pages = {}, tabButtons = {}, current = nil } + -- деревянная панель, золотая рамка в 2 слоя, ромбики-заклёпки, заголовок на багровой ленте, + -- закрытие — круглая багровая печать. accent — цвет раздела: тонкая полоска под лентой local frame = new("Frame", { Size = UDim2.fromScale(0.92, 0.82), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.53), - BackgroundColor3 = WHITE, Visible = false, Parent = gui, - }, { corner(20), stroke(accent, 3, 0.05), gradient(C.panel, C.bg, 90), new("UISizeConstraint", { MaxSize = Vector2.new(760, 540) }) }) + BackgroundColor3 = WHITE, Visible = false, ZIndex = 20, Parent = screen, -- поверх HUD, целей и подсказок + }, { corner(12), stroke(C.goldDark, 4, 0), Theme.woodGradient(C.wood, C.woodDark), new("UISizeConstraint", { MaxSize = Vector2.new(760, 540) }) }) + Theme.innerBorder(frame, 7, 8, C.gold, 0.2) + Theme.rivets(frame, 12, 8) local scale = new("UIScale", { Parent = frame }) - local header = new("Frame", { Size = UDim2.new(1, 0, 0, 56), BackgroundColor3 = WHITE, Parent = frame }, { corner(20), gradient(accent, accent:Lerp(BLACK, 0.35), 90) }) - new("Frame", { Size = UDim2.new(1, 0, 0, 20), Position = UDim2.new(0, 0, 1, -20), BackgroundColor3 = accent:Lerp(BLACK, 0.3), BorderSizePixel = 0, Parent = header }) - text({ Size = UDim2.new(1, -80, 1, 0), Position = UDim2.fromOffset(20, 0), Font = TITLE, TextSize = 30, Text = title, TextStrokeTransparency = 0.5, ZIndex = 2, Parent = header }) - btn({ Size = UDim2.fromOffset(42, 42), Position = UDim2.new(1, -52, 0, 7), BackgroundColor3 = C.red, Text = "✕", TextSize = 22, ZIndex = 3, Parent = header }, function() + local header = new("Frame", { Size = UDim2.new(1, 0, 0, 56), BackgroundTransparency = 1, Parent = frame }) + -- багровая лента по центру, ширина — по тексту + local ribbon = new("Frame", { + Size = UDim2.new(0, 0, 0, 44), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 8), + BackgroundColor3 = WHITE, ZIndex = 3, Parent = header, + }, { corner(4), gradient(Color3.fromRGB(184, 58, 48), Color3.fromRGB(118, 28, 26), 90), stroke(C.gold, 2, 0), + new("UIListLayout", { HorizontalAlignment = Enum.HorizontalAlignment.Center, VerticalAlignment = Enum.VerticalAlignment.Center }), + new("UIPadding", { PaddingLeft = UDim.new(0, 36), PaddingRight = UDim.new(0, 36) }) }) + text({ Size = UDim2.fromScale(0, 1), AutomaticSize = Enum.AutomaticSize.X, Font = TITLE, TextSize = 24, TextXAlignment = Enum.TextXAlignment.Center, + TextColor3 = C.goldBright, TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.2, Text = title, ZIndex = 4, Parent = ribbon }) + new("Frame", { Size = UDim2.new(0, 120, 0, 3), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 1, 2), BackgroundColor3 = accent, BorderSizePixel = 0, Parent = header }, { corner(2) }) + local closeB = btn({ Size = UDim2.fromOffset(44, 44), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.new(1, -24, 0, 22), BackgroundColor3 = C.crimson, Text = "×", TextSize = 30, TextColor3 = C.goldBright, ZIndex = 7, Parent = frame }, function() w.close() end) + closeB:FindFirstChildOfClass("UICorner").CornerRadius = UDim.new(1, 0) + closeB:FindFirstChildOfClass("UIStroke").Thickness = 2.5 local hasTabs = #tabs > 1 - local tabBar = new("Frame", { Size = UDim2.new(1, -28, 0, 42), Position = UDim2.fromOffset(14, 66), BackgroundTransparency = 1, Visible = hasTabs, Parent = frame }, + local tabBar = new("Frame", { Size = UDim2.new(1, -36, 0, 40), Position = UDim2.fromOffset(18, 68), BackgroundTransparency = 1, Visible = hasTabs, Parent = frame }, { new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) - local top = hasTabs and 116 or 68 - local body = new("Frame", { Size = UDim2.new(1, -28, 1, -(top + 12)), Position = UDim2.fromOffset(14, top), BackgroundTransparency = 1, Parent = frame }) + local top = hasTabs and 118 or 70 + local body = new("Frame", { Size = UDim2.new(1, -36, 1, -(top + 16)), Position = UDim2.fromOffset(18, top), BackgroundTransparency = 1, Parent = frame }) w.frame = frame + -- на телефоне окно почти на весь экран + Theme.onLayout(function(compact) + frame.Size = compact and UDim2.new(1, -16, 1, -12) or UDim2.fromScale(0.92, 0.82) + frame.UISizeConstraint.MaxSize = compact and Vector2.new(1100, 640) or Vector2.new(760, 540) + frame.Position = compact and UDim2.fromScale(0.5, 0.5) or UDim2.fromScale(0.5, 0.53) + end) function w.setTab(id) w.current = id for k, page in pairs(w.pages) do page.Visible = (k == id) end + -- выбранная вкладка — золотая с тёмными буквами, остальные — светлое дерево for k, b in pairs(w.tabButtons) do - b.BackgroundColor3 = (k == id) and accent or C.panel2 + b.BackgroundColor3 = (k == id) and C.gold or C.woodLight + b.TextColor3 = (k == id) and C.ink or C.text + b.TextStrokeTransparency = (k == id) and 1 or 0.55 end if w.render then w.render(id) @@ -395,6 +469,9 @@ local function makeWindow(title, accent, tabs) openWindow.close() end openWindow = w + if not frame.Visible then + Audio.play("open") + end frame.Visible = true scale.Scale = 0.85 TweenService:Create(scale, TweenInfo.new(0.25, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play() @@ -460,15 +537,23 @@ local function itemRow(parent, order, o) end local function progressBar(parent, pos, size, frac, color) - local back = new("Frame", { Size = size, Position = pos, BackgroundColor3 = Color3.fromRGB(14, 18, 30), Parent = parent }, { corner(7) }) + local back = new("Frame", { Size = size, Position = pos, BackgroundColor3 = C.dark, Parent = parent }, { corner(7) }) new("Frame", { Size = UDim2.fromScale(math.clamp(frac, 0, 1), 1), BackgroundColor3 = color, Parent = back }, { corner(7) }) return back end +-- помощники интерфейса для других скриптов (GuildClient): тот же стиль окон, кнопок и уведомлений +Theme.kit = { + new = new, text = text, btn = btn, corner = corner, stroke = stroke, gradient = gradient, clear = clear, + makeWindow = makeWindow, scrollArea = scrollArea, itemRow = itemRow, progressBar = progressBar, + sideButton = sideButton, notify = notify, popIn = popIn, fmt = fmt, timeStr = timeStr, + screen = screen, hud = hud, TITLE = TITLE, BODY = BODY, BODY2 = BODY2, +} + ---------------------------------------------------------------- данные с сервера local inventory, discovered, claimed = {}, {}, {} -local quests, daily = {}, { available = false, streak = 0, nextStreak = 1 } +local chain, daily = nil, { available = false, streak = 0, nextStreak = 1 } ---------------------------------------------------------------- магазин @@ -492,7 +577,7 @@ local function buyButton(price, level, myLevel, coins) if myLevel < level then return "🔒 Ур. " .. level, C.grey, false end - return "💰 " .. fmt(price), coins >= price and C.green or Color3.fromRGB(150, 95, 60), true + return "⚪ " .. fmt(price), coins >= price and C.green or Color3.fromRGB(150, 95, 60), true end shopWin.render = function(tab) @@ -519,7 +604,7 @@ shopWin.render = function(tab) bText, bColor, active = buyButton(rod.price, rod.level, myLevel, coins) end itemRow(list, i, { - model = Models.buildRod(rod.id, lv, true), dir = ROD_VIEW, zoom = 0.6, + model = Models.buildRod(rod.id, lv, true), dir = VIEW.rod, zoom = 0.6, title = rod.name .. (owned[rod.id] and (" " .. stars(lv) .. "") or ""), lines = statLine(Config.RodStats(rod.id, lv)) .. "\n" .. (owned[rod.id] and "Куплена" or ("Нужен уровень " .. rod.level)), strokeColor = equipped and C.gold or nil, @@ -554,7 +639,7 @@ shopWin.render = function(tab) end local cost = Config.UpgradeCost(rod, lv) itemRow(list, order, { - model = Models.buildRod(rod.id, lv, true), dir = ROD_VIEW, zoom = 0.6, + model = Models.buildRod(rod.id, lv, true), dir = VIEW.rod, zoom = 0.6, title = rod.name .. " " .. stars(lv) .. "", lines = lines, strokeColor = player:GetAttribute("Rod") == rod.id and C.gold or nil, @@ -581,7 +666,7 @@ shopWin.render = function(tab) bText, bColor, active = buyButton(bag.price, bag.level, myLevel, coins) end itemRow(list, i, { - model = Models.buildBag(bag.id, true), dir = BAG_VIEW, zoom = 0.8, + model = Models.buildBag(bag.id, true), dir = VIEW.bag, zoom = 0.8, title = bag.name, lines = ("🎒 Вмещает %d рыб%s\n%s"):format(bag.capacity + bonus, bonus > 0 and " (с пропуском)" or "", owned[bag.id] and "Куплена" or ("Нужен уровень " .. bag.level)), strokeColor = equipped and C.gold or nil, @@ -604,7 +689,7 @@ shopWin.render = function(tab) table.insert(mutLine, ("%s %.1f%%"):format(hex(m.color), m.name, math.min(100, m.chance * total / 100 * ((event and event.mutation) or 1) * 100))) end local lines = { - ("🍀 Твоя удача: %d%%"):format(total), + ("🍀 Твоя удача: %d%%"):format(total), ("Базовая 100%% · 🎣 Удочка +%d%% · ✨ Улучшения +%d%%"):format(math.floor(rod.luck * 100 + 0.5), math.floor(lv * Config.RodUpgrade.luckPerLevel * 100 + 0.5)), ("⭐ Уровень +%d%% · 🏆 Мастерство миров +%d%%"):format(math.floor(((player:GetAttribute("Level") or 1) - 1) * Config.LuckPerPlayerLevel * 100 + 0.5), math.floor((player:GetAttribute("Mastery") or 0) * Config.MasteryLuck * 100 + 0.5)), ("🧪 Зелье +%d%%%s · 👑 Пропуска +%d%%%s"):format(math.floor(boost * 100 + 0.5), boost > 0 and (" (" .. timeStr(player:GetAttribute("BoostLeft") or 0) .. ")") or "", @@ -638,7 +723,7 @@ local bagWin = makeWindow("🎒 Сумка", Color3.fromRGB(60, 140, 220), { local fishHeader = new("Frame", { Size = UDim2.new(1, 0, 0, 50), BackgroundColor3 = WHITE, Parent = bagWin.pages.fish }, { corner(12), gradient(C.panel2, C.panel, 90) }) local fishSummary = text({ Size = UDim2.new(1, -200, 1, 0), Position = UDim2.fromOffset(14, 0), Font = TITLE, TextSize = 19, RichText = true, Text = "", Parent = fishHeader }) -btn({ Size = UDim2.fromOffset(170, 38), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0), BackgroundColor3 = C.green, Text = "💰 Продать всё", TextSize = 18, Parent = fishHeader }, function() +btn({ Size = UDim2.fromOffset(170, 38), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -8, 0.5, 0), BackgroundColor3 = C.green, Text = "⚪ Продать всё", TextSize = 18, Parent = fishHeader }, function() remote:FireServer("SellAll") end) local fishGrid = scrollArea(bagWin.pages.fish, UDim2.fromOffset(132, 176), 60) @@ -650,8 +735,13 @@ local dexList = scrollArea(bagWin.pages.dex, nil, 46) local dexTabButtons = {} local function fishCard(parent, order, rarityColor, strokeColor) - return new("Frame", { BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent }, - { corner(14), stroke(strokeColor or rarityColor, 2.5, 0.05), gradient(rarityColor:Lerp(C.bg, 0.55), C.panel, 90) }) + -- тёмное дерево; редкость — цветная полоса сверху и камень в углу, мутация — цвет рамки + local card = new("Frame", { BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent }, + { corner(8), stroke(strokeColor or C.goldDark, strokeColor and 2.5 or 2, 0), gradient(rarityColor:Lerp(C.woodDark, 0.78), C.woodDark, 90) }) + new("Frame", { Size = UDim2.new(1, -16, 0, 4), AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 3), BackgroundColor3 = rarityColor, BorderSizePixel = 0, Parent = card }, { corner(2) }) + new("Frame", { Size = UDim2.fromOffset(12, 12), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.new(1, -11, 0, 13), Rotation = 45, BackgroundColor3 = rarityColor, ZIndex = 5, Parent = card }, + { stroke(C.ink, 1.5), gradient(WHITE, Color3.fromRGB(150, 150, 150), 90) }) + return card end local function rewardButton(parent, state, label, onClick) @@ -681,7 +771,7 @@ local function renderDex() { corner(12), stroke(C.gold, 2, 0.3), gradient(Color3.fromRGB(70, 55, 20), C.panel, 90) }) text({ Size = UDim2.new(1, -180, 1, 0), Position = UDim2.fromOffset(14, 0), Font = TITLE, TextSize = 17, RichText = true, TextWrapped = true, - Text = ("%s %s — %d / %d\nСобери всех: +%s 💰 и +%d%% удачи навсегда"):format( + Text = ("%s %s — %d / %d\nСобери всех: +%s ⚪ и +%d%% удачи навсегда"):format( world.icon, world.name, found, #all, fmt(Config.MasteryCoins * world.mult), math.floor(Config.MasteryLuck * 100 + 0.5)), Parent = head, }) @@ -713,7 +803,7 @@ local function renderDex() local reward = Config.CollectionRewards[rarity] text({ Size = UDim2.new(1, -180, 1, 0), Position = UDim2.fromOffset(12, 0), Font = TITLE, TextSize = 17, RichText = true, - Text = ("%s %d/%d +%s 💰 +%s XP"):format( + Text = ("%s %d/%d +%s ⚪ +%s XP"):format( hex(r.color), r.name, have, #group, fmt(reward.coins * world.mult), fmt(reward.xp * world.mult)), Parent = hdr, }) @@ -729,7 +819,7 @@ local function renderDex() local card = fishCard(grid, i, rec and r.color or C.grey) local view = new("Frame", { Size = UDim2.new(1, -12, 0, 76), Position = UDim2.fromOffset(6, 6), BackgroundTransparency = 1, Parent = card }) local model = Models.buildFish(f.id, nil, 1, true) - viewport(view, rec and model or silhouette(model), FISH_VIEW, 0.72) + viewport(view, rec and model or silhouette(model), VIEW.fish, 0.72) text({ Size = UDim2.new(1, -10, 0, 20), Position = UDim2.fromOffset(6, 84), Font = TITLE, TextSize = 15, TextColor3 = rec and r.color or C.muted, Text = rec and f.name or "???", TextTruncate = Enum.TextTruncate.AtEnd, Parent = card }) text({ Size = UDim2.new(1, -10, 0, 40), Position = UDim2.fromOffset(6, 104), Font = BODY2, TextSize = 12, TextColor3 = C.muted, TextWrapped = true, @@ -757,7 +847,7 @@ bagWin.render = function(tab) for _, it in ipairs(inventory) do total += it.value end - fishSummary.Text = ("🐟 %d / %d · 💰 ≈%s"):format(#inventory, player:GetAttribute("BagCap") or 0, fmt(player:GetAttribute("BagValue") or total)) + fishSummary.Text = ("🐟 %d / %d · ⚪ ≈%s"):format(#inventory, player:GetAttribute("BagCap") or 0, fmt(player:GetAttribute("BagValue") or total)) if #inventory == 0 then text({ Size = UDim2.fromOffset(400, 60), Font = TITLE, TextSize = 20, TextColor3 = C.muted, TextWrapped = true, Text = "Сумка пуста. Иди к воде и поймай рыбу! 🎣", Parent = fishGrid }) return @@ -771,7 +861,7 @@ bagWin.render = function(tab) local mut = it.mutation and Config.Find(Config.Mutations, it.mutation) local card = fishCard(fishGrid, i, r.color, mut and mut.color) local view = new("Frame", { Size = UDim2.new(1, -12, 0, 84), Position = UDim2.fromOffset(6, 6), BackgroundTransparency = 1, Parent = card }) - viewport(view, Models.buildFish(it.id, it.mutation, 1, true), FISH_VIEW, 0.72) + viewport(view, Models.buildFish(it.id, it.mutation, 1, true), VIEW.fish, 0.72) if mut then local tag = new("Frame", { Size = UDim2.fromOffset(0, 20), AutomaticSize = Enum.AutomaticSize.X, Position = UDim2.fromOffset(6, 6), BackgroundColor3 = mut.color, ZIndex = 3, Parent = card }, { corner(6), new("UIPadding", { PaddingLeft = UDim.new(0, 6), PaddingRight = UDim.new(0, 6) }) }) @@ -779,7 +869,7 @@ bagWin.render = function(tab) end text({ Size = UDim2.new(1, -10, 0, 20), Position = UDim2.fromOffset(6, 92), Font = TITLE, TextSize = 16, TextColor3 = r.color, Text = it.name, TextTruncate = Enum.TextTruncate.AtEnd, Parent = card }) text({ Size = UDim2.new(1, -10, 0, 16), Position = UDim2.fromOffset(6, 112), Font = BODY2, TextSize = 13, TextColor3 = C.muted, Text = ("%.2f кг · %s"):format(it.weight, r.name), Parent = card }) - btn({ Size = UDim2.new(1, -12, 0, 32), Position = UDim2.fromOffset(6, 136), BackgroundColor3 = C.green, Text = "💰 " .. fmt(it.value), TextSize = 17, Parent = card }, function() + btn({ Size = UDim2.new(1, -12, 0, 32), Position = UDim2.fromOffset(6, 136), BackgroundColor3 = C.green, Text = "⚪ " .. fmt(it.value), TextSize = 17, Parent = card }, function() remote:FireServer("SellOne", it.uid) end) end @@ -828,6 +918,8 @@ worldsWin.render = function() bText, bColor, active = "Скоро…", C.grey, false elseif myLevel < w.level then bText, bColor, active = "🔒 Ур. " .. w.level, C.grey, false + elseif (Config.Guild.worldRank[w.id] or 1) > (player:GetAttribute("RankIdx") or 1) then + bText, bColor, active = "🔒 Ранг " .. Config.Guild.ranks[Config.Guild.worldRank[w.id]].id, C.grey, false elseif here and here.id == w.id then bText, bColor, active = "Вы здесь", C.grey, false else @@ -836,7 +928,8 @@ worldsWin.render = function() itemRow(worldsList, i, { icon = w.icon, iconBg = w.color:Lerp(C.bg, 0.6), title = w.name, titleColor = w.color, - lines = w.desc .. "\n" .. (w.soon and "В разработке" or ("Уровень: %d · Рыб поймано: %d / %d · Награды x%d"):format(w.level, found, total, w.mult)), + lines = w.desc .. "\n" .. (w.soon and "В разработке" or ("Уровень: %d%s · Рыб поймано: %d / %d · Награды x%d"):format(w.level, + Config.Guild.worldRank[w.id] and (", ранг " .. Config.Guild.ranks[Config.Guild.worldRank[w.id]].id) or "", found, total, w.mult)), strokeColor = (here and here.id == w.id) and C.gold or nil, buttonText = bText, buttonColor = bColor, active = active, onClick = function() @@ -856,35 +949,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 @@ -900,10 +1013,10 @@ questWin.render = function(tab) local cell = new("Frame", { BackgroundColor3 = WHITE, Parent = row }, { corner(12), stroke(isNext and C.gold or C.line, isNext and 3 or 2, isNext and 0 or 0.4), gradient(isNext and Color3.fromRGB(90, 70, 20) or C.panel2, C.panel, 90) }) text({ Size = UDim2.new(1, 0, 0, 24), Position = UDim2.fromOffset(0, 6), Font = TITLE, TextSize = 15, TextXAlignment = Enum.TextXAlignment.Center, Text = "День " .. d, Parent = cell }) - text({ Size = UDim2.new(1, 0, 0, 44), Position = UDim2.fromOffset(0, 32), TextSize = 32, TextXAlignment = Enum.TextXAlignment.Center, Text = passed and "✅" or (r.potion and "🧪" or "💰"), Parent = cell }) + text({ Size = UDim2.new(1, 0, 0, 44), Position = UDim2.fromOffset(0, 32), TextSize = 32, TextXAlignment = Enum.TextXAlignment.Center, Text = passed and "✅" or (r.potion and "🧪" or "⚪"), Parent = cell }) text({ Size = UDim2.new(1, -6, 0, 50), Position = UDim2.fromOffset(3, 80), Font = BODY2, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Center, TextWrapped = true, TextColor3 = C.gold, - Text = fmt(r.coins * (1 + (myLevel - 1) * 0.2)) .. " 💰" .. (r.potion and "\n+ зелье" or ""), Parent = cell, + Text = fmt(r.coins * (1 + (myLevel - 1) * 0.2)) .. " ⚪" .. (r.potion and "\n+ зелье" or ""), Parent = cell, }) end btn({ @@ -920,7 +1033,7 @@ end local robuxWin = makeWindow("💎 Премиум", Color3.fromRGB(150, 80, 210), { { id = "passes", label = "👑 Пропуска" }, - { id = "products", label = "🪙 Наборы" }, + { id = "products", label = "⚪ Наборы" }, }) local robuxLists = { passes = scrollArea(robuxWin.pages.passes), products = scrollArea(robuxWin.pages.products) } @@ -939,7 +1052,7 @@ robuxWin.render = function(tab) buttonText = has and "Куплено ✓" or ("R$ " .. it.robux), buttonColor = has and C.grey or C.green, active = not has, onClick = function() if not it.id or it.id == 0 then - notify("Товар ещё не настроен: впиши его ID в FishConfig", Color3.fromRGB(255, 200, 120)) + notify("⚙ Товар не настроен", Color3.fromRGB(255, 200, 120)) return end if tab == "passes" then @@ -952,6 +1065,50 @@ robuxWin.render = function(tab) end end +---------------------------------------------------------------- настройки звука + +local settingsWin = makeWindow("⚙ Настройки", Color3.fromRGB(150, 120, 80), { { id = "sound", label = "Звук" } }) +local settingsPage = settingsWin.pages.sound +local volumes = { + music = player:GetAttribute("VolMusic") or Config.DefaultVolume.music, + sfx = player:GetAttribute("VolSfx") or Config.DefaultVolume.sfx, +} + +local function setVolume(key, value) + volumes[key] = math.clamp(math.floor(value * 10 + 0.5) / 10, 0, 1) + -- сразу у себя (слышно без задержки), сервер сохранит и подтвердит + player:SetAttribute(key == "music" and "VolMusic" or "VolSfx", volumes[key]) + remote:FireServer("Settings", volumes.music, volumes.sfx) + settingsWin.refresh() +end + +settingsWin.render = function() + clear(settingsPage) + for i, row in ipairs({ { "music", "🎵 Музыка" }, { "sfx", "🔊 Звуки и окружение" } }) do + local key, label = row[1], row[2] + local f = new("Frame", { Size = UDim2.new(1, -4, 0, 70), Position = UDim2.fromOffset(0, (i - 1) * 82), BackgroundColor3 = WHITE, Parent = settingsPage }, + { corner(14), stroke(C.line, 2, 0.45), gradient(C.panel2, C.panel, 90) }) + text({ Size = UDim2.new(1, -260, 1, 0), Position = UDim2.fromOffset(18, 0), Font = TITLE, TextSize = 21, Text = label, Parent = f }) + btn({ Size = UDim2.fromOffset(52, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -170, 0.5, 0), BackgroundColor3 = C.grey, Text = "−", TextSize = 26, Parent = f }, function() + setVolume(key, volumes[key] - 0.1) + end) + text({ Size = UDim2.fromOffset(90, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -74, 0.5, 0), Font = TITLE, TextSize = 22, + TextXAlignment = Enum.TextXAlignment.Center, TextColor3 = C.gold, Text = math.floor(volumes[key] * 100 + 0.5) .. "%", Parent = f }) + btn({ Size = UDim2.fromOffset(52, 46), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -14, 0.5, 0), BackgroundColor3 = C.green, Text = "+", TextSize = 26, Parent = f }, function() + setVolume(key, volumes[key] + 0.1) + end) + end +end +-- сервер прислал сохранённую громкость +player:GetAttributeChangedSignal("VolMusic"):Connect(function() + volumes.music = player:GetAttribute("VolMusic") or volumes.music + settingsWin.refresh() +end) +player:GetAttributeChangedSignal("VolSfx"):Connect(function() + volumes.sfx = player:GetAttribute("VolSfx") or volumes.sfx + settingsWin.refresh() +end) + ---------------------------------------------------------------- боковые кнопки sideButton(1, "🎒", "Сумка", "B", Color3.fromRGB(60, 140, 220), function() @@ -969,15 +1126,42 @@ end) sideButton(5, "💎", "Донат", nil, Color3.fromRGB(150, 80, 210), function() robuxWin.toggle() end) +sideButton(6, "⚙", "Звук", nil, Color3.fromRGB(150, 120, 80), function() + settingsWin.toggle() +end) + +-- раскладка: компьютер — как раньше; телефон — HUD и кнопки компактнее, кнопки сеткой 3×N под HUD +-- (левый низ свободен под джойстик, правый низ — под кнопку прыжка) +do + local function scaleOf(obj) + local sc = obj:FindFirstChild("LayoutScale") or new("UIScale", { Name = "LayoutScale", Parent = obj }) + return sc + end + local grid = side:FindFirstChildOfClass("UIGridLayout") + Theme.onLayout(function(compact) + scaleOf(hud.Parent).Scale = compact and 0.82 or 1 + hud.Parent.Position = compact and UDim2.fromOffset(8, 6) or UDim2.fromOffset(12, 10) + grid.CellSize = compact and UDim2.fromOffset(52, 52) or UDim2.fromOffset(62, 62) + grid.CellPadding = compact and UDim2.fromOffset(6, 6) or UDim2.fromOffset(6, 6) + grid.FillDirectionMaxCells = compact and 3 or 1 + side.AnchorPoint = Vector2.zero + -- под HUD (он выше на строку гильдии — её добавляет GuildClient) + side.Position = compact and UDim2.fromOffset(8, 172) or UDim2.fromOffset(12, 216) + side.Size = compact and UDim2.fromOffset(170, 240) or UDim2.fromOffset(70, 480) + toasts.Size = compact and UDim2.fromOffset(640, 200) or UDim2.fromOffset(900, 200) + toasts.Position = compact and UDim2.new(0.5, 0, 0, 66) or UDim2.new(0.5, 0, 0, 84) + scaleOf(toasts).Scale = compact and 0.75 or 1 + scaleOf(catchCard).Scale = compact and 0.8 or 1 + scaleOf(mgFrame).Scale = compact and 0.85 or 1 + mgFrame.Position = compact and UDim2.new(0.5, 0, 1, -60) or UDim2.new(0.5, 0, 1, -100) + scaleOf(eventBanner).Scale = compact and 0.8 or 1 + statusLabel:FindFirstChildOfClass("TextLabel").TextSize = compact and 28 or 36 + end) +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] @@ -1006,18 +1190,18 @@ end local function refreshHud() local xp = player:GetAttribute("XP") or 0 local need = player:GetAttribute("XPNeed") or 100 - coinsText.Text = "💰 " .. fmt(player:GetAttribute("Coins") or 0) - lvlText.Text = tostring(player:GetAttribute("Level") or 1) - xpText.Text = ("%d / %d XP"):format(xp, need) - TweenService:Create(xpFill, TweenInfo.new(0.3), { Size = UDim2.fromScale(math.clamp(xp / need, 0, 1), 1) }):Play() + H.coins.Text = "⚪ " .. fmt(player:GetAttribute("Coins") or 0) + H.lvl.Text = tostring(player:GetAttribute("Level") or 1) + H.xpText.Text = ("%d / %d XP"):format(xp, need) + TweenService:Create(H.xpFill, TweenInfo.new(0.3), { Size = UDim2.fromScale(math.clamp(xp / need, 0, 1), 1) }):Play() local boost = player:GetAttribute("BoostBonus") or 0 - luckText.Text = ("🍀 Удача %d%%%s"):format(player:GetAttribute("Luck") or 100, + H.luck.Text = ("🍀 Удача %d%%%s"):format(player:GetAttribute("Luck") or 100, boost > 0 and (" 🧪 +%d%% %s"):format(boost * 100, timeStr(player:GetAttribute("BoostLeft") or 0)) or "") local count, cap = player:GetAttribute("BagCount") or 0, player:GetAttribute("BagCap") or 10 - bagText.Text = ("🎒 %d / %d · ≈ %s 💰"):format(count, cap, fmt(player:GetAttribute("BagValue") or 0)) - bagText.TextColor3 = count >= cap and Color3.fromRGB(255, 120, 120) or C.text + H.bag.Text = ("🎒 %d / %d · ≈ %s ⚪"):format(count, cap, fmt(player:GetAttribute("BagValue") or 0)) + H.bag.TextColor3 = count >= cap and Color3.fromRGB(255, 120, 120) or C.text local rod = Config.Find(Config.Rods, player:GetAttribute("Rod") or "Basic") - rodText.Text = ("🎣 %s %s"):format(rod and rod.name or "", stars(player:GetAttribute("RodLevel") or 0)) + H.rod.Text = ("🎣 %s %s"):format(rod and rod.name or "", stars(player:GetAttribute("RodLevel") or 0)) end local pending = false @@ -1045,18 +1229,291 @@ refreshHud() local state = "idle" local mg = { pos = 0, dir = 1, speed = 1, zoneStart = 0.4, zoneWidth = 0.25, hits = 0, need = 1, misses = 0, maxMisses = 2, deadline = 0, timeout = 10 } +-- с начала зарядки и до конца рыбалки персонажем не управляем: не ходит, не прыгает, не поворачивается +local ContextActionService = game:GetService("ContextActionService") +local MOVE_KEYS = { + Enum.KeyCode.W, Enum.KeyCode.A, Enum.KeyCode.S, Enum.KeyCode.D, Enum.KeyCode.Space, + Enum.KeyCode.Up, Enum.KeyCode.Down, Enum.KeyCode.Left, Enum.KeyCode.Right, + Enum.KeyCode.Thumbstick1, Enum.KeyCode.ButtonA, +} +local controls +local movementLocked = false +local function setMovementLocked(locked) + if not controls then + local pm = player:FindFirstChild("PlayerScripts") and player.PlayerScripts:FindFirstChild("PlayerModule") + local ok, mod = pcall(require, pm) + controls = ok and mod and mod:GetControls() or nil + end + if controls then + if locked then + controls:Disable() + else + controls:Enable() + end + end + if locked ~= movementLocked then + movementLocked = locked + if locked then + ContextActionService:BindActionAtPriority("FishingLock", function() + return Enum.ContextActionResult.Sink + end, false, Enum.ContextActionPriority.High.Value + 100, table.unpack(MOVE_KEYS)) + else + ContextActionService:UnbindAction("FishingLock") + end + end + local hum = player.Character and player.Character:FindFirstChildOfClass("Humanoid") + if hum then + hum.AutoRotate = not locked + hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, not locked) + if locked then + hum:Move(Vector3.zero) + end + end +end + +local function easeInOut(a) + return a < 0.5 and 4 * a * a * a or 1 - (-2 * a + 2) ^ 3 / 2 +end +local function easeOut(a) + return 1 - (1 - a) ^ 3 +end + +---------------------------------------------------------------- заброс: зарядка, шкала силы, наклон удочки +-- держишь ЛКМ — сила растёт, удочка уходит назад; отпустил — бросок на дальность по силе + +local REST_ANGLE, BACK_ANGLE = 30, 110 -- удочка в покое (как в GameServer) и в полном замахе +local function gripCF(angle) + return (CFrame.Angles(math.rad(angle), 0, 0) * CFrame.new(0, 0, -0.3)):Inverse() +end + +local charge = nil -- { t0, tool } +local castTool = nil -- удочка последнего броска: вернуть её в покой, если бросок не удался +-- сила ездит туда-сюда: 0 → 1 за CastChargeTime, потом обратно к 0 и снова вверх, пока держишь ЛКМ +local function chargePower() + if not charge then + return 0 + end + local t = ((os.clock() - charge.t0) / Config.CastChargeTime) % 2 + return t <= 1 and t or 2 - t +end +local function inPerfect(v) + return v >= Config.CastPerfect[1] and v <= Config.CastPerfect[2] +end + +-- шкала-дуга справа от персонажа: внизу слабый бросок, вверху сильный, зелёная зона — бонус удачи +local GAUGE_R, GAUGE_DEG, GAUGE_N = 190, 110, 32 +local gauge = new("Frame", { + Size = UDim2.fromOffset(150, 280), AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0.57, 0, 0.48, 0), + BackgroundTransparency = 1, Visible = false, Parent = screen, +}) +local GAUGE_C = Vector2.new(110 - GAUGE_R, 140) -- центр окружности левее рамки: дуга выгнута вправо +local function arcPoint(v, r) + local th = math.rad(-GAUGE_DEG / 2 + GAUGE_DEG * v) + return GAUGE_C + Vector2.new(math.cos(th) * r, -math.sin(th) * r), -math.deg(th) +end +do + local segLen = 2 * math.pi * GAUGE_R * (GAUGE_DEG / 360) / GAUGE_N + for _, layer in ipairs({ { 46, 4, BLACK }, { 34, 1 } }) do -- чёрная обводка, потом цветные секции + for i = 0, GAUGE_N - 1 do + local v = (i + 0.5) / GAUGE_N + local pos, rot = arcPoint(v, GAUGE_R) + local color = layer[3] + or ((v < 0.12 or v > 0.94) and C.red) + or (inPerfect(v) and Color3.fromRGB(110, 235, 60)) + or Color3.fromRGB(40, 70, 95) + new("Frame", { + Size = UDim2.fromOffset(layer[1], segLen + layer[2]), AnchorPoint = Vector2.new(0.5, 0.5), + Position = UDim2.fromOffset(pos.X, pos.Y), Rotation = rot, BorderSizePixel = 0, + BackgroundColor3 = color, Parent = gauge, + }) + end + end +end +local needle = new("Frame", { + Size = UDim2.fromOffset(64, 8), AnchorPoint = Vector2.new(0.5, 0.5), BackgroundColor3 = WHITE, + BorderSizePixel = 0, ZIndex = 3, Parent = gauge, +}, { corner(4), stroke(BLACK, 2) }) +local multLabel = text({ + Size = UDim2.fromOffset(110, 40), AnchorPoint = Vector2.new(0.5, 1), Font = TITLE, TextSize = 34, + Text = "×" .. Config.CastPerfectLuck, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 4, + Visible = false, Parent = gauge, +}) +new("UIStroke", { Color = BLACK, Thickness = 3, Parent = multLabel }) +do + local top = arcPoint(1, GAUGE_R) + multLabel.Position = UDim2.fromOffset(top.X + 10, top.Y - 18) +end + +local function updateCharge() + local p = chargePower() + local pos, rot = arcPoint(p, GAUGE_R) + needle.Position = UDim2.fromOffset(pos.X, pos.Y) + needle.Rotation = rot + local good = inPerfect(p) + multLabel.Visible = good + needle.BackgroundColor3 = good and Color3.fromRGB(190, 255, 150) or WHITE + if charge.tool and charge.tool.Parent then + charge.tool.Grip = gripCF(REST_ANGLE + (BACK_ANGLE - REST_ANGLE) * easeOut(p)) + end +end + +---------------------------------------------------------------- камера при забросе +-- зарядка: камера уходит в сторону от персонажа и отъезжает тем дальше, чем сильнее замах; +-- бросок: камера сбоку разгоняется за поплавком; потом сверху-сбоку держит в кадре игрока и поплавок + +local CAM_IN, CAM_SETTLE, CAM_RETURN = 0.35, 0.8, 0.6 +local UP = Vector3.new(0, 1, 0) +local fishCam = nil + +local function sideCF(fc, p) + return CFrame.lookAt(fc.hrp + fc.r * (9 + 3 * p) - fc.f * (3 + 2 * p) + UP * (3 + 1.5 * p), fc.hrp + fc.f * 6 + UP) +end +local function chaseCF(fc, p) + return CFrame.lookAt(p + fc.r * 9 - fc.f * 5 + UP * 3, p + fc.f * 3) +end +local function restCF(fc) + local d = ((fc.target - fc.hrp) * Vector3.new(1, 0, 1)).Magnitude + local mid = fc.hrp:Lerp(fc.target, 0.5) + return CFrame.lookAt(mid + fc.r * (8 + d * 0.55) - fc.f * 4 + UP * (6 + d * 0.25), fc.hrp:Lerp(fc.target, 0.6)) +end + +local function fishCamStep() + local fc = fishCam + local cam = workspace.CurrentCamera + if not fc or not cam then + return + end + if fc.returning then + local a = math.min(1, (os.clock() - fc.returning) / CAM_RETURN) + local e = easeInOut(a) + cam.CFrame = fc.leaveCF:Lerp(fc.origCF, e) + cam.FieldOfView = fc.leaveFov + (fc.origFov - fc.leaveFov) * e + if a >= 1 then + RunService:UnbindFromRenderStep("FishCam") + cam.CameraType = Enum.CameraType.Custom + fishCam = nil + end + return + end + local now = os.clock() + local cf, fov + if not fc.castT0 then + -- зарядка: плавно уходим в вид сбоку; чем сильнее замах, тем дальше камера и шире обзор + -- после отпускания ЛКМ, пока ждём ответ сервера, держим набранную силу + local p = charge and chargePower() or (fc.power or 0) + fc.power = p + local e = easeOut(math.min(1, (now - fc.t0) / CAM_IN)) + cf = fc.origCF:Lerp(sideCF(fc, p), e) + fov = fc.origFov + 12 * p * e + else + local th = fc.throw + local t = now - fc.castT0 + local lunge = fc.fromCF + fc.f * 1.5 + if t < th.windup then + -- рывок удочки вперёд: камера подаётся следом + local e = easeOut(t / th.windup) + cf = fc.fromCF:Lerp(lunge, e) + fov = fc.fromFov + 4 * e + elseif t < th.windup + th.flight then + if not fc.start then + fc.start = (fc.tip and fc.tip.Parent and fc.tip.WorldPosition) or (fc.hrp + fc.f * 2 + UP * 4) + end + local a = (t - th.windup) / th.flight + local p = fc.start:Lerp(fc.target, a) + UP * (math.sin(a * math.pi) * th.arc) -- та же дуга, что у поплавка + local e = easeInOut(a) + cf = lunge:Lerp(chaseCF(fc, p), e) + fov = (fc.fromFov + 4) + ((fc.origFov - 6) - (fc.fromFov + 4)) * e + else + local e = easeOut(math.min(1, (t - th.windup - th.flight) / CAM_SETTLE)) + local sway = Vector3.new(math.sin(now * 0.7) * 0.5, math.sin(now * 1.1) * 0.25, 0) + if state == "bite" then + sway += Vector3.new(math.random() - 0.5, math.random() - 0.5, 0) * 0.15 + end + cf = chaseCF(fc, fc.target):Lerp(restCF(fc) + sway, e) + fov = fc.origFov - 6 + 6 * e + end + end + cam.CFrame = cf + cam.FieldOfView = fov +end + +-- начало зарядки: dir — куда полетит поплавок (к центру озера) +local function startChargeCam(tool, dir) + local cam = workspace.CurrentCamera + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if not cam or not hrp then + return + end + fishCam = { + t0 = os.clock(), hrp = hrp.Position, f = dir, r = dir:Cross(UP), + tip = tool:FindFirstChild("Handle") and tool.Handle:FindFirstChild("Tip"), + -- если камера ещё возвращалась с прошлого заброса, возвращаться будем туда же + origCF = fishCam and fishCam.origCF or cam.CFrame, + origFov = fishCam and fishCam.origFov or cam.FieldOfView, + } + cam.CameraType = Enum.CameraType.Scriptable + RunService:UnbindFromRenderStep("FishCam") + RunService:BindToRenderStep("FishCam", Enum.RenderPriority.Camera.Value + 1, fishCamStep) +end + +-- сервер принял бросок: target — куда упадёт поплавок, throw — тайминги и высота дуги +local function startCastCam(target, throw) + local cam = workspace.CurrentCamera + if not fishCam or fishCam.returning or not cam or typeof(target) ~= "Vector3" or type(throw) ~= "table" then + return + end + fishCam.castT0 = os.clock() + fishCam.target = target + fishCam.throw = throw + fishCam.fromCF = cam.CFrame + fishCam.fromFov = cam.FieldOfView +end + +local function stopFishCam() + local cam = workspace.CurrentCamera + if not fishCam or fishCam.returning or not cam then + return + end + fishCam.returning = os.clock() + fishCam.leaveCF = cam.CFrame + fishCam.leaveFov = cam.FieldOfView +end + +local reelToken local function setState(s) + if s ~= "charging" and charge then + -- зарядку прервали (убрал удочку и т.п.): удочку обратно в покой + if charge.tool.Parent then + charge.tool.Grip = gripCF(REST_ANGLE) + end + charge = nil + end state = s + Audio.fade(reelSound, s == "bite" and 1 or 0, s == "bite" and 0.2 or 0.4) statusLabel.Visible = (s == "waiting") mgFrame.Visible = (s == "bite") + gauge.Visible = (s == "charging") + setMovementLocked(s ~= "idle") + if s == "idle" then + stopFishCam() + elseif s == "reeling" then + -- на случай, если сервер не ответит на вытаскивание: не оставляем игрока замороженным + local token = {} + reelToken = token + task.delay(4, function() + if state == "reeling" and reelToken == token then + setState("idle") + end + end) + end end local function updatePips() - pipsText.Text = "🎯 " .. string.rep("●", mg.hits) .. string.rep("●", mg.need - mg.hits) - missText.Text = string.rep("✖", mg.misses) .. string.rep("❤️", mg.maxMisses - mg.misses) + pipsText.Text = "🎯 " .. string.rep("●", mg.hits) .. string.rep("●", mg.need - mg.hits) + missText.Text = string.rep("✖", mg.misses) .. string.rep("❤️", mg.maxMisses - mg.misses) end local function flash(color) bar.BackgroundColor3 = color - TweenService:Create(bar, TweenInfo.new(0.35), { BackgroundColor3 = Color3.fromRGB(22, 28, 46) }):Play() + TweenService:Create(bar, TweenInfo.new(0.35), { BackgroundColor3 = C.dark }):Play() end local function placeZone() mg.zoneStart = math.random() * (1 - mg.zoneWidth) @@ -1064,11 +1521,45 @@ local function placeZone() zoneF.Position = UDim2.fromScale(mg.zoneStart, 0) end +-- ЛКМ зажата: персонаж разворачивается к центру озера, начинается зарядка +local function startCharge(tool) + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + if not hrp then + return + end + local world = Config.WorldAt(hrp.Position) + -- из воды и издалека не заряжаем вовсе: сразу подсказка + local can = Config.CanCastFrom(world, hrp.Position, player.Character:FindFirstChildOfClass("Humanoid")) + if can ~= true then + notify(can, Color3.fromRGB(255, 200, 120)) + return + end + local dir = Config.CastDirection(world, hrp.Position) + if not dir then + dir = hrp.CFrame.LookVector * Vector3.new(1, 0, 1) + dir = dir.Magnitude > 0.01 and dir.Unit or Vector3.new(0, 0, -1) + end + hrp.CFrame = CFrame.lookAt(hrp.Position, hrp.Position + dir) + charge = { t0 = os.clock(), tool = tool } + setState("charging") + startChargeCam(tool, dir) + updateCharge() +end + +-- ЛКМ отпущена: бросок с набранной силой +local function releaseCast() + if state ~= "charging" or not charge then + return + end + local power = chargePower() + castTool = charge.tool + charge = nil -- удочку не возвращаем: сервер сам сделает рывок вперёд + setState("casting") + remote:FireServer("Cast", power) +end + local function onActivate() - if state == "idle" then - setState("casting") - remote:FireServer("Cast") - elseif state == "waiting" then + if state == "waiting" then remote:FireServer("Cancel") setState("idle") elseif state == "bite" then @@ -1102,7 +1593,14 @@ local function hookTool(tool) return end hooked[tool] = true - tool.Activated:Connect(onActivate) + tool.Activated:Connect(function() + if state == "idle" then + startCharge(tool) + else + onActivate() + end + end) + tool.Deactivated:Connect(releaseCast) tool.Unequipped:Connect(function() if state == "waiting" or state == "bite" or state == "casting" then remote:FireServer("Cancel") @@ -1132,6 +1630,12 @@ if player.Character then watch(player.Character) end +RunService.RenderStepped:Connect(function() + if state == "charging" and charge then + updateCharge() + end +end) + RunService.RenderStepped:Connect(function(dt) if state ~= "bite" then return @@ -1181,33 +1685,272 @@ local snow = new("ParticleEmitter", { }) local lastWorldId = "none" local terrain = workspace.Terrain -local defaultWater = Color3.fromRGB(20, 95, 115) -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 +local DEFAULT_LOOK = { tint = Color3.new(1, 1, 1) } +local defaultTerrainColors = nil + +-- world.look: свет и эффекты мира; при выходе свойства возвращаются к тем, что были до первого входа +local lookTargets = { + lighting = function() return Lighting end, + atmosphere = function() return Lighting:FindFirstChildOfClass("Atmosphere") end, + color = function() return Lighting:FindFirstChildOfClass("ColorCorrectionEffect") end, + bloom = function() return Lighting:FindFirstChildOfClass("BloomEffect") end, + sunRays = function() return Lighting:FindFirstChildOfClass("SunRaysEffect") end, + dof = function() + return Lighting:FindFirstChildOfClass("DepthOfFieldEffect") + or new("DepthOfFieldEffect", { Enabled = false, Parent = Lighting }) + end, + grading = function() return Lighting:FindFirstChildOfClass("ColorGradingEffect") end, +} +local lookDefaults = {} +-- лобби настраивается так же, как миры +local lookSources = table.clone(Config.Worlds) +table.insert(lookSources, Config.Lobby) + +-- смена света: плавно или сразу (за экраном загрузки) +local lookTweens = {} +local function setLook(obj, goal, instant) + if instant then + for prop, v in pairs(goal) do + obj[prop] = v + end + else + local tw = TweenService:Create(obj, TweenInfo.new(2), goal) + table.insert(lookTweens, tw) + tw:Play() + end +end + +-- погода сгущает дымку поверх настроек локации (туман — сильно, дождь и гроза — слегка) +local WEATHER_ATMO = { + Fog = { Density = 0.22, Haze = 1.5 }, + Rain = { Density = 0.06, Haze = 0.4 }, + Storm = { Density = 0.12, Haze = 0.8 }, +} +local function weatherAtmo(prop) + local add = WEATHER_ATMO[workspace:GetAttribute("Weather") or ""] + return (add and add[prop]) or 0 +end + +local function applyLook(world, instant) + -- исходные значения запоминаем до первой правки; эффект мог ещё не прийти с сервера, тогда в следующий раз + for _, w in ipairs(lookSources) do + for section, props in pairs(w.look or {}) do + local obj = lookTargets[section] and lookTargets[section]() + if obj then + lookDefaults[section] = lookDefaults[section] or {} + for prop in pairs(props) do + if lookDefaults[section][prop] == nil then + lookDefaults[section][prop] = obj[prop] + end + end + end + end + end + local look = (world and world.look) or {} + for section, defaults in pairs(lookDefaults) do + local obj = lookTargets[section]() + if obj then + local goal = {} + for prop, def in pairs(defaults) do + local v = look[section] and look[section][prop] + if v == nil then v = def end + if section == "atmosphere" and typeof(v) == "number" then + v += weatherAtmo(prop) + end + -- плавно меняются только числа и цвета; флаги и режимы (EnumItem) ставим сразу + local kind = typeof(v) + if kind == "number" or kind == "Color3" then goal[prop] = v else obj[prop] = v end + end + setLook(obj, goal, instant) + end + end +end + +local function applyAmbience(world, instant) + -- прошлая плавная смена ещё может идти — она перебила бы новые значения + for _, tw in ipairs(lookTweens) do + tw:Cancel() + end + table.clear(lookTweens) + world = world or Config.Lobby + -- при смене суток часы двигает Ambience; иначе у каждой локации своё время + if not Config.DayNight.enabled then + setLook(Lighting, { ClockTime = (world and world.clock) or 14.5 }, instant) + end + local cc = Lighting:FindFirstChildOfClass("ColorCorrectionEffect") + if cc then + setLook(cc, { TintColor = (world and world.tint) or DEFAULT_LOOK.tint }, instant) + end + -- цвета материалов террейна общие для всей карты, поэтому меняем их только у себя и возвращаем при выходе + if not defaultTerrainColors then + defaultTerrainColors = {} + for _, name in ipairs({ "Snow", "Salt", "Mud", "Sand", "Rock", "Slate", "Grass", "Ground" }) do + defaultTerrainColors[name] = terrain:GetMaterialColor(Enum.Material[name]) + end + end + local colors = (world and world.terrainColors) or {} + for name, def in pairs(defaultTerrainColors) do + terrain:SetMaterialColor(Enum.Material[name], colors[name] or def) + end local atm = Lighting:FindFirstChildOfClass("Atmosphere") if atm then local frost = world and world.id == "World3" - TweenService:Create(atm, TweenInfo.new(2), { + setLook(atm, { Density = frost and 0.38 or 0.25, Color = frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232), - }):Play() + }, instant) end + applyLook(world, instant) snow.Rate = (world and world.id == "World3") and 140 or 0 end +-- тёмные силуэты рыб под прозрачной водой «Тихого озера», медленно плавают по кругу (только у этого игрока) +do + local w1 = Config.Worlds[1] + local fishList = Config.Zones.World1.fish + local frng = Random.new(11) + local folder = new("Folder", { Name = "FishShadows", Parent = workspace }) + local swimmers = {} + for i = 1, 10 do + local l = w1.lakes[(i - 1) % #w1.lakes + 1] + local ok, model = pcall(Models.buildFish, fishList[(i - 1) % #fishList + 1].id, nil, frng:NextNumber(1.3, 2), true) + if ok and model then + for _, d in ipairs(model:GetDescendants()) do + if d:IsA("BasePart") then + d.Color = Color3.fromRGB(22, 70, 74) + d.Material = Enum.Material.SmoothPlastic + d.Transparency = 0.5 + d.CanCollide, d.CanQuery, d.CanTouch, d.CastShadow = false, false, false, false + elseif d:IsA("Decal") or d:IsA("ParticleEmitter") or d:IsA("Light") then + d:Destroy() + end + end + model.Parent = folder + table.insert(swimmers, { + model = model, + c = w1.center + Vector3.new(l[1] + frng:NextNumber(-l[3], l[3]) * 0.25, w1.waterY - frng:NextNumber(1.4, 2.4), l[2] + frng:NextNumber(-l[3], l[3]) * 0.25), + r = l[3] * frng:NextNumber(0.25, 0.55), a = frng:NextNumber(0, math.pi * 2), + w = frng:NextNumber(0.08, 0.18) * (frng:NextNumber() < 0.5 and -1 or 1), + }) + end + end + local acc = 0 + RunService.Heartbeat:Connect(function(dt) + acc += dt + if acc < 1 / 30 then + return + end + local step = acc + acc = 0 + local w = currentWorld() + if not (w and w.id == "World1") then + return + end + for _, s in ipairs(swimmers) do + s.a += s.w * step + local pos = s.c + Vector3.new(math.cos(s.a) * s.r, math.sin(s.a * 3) * 0.2, math.sin(s.a) * s.r) + local dir = Vector3.new(-math.sin(s.a), 0, math.cos(s.a)) * math.sign(s.w) + -- голова рыбы смотрит в +X модели, поэтому разворачиваем на 90° + s.model:PivotTo(CFrame.lookAt(pos, pos + dir) * CFrame.Angles(0, math.rad(90), 0)) + end + end) +end + +-- экран загрузки (ReplicatedFirst/Loading): при входе и телепорте свет локации ставится, пока он закрывает картинку +local loadingGui = player:WaitForChild("PlayerGui"):WaitForChild("LoadingScreen", 10) +local function loadingVisible() + return loadingGui ~= nil and loadingGui.Enabled +end + +local function placeTitle(w) + return w and (w.icon .. " " .. w.name) or "🏠 Лобби" +end + +local function enterWorld(w, instant) + lastWorldId = w and w.id or "lobby" + applyAmbience(w, instant) + if w then + -- название локации — когда экран загрузки уже ушёл + task.spawn(function() + while loadingVisible() do + task.wait(0.1) + end + notify(w.icon .. " " .. w.name, w.color) + end) + end +end + +-- погода сменилась: плавно пересчитываем дымку текущей локации +workspace:GetAttributeChangedSignal("Weather"):Connect(function() + if lastWorldId ~= "none" and not loadingVisible() then + applyAmbience(currentWorld(), false) + end +end) + +-- новый уровень — арфа +do + local lastLevel = player:GetAttribute("Level") + player:GetAttributeChangedSignal("Level"):Connect(function() + local lv = player:GetAttribute("Level") + if lastLevel and lv and lv > lastLevel then + Audio.play("levelUp") + end + lastLevel = lv + end) +end + +-- первое появление: ждём персонажа, ставим свет его локации сразу и отпускаем экран загрузки +task.spawn(function() + local char = player.Character or player.CharacterAdded:Wait() + char:WaitForChild("HumanoidRootPart", 30) + local w = currentWorld() + enterWorld(w, true) + if loadingGui then + loadingGui:SetAttribute("Title", placeTitle(w)) + loadingGui:SetAttribute("Ready", true) + end +end) + +-- телепорт: экран загрузки закрывает картинку, сервер переносит персонажа, свет новой локации ставится сразу +local teleportToken = 0 +local function teleportLoading(targetId, delay) + teleportToken += 1 + local token = teleportToken + local target = Config.Find(Config.Worlds, targetId) + if loadingGui then + local now = os.clock() + loadingGui:SetAttribute("Ready", false) + loadingGui:SetAttribute("StartAt", now) + loadingGui:SetAttribute("MinUntil", now + Config.Loading.teleport) + loadingGui:SetAttribute("Title", placeTitle(target)) + loadingGui:SetAttribute("Visible", true) + end + task.spawn(function() + -- ждём, пока персонаж окажется в новой локации (или сдаёмся через пару секунд) + local deadline = os.clock() + delay + 3 + local w + repeat + task.wait() + w = currentWorld() + until (w and w.id or "Lobby") == targetId or os.clock() > deadline or token ~= teleportToken + if token ~= teleportToken then + return + end + enterWorld(w, true) + if loadingGui then + loadingGui:SetAttribute("Ready", true) + end + end) +end + task.spawn(function() while true do local w = currentWorld() local id = w and w.id or "lobby" - if id ~= lastWorldId then - lastWorldId = id - applyAmbience(w) - if w then - notify(w.icon .. " " .. w.name, w.color) - end + if id ~= lastWorldId and lastWorldId ~= "none" and not loadingVisible() then + enterWorld(w, false) -- без телепорта (например, после возрождения): плавно end local cam = workspace.CurrentCamera if cam then @@ -1227,14 +1970,757 @@ task.spawn(function() end end) +---------------------------------------------------------------- обучение: линия-подсказка +-- белые «стрелки» бегут по земле от игрока к цели текущего шага (см. Config.TutorialDone) + +local GUIDE_N, GUIDE_GAP, GUIDE_SPEED = 32, 3, 7 -- сколько стрелок, шаг между ними, скорость бега +local guideStep = 0 -- шаг, отправленный на сервер (атрибут Tutorial может прийти чуть позже) + +-- крупная мультяшная подсказка под уведомлениями: покачивается, при смене шага «выпрыгивает» +local guideHint, guideHintText = softPlate( + { Size = UDim2.fromOffset(0, 70), AutomaticSize = Enum.AutomaticSize.X, AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 10), Visible = false, Parent = screen }, + { TextSize = 42, Text = "" } +) +wobble(guideHint, 1.2, 1.6) +Theme.onLayout(function(compact) + guideHintText.TextSize = compact and 30 or 42 +end) +local lastHint = nil + +local guideFolder = new("Folder", { Name = "TutorialGuide", Parent = workspace }) +local chevrons = {} +for i = 1, GUIDE_N do + local arms = {} + for k = 1, 2 do + arms[k] = new("Part", { + Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false, CastShadow = false, + Material = Enum.Material.Neon, Color = Color3.fromRGB(70, 195, 255), Size = Vector3.new(0.5, 0.5, 2), Transparency = 1, + Parent = guideFolder, + }) + end + chevrons[i] = arms +end +-- два объёмных бруска стрелки «>» острием вперёд (по -Z) +local GUIDE_HEIGHT = 2.2 -- стрелки висят в воздухе над землёй +local ARM_CF = {} +for k, s in ipairs({ -1, 1 }) do + local center = Vector3.new(s * 0.65, 0, -0.15) + ARM_CF[k] = CFrame.lookAt(center, center + Vector3.new(s * 1.3, 0, 1.5)) +end +local function hideChevrons(from) + for i = from, GUIDE_N do + chevrons[i][1].Transparency = 1 + chevrons[i][2].Transparency = 1 + end +end + +local guideRay = RaycastParams.new() +guideRay.FilterType = Enum.RaycastFilterType.Exclude +guideRay.RespectCanCollide = true +guideRay.IgnoreWater = false + +local function tutorialStep() + return math.max(player:GetAttribute("Tutorial") or 0, guideStep) +end +local function advanceTutorial(step) + if step > tutorialStep() then + guideStep = step + remote:FireServer("Tutorial", step) + if step >= Config.TutorialDone then + notify("🎓 Обучение пройдено!", C.gold) + end + end +end + +local function guideMarker(name) + local map = workspace:FindFirstChild("FishingMap") + local m = map and map:FindFirstChild(name, true) -- маркеры могут лежать в папках уровня (World1Map) + return m and m.Position +end + +-- объект цели обводится мягким светящимся контуром (атрибут GuideTarget ставит MapBuilder); +-- Occluded: то, что стоит перед объектом (персонаж на мостике), не перекрашивается +local guideHighlight = new("Highlight", { + FillColor = Color3.fromRGB(150, 225, 255), OutlineColor = Color3.fromRGB(190, 240, 255), + DepthMode = Enum.HighlightDepthMode.Occluded, Enabled = false, Parent = guideFolder, +}) +local guideObjects, guideScanAt = {}, {} +local function guideObject(key) + local obj = guideObjects[key] + if obj and obj.Parent then + return obj + end + -- карта большая: если объекта нет (ещё не загрузился), ищем заново не чаще раза в 2 секунды + if guideScanAt[key] and os.clock() - guideScanAt[key] < 2 then + return nil + end + guideScanAt[key] = os.clock() + local map = workspace:FindFirstChild("FishingMap") + if not map then + return nil + end + for _, d in ipairs(map:GetDescendants()) do + if d:GetAttribute("GuideTarget") == key then + guideObjects[key] = d + return d + end + end + return nil +end + +-- первый подход к табличке: камера крупно на табличку, управление и весь интерфейс убраны; +-- кнопка «Далее» плавно возвращает камеру, интерфейс и управление +local StarterGui = game:GetService("StarterGui") +local BOARD_CAM_TIME, BOARD_FOV = 0.8, 70 +local boardView = nil +local closeBoardView +-- кнопка в отдельном ScreenGui: основной интерфейс на это время выключается целиком +local boardGui = new("ScreenGui", { Name = "BoardView", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 50, Enabled = false, Parent = player:WaitForChild("PlayerGui") }) +btn({ + Size = UDim2.fromOffset(240, 60), AnchorPoint = Vector2.new(0.5, 1), Position = UDim2.new(0.5, 0, 1, -40), + BackgroundColor3 = C.green, Text = "Далее ▶", TextSize = 26, Parent = boardGui, +}, function() + closeBoardView() +end) + +local function setInterfaceHidden(hidden) + gui.Enabled = not hidden + boardGui.Enabled = hidden + pcall(function() + StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, not hidden) + end) + -- надписи над объектами (порталы, лавки) тоже прячем, потом возвращаем как было + if hidden then + boardView.billboards = {} + local map = workspace:FindFirstChild("FishingMap") + for _, d in ipairs(map and map:GetDescendants() or {}) do + if d:IsA("BillboardGui") and d.Enabled then + d.Enabled = false + table.insert(boardView.billboards, d) + end + end + elseif boardView and boardView.billboards then + for _, d in ipairs(boardView.billboards) do + d.Enabled = true + end + boardView.billboards = nil + end +end + +local function boardCamStep() + local bv, cam = boardView, workspace.CurrentCamera + if not bv or not cam then + return + end + local e = easeInOut(math.min(1, (os.clock() - bv.t0) / BOARD_CAM_TIME)) + cam.CFrame = bv.fromCF:Lerp(bv.toCF, e) + cam.FieldOfView = bv.fromFov + (bv.toFov - bv.fromFov) * e + if bv.returning and e >= 1 then + RunService:UnbindFromRenderStep("BoardCam") + cam.CameraType = Enum.CameraType.Custom + setInterfaceHidden(false) + boardView = nil + setMovementLocked(false) + end +end + +local function openBoardView(board) + local cam = workspace.CurrentCamera + -- отходим ровно настолько, чтобы табличка целиком влезла в кадр (по высоте и по ширине) с небольшим запасом + local half = math.tan(math.rad(BOARD_FOV / 2)) + local aspect = cam.ViewportSize.X / math.max(1, cam.ViewportSize.Y) + local dist = math.max((board.Size.Y / 2) / half, (board.Size.X / 2) / (half * aspect)) * 1.15 + boardView = { + t0 = os.clock(), origCF = cam.CFrame, origFov = cam.FieldOfView, + fromCF = cam.CFrame, fromFov = cam.FieldOfView, + -- надписи на лицевой стороне (Front), она смотрит по LookVector + toCF = CFrame.lookAt(board.Position + board.CFrame.LookVector * dist, board.Position), toFov = BOARD_FOV, + } + setMovementLocked(true) + setInterfaceHidden(true) + cam.CameraType = Enum.CameraType.Scriptable + RunService:UnbindFromRenderStep("BoardCam") + RunService:BindToRenderStep("BoardCam", Enum.RenderPriority.Camera.Value + 1, boardCamStep) +end + +closeBoardView = function() + local cam = workspace.CurrentCamera + if not boardView or boardView.returning or not cam then + return + end + boardGui.Enabled = false -- кнопка пропадает сразу, остальной интерфейс — когда камера вернётся + boardView.returning = true + boardView.t0 = os.clock() + boardView.fromCF, boardView.fromFov = cam.CFrame, cam.FieldOfView + boardView.toCF, boardView.toFov = boardView.origCF, boardView.origFov + advanceTutorial(1) +end + +-- скупка «Тихого озера»: ведём к прилавку с подсказкой «Продать» внутри лавки (GuideTarget = "Sell"), +-- поэтому стрелка идёт за лавкой, куда бы её ни переставили; маркер GuideSell — запасной вариант +local function sellTargetW1() + local shop = guideObject("Sell") + if shop then + for _, d in ipairs(shop:GetDescendants()) do + if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then + local p = d.Parent + local at = (p:IsA("BasePart") and p.Position) or (p:IsA("Attachment") and p.WorldPosition) + if at then + return at + end + end + end + return shop:IsA("Model") and shop:GetPivot().Position or shop.Position + end + return guideMarker("GuideSell") +end + +-- маршрут для текущего шага: точки ломаной (без игрока), подсказка и что подсветить; nil — линию не показываем +local function guideRoute(step, pos, world) + local inW1 = world and world.id == "World1" + if step == 0 and not world then + return { guideMarker("GuideBoard") }, "📋 Прочитай табличку", "Board" + elseif not world then -- шаги 1–3 из лобби: сначала в портал + return { guideMarker("GuidePortal") }, "🌊 Иди в портал", "Portal" + elseif step == 2 and inW1 then + return { guideMarker("GuideFishSpot") }, "🎣 Зажми ЛКМ у воды", "Pier" + elseif step == 3 and inW1 then + return { sellTargetW1() }, "⚪ Продай рыбу", "Sell" -- лавка у самого причала, идём напрямую + end + return nil +end + +-- ближайшая скупка в этом мире (или в лобби): прилавки с ProximityPrompt Action = "Sell" +local nearestSell +do +local sellSpots, sellScanAt = {}, -math.huge +nearestSell = function(pos, world) + if #sellSpots == 0 and os.clock() - sellScanAt > 3 then + sellScanAt = os.clock() + local map = workspace:FindFirstChild("FishingMap") + for _, d in ipairs(map and map:GetDescendants() or {}) do + if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then + local p = d.Parent + local at = (p:IsA("BasePart") and p.Position) or (p:IsA("Attachment") and p.WorldPosition) or (p:IsA("Model") and p:GetPivot().Position) + if at then + table.insert(sellSpots, at) + end + end + end + end + local best, bestD = nil, nil + for _, at in ipairs(sellSpots) do + if Config.WorldAt(at) == world then + local d = (at - pos).Magnitude + if not bestD or d < bestD then + best, bestD = at, d + end + end + end + return best +end +end + +RunService.RenderStepped:Connect(function() + local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart") + local step = tutorialStep() + -- пока сервер не прислал шаг (данные ещё грузятся), обучение не показываем; + -- после обучения линия ведёт к скупщику, когда сумка полна + local tutorialOn = player:GetAttribute("Tutorial") ~= nil and step < Config.TutorialDone + local bagFull = (player:GetAttribute("BagCount") or 0) >= (player:GetAttribute("BagCap") or math.huge) + if not hrp or not (tutorialOn or bagFull) then + guideHint.Visible = false + guideHighlight.Enabled = false + hideChevrons(1) + return + end + if boardView then -- смотрим на табличку: ни линии, ни подсказок + guideHint.Visible = false + guideHighlight.Enabled = false + hideChevrons(1) + return + end + local pos = hrp.Position + local world = Config.WorldAt(pos) + + -- переходы между шагами + if not tutorialOn then + -- обучение пройдено, остаётся только дорога к скупщику + elseif step <= 1 and world and world.id == "World1" then + advanceTutorial(2) + elseif step == 0 then + local board = guideMarker("GuideBoard") + if board and (board - pos).Magnitude < 9 and state == "idle" then + local obj = guideObject("Board") + if obj then + openBoardView(obj) -- шаг засчитается по кнопке «Далее» + return + end + advanceTutorial(1) + end + elseif step == 2 and (player:GetAttribute("TotalCaught") or 0) > 0 then + advanceTutorial(3) + end + step = tutorialStep() + + local route, hint, key + if tutorialOn then + route, hint, key = guideRoute(step, pos, world) + end + if not route and bagFull then + local inW1 = world and world.id == "World1" + local at = (inW1 and sellTargetW1()) or nearestSell(pos, world) + route, hint, key = at and { at } or nil, "🎒 Сумка полна — продай рыбу!", inW1 and "Sell" or nil + end + guideHintText.Text = hint or "" + local showHint = hint ~= nil and state == "idle" + if showHint and (hint ~= lastHint or not guideHint.Visible) then + popIn(guideHint, 0.5) + end + lastHint = hint + guideHint.Visible = showHint + local target = (key and state == "idle") and guideObject(key) or nil + guideHighlight.Adornee = target or nil + guideHighlight.Enabled = target ~= nil + if target then + local pulse = (math.sin(os.clock() * 4) + 1) / 2 -- мягкое мигание + guideHighlight.FillTransparency = 0.86 + 0.1 * pulse -- лёгкое «дыхание», цвет объекта виден + guideHighlight.OutlineTransparency = 0.1 + 0.45 * pulse + end + if not route or #route == 0 or state ~= "idle" then + hideChevrons(1) + return + end + + -- ломаная от ног игрока через точки маршрута + local pts = { pos - Vector3.new(0, 3, 0) } + for _, p in ipairs(route) do + table.insert(pts, p) + end + local lens, total = {}, 0 + for i = 2, #pts do + local d = ((pts[i] - pts[i - 1]) * Vector3.new(1, 0, 1)).Magnitude + lens[i] = math.max(d, 0.001) + total += d + end + if total < 4 then + hideChevrons(1) -- уже на месте + return + end + + guideRay.FilterDescendantsInstances = { player.Character, guideFolder } + local phase = (os.clock() * GUIDE_SPEED) % GUIDE_GAP + local seg, segStart = 2, 0 + for i = 1, GUIDE_N do + local d = 2 + phase + (i - 1) * GUIDE_GAP + if d > total - 1 then + hideChevrons(i) + break + end + while seg < #pts and d > segStart + lens[seg] do + segStart += lens[seg] + seg += 1 + end + local a, b = pts[seg - 1], pts[seg] + local p = a:Lerp(b, (d - segStart) / lens[seg]) + local dir = (b - a) * Vector3.new(1, 0, 1) + local hit = workspace:Raycast(p + Vector3.new(0, 4, 0), Vector3.new(0, -12, 0), guideRay) + -- висят в воздухе и слегка покачиваются волной + local y = (hit and hit.Position.Y or p.Y) + GUIDE_HEIGHT + math.sin(os.clock() * 4 - d * 0.5) * 0.25 + local base = CFrame.lookAt(Vector3.new(p.X, y, p.Z), Vector3.new(p.X, y, p.Z) + dir) + -- у игрока и у цели стрелки плавно проявляются и гаснут + local fade = math.max(0, 1 - math.min(d - 2, total - 1 - d) / 2.5) + local tr = 0.05 + 0.95 * fade + for k = 1, 2 do + chevrons[i][k].CFrame = base * ARM_CF[k] + chevrons[i][k].Transparency = tr + end + end +end) + +---------------------------------------------------------------- цели на экране: серия, трекер, босс, покупка у скупщика +-- в отдельной функции: у основного скрипта почти исчерпан лимит в 200 локальных переменных + +local refreshTracker, bestOffer, showOffer +local offerState = { bagWasFull = false } -- была ли сумка полной перед продажей (тогда первым предлагаем сумку побольше) +;(function() +local CENTER = Enum.TextXAlignment.Center +local RIGHT = Enum.TextXAlignment.Right +local FIRE = Color3.fromRGB(255, 150, 60) + +-- серия улова — справа от HUD; полоска показывает, сколько осталось до того, как серия сгорит +local comboBox = new("Frame", { + Size = UDim2.fromOffset(140, 66), Position = UDim2.fromOffset(310, 10), BackgroundColor3 = WHITE, Visible = false, Parent = screen, +}, { 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 = C.dark, 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 = screen, +}, { new("UIListLayout", { Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) + +-- на телефоне колонка выше и мельче, чтобы не заходить на кнопку прыжка; серия — правее компактного HUD +local rightScale = new("UIScale", { Parent = rightCol }) +Theme.onLayout(function(compact) + rightScale.Scale = compact and 0.8 or 1 + rightCol.AnchorPoint = compact and Vector2.new(1, 0) or Vector2.new(1, 0.5) + rightCol.Position = compact and UDim2.new(1, -8, 0, 128) or UDim2.new(1, -12, 0.5, 10) + comboBox.Position = compact and UDim2.fromOffset(254, 6) or UDim2.fromOffset(310, 10) +end) + +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 = C.dark, 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 = C.dark, 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 = screen, +}, { corner(16), stroke(C.green, 2.5, 0.05), gradient(Color3.fromRGB(30, 85, 55), C.bg, 90) }) +local offerIcon = text({ Size = UDim2.fromOffset(70, 70), Position = UDim2.fromOffset(12, 13), TextSize = 46, TextXAlignment = CENTER, Text = "", Parent = offerCard }) +local offerTitle = text({ Size = UDim2.new(1, -250, 0, 26), Position = UDim2.fromOffset(90, 12), Font = TITLE, TextSize = 19, TextTruncate = Enum.TextTruncate.AtEnd, Text = "", Parent = offerCard }) +local offerDesc = text({ Size = UDim2.new(1, -250, 0, 44), Position = UDim2.fromOffset(90, 40), Font = BODY2, TextSize = 13, TextColor3 = C.muted, TextWrapped = true, TextYAlignment = Enum.TextYAlignment.Top, Text = "", Parent = offerCard }) +local offerItem, offerToken = nil, 0 +local function hideOffer() + offerCard.Visible = false + offerItem = nil +end +local offerBuy = btn({ Size = UDim2.fromOffset(146, 52), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -14, 0.5, 0), BackgroundColor3 = C.green, TextSize = 18, Text = "", Parent = offerCard }, function() + if offerItem then + remote:FireServer("Buy", offerItem.kind, offerItem.id) + Audio.play("coins") + end + hideOffer() +end) +btn({ Size = UDim2.fromOffset(26, 26), Position = UDim2.new(1, -18, 0, -8), BackgroundColor3 = C.red, Text = "×", TextSize = 22, 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 == "TeleportFade" then + teleportLoading(a, b) elseif action == "Cast" then + Audio.play("cast") setState("waiting") + startCastCam(a, b) elseif action == "CastFail" or action == "Cancel" or action == "Escaped" then + if action == "Escaped" then + Audio.play("escape") + end + if action == "CastFail" and castTool and castTool.Parent then + castTool.Grip = gripCF(REST_ANGLE) -- сервер удочку не трогал, а у нас она в замахе + end setState("idle") elseif action == "Bite" then mg.speed = a.speed @@ -1248,25 +2734,73 @@ remote.OnClientEvent:Connect(function(action, a, b, c) mg.pos, mg.dir = 0, 1 placeZone() updatePips() + Audio.play("bite") setState("bite") elseif action == "Caught" then setState("idle") showCatch(a, b) - playUiSound(DING, 0.5) + Audio.play("catchSplash") + local r = Config.Rarities[a.rarity] + Audio.play((r and r.rank >= 4) and "fanfare" or "catch") + if a.mutation then + Audio.play("sparkle") + end elseif action == "Sold" then - floatText("+" .. fmt(a) .. " 💰", C.gold) - notify(("Продано рыб: %d → +%s 💰"):format(b, fmt(a)), Color3.fromRGB(120, 255, 140)) + Audio.play("coins") + if tutorialStep() == 3 then + advanceTutorial(Config.TutorialDone) + end + floatText("+" .. fmt(a) .. " ⚪", C.gold) + notify(("⚪ +%s"):format(fmt(a)), Color3.fromRGB(120, 255, 140)) + -- монеты приходят атрибутом чуть позже события, поэтому предложение — с задержкой + local wasFull = offerState.bagWasFull + offerState.bagWasFull = false + -- продать можно и с заброшенной удочкой; не мешаем только мини-игре поклёвки (она тоже внизу экрана) + task.delay(0.5, function() + local t0 = os.clock() + while state == "bite" and os.clock() - t0 < 10 do + task.wait(0.3) + end + local o = state ~= "bite" and bestOffer(wasFull) + if o then + showOffer(o) + end + end) elseif action == "Inventory" then inventory = a or {} discovered = b or {} claimed = c or {} bagWin.refresh() refreshDots() + refreshTracker() elseif action == "Quests" then - 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)) + Audio.play("quest") + elseif action == "ChainDone" then + floatText("🏆 Цепочка пройдена!", C.gold) + notify(("🎁 %s: +%s ⚪ +%s XP%s"):format(a, fmt(b), fmt(c), d and (" + " .. d) or ""), C.gold) + Audio.play("fanfare") + elseif action == "ComboLost" then + notify(("💔 Серия из %d прервана"):format(a), Color3.fromRGB(255, 130, 110)) + elseif action == "BossStart" then + notify(("👑 %s в мире «%s»! Ловите всем сервером"):format(a, b), C.gold) + Audio.play("quest") + elseif action == "BossHit" then + floatText(("⚔ -%d боссу"):format(a), Color3.fromRGB(255, 130, 100)) + elseif action == "BossDone" then + if a then + notify(("🏆 %s пойман всем сервером!%s"):format(b, c and (" Лучший: " .. c) or ""), C.gold) + else + notify(("🌊 %s ушёл на глубину…"):format(b), C.muted) + end + elseif action == "BossReward" then + notify(("🎁 За босса: +%s ⚪ +%s XP%s"):format(fmt(a), fmt(b), c and (" + " .. c) or ""), Color3.fromRGB(120, 255, 140)) elseif action == "OpenShop" then shopWin.open("rods") elseif action == "OpenQuests" then diff --git a/src/StarterPlayer/StarterPlayerScripts/GuildClient.client.lua b/src/StarterPlayer/StarterPlayerScripts/GuildClient.client.lua new file mode 100644 index 0000000..8151690 --- /dev/null +++ b/src/StarterPlayer/StarterPlayerScripts/GuildClient.client.lua @@ -0,0 +1,412 @@ +-- GuildClient (LocalScript) -> StarterPlayer > StarterPlayerScripts +-- Окно гильдии рыбаков (ранг и испытание, заказы, наживка, ловушки), строка жемчуга и печатей в HUD, +-- кнопки наживки и автоловли, церемония нового ранга. Стиль и помощники — из FishingClient (Theme.kit). + +local Players = game:GetService("Players") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local TweenService = game:GetService("TweenService") +local UserInputService = game:GetService("UserInputService") +local RunService = game:GetService("RunService") + +local player = Players.LocalPlayer +local Config = require(ReplicatedStorage:WaitForChild("FishConfig")) +local Theme = require(script.Parent:WaitForChild("UiTheme")) +local Audio = require(script.Parent:WaitForChild("Audio")) +local remote = ReplicatedStorage:WaitForChild("GameEvent") + +while not Theme.kit do + task.wait(0.1) +end +local K = Theme.kit +local C = Theme.C +local new, text, btn, corner, stroke, gradient = K.new, K.text, K.btn, K.corner, K.stroke, K.gradient +local fmt = K.fmt +local TITLE, BODY2 = K.TITLE, K.BODY2 +local RANKS = Config.Guild.ranks +local CENTER, RIGHT = Enum.TextXAlignment.Center, Enum.TextXAlignment.Right +local WHITE = Color3.new(1, 1, 1) + +local state = nil -- последнее состояние гильдии от сервера + +local function rankOf(idx) + return RANKS[math.clamp(idx or 1, 1, #RANKS)] +end + +-- щит ранга: ромб цвета ранга с буквой +local function shield(parent, size, idx, props) + local r = rankOf(idx) + local f = new("Frame", { Size = UDim2.fromOffset(size, size), Rotation = 45, BackgroundColor3 = r.color, Parent = parent }, + { corner(math.floor(size / 6)), stroke(C.gold, math.max(2, size / 14), 0), gradient(WHITE, Color3.fromRGB(150, 150, 150), 45) }) + for k, v in pairs(props or {}) do + f[k] = v + end + text({ Size = UDim2.fromScale(1, 1), Rotation = -45, Font = TITLE, TextScaled = true, TextXAlignment = CENTER, Text = r.id, + TextColor3 = WHITE, TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.2, Parent = f }) + return f +end + +---------------------------------------------------------------- окно гильдии + +local win = K.makeWindow("⚔ Гильдия рыбаков", C.crimson, { + { id = "rank", label = "⚔ Ранг" }, + { id = "orders", label = "📜 Заказы" }, + { id = "bait", label = "🐛 Наживка" }, + { id = "traps", label = "🧺 Ловушки" }, +}) +local lists = { + rank = K.scrollArea(win.pages.rank), + orders = K.scrollArea(win.pages.orders), + bait = K.scrollArea(win.pages.bait), + traps = K.scrollArea(win.pages.traps), +} + +-- деревянная карточка-строка +local function card(parent, order, height, strokeColor) + return new("Frame", { Size = UDim2.new(1, -4, 0, height), BackgroundColor3 = WHITE, LayoutOrder = order, Parent = parent }, + { corner(8), stroke(strokeColor or C.goldDark, 2, 0), gradient(C.woodLight, C.wood, 90) }) +end + +local function rewardText(o) + return ("+%d %s +%s %s%s"):format(o.seals, Theme.SEAL, fmt(o.coins), Theme.SILVER, (o.pearls or 0) > 0 and (" +" .. o.pearls .. " " .. Theme.PEARL) or "") +end + +local function renderRank(list) + local idx = player:GetAttribute("RankIdx") or 1 + local r = rankOf(idx) + local seals = player:GetAttribute("Seals") or 0 + local nextR = RANKS[idx + 1] + + -- шапка: щит, звание, печати + local head = card(list, 0, 120, C.gold) + shield(head, 64, idx, { AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(62, 60) }) + text({ Size = UDim2.new(1, -140, 0, 30), Position = UDim2.fromOffset(122, 10), Font = TITLE, TextSize = 24, TextColor3 = r.color:Lerp(WHITE, 0.35), + Text = ("Ранг %s — %s"):format(r.id, r.name), Parent = head }) + text({ Size = UDim2.new(1, -140, 0, 22), Position = UDim2.fromOffset(122, 42), Font = BODY2, TextSize = 15, TextColor3 = C.muted, RichText = true, + Text = ("%s Печати: %s%s %s Жемчуг: %s"):format(Theme.SEAL, fmt(seals), nextR and (" / " .. fmt(nextR.seals)) or "", Theme.PEARL, fmt(player:GetAttribute("Pearls") or 0)), + Parent = head }) + if nextR then + K.progressBar(head, UDim2.fromOffset(122, 74), UDim2.new(1, -140, 0, 14), (seals - r.seals) / math.max(1, nextR.seals - r.seals), C.gold) + text({ Size = UDim2.new(1, -140, 0, 18), Position = UDim2.fromOffset(122, 92), Font = BODY2, TextSize = 13, TextColor3 = C.muted, + Text = "Печати дают только заказы гильдии и испытания", Parent = head }) + end + + -- испытание на следующий ранг + local t = state and state.trial + if t and nextR then + local box = card(list, 1, 96, t.ready and C.goldBright or C.goldDark) + text({ Size = UDim2.new(1, -220, 0, 26), Position = UDim2.fromOffset(16, 10), Font = TITLE, TextSize = 19, TextColor3 = C.goldBright, + Text = ("⚔ Испытание на ранг %s"):format(nextR.id), Parent = box }) + text({ Size = UDim2.new(1, -220, 0, 40), Position = UDim2.fromOffset(16, 38), Font = BODY2, TextSize = 15, TextWrapped = true, RichText = true, + TextYAlignment = Enum.TextYAlignment.Top, + Text = t.text .. (t.active and (" " .. t.progress .. " / " .. t.goal .. "") or "") + .. (t.ready and "" or ("\nСначала накопи " .. fmt(nextR.seals) .. " печатей")), + Parent = box }) + local label, color, active + if not t.ready then + label, color, active = "🔒 " .. fmt(nextR.seals) .. " " .. Theme.SEAL, C.grey, false + elseif t.active and nextR.trial.kind == "deliver" then + label, color, active = "🐟 Сдать рыбу", C.green, true + elseif t.active then + label, color, active = "Идёт…", C.grey, false + else + label, color, active = "⚔ Взять", C.crimson, true + end + btn({ Size = UDim2.fromOffset(180, 50), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -14, 0.5, 0), BackgroundColor3 = color, + AutoButtonColor = active, Text = label, TextSize = 18, Parent = box }, active and function() + remote:FireServer("TakeTrial") + end or nil) + end + + -- лестница рангов + for i, rr in ipairs(RANKS) do + local here = i == idx + local row = card(list, 10 + i, 58, here and C.gold or nil) + if i > idx then + row.BackgroundTransparency = 0.35 + end + shield(row, 30, i, { AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(34, 29) }) + text({ Size = UDim2.fromOffset(230, 24), Position = UDim2.fromOffset(64, 6), Font = TITLE, TextSize = 17, + TextColor3 = i <= idx and C.text or C.muted, Text = ("%s — %s"):format(rr.id, rr.name), Parent = row }) + text({ Size = UDim2.new(1, -200, 0, 20), Position = UDim2.fromOffset(64, 31), Font = BODY2, TextSize = 13, TextColor3 = C.muted, + TextTruncate = Enum.TextTruncate.AtEnd, Text = rr.unlocks, Parent = row }) + text({ Size = UDim2.fromOffset(120, 24), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -14, 0, 17), Font = TITLE, TextSize = 16, + TextXAlignment = RIGHT, TextColor3 = i <= idx and C.green:Lerp(WHITE, 0.4) or C.gold, + Text = i <= idx and "✓" or (fmt(rr.seals) .. " " .. Theme.SEAL), Parent = row }) + end +end + +local function renderOrders(list) + if not state then + return + end + local left = (state.ordersEnd or 0) - workspace:GetServerTimeNow() + local h = math.floor(math.max(0, left) / 3600) + local m = math.floor(math.max(0, left) % 3600 / 60) + text({ Size = UDim2.new(1, -4, 0, 26), LayoutOrder = 0, Font = BODY2, TextSize = 15, TextColor3 = C.muted, RichText = true, + Text = ("Личные заказы гильдии. Новые через %d ч %02d мин. Рыбу сдают у доски заказов в лобби."):format(h, m), Parent = list }) + for i, o in ipairs(state.orders) do + local row = card(list, i, 92, o.done and C.green or nil) + text({ Size = UDim2.new(1, -230, 0, 26), Position = UDim2.fromOffset(16, 8), Font = TITLE, TextSize = 18, + TextColor3 = o.done and C.muted or C.text, TextTruncate = Enum.TextTruncate.AtEnd, Text = (o.done and "✅ " or "📜 ") .. o.text, Parent = row }) + text({ Size = UDim2.new(1, -230, 0, 20), Position = UDim2.fromOffset(16, 36), Font = BODY2, TextSize = 14, TextColor3 = C.gold, + Text = rewardText(o), Parent = row }) + K.progressBar(row, UDim2.fromOffset(16, 64), UDim2.new(1, -310, 0, 12), o.progress / math.max(1, o.count), o.done and C.green or C.gold) + text({ Size = UDim2.fromOffset(70, 18), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -224, 0, 61), Font = TITLE, TextSize = 14, + TextXAlignment = RIGHT, Text = ("%d / %d"):format(o.progress, o.count), Parent = row }) + if not o.done then + if o.deliver then + btn({ Size = UDim2.fromOffset(120, 40), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -86, 0, 10), BackgroundColor3 = C.green, + Text = "🐟 Сдать", TextSize = 17, Parent = row }, function() + remote:FireServer("DeliverOrder", i) + end) + end + btn({ Size = UDim2.fromOffset(66, 40), AnchorPoint = Vector2.new(1, 0), Position = UDim2.new(1, -12, 0, 10), BackgroundColor3 = C.woodLight, + Text = "🎲 " .. Config.Orders.rerollPearls .. Theme.PEARL, TextSize = 14, Parent = row }, function() + remote:FireServer("RerollOrder", i) + end) + end + end + text({ Size = UDim2.new(1, -4, 0, 24), LayoutOrder = 99, Font = BODY2, TextSize = 13, TextColor3 = C.muted, + Text = ("🎲 — заменить заказ другим за %d %s"):format(Config.Orders.rerollPearls, Theme.PEARL), Parent = list }) +end + +local function renderBait(list) + local idx = player:GetAttribute("RankIdx") or 1 + local coins = player:GetAttribute("Coins") or 0 + local pearls = player:GetAttribute("Pearls") or 0 + local counts = state and state.baits or {} + local equipped = player:GetAttribute("Bait") + text({ Size = UDim2.new(1, -4, 0, 26), LayoutOrder = 0, Font = BODY2, TextSize = 15, TextColor3 = C.muted, + Text = "Один слот наживки: 1 штука тратится на каждый заброс.", Parent = list }) + for i, b in ipairs(Config.Baits) do + local have = counts[b.id] or 0 + local locked = b.rank and idx < b.rank + local pearl = b.currency == "pearls" + local row = card(list, i, 84, equipped == b.id and C.goldBright or nil) + text({ Size = UDim2.fromOffset(60, 60), Position = UDim2.fromOffset(10, 12), TextSize = 40, TextXAlignment = CENTER, Text = b.icon, Parent = row }) + text({ Size = UDim2.new(1, -330, 0, 26), Position = UDim2.fromOffset(78, 10), Font = TITLE, TextSize = 18, + Text = b.name .. (have > 0 and (" ×" .. have) or ""), Parent = row }) + text({ Size = UDim2.new(1, -330, 0, 36), Position = UDim2.fromOffset(78, 38), Font = BODY2, TextSize = 14, TextColor3 = C.muted, TextWrapped = true, + TextYAlignment = Enum.TextYAlignment.Top, Text = b.desc, Parent = row }) + local can = (pearl and pearls >= b.price) or (not pearl and coins >= b.price) + btn({ + Size = UDim2.fromOffset(130, 42), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -12, 0.5, 0), + BackgroundColor3 = locked and C.grey or (can and C.green or C.woodLight), AutoButtonColor = not locked, + Text = locked and ("🔒 Ранг " .. RANKS[b.rank].id) or (("%s %d · ×%d"):format(pearl and Theme.PEARL or Theme.SILVER, b.price, b.pack)), TextSize = 15, Parent = row, + }, (not locked) and function() + remote:FireServer("BuyBait", b.id) + end or nil) + if have > 0 then + local on = equipped == b.id + btn({ + Size = UDim2.fromOffset(100, 42), AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -150, 0.5, 0), + BackgroundColor3 = on and C.gold or C.blue, TextColor3 = on and C.ink or C.text, Text = on and "✓ В слоте" or "Взять", TextSize = 15, Parent = row, + }, function() + remote:FireServer("EquipBait", on and "" or b.id) + end) + end + end +end + +local function renderTraps(list) + if not state then + return + end + if (state.trapSlots or 0) == 0 then + local box = card(list, 0, 90) + text({ Size = UDim2.new(1, -32, 1, 0), Position = UDim2.fromOffset(16, 0), Font = TITLE, TextSize = 18, TextWrapped = true, TextColor3 = C.muted, + Text = "🔒 Ловушки-вентери открываются с ранга D.\nКаждая сама ловит рыбу «Тихого озера», даже когда ты не в игре.", Parent = box }) + return + end + text({ Size = UDim2.new(1, -4, 0, 26), LayoutOrder = 0, Font = BODY2, TextSize = 15, TextColor3 = C.muted, + Text = ("Каждая ловушка: 1 рыба за %d мин, не больше %d. Работает и офлайн."):format(state.trapEvery / 60, state.trapMax), Parent = list }) + local total = 0 + for i = 1, state.trapSlots do + local n = state.traps[i] or 0 + total += n + local row = card(list, i, 64, n >= state.trapMax and C.goldBright or nil) + text({ Size = UDim2.new(1, -40, 0, 26), Position = UDim2.fromOffset(16, 6), Font = TITLE, TextSize = 18, + Text = ("🧺 Ловушка %d: %d / %d рыб%s"):format(i, n, state.trapMax, n >= state.trapMax and " · полная!" or ""), Parent = row }) + K.progressBar(row, UDim2.fromOffset(16, 38), UDim2.new(1, -32, 0, 12), n / state.trapMax, C.gold) + end + local b = btn({ + Size = UDim2.fromOffset(260, 52), BackgroundColor3 = total > 0 and C.green or C.grey, AutoButtonColor = total > 0, + Text = ("🧺 Забрать улов (%d)"):format(total), TextSize = 19, LayoutOrder = 50, Parent = list, + }, total > 0 and function() + remote:FireServer("CollectTraps") + end or nil) + b.AnchorPoint = Vector2.new(0, 0) +end + +win.render = function(tab) + local list = lists[tab] + if not list then + return + end + K.clear(list) + if tab == "rank" then + renderRank(list) + elseif tab == "orders" then + renderOrders(list) + elseif tab == "bait" then + renderBait(list) + elseif tab == "traps" then + renderTraps(list) + end +end + +local function openGuild(tab) + remote:FireServer("GuildState") + win.open(tab) +end + +K.sideButton(7, "⚔", "Гильдия", "G", C.crimson, function() + if win.isOpen() then + win.close() + else + openGuild() + end +end) +UserInputService.InputBegan:Connect(function(input, processed) + if not processed and input.KeyCode == Enum.KeyCode.G then + if win.isOpen() then + win.close() + else + openGuild() + end + end +end) + +---------------------------------------------------------------- HUD: жемчуг, печати, ранг, отдых + +local hud = K.hud +hud.Parent.Size = UDim2.fromOffset(290, 198) +local guildLine = text({ Size = UDim2.new(1, 0, 0, 20), Position = UDim2.fromOffset(0, 149), TextSize = 14, Font = BODY2, RichText = true, Text = "", Parent = hud }) +-- отдых: строка видна, только пока есть двойной опыт +local restText = text({ Size = UDim2.new(1, 0, 0, 18), Position = UDim2.fromOffset(0, 169), Font = BODY2, TextSize = 13, TextColor3 = Color3.fromRGB(170, 215, 255), Text = "", Parent = hud }) +local restPlate = restText + +local function refreshHud() + local idx = player:GetAttribute("RankIdx") or 1 + local r = rankOf(idx) + local nextSeals = player:GetAttribute("SealsNext") + guildLine.Text = ("⚔ %s %s %s%s %s %s"):format(r.color:Lerp(WHITE, 0.3):ToHex(), r.id, + Theme.SEAL, fmt(player:GetAttribute("Seals") or 0), nextSeals and ("/" .. fmt(nextSeals)) or "", Theme.PEARL, fmt(player:GetAttribute("Pearls") or 0)) + local rest = player:GetAttribute("RestLeft") or 0 + restPlate.Visible = rest > 0 + restText.Text = ("🛌 Отдых: опыт ×2 ещё %d мин"):format(math.ceil(rest / 60)) +end + +---------------------------------------------------------------- наживка и автоловля (правый низ, над кнопкой прыжка на телефоне) + +local bar = new("Frame", { + Size = UDim2.fromOffset(250, 56), AnchorPoint = Vector2.new(1, 1), Position = UDim2.new(1, -12, 1, -12), BackgroundTransparency = 1, Parent = K.screen, +}, { new("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, HorizontalAlignment = Enum.HorizontalAlignment.Right, Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder }) }) +local baitBtn = btn({ Size = UDim2.fromOffset(110, 52), BackgroundColor3 = C.woodLight, Text = "", TextSize = 16, LayoutOrder = 1, Parent = bar }, function() + openGuild("bait") +end) +local autoBtn = btn({ Size = UDim2.fromOffset(130, 52), BackgroundColor3 = C.woodLight, Text = "", TextSize = 15, LayoutOrder = 2, Visible = false, Parent = bar }, function() + remote:FireServer("AutoFish", not player:GetAttribute("AutoFish")) +end) +Theme.onLayout(function(compact) + -- на телефоне — внизу, левее кнопки прыжка (над ней — панель целей) + bar.Position = compact and UDim2.new(1, -140, 1, -8) or UDim2.new(1, -12, 1, -12) +end) + +local function refreshBar() + local id = player:GetAttribute("Bait") + local b = id and Config.Find(Config.Baits, id) + baitBtn.Text = b and ("%s ×%d"):format(b.icon, player:GetAttribute("BaitCount") or 0) or "🐛 Наживка" + baitBtn.BackgroundColor3 = b and C.woodLight or C.wood + local idx = player:GetAttribute("RankIdx") or 1 + autoBtn.Visible = rankOf(idx).auto == true + local on = player:GetAttribute("AutoFish") == true + autoBtn.Text = on and "🎣 Авто: ВКЛ" or "🎣 Автоловля" + autoBtn.BackgroundColor3 = on and C.green or C.woodLight +end + +---------------------------------------------------------------- церемония нового ранга + +local ceremonyGui = new("ScreenGui", { Name = "RankCeremony", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 40, Enabled = false, Parent = player:WaitForChild("PlayerGui") }) +local function ceremony(letter, name, unlocks, pearls) + ceremonyGui.Enabled = true + local root = Theme.followScale(ceremonyGui) + local dim = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.new(0, 0, 0), BackgroundTransparency = 0.45, Parent = root }) + local _, idx = Config.RankById(letter) + local panel = new("Frame", { + Size = UDim2.fromOffset(520, 300), AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.5), BackgroundColor3 = WHITE, Parent = root, + }, { corner(12), stroke(C.goldDark, 4, 0), Theme.woodGradient(C.wood, C.woodDark) }) + Theme.innerBorder(panel, 7, 8, C.gold, 0.2) + Theme.rivets(panel, 12, 8) + text({ Size = UDim2.new(1, 0, 0, 34), Position = UDim2.fromOffset(0, 16), Font = TITLE, TextSize = 26, TextXAlignment = CENTER, TextColor3 = C.goldBright, + TextStrokeColor3 = C.ink, TextStrokeTransparency = 0.2, Text = "⚔ НОВЫЙ РАНГ ГИЛЬДИИ ⚔", Parent = panel }) + local sh = shield(panel, 96, idx, { AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(260, 118) }) + text({ Size = UDim2.new(1, -40, 0, 30), Position = UDim2.fromOffset(20, 180), Font = TITLE, TextSize = 24, TextXAlignment = CENTER, + Text = ("%s — «%s»"):format(letter, name), Parent = panel }) + text({ Size = UDim2.new(1, -40, 0, 40), Position = UDim2.fromOffset(20, 212), Font = BODY2, TextSize = 15, TextXAlignment = CENTER, TextWrapped = true, + TextColor3 = C.muted, Text = "Открыто: " .. unlocks, Parent = panel }) + text({ Size = UDim2.new(1, -40, 0, 26), Position = UDim2.fromOffset(20, 256), Font = TITLE, TextSize = 19, TextXAlignment = CENTER, + TextColor3 = C.pearl, Text = ("+%d %s"):format(pearls or 0, Theme.PEARL), Parent = panel }) + K.popIn(panel, 0.3) + TweenService:Create(sh, TweenInfo.new(1.2, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Rotation = 405 }):Play() + Audio.play("fanfare") + -- конфетти + local colors = { C.goldBright, C.crimson, C.forest, C.parchment, Color3.fromRGB(120, 200, 255) } + for i = 1, 70 do + local p = new("Frame", { + Size = UDim2.fromOffset(math.random(6, 12), math.random(10, 18)), Position = UDim2.new(math.random(), 0, 0, -30), + Rotation = math.random(0, 360), BackgroundColor3 = colors[(i % #colors) + 1], BorderSizePixel = 0, Parent = root, + }) + local t = math.random(18, 34) / 10 + TweenService:Create(p, TweenInfo.new(t, Enum.EasingStyle.Quad, Enum.EasingDirection.In), { + Position = UDim2.new(p.Position.X.Scale + (math.random() - 0.5) * 0.2, 0, 1.1, 0), Rotation = p.Rotation + math.random(-360, 360), + }):Play() + end + task.delay(5, function() + TweenService:Create(dim, TweenInfo.new(0.4), { BackgroundTransparency = 1 }):Play() + task.wait(0.4) + root:Destroy() + ceremonyGui.Enabled = false + end) +end + +---------------------------------------------------------------- события + +remote.OnClientEvent:Connect(function(action, a, b, c, d) + if action == "Guild" then + state = a + win.refresh() + elseif action == "OpenGuild" then + openGuild(a) + elseif action == "RankUp" then + win.close() + ceremony(a, b, c, d) + elseif action == "OrderDone" then + Audio.play("quest") + end +end) + +player.AttributeChanged:Connect(function(name) + if name == "Seals" or name == "Pearls" or name == "RankIdx" or name == "SealsNext" or name == "RestLeft" then + refreshHud() + end + if name == "Bait" or name == "BaitCount" or name == "AutoFish" or name == "RankIdx" then + refreshBar() + end + if (name == "Coins" or name == "Pearls" or name == "Bait") and win.isOpen() and win.current == "bait" then + win.refresh() + end +end) +refreshHud() +refreshBar() + +-- таймер заказов и ловушки тикают, пока окно открыто +task.spawn(function() + while true do + task.wait(30) + if win.isOpen() and (win.current == "orders" or win.current == "traps") then + remote:FireServer("GuildState") + end + end +end) +remote:FireServer("GuildState") diff --git a/src/StarterPlayer/StarterPlayerScripts/UiTheme.lua b/src/StarterPlayer/StarterPlayerScripts/UiTheme.lua new file mode 100644 index 0000000..c910599 --- /dev/null +++ b/src/StarterPlayer/StarterPlayerScripts/UiTheme.lua @@ -0,0 +1,184 @@ +-- UiTheme (ModuleScript) -> StarterPlayer > StarterPlayerScripts +-- Общий стиль интерфейса «средневековая гильдия»: палитра, шрифты с кириллицей, +-- украшения окон (золотая рамка, заклёпки, багровая лента) и масштаб под размер экрана. + +local UserInputService = game:GetService("UserInputService") + +local Theme = {} + +---------------------------------------------------------------- палитра +-- старые ключи (bg, panel, blue…) оставлены, чтобы весь интерфейс перекрасился сразу + +local C = { + woodDark = Color3.fromRGB(40, 28, 20), + wood = Color3.fromRGB(66, 46, 30), + woodLight = Color3.fromRGB(98, 70, 44), + parchment = Color3.fromRGB(236, 220, 180), + ink = Color3.fromRGB(52, 36, 24), + gold = Color3.fromRGB(218, 172, 92), + goldBright = Color3.fromRGB(255, 214, 120), + goldDark = Color3.fromRGB(140, 102, 52), + crimson = Color3.fromRGB(150, 40, 35), + forest = Color3.fromRGB(64, 112, 62), + silver = Color3.fromRGB(214, 220, 228), + pearl = Color3.fromRGB(235, 225, 245), +} +C.bg = C.woodDark +C.panel = C.wood +C.panel2 = C.woodLight +C.green = C.forest +C.red = C.crimson +C.blue = Color3.fromRGB(70, 92, 112) -- «сталь»: телепорт, надеть +C.purple = Color3.fromRGB(110, 62, 118) +C.grey = Color3.fromRGB(84, 72, 60) +C.text = C.parchment +C.muted = Color3.fromRGB(192, 172, 136) +C.line = C.goldDark +C.dark = Color3.fromRGB(24, 16, 11) -- подложка полосок прогресса +Theme.C = C + +-- цвета для RichText +Theme.HEX = { + gold = "#FFD678", + muted = "#C0AC88", + green = "#9BE08C", + red = "#FF8A7A", + silver = "#DCE2EA", +} + +---------------------------------------------------------------- значки валют +-- 🪙 в Roblox не рисуется (квадратик), поэтому серебро — светлый кружок +Theme.SILVER = "⚪" +Theme.PEARL = "🦪" +Theme.SEAL = "📜" + +---------------------------------------------------------------- шрифты +-- проверено в Studio: у Merriweather и Nunito есть кириллица (у FredokaOne и Gotham — нет) + +local function family(name, weight) + return Font.new("rbxasset://fonts/families/" .. name .. ".json", weight) +end +Theme.TITLE_FACE = family("Merriweather", Enum.FontWeight.Heavy) +Theme.BODY_FACE = family("Nunito", Enum.FontWeight.ExtraBold) +Theme.BODY2_FACE = family("Nunito", Enum.FontWeight.Bold) +Theme.HINT_FACE = family("Nunito", Enum.FontWeight.Heavy) +-- старые Enum.Font в коде подменяются на эти шрифты +Theme.FACES = { + [Enum.Font.FredokaOne] = Theme.TITLE_FACE, + [Enum.Font.GothamBold] = Theme.BODY_FACE, + [Enum.Font.GothamMedium] = Theme.BODY2_FACE, + [Enum.Font.GothamBlack] = Theme.TITLE_FACE, +} + +---------------------------------------------------------------- украшения + +local function make(class, props) + local o = Instance.new(class) + for k, v in pairs(props) do + if k ~= "Parent" then + o[k] = v + end + end + o.Parent = props.Parent + return o +end + +-- ромбики-заклёпки по углам +function Theme.rivets(frame, size, inset, color) + size = size or 10 + inset = inset or 6 + for _, a in ipairs({ Vector2.new(0, 0), Vector2.new(1, 0), Vector2.new(0, 1), Vector2.new(1, 1) }) do + local r = make("Frame", { + Name = "Rivet", Size = UDim2.fromOffset(size, size), AnchorPoint = Vector2.new(0.5, 0.5), Rotation = 45, + Position = UDim2.new(a.X, a.X == 0 and inset or -inset, a.Y, a.Y == 0 and inset or -inset), + BackgroundColor3 = color or C.gold, BorderSizePixel = 0, ZIndex = 6, Parent = frame, + }) + make("UIStroke", { Color = C.ink, Thickness = 1.5, Parent = r }) + end +end + +-- рамка в 2 слоя: снаружи тёмное золото (UIStroke у самого окна), внутри — светлая тонкая линия +function Theme.innerBorder(frame, inset, radius, color, transparency) + inset = inset or 5 + local b = make("Frame", { + Name = "InnerBorder", Size = UDim2.new(1, -inset * 2, 1, -inset * 2), Position = UDim2.fromOffset(inset, inset), + BackgroundTransparency = 1, ZIndex = 1, Parent = frame, + }) + make("UICorner", { CornerRadius = UDim.new(0, radius or 8), Parent = b }) + make("UIStroke", { Color = color or C.gold, Thickness = 1.5, Transparency = transparency or 0.25, Parent = b }) + return b +end + +-- деревянная панель: тёплый градиент сверху вниз +function Theme.woodGradient(top, bottom) + return make("UIGradient", { Color = ColorSequence.new(top or C.wood, bottom or C.woodDark), Rotation = 90 }) +end + +---------------------------------------------------------------- масштаб под экран +-- Весь интерфейс лежит в «холсте» Root: он во столько же раз больше экрана, во сколько уменьшен +-- UIScale. Поэтому вёрстка в пикселях одинакова на любом экране, а на телефоне всё меньше и плотнее. +-- compact — узкий/сенсорный экран: другая раскладка (сетка кнопок, окна на весь экран). + +local BASE = Vector2.new(1280, 720) +local BASE_COMPACT = Vector2.new(780, 430) +local listeners = {} +Theme.compact = false +Theme.scale = 1 + +local function isCompact(size) + return size.X < 900 or UserInputService.TouchEnabled +end + +function Theme.onLayout(fn) + table.insert(listeners, fn) + fn(Theme.compact, Theme.scale) +end + +function Theme.scaleRoot(screenGui, name) + local root = make("Frame", { Name = name or "Root", BackgroundTransparency = 1, Size = UDim2.fromScale(1, 1), Parent = screenGui }) + local uiScale = make("UIScale", { Parent = root }) + local function update() + local size = screenGui.AbsoluteSize + if size.X < 2 or size.Y < 2 then + return + end + local compact = isCompact(size) + local base = compact and BASE_COMPACT or BASE + local s = math.clamp(math.min(size.X / base.X, size.Y / base.Y), 0.45, 1) + uiScale.Scale = s + root.Size = UDim2.fromScale(1 / s, 1 / s) + if compact ~= Theme.compact or s ~= Theme.scale then + Theme.compact, Theme.scale = compact, s + for _, fn in ipairs(listeners) do + task.spawn(fn, compact, s) + end + end + end + screenGui:GetPropertyChangedSignal("AbsoluteSize"):Connect(update) + update() + return root +end + +-- второй ScreenGui (погода и т.п.) — тот же масштаб, но без своей раскладки +function Theme.followScale(screenGui) + local root = make("Frame", { Name = "Root", BackgroundTransparency = 1, Size = UDim2.fromScale(1, 1), Parent = screenGui }) + local uiScale = make("UIScale", { Parent = root }) + local function apply(_, s) + uiScale.Scale = s + root.Size = UDim2.fromScale(1 / s, 1 / s) + end + local function update() + local size = screenGui.AbsoluteSize + if size.X < 2 or size.Y < 2 then + return + end + local compact = isCompact(size) + local base = compact and BASE_COMPACT or BASE + apply(compact, math.clamp(math.min(size.X / base.X, size.Y / base.Y), 0.45, 1)) + end + screenGui:GetPropertyChangedSignal("AbsoluteSize"):Connect(update) + update() + return root +end + +return Theme diff --git a/tools/build-guild-hall.lua b/tools/build-guild-hall.lua new file mode 100644 index 0000000..b205e00 --- /dev/null +++ b/tools/build-guild-hall.lua @@ -0,0 +1,231 @@ +-- Двор гильдии рыбаков в лобби + лавки наживки. Запускать в Studio в режиме редактирования +-- (Command Bar или Studio MCP), потом сохранить плейс (Ctrl+S). Повторный запуск пересобирает только +-- то, что строит этот скрипт (папки FishingMap.GuildHall и FishingMap.BaitShops), остальная карта не трогается. +-- +-- Двор — в проходе между двумя домиками на севере лобби: арка с вывеской «⚓ ГИЛЬДИЯ РЫБАКОВ», +-- знамёна, фонари, доска заказов (атрибут OrderBoard + подсказка Action=Orders), +-- кафедра и место Старейшины Ворона (NpcSpot с атрибутами, GuildElder, Look=Elder, Action=Guild). + +local map = workspace:FindFirstChild("FishingMap") +assert(map, "Нет Workspace.FishingMap") + +local V = Vector3.new +local FLOOR = 1.02 -- верх дорожки лобби +local X0 = 0.5 -- середина прохода между домиками (x от -4 до 5) + +local WOOD = Color3.fromRGB(110, 72, 44) +local DARK = Color3.fromRGB(66, 42, 26) +local GOLD = Color3.fromRGB(214, 160, 70) +local CRIMSON = Color3.fromRGB(150, 40, 35) +local PARCH = Color3.fromRGB(236, 220, 180) +local TITLE_FONT = Font.new("rbxasset://fonts/families/Merriweather.json", Enum.FontWeight.Heavy) + +for _, name in ipairs({ "GuildHall", "BaitShops" }) do + local old = map:FindFirstChild(name) + if old then + old:Destroy() + end +end +local hall = Instance.new("Folder") +hall.Name = "GuildHall" +hall.Parent = map + +local rng = Random.new(42) +local function shade(c, k) + k = 1 + rng:NextNumber(-k, k) + return Color3.new(math.clamp(c.R * k, 0, 1), math.clamp(c.G * k, 0, 1), math.clamp(c.B * k, 0, 1)) +end + +local function P(props, parent) + local p = Instance.new(props.ClassName or "Part") + props.ClassName = nil + p.Anchored = true + p.TopSurface, p.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth + p.Material = Enum.Material.SmoothPlastic + for k, v in pairs(props) do + p[k] = v + end + p.Parent = parent or hall + return p +end + +local function surfaceText(part, face, text, color, size) + 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.FontFace = TITLE_FONT + t.TextScaled = true + t.TextColor3 = color + t.TextStrokeTransparency = 0.35 + t.TextStrokeColor3 = Color3.fromRGB(40, 28, 20) + t.Text = text + t.Parent = sg + local pad = Instance.new("UIPadding") + pad.PaddingLeft, pad.PaddingRight = UDim.new(0.05, 0), UDim.new(0.05, 0) + pad.PaddingTop, pad.PaddingBottom = UDim.new(size or 0.1, 0), UDim.new(size or 0.1, 0) + pad.Parent = t + return t +end + +local function billboard(target, text, color, offsetY, width) + local bb = Instance.new("BillboardGui") + bb.Size = UDim2.fromOffset(width or 300, 56) + bb.StudsOffset = V(0, offsetY, 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.FontFace = TITLE_FONT + t.TextScaled = true + t.TextColor3 = color + 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 12 + pp.RequiresLineOfSight = false + pp:SetAttribute("Action", action) + pp.Parent = target + return pp +end + +local function lantern(pos, parent) + P({ Name = "LanternCap", Size = V(1.1, 0.3, 1.1), CFrame = CFrame.new(pos + V(0, 0.75, 0)), Color = DARK }, parent) + local l = P({ Name = "GuildLantern", Size = V(0.8, 1.1, 0.8), CFrame = CFrame.new(pos), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 205, 130) }, parent) + local light = Instance.new("PointLight") + light.Range = 16 + light.Brightness = 1.2 + light.Color = Color3.fromRGB(255, 205, 150) + light.Parent = l +end + +---------------------------------------------------------------- арка с вывеской + +local ZA = -34 -- арка перед фасадами домиков +for _, x in ipairs({ -4.2, 5.2 }) do + P({ Name = "ArchPost", Size = V(1.4, 15, 1.4), CFrame = CFrame.new(x, FLOOR + 7.5, ZA), Color = shade(DARK, 0.05) }) + P({ Name = "ArchFoot", Size = V(2, 1, 2), CFrame = CFrame.new(x, FLOOR + 0.5, ZA), Color = Color3.fromRGB(120, 112, 104), Material = Enum.Material.Slate }) + -- знамя гильдии на столбе + local banner = P({ Name = "GuildBanner", Size = V(2.4, 6, 0.2), CFrame = CFrame.new(x, FLOOR + 8.5, ZA + 0.85), Color = CRIMSON, Material = Enum.Material.Fabric, CanCollide = false }) + P({ Name = "BannerRod", Size = V(3, 0.25, 0.25), CFrame = CFrame.new(x, FLOOR + 11.6, ZA + 0.85), Color = GOLD }) + P({ Name = "BannerTrim", Size = V(2.4, 0.3, 0.22), CFrame = CFrame.new(x, FLOOR + 5.6, ZA + 0.86), Color = GOLD, CanCollide = false }) + surfaceText(banner, Enum.NormalId.Back, "⚓", Color3.fromRGB(255, 214, 120), 0.25) +end +P({ Name = "ArchBeam", Size = V(12, 1.4, 1.6), CFrame = CFrame.new(X0, FLOOR + 14.6, ZA), Color = DARK }) +P({ Name = "ArchRidge", Size = V(13, 0.6, 2.6), CFrame = CFrame.new(X0, FLOOR + 19.1, ZA), Color = shade(CRIMSON, 0.04) }) +P({ Name = "SignFrame", Size = V(11.6, 3.9, 0.3), CFrame = CFrame.new(X0, FLOOR + 17, ZA + 0.2), Color = GOLD }) +local sign = P({ Name = "GuildSign", Size = V(11, 3.3, 0.5), CFrame = CFrame.new(X0, FLOOR + 17, ZA + 0.45), Color = Color3.fromRGB(70, 45, 30) }) +surfaceText(sign, Enum.NormalId.Back, "⚓ ГИЛЬДИЯ РЫБАКОВ", Color3.fromRGB(255, 214, 120), 0.14) +billboard(sign, "⚔ Гильдия рыбаков", Color3.fromRGB(255, 214, 120), 4.2, 320) +for _, x in ipairs({ X0 - 4, X0 + 4 }) do + P({ Name = "Chain", Size = V(0.15, 1.2, 0.15), CFrame = CFrame.new(x, FLOOR + 13.3, ZA + 0.3), Color = Color3.fromRGB(70, 70, 75), Material = Enum.Material.Metal }, hall) + lantern(V(x, FLOOR + 12.2, ZA + 0.3), hall) +end + +-- ковровая дорожка от арки к Старейшине +P({ Name = "GuildRug", Size = V(4, 0.1, 22), CFrame = CFrame.new(X0, FLOOR + 0.05, -47), Color = shade(CRIMSON, 0.03), Material = Enum.Material.Fabric, CanCollide = false }) +for _, x in ipairs({ X0 - 2.05, X0 + 2.05 }) do + P({ Name = "RugTrim", Size = V(0.15, 0.11, 22), CFrame = CFrame.new(x, FLOOR + 0.05, -47), Color = GOLD, CanCollide = false }) +end + +---------------------------------------------------------------- доска заказов (у стены левого домика, лицом к проходу) + +local BZ = -46 +for _, z in ipairs({ BZ - 3.4, BZ + 3.4 }) do + P({ Name = "BoardLeg", Size = V(0.5, 8.6, 0.5), CFrame = CFrame.new(-3.3, FLOOR + 4.3, z), Color = DARK }) +end +local board = P({ Name = "OrderBoard", Size = V(0.4, 4.6, 6.4), CFrame = CFrame.new(-3.2, FLOOR + 5, BZ), Color = Color3.fromRGB(112, 80, 52) }) +board:SetAttribute("OrderBoard", true) +P({ Name = "BoardFrame", Size = V(0.35, 5.1, 6.9), CFrame = CFrame.new(-3.3, FLOOR + 5, BZ), Color = DARK }) +P({ Name = "BoardRoof", Size = V(1.8, 0.3, 7.6), CFrame = CFrame.new(-3, FLOOR + 8.9, BZ) * CFrame.Angles(0, 0, math.rad(-14)), Color = Color3.fromRGB(110, 34, 30) }) +local header = P({ Name = "BoardHeader", Size = V(0.3, 1.1, 6.4), CFrame = CFrame.new(-3.05, FLOOR + 8, BZ), Color = Color3.fromRGB(70, 45, 30) }) +surfaceText(header, Enum.NormalId.Right, "📜 ДОСКА ЗАКАЗОВ", Color3.fromRGB(255, 214, 120), 0.12) +-- пергаменты-заказы, приколотые к доске +for i, spot in ipairs({ { 6.2, -2.1 }, { 6.0, 0.1 }, { 6.3, 2.2 }, { 4.0, -1.2 }, { 3.8, 1.1 }, { 3.9, 2.6 } }) do + local note = P({ + Name = "OrderNote", Size = V(0.06, 1.7, 1.35), Color = shade(PARCH, 0.05), CanCollide = false, + CFrame = CFrame.new(-2.97, FLOOR + spot[1] - 0.6, BZ + spot[2]) * CFrame.Angles(math.rad(rng:NextNumber(-8, 8)), 0, 0), + }) + P({ Name = "Pin", Size = V(0.12, 0.2, 0.2), CFrame = note.CFrame * CFrame.new(0.05, 0.65, 0), Color = (i % 2 == 0) and CRIMSON or GOLD, CanCollide = false }) +end +prompt(board, "Заказы гильдии", "Доска заказов", "Orders", 12) + +---------------------------------------------------------------- Старейшина Ворон и кафедра + +local EZ = -60 +local lectern = P({ Name = "GuildLectern", Size = V(2.6, 3.4, 1.6), CFrame = CFrame.new(X0, FLOOR + 1.7, EZ + 2.6), Color = DARK }) +P({ Name = "LecternTop", Size = V(3, 0.3, 2), CFrame = CFrame.new(X0, FLOOR + 3.55, EZ + 2.6) * CFrame.Angles(math.rad(-15), 0, 0), Color = WOOD }) +P({ Name = "GuildBook", Size = V(1.6, 0.25, 1.1), CFrame = CFrame.new(X0, FLOOR + 3.85, EZ + 2.6) * CFrame.Angles(math.rad(-15), 0, 0), Color = Color3.fromRGB(110, 30, 30) }) +P({ Name = "BookPages", Size = V(1.5, 0.27, 1.0), CFrame = CFrame.new(X0, FLOOR + 3.87, EZ + 2.6) * CFrame.Angles(math.rad(-15), 0, 0), Color = PARCH }) +local elder = P({ Name = "NpcSpot", Size = V(2, 5, 1), CFrame = CFrame.new(X0, FLOOR + 3, EZ) * CFrame.Angles(0, math.pi, 0), + Color = Color3.fromRGB(60, 50, 70), Transparency = 0.5, CanCollide = false, CanQuery = false, CanTouch = false }) +elder:SetAttribute("NpcName", "Старейшина Ворон") +elder:SetAttribute("SkinColor", Color3.fromRGB(222, 176, 140)) +elder:SetAttribute("ShirtColor", Color3.fromRGB(58, 46, 70)) +elder:SetAttribute("PantsColor", Color3.fromRGB(48, 40, 34)) +elder:SetAttribute("HatColor", Color3.fromRGB(150, 150, 152)) +elder:SetAttribute("NpcAction", "Guild") +elder:SetAttribute("NpcActionText", "Гильдия") +elder:SetAttribute("Look", "Elder") +elder:SetAttribute("GuildElder", true) +-- знамя гильдии за спиной Старейшины +P({ Name = "BackBannerRod", Size = V(5.4, 0.3, 0.3), CFrame = CFrame.new(X0, FLOOR + 11, EZ - 2.4), Color = GOLD }) +local back = P({ Name = "GuildBanner", Size = V(4.6, 8, 0.2), CFrame = CFrame.new(X0, FLOOR + 6.9, EZ - 2.4), Color = CRIMSON, Material = Enum.Material.Fabric, CanCollide = false }) +surfaceText(back, Enum.NormalId.Back, "⚓\nF·E·D·C·B·A·S", Color3.fromRGB(255, 214, 120), 0.12) +for _, x in ipairs({ X0 - 2.9, X0 + 2.9 }) do + P({ Name = "BannerPole", Size = V(0.4, 11.5, 0.4), CFrame = CFrame.new(x, FLOOR + 5.75, EZ - 2.4), Color = DARK }) +end +lantern(V(X0 - 3.6, FLOOR + 4.2, EZ + 1), hall) + +---------------------------------------------------------------- лавки наживки: у магазина в лобби и у деда на причале Мира 1 + +local shops = Instance.new("Folder") +shops.Name = "BaitShops" +shops.Parent = map + +local function baitCrate(pos, objectText) + local crate = P({ Name = "BaitCrate", Size = V(2.6, 2.2, 2.2), CFrame = CFrame.new(pos + V(0, 1.1, 0)), Color = shade(WOOD, 0.06) }, shops) + P({ Name = "CrateBand", Size = V(2.7, 0.3, 2.3), CFrame = CFrame.new(pos + V(0, 1.6, 0)), Color = DARK }, shops) + P({ Name = "Worms", Size = V(2.3, 0.2, 1.9), CFrame = CFrame.new(pos + V(0, 2.25, 0)), Color = Color3.fromRGB(96, 66, 46), Material = Enum.Material.Ground }, shops) + for i = 1, 4 do + P({ Name = "Worm", ClassName = "Part", Shape = Enum.PartType.Cylinder, Size = V(0.9, 0.25, 0.25), CanCollide = false, + CFrame = CFrame.new(pos + V(rng:NextNumber(-0.8, 0.8), 2.4, rng:NextNumber(-0.6, 0.6))) * CFrame.Angles(0, rng:NextNumber(0, 6.28), 0), + Color = Color3.fromRGB(210, 120, 120) }, shops) + end + billboard(crate, "🐛 Наживка", Color3.fromRGB(255, 214, 120), 3.2, 180) + prompt(crate, "Наживка", objectText, "Bait", 11) + return crate +end + +local function groundAt(x, z) + local params = RaycastParams.new() + params.FilterType = Enum.RaycastFilterType.Exclude + params.FilterDescendantsInstances = { shops, hall } + local hit = workspace:Raycast(V(x, 80, z), V(0, -160, 0), params) + return hit and hit.Position.Y or FLOOR +end + +baitCrate(V(-49.5, groundAt(-49.5, 15), 15), "Лавка Михалыча") +-- у Деда Петровича на причале «Тихого озера» +local grandpa = map:FindFirstChild("World1NpcGrandpa", true) +if grandpa then + local p = grandpa.Position + grandpa.CFrame.RightVector * 3.2 + baitCrate(V(p.X, groundAt(p.X, p.Z), p.Z), "Дед Петрович") +end + +return ("Двор гильдии: %d деталей, лавок наживки: %d"):format(#hall:GetDescendants(), #shops:GetChildren()) diff --git a/update-place.ps1 b/update-place.ps1 new file mode 100644 index 0000000..dc53723 --- /dev/null +++ b/update-place.ps1 @@ -0,0 +1,82 @@ +# Updates the scripts inside Fishing.rbxlx from src/ WITHOUT touching the map. +# Studio must be closed. A backup is saved to backups\ first. +# Run: powershell -ExecutionPolicy Bypass -File update-place.ps1 + +$ErrorActionPreference = 'Stop' +$root = $PSScriptRoot +$enc = New-Object System.Text.UTF8Encoding($false) +$placePath = Join-Path $root 'Fishing.rbxlx' + +if (Test-Path "$placePath.lock") { throw "Roblox Studio has Fishing.rbxlx open. Close Studio first." } + +# src folder -> service class in the place +$services = [ordered]@{ + 'ReplicatedFirst' = 'ReplicatedFirst' + 'ReplicatedStorage' = 'ReplicatedStorage' + 'ServerScriptService' = 'ServerScriptService' + 'StarterPlayer\StarterPlayerScripts' = 'StarterPlayerScripts' +} + +$scripts = @() +foreach ($rel in $services.Keys) { + $dir = Join-Path "$root\src" $rel + if (-not (Test-Path $dir)) { continue } + Get-ChildItem $dir -File -Filter *.lua | ForEach-Object { + $n = $_.Name + if ($n -like '*.server.lua') { $class = 'Script'; $name = $n -replace '\.server\.lua$', '' } + elseif ($n -like '*.client.lua') { $class = 'LocalScript'; $name = $n -replace '\.client\.lua$', '' } + else { $class = 'ModuleScript'; $name = $n -replace '\.lua$', '' } + $src = [System.IO.File]::ReadAllText($_.FullName, $enc) + if ($src.Contains(']]>') -or $src.Contains('')) { throw "Unsupported text in $n" } + $scripts += @{ Name = $name; Class = $class; Service = $services[$rel]; Source = $src } + } +} + +# backup +$backupDir = Join-Path $root 'backups' +New-Item -ItemType Directory -Force $backupDir | Out-Null +$stamp = Get-Date -Format 'yyyyMMdd-HHmmss' +Copy-Item $placePath (Join-Path $backupDir "Fishing-$stamp.rbxlx") + +$xml = [System.IO.File]::ReadAllText($placePath, $enc) + +foreach ($s in $scripts) { + # all items of this class with this exact name + $pattern = '\s*' + $found = @() + foreach ($m in [regex]::Matches($xml, $pattern)) { + $propsEnd = $xml.IndexOf('', $m.Index) + $seg = $xml.Substring($m.Index, $propsEnd - $m.Index) + if ($seg -match '([^<]*)' -and $Matches[1] -eq $s.Name) { + $found += @{ Start = $m.Index; PropsEnd = $propsEnd } + } + } + if ($found.Count -gt 1) { throw "Several $($s.Class) named $($s.Name) in the place - not touching it." } + + $cdata = '' + if ($found.Count -eq 1) { + $f = $found[0] + $seg = $xml.Substring($f.Start, $f.PropsEnd - $f.Start) + $srcTag = [regex]::Match($seg, '[\s\S]*?') + $newTag = '' + $cdata + '' + if ($srcTag.Success) { + $absStart = $f.Start + $srcTag.Index + $xml = $xml.Substring(0, $absStart) + $newTag + $xml.Substring($absStart + $srcTag.Length) + } else { + $xml = $xml.Substring(0, $f.PropsEnd) + $newTag + $xml.Substring($f.PropsEnd) + } + Write-Host "updated $($s.Service)/$($s.Name)" + } else { + # new script: put it right after the service's own block + $svc = [regex]::Match($xml, '\s*') + if (-not $svc.Success) { throw "Service $($s.Service) not found in the place." } + $insertAt = $xml.IndexOf('', $svc.Index) + ''.Length + $ref = 'RBX' + ([guid]::NewGuid().ToString('N').ToUpper()) + $item = "`n$($s.Name)$cdata" + $xml = $xml.Substring(0, $insertAt) + $item + $xml.Substring($insertAt) + Write-Host "added $($s.Service)/$($s.Name)" + } +} + +[System.IO.File]::WriteAllText($placePath, $xml, $enc) +Write-Host "Done. Backup: backups\Fishing-$stamp.rbxlx"