fix(g39): 3D-дистанция для distance-check мест

8 мест-призраков стоят один над другим (x=0, z=0, y=1,3,5,...).
По X+Z они в (0,0) → все 8 видят hintVisible=true одновременно
→ нажатие E срабатывало у всех сразу, башня строилась за раз.

Фикс: 3D-дистанция (учитываем dy).
This commit is contained in:
min 2026-06-09 22:43:40 +03:00
parent b42685521c
commit f7b296f43b

View File

@ -3566,10 +3566,14 @@ local hintVisible = false
RunService.Heartbeat:Connect(function() RunService.Heartbeat:Connect(function()
if built then return end if built then return end
local px = __rbxl_player_x() local px = __rbxl_player_x()
local py = __rbxl_player_y()
local pz = __rbxl_player_z() local pz = __rbxl_player_z()
local dx = part.Position.X - px local dx = part.Position.X - px
local dy = part.Position.Y - py
local dz = part.Position.Z - pz local dz = part.Position.Z - pz
local dist = math.sqrt(dx*dx + dz*dz) -- 3D-дистанция иначе 8 мест-призраков один над другим
-- все видят hintVisible=true (по X+Z они в (0,0,0))
local dist = math.sqrt(dx*dx + dy*dy + dz*dz)
local near = dist <= 4 local near = dist <= 4
if near ~= hintVisible then if near ~= hintVisible then
hintVisible = near hintVisible = near