Untitled

Anonymous
plain_text
02/18/2026 12:37 AM
11.5 KB
12
Indexable
```gdscript
extends Node2D

@export var oldlady_portrait: Texture2D

var dialogue_ui
var note_ui
var fade_rect
var main_ref

@onready var player = $Player
@onready var oldlady = $OldLady

var wrong_count := 0
var has_key := false

func bind_ui(d, n, f, m):
	dialogue_ui = d
	note_ui = n
	fade_rect = f
	main_ref = m

func _ready():
	oldlady.interacted.connect(_on_oldlady_interacted)

# --------------------------
# Entry point
# --------------------------
func _on_oldlady_interacted():
	_start_gate()

func _start_gate():
	player.set_can_move(false)

	var intro := _escalate_intro()

	dialogue_ui.show_dialogue(
		"Neighbour",
		intro,
		oldlady_portrait,
		[
			{"label": "Good morning."},
			{"label": "Can I pass?"},
			{"label": "I live here."},
			{"label": "I'm just trying to leave quietly."}
		]
	)

	dialogue_ui.choice_selected.connect(_gate_choice, CONNECT_ONE_SHOT)

func _gate_choice(index: int):
	match index:
		0: _branch_good_morning()
		1: _branch_can_i_pass()
		2: _branch_i_live_here()
		3: _branch_leave_quietly()

# --------------------------
# Branches (each gives a reply + new choices)
# --------------------------
func _branch_good_morning():
	wrong_count += 1
	dialogue_ui.show_dialogue(
		"Neighbour",
		"“Good *morning*?”\n\nShe tastes the words like they're expired.\n\n“Morning is earned. Tell me why you're in the corridor.”",
		oldlady_portrait,
		[
			{"label": "Because I exist in this building."},
			{"label": "Because the corridor summoned me."},
			{"label": "Because you’re blocking my oxygen supply."},
			{"label": "Because I need to go do errands."}
		]
	)
	dialogue_ui.choice_selected.connect(_good_morning_choice, CONNECT_ONE_SHOT)

func _good_morning_choice(i: int):
	match i:
		0:
			_wrong_loop("“Existence without documentation? Not in *my* stairwell.”\n\nShe squints. “Try again.”")
		1:
			_wrong_loop("“Don’t be cute.”\n\n“Cute is how burglars get invited in.”\n\n“Try again.”")
		2:
			_wrong_loop("She gasps dramatically.\n\n“THREATENING THE AIR. Typical.”\n\n“Try again.”")
		3:
			_midpoint_to_key("“Errands.”\n\nShe nods like a judge hearing a plea.\n\n“List them. In order. With intent.”")

func _branch_can_i_pass():
	wrong_count += 1
	dialogue_ui.show_dialogue(
		"Neighbour",
		"“Pass?”\n\nShe clutches an imaginary clipboard.\n\n“Pass *where*? This isn’t a train station. This is a corridor with standards.”",
		oldlady_portrait,
		[
			{"label": "Past you. Physically. With my body."},
			{"label": "Into the world. To be perceived by society."},
			{"label": "To the bus. I have places to be."},
			{"label": "Actually never mind, I’ll evaporate."}
		]
	)
	dialogue_ui.choice_selected.connect(_pass_choice, CONNECT_ONE_SHOT)

func _pass_choice(i: int):
	match i:
		0:
			_wrong_loop("“Don’t get technical with me.”\n\n“Technical is for people with nothing to hide.”\n\n“Try again.”")
		1:
			_wrong_loop("“Society?”\n\nShe shudders.\n\n“Society is exactly why I’m here.”\n\n“Try again.”")
		2:
			_midpoint_to_key("“Bus.”\n\nHer eyes narrow.\n\n“Which bus. Say the number. Confidently.”")
		3:
			_wrong_loop("“No one evaporates in my building.”\n\n“Even the humidity submits paperwork.”\n\n“Try again.”")

func _branch_i_live_here():
	wrong_count += 1
	dialogue_ui.show_dialogue(
		"Neighbour",
		"“You live here.”\n\nShe nods slowly.\n\n“Prove it. With a fact only a resident would know.”",
		oldlady_portrait,
		[
			{"label": "The elevator is a myth."},
			{"label": "The stairwell has a specific smell."},
			{"label": "Someone always leaves flyers we never read."},
			{"label": "The corridor is where the drama lives."}
		]
	)
	dialogue_ui.choice_selected.connect(_live_here_choice, CONNECT_ONE_SHOT)

func _live_here_choice(i: int):
	match i:
		0:
			_wrong_loop("“Incorrect.”\n\n“There is an elevator. It’s just offended by your attitude.”\n\n“Try again.”")
		1:
			_midpoint_to_key("She inhales like a sommelier.\n\n“Fine. That’s… disturbingly accurate.”\n\n“And what is your plan today?”")
		2:
			_wrong_loop("“Flyers are surveillance.”\n\n“People take one and suddenly they’re ‘interested’ in community.”\n\n“Try again.”")
		3:
			_wrong_loop("“Drama lives everywhere.”\n\n“Especially in pockets. Check yours.”\n\n“Try again.”")

func _branch_leave_quietly():
	# This is the closest to the "correct vibe"
	dialogue_ui.show_dialogue(
		"Neighbour",
		"She freezes.\n\n“Quietly?”\n\nLike you just offered her a rare delicacy.\n\n“Explain. With sincerity. No jokes.”",
		oldlady_portrait,
		[
			{"label": "I’m trying to avoid… a corridor incident."},
			{"label": "I respect your corridor jurisdiction."},
			{"label": "I have a Vinted package. The world demands I fetch it."},
			{"label": "It’s my birthday. Please don’t arrest me in the stairwell."}
		]
	)
	dialogue_ui.choice_selected.connect(_quietly_choice, CONNECT_ONE_SHOT)

func _quietly_choice(i: int):
	match i:
		0:
			_midpoint_to_key("“Good.”\n\nShe points at you.\n\n“Awareness is step one. Step two is *procedure*.”")
		1:
			_wrong_loop("She softens for half a second.\n\nThen hardens again.\n\n“Flattery is how locksmiths go bankrupt.”\n\n“Try again.”")
		2:
			_midpoint_to_key("“Vinted.”\n\nShe nods like you said a sacred word.\n\n“Fine. That’s legitimate. Where are you going after?”")
		3:
			_midpoint_to_key("She pauses.\n\n“…Birthday.”\n\nHer suspicion recalibrates.\n\n“Okay. New protocol. Answer carefully.”")

# --------------------------
# Midpoint -> Key offer (still not granted yet)
# --------------------------
func _midpoint_to_key(prompt: String):
	dialogue_ui.show_dialogue(
		"Neighbour",
		prompt + "\n\nShe leans in.\n\n“Final question.”",
		oldlady_portrait,
		[
			{"label": "I will leave, accomplish tasks, and return in one piece."},
			{"label": "I will cause zero noise and minimal eye contact."},
			{"label": "I will bring back gossip as rent payment."},
			{"label": "Turns out I'm just trying to get here. To the day."}
		]
	)
	dialogue_ui.choice_selected.connect(_final_question_choice, CONNECT_ONE_SHOT)

func _final_question_choice(i: int):
	match i:
		0:
			_wrong_loop("“One piece?”\n\n“Don’t be dramatic.”\n\n“Try again.”")
		1:
			_grant_key()
		2:
			_wrong_loop("“Gossip?”\n\nShe looks offended.\n\n“Gossip is currency. You can’t just wave it around.”\n\n“Try again.”")
		3:
			_grant_key()

# --------------------------
# Wrong loop helper (increments unhingedness)
# --------------------------
func _wrong_loop(reply: String):
	wrong_count += 1
	var extra := _escalate_wrong_tag()
	dialogue_ui.show_dialogue(
		"Neighbour",
		reply + "\n\n" + extra,
		oldlady_portrait,
		[
			{"label": "Okay. Let me try again."},
			{"label": "What if I just… slide past?"}
		]
	)
	dialogue_ui.choice_selected.connect(_wrong_loop_choice, CONNECT_ONE_SHOT)

func _wrong_loop_choice(i: int):
	# Either way, go back to start gate with escalating intro
	_start_gate()

func _escalate_intro() -> String:
	match wrong_count:
		0:
			return "“Aha. There you are.”"
		1:
			return "“Back again.”\n\n“Either you’re innocent or extremely confident.”"
		2:
			return "“We are doing this *again*.”\n\n“Fine. I have time. I always have time.”"
		_:
			return "She appears like a loading screen you can’t skip.\n\n“Again.”\n\n“Say your lines. I’ll judge them.”"

func _escalate_wrong_tag() -> String:
	match wrong_count:
		0:
			return ""
		1:
			return "She mutters: “People today… no corridor discipline.”"
		2:
			return "She pulls out an imaginary stamp and stamps the air. “Denied.”"
		3:
			return "A neighbor door creaks somewhere.\n\nShe whispers: “They’re watching.”"
		_:
			return "She smiles.\n\nIt is not a friendly smile.\n\n“Try. Again.”"

# --------------------------
# Grant key + set next-step hint (placeholder)
# --------------------------
func _grant_key():
	if has_key:
		# If somehow repeated, just let player go
		dialogue_ui.show_dialogue(
			"Neighbour",
			"“You already have it.”\n\n“Go. Before I change my mind.”",
			oldlady_portrait,
			[]
		)
		player.set_can_move(true)
		return

	has_key = true
	# TODO: GameState flag set when you add it:
	# GameState.has_spare_key = true
	# GameState.unlock_aurora = true

	dialogue_ui.show_dialogue(
		"Neighbour",
		"She sighs like she’s approving a building permit.\n\n“Fine.”\n\nShe produces a **spare key** from nowhere.\n\n“Don’t lose it. If you lose it, I’ll know. Corridor knows.”",
		oldlady_portrait,
		[]
	)

	# Let player move again after this line; closing handled by your existing flow (E: continue)
	player.set_can_move(true)
```
Editor is loading...
Leave a Comment