fixed detour stacking and improper option gating

This commit is contained in:
2026-08-16 14:50:38 +02:00
parent bea880a999
commit 1ef1720bae
7 changed files with 427 additions and 37 deletions
+53
View File
@@ -0,0 +1,53 @@
# YarnCheck
Compiles and plays the project's Yarn scripts from the terminal, without opening Unity.
It uses the Yarn Spinner assemblies that ship inside
`NightclubArcadia/Packages/dev.yarnspinner.unity/Runtime/DLLs`, so it always compiles against
the exact compiler and virtual machine the game runs — not a NuGet copy that could drift.
## Why
The EditMode suite lints Yarn *source* with regexes (`CandidateYarnLintTests`). This runs the
compiled program instead, which catches a different class of bug: a branch that can never be
reached because a flag was written earlier in the same node, a detour chain that never returns,
a menu that recurses instead of looping. Those are invisible to a source lint and expensive to
find by playtesting.
## Usage
```
cd tools/YarnCheck
# compile everything; exit code 1 and diagnostics on failure
dotnet run -- ../../NightclubArcadia/Assets/Dialogue
# compile, then play a node, choosing option 0, then 0, then 3
dotnet run -- ../../NightclubArcadia/Assets/Dialogue Chair_Interaction 0 0 3
```
Picks are consumed as the run needs them. Leftover picks start the node again — that models the
player walking away and coming back, which is how these scenes are actually played:
```
# ask the bartender questions, leave, return, and order a drink
dotnet run -- ../../NightclubArcadia/Assets/Dialogue Bartender_Talk 2 2 0 0
```
Output is the line / command / node-enter / node-exit trace, the options at each choice, and
every declared variable's final value.
## What it does not model
- **Unity commands are printed, not executed.** `<<check>>`, `<<enter_environment>>` and
`<<skill_mod>>` are stepped over, so `$check_result` stays `false` and any check-gated branch
shows its failure side. Read traces with that in mind.
- **Yarn functions are stubbed** in `ProjectLibrary()`: `top_skill` mirrors the real tie
behaviour (first argument wins), `alias_name` returns an obvious placeholder, `skill_rank`
returns 0. If a shipping function's behaviour changes in a way that steers dialogue, update
the stub to match.
- **Variables start from their `<<declare>>` defaults** every run. There is no save state.
## Requirements
.NET 9 SDK. Bump `<TargetFramework>` in `YarnCheck.csproj` if you move to another version.