Update
This commit is contained in:
1 parent
f316a9bf0c
commit
9fcbd8bc0b
38 files changed
+29208
-4904
No files matched your search
@@ -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
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -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
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,165 @@
|
||||
<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">
|
||||
<Item class="LocalScript" referent="RBX1"><Properties><string name="Name">Loading</string><ProtectedString name="Source"><![CDATA[-- 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)
|
||||
]]></ProtectedString></Properties></Item>
|
||||
</roblox>
|
||||
@@ -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<math.huge then bridge:PivotTo(bridge:GetPivot()+V(0,39.1-low,0)) end
|
||||
local generated=workspace:FindFirstChild('HouseWithRamp')
|
||||
if generated then generated.Parent=game.ServerStorage end
|
||||
workspace.CurrentCamera.CFrame=CFrame.lookAt(V(22,14,1570),V(-22,25,1443))
|
||||
return {rampSlopeDegrees=math.deg(math.atan((a.Y-b.Y)/(a.Z-b.Z)))*-1}
|
||||
|
||||
+5066
-1593
File diff suppressed because it is too large.
Load diff
@@ -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.Name<b.Name end)
|
||||
local rng=Random.new(320)
|
||||
local function place(source,name,pos,size,angle,color)
|
||||
local p=source:Clone()
|
||||
for _,v in p:GetDescendants() do if v:IsA('LuaSourceContainer') or v:IsA('SurfaceAppearance') or v:IsA('Decal') or v:IsA('Texture') then v:Destroy() end end
|
||||
p.Name=name;p.Anchored=true;p.TextureID='';p.Material=Enum.Material.SmoothPlastic;p.MaterialVariant='';p.Reflectance=0
|
||||
p.Size=size;p.CFrame=CF(pos)*CFrame.Angles(0,angle or 0,0)
|
||||
p.Color=color or Color3.fromRGB(130+rng:NextInteger(-7,7),135+rng:NextInteger(-5,5),149+rng:NextInteger(-5,5))
|
||||
p.Parent=folder;return p
|
||||
end
|
||||
-- Broad vertical facets under the grassy lookout and beside the waterfall.
|
||||
local columns={
|
||||
{-75,18,1415,23,38,24},{-58,21,1417,26,44,25},{-38,22,1415,25,46,23},{-19,18,1408,24,38,23},
|
||||
{5,13,1410,22,28,24},
|
||||
{25,16,1427,23,36,27},{12,13,1423,22,29,26},
|
||||
{68,17,1425,25,39,29},{85,15,1420,25,34,30},{98,10,1410,24,25,27},
|
||||
}
|
||||
for i,p in columns do
|
||||
place(cliff,'CliffFace_'..i,V(p[1],p[2],p[3]+(i<=5 and 9 or 0)),V(p[4]*(i<=5 and 1.2 or 1),p[5],p[6]*(i<=5 and 1.15 or 1)),i*0.71)
|
||||
end
|
||||
-- Large irregular rock silhouettes replace the fine-grained mountain surface.
|
||||
for i=0,23 do
|
||||
local a=i*math.pi*2/24
|
||||
local r=239+17*math.sin(i*2.17)
|
||||
local radius=66+23*math.sin(i*3.1)^2
|
||||
local ht=76+43*math.sin(i*1.87)^2
|
||||
local pos=V(math.cos(a)*r,ht*0.43,1500+math.sin(a)*r)
|
||||
local mass=place(mountain,'MountainMass_'..i,V(pos.X-math.cos(a)*19,ht*0.51-4,pos.Z-math.sin(a)*19),V(radius*1.95,ht*1.344,radius*2.295),0,Color3.fromRGB(125+i%3*4,136+i%3*3,147+i%3*4))
|
||||
mass.CFrame=CFrame.lookAt(mass.Position,mass.Position+V(math.cos(a),0,math.sin(a)))
|
||||
task.wait()
|
||||
end
|
||||
local feet={{-64,12,1426,25,30,22},{-44,15,1428,29,35,24},{-25,10,1424,20,24,19},{27,12,1433,24,29,27},{70,15,1430,29,35,30},{92,9,1421,28,25,27}}
|
||||
for i,a in feet do
|
||||
place(stones[i],'CliffFootBoulder',V(a[1],a[2],a[3]),V(a[4],a[5],a[6]),i*0.6,Color3.fromRGB(128+i%3*3,132+i%3*3,146+i%3*3))
|
||||
end
|
||||
local rp=RaycastParams.new();rp.FilterType=Enum.RaycastFilterType.Include;rp.FilterDescendantsInstances={terrain};rp.IgnoreWater=true
|
||||
local lakes=require(game.ReplicatedStorage.FishConfig).Worlds[1].lakes
|
||||
local function gap(x,z)
|
||||
local g=math.huge
|
||||
for _,l in lakes do g=math.min(g,math.sqrt((x-l[1])^2+(z-1500-l[2])^2)-l[3]) end
|
||||
return g
|
||||
end
|
||||
-- Discrete clusters, with the dock, ramp, and trail kept open.
|
||||
for i=1,120 do
|
||||
local x,z=rng:NextNumber(-112,116),rng:NextNumber(1408,1557)
|
||||
local g=gap(x,z)
|
||||
local clear=not (math.abs(x)<27 and z>1530) 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}
|
||||
|
||||
|
||||
@@ -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 d<best then best,h=d,a[3]+(b[3]-a[3])*t end
|
||||
end
|
||||
return best,h
|
||||
end
|
||||
local peaks={}
|
||||
for i=0,23 do
|
||||
local a=i*math.pi*2/24
|
||||
local r=239+17*math.sin(i*2.17)
|
||||
table.insert(peaks,{math.cos(a)*r,math.sin(a)*r,66+23*math.sin(i*3.1)^2,76+43*math.sin(i*1.87)^2})
|
||||
end
|
||||
local function height(x,z)
|
||||
local g=gap(x,z)
|
||||
if g<0 then return -10+math.clamp((g+10)/10,0,1)*8 end
|
||||
local y=4+math.noise(x/48,z/48)*2
|
||||
for _,p in peaks do
|
||||
local d=math.sqrt((x-p[1])^2+(z-p[2])^2)/p[3]
|
||||
y=math.max(y,4+p[4]*math.max(0,1-d)^0.85)
|
||||
end
|
||||
local d=math.sqrt(((x+46)/70)^2+((z+123)/64)^2)
|
||||
y=math.max(y,4+56*math.max(0,1-d^2)^0.7)
|
||||
-- Broad, grassy summit with a firm level base for the lookout.
|
||||
if ((x+46)/15)^2+((z+123)/14)^2<1 then y=60 end
|
||||
-- River escarpment behind the waterfall, with a steep lake-facing wall.
|
||||
local cliff=math.clamp((x-17)/15,0,1)*math.clamp((112-x)/22,0,1)*math.clamp((-z-68)/12,0,1)*math.clamp((z+172)/28,0,1)
|
||||
y=math.max(y,4+32*cliff)
|
||||
local pd,ph=pathInfo(x,z)
|
||||
local mix=1-math.clamp((pd-4)/9,0,1)
|
||||
y=y*(1-mix)+ph*mix
|
||||
-- Level building terrace on the left bank.
|
||||
local cd=math.sqrt(((x+80)/22)^2+((z+50)/19)^2)
|
||||
if cd<1.5 then local b=math.clamp((1.5-cd)/0.5,0,1); y=y*(1-b)+10*b end
|
||||
-- Preserve the low, usable shoreline.
|
||||
y=4+(y-4)*math.clamp(g/11,0,1)
|
||||
return y
|
||||
end
|
||||
terrain:SetMaterialColor(Enum.Material.Snow,Color3.fromRGB(122,182,74))
|
||||
terrain:SetMaterialColor(Enum.Material.Salt,Color3.fromRGB(190,153,102))
|
||||
terrain:SetMaterialColor(Enum.Material.Rock,Color3.fromRGB(111,124,137))
|
||||
terrain:SetMaterialColor(Enum.Material.Sand,Color3.fromRGB(205,190,140))
|
||||
terrain.WaterColor=Color3.fromRGB(38,158,157)
|
||||
terrain.WaterTransparency=0.5
|
||||
terrain.WaterWaveSize=0.12
|
||||
terrain.WaterWaveSpeed=8
|
||||
-- 48-stud chunks keep every WriteVoxels small and allow Studio to repaint.
|
||||
for x0=-288,287,48 do
|
||||
for z0=-288,287,48 do
|
||||
local region=Region3.new(W+V(x0,-24,z0),W+V(x0+48,160,z0+48)):ExpandToGrid(4)
|
||||
local mats,occ=terrain:ReadVoxels(region,4)
|
||||
for ix=1,12 do for iz=1,12 do
|
||||
local x,z=x0+(ix-0.5)*4,z0+(iz-0.5)*4
|
||||
local h,g=height(x,z)-2,gap(x,z)
|
||||
local pd=pathInfo(x,z)
|
||||
local slope=math.max(math.abs(height(x+2,z)-height(x-2,z)),math.abs(height(x,z+2)-height(x,z-2)))/4
|
||||
for iy=1,46 do
|
||||
local bottom=-24+(iy-1)*4
|
||||
local o=math.clamp((h-bottom)/4,0,1)
|
||||
local m=Enum.Material.Air
|
||||
if o>0 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}
|
||||
|
||||
|
||||
@@ -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}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user