234
This commit is contained in:
1 parent
1ff2a46e1e
commit
e1459c9834
8 files changed
+994467
-5717
No files matched your search
@@ -329,6 +329,149 @@ local function lobbyRockPlants()
|
||||
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)
|
||||
@@ -770,6 +913,7 @@ function Builder.build()
|
||||
lobbyCliffs()
|
||||
lobbyTrees()
|
||||
lobbyRockPlants()
|
||||
lobbyHills()
|
||||
|
||||
-- магазин (запад) и скупка (восток)
|
||||
stall(CFrame.lookAt(V(-62, FLOOR, 0), V(0, FLOOR, 0)), {
|
||||
|
||||
Reference in new issue
Block a user