This commit is contained in:
listik committed 2026-11-04 23:02:16 +03:00
1 parent 838a118f98
commit 81c7c016c5
3 files changed
+84

No files matched your search

@@ -433,6 +433,13 @@ local timeBar = new("Frame", { Size = UDim2.new(1, -30, 0, 5), Position = UDim2.
---------------------------------------------------------------- окна
local openWindow = nil
-- окно, открытое у ларька (сразу после нажатия на подсказку), закрывается, если отойти дальше WINDOW_CLOSE_DIST
-- (5 м ≈ 18 studs); окна, открытые клавишами и кнопками меню, так не закрываются
H.WINDOW_CLOSE_DIST = 18
H.promptAt = -math.huge
game:GetService("ProximityPromptService").PromptTriggered:Connect(function()
H.promptAt = os.clock()
end)
local function makeWindow(title, accent, tabs)
local w = { pages = {}, tabButtons = {}, current = nil }
@@ -444,6 +451,8 @@ local function makeWindow(title, accent, tabs)
}, { corner(12), stroke(C.goldDark, 4, 0), Theme.woodGradient(C.wood, C.woodDark), new("UISizeConstraint", { MaxSize = Vector2.new(760, 540) }) })
Theme.innerBorder(frame, 7, 8, C.gold, 0.2)
Theme.rivets(frame, 12, 8)
-- Modal: пока окно открыто, Roblox отпускает курсор и в виде от первого лица (иначе он прибит к центру экрана)
new("TextButton", { Name = "FreeCursor", Size = UDim2.fromOffset(1, 1), BackgroundTransparency = 1, Text = "", Modal = true, Parent = frame })
local scale = new("UIScale", { Parent = frame })
local header = new("Frame", { Size = UDim2.new(1, 0, 0, 56), BackgroundTransparency = 1, Parent = frame })
-- багровая лента по центру, ширина — по тексту
@@ -502,6 +511,9 @@ local function makeWindow(title, accent, tabs)
openWindow = w
if not frame.Visible then
Audio.play("open")
-- открыли у ларька — запоминаем, где стоим; отойдёт игрок — окно закроется само
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
w.anchor = (hrp and os.clock() - H.promptAt < 2) and hrp.Position or nil
end
frame.Visible = true
scale.Scale = 0.85
@@ -510,6 +522,7 @@ local function makeWindow(title, accent, tabs)
end
function w.close()
frame.Visible = false
w.anchor = nil
if openWindow == w then
openWindow = nil
end
@@ -532,6 +545,21 @@ local function makeWindow(title, accent, tabs)
return w
end
-- отошёл от ларька — его окно закрывается
RunService.Heartbeat:Connect(function()
local w = openWindow
if not (w and w.anchor) then
return
end
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
if hrp then
local d = hrp.Position - w.anchor
if Vector3.new(d.X, 0, d.Z).Magnitude > H.WINDOW_CLOSE_DIST then
w.close()
end
end
end)
local function scrollArea(parent, cell, topOffset)
local sf = new("ScrollingFrame", {
Size = UDim2.new(1, 0, 1, -(topOffset or 0)), Position = UDim2.fromOffset(0, topOffset or 0),