From 2a7febfa4d1a183099498d48683bfc383a33a359 Mon Sep 17 00:00:00 2001
From: dutchie031
Date: Tue, 1 Sep 2026 20:13:23 +0200
Subject: [PATCH] added examples
---
.docs/web/pages/advanced/lanes.html | 60 +++++++++++++-
lanes.excalidraw.json | 18 ++---
.../stageClasses/GlobalStageManager.lua | 80 +++++++++++++++++--
3 files changed, 141 insertions(+), 17 deletions(-)
diff --git a/.docs/web/pages/advanced/lanes.html b/.docs/web/pages/advanced/lanes.html
index 6303f44..f3287ba 100644
--- a/.docs/web/pages/advanced/lanes.html
+++ b/.docs/web/pages/advanced/lanes.html
@@ -99,10 +99,66 @@
Log Example
- TODO: Show log example
+
+ 2026-09-01 17:53:13.213 INFO SCRIPTING (Main): [Spearhead][StageManager] ========== STAGE FLOW DIAGRAM ==========
+ graph TD
+ default_8["MAIN-2 (S8)"]
+ b_5["West Valley (S5)"]
+ default_1["MAIN-1 (S1)"]
+ a_5["WEST-2 (S5)"]
+ default_4["MAIN-2 (S4)"]
+ default_10["MAIN-1 (S10)"]
+ default_6["MAIN-2 (S6)"]
+ a_4["WEST-1 (S4)"]
+ default_3["MAIN-1 (S3)"]
+ default_9["MAIN-3 (S9)"]
+ a_7["WEST-2 (S7)"]
+ a_3["WEST (S3)"]
+ default_5["MAIN-3 (S5)"]
+ b_6["West Valley-1 (S6)"]
+ default_61["CAP-Maykop (S61)"]
+ default_7["MAIN-1 (S7)"]
+ default_0["START (S0)"]
+ a_6["WEST-3 (S6)"]
+ default_60["CAP-Nalchik (S60)"]
+ default_2["MAIN (S2)"]
+ a_2["WEST-1 (S2)"]
+ a_2 --> a_3
+ a_3 --> a_4
+ a_4 --> a_5
+ a_5 --> a_6
+ a_6 --> a_7
+ default_0 --> default_1
+ default_1 --> default_2
+ default_2 --> default_3
+ default_3 --> default_4
+ default_4 --> default_5
+ default_5 --> default_6
+ default_6 --> default_7
+ default_7 --> default_8
+ default_8 --> default_9
+ default_9 --> default_10
+ default_10 -->|chapter| default_60
+ default_60 --> default_61
+ b_5 --> b_6
+ default_2 -->|unlock| a_2
+ default_5 -->|unlock| b_5
+ a_7 -->|gate| default_60
+ b_6 -->|gate| default_60
+ ========== END DIAGRAM ==========
+
+
Diagram Example
- TODO: Show diagram example
+
+ If you want to then copy and paste everything between the
+ ========== STAGE FLOW DIAGRAM ========== and
+ ========== END DIAGRAM ==========
+ you will be able to go to https://mermaid.live/ and paste the diagram code into the editor.
+
+ It would look like this:
+
+
Limitations
CAP
diff --git a/lanes.excalidraw.json b/lanes.excalidraw.json
index a075b21..ab77ada 100644
--- a/lanes.excalidraw.json
+++ b/lanes.excalidraw.json
@@ -1,7 +1,7 @@
{
"type": "excalidraw",
"version": 2,
- "source": "vscode-webview://1h45nhtr1vhnknf2q5n6qdd43citnkfueml5qdvamifv7pfv0our",
+ "source": "vscode-webview://1hn2vaam3v69jt67pr4i27hnkafotvd70l4ao9nlb18pmrffl5dm",
"elements": [
{
"id": "kJXWwZE94uUnPMEB7mBNj",
@@ -629,11 +629,11 @@
"type": 2
},
"seed": 2125327475,
- "version": 44,
- "versionNonce": 2047370396,
+ "version": 46,
+ "versionNonce": 342494645,
"isDeleted": true,
"boundElements": [],
- "updated": 1788258273370,
+ "updated": 1788285477032,
"link": null,
"locked": false,
"points": [
@@ -2426,7 +2426,7 @@
"version": 112,
"versionNonce": 1755199388,
"isDeleted": false,
- "boundElements": null,
+ "boundElements": [],
"updated": 1788258305636,
"link": null,
"locked": false
@@ -2456,7 +2456,7 @@
"version": 28,
"versionNonce": 557293604,
"isDeleted": false,
- "boundElements": null,
+ "boundElements": [],
"updated": 1788258305636,
"link": null,
"locked": false,
@@ -2598,7 +2598,7 @@
"version": 7,
"versionNonce": 969870492,
"isDeleted": true,
- "boundElements": null,
+ "boundElements": [],
"updated": 1788258356227,
"link": null,
"locked": false,
@@ -2637,7 +2637,7 @@
"version": 3,
"versionNonce": 1886913564,
"isDeleted": true,
- "boundElements": null,
+ "boundElements": [],
"updated": 1788258344772,
"link": null,
"locked": false,
@@ -2713,7 +2713,7 @@
"version": 3,
"versionNonce": 1539555236,
"isDeleted": true,
- "boundElements": null,
+ "boundElements": [],
"updated": 1788258343223,
"link": null,
"locked": false,
diff --git a/src/classes/stageClasses/GlobalStageManager.lua b/src/classes/stageClasses/GlobalStageManager.lua
index f6e36c1..658c9f3 100644
--- a/src/classes/stageClasses/GlobalStageManager.lua
+++ b/src/classes/stageClasses/GlobalStageManager.lua
@@ -368,12 +368,51 @@ function GlobalStageManager:PrintMermaidStage()
local stageIndicesByLane = {} -- Track all stage indices per lane
local mainLaneId = "default"
+ -- Color palette for lanes (26 vibrant colors optimized for dark mode)
+ local laneColors = {
+ "#FF6B6B", -- 1: Red
+ "#4ECDC4", -- 2: Teal
+ "#45B7D1", -- 3: Blue
+ "#FFA502", -- 4: Orange
+ "#95E1D3", -- 5: Mint
+ "#F38181", -- 6: Coral
+ "#AA96DA", -- 7: Purple
+ "#FCBAD3", -- 8: Pink
+ "#A8E6CF", -- 9: Light green
+ "#FFD3B6", -- 10: Peach
+ "#FFAAA5", -- 11: Light red
+ "#FF8B94", -- 12: Rose
+ "#FFEAA7", -- 13: Butter
+ "#DFE6E9", -- 14: Gray
+ "#00B894", -- 15: Emerald
+ "#0984E3", -- 16: Cobalt
+ "#6C5CE7", -- 17: Indigo
+ "#A29BFE", -- 18: Lavender
+ "#FD79A8", -- 19: Magenta
+ "#FDCB6E", -- 20: Gold
+ "#6C757D", -- 21: Slate
+ "#20C997", -- 22: Seafoam
+ "#E74C3C", -- 23: Scarlet
+ "#3498DB", -- 24: Dodger blue
+ "#9B59B6", -- 25: Amethyst
+ "#1ABC9C", -- 26: Turquoise
+ }
+ local laneColorMap = {} -- Map lane ID to color
+ local colorIndex = 1
+
-- Build nodes and collect all stage indices per lane
for _, lane in ipairs(lanes) do
local laneId = lane:GetStageLaneIdentifier() or "default"
local stageIndices = lane:GetAllStageIndices()
stageIndicesByLane[laneId] = stageIndices
+ -- Assign color to this lane
+ laneColorMap[laneId] = laneColors[colorIndex]
+ colorIndex = colorIndex + 1
+ if colorIndex > #laneColors then
+ colorIndex = 1
+ end
+
-- Create nodes for each stage index in this lane
for _, stageIndex in ipairs(stageIndices) do
local stages = lane:GetStagesAtIndex(stageIndex)
@@ -382,7 +421,18 @@ function GlobalStageManager:PrintMermaidStage()
for _, stage in ipairs(stages) do
local nodeId = laneId .. "_" .. stageIndex
local stageType = stage:GetStageType()
- local label = stage.stageName or stage.zoneName
+ local stageName = stage.stageName or stage.zoneName
+
+ -- Generate bracket label: [1], [2] for default, [w1], [e2] for other lanes
+ local bracketLabel
+ if laneId == "default" then
+ bracketLabel = "[" .. stageIndex .. "]"
+ else
+ bracketLabel = "[" .. laneId .. stageIndex .. "]"
+ end
+
+ -- Combined label: [bracket] Name
+ local label = bracketLabel .. " " .. stageName
-- Different node shapes for different stage types
local nodeShape = "["
@@ -395,8 +445,8 @@ function GlobalStageManager:PrintMermaidStage()
nodeEnd = "]]"
end
- nodes[nodeId] = string.format(' %s%s"%s (S%d)"%s',
- nodeId, nodeShape, label, stageIndex, nodeEnd)
+ nodes[nodeId] = string.format(' %s%s"%s"%s',
+ nodeId, nodeShape, label, nodeEnd)
end
end
end
@@ -435,7 +485,7 @@ function GlobalStageManager:PrintMermaidStage()
end
-- Add dependencies from DEFAULT lane to SIDE lanes at chapter starts
- -- Side lanes activate when main reaches a chapter start index for that side lane
+ -- Side lanes activate when main completes the stage BEFORE the chapter start
if mainStageLane then
for _, lane in ipairs(lanes) do
if lane:IsDefaultStageLane() == false then
@@ -446,9 +496,10 @@ function GlobalStageManager:PrintMermaidStage()
for _, stageIdx in ipairs(sideIndices) do
-- Check if this is a chapter start in the side lane
if lane:IsChapterStart(stageIdx) then
- local fromNodeId = mainLaneId .. "_" .. stageIdx
+ -- Main lane must complete (stageIdx - 1) to activate side lane at stageIdx
+ local fromNodeId = mainLaneId .. "_" .. (stageIdx - 1)
local toNodeId = sideId .. "_" .. stageIdx
- -- Side lane activates when main lane reaches this chapter start
+ -- Side lane activates when main lane completes the prior stage
table.insert(edges, string.format(' %s -->|unlock| %s', fromNodeId, toNodeId))
end
end
@@ -502,13 +553,30 @@ function GlobalStageManager:PrintMermaidStage()
-- Build complete Mermaid diagram
local diagramLines = {"graph TD"}
+
+ -- Add class definitions for each lane with colors and contrasting text
+ for laneId, color in pairs(laneColorMap) do
+ table.insert(diagramLines, string.format(' classDef lane_%s fill:%s,stroke:#333,stroke-width:2px,color:#000', laneId, color))
+ end
+
+ -- Add nodes
for _, nodeStr in pairs(nodes) do
table.insert(diagramLines, nodeStr)
end
+
+ -- Add edges
for _, edgeStr in pairs(edges) do
table.insert(diagramLines, edgeStr)
end
+ -- Apply classes to nodes
+ for nodeId in pairs(nodes) do
+ local laneId = nodeId:match("(.+)_[0-9]+$")
+ if laneId then
+ table.insert(diagramLines, string.format(' class %s lane_%s', nodeId, laneId))
+ end
+ end
+
-- Print as single multi-line message
local diagram = "========== STAGE FLOW DIAGRAM ==========\n" .. table.concat(diagramLines, "\n") .. "\n========== END DIAGRAM =========="
self.logger:info(diagram)