Files
2026-11-06 12:34:01 +05:00

138 lines
6.4 KiB
Lua

-- Правки лобби №2 (запуск в Studio в режиме редактирования, потом Ctrl+S; повторный запуск ничего не ломает):
-- 1) Табличка «Как играть» уходит с пути от точки появления: левее и дальше, лицом к точке появления.
-- Вместе с ней — оба столба и маркер обучения GuideBoard (по нему стрелка и шаг «Прочитай табличку»).
-- Раньше маркер был в 9 studs от точки появления, и обучение срабатывало сразу при входе.
-- 2) Доски «Топ рыболовов» и «Топ донатеров» встают в торговый ряд на радиус 80 по краям (−32° и 212°,
-- с тем же шагом 32°, что лавки), подальше от двора гильдии и домиков; между ними и соседями — фонарь с бочками.
-- Прежние места — в атрибуте Fix2Orig у каждой сдвинутой детали.
local map = workspace.FishingMap
local R, FLOOR = 80, 1
local report = {}
local function remember(o, cf)
if o:GetAttribute("Fix2Orig") == nil then
o:SetAttribute("Fix2Orig", cf)
end
end
local function flat(v)
return Vector3.new(v.X, 0, v.Z)
end
---------------------------------------------------------------- 1. табличка
do
local board
for _, c in ipairs(map:GetChildren()) do
if c:IsA("BasePart") and c:GetAttribute("GuideTarget") == "Board" then
board = c
end
end
assert(board, "Нет таблички (GuideTarget = Board)")
local marker = map:FindFirstChild("GuideBoard")
-- столбы: тонкие высокие детали у концов таблички
local posts = {}
for _, c in ipairs(map:GetChildren()) do
if c:IsA("BasePart") and c ~= board and c.Size.Y > 6 and c.Size.X < 1.5 and c.Size.Z < 1.5 then
local l = board.CFrame:PointToObjectSpace(c.Position)
if math.abs(l.X) <= board.Size.X / 2 + 1.5 and math.abs(l.Z) < 1.5 then
table.insert(posts, c)
end
end
end
-- лицевая сторона — та, на которой надпись
local gui = board:FindFirstChildOfClass("SurfaceGui")
local frontSign = (gui and gui.Face == Enum.NormalId.Back) and -1 or 1
local spawnPos = Vector3.new(0, FLOOR, 57)
-- левее фонаря у дорожки (−13.5, 46), чтобы он не заслонял надпись со стороны точки появления
local center = Vector3.new(-24, board.Position.Y, 48)
local faceDir = flat(spawnPos - center).Unit
-- новый кадр таблички: её «лицо» (LookVector · frontSign) смотрит на точку появления
local look = faceDir * frontSign
local newCF = CFrame.lookAt(center, center + look)
local moved = { board }
for _, p in ipairs(posts) do
table.insert(moved, p)
end
if marker then
table.insert(moved, marker)
end
for _, p in ipairs(moved) do
remember(p, p.CFrame)
end
-- считаем от исходного положения (повторный запуск не сдвигает дальше)
local T = newCF * board:GetAttribute("Fix2Orig"):Inverse()
for _, p in ipairs(moved) do
p.CFrame = T * p:GetAttribute("Fix2Orig")
end
if marker then
-- маркер — на полу перед табличкой, в 6 studs от неё к точке появления
marker.CFrame = CFrame.new(Vector3.new(center.X, marker:GetAttribute("Fix2Orig").Position.Y, center.Z) + faceDir * 6)
end
table.insert(report, ("табличка → (%.0f, %.0f), столбов %d, маркер до точки появления %.1f studs"):format(center.X, center.Z, #posts,
marker and flat(marker.Position - spawnPos).Magnitude or -1))
end
---------------------------------------------------------------- 2. доски лидеров
local function slot(deg)
local a = math.rad(deg)
local p = Vector3.new(math.cos(a) * R, FLOOR, math.sin(a) * R)
return CFrame.lookAt(p, Vector3.new(0, FLOOR, 0))
end
for _, s in ipairs({ { "Leaderboard_Catch", -32 }, { "Leaderboard_Donate", 212 } }) do
local m = map:FindFirstChild(s[1])
if m then
remember(m, m:GetPivot())
local orig = m:GetAttribute("Fix2Orig")
-- кадр доски на полу: Y пола и фасад (LookVector) как у исходной доски
local p = orig.Position
local from = CFrame.lookAt(Vector3.new(p.X, FLOOR, p.Z), Vector3.new(p.X, FLOOR, p.Z) + flat(orig.LookVector))
m:PivotTo(slot(s[2]) * from:ToObjectSpace(orig))
table.insert(report, ("%s → %d°"):format(s[1], s[2]))
end
end
-- фонарь с бочками между крайними досками и соседями (как в tools/lobby-decor.lua)
local decor = map:FindFirstChild("LobbyMarketDecor")
if decor then
for _, deg in ipairs({ -16, 196 }) do
local name = ("Gap_%03d"):format(deg % 360)
local old = decor:FindFirstChild(name)
if old then
old:Destroy()
end
local src = decor:FindFirstChild("Gap_016")
if src then
-- копия готового промежутка, повёрнутая на нужный угол вокруг центра площади
local g = src:Clone()
g.Name = name
g:PivotTo(CFrame.Angles(0, -math.rad(deg - 16), 0) * g:GetPivot())
g.Parent = decor
end
end
end
-- проверка: доски и новые украшения не задевают постройки (отступ 8 studs)
local overlap = OverlapParams.new()
overlap.FilterType = Enum.RaycastFilterType.Exclude
for _, n in ipairs({ "Leaderboard_Catch", "Leaderboard_Donate", "Leaderboard_Earn" }) do
local m = map:FindFirstChild(n)
if m then
overlap.FilterDescendantsInstances = { m, decor }
local cf, size = m:GetBoundingBox()
local hits = {}
for _, p in ipairs(workspace:GetPartBoundsInBox(cf * CFrame.new(0, 1, 0), size + Vector3.new(16, -2, 16), overlap)) do
if p.CanCollide and p.Size.Y > 2 and p.Size.Y < 50 and p.Size.X < 60 and p.Size.Z < 60 and p.Position.Y > 1.5 then
hits[(p.Parent and p.Parent ~= map and p.Parent.Name or p.Name)] = true
end
end
local list = {}
for k in pairs(hits) do
table.insert(list, k)
end
table.insert(report, n .. ": рядом (8 studs) " .. (#list > 0 and table.concat(list, ", ") or "ничего"))
end
end
return table.concat(report, "\n")