234
This commit is contained in:
1 parent
e1459c9834
commit
b48d1f68f6
14 files changed
+51196
-45855
No files matched your search
@@ -1575,7 +1575,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
|
||||
@@ -1602,18 +1616,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
|
||||
@@ -1629,12 +1648,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
|
||||
|
||||
@@ -1690,16 +1709,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
|
||||
@@ -1784,10 +1867,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)
|
||||
@@ -1901,6 +1985,25 @@ closeBoardView = function()
|
||||
advanceTutorial(1)
|
||||
end
|
||||
|
||||
-- скупка «Тихого озера»: ведём к прилавку с подсказкой «Продать» внутри лавки (GuideTarget = "Sell"),
|
||||
-- поэтому стрелка идёт за лавкой, куда бы её ни переставили; маркер GuideSell — запасной вариант
|
||||
local function sellTargetW1()
|
||||
local shop = guideObject("Sell")
|
||||
if shop then
|
||||
for _, d in ipairs(shop:GetDescendants()) do
|
||||
if d:IsA("ProximityPrompt") and d:GetAttribute("Action") == "Sell" then
|
||||
local p = d.Parent
|
||||
local at = (p:IsA("BasePart") and p.Position) or (p:IsA("Attachment") and p.WorldPosition)
|
||||
if at then
|
||||
return at
|
||||
end
|
||||
end
|
||||
end
|
||||
return shop:IsA("Model") and shop:GetPivot().Position or shop.Position
|
||||
end
|
||||
return guideMarker("GuideSell")
|
||||
end
|
||||
|
||||
-- маршрут для текущего шага: точки ломаной (без игрока), подсказка и что подсветить; nil — линию не показываем
|
||||
local function guideRoute(step, pos, world)
|
||||
local inW1 = world and world.id == "World1"
|
||||
@@ -1911,7 +2014,7 @@ local function guideRoute(step, pos, world)
|
||||
elseif step == 2 and inW1 then
|
||||
return { guideMarker("GuideFishSpot") }, "🎣 Зажми ЛКМ у воды", "Pier"
|
||||
elseif step == 3 and inW1 then
|
||||
return { guideMarker("GuideSell") }, "💰 Продай рыбу", "Sell" -- лавка у самого причала, идём напрямую
|
||||
return { sellTargetW1() }, "💰 Продай рыбу", "Sell" -- лавка у самого причала, идём напрямую
|
||||
end
|
||||
return nil
|
||||
end
|
||||
@@ -1995,7 +2098,7 @@ RunService.RenderStepped:Connect(function()
|
||||
end
|
||||
if not route and bagFull then
|
||||
local inW1 = world and world.id == "World1"
|
||||
local at = (inW1 and guideMarker("GuideSell")) or nearestSell(pos, world)
|
||||
local at = (inW1 and sellTargetW1()) or nearestSell(pos, world)
|
||||
route, hint, key = at and { at } or nil, "🎒 Сумка полна — продай рыбу!", inW1 and "Sell" or nil
|
||||
end
|
||||
guideHintText.Text = hint or ""
|
||||
@@ -2010,8 +2113,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)
|
||||
@@ -2425,6 +2528,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)
|
||||
|
||||
Reference in new issue
Block a user