версия от гпт
This commit is contained in:
1 parent
1d5300eb96
commit
dc6c45409d
8 files changed
+2328
-972
No files matched your search
@@ -1539,21 +1539,109 @@ local lastWorldId = "none"
|
||||
local terrain = workspace.Terrain
|
||||
local defaultWater = Color3.fromRGB(10, 55, 70)
|
||||
|
||||
-- Исходный свет восстанавливается при выходе из Тихого озера.
|
||||
local lakeDefaults
|
||||
|
||||
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
|
||||
local lake = world and world.id == "World1"
|
||||
local atm = Lighting:FindFirstChildOfClass("Atmosphere")
|
||||
local bloom = Lighting:FindFirstChildOfClass("BloomEffect")
|
||||
local grade = Lighting:FindFirstChildOfClass("ColorCorrectionEffect")
|
||||
local rays = Lighting:FindFirstChildOfClass("SunRaysEffect")
|
||||
if not lakeDefaults then
|
||||
lakeDefaults = {
|
||||
ambient = Lighting.Ambient, outdoor = Lighting.OutdoorAmbient,
|
||||
brightness = Lighting.Brightness, exposure = Lighting.ExposureCompensation,
|
||||
latitude = Lighting.GeographicLatitude, reflectance = terrain.WaterReflectance,
|
||||
haze = atm and atm.Haze or 0.6, decay = atm and atm.Decay or Color3.fromRGB(110, 140, 175),
|
||||
bloom = bloom and bloom.Intensity or 0.5, threshold = bloom and bloom.Threshold or 1.4,
|
||||
tint = grade and grade.TintColor or Color3.new(1, 1, 1),
|
||||
contrast = grade and grade.Contrast or 0.06, rays = rays and rays.Intensity or 0.05,
|
||||
}
|
||||
end
|
||||
local base = lakeDefaults
|
||||
TweenService:Create(Lighting, TweenInfo.new(2), {
|
||||
ClockTime = (world and world.clock) or 14.5,
|
||||
Ambient = lake and Color3.fromRGB(108, 100, 85) or base.ambient,
|
||||
OutdoorAmbient = lake and Color3.fromRGB(157, 160, 144) or base.outdoor,
|
||||
Brightness = lake and 2.5 or base.brightness,
|
||||
ExposureCompensation = lake and 0.08 or base.exposure,
|
||||
GeographicLatitude = lake and 35 or base.latitude,
|
||||
}):Play()
|
||||
terrain.WaterColor = (world and world.water) or defaultWater
|
||||
terrain.WaterTransparency = (world and world.waterTransparency) or 0.15
|
||||
terrain.WaterReflectance = lake and 0.12 or base.reflectance
|
||||
if atm then
|
||||
local frost = world and world.id == "World3"
|
||||
TweenService:Create(atm, TweenInfo.new(2), {
|
||||
Density = frost and 0.38 or 0.25,
|
||||
Color = frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232),
|
||||
Density = lake and 0.23 or (frost and 0.38 or 0.25),
|
||||
Color = lake and Color3.fromRGB(205, 222, 232) or (frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232)),
|
||||
Decay = lake and Color3.fromRGB(155, 173, 177) or base.decay,
|
||||
Haze = lake and 1 or base.haze,
|
||||
}):Play()
|
||||
end
|
||||
if bloom then TweenService:Create(bloom, TweenInfo.new(2), { Intensity = lake and 0.25 or base.bloom, Threshold = lake and 1.5 or base.threshold }):Play() end
|
||||
if grade then
|
||||
TweenService:Create(grade, TweenInfo.new(2), {
|
||||
TintColor = lake and Color3.fromRGB(255, 242, 220) or base.tint,
|
||||
Contrast = lake and 0.08 or base.contrast,
|
||||
}):Play()
|
||||
end
|
||||
if rays then rays.Intensity = lake and 0.06 or base.rays end
|
||||
snow.Rate = (world and world.id == "World3") and 140 or 0
|
||||
end
|
||||
|
||||
-- Восемь силуэтов обновляются локально 20 раз в секунду и только рядом с озером.
|
||||
local fishScenery, ambientFish, waterfallRipples = nil, {}, {}
|
||||
local fishElapsed = 0
|
||||
RunService.Heartbeat:Connect(function(dt)
|
||||
fishElapsed += dt
|
||||
if fishElapsed < 0.05 then return end
|
||||
fishElapsed = 0
|
||||
local world = currentWorld()
|
||||
if not world or world.id ~= "World1" then return end
|
||||
local root = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
|
||||
if not root or (root.Position - world.center).Magnitude > 180 then return end
|
||||
if not fishScenery or not fishScenery.Parent or #ambientFish == 0 then
|
||||
local map = workspace:FindFirstChild("FishingMap")
|
||||
fishScenery = map and map:FindFirstChild("World1Scenery")
|
||||
ambientFish, waterfallRipples = {}, {}
|
||||
if fishScenery then
|
||||
for _, child in ipairs(fishScenery:GetChildren()) do
|
||||
if child:IsA("Model") and child.Name == "AmbientFish" then table.insert(ambientFish, child) end
|
||||
if child:IsA("Model") and child.Name == "WaterfallRipple" then table.insert(waterfallRipples, child) end
|
||||
end
|
||||
end
|
||||
end
|
||||
local now = workspace:GetServerTimeNow()
|
||||
for _, ripple in ipairs(waterfallRipples) do
|
||||
if ripple.Parent then
|
||||
local center = ripple:GetAttribute("RippleCenter")
|
||||
local phase = (now * 0.3 + ripple:GetAttribute("RipplePhase")) % 1
|
||||
local radius = 2 + phase * 8
|
||||
for _, segment in ipairs(ripple:GetChildren()) do
|
||||
local index = segment:GetAttribute("RippleSegment")
|
||||
local a, b = index * math.pi / 6, (index + 1) * math.pi / 6
|
||||
local p = center + Vector3.new(math.cos(a) * radius, 0, math.sin(a) * radius)
|
||||
local q = center + Vector3.new(math.cos(b) * radius, 0, math.sin(b) * radius)
|
||||
segment.Size = Vector3.new((q - p).Magnitude, 0.07, 0.07)
|
||||
segment.CFrame = CFrame.lookAt((p + q) / 2, q) * CFrame.Angles(0, math.pi / 2, 0)
|
||||
segment.Transparency = 0.6 + phase * 0.4
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, fish in ipairs(ambientFish) do
|
||||
if fish.Parent then
|
||||
local center, radius = fish:GetAttribute("SwimCenter"), fish:GetAttribute("SwimRadius")
|
||||
local angle = now * fish:GetAttribute("SwimSpeed") + fish:GetAttribute("SwimPhase")
|
||||
local pos = center + Vector3.new(math.cos(angle) * radius, 0, math.sin(angle) * radius * 0.65)
|
||||
local direction = Vector3.new(-math.sin(angle), 0, math.cos(angle) * 0.65)
|
||||
fish:PivotTo(CFrame.lookAt(pos, pos + direction))
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
task.spawn(function()
|
||||
while true do
|
||||
local w = currentWorld()
|
||||
|
||||
Reference in new issue
Block a user