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
@@ -1,11 +1,11 @@
// Everything the bartender ever says.
//
// These nodes share a title, which makes them a node group. Callers just
// `<<detour Bartender_Talk>>` and Yarn runs the most specific variation whose
// `when:` conditions pass. Adding a new variation later means adding a node,
// not editing a growing <<if>> chain.
//
// Each variation sets $went_inside so the calling scene knows the verdict.
// Stack discipline (the player comes back to the bar, so it matters):
// `Bartender_Talk` is the node DialogueInteractable starts, so nothing is
// waiting for it to return. Its branches therefore <<jump>> — they are the last
// thing the node does — and each destination hands control back with
// <<enter_environment>> itself. <<detour>> is only for sub-conversations that
// have to resume the caller; a <<jump>> inside one would clear the return stack.
title: Bartender_Talk
position: -121,-60
@@ -17,9 +17,9 @@ position: -121,-60
Bartender: Ah, {$player_alias}. A drink?
<<endif>>
-> Yes, please.
<<detour SC101_Hook_Drink_Bartender_Talk>>
<<jump SC101_Hook_Drink_Bartender_Talk>>
-> No, I have questions.
<<detour SC101_Hook_Questions_Bartender_Talk>>
<<jump SC101_Hook_Questions_Bartender_Talk>>
<<else>>
<<set $spoke_to_bartender = true>>
Bartender: Ah, {$player_alias}, back again?
@@ -41,29 +41,32 @@ position: -121,-60
-> What can you recommend?
Bartender: Last time you tooke the Estate.
Narrator: You ignore the jab.
<<detour SC101_Hook_Drink_Bartender_Talk>>
<<jump SC101_Hook_Drink_Bartender_Talk>>
-> Whatever.
<<detour SC101_Hook_Drink_Bartender_Talk>>
<<jump SC101_Hook_Drink_Bartender_Talk>>
-> Yes. I'll take the usual.
Narrator: The bartender doesn't even flinch, while taking ingredients from the bar.
PROVENANCE: We cannot remember these substances.
AMNESTY: Is this really our favorite drink?
<<set $self_lean_inheritor += 1>>
<<detour SC101_Hook_Drink_Bartender_Talk>>
<<jump SC101_Hook_Drink_Bartender_Talk>>
-> I am, and I have a few questions.
<<detour SC101_Hook_Questions_Bartender_Talk>>
<<jump SC101_Hook_Questions_Bartender_Talk>>
<<endif>>
<<enter_environment>>
===
title: SC101_Hook_Drink_Bartender_Talk
position: 116,222
---
// $had_the_estate_drink is written at the BOTTOM of this node, not here. The whole
// node reads first-glass state — the pour, the taste, and the lean write under the
// answer — and the glass is only recorded once all of it has run. Setting the flag
// up here (as this node used to) leaves the tests below reading a flag this same
// run already flipped, and the lean write can never fire.
Bartender: One Estate coming right up.
<<if $had_the_estate_drink>>
Narrator: He puts another amber drink before you.
<<else>>
<<set $had_the_estate_drink = true>>
Narrator: He puts a deep amber drink before you.
HOUSE POUR: It smells like old wood, oak, which went sour with age, like a library shelf that's been rained on once and dried wrong.
Narrator: You take a sip.
@@ -84,6 +87,8 @@ AMNESTY: Is that the taste of our favorite drink? I cannot remember ...
<<else>>
HOUSE POUR: Still bitter.
<<endif>>
<<set $had_the_estate_drink = true>>
<<enter_environment>>
===
title: SC101_Hook_Questions_Bartender_Talk
@@ -92,10 +97,11 @@ position: -139,224
Bartender: Sure, what do you want to know?
-> Question 1
Bartender: Answer 1
<<detour SC101_Hook_Questions_Bartender_Talk>>
-> Question 2
Bartender: Answer 2
<<detour SC101_Hook_Questions_Bartender_Talk>>
-> Nothing.
Bartender: Alright.
<<enter_environment>>
<<stop>>
<<jump SC101_Hook_Questions_Bartender_Talk>>
===
+15 -4
View File
@@ -32,9 +32,20 @@ title: Declarations
<<declare $previous_winner = "" as string>>
// Candidate lean. Three permanently-live readings of who the PC is; they are
// not mutually exclusive and never resolve. Writers <<set>> these; no code
// reads them. There is deliberately NO derived "winning candidate" variable —
// see docs/candidate-system-implementation-plan.md §6.
// not mutually exclusive and never resolve into a canonical identity.
//
// DESIGN DECISION 2026-08-16 — amends the "no code ever reads lean" guardrail in
// docs/candidate-system-implementation-plan.md §6.1: scenes are meant to tilt
// toward one reading and NPCs are meant to act on the current tilt, so that a
// player who thinks they have settled on a path gets challenged on it in the
// next scene. Reading lean through top_skill(...) is therefore sanctioned, as in
// SC101_Asks_Candidate_Chevalier_Cassian_Thal_Talk. top_skill returns its FIRST
// argument on a tie, which is why made_asset is passed first — the Made Asset
// bias on an even score is deliberate, not an accident of argument order.
//
// What the amendment does NOT license: a stored winner. There is still no
// $dominant_candidate, no ground-truth identity field, and nothing in save data
// beyond these three integers. $winner above is scratch, recomputed per use.
<<declare $self_lean_made_asset = 0 as number>>
<<declare $self_lean_journalist = 0 as number>>
<<declare $self_lean_inheritor = 0 as number>>
@@ -102,5 +113,5 @@ title: Declarations
<<declare $spoke_to_chevalier_cassian_thal = false as bool>>
<<declare $spoke_to_bradford_kane = false as bool>>
<<declare $inquired_about_cyprus = false as bool>>
<<declare $declared_candidate_to_chevalier_cassian_thal = true as bool>>
<<declare $declared_candidate_to_chevalier_cassian_thal = false as bool>>
===
@@ -1,11 +1,14 @@
// Everything that can be interacted with the chair.
//
// These nodes share a title, which makes them a node group. Callers just
// `<<detour Chair_Interaction>>` and Yarn runs the most specific variation whose
// `when:` conditions pass. Adding a new variation later means adding a node,
// not editing a growing <<if>> chain.
// Stack discipline (the player re-enters all of this, so it matters):
// `Chair_Interaction` is the node DialogueInteractable starts, so nothing above
// it is waiting for a return. The menu therefore LOOPS with <<jump>>, which
// replaces the current node and pushes nothing, and only sub-conversations that
// have to come back use <<detour>>. Never <<jump>> out of a detoured node —
// that clears the return stack and the caller never resumes.
//
// Each variation sets $went_inside so the calling scene knows the verdict.
// The sit-down line lives in its own node so the menu loop can't replay it,
// while a player who stands up and sits down again still gets it.
title: Chair_Interaction
position: -334,-601
@@ -13,7 +16,7 @@ position: -334,-601
Narrator: An empty chair with a place card: {$player_name}.
-> Sit down.
<<set $sat_down_at_table = true>>
<<detour SC101_Hook_Sitting_Chair_Interaction>>
<<jump SC101_Hook_Sitting_Chair_Interaction>>
-> Not yet.
<<enter_environment>>
===
@@ -22,21 +25,22 @@ title: SC101_Hook_Sitting_Chair_Interaction
position: -328,-360
---
Narrator: You sit down between two very distinguished gentlemen.
<<jump SC101_Hook_Menu_Chair_Interaction>>
===
// The loop target. Every menu variation jumps back here when its sub-conversation
// returns, so which variation shows is re-evaluated after every interaction.
title: SC101_Hook_Menu_Chair_Interaction
position: -328,-205
---
<<if $spoke_to_chevalier_cassian_thal eq true and $spoke_to_bradford_kane eq true>>
<<detour SC101_Hook_Both_Chair_Interaction>>
<<detour SC101_Hook_Sitting_Chair_Interaction>>
<<jump SC101_Hook_Both_Chair_Interaction>>
<<elseif $spoke_to_chevalier_cassian_thal eq true and $spoke_to_bradford_kane eq false>>
<<detour SC101_Hook_Left_Not_Right_Chair_Interaction>>
<<detour SC101_Hook_Sitting_Chair_Interaction>>
<<jump SC101_Hook_Left_Not_Right_Chair_Interaction>>
<<elseif $spoke_to_chevalier_cassian_thal eq false and $spoke_to_bradford_kane eq true>>
<<detour SC101_Hook_Right_Not_Left_Chair_Interaction>>
<<detour SC101_Hook_Sitting_Chair_Interaction>>
<<elseif $spoke_to_chevalier_cassian_thal eq true and $spoke_to_bradford_kane eq true>>
<<detour SC101_Hook_Both_Chair_Interaction>>
<<detour SC101_Hook_Sitting_Chair_Interaction>>
<<jump SC101_Hook_Right_Not_Left_Chair_Interaction>>
<<else>>
<<detour SC101_Hook_First_Sitting_Chair_Interaction>>
<<detour SC101_Hook_Sitting_Chair_Interaction>>
<<jump SC101_Hook_First_Sitting_Chair_Interaction>>
<<endif>>
===
@@ -51,6 +55,8 @@ position: -320,-51
<<detour Bradford_Kane_Talk>>
-> Stand up.
<<enter_environment>>
<<stop>>
<<jump SC101_Hook_Menu_Chair_Interaction>>
===
title: SC101_Hook_Left_Not_Right_Chair_Interaction
@@ -64,6 +70,8 @@ position: -95,-48
<<detour Bradford_Kane_Talk>>
-> Stand up.
<<enter_environment>>
<<stop>>
<<jump SC101_Hook_Menu_Chair_Interaction>>
===
title: SC101_Hook_Right_Not_Left_Chair_Interaction
@@ -77,6 +85,8 @@ position: 134,-32
<<detour Bradford_Kane_Talk>>
-> Stand up.
<<enter_environment>>
<<stop>>
<<jump SC101_Hook_Menu_Chair_Interaction>>
===
title: SC101_Hook_Both_Chair_Interaction
@@ -90,6 +100,8 @@ position: 363,-36
<<detour Bradford_Kane_Talk>>
-> Stand up.
<<enter_environment>>
<<stop>>
<<jump SC101_Hook_Menu_Chair_Interaction>>
===
title: SC101_Hook_Place_Card_Chair_Interaction