1759 lines
77 KiB
Plaintext
1759 lines
77 KiB
Plaintext
<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">
|
||
<Item class="ModuleScript" referent="RBX1"><Properties><string name="Name">WorldBuilder</string><ProtectedString name="Source"><![CDATA[-- 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
|
||
|
||
function Builder.applyLighting()
|
||
Lighting.ClockTime = 14.5
|
||
Lighting.Brightness = 2.3
|
||
Lighting.Ambient = Color3.fromRGB(70, 70, 85)
|
||
Lighting.OutdoorAmbient = Color3.fromRGB(140, 145, 160)
|
||
Lighting.EnvironmentDiffuseScale = 0.6
|
||
Lighting.EnvironmentSpecularScale = 0.8
|
||
ensure("Atmosphere", Lighting, {
|
||
Density = 0.25, Offset = 0.12, Glare = 0, Haze = 0.6,
|
||
Color = Color3.fromRGB(200, 215, 232), Decay = Color3.fromRGB(110, 140, 175),
|
||
})
|
||
ensure("BloomEffect", Lighting, { Intensity = 0.5, Size = 24, Threshold = 1.4 })
|
||
ensure("ColorCorrectionEffect", Lighting, { Saturation = 0.15, Contrast = 0.06, Brightness = 0.02 })
|
||
ensure("SunRaysEffect", Lighting, { Intensity = 0.05, Spread = 0.8 })
|
||
end
|
||
|
||
---------------------------------------------------------------- помощники
|
||
|
||
local function P(props)
|
||
local p = Instance.new("Part")
|
||
if props.Shape then
|
||
p.Shape = props.Shape
|
||
end
|
||
p.Anchored = true
|
||
p.TopSurface = Enum.SurfaceType.Smooth
|
||
p.BottomSurface = Enum.SurfaceType.Smooth
|
||
for k, v in pairs(props) do
|
||
if k ~= "Parent" and k ~= "Shape" then
|
||
p[k] = v
|
||
end
|
||
end
|
||
p.Parent = props.Parent or map
|
||
return p
|
||
end
|
||
|
||
local function vcyl(pos, h, d, props)
|
||
props.Shape = Enum.PartType.Cylinder
|
||
props.Size = V(h, d, d)
|
||
props.CFrame = CFrame.new(pos) * CFrame.Angles(0, 0, math.rad(90))
|
||
return P(props)
|
||
end
|
||
|
||
local function ball(pos, d, props)
|
||
props.Shape = Enum.PartType.Ball
|
||
props.Size = V(d, d, d)
|
||
props.Position = pos
|
||
return P(props)
|
||
end
|
||
|
||
local function surfaceText(part, face, text, color, extra)
|
||
local sg = Instance.new("SurfaceGui")
|
||
sg.Face = face
|
||
sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
|
||
sg.PixelsPerStud = 40
|
||
sg.LightInfluence = 0
|
||
sg.Parent = part
|
||
local t = Instance.new("TextLabel")
|
||
t.Size = UDim2.fromScale(1, 1)
|
||
t.BackgroundTransparency = 1
|
||
t.Font = Enum.Font.FredokaOne
|
||
t.TextScaled = true
|
||
t.RichText = true
|
||
t.TextColor3 = color or Color3.new(1, 1, 1)
|
||
t.TextStrokeTransparency = 0.4
|
||
t.Text = text
|
||
t.Parent = sg
|
||
local pad = Instance.new("UIPadding")
|
||
pad.PaddingLeft = UDim.new(0.05, 0)
|
||
pad.PaddingRight = UDim.new(0.05, 0)
|
||
pad.PaddingTop = UDim.new(0.06, 0)
|
||
pad.PaddingBottom = UDim.new(0.06, 0)
|
||
pad.Parent = t
|
||
for k, v in pairs(extra or {}) do
|
||
t[k] = v
|
||
end
|
||
return t
|
||
end
|
||
|
||
local function billboard(target, text, color, offsetY, width)
|
||
local bb = Instance.new("BillboardGui")
|
||
bb.Size = UDim2.fromOffset(width or 300, 64)
|
||
bb.StudsOffset = V(0, offsetY or 5, 0)
|
||
bb.MaxDistance = 160
|
||
bb.LightInfluence = 0
|
||
bb.Parent = target
|
||
local t = Instance.new("TextLabel")
|
||
t.Size = UDim2.fromScale(1, 1)
|
||
t.BackgroundTransparency = 1
|
||
t.Font = Enum.Font.FredokaOne
|
||
t.TextScaled = true
|
||
t.TextColor3 = color or Color3.new(1, 1, 1)
|
||
t.TextStrokeTransparency = 0.15
|
||
t.Text = text
|
||
t.Parent = bb
|
||
return bb
|
||
end
|
||
|
||
local function prompt(target, actionText, objectText, action, dist)
|
||
local pp = Instance.new("ProximityPrompt")
|
||
pp.ActionText = actionText
|
||
pp.ObjectText = objectText
|
||
pp.HoldDuration = 0
|
||
pp.MaxActivationDistance = dist or 13
|
||
pp.RequiresLineOfSight = false
|
||
pp:SetAttribute("Action", action)
|
||
pp.Parent = target
|
||
return pp
|
||
end
|
||
|
||
local function marker(name, cf)
|
||
return P({ Name = name, Size = V(4, 1, 4), CFrame = cf, Transparency = 1, CanCollide = false, CanQuery = false, CanTouch = false })
|
||
end
|
||
|
||
local function lobbyCliffs()
|
||
local template = ServerStorage:FindFirstChild("FishingCliffTemplate")
|
||
if not template or not template:IsA("Model") then
|
||
warn("FishingCliffTemplate отсутствует; используем низкую изгородь лобби")
|
||
for deg = 0, 359, 7 do
|
||
local a = math.rad(deg)
|
||
local p = V(math.cos(a) * 82, FLOOR + 2, math.sin(a) * 82)
|
||
P({ Size = V(10.5, 4, 3), CFrame = CFrame.lookAt(p, V(0, p.Y, 0)), Material = Enum.Material.Grass, Color = Color3.fromRGB(60, 130, 55) })
|
||
end
|
||
return
|
||
end
|
||
|
||
local ring = Instance.new("Folder")
|
||
ring.Name = "LobbyCliffs"
|
||
ring.Parent = map
|
||
local count = 24
|
||
local tiers = {
|
||
{ name = "LobbyCliff", radius = 88, scale = 1.4, baseY = FLOOR },
|
||
{ name = "LobbyCliffUpper", radius = 104, scale = 2.2, baseY = FLOOR + 10 },
|
||
}
|
||
for _, tier in ipairs(tiers) do
|
||
for i = 1, count do
|
||
local angle = (i - 1) * 2 * math.pi / count
|
||
local radial = V(math.cos(angle), 0, math.sin(angle))
|
||
local center = V(radial.X * tier.radius, tier.baseY, radial.Z * tier.radius)
|
||
local model = template:Clone()
|
||
model.Name = string.format("%s_%02d", tier.name, i)
|
||
model:ScaleTo(tier.scale)
|
||
local facing = CFrame.lookAt(center, center + radial)
|
||
local rotation = facing - facing.Position
|
||
model:PivotTo(CFrame.new(center) * rotation)
|
||
local boxCF, boxSize = model:GetBoundingBox()
|
||
local targetBoxCenter = V(center.X, tier.baseY + boxSize.Y / 2, center.Z)
|
||
model:PivotTo(model:GetPivot() + (targetBoxCenter - boxCF.Position))
|
||
model.Parent = ring
|
||
end
|
||
end
|
||
end
|
||
|
||
local function rockTopPosition(cliffs, radial, desiredRadius, radiusOffsets)
|
||
local params = RaycastParams.new()
|
||
params.FilterType = Enum.RaycastFilterType.Include
|
||
params.FilterDescendantsInstances = { cliffs }
|
||
for _, offset in ipairs(radiusOffsets) do
|
||
local radius = desiredRadius + offset
|
||
local origin = V(radial.X * radius, 128, radial.Z * radius)
|
||
local hit = Workspace:Raycast(origin, V(0, -180, 0), params)
|
||
if hit then
|
||
return hit.Position
|
||
end
|
||
end
|
||
return V(radial.X * desiredRadius, FLOOR, radial.Z * desiredRadius)
|
||
end
|
||
|
||
local function placeModelOnRock(model, position, yaw)
|
||
local rotation = CFrame.Angles(0, yaw, 0)
|
||
model:PivotTo(CFrame.new(position) * rotation)
|
||
local boxCF, boxSize = model:GetBoundingBox()
|
||
local targetBoxCenter = V(position.X, position.Y + boxSize.Y / 2, position.Z)
|
||
model:PivotTo(model:GetPivot() + (targetBoxCenter - boxCF.Position))
|
||
end
|
||
|
||
local function lobbyTrees()
|
||
local templates = ServerStorage:FindFirstChild("LobbyTreeTemplates")
|
||
local cliffs = map:FindFirstChild("LobbyCliffs")
|
||
if not templates or not cliffs then
|
||
warn("LobbyTreeTemplates или LobbyCliffs отсутствует; деревья лобби пропущены")
|
||
return
|
||
end
|
||
local treeTypes = { "LargeCanopy", "Pine", "RoundCanopy" }
|
||
local treeScale = { LargeCanopy = 1, Pine = 1.25, RoundCanopy = 1.2 }
|
||
local folder = Instance.new("Folder")
|
||
folder.Name = "LobbyTrees"
|
||
folder.Parent = map
|
||
for layer = 1, 2 do
|
||
local baseRadius = layer == 1 and 84 or 96
|
||
local radiusOffsets = { 0, -2, 2, -4, 4, -6, 6 }
|
||
for i = 1, 18 do
|
||
local degrees = (i - 1) * 20 + 10 + (layer == 2 and 10 or 0)
|
||
local angle = math.rad(degrees)
|
||
local radial = V(math.cos(angle), 0, math.sin(angle))
|
||
local position = rockTopPosition(cliffs, radial, baseRadius, radiusOffsets)
|
||
local kind = treeTypes[(i + layer - 2) % #treeTypes + 1]
|
||
local template = templates:FindFirstChild(kind)
|
||
if template and template:IsA("Model") then
|
||
local model = template:Clone()
|
||
model.Name = string.format("LobbyTree_L%d_%02d_%s", layer, i, kind)
|
||
model:ScaleTo(treeScale[kind])
|
||
placeModelOnRock(model, position, math.rad((i * 47 + layer * 23) % 360))
|
||
for _, part in ipairs(model:GetDescendants()) do
|
||
if part:IsA("BasePart") then part.Anchored = true end
|
||
end
|
||
model.Parent = folder
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
local function lobbyRockPlants()
|
||
local templates = ServerStorage:FindFirstChild("LobbyRockPlantTemplates")
|
||
local cliffs = map:FindFirstChild("LobbyCliffs")
|
||
if not templates or not cliffs then
|
||
warn("LobbyRockPlantTemplates или LobbyCliffs отсутствует; растительность скал пропущена")
|
||
return
|
||
end
|
||
local folder = Instance.new("Folder")
|
||
folder.Name = "LobbyRockPlants"
|
||
folder.Parent = map
|
||
local clusterAngles = {
|
||
{ layer = 1, degrees = 45 }, { layer = 1, degrees = 135 },
|
||
{ layer = 1, degrees = 225 }, { layer = 1, degrees = 315 },
|
||
{ layer = 2, degrees = 0 }, { layer = 2, degrees = 90 },
|
||
{ layer = 2, degrees = 180 }, { layer = 2, degrees = 270 },
|
||
}
|
||
local tuftKinds = { "GrassTuft", "BladeGrass", "GrassTuft", "FlowerPatch", "GrassTuft", "WideGrass" }
|
||
local tuftScales = { GrassTuft = 1.15, BladeGrass = 1.45, FlowerPatch = 1.1, WideGrass = 0.55 }
|
||
local offsets = { { 0, 0 }, { -2.2, 0 }, { 2.2, 0 }, { 0, -2.2 }, { 0, 2.2 }, { 1.6, 1.6 } }
|
||
local rayParams = RaycastParams.new()
|
||
rayParams.FilterType = Enum.RaycastFilterType.Include
|
||
rayParams.FilterDescendantsInstances = { cliffs }
|
||
for clusterIndex, cluster in ipairs(clusterAngles) do
|
||
local baseRadius = cluster.layer == 1 and 84 or 96
|
||
local baseAngle = math.rad(cluster.degrees)
|
||
local radial = V(math.cos(baseAngle), 0, math.sin(baseAngle))
|
||
local tangent = V(-radial.Z, 0, radial.X)
|
||
local basePos = rockTopPosition(cliffs, radial, baseRadius, { 0, -2, 2, -4, 4, -6, 6 })
|
||
local bush = Instance.new("Model")
|
||
bush.Name = string.format("GrassBush_%02d_L%d", clusterIndex, cluster.layer)
|
||
for i, offset in ipairs(offsets) do
|
||
local xz = basePos + radial * offset[1] + tangent * offset[2]
|
||
local plantPos
|
||
for _, correction in ipairs({ 0, -2, 2, -4, 4 }) do
|
||
local candidate = xz + radial * correction
|
||
local hit = Workspace:Raycast(V(candidate.X, 128, candidate.Z), V(0, -180, 0), rayParams)
|
||
if hit then plantPos = hit.Position; break end
|
||
end
|
||
if plantPos then
|
||
local kind = tuftKinds[i]
|
||
local template = templates:FindFirstChild(kind)
|
||
if template and template:IsA("Model") then
|
||
local plant = template:Clone()
|
||
plant.Name = kind .. "_" .. i
|
||
plant:ScaleTo(tuftScales[kind])
|
||
placeModelOnRock(plant, plantPos, math.rad((clusterIndex * 37 + i * 53) % 360))
|
||
for _, part in ipairs(plant:GetDescendants()) do
|
||
if part:IsA("BasePart") then part.Anchored = true end
|
||
end
|
||
plant.Parent = bush
|
||
end
|
||
end
|
||
end
|
||
bush.Parent = folder
|
||
end
|
||
end
|
||
-- холмы и горы за скалами лобби (террейн), ельники на склонах и кольцо тумана за горами.
|
||
-- К горизонту холмы выше, чтобы из лобби было видно не пустоту, а гряду в дымке.
|
||
local function lobbyHillHeight(x, z)
|
||
local r = math.sqrt(x * x + z * z)
|
||
if r < 120 then
|
||
return nil
|
||
end
|
||
local t = math.clamp((r - 120) / 220, 0, 1)
|
||
local base = 22 + 90 * t ^ 0.85
|
||
local n = math.noise(x / 95, z / 95, 1.7) * 30 + math.noise(x / 38, z / 38, 5.1) * 9
|
||
local peak = math.max(0, math.noise(x / 150, z / 150, 9.3)) * 70 * t
|
||
local edge = math.clamp((r - 120) / 12, 0, 1)
|
||
return (base + n * (0.35 + 0.65 * t) + peak) * edge
|
||
end
|
||
|
||
local function lobbyHills()
|
||
local R, Y0, Y1, CH = 384, -8, 232, 64
|
||
for cx = -R, R - CH, CH do
|
||
for cz = -R, R - CH, CH do
|
||
-- чанк целиком внутри лобби пропускаем
|
||
local far = math.sqrt(math.max(cx * cx, (cx + CH) ^ 2) + math.max(cz * cz, (cz + CH) ^ 2))
|
||
if far >= 120 then
|
||
local region = Region3.new(V(cx, Y0, cz), V(cx + CH, Y1, cz + CH))
|
||
local nx, ny, nz = CH / 4, (Y1 - Y0) / 4, CH / 4
|
||
local mats, occs = {}, {}
|
||
for i = 1, nx do
|
||
mats[i], occs[i] = {}, {}
|
||
for j = 1, ny do
|
||
mats[i][j], occs[i][j] = {}, {}
|
||
end
|
||
for k = 1, nz do
|
||
local x, z = cx + (i - 0.5) * 4, cz + (k - 0.5) * 4
|
||
local h = (math.sqrt(x * x + z * z) <= R) and lobbyHillHeight(x, z) or nil
|
||
for j = 1, ny do
|
||
local yb = Y0 + (j - 1) * 4
|
||
local occ = h and math.clamp((h - yb) / 4, 0, 1) or 0
|
||
local m = Enum.Material.Air
|
||
if occ > 0 then
|
||
if yb > h - 6 then
|
||
m = h > 118 and Enum.Material.Rock or Enum.Material.Grass
|
||
else
|
||
m = Enum.Material.Ground
|
||
end
|
||
end
|
||
mats[i][j][k], occs[i][j][k] = m, occ
|
||
end
|
||
end
|
||
end
|
||
terrain:WriteVoxels(region, 4, mats, occs)
|
||
end
|
||
end
|
||
end
|
||
|
||
-- ельники пятнами на склонах
|
||
local pines = ServerStorage:FindFirstChild("OldPines")
|
||
local forest = Instance.new("Folder")
|
||
forest.Name = "LobbyHillForest"
|
||
forest.Parent = map
|
||
if pines and #pines:GetChildren() > 0 then
|
||
local templates = pines:GetChildren()
|
||
local frng = Random.new(1104)
|
||
local placed = {}
|
||
for _ = 1, 4000 do
|
||
if #placed >= 170 then break end
|
||
local a = frng:NextNumber(0, math.pi * 2)
|
||
local r = frng:NextNumber(132, 300)
|
||
local x, z = math.cos(a) * r, math.sin(a) * r
|
||
-- высоту берём из той же формулы: лучи по только что залитому террейну в редакторе ненадёжны
|
||
local h = lobbyHillHeight(x, z)
|
||
local slope = h and math.max(math.abs((lobbyHillHeight(x + 4, z) or h) - h), math.abs((lobbyHillHeight(x, z + 4) or h) - h)) / 4
|
||
if h and h <= 118 and slope < 0.8 and math.noise(x / 60, z / 60, 3.3) > -0.05 then
|
||
local ground = V(x, h, z)
|
||
local ok = true
|
||
for _, q in ipairs(placed) do
|
||
if (q - ground).Magnitude < 9 then ok = false break end
|
||
end
|
||
if ok then
|
||
local m = templates[frng:NextInteger(1, #templates)]:Clone()
|
||
for _, d in ipairs(m:GetDescendants()) do
|
||
if d:IsA("LuaSourceContainer") then
|
||
d:Destroy()
|
||
elseif d:IsA("BasePart") then
|
||
d.Anchored = true
|
||
d.CanCollide = false
|
||
d.CastShadow = false
|
||
end
|
||
end
|
||
m:ScaleTo(m:GetScale() * frng:NextNumber(0.8, 1.5))
|
||
m:PivotTo(CFrame.new(ground) * CFrame.Angles(0, frng:NextNumber(0, math.pi * 2), 0))
|
||
local bcf, bsz = m:GetBoundingBox()
|
||
m:PivotTo(m:GetPivot() + V(0, ground.Y - (bcf.Position.Y - bsz.Y / 2) - 1, 0))
|
||
m.Parent = forest
|
||
table.insert(placed, ground)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
-- туман за горами: медленные крупные клубы по двум кольцам
|
||
local haze = Instance.new("Folder")
|
||
haze.Name = "LobbyHaze"
|
||
haze.Parent = map
|
||
for ring, cfg in ipairs({ { r = 150, n = 28, y = 18, size = 45 }, { r = 250, n = 36, y = 40, size = 70 } }) do
|
||
for i = 1, cfg.n do
|
||
local a = (i - 1) / cfg.n * math.pi * 2
|
||
local x, z = math.cos(a) * cfg.r, math.sin(a) * cfg.r
|
||
local h = lobbyHillHeight(x, z) or 0
|
||
local anchor = Instance.new("Part")
|
||
anchor.Name = "HazeAnchor"
|
||
anchor.Anchored = true
|
||
anchor.CanCollide = false
|
||
anchor.CanQuery = false
|
||
anchor.CanTouch = false
|
||
anchor.Transparency = 1
|
||
anchor.Size = V(30, 4, 30)
|
||
anchor.CFrame = CFrame.new(x, h + cfg.y, z)
|
||
anchor.Parent = haze
|
||
local pe = Instance.new("ParticleEmitter")
|
||
pe.Texture = "rbxasset://textures/particles/smoke_main.dds"
|
||
pe.Color = ColorSequence.new(Color3.fromRGB(236, 228, 220))
|
||
pe.LightEmission = 0.15
|
||
pe.LightInfluence = 0.6
|
||
pe.Rate = ring == 1 and 0.5 or 0.35
|
||
pe.Lifetime = NumberRange.new(16, 22)
|
||
pe.Speed = NumberRange.new(0.3, 0.8)
|
||
pe.SpreadAngle = Vector2.new(60, 60)
|
||
pe.Rotation = NumberRange.new(0, 360)
|
||
pe.RotSpeed = NumberRange.new(-4, 4)
|
||
pe.Size = NumberSequence.new({
|
||
NumberSequenceKeypoint.new(0, cfg.size * 0.7),
|
||
NumberSequenceKeypoint.new(1, cfg.size * 1.2),
|
||
})
|
||
pe.Transparency = NumberSequence.new({
|
||
NumberSequenceKeypoint.new(0, 1),
|
||
NumberSequenceKeypoint.new(0.3, 0.8),
|
||
NumberSequenceKeypoint.new(0.7, 0.82),
|
||
NumberSequenceKeypoint.new(1, 1),
|
||
})
|
||
pe.Parent = anchor
|
||
end
|
||
end
|
||
end
|
||
|
||
-- высота земли: читаем воксели столбца (лучи по только что залитому террейну ненадёжны, особенно в редакторе)
|
||
local function groundY(x, z)
|
||
local region = Region3.new(V(x - 1, -128, z - 1), V(x + 1, 160, z + 1)):ExpandToGrid(4)
|
||
local ok, mats, occ = pcall(terrain.ReadVoxels, terrain, region, 4)
|
||
if ok then
|
||
local bottom = region.CFrame.Position.Y - region.Size.Y / 2
|
||
for y = mats.Size.Y, 1, -1 do
|
||
local m = mats[1][y][1]
|
||
if m ~= Enum.Material.Air and m ~= Enum.Material.Water then
|
||
return bottom + (y - 1 + occ[1][y][1]) * 4, m
|
||
end
|
||
end
|
||
end
|
||
return GROUND_Y
|
||
end
|
||
|
||
local function lamp(pos, color)
|
||
vcyl(pos + V(0, 4.5, 0), 9, 0.5, { Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal })
|
||
P({ Size = V(1.4, 0.3, 1.4), Position = pos + V(0, 9.1, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal })
|
||
local bulb = P({ Size = V(1, 1.4, 1), Position = pos + V(0, 9.95, 0), Material = Enum.Material.Neon, Color = color or Color3.fromRGB(255, 215, 150) })
|
||
P({ Size = V(1.5, 0.35, 1.5), Position = pos + V(0, 10.8, 0), Color = Color3.fromRGB(40, 40, 45), Material = Enum.Material.Metal })
|
||
local light = Instance.new("PointLight")
|
||
light.Range = 16
|
||
light.Brightness = 1.2
|
||
light.Color = color or Color3.fromRGB(255, 210, 150)
|
||
light.Parent = bulb
|
||
end
|
||
|
||
local function tree(pos, kind)
|
||
if kind == "pine" then
|
||
local h = rng:NextNumber(8, 12)
|
||
vcyl(pos + V(0, h / 2, 0), h, 1.3, { Color = Color3.fromRGB(95, 65, 40), Material = Enum.Material.Wood })
|
||
for i = 0, 3 do
|
||
ball(pos + V(0, h * 0.4 + i * 2.8, 0), 10 - i * 2.2, { Color = Color3.fromRGB(35, 100 + i * 10, 55), Material = Enum.Material.Grass })
|
||
end
|
||
else
|
||
local birch = kind == "birch"
|
||
local h = rng:NextNumber(7, 10)
|
||
vcyl(pos + V(0, h / 2, 0), h, 1.5, {
|
||
Color = birch and Color3.fromRGB(225, 222, 210) or Color3.fromRGB(105, 72, 45),
|
||
Material = Enum.Material.Wood,
|
||
})
|
||
local leaf = birch and Color3.fromRGB(150, 195, 80) or Color3.fromRGB(65, rng:NextInteger(135, 165), 60)
|
||
local s = rng:NextNumber(9, 12)
|
||
ball(pos + V(0, h + s * 0.25, 0), s, { Color = leaf, Material = Enum.Material.Grass })
|
||
ball(pos + V(s * 0.35, h - 0.5, s * 0.1), s * 0.7, { Color = leaf, Material = Enum.Material.Grass })
|
||
ball(pos + V(-s * 0.3, h - 0.2, -s * 0.2), s * 0.65, { Color = leaf, Material = Enum.Material.Grass })
|
||
end
|
||
end
|
||
|
||
local function bush(pos)
|
||
local c = Color3.fromRGB(55, rng:NextInteger(120, 150), 55)
|
||
for i = 1, 3 do
|
||
ball(pos + V(rng:NextNumber(-1.5, 1.5), 1, rng:NextNumber(-1.5, 1.5)), rng:NextNumber(2.5, 4), { Color = c, Material = Enum.Material.Grass })
|
||
end
|
||
if rng:NextNumber() < 0.5 then
|
||
for i = 1, 4 do
|
||
ball(pos + V(rng:NextNumber(-1.8, 1.8), rng:NextNumber(1.5, 2.6), rng:NextNumber(-1.8, 1.8)), 0.5, {
|
||
Color = ({ Color3.fromRGB(255, 120, 150), Color3.fromRGB(255, 230, 90), Color3.fromRGB(240, 240, 255) })[rng:NextInteger(1, 3)],
|
||
CanCollide = false,
|
||
})
|
||
end
|
||
end
|
||
end
|
||
|
||
local function bench(cf)
|
||
local seat = Instance.new("Seat")
|
||
seat.Anchored = true
|
||
seat.Size = V(5, 0.4, 1.6)
|
||
seat.CFrame = cf * CFrame.new(0, 1.6, 0)
|
||
seat.Material = Enum.Material.WoodPlanks
|
||
seat.Color = Color3.fromRGB(150, 105, 65)
|
||
seat.TopSurface = Enum.SurfaceType.Smooth
|
||
seat.Parent = map
|
||
for _, x in ipairs({ -2.1, 2.1 }) do
|
||
P({ Size = V(0.4, 1.4, 1.4), CFrame = cf * CFrame.new(x, 0.7, 0), Color = Color3.fromRGB(50, 50, 55), Material = Enum.Material.Metal })
|
||
end
|
||
P({ Size = V(5, 1.3, 0.3), CFrame = cf * CFrame.new(0, 2.6, 0.75) * CFrame.Angles(math.rad(-10), 0, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 105, 65) })
|
||
end
|
||
|
||
-- место NPC: полупрозрачная фигура в редакторе; сам NPC встаёт сюда при запуске (prepareRuntime)
|
||
local function setNpc(part, name, colors, action, actionText)
|
||
part:SetAttribute("NpcName", name)
|
||
part:SetAttribute("SkinColor", colors.skin)
|
||
part:SetAttribute("ShirtColor", colors.shirt)
|
||
part:SetAttribute("PantsColor", colors.pants)
|
||
part:SetAttribute("HatColor", colors.hat)
|
||
part:SetAttribute("NpcAction", action)
|
||
part:SetAttribute("NpcActionText", actionText)
|
||
part.Size = V(2, 5, 1)
|
||
part.Color = colors.shirt
|
||
part.Transparency = 0.5
|
||
part.CanCollide = false
|
||
part.CanQuery = false
|
||
part.CanTouch = false
|
||
return part
|
||
end
|
||
|
||
local function npc(name, cf, colors, action, actionText)
|
||
return setNpc(P({ Name = "NpcSpot", CFrame = cf }), name, colors, action, actionText)
|
||
end
|
||
|
||
-- доска «кто водится»: атрибуты Bestiary (зона), BestiaryTitle, BestiaryHex; текст пишется заново при запуске
|
||
local function writeBestiary(board)
|
||
local old = board:FindFirstChild("BestiaryText")
|
||
if old then
|
||
old:Destroy()
|
||
end
|
||
local zone = Config.Zones[board:GetAttribute("Bestiary")]
|
||
if not zone then
|
||
return
|
||
end
|
||
local lines = { ("<font color=\"%s\">%s</font>"):format(board:GetAttribute("BestiaryHex") or "#FFFFFF", board:GetAttribute("BestiaryTitle") or "") }
|
||
for _, f in ipairs(zone.fish) do
|
||
local r = Config.Rarities[f.rarity]
|
||
table.insert(lines, ("<font color=\"#%s\">%s — %s</font>"):format(r.color:ToHex(), f.name, r.name))
|
||
end
|
||
surfaceText(board, Enum.NormalId.Front, table.concat(lines, "\n"), Color3.new(1, 1, 1)).Parent.Name = "BestiaryText"
|
||
end
|
||
|
||
local function setBestiary(board, zoneId, title, titleHex)
|
||
board:SetAttribute("Bestiary", zoneId)
|
||
board:SetAttribute("BestiaryTitle", title)
|
||
board:SetAttribute("BestiaryHex", titleHex)
|
||
writeBestiary(board)
|
||
end
|
||
|
||
-- лавка: 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
|
||
|
||
-- Модель портала из ServerStorage.FishingPortalTemplate, перекрашенная в цвет мира и
|
||
-- поставленная основанием на baseCF. Без шаблона возвращает nil (тогда строится старое кольцо).
|
||
function Builder.portalModel(baseCF, color, name, parent)
|
||
local template = ServerStorage:FindFirstChild("FishingPortalTemplate")
|
||
if not (template and template:IsA("Model")) then
|
||
return nil
|
||
end
|
||
local model = template:Clone()
|
||
model.Name = name
|
||
for _, part in ipairs(model:GetDescendants()) do
|
||
if part:IsA("BasePart") then
|
||
local c = part.Color
|
||
local isGreen = c.G > c.R * 1.15 and c.G > c.B * 1.10 and c.G > 0.25
|
||
if part.Material == Enum.Material.Neon then
|
||
part.Color = color
|
||
elseif isGreen then
|
||
part.Color = color:Lerp(Color3.fromRGB(55, 65, 75), 0.30)
|
||
part.Material = Enum.Material.SmoothPlastic
|
||
end
|
||
elseif part:IsA("ParticleEmitter") then
|
||
part.Color = ColorSequence.new(color, Color3.new(1, 1, 1))
|
||
end
|
||
end
|
||
|
||
local pivot = template:GetPivot()
|
||
local boxCFrame, boxSize = template:GetBoundingBox()
|
||
local boxBottom = pivot:PointToObjectSpace(Vector3.new(
|
||
boxCFrame.Position.X,
|
||
boxCFrame.Position.Y - boxSize.Y / 2,
|
||
boxCFrame.Position.Z
|
||
)).Y
|
||
model:PivotTo(baseCF * CFrame.new(0, -boxBottom, 0))
|
||
model.Parent = parent
|
||
return model
|
||
end
|
||
|
||
local function portal(baseCF, title, color, worldId, locked)
|
||
-- Все порталы, и в лобби, и возвратные в мирах, используют модель автора из ServerStorage.
|
||
do
|
||
local model = Builder.portalModel(baseCF, color, "PortalModel_" .. worldId, map)
|
||
if model then
|
||
-- Этот невидимый якорь сохраняет ProximityPrompt и подпись мира.
|
||
local disc = P({
|
||
Name = "Portal_" .. worldId,
|
||
Size = V(1, 1, 1),
|
||
CFrame = baseCF * CFrame.new(0, 10, 0),
|
||
Transparency = 1,
|
||
CanCollide = false,
|
||
CanQuery = false,
|
||
CanTouch = false,
|
||
})
|
||
local pe = Instance.new("ParticleEmitter")
|
||
pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1))
|
||
pe.LightEmission = 1
|
||
pe.Rate = 25
|
||
pe.Lifetime = NumberRange.new(1, 1.8)
|
||
pe.Speed = NumberRange.new(0.5, 2)
|
||
pe.SpreadAngle = Vector2.new(180, 180)
|
||
pe.Size = NumberSequence.new(0.5, 0)
|
||
pe.Transparency = NumberSequence.new(0.2, 1)
|
||
pe.Parent = disc
|
||
billboard(disc, title, color:Lerp(Color3.new(1, 1, 1), 0.4), 7, 200)
|
||
if locked then
|
||
billboard(disc, "🔒", Color3.new(1, 1, 1), 0, 120)
|
||
end
|
||
local pp = prompt(disc, locked and "Посмотреть" or "Перейти", title, "Portal", 14)
|
||
pp:SetAttribute("World", worldId)
|
||
return disc
|
||
end
|
||
end
|
||
|
||
local center = baseCF * CFrame.new(0, 10, 0)
|
||
P({ Size = V(17, 1, 9), CFrame = baseCF * CFrame.new(0, 0.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(95, 100, 115) })
|
||
P({ Size = V(14, 1, 7), CFrame = baseCF * CFrame.new(0, 1.5, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(110, 115, 130) })
|
||
local R, n = 7, 20
|
||
for i = 0, n - 1 do
|
||
local a = (i + 0.5) / n * math.pi * 2
|
||
P({
|
||
Size = V(2 * math.pi * R / n + 0.4, 1.7, 1.7),
|
||
CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R, 0),
|
||
Material = Enum.Material.Slate,
|
||
Color = Color3.fromRGB(80, 85, 100),
|
||
})
|
||
if i % 2 == 0 then
|
||
P({
|
||
Size = V(0.6, 0.6, 1.9),
|
||
CFrame = center * CFrame.Angles(0, 0, a) * CFrame.new(0, R + 0.95, 0),
|
||
Material = Enum.Material.Neon,
|
||
Color = color,
|
||
})
|
||
end
|
||
end
|
||
local disc = P({
|
||
Name = "Portal_" .. worldId,
|
||
Shape = Enum.PartType.Cylinder,
|
||
Size = V(0.3, 2 * R - 1, 2 * R - 1),
|
||
CFrame = center * CFrame.Angles(0, math.rad(90), 0),
|
||
Material = Enum.Material.Neon,
|
||
Color = color,
|
||
Transparency = 0.3,
|
||
CanCollide = false,
|
||
})
|
||
local pe = Instance.new("ParticleEmitter")
|
||
pe.Color = ColorSequence.new(color, Color3.new(1, 1, 1))
|
||
pe.LightEmission = 1
|
||
pe.Rate = 25
|
||
pe.Lifetime = NumberRange.new(1, 1.8)
|
||
pe.Speed = NumberRange.new(0.5, 2)
|
||
pe.SpreadAngle = Vector2.new(180, 180)
|
||
pe.Size = NumberSequence.new(0.5, 0)
|
||
pe.Transparency = NumberSequence.new(0.2, 1)
|
||
pe.Parent = disc
|
||
billboard(disc, title, color:Lerp(Color3.new(1, 1, 1), 0.4), 10, 250)
|
||
if locked then
|
||
billboard(disc, "🔒", Color3.new(1, 1, 1), 0, 120)
|
||
end
|
||
local pp = prompt(disc, locked and "Посмотреть" or "Перейти", title, "Portal", 14)
|
||
pp:SetAttribute("World", worldId)
|
||
return disc
|
||
end
|
||
|
||
local function banner(pos, color, icon, text)
|
||
local look = CFrame.lookAt(pos, V(0, pos.Y, 0)) -- смотрит в центр лобби
|
||
vcyl(pos + V(0, 8, 0), 16, 0.7, { Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal })
|
||
ball(pos + V(0, 16.3, 0), 1.2, { Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal })
|
||
P({ Size = V(5.2, 0.4, 0.4), CFrame = look * CFrame.new(0, 15, -0.6), Color = Color3.fromRGB(60, 60, 65), Material = Enum.Material.Metal })
|
||
local flag = P({ Size = V(4.6, 8, 0.25), CFrame = look * CFrame.new(0, 10.8, -0.6), Color = color, Material = Enum.Material.Fabric, CanCollide = false })
|
||
P({ Size = V(4.6, 0.5, 0.3), CFrame = look * CFrame.new(0, 6.6, -0.6), Color = Color3.fromRGB(255, 200, 60), Material = Enum.Material.Metal })
|
||
local label = icon .. "\n" .. text
|
||
surfaceText(flag, Enum.NormalId.Front, label, Color3.new(1, 1, 1))
|
||
surfaceText(flag, Enum.NormalId.Back, label, Color3.new(1, 1, 1))
|
||
end
|
||
|
||
local function arch(cf, span, height, title, color)
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
P({ Size = V(4, height, 4), CFrame = cf * CFrame.new(s * span / 2, height / 2, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) })
|
||
P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, height + 0.6, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 195, 60) })
|
||
P({ Size = V(5, 1.2, 5), CFrame = cf * CFrame.new(s * span / 2, 0.6, 0), Material = Enum.Material.Slate, Color = Color3.fromRGB(150, 145, 140) })
|
||
end
|
||
local beam = P({ Size = V(span + 6, 6, 2.5), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(60, 85, 140) })
|
||
P({ Size = V(span + 7, 7, 2), CFrame = cf * CFrame.new(0, height + 4.2, 0), Material = Enum.Material.Neon, Color = color })
|
||
surfaceText(beam, Enum.NormalId.Front, title, Color3.fromRGB(255, 230, 120))
|
||
surfaceText(beam, Enum.NormalId.Back, title, Color3.fromRGB(255, 230, 120))
|
||
end
|
||
|
||
---------------------------------------------------------------- сборка карты
|
||
|
||
function Builder.build()
|
||
rng = Random.new(7)
|
||
map = Instance.new("Folder")
|
||
map.Name = "FishingMap"
|
||
local zonesFolder = Instance.new("Folder")
|
||
zonesFolder.Name = "FishingZones"
|
||
zonesFolder.Parent = map
|
||
local world1Prebuilt = Workspace:FindFirstChild("World1Map")
|
||
|
||
---------------------------------------------------------------- ЛОББИ
|
||
|
||
P({ Shape = Enum.PartType.Cylinder, Size = V(1, 170, 170), CFrame = CFrame.new(0, 0.5, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Cobblestone, Color = Color3.fromRGB(190, 180, 165) })
|
||
P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 74, 74), CFrame = CFrame.new(0, 0.52, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Marble, Color = Color3.fromRGB(232, 226, 214) })
|
||
P({ Shape = Enum.PartType.Cylinder, Size = V(1.04, 78, 78), CFrame = CFrame.new(0, 0.51, 0) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.SmoothPlastic, Color = Color3.fromRGB(60, 120, 190) })
|
||
-- дорожки-лучи к лавкам и порталам
|
||
for _, a in ipairs({ 0, 90, 180, 270 }) do
|
||
local r = math.rad(a)
|
||
P({ Size = V(10, 1.0, 48), CFrame = CFrame.new(math.cos(r) * 60, 0.52, math.sin(r) * 60) * CFrame.Angles(0, -r + math.pi / 2, 0), Material = Enum.Material.Marble, Color = Color3.fromRGB(225, 218, 205) })
|
||
end
|
||
|
||
marker("LobbySpawn", CFrame.new(0, FLOOR + 2, 57)) -- на дорожке за табличкой «Как играть»: сначала она, дальше портал в Мир 1
|
||
|
||
-- фонтан со статуей золотой рыбы
|
||
vcyl(V(0, FLOOR + 1, 0), 2, 24, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) })
|
||
vcyl(V(0, FLOOR + 1.6, 0), 1.0, 21, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 })
|
||
vcyl(V(0, FLOOR + 4, 0), 6, 3, { Material = Enum.Material.Slate, Color = Color3.fromRGB(190, 185, 175) })
|
||
local bowl = vcyl(V(0, FLOOR + 7.3, 0), 1, 9, { Material = Enum.Material.Slate, Color = Color3.fromRGB(205, 200, 190) })
|
||
vcyl(V(0, FLOOR + 7.75, 0), 0.2, 8, { Material = Enum.Material.Glass, Color = Color3.fromRGB(60, 165, 225), Transparency = 0.2 })
|
||
do
|
||
local statue = Models.buildFish("Gold", "Golden", 3.2, true)
|
||
statue:PivotTo(CFrame.new(0, FLOOR + 12, 0) * CFrame.Angles(0, math.rad(30), math.rad(40)))
|
||
statue.Parent = map
|
||
local sp = Instance.new("ParticleEmitter")
|
||
sp.Texture = "rbxasset://textures/particles/sparkles_main.dds"
|
||
sp.Rate = 12
|
||
sp.LightEmission = 1
|
||
sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90))
|
||
sp.Size = NumberSequence.new(0.6, 0)
|
||
sp.Lifetime = NumberRange.new(1, 1.5)
|
||
sp.SpreadAngle = Vector2.new(180, 180)
|
||
sp.Speed = NumberRange.new(1, 2)
|
||
sp.Parent = statue.PrimaryPart
|
||
-- струи воды
|
||
local att = Instance.new("Attachment")
|
||
att.Position = V(0.6, 0, 0) -- у повёрнутого цилиндра ось X смотрит вверх
|
||
att.Orientation = V(0, 0, -90) -- направить струю вверх
|
||
att.Parent = bowl
|
||
local water = Instance.new("ParticleEmitter")
|
||
water.Color = ColorSequence.new(Color3.fromRGB(200, 235, 255))
|
||
water.Transparency = NumberSequence.new(0.3, 1)
|
||
water.Size = NumberSequence.new(0.6, 1.2)
|
||
water.Rate = 60
|
||
water.Lifetime = NumberRange.new(1.2, 1.5)
|
||
water.Speed = NumberRange.new(10, 12)
|
||
water.SpreadAngle = Vector2.new(25, 25)
|
||
water.Acceleration = V(0, -25, 0)
|
||
water.Parent = att
|
||
end
|
||
-- скамейки по внешнему краю площади, между порталами, лицом к фонтану
|
||
for _, deg in ipairs({ 45, 135, 225, 315 }) do
|
||
local a = math.rad(deg)
|
||
for _, side in ipairs({ -1, 1 }) do
|
||
local b = a + side * math.rad(9)
|
||
bench(CFrame.lookAt(V(math.cos(b) * 34, FLOOR, math.sin(b) * 34), V(0, FLOOR, 0)))
|
||
end
|
||
end
|
||
|
||
-- фонари по кругу (у спавна — за спиной игрока, чтобы не закрывали табличку и сундук)
|
||
for i = 0, 7 do
|
||
local deg = i * 45 + 22.5
|
||
if deg ~= 67.5 and deg ~= 112.5 then
|
||
local a = math.rad(deg)
|
||
lamp(V(math.cos(a) * 40, FLOOR, math.sin(a) * 40))
|
||
end
|
||
end
|
||
lamp(V(7, FLOOR, 48)) -- левый фонарь стоит за табличкой «Как играть»
|
||
|
||
-- клумбы с деревьями
|
||
for _, deg in ipairs({ 225, 315 }) do
|
||
local a = math.rad(deg)
|
||
local p = V(math.cos(a) * 58, FLOOR, math.sin(a) * 58)
|
||
vcyl(p + V(0, 1, 0), 2, 12, { Material = Enum.Material.Brick, Color = Color3.fromRGB(150, 95, 70) })
|
||
vcyl(p + V(0, 1.6, 0), 1.0, 11, { Material = Enum.Material.Grass, Color = Color3.fromRGB(70, 140, 60) })
|
||
tree(p + V(0, 2, 0), "round")
|
||
for j = 1, 5 do
|
||
local b = rng:NextNumber(0, math.pi * 2)
|
||
ball(p + V(math.cos(b) * 4, 2.4, math.sin(b) * 4), 0.8, { Color = ({ Color3.fromRGB(255, 110, 140), Color3.fromRGB(255, 220, 80), Color3.fromRGB(170, 120, 255) })[rng:NextInteger(1, 3)] })
|
||
end
|
||
end
|
||
|
||
-- баннеры
|
||
local bannerData = {
|
||
{ 15, Color3.fromRGB(40, 110, 200), "🎣", "Лови!" },
|
||
{ 70, Color3.fromRGB(240, 140, 40), "🐟", "Продавай" },
|
||
{ 110, Color3.fromRGB(40, 110, 200), "⭐", "Качайся" },
|
||
{ 165, Color3.fromRGB(240, 140, 40), "🍀", "Удача" },
|
||
{ 205, Color3.fromRGB(40, 110, 200), "🏆", "Рекорды" },
|
||
{ 335, Color3.fromRGB(240, 140, 40), "💎", "Мифика" },
|
||
}
|
||
for _, b in ipairs(bannerData) do
|
||
local a = math.rad(b[1])
|
||
banner(V(math.cos(a) * 74, FLOOR, math.sin(a) * 74), b[2], b[3], b[4])
|
||
end
|
||
|
||
-- высокий скальный контур закрывает горизонт и удерживает игроков в лобби
|
||
lobbyCliffs()
|
||
lobbyTrees()
|
||
lobbyRockPlants()
|
||
lobbyHills()
|
||
|
||
-- магазин (запад) и скупка (восток)
|
||
stall(CFrame.lookAt(V(-62, FLOOR, 0), V(0, FLOOR, 0)), {
|
||
title = "🎣 УДОЧКИ И СНАРЯЖЕНИЕ",
|
||
titleColor = Color3.fromRGB(255, 230, 120),
|
||
wall = Color3.fromRGB(185, 130, 85),
|
||
stripeA = Color3.fromRGB(215, 55, 55),
|
||
stripeB = Color3.fromRGB(245, 240, 230),
|
||
glow = Color3.fromRGB(255, 170, 60),
|
||
action = "Shop",
|
||
promptText = "Открыть магазин",
|
||
promptObject = "Магазин",
|
||
npcName = "Продавец Михалыч",
|
||
npcColors = { skin = Color3.fromRGB(234, 184, 146), shirt = Color3.fromRGB(200, 60, 50), pants = Color3.fromRGB(60, 70, 100), hat = Color3.fromRGB(90, 110, 60) },
|
||
decor = function(at)
|
||
-- витрина удочек на задней стене
|
||
for i, rod in ipairs(Config.Rods) do
|
||
local x = -8 + (i - 1) * 4
|
||
local m = Models.buildRod(rod.id, 0, true)
|
||
m:PivotTo(at(x, 3, 7) * CFrame.Angles(math.rad(80), 0, 0))
|
||
m.Parent = map
|
||
local plaque = P({ Size = V(3.6, 1.6, 0.2), CFrame = at(x, 11.7, 7.4), Material = Enum.Material.Wood, Color = Color3.fromRGB(60, 40, 25) })
|
||
surfaceText(plaque, Enum.NormalId.Front, rod.name .. "\n" .. (rod.price > 0 and (rod.price .. " 💰") or "бесплатно"), Color3.fromRGB(255, 235, 180))
|
||
end
|
||
end,
|
||
})
|
||
|
||
stall(CFrame.lookAt(V(62, FLOOR, 0), V(0, FLOOR, 0)), {
|
||
title = "💰 СКУПКА РЫБЫ",
|
||
titleColor = Color3.fromRGB(150, 255, 160),
|
||
wall = Color3.fromRGB(110, 150, 175),
|
||
stripeA = Color3.fromRGB(50, 150, 80),
|
||
stripeB = Color3.fromRGB(245, 240, 230),
|
||
glow = Color3.fromRGB(80, 230, 120),
|
||
action = "Sell",
|
||
promptText = "Продать всю рыбу",
|
||
promptObject = "Скупка",
|
||
npcName = "Скупщица Зина",
|
||
npcColors = { skin = Color3.fromRGB(240, 195, 160), shirt = Color3.fromRGB(60, 120, 170), pants = Color3.fromRGB(50, 50, 60), hat = Color3.fromRGB(230, 230, 230) },
|
||
decor = function(at)
|
||
-- лёд с рыбой на прилавке
|
||
P({ Size = V(10, 0.4, 3), CFrame = at(-3, 5.7, -4), Material = Enum.Material.Glass, Color = Color3.fromRGB(200, 235, 255), Transparency = 0.2 })
|
||
for i, id in ipairs({ "Karas", "Okun", "Shuka" }) do
|
||
local f = Models.buildFish(id, nil, 0.9, true)
|
||
f:PivotTo(at(-6.5 + i * 2.5, 6.2, -4) * CFrame.Angles(math.rad(90), 0, math.rad(90)))
|
||
f.Parent = map
|
||
end
|
||
-- весы
|
||
P({ Size = V(2, 0.5, 2), CFrame = at(6, 5.75, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) })
|
||
P({ Size = V(0.3, 1.4, 0.3), CFrame = at(6, 6.7, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(60, 60, 65) })
|
||
P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 2.4, 2.4), CFrame = at(6, 7.45, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(200, 200, 205) })
|
||
-- ящики с уловом
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
P({ Size = V(3, 2, 3), CFrame = at(s * 14.5, 2, 2), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(150, 110, 70) })
|
||
local f = Models.buildFish(s < 0 and "Lesh" or "Sudak", nil, 0.7, true)
|
||
f:PivotTo(at(s * 14.5, 3.3, 2) * CFrame.Angles(math.rad(90), 0, 0))
|
||
f.Parent = map
|
||
end
|
||
end,
|
||
})
|
||
|
||
-- арка с названием
|
||
arch(CFrame.lookAt(V(0, FLOOR, -66), V(0, FLOOR, 0)), 84, 24, "🎣 " .. string.upper(Config.GameName) .. " 🎣", Color3.fromRGB(255, 190, 60))
|
||
|
||
-- порталы по кругу у фонтана, лицом наружу; первый (бесплатный) мир — прямо перед точкой появления
|
||
local PORTAL_R = 19
|
||
for i, w in ipairs(Config.Worlds) do
|
||
local title = w.icon .. " " .. w.name .. (w.level > 1 and (" (ур. " .. w.level .. ")") or "")
|
||
local a = math.rad(90 - (i - 1) * 90) -- 90° = сторона спавна (+Z)
|
||
local pos = V(math.cos(a) * PORTAL_R, FLOOR, math.sin(a) * PORTAL_R)
|
||
local disc = portal(CFrame.lookAt(pos, V(pos.X * 2, FLOOR, pos.Z * 2)), title, w.color, w.id, w.soon)
|
||
if i == 1 then
|
||
disc:SetAttribute("GuideTarget", "Portal")
|
||
marker("GuidePortal", CFrame.new(pos.X * 1.3, FLOOR, pos.Z * 1.3)) -- точка перед порталом для линии-подсказки
|
||
end
|
||
end
|
||
|
||
-- невидимая стена по кругу: из лобби не уйти
|
||
for deg = 0, 359, 5 do
|
||
local a = math.rad(deg)
|
||
local p = V(math.cos(a) * 86, 30, math.sin(a) * 86)
|
||
P({ Size = V(8, 60, 2), CFrame = CFrame.lookAt(p, V(0, 30, 0)), Transparency = 1, CanQuery = false })
|
||
end
|
||
|
||
-- донат-лавки
|
||
stall(CFrame.lookAt(V(41, FLOOR, 41), V(0, FLOOR, 0)), {
|
||
title = "💎 ПРЕМИУМ",
|
||
titleColor = Color3.fromRGB(255, 220, 120),
|
||
wall = Color3.fromRGB(120, 70, 170),
|
||
stripeA = Color3.fromRGB(255, 200, 60),
|
||
stripeB = Color3.fromRGB(150, 80, 210),
|
||
glow = Color3.fromRGB(255, 200, 60),
|
||
action = "RobuxPasses",
|
||
promptText = "Открыть",
|
||
promptObject = "Премиум-пропуска",
|
||
npcName = "Барон Злотов",
|
||
npcColors = { skin = Color3.fromRGB(230, 185, 150), shirt = Color3.fromRGB(110, 40, 140), pants = Color3.fromRGB(30, 30, 40), hat = Color3.fromRGB(255, 200, 60) },
|
||
decor = function(at)
|
||
-- сундук с самоцветами
|
||
P({ Size = V(4, 2, 2.5), CFrame = at(-5, 6.5, -4), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(120, 75, 40) })
|
||
P({ Size = V(4.2, 0.4, 2.7), CFrame = at(-5, 7.6, -4), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) })
|
||
for i, c in ipairs({ Color3.fromRGB(255, 60, 90), Color3.fromRGB(80, 200, 255), Color3.fromRGB(120, 255, 120), Color3.fromRGB(200, 100, 255) }) do
|
||
P({ Size = V(0.7, 0.7, 0.7), CFrame = at(-6.5 + i * 0.75, 8.1, -4) * CFrame.Angles(0.6, i, 0.6), Material = Enum.Material.Neon, Color = c })
|
||
end
|
||
P({ Size = V(3, 4, 0.3), CFrame = at(5, 7.5, -4.8), Material = Enum.Material.Neon, Color = Color3.fromRGB(255, 200, 60) })
|
||
end,
|
||
})
|
||
stall(CFrame.lookAt(V(-41, FLOOR, 41), V(0, FLOOR, 0)), {
|
||
title = "🪙 СОКРОВИЩНИЦА",
|
||
titleColor = Color3.fromRGB(255, 235, 140),
|
||
wall = Color3.fromRGB(200, 160, 70),
|
||
stripeA = Color3.fromRGB(230, 180, 40),
|
||
stripeB = Color3.fromRGB(255, 250, 230),
|
||
glow = Color3.fromRGB(255, 220, 90),
|
||
action = "RobuxProducts",
|
||
promptText = "Открыть",
|
||
promptObject = "Наборы монет",
|
||
npcName = "Купчиха Злата",
|
||
npcColors = { skin = Color3.fromRGB(240, 200, 165), shirt = Color3.fromRGB(220, 170, 50), pants = Color3.fromRGB(90, 50, 30), hat = Color3.fromRGB(180, 40, 40) },
|
||
decor = function(at)
|
||
-- горки монет
|
||
for i = 0, 4 do
|
||
for j = 0, 3 - (i % 3) do
|
||
P({ Shape = Enum.PartType.Cylinder, Size = V(0.2, 0.9, 0.9), CFrame = at(-7 + i * 1.2, 5.6 + j * 0.2, -4) * CFrame.Angles(0, 0, math.rad(90)), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 205, 60) })
|
||
end
|
||
end
|
||
for _, s in ipairs({ -1, 1 }) do
|
||
ball(at(s * 14.5, 2.2, 2).Position, 2.6, { Color = Color3.fromRGB(190, 160, 110), Material = Enum.Material.Fabric })
|
||
ball(at(s * 14.5, 3.5, 2).Position, 1.2, { Color = Color3.fromRGB(255, 205, 60), Material = Enum.Material.Metal })
|
||
end
|
||
end,
|
||
})
|
||
|
||
-- сундук с ежедневной наградой
|
||
do
|
||
local cf = CFrame.lookAt(V(14, FLOOR, 34), V(0, FLOOR, 50))
|
||
local base = P({ Size = V(5, 3, 3.2), CFrame = cf * CFrame.new(0, 1.5, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(140, 90, 50) })
|
||
P({ Shape = Enum.PartType.Cylinder, Size = V(5, 3.2, 3.2), CFrame = cf * CFrame.new(0, 3, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(160, 105, 60) })
|
||
for _, x in ipairs({ -1.8, 1.8 }) do
|
||
P({ Size = V(0.4, 4.9, 3.4), CFrame = cf * CFrame.new(x, 2.3, 0), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 200, 60) })
|
||
end
|
||
P({ Size = V(0.9, 1.1, 0.3), CFrame = cf * CFrame.new(0, 2.8, -1.7), Material = Enum.Material.Metal, Color = Color3.fromRGB(255, 220, 90) })
|
||
local sp = Instance.new("ParticleEmitter")
|
||
sp.Texture = "rbxasset://textures/particles/sparkles_main.dds"
|
||
sp.Rate = 8
|
||
sp.LightEmission = 1
|
||
sp.Color = ColorSequence.new(Color3.fromRGB(255, 220, 90))
|
||
sp.Size = NumberSequence.new(0.5, 0)
|
||
sp.Parent = base
|
||
billboard(base, "🎁 Ежедневная награда", Color3.fromRGB(255, 220, 120), 5, 260)
|
||
prompt(base, "Забрать", "Сундук", "Daily", 12)
|
||
end
|
||
|
||
-- табличка «Как играть»
|
||
do
|
||
-- слева от дорожки за точкой появления, лицом к камере игрока; фонарь — за табличкой
|
||
local pos = V(-12, FLOOR, 48)
|
||
local cf = CFrame.lookAt(pos, V(0, FLOOR, 64))
|
||
lamp((cf * CFrame.new(0, 0, 2.5)).Position)
|
||
marker("GuideBoard", cf * CFrame.new(0, 0, -6)) -- перед табличкой, для линии-подсказки
|
||
for _, x in ipairs({ -6.5, 6.5 }) do
|
||
P({ Size = V(0.8, 9, 0.8), CFrame = cf * CFrame.new(x, 4.5, 0.3), Material = Enum.Material.Wood, Color = Color3.fromRGB(90, 60, 40) })
|
||
end
|
||
local board = P({ Size = V(14, 8, 0.5), CFrame = cf * CFrame.new(0, 6, 0), Material = Enum.Material.WoodPlanks, Color = Color3.fromRGB(70, 48, 32) })
|
||
board:SetAttribute("GuideTarget", "Board") -- подсвечивается на шаге обучения
|
||
surfaceText(board, Enum.NormalId.Front,
|
||
"<font color=\"#FFD866\">КАК ИГРАТЬ</font>\n1. Портал «Мир 1» или кнопка 🌍 Миры\n2. Удочка — клавиша 1, у воды зажми ЛКМ и отпусти\n3. Клюёт → кликай в зелёную зону\n4. 🎒 Сумка — B, 📜 Задания — Q\n5. Собирай коллекцию — получай награды!",
|
||
Color3.fromRGB(255, 245, 225), { TextXAlignment = Enum.TextXAlignment.Left })
|
||
end
|
||
|
||
---------------------------------------------------------------- МИР 1: ТИХОЕ ОЗЕРО
|
||
do
|
||
-- отдельно собранное раньше «Тихое озеро» (Workspace.World1Map) переносим в карту, иначе строим заново
|
||
local w1map = world1Prebuilt or World1Builder.build(map, Builder.portalModel)
|
||
w1map.Parent = map
|
||
-- 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
|
||
]]></ProtectedString></Properties></Item>
|
||
</roblox>
|