This commit is contained in:
listik committed 2026-11-03 23:22:03 +03:00
1 parent 1ff2a46e1e
commit e1459c9834
8 files changed
+994467 -5717

No files matched your search

+184 -3
View File
@@ -85,6 +85,36 @@ Config.Worlds = {
}
Config.WorldRadius = 260
-- лобби: те же поля внешнего вида, что у миров (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
@@ -3950,6 +3980,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)
@@ -4391,6 +4564,7 @@ function Builder.build()
lobbyCliffs()
lobbyTrees()
lobbyRockPlants()
lobbyHills()
-- магазин (запад) и скупка (восток)
stall(CFrame.lookAt(V(-62, FLOOR, 0), V(0, FLOOR, 0)), {
@@ -6802,12 +6976,16 @@ local lookTargets = {
return Lighting:FindFirstChildOfClass("DepthOfFieldEffect")
or new("DepthOfFieldEffect", { Enabled = false, Parent = Lighting })
end,
grading = function() return Lighting:FindFirstChildOfClass("ColorGradingEffect") end,
}
local lookDefaults = {}
-- лобби настраивается так же, как миры
local lookSources = table.clone(Config.Worlds)
table.insert(lookSources, Config.Lobby)
local function applyLook(world)
-- исходные значения запоминаем до первой правки; эффект мог ещё не прийти с сервера, тогда в следующий раз
for _, w in ipairs(Config.Worlds) do
for _, w in ipairs(lookSources) do
for section, props in pairs(w.look or {}) do
local obj = lookTargets[section] and lookTargets[section]()
if obj then
@@ -6828,7 +7006,9 @@ local function applyLook(world)
for prop, def in pairs(defaults) do
local v = look[section] and look[section][prop]
if v == nil then v = def end
if typeof(v) == "boolean" then obj[prop] = v else goal[prop] = v end
-- плавно меняются только числа и цвета; флаги и режимы (EnumItem) ставим сразу
local kind = typeof(v)
if kind == "number" or kind == "Color3" then goal[prop] = v else obj[prop] = v end
end
TweenService:Create(obj, TweenInfo.new(2), goal):Play()
end
@@ -6836,6 +7016,7 @@ local function applyLook(world)
end
local function applyAmbience(world)
world = world or Config.Lobby
local clock = (world and world.clock) or 14.5
TweenService:Create(Lighting, TweenInfo.new(2), { ClockTime = clock }):Play()
local cc = Lighting:FindFirstChildOfClass("ColorCorrectionEffect")
@@ -6845,7 +7026,7 @@ local function applyAmbience(world)
-- цвета материалов террейна общие для всей карты, поэтому меняем их только у себя и возвращаем при выходе
if not defaultTerrainColors then
defaultTerrainColors = {}
for _, name in ipairs({ "Snow", "Salt", "Mud", "Sand", "Rock", "Slate" }) do
for _, name in ipairs({ "Snow", "Salt", "Mud", "Sand", "Rock", "Slate", "Grass", "Ground" }) do
defaultTerrainColors[name] = terrain:GetMaterialColor(Enum.Material[name])
end
end