Rework the PA junction to match the reference drawing: yellow = PA -> highway (entry), red = highway -> PA (exit). Entry and exit swap sides (entry now EAST, exit WEST) and both trunks hug the PA perimeter instead of running concentric spirals. The simplification: both carriageways sit at the same deck level, adjacent, so the median opening IS the far-side access path. The under-deck crossing and merge runs are deleted outright -- 8 runs collapse to 4, and the girder-soffit ceiling logic that constrained the crossing goes with them. Part count 24,210 -> 21,691. The median opening is now load-bearing rather than cosmetic (it is the only route from the far carriageway to the ramps), so it widens from 6 to 9 samples per junction. Orientation is a single flip-able constant (ORIENT) so a mirrored result is a one-line correction, not a rewrite. Measured on the built map (not asserted): - 600 entry + 600 exit ramp parts - max grade 8.00% / 8.27%, under the 9% limit - 0 collisions with piers/masts/girders (558 structural parts) - segment continuity <= 2.5 studs; trunk->merge handoff <= 1.7 studs - merge lands at dY 0.0 (exact deck level), 33 studs lateral - median open at junctions: 0 parts vs. control ~7 on plain mainline Two traps worth recording, both caught by controls: 1. Studio's require() cache silently rebuilt STALE code. The first "passing" build reported 17,575 parts and zero ramps, and the map contained PAOffRamp/PAOnRamp parts whose names exist nowhere in the current source. Every measurement taken before this was describing an old map. Added tools/rebuild_fresh.luau, which clones the module to bust the cache; use it rather than requiring MapBuilder directly. 2. A reported "median never opens" bug was a bad probe, not a defect. It counted `Barrier` (the outer edge parapet, which must NEVER open) instead of `Median_<i>`. Re-run against the right name: control 7, junctions 0. Both were only visible because the probes carry controls -- a 0-hit result with no control is vacuous. The verification harnesses are kept in tools/ with their controls built in.
72 lines
2.1 KiB
Luau
72 lines
2.1 KiB
Luau
-- Correct probe: mainline deck parts are named "Road". Barriers are found by
|
|
-- actual name, not a guess. Also verifies the ramp tip lands ON a Road part
|
|
-- (not merely near one) and that the median parapet really is open at the
|
|
-- junctions.
|
|
local ws = game:GetService("Workspace")
|
|
local map = ws:FindFirstChild("Map")
|
|
local exp = map:FindFirstChild("Expressway")
|
|
|
|
local road, runs = {}, {}
|
|
local barrierNames = {}
|
|
for _, d in ipairs(map:GetDescendants()) do
|
|
if d:IsA("BasePart") then
|
|
local nm = d.Name
|
|
if nm:gsub("_?%d+$", "") == "Road" then
|
|
table.insert(road, d)
|
|
end
|
|
for _, base in ipairs({ "PAEntryRampNear", "PAExitRampNear", "PAEntryRampTrunk", "PAExitRampTrunk" }) do
|
|
if nm:sub(1, #base + 1) == base .. "_" then
|
|
runs[base] = runs[base] or {}
|
|
table.insert(runs[base], d)
|
|
end
|
|
end
|
|
if
|
|
nm:lower():find("barrier")
|
|
or nm:lower():find("parapet")
|
|
or nm:lower():find("wall")
|
|
or nm:lower():find("rail")
|
|
then
|
|
local b = nm:gsub("_?%d+$", "")
|
|
barrierNames[b] = (barrierNames[b] or 0) + 1
|
|
end
|
|
end
|
|
end
|
|
|
|
local out = {}
|
|
table.insert(out, "roadDeckParts=" .. #road)
|
|
local bn = {}
|
|
for k, v in pairs(barrierNames) do
|
|
table.insert(bn, k .. "=" .. v)
|
|
end
|
|
table.sort(bn)
|
|
table.insert(out, "barrier-ish: " .. table.concat(bn, " "))
|
|
|
|
local function sortKey(p)
|
|
return tonumber(p.Name:match("_(%d+)$")) or 0
|
|
end
|
|
|
|
-- Ramp tip -> nearest Road part, horizontal and vertical separately.
|
|
for _, base in ipairs({ "PAEntryRampNear", "PAExitRampNear" }) do
|
|
local parts = runs[base]
|
|
if not parts then
|
|
table.insert(out, base .. ": MISSING")
|
|
continue
|
|
end
|
|
table.sort(parts, function(a, b)
|
|
return sortKey(a) < sortKey(b)
|
|
end)
|
|
for _, which in ipairs({ { "head", parts[1] }, { "tail", parts[#parts] } }) do
|
|
local p = which[2]
|
|
local bestH, bestDY = math.huge, 0
|
|
for _, m in ipairs(road) do
|
|
local h = (Vector3.new(p.Position.X, 0, p.Position.Z) - Vector3.new(m.Position.X, 0, m.Position.Z)).Magnitude
|
|
if h < bestH then
|
|
bestH = h
|
|
bestDY = p.Position.Y - m.Position.Y
|
|
end
|
|
end
|
|
table.insert(out, ("%s %s: horizToRoad=%.1f dY=%.1f"):format(base, which[1], bestH, bestDY))
|
|
end
|
|
end
|
|
return table.concat(out, "\n")
|