v1-Ausbau Phase 4: Cassian Vane mit Dialogen, Drohnotizen und Tag-9-Hinterhalt
- cassian_npc am Hofrand (Reiterquadrant): stationaer, dreht sich dem Spieler zu; tagesabhaengige Dialogbaeume nach CHARACTERS-Stimme (leise, muede, nur Wetter): Tag 1-3 cassian_intro (Hetze), Tag 4-6 cassian_angebot (Optionen mit Ton + Flag), Tag 7-8 cassian_warnung (Vorausdeutung Materialraum); jedes Gespraech hebt die Eskalation aufs Tages-Niveau; ab Tag 9 bzw. nach dem Ausgang fort - threat_note + data/story/threat_notes.json: zerknuellte Notiz an Tag 4-6 im Hof, Popup mit Tages-Text, Steuerungs-Sperre, persistentes Lese-Flag, verschwindet fuer den Resttag - cassian_ambush im Materialraum: Akteure (Cassian, Wren, 2 Schergen) nur an Tag 9; nicht abbrechbarer Auftakt -> QTE-Kette (4 Stufen: Parieren/Kontern/Ausweichen/Springen, dynamische Prompt-Glyphen); Permadeath AN: Scheitern = Game Over, AUS: Wiederholung mit Hohn-Zeile (Weiche ist story-kritisch); Herz/Klinge-Weiche als Dialog: HERZ = Wren-Vertrauen max + wren_loyal, Menschlichkeit +3, temporaerer Stat-Malus (Kraft/Schnelligkeit -2, Malus-Flag), Cassian lebt; KLINGE = Ausgang blade (liegt), Wren-Vertrauen -40 + wren_angst, Menschlichkeit -3; Cassian-Ausgang persistiert und wird in Phase 6 als Dreschen-Daumen verdrahtet - Fix: Eskalation nach Dialogen feuerte nicht (is_speaker bei dialogue_finished bereits geleert) - Sprecher-Zustand wird bei dialogue_started gemerkt (NPC-Standardmuster) - Verifikation: Sonde 36/36 gruen (Eskalations-Kette, Notiz-Fenster, End-to-End-Hinterhalt mit Fehlversuch + Herz-Zweig, Klinge-Zweig ueber apply_outcome, Cassian an Tag 10 fort); Boot-Check fehlerfrei Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
d64cf71c0d
commit
b3517b7a55
17 changed files with 993 additions and 13 deletions
225
scripts/gameplay/cassian_ambush.gd
Normal file
225
scripts/gameplay/cassian_ambush.gd
Normal file
|
|
@ -0,0 +1,225 @@
|
|||
extends Node
|
||||
## Tag-9-Hinterhalt im Materialraum (v1-Ausbau Phase 4, STORY.md §5).
|
||||
##
|
||||
## Nach der Gefechtskunde werden Tyrveil und Wren ins Lager geschickt —
|
||||
## zwischen den Regalen kesseln Cassian und zwei Schergen sie ein. Aktiv
|
||||
## nur an Tag 9, solange der Cassian-Ausgang offen ist; an allen anderen
|
||||
## Tagen bleiben die Akteure unsichtbar. Ablauf: nicht abbrechbarer
|
||||
## Auftakt -> taktisches Sparring als QTE-Kette (Permadeath-gekoppelt:
|
||||
## Scheitern bedeutet bei Permadeath AN Game Over; bei AUS rappelt
|
||||
## Tyrveil sich auf und die Kette startet neu — die Weiche ist
|
||||
## story-kritisch und darf nicht verloren gehen) -> Herz/Klinge-Weiche
|
||||
## als Dialog. Konsequenzen: HERZ = Wren bedingungslos loyal (Vertrauen
|
||||
## max), temporärer Stat-Malus durch Verletzungen, Menschlichkeit
|
||||
## steigt, Cassian lebt. KLINGE = Cassian final ausgeschaltet, Wren hat
|
||||
## Angst (Vertrauen bricht ein), Menschlichkeit kippt. Der Ausgang liegt
|
||||
## als Cassian-Outcome im GameState und fließt in Phase 6 als Daumen ins
|
||||
## Dreschen (DragonBondSystem).
|
||||
|
||||
signal ambush_finished(outcome: String)
|
||||
|
||||
const INTRO_PATH := "res://data/dialogue/cassian_ambush_intro.json"
|
||||
const FAIL_PATH := "res://data/dialogue/cassian_ambush_fail.json"
|
||||
const CHOICE_PATH := "res://data/dialogue/cassian_ambush_choice.json"
|
||||
const MAIN_MENU_SCENE := "res://scenes/ui/main_menu.tscn"
|
||||
const QTE_STAGES := 4
|
||||
const QTE_WINDOW_SECONDS := 1.3
|
||||
const QTE_STAGE_GAP_SECONDS := 0.3
|
||||
const QTE_ACTIONS := [
|
||||
{ "action": "block", "label": "PARIEREN" },
|
||||
{ "action": "attack", "label": "KONTERN" },
|
||||
{ "action": "slide", "label": "AUSWEICHEN" },
|
||||
{ "action": "jump", "label": "ÜBER DIE KISTE" },
|
||||
]
|
||||
const AMBUSH_DAY := 9
|
||||
const HEART_STAT_MALUS := 2
|
||||
|
||||
@export var cassian_path: NodePath
|
||||
@export var wren_path: NodePath
|
||||
@export var scherge_paths: Array[NodePath] = []
|
||||
@export var trigger_path: NodePath
|
||||
|
||||
var is_ambush_active := false
|
||||
|
||||
var _qte_expected_action := ""
|
||||
var _is_stage_passed := false
|
||||
var _is_stage_failed := false
|
||||
var _has_run := false
|
||||
var _qte_layer: CanvasLayer
|
||||
var _qte_label: Label
|
||||
|
||||
@onready var _cassian: Node3D = get_node(cassian_path)
|
||||
@onready var _wren: Node3D = get_node(wren_path)
|
||||
|
||||
|
||||
## Richtet die Akteure nach Tag/Ausgang aus und verbindet den Auslöser.
|
||||
func _ready() -> void:
|
||||
var is_armed: bool = TimeSystem.day_count == AMBUSH_DAY and StorySystem.get_cassian_outcome() == "none"
|
||||
_set_actors_visible(is_armed)
|
||||
if is_armed:
|
||||
var trigger := get_node(trigger_path) as Area3D
|
||||
trigger.body_entered.connect(_on_trigger_entered)
|
||||
|
||||
|
||||
## Bewertet die QTE-Eingabe; während einer aktiven Stufe wird sämtlicher
|
||||
## übriger Input geschluckt.
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if _qte_expected_action.is_empty():
|
||||
return
|
||||
for stage in QTE_ACTIONS:
|
||||
if event.is_action_pressed(str(stage["action"])):
|
||||
if stage["action"] == _qte_expected_action:
|
||||
_is_stage_passed = true
|
||||
else:
|
||||
_is_stage_failed = true
|
||||
break
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
|
||||
## Startet den Hinterhalt, sobald Tyrveil zwischen die Regale läuft.
|
||||
func _on_trigger_entered(body: Node3D) -> void:
|
||||
if not body.is_in_group("player") or _has_run:
|
||||
return
|
||||
if DialogueSystem.is_dialogue_active:
|
||||
return
|
||||
_has_run = true
|
||||
is_ambush_active = true
|
||||
_run_ambush(body)
|
||||
|
||||
|
||||
## Spielt den kompletten Hinterhalt als Coroutine: Auftakt, QTE-Kette
|
||||
## (mit Wiederholung bei Permadeath AUS), Herz/Klinge-Weiche, Konsequenzen.
|
||||
func _run_ambush(player: CharacterBody3D) -> void:
|
||||
DialogueSystem.start_dialogue(INTRO_PATH, {
|
||||
"cassian": _cassian,
|
||||
"wren": _wren,
|
||||
DialogueSystem.PLAYER_SPEAKER_ID: player,
|
||||
})
|
||||
await DialogueSystem.dialogue_finished
|
||||
player.set_control_locked(true)
|
||||
while true:
|
||||
var is_success := await _run_qte()
|
||||
if is_success:
|
||||
break
|
||||
if GameState.is_permadeath_enabled:
|
||||
player.set_control_locked(false)
|
||||
print("Game Over — der Materialraum hat keine Zeugen.")
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
get_tree().change_scene_to_file(MAIN_MENU_SCENE)
|
||||
return
|
||||
player.set_control_locked(false)
|
||||
DialogueSystem.start_dialogue(FAIL_PATH, {
|
||||
"cassian": _cassian,
|
||||
DialogueSystem.PLAYER_SPEAKER_ID: player,
|
||||
})
|
||||
await DialogueSystem.dialogue_finished
|
||||
player.set_control_locked(true)
|
||||
player.set_control_locked(false)
|
||||
DialogueSystem.start_dialogue(CHOICE_PATH, {
|
||||
"cassian": _cassian,
|
||||
"wren": _wren,
|
||||
DialogueSystem.PLAYER_SPEAKER_ID: player,
|
||||
})
|
||||
await DialogueSystem.dialogue_finished
|
||||
var choice := str(GameState.get_story_flag("cassian_choice", "heart"))
|
||||
apply_outcome(choice)
|
||||
is_ambush_active = false
|
||||
ambush_finished.emit(choice)
|
||||
|
||||
|
||||
## Wendet die Konsequenzen der Weiche an (öffentlich, damit Tests beide
|
||||
## Zweige deterministisch prüfen können).
|
||||
func apply_outcome(choice: String) -> void:
|
||||
GameState.set_story_flag("materialraum_hinterhalt_done", true)
|
||||
while StorySystem.get_cassian_escalation() < StorySystem.CASSIAN_ESCALATION_MAX:
|
||||
StorySystem.escalate_cassian()
|
||||
if choice == "blade":
|
||||
StorySystem.set_cassian_outcome("blade")
|
||||
StorySystem.adjust_wren_trust(-40)
|
||||
GameState.shift_humanity(-3)
|
||||
GameState.set_story_flag("wren_angst", true)
|
||||
_lay_cassian_down()
|
||||
_hide_schergen()
|
||||
else:
|
||||
StorySystem.set_cassian_outcome("heart")
|
||||
StorySystem.adjust_wren_trust(100)
|
||||
GameState.shift_humanity(3)
|
||||
GameState.set_story_flag("wren_loyal", true)
|
||||
GameState.increase_stat("strength", -HEART_STAT_MALUS)
|
||||
GameState.increase_stat("agility", -HEART_STAT_MALUS)
|
||||
GameState.set_story_flag("heart_stat_malus", HEART_STAT_MALUS)
|
||||
_cassian.visible = false
|
||||
_hide_schergen()
|
||||
|
||||
|
||||
## Führt die QTE-Stufen aus; true, wenn alle bestanden wurden.
|
||||
func _run_qte() -> bool:
|
||||
_ensure_qte_ui()
|
||||
_qte_layer.visible = true
|
||||
var is_all_passed := true
|
||||
for i in QTE_STAGES:
|
||||
var stage: Dictionary = QTE_ACTIONS.pick_random()
|
||||
_is_stage_passed = false
|
||||
_is_stage_failed = false
|
||||
_qte_label.text = "%s — %s" % [str(stage["label"]), InputPrompts.prompt(str(stage["action"]))]
|
||||
_qte_expected_action = str(stage["action"])
|
||||
var timer := get_tree().create_timer(QTE_WINDOW_SECONDS)
|
||||
while timer.time_left > 0.0 and not _is_stage_passed and not _is_stage_failed:
|
||||
await get_tree().process_frame
|
||||
_qte_expected_action = ""
|
||||
if not _is_stage_passed:
|
||||
is_all_passed = false
|
||||
break
|
||||
_qte_label.text = "!"
|
||||
await get_tree().create_timer(QTE_STAGE_GAP_SECONDS).timeout
|
||||
_qte_layer.visible = false
|
||||
return is_all_passed
|
||||
|
||||
|
||||
## Legt Cassians Mesh in Liegeposition (Klinge-Ausgang); der Root bleibt
|
||||
## aufrecht, damit Label und Sprechblase lesbar bleiben.
|
||||
func _lay_cassian_down() -> void:
|
||||
var mesh := _cassian.get_node_or_null("MeshInstance3D") as Node3D
|
||||
if mesh != null:
|
||||
mesh.rotation.z = PI / 2.0
|
||||
mesh.position.y = 0.4
|
||||
|
||||
|
||||
## Blendet die Schergen aus (sie fliehen).
|
||||
func _hide_schergen() -> void:
|
||||
for path in scherge_paths:
|
||||
var scherge := get_node_or_null(path) as Node3D
|
||||
if scherge != null:
|
||||
scherge.visible = false
|
||||
|
||||
|
||||
## Blendet alle Hinterhalt-Akteure ein oder aus.
|
||||
func _set_actors_visible(is_visible_now: bool) -> void:
|
||||
_cassian.visible = is_visible_now
|
||||
_wren.visible = is_visible_now
|
||||
for path in scherge_paths:
|
||||
var scherge := get_node_or_null(path) as Node3D
|
||||
if scherge != null:
|
||||
scherge.visible = is_visible_now
|
||||
|
||||
|
||||
## Baut die QTE-Anzeige beim ersten Bedarf.
|
||||
func _ensure_qte_ui() -> void:
|
||||
if _qte_layer != null:
|
||||
return
|
||||
_qte_layer = CanvasLayer.new()
|
||||
_qte_layer.layer = 3
|
||||
var root := Control.new()
|
||||
root.set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
root.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
_qte_label = Label.new()
|
||||
_qte_label.set_anchors_preset(Control.PRESET_CENTER)
|
||||
_qte_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
_qte_label.add_theme_font_size_override("font_size", 42)
|
||||
_qte_label.add_theme_color_override("font_color", Color(1, 0.85, 0.4))
|
||||
_qte_label.add_theme_color_override("font_outline_color", Color.BLACK)
|
||||
_qte_label.add_theme_constant_override("outline_size", 8)
|
||||
root.add_child(_qte_label)
|
||||
_qte_layer.add_child(root)
|
||||
add_child(_qte_layer)
|
||||
_qte_layer.visible = false
|
||||
1
scripts/gameplay/cassian_ambush.gd.uid
Normal file
1
scripts/gameplay/cassian_ambush.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cn0oevoco6ymh
|
||||
127
scripts/gameplay/cassian_npc.gd
Normal file
127
scripts/gameplay/cassian_npc.gd
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
extends StaticBody3D
|
||||
## Cassian Vane am Hofrand (v1-Ausbau Phase 4, STORY.md §5,
|
||||
## CHARACTERS.md).
|
||||
##
|
||||
## Stationärer Antagonist: Er wandert nicht, er beobachtet. Der Dialog
|
||||
## hängt am Tageszyklus (STORY §5): Tag 1–3 die Hetze (cassian_intro),
|
||||
## Tag 4–6 das Angebot (cassian_angebot), Tag 7–8 die Warnung samt
|
||||
## Vorausdeutung auf den Materialraum (cassian_warnung). Nach jedem
|
||||
## Gespräch steigt die Cassian-Eskalationsstufe auf das Tages-Niveau.
|
||||
## Ab Tag 9 ist er fort (er wartet im Materialraum); nach dem
|
||||
## Hinterhalt-Ausgang (Cassian-Outcome gesetzt) taucht er nie wieder am
|
||||
## Hof auf.
|
||||
|
||||
const INTRO_PATH := "res://data/dialogue/cassian_intro.json"
|
||||
const ANGEBOT_PATH := "res://data/dialogue/cassian_angebot.json"
|
||||
const WARNUNG_PATH := "res://data/dialogue/cassian_warnung.json"
|
||||
|
||||
@export var npc_id := "cassian"
|
||||
|
||||
var _is_player_in_range := false
|
||||
var _is_in_dialogue := false
|
||||
|
||||
@onready var _prompt_label: Label3D = $PromptLabel
|
||||
@onready var _interaction_area: Area3D = $InteractionArea
|
||||
@onready var _mesh: MeshInstance3D = $MeshInstance3D
|
||||
|
||||
|
||||
## Verbindet Signale und richtet die Anwesenheit nach Tag/Ausgang aus.
|
||||
func _ready() -> void:
|
||||
_interaction_area.body_entered.connect(_on_body_entered)
|
||||
_interaction_area.body_exited.connect(_on_body_exited)
|
||||
DialogueSystem.dialogue_started.connect(_on_dialogue_started)
|
||||
DialogueSystem.dialogue_finished.connect(_on_dialogue_finished)
|
||||
TimeSystem.day_ended.connect(func(_day: int) -> void: _update_presence())
|
||||
_update_presence()
|
||||
|
||||
|
||||
## Startet den tagesabhängigen Dialog bei interact in Reichweite.
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if not visible or not _is_player_in_range:
|
||||
return
|
||||
if DialogueSystem.is_dialogue_active:
|
||||
return
|
||||
if not event.is_action_pressed("interact"):
|
||||
return
|
||||
var path := _dialogue_path_for_day(TimeSystem.day_count)
|
||||
if path.is_empty():
|
||||
return
|
||||
var player := get_tree().get_first_node_in_group("player")
|
||||
if player == null:
|
||||
return
|
||||
DialogueSystem.start_dialogue(path, {
|
||||
npc_id: self,
|
||||
DialogueSystem.PLAYER_SPEAKER_ID: player,
|
||||
})
|
||||
|
||||
|
||||
## Liefert den Dialogbaum für den Tag ("" = keiner).
|
||||
func _dialogue_path_for_day(day: int) -> String:
|
||||
if day <= 3:
|
||||
return INTRO_PATH
|
||||
if day <= 6:
|
||||
return ANGEBOT_PATH
|
||||
if day <= 8:
|
||||
return WARNUNG_PATH
|
||||
return ""
|
||||
|
||||
|
||||
## Liefert die Eskalationsstufe, die der Tag rechtfertigt.
|
||||
func _escalation_tier_for_day(day: int) -> int:
|
||||
if day <= 3:
|
||||
return 1
|
||||
if day <= 6:
|
||||
return 2
|
||||
return 3
|
||||
|
||||
|
||||
## Merkt sich beim Dialog-Start, ob Cassian Sprecher ist (bei
|
||||
## dialogue_finished sind die Sprecher bereits geleert).
|
||||
func _on_dialogue_started(_dialogue_id: String) -> void:
|
||||
if DialogueSystem.is_speaker(self):
|
||||
_is_in_dialogue = true
|
||||
_update_prompt()
|
||||
|
||||
|
||||
## Hebt nach einem Gespräch mit Cassian die Eskalation auf das
|
||||
## Tages-Niveau und aktualisiert den Prompt.
|
||||
func _on_dialogue_finished(_dialogue_id: String) -> void:
|
||||
if _is_in_dialogue:
|
||||
_is_in_dialogue = false
|
||||
var tier := _escalation_tier_for_day(TimeSystem.day_count)
|
||||
while StorySystem.get_cassian_escalation() < tier:
|
||||
StorySystem.escalate_cassian()
|
||||
_update_prompt()
|
||||
|
||||
|
||||
## Blendet Cassian aus, sobald er laut Story nicht mehr am Hof steht
|
||||
## (ab Tag 9 bzw. nach dem Hinterhalt-Ausgang).
|
||||
func _update_presence() -> void:
|
||||
var is_present: bool = TimeSystem.day_count <= 8 and StorySystem.get_cassian_outcome() == "none"
|
||||
visible = is_present
|
||||
_interaction_area.monitoring = is_present
|
||||
if not is_present:
|
||||
_is_player_in_range = false
|
||||
_prompt_label.visible = false
|
||||
|
||||
|
||||
## Blendet den Prompt ein, sobald der Spieler die Reichweite betritt,
|
||||
## und dreht Cassian dem Spieler zu — er sieht dich immer kommen.
|
||||
func _on_body_entered(body: Node3D) -> void:
|
||||
_is_player_in_range = true
|
||||
var direction := body.global_position - global_position
|
||||
direction.y = 0.0
|
||||
if direction.length_squared() > 0.01:
|
||||
_mesh.rotation.y = atan2(-direction.x, -direction.z)
|
||||
_update_prompt()
|
||||
|
||||
|
||||
## Blendet den Prompt aus, wenn der Spieler die Reichweite verlässt.
|
||||
func _on_body_exited(_body: Node3D) -> void:
|
||||
_is_player_in_range = false
|
||||
_update_prompt()
|
||||
|
||||
|
||||
## Zeigt den Prompt nur in Reichweite, außerhalb laufender Dialoge.
|
||||
func _update_prompt() -> void:
|
||||
_prompt_label.visible = visible and _is_player_in_range and not DialogueSystem.is_dialogue_active
|
||||
1
scripts/gameplay/cassian_npc.gd.uid
Normal file
1
scripts/gameplay/cassian_npc.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dtkwpxakkuhjk
|
||||
131
scripts/gameplay/threat_note.gd
Normal file
131
scripts/gameplay/threat_note.gd
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
extends StaticBody3D
|
||||
## Drohnotiz an Wren (v1-Ausbau Phase 4, STORY.md §5 Tag 4–6).
|
||||
##
|
||||
## Cassians psychologische Kriegsführung als aufhebbares Item: An den
|
||||
## Tagen 4–6 liegt eine zerknüllte Notiz im Hof (in Wrens Nähe). Interact
|
||||
## öffnet ein Popup mit dem Tages-Text aus data/story/threat_notes.json;
|
||||
## Schließen über interact/cancel. Jede gelesene Notiz setzt ein
|
||||
## persistentes Story-Flag (drohnotiz_tag_N) und verschwindet für den
|
||||
## Rest des Tages. Außerhalb des Fensters ist die Notiz unsichtbar.
|
||||
|
||||
const NOTES_PATH := "res://data/story/threat_notes.json"
|
||||
|
||||
var _notes: Dictionary = {}
|
||||
var _is_player_in_range := false
|
||||
var _popup_layer: CanvasLayer
|
||||
var _popup_label: Label
|
||||
|
||||
@onready var _prompt_label: Label3D = $PromptLabel
|
||||
@onready var _interaction_area: Area3D = $InteractionArea
|
||||
|
||||
|
||||
## Lädt die Notiz-Texte, verbindet Signale und richtet die Anwesenheit aus.
|
||||
func _ready() -> void:
|
||||
var file := FileAccess.open(NOTES_PATH, FileAccess.READ)
|
||||
if file != null:
|
||||
var parsed: Variant = JSON.parse_string(file.get_as_text())
|
||||
if parsed is Dictionary and parsed.get("notes") is Dictionary:
|
||||
_notes = parsed["notes"]
|
||||
_interaction_area.body_entered.connect(_on_body_entered)
|
||||
_interaction_area.body_exited.connect(_on_body_exited)
|
||||
TimeSystem.day_ended.connect(func(_day: int) -> void: _update_presence())
|
||||
_update_presence()
|
||||
|
||||
|
||||
## Öffnet das Popup bei interact in Reichweite; ein offenes Popup wird
|
||||
## mit interact oder cancel geschlossen (aller Input dabei geschluckt).
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if _popup_layer != null and _popup_layer.visible:
|
||||
if event.is_action_pressed("interact") or event.is_action_pressed("cancel"):
|
||||
_close_popup()
|
||||
get_viewport().set_input_as_handled()
|
||||
return
|
||||
if not visible or not _is_player_in_range:
|
||||
return
|
||||
if DialogueSystem.is_dialogue_active:
|
||||
return
|
||||
if event.is_action_pressed("interact"):
|
||||
_open_popup()
|
||||
|
||||
|
||||
## Zeigt die Tages-Notiz als Popup, sperrt die Steuerung und merkt das
|
||||
## Lese-Flag.
|
||||
func _open_popup() -> void:
|
||||
var note_text := str(_notes.get(str(TimeSystem.day_count), ""))
|
||||
if note_text.is_empty():
|
||||
return
|
||||
_ensure_popup()
|
||||
_popup_label.text = "Zerknüllte Notiz — an Wren:\n\n„%s\"\n\n%s Weglegen" % [note_text, InputPrompts.prompt("interact")]
|
||||
_popup_layer.visible = true
|
||||
GameState.set_story_flag("drohnotiz_tag_%d" % TimeSystem.day_count, true)
|
||||
var player := get_tree().get_first_node_in_group("player")
|
||||
if player != null:
|
||||
player.set_control_locked(true)
|
||||
|
||||
|
||||
## Schließt das Popup, gibt die Steuerung frei und versteckt die Notiz
|
||||
## für den Rest des Tages.
|
||||
func _close_popup() -> void:
|
||||
_popup_layer.visible = false
|
||||
var player := get_tree().get_first_node_in_group("player")
|
||||
if player != null:
|
||||
player.set_control_locked(false)
|
||||
_update_presence()
|
||||
|
||||
|
||||
## Meldet, ob das Notiz-Popup gerade offen ist (für Tests).
|
||||
func is_popup_open() -> bool:
|
||||
return _popup_layer != null and _popup_layer.visible
|
||||
|
||||
|
||||
## Sichtbar nur an Notiz-Tagen, solange die Tages-Notiz ungelesen ist.
|
||||
func _update_presence() -> void:
|
||||
var day := TimeSystem.day_count
|
||||
var has_note := _notes.has(str(day))
|
||||
var is_read := bool(GameState.get_story_flag("drohnotiz_tag_%d" % day, false))
|
||||
var is_present := has_note and not is_read
|
||||
visible = is_present
|
||||
_interaction_area.monitoring = is_present
|
||||
if not is_present:
|
||||
_is_player_in_range = false
|
||||
_prompt_label.visible = false
|
||||
|
||||
|
||||
## Baut das Popup (dunkle Tafel mit Text) beim ersten Bedarf.
|
||||
func _ensure_popup() -> void:
|
||||
if _popup_layer != null:
|
||||
return
|
||||
_popup_layer = CanvasLayer.new()
|
||||
_popup_layer.layer = 4
|
||||
var root := Control.new()
|
||||
root.set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
root.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
var panel := ColorRect.new()
|
||||
panel.set_anchors_preset(Control.PRESET_CENTER)
|
||||
panel.custom_minimum_size = Vector2(640, 260)
|
||||
panel.position -= Vector2(320, 130)
|
||||
panel.color = Color(0.08, 0.07, 0.06, 0.95)
|
||||
root.add_child(panel)
|
||||
_popup_label = Label.new()
|
||||
_popup_label.set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
_popup_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
_popup_label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||
_popup_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
_popup_label.add_theme_font_size_override("font_size", 24)
|
||||
_popup_label.add_theme_color_override("font_color", Color(0.92, 0.88, 0.8))
|
||||
panel.add_child(_popup_label)
|
||||
_popup_layer.add_child(root)
|
||||
add_child(_popup_layer)
|
||||
_popup_layer.visible = false
|
||||
|
||||
|
||||
## Blendet den Prompt ein, sobald der Spieler die Reichweite betritt.
|
||||
func _on_body_entered(_body: Node3D) -> void:
|
||||
_is_player_in_range = true
|
||||
_prompt_label.visible = visible
|
||||
|
||||
|
||||
## Blendet den Prompt aus, wenn der Spieler die Reichweite verlässt.
|
||||
func _on_body_exited(_body: Node3D) -> void:
|
||||
_is_player_in_range = false
|
||||
_prompt_label.visible = false
|
||||
1
scripts/gameplay/threat_note.gd.uid
Normal file
1
scripts/gameplay/threat_note.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bq8ljs3su4r6l
|
||||
Loading…
Add table
Add a link
Reference in a new issue