This commit is contained in:
Leshyi committed 2026-11-03 13:45:36 +03:00
1 parent 9682ed0987
commit eade0cd2ae
10 files changed
+1532033 -166651

No files matched your search

@@ -1536,18 +1536,58 @@ local snow = new("ParticleEmitter", {
})
local lastWorldId = "none"
local terrain = workspace.Terrain
local defaultWater = Color3.fromRGB(10, 55, 70)
-- то, что мир может поменять под себя (вода, оттенок, цвета травы и песка); остальные миры — как в MapBuilder
local DEFAULT_LOOK = { waterTransparency = 0.15, waveSize = 0.3, tint = Color3.new(1, 1, 1) }
-- то, что мир может поменять под себя (оттенок, цвета травы и песка); вода не трогается — она из свойств Terrain
local DEFAULT_LOOK = { tint = Color3.new(1, 1, 1) }
local defaultTerrainColors = nil
-- world.look: свет и эффекты мира; при выходе свойства возвращаются к тем, что были до первого входа
local lookTargets = {
lighting = function() return Lighting end,
atmosphere = function() return Lighting:FindFirstChildOfClass("Atmosphere") end,
color = function() return Lighting:FindFirstChildOfClass("ColorCorrectionEffect") end,
bloom = function() return Lighting:FindFirstChildOfClass("BloomEffect") end,
sunRays = function() return Lighting:FindFirstChildOfClass("SunRaysEffect") end,
dof = function()
return Lighting:FindFirstChildOfClass("DepthOfFieldEffect")
or new("DepthOfFieldEffect", { Enabled = false, Parent = Lighting })
end,
}
local lookDefaults = {}
local function applyLook(world)
-- исходные значения запоминаем до первой правки; эффект мог ещё не прийти с сервера, тогда в следующий раз
for _, w in ipairs(Config.Worlds) do
for section, props in pairs(w.look or {}) do
local obj = lookTargets[section] and lookTargets[section]()
if obj then
lookDefaults[section] = lookDefaults[section] or {}
for prop in pairs(props) do
if lookDefaults[section][prop] == nil then
lookDefaults[section][prop] = obj[prop]
end
end
end
end
end
local look = (world and world.look) or {}
for section, defaults in pairs(lookDefaults) do
local obj = lookTargets[section]()
if obj then
local goal = {}
for prop, def in pairs(defaults) do
local v = look[section] and look[section][prop]
if v == nil then v = def end
if typeof(v) == "boolean" then obj[prop] = v else goal[prop] = v end
end
TweenService:Create(obj, TweenInfo.new(2), goal):Play()
end
end
end
local function applyAmbience(world)
local clock = (world and world.clock) or 14.5
TweenService:Create(Lighting, TweenInfo.new(2), { ClockTime = clock }):Play()
terrain.WaterColor = (world and world.water) or defaultWater
terrain.WaterTransparency = (world and world.waterTransparency) or DEFAULT_LOOK.waterTransparency
terrain.WaterWaveSize = (world and world.waveSize) or DEFAULT_LOOK.waveSize
local cc = Lighting:FindFirstChildOfClass("ColorCorrectionEffect")
if cc then
TweenService:Create(cc, TweenInfo.new(2), { TintColor = (world and world.tint) or DEFAULT_LOOK.tint }):Play()
@@ -1555,7 +1595,7 @@ local function applyAmbience(world)
-- цвета материалов террейна общие для всей карты, поэтому меняем их только у себя и возвращаем при выходе
if not defaultTerrainColors then
defaultTerrainColors = {}
for _, name in ipairs({ "Snow", "Salt", "Mud", "Sand" }) do
for _, name in ipairs({ "Snow", "Salt", "Mud", "Sand", "Rock", "Slate" }) do
defaultTerrainColors[name] = terrain:GetMaterialColor(Enum.Material[name])
end
end
@@ -1571,6 +1611,7 @@ local function applyAmbience(world)
Color = frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232),
}):Play()
end
applyLook(world)
snow.Rate = (world and world.id == "World3") and 140 or 0
end