chore(prototype): log lane connections at prototype segment nodes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
haylanandClaude Bot committed 2026-10-06 00:14:12 +02:00
1 parent 6ed16fb1ab
commit 1afd1f2e61
2 files changed
+24

No files matched your search

+23
View File
@@ -33,10 +33,31 @@ local function roadOf(seg : integer) : string
return (tostring(be.roadTemplate):match("([^/]+)%.street_template$")) or tostring(be.roadTemplate)
end
-- lane connections at both nodes of a segment, to check whether crossing-tool edits exist where vehicles enter
local function nodeLog(seg : integer)
local be = api.engine.getComponent(seg, api.type.ComponentType.BASE_EDGE) as Engine.Component.BaseEdge
if be == nil then return end
for _, node in ipairs({ be.node0, be.node1 }) do
local cfg = api.engine.getComponent(node, api.type.ComponentType.BASE_NODE_CONFIG) as Engine.Component.BaseNodeConfig
if cfg == nil then
p(string.format("NODE seg=%d node=%d no BaseNodeConfig (default connections)", seg, node))
else
local conns : {string} = {}
for _, lc in ipairs(cfg.laneConnections) do
if lc.segment0 == seg or lc.segment1 == seg then
table.insert(conns, string.format("%d:%d->%d:%d", lc.segment0, lc.lane0, lc.segment1, lc.lane1))
end
end
p(string.format("NODE seg=%d node=%d userModified=%s conns=%s", seg, node, tostring(cfg.userModifiedLaneConnections), table.concat(conns, " ")))
end
end
end
local function dump(dt : number)
local player = api.engine.util.getPlayer()
local vehicles = api.engine.getEntitiesWithComponent(api.type.ComponentType.TRANSPORT_VEHICLE, { requireOwnedByPlayer = player })
p(string.format("tick=%d dt=%s playerVehicles=%d", ticks, tostring(dt), #vehicles))
local protoSegs : {integer : boolean} = {}
for _, v in ipairs(vehicles) do
local lv = api.engine.getComponent(v, api.type.ComponentType.LAND_VEHICLE) as Engine.Component.LandVehicle
local mp = api.engine.getComponent(v, api.type.ComponentType.MOVE_PATH) as Engine.Component.MovePath
@@ -48,8 +69,10 @@ local function dump(dt : number)
v, edge and roadOf(edge.entity) or "-", edge and edge.entity or -1, tostring(edge and edge.index), tostring(dir), tostring(edge and turnaround(edge)),
mp.dyn.pathPos.edgeIndex, #(mp.path.edges as {any}), mp.dyn.pathPos.pos, mp.dyn.speed, tostring(mp.state),
tostring(tv and tv.state), tostring(tv and tv.line), mp.dyn.timeStanding))
if edge ~= nil and roadOf(edge.entity) == "overtake_proto_b" then protoSegs[edge.entity] = true end
end
end
for seg, _ in pairs(protoSegs) do nodeLog(seg) end
end
local ret : GameScript<table> = {