This commit is contained in:
listik committed 2026-11-04 00:01:19 +03:00
1 parent e1459c9834
commit b48d1f68f6
14 files changed
+51196 -45855

No files matched your search

@@ -1576,7 +1576,21 @@ local lookDefaults = {}
local lookSources = table.clone(Config.Worlds)
table.insert(lookSources, Config.Lobby)
local function applyLook(world)
-- смена света: плавно или сразу (за экраном загрузки)
local lookTweens = {}
local function setLook(obj, goal, instant)
if instant then
for prop, v in pairs(goal) do
obj[prop] = v
end
else
local tw = TweenService:Create(obj, TweenInfo.new(2), goal)
table.insert(lookTweens, tw)
tw:Play()
end
end
local function applyLook(world, instant)
-- исходные значения запоминаем до первой правки; эффект мог ещё не прийти с сервера, тогда в следующий раз
for _, w in ipairs(lookSources) do
for section, props in pairs(w.look or {}) do
@@ -1603,18 +1617,23 @@ local function applyLook(world)
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()
setLook(obj, goal, instant)
end
end
end
local function applyAmbience(world)
local function applyAmbience(world, instant)
-- прошлая плавная смена ещё может идти — она перебила бы новые значения
for _, tw in ipairs(lookTweens) do
tw:Cancel()
end
table.clear(lookTweens)
world = world or Config.Lobby
local clock = (world and world.clock) or 14.5
TweenService:Create(Lighting, TweenInfo.new(2), { ClockTime = clock }):Play()
setLook(Lighting, { ClockTime = clock }, instant)
local cc = Lighting:FindFirstChildOfClass("ColorCorrectionEffect")
if cc then
TweenService:Create(cc, TweenInfo.new(2), { TintColor = (world and world.tint) or DEFAULT_LOOK.tint }):Play()
setLook(cc, { TintColor = (world and world.tint) or DEFAULT_LOOK.tint }, instant)
end
-- цвета материалов террейна общие для всей карты, поэтому меняем их только у себя и возвращаем при выходе
if not defaultTerrainColors then
@@ -1630,12 +1649,12 @@ local function applyAmbience(world)
local atm = Lighting:FindFirstChildOfClass("Atmosphere")
if atm then
local frost = world and world.id == "World3"
TweenService:Create(atm, TweenInfo.new(2), {
setLook(atm, {
Density = frost and 0.38 or 0.25,
Color = frost and Color3.fromRGB(170, 200, 235) or Color3.fromRGB(200, 215, 232),
}):Play()
}, instant)
end
applyLook(world)
applyLook(world, instant)
snow.Rate = (world and world.id == "World3") and 140 or 0
end
@@ -1691,16 +1710,80 @@ do
end)
end
-- экран загрузки (ReplicatedFirst/Loading): при входе и телепорте свет локации ставится, пока он закрывает картинку
local loadingGui = player:WaitForChild("PlayerGui"):WaitForChild("LoadingScreen", 10)
local function loadingVisible()
return loadingGui ~= nil and loadingGui.Enabled
end
local function placeTitle(w)
return w and (w.icon .. " " .. w.name) or "🏠 Лобби"
end
local function enterWorld(w, instant)
lastWorldId = w and w.id or "lobby"
applyAmbience(w, instant)
if w then
-- название локации — когда экран загрузки уже ушёл
task.spawn(function()
while loadingVisible() do
task.wait(0.1)
end
notify(w.icon .. " " .. w.name, w.color)
end)
end
end
-- первое появление: ждём персонажа, ставим свет его локации сразу и отпускаем экран загрузки
task.spawn(function()
local char = player.Character or player.CharacterAdded:Wait()
char:WaitForChild("HumanoidRootPart", 30)
local w = currentWorld()
enterWorld(w, true)
if loadingGui then
loadingGui:SetAttribute("Title", placeTitle(w))
loadingGui:SetAttribute("Ready", true)
end
end)
-- телепорт: экран загрузки закрывает картинку, сервер переносит персонажа, свет новой локации ставится сразу
local teleportToken = 0
local function teleportLoading(targetId, delay)
teleportToken += 1
local token = teleportToken
local target = Config.Find(Config.Worlds, targetId)
if loadingGui then
local now = os.clock()
loadingGui:SetAttribute("Ready", false)
loadingGui:SetAttribute("StartAt", now)
loadingGui:SetAttribute("MinUntil", now + Config.Loading.teleport)
loadingGui:SetAttribute("Title", placeTitle(target))
loadingGui:SetAttribute("Visible", true)
end
task.spawn(function()
-- ждём, пока персонаж окажется в новой локации (или сдаёмся через пару секунд)
local deadline = os.clock() + delay + 3
local w
repeat
task.wait()
w = currentWorld()
until (w and w.id or "Lobby") == targetId or os.clock() > deadline or token ~= teleportToken
if token ~= teleportToken then
return
end
enterWorld(w, true)
if loadingGui then
loadingGui:SetAttribute("Ready", true)
end
end)
end
task.spawn(function()
while true do
local w = currentWorld()
local id = w and w.id or "lobby"
if id ~= lastWorldId then
lastWorldId = id
applyAmbience(w)
if w then
notify(w.icon .. " " .. w.name, w.color)
end
if id ~= lastWorldId and lastWorldId ~= "none" and not loadingVisible() then
enterWorld(w, false) -- без телепорта (например, после возрождения): плавно
end
local cam = workspace.CurrentCamera
if cam then
@@ -1785,10 +1868,11 @@ local function guideMarker(name)
return m and m.Position
end
-- объект цели подсвечивается голубым (атрибут GuideTarget ставит MapBuilder)
-- объект цели обводится мягким светящимся контуром (атрибут GuideTarget ставит MapBuilder);
-- Occluded: то, что стоит перед объектом (персонаж на мостике), не перекрашивается
local guideHighlight = new("Highlight", {
FillColor = Color3.fromRGB(70, 195, 255), OutlineColor = Color3.fromRGB(170, 235, 255),
DepthMode = Enum.HighlightDepthMode.AlwaysOnTop, Enabled = false, Parent = guideFolder,
FillColor = Color3.fromRGB(150, 225, 255), OutlineColor = Color3.fromRGB(190, 240, 255),
DepthMode = Enum.HighlightDepthMode.Occluded, Enabled = false, Parent = guideFolder,
})
local guideObjects, guideScanAt = {}, {}
local function guideObject(key)
@@ -2011,8 +2095,8 @@ RunService.RenderStepped:Connect(function()
guideHighlight.Enabled = target ~= nil
if target then
local pulse = (math.sin(os.clock() * 4) + 1) / 2 -- мягкое мигание
guideHighlight.FillTransparency = 0.45 + 0.3 * pulse
guideHighlight.OutlineTransparency = 0.3 * pulse
guideHighlight.FillTransparency = 0.86 + 0.1 * pulse -- лёгкое «дыхание», цвет объекта виден
guideHighlight.OutlineTransparency = 0.1 + 0.45 * pulse
end
if not route or #route == 0 or state ~= "idle" then
hideChevrons(1)
@@ -2426,6 +2510,8 @@ end)()
remote.OnClientEvent:Connect(function(action, a, b, c, d)
if action == "Notify" then
notify(a, b)
elseif action == "TeleportFade" then
teleportLoading(a, b)
elseif action == "Cast" then
setState("waiting")
startCastCam(a, b)