-- Деревья, кусты и камни вокруг лобби — на скалы и рельеф под ними. Луч вниз из центра основания; -- висит (зазор 0.3…30) — опускаем с небольшим заглублением; под ним пропасть — в ServerStorage.Backup. -- Повторный запуск безопасен. DRY = true — только отчёт. local DRY = false local map = workspace.FishingMap local V = Vector3.new local FOLDERS = { "LobbyForest", "LobbyTrees", "LobbyHillForest", "LobbyRockPlants", "LobbyCliffFoot" } local backup = game.ServerStorage.Backup local rp = RaycastParams.new() rp.FilterType = Enum.RaycastFilterType.Exclude local excl0 = { workspace:FindFirstChild("NpcNoWalk"), workspace:FindFirstChild("TutorialGuide"), map:FindFirstChild("LobbyHaze") } local leaves = {} local function collect(f) for _, c in ipairs(f:GetChildren()) do if c:IsA("Folder") then collect(c) elseif c:IsA("Model") or c:IsA("BasePart") then table.insert(leaves, c) end end end for _, n in ipairs(FOLDERS) do if map:FindFirstChild(n) then collect(map[n]) end end local moved, removed, maxGap, per, bigs = 0, 0, 0, {}, {} for _, o in ipairs(leaves) do local cf, size if o:IsA("Model") then cf, size = o:GetBoundingBox() else cf, size = o.CFrame, o.Size end local r = V(cf.X, 0, cf.Z).Magnitude if r > 30 and r < 260 then local bottom = cf.Y - size.Y / 2 rp.FilterDescendantsInstances = { o, table.unpack(excl0) } -- холмы бывают деталями в той же папке — их не исключаем local hit = workspace:Raycast(V(cf.X, bottom + 2, cf.Z), V(0, -50, 0), rp) if not hit then -- луч начался внутри рельефа (дерево вкопано) — смотрим сверху: поверхность выше низа — значит, стоит local fromTop = workspace:Raycast(V(cf.X, bottom + 60, cf.Z), V(0, -100, 0), rp) if fromTop and fromTop.Position.Y >= bottom - 0.3 then hit = { Position = V(cf.X, bottom, cf.Z) } else hit = fromTop end end local key = o:GetFullName():match("FishingMap%.([^%.]+)") or "?" if not hit then if bottom > 6 then -- висит над пропастью removed += 1 per[key .. " убрано"] = (per[key .. " убрано"] or 0) + 1 if not DRY then o.Name ..= "_float" o.Parent = backup end end else local gap = bottom - hit.Position.Y if gap > 8 and #bigs < 6 then table.insert(bigs, ("%s(%.0f,%.0f,%.0f)+%.0f"):format(o.Name, cf.X, bottom, cf.Z, gap)) end if gap > 0.3 and gap < 45 then local sink = math.min(0.4, size.Y * 0.05) maxGap = math.max(maxGap, gap) moved += 1 per[key] = (per[key] or 0) + 1 if not DRY then if o:IsA("Model") then o:PivotTo(o:GetPivot() - V(0, gap + sink, 0)) else o.CFrame -= V(0, gap + sink, 0) end end end end end end local t = {} for k, v in pairs(per) do table.insert(t, k .. " " .. v) end return ("%s: опущено %d (макс. зазор %.1f), убрано %d; %s; большие: " .. table.concat(bigs, " ")):format(DRY and "проверка" or "сделано", moved, maxGap, removed, table.concat(t, ", "))