diff --git a/docs/CHANGEREQUESTS_DONE.md b/docs/CHANGEREQUESTS_DONE.md index 5cf7cd8..b6e6fd5 100644 --- a/docs/CHANGEREQUESTS_DONE.md +++ b/docs/CHANGEREQUESTS_DONE.md @@ -3,6 +3,53 @@ > Abgearbeitete Change Requests aus CHANGEREQUESTS.md, mit Datum und > Anmerkung, was geändert wurde. +## 2026-07-07 — Abspann-Screen hing in der Ecke + +**Request:** „der letzte Screen nach dem Fliegen hängt unten links in der +Ecke" + +**Umsetzung:** Der Ende-Bildschirm des Epilogs wurde in einen +CenterContainer (voller Bildschirm) gelegt, statt den VBoxContainer nur +per Anker auf die Mitte zu setzen (was ihn zur Ecke rutschen ließ). Titel, +Text und der „Zurück zum Hauptmenü"-Button stehen jetzt sauber zentriert. +Headless verifiziert (Button horizontal mittig). + +## 2026-07-07 — CR-001: Viadukt buchgetreu + Wind-, Regen- & Balance-QTE + +**Request:** Viadukt buchnah (Fourth Wing) umbauen: schmaler Steinsteg +ohne Geländer über Nebelschlucht, konstanter Seitenwind mit Böen, +Regen-Chance und ein Rutsch-QTE mit Gegensteuern (A/D bzw. Controller). + +**Umsetzung:** Das alte ~220-m-Parcours-Viadukt wurde durch einen schmalen, +geraden Steinsteg ersetzt, der prozedural aus `bridge_width` (Export, +Default 0,8 m — 0,45 m ist buchgetreu, aber brutal; im Editor tunebar) +und `bridge_length` gebaut wird. Kein Geländer, WorldEnvironment-Nebel +verdeckt die Schlucht, eine breite KillZone fängt Stürze zu beiden Seiten. +Drei eigenständige, signalbasierte Komponenten am Szenen-Root: +- `wind_controller.gd`: konstante Seitenkraft + periodische Böen + (gust_interval_min/max, gust_strength_mult, gust_duration), schiebt über + das neue `player.external_push`; ruht bei Dialog/Kamera-Schwenk und + abseits des Stegs; meldet `gust_started`. +- `weather_controller.gd`: würfelt beim Betreten `rain_chance` (Default + 0,3), Regenpartikel folgen dem Spieler, nasser Stein erhöht die + Rutsch-Chance und verkürzt das QTE-Fenster; meldet `rain_started`. +- `balance_qte.gd`: pro Bö Rutsch-Wurf + (slip_base_chance * gust_factor * rain_factor); bei Rutsch friert die + Steuerung ein (greybox-Slow-Motion, bewusst KEIN globales + Engine.time_scale), Prompt zeigt die Gegensteuer-Taste (A / Stick links + bzw. D / Stick rechts), Reaktionsfenster `qte_window`, mehrere Taps über + `qte_tap_count`. Erfolg = weiterlaufen; Fehlschlag (falsche Taste / zu + spät) stößt vom Steg → Sturz in die KillZone → bestehende + Death/Respawn-Logik (Game Over bei Permadeath AN, sonst Respawn am + Checkpoint). Alle Werte als @export tunebar; Signale slip_triggered, + qte_succeeded, qte_failed. +Der Wren-Moment (nicht abbrechbarer Straucheln-Dialog, Story-Flag) bleibt +erhalten: Wren läuft voraus, das Straucheln löst beim Einholen aus. +Der optionale 250-Stufen-Turmaufstieg vor dem Steg ist bewusst NICHT +enthalten (eigener CR bei Bedarf). Headless verifiziert (27 Checks): +Geometrie/Nebel, Wind nur auf dem Steg, forcierter Regen, QTE-Erfolg per +Gegensteuern, QTE-Fehlschlag mit Sturz + Respawn, Wren-Moment. + ## 2026-07-07 — Sprechblasen-Texte zusätzlich als Untertitel am unteren Rand **Request:** „Alle Gespräche alles was über den Köpfen steht muss auch diff --git a/scenes/viaduct/viaduct.tscn b/scenes/viaduct/viaduct.tscn index 37adf3a..fb5ebc0 100644 --- a/scenes/viaduct/viaduct.tscn +++ b/scenes/viaduct/viaduct.tscn @@ -1,14 +1,17 @@ -[gd_scene load_steps=52 format=3] +[gd_scene load_steps=25 format=3] [ext_resource type="Script" path="res://scripts/gameplay/viaduct.gd" id="1_viaduct"] [ext_resource type="PackedScene" path="res://scenes/player.tscn" id="2_player"] [ext_resource type="PackedScene" path="res://scenes/ui/debug_overlay.tscn" id="3_debug"] [ext_resource type="Script" path="res://scripts/gameplay/zone_trigger.gd" id="4_zone"] [ext_resource type="PackedScene" path="res://scenes/ui/speech_bubble.tscn" id="5_bubble"] +[ext_resource type="Script" path="res://scripts/gameplay/wind_controller.gd" id="6_wind"] +[ext_resource type="Script" path="res://scripts/gameplay/weather_controller.gd" id="7_weather"] +[ext_resource type="Script" path="res://scripts/gameplay/balance_qte.gd" id="8_qte"] [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_sky"] -sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1) -ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1) +sky_horizon_color = Color(0.62, 0.63, 0.66, 1) +ground_horizon_color = Color(0.62, 0.63, 0.66, 1) [sub_resource type="Sky" id="Sky_sky"] sky_material = SubResource("ProceduralSkyMaterial_sky") @@ -17,6 +20,10 @@ sky_material = SubResource("ProceduralSkyMaterial_sky") background_mode = 2 sky = SubResource("Sky_sky") tonemap_mode = 2 +fog_enabled = true +fog_light_color = Color(0.66, 0.67, 0.7, 1) +fog_density = 0.04 +fog_aerial_perspective = 0.5 [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_stone"] albedo_color = Color(0.45, 0.44, 0.42, 1) @@ -28,117 +35,11 @@ size = Vector3(8, 1, 8) material = SubResource("StandardMaterial3D_stone") size = Vector3(8, 1, 8) -[sub_resource type="BoxShape3D" id="BoxShape3D_walk20"] -size = Vector3(2, 1, 20) +[sub_resource type="BoxShape3D" id="BoxShape3D_killzone"] +size = Vector3(60, 6, 120) -[sub_resource type="BoxMesh" id="BoxMesh_walk20"] -material = SubResource("StandardMaterial3D_stone") -size = Vector3(2, 1, 20) - -[sub_resource type="BoxShape3D" id="BoxShape3D_walk8"] -size = Vector3(2, 1, 8) - -[sub_resource type="BoxMesh" id="BoxMesh_walk8"] -material = SubResource("StandardMaterial3D_stone") -size = Vector3(2, 1, 8) - -[sub_resource type="BoxShape3D" id="BoxShape3D_walk6"] -size = Vector3(2, 1, 6) - -[sub_resource type="BoxMesh" id="BoxMesh_walk6"] -material = SubResource("StandardMaterial3D_stone") -size = Vector3(2, 1, 6) - -[sub_resource type="BoxShape3D" id="BoxShape3D_rail"] -size = Vector3(0.3, 1, 4) - -[sub_resource type="BoxMesh" id="BoxMesh_rail"] -material = SubResource("StandardMaterial3D_stone") -size = Vector3(0.3, 1, 4) - -[sub_resource type="BoxShape3D" id="BoxShape3D_wall2"] -size = Vector3(2, 2, 2) - -[sub_resource type="BoxMesh" id="BoxMesh_wall2"] -material = SubResource("StandardMaterial3D_stone") -size = Vector3(2, 2, 2) - -[sub_resource type="BoxShape3D" id="BoxShape3D_trans4"] -size = Vector3(4, 1, 4) - -[sub_resource type="BoxMesh" id="BoxMesh_trans4"] -material = SubResource("StandardMaterial3D_stone") -size = Vector3(4, 1, 4) - -[sub_resource type="BoxShape3D" id="BoxShape3D_ledge32"] -size = Vector3(1, 1, 32) - -[sub_resource type="BoxMesh" id="BoxMesh_ledge32"] -material = SubResource("StandardMaterial3D_stone") -size = Vector3(1, 1, 32) - -[sub_resource type="BoxShape3D" id="BoxShape3D_sidewall"] -size = Vector3(3, 4, 32) - -[sub_resource type="BoxMesh" id="BoxMesh_sidewall"] -material = SubResource("StandardMaterial3D_stone") -size = Vector3(3, 4, 32) - -[sub_resource type="BoxShape3D" id="BoxShape3D_narrow18"] -size = Vector3(1, 1, 18) - -[sub_resource type="BoxMesh" id="BoxMesh_narrow18"] -material = SubResource("StandardMaterial3D_stone") -size = Vector3(1, 1, 18) - -[sub_resource type="BoxShape3D" id="BoxShape3D_cross6"] -size = Vector3(6, 1, 1) - -[sub_resource type="BoxMesh" id="BoxMesh_cross6"] -material = SubResource("StandardMaterial3D_stone") -size = Vector3(6, 1, 1) - -[sub_resource type="BoxShape3D" id="BoxShape3D_rest46"] -size = Vector3(4, 1, 6) - -[sub_resource type="BoxMesh" id="BoxMesh_rest46"] -material = SubResource("StandardMaterial3D_stone") -size = Vector3(4, 1, 6) - -[sub_resource type="BoxShape3D" id="BoxShape3D_elev2"] -size = Vector3(2, 2, 6) - -[sub_resource type="BoxMesh" id="BoxMesh_elev2"] -material = SubResource("StandardMaterial3D_stone") -size = Vector3(2, 2, 6) - -[sub_resource type="BoxShape3D" id="BoxShape3D_elev4"] -size = Vector3(2, 4, 6) - -[sub_resource type="BoxMesh" id="BoxMesh_elev4"] -material = SubResource("StandardMaterial3D_stone") -size = Vector3(2, 4, 6) - -[sub_resource type="BoxShape3D" id="BoxShape3D_island"] -size = Vector3(2, 1, 2) - -[sub_resource type="BoxMesh" id="BoxMesh_island"] -material = SubResource("StandardMaterial3D_stone") -size = Vector3(2, 1, 2) - -[sub_resource type="BoxShape3D" id="BoxShape3D_wide28"] -size = Vector3(4, 1, 28) - -[sub_resource type="BoxMesh" id="BoxMesh_wide28"] -material = SubResource("StandardMaterial3D_stone") -size = Vector3(4, 1, 28) - -[sub_resource type="BoxShape3D" id="BoxShape3D_conn4"] -size = Vector3(2, 1, 4) - -[sub_resource type="BoxMesh" id="BoxMesh_conn4"] -material = SubResource("StandardMaterial3D_stone") -size = Vector3(2, 1, 4) +[sub_resource type="BoxShape3D" id="BoxShape3D_checkpoint"] +size = Vector3(3, 2, 2) [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_wren"] albedo_color = Color(0.45, 0.72, 0.45, 1) @@ -163,11 +64,12 @@ size = Vector3(2, 2, 2) material = SubResource("StandardMaterial3D_trigger") size = Vector3(2, 2, 2) -[sub_resource type="BoxShape3D" id="BoxShape3D_killzone"] -size = Vector3(100, 6, 260) +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_rain"] +albedo_color = Color(0.6, 0.7, 0.85, 0.7) -[sub_resource type="BoxShape3D" id="BoxShape3D_checkpoint"] -size = Vector3(3, 2, 2) +[sub_resource type="BoxMesh" id="BoxMesh_rain"] +material = SubResource("StandardMaterial3D_rain") +size = Vector3(0.02, 0.5, 0.02) [node name="Viaduct" type="Node3D"] script = ExtResource("1_viaduct") @@ -188,242 +90,10 @@ shape = SubResource("BoxShape3D_platform8") [node name="MeshInstance3D" type="MeshInstance3D" parent="StartPlatform"] mesh = SubResource("BoxMesh_platform8") -[node name="WalkA" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, -14) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="WalkA"] -shape = SubResource("BoxShape3D_walk20") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="WalkA"] -mesh = SubResource("BoxMesh_walk20") - -[node name="RailA1" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.15, 0.5, -7) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="RailA1"] -shape = SubResource("BoxShape3D_rail") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="RailA1"] -mesh = SubResource("BoxMesh_rail") - -[node name="RailA2" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.15, 0.5, -12) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="RailA2"] -shape = SubResource("BoxShape3D_rail") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="RailA2"] -mesh = SubResource("BoxMesh_rail") - -[node name="RailA3" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.15, 0.5, -18) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="RailA3"] -shape = SubResource("BoxShape3D_rail") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="RailA3"] -mesh = SubResource("BoxMesh_rail") - -[node name="GapB1" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, -28) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="GapB1"] -shape = SubResource("BoxShape3D_walk8") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="GapB1"] -mesh = SubResource("BoxMesh_walk8") - -[node name="GapB2" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, -0.5, -37.6) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="GapB2"] -shape = SubResource("BoxShape3D_walk8") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="GapB2"] -mesh = SubResource("BoxMesh_walk8") - -[node name="GapB3" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, -0.5, -46.6) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="GapB3"] -shape = SubResource("BoxShape3D_walk6") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="GapB3"] -mesh = SubResource("BoxMesh_walk6") - -[node name="ClimbWallA" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 1, -50.6) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="ClimbWallA"] -shape = SubResource("BoxShape3D_wall2") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="ClimbWallA"] -mesh = SubResource("BoxMesh_wall2") - -[node name="WalkC" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, -0.5, -55.6) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="WalkC"] -shape = SubResource("BoxShape3D_walk8") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="WalkC"] -mesh = SubResource("BoxMesh_walk8") - -[node name="TransD" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, -0.5, -61.6) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="TransD"] -shape = SubResource("BoxShape3D_trans4") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="TransD"] -mesh = SubResource("BoxMesh_trans4") - -[node name="LedgeD" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, -79.6) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="LedgeD"] -shape = SubResource("BoxShape3D_ledge32") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="LedgeD"] -mesh = SubResource("BoxMesh_ledge32") - -[node name="SideWallD" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 1.5, -79.6) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="SideWallD"] -shape = SubResource("BoxShape3D_sidewall") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="SideWallD"] -mesh = SubResource("BoxMesh_sidewall") - -[node name="NarrowE1" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, -104.6) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="NarrowE1"] -shape = SubResource("BoxShape3D_narrow18") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="NarrowE1"] -mesh = SubResource("BoxMesh_narrow18") - -[node name="CrossE" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.5, -0.5, -114.1) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="CrossE"] -shape = SubResource("BoxShape3D_cross6") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="CrossE"] -mesh = SubResource("BoxMesh_cross6") - -[node name="NarrowE2" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, -0.5, -123.6) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="NarrowE2"] -shape = SubResource("BoxShape3D_narrow18") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="NarrowE2"] -mesh = SubResource("BoxMesh_narrow18") - -[node name="RestF" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, -0.5, -135.6) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="RestF"] -shape = SubResource("BoxShape3D_rest46") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="RestF"] -mesh = SubResource("BoxMesh_rest46") - -[node name="ClimbWallB" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 1, -139.6) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="ClimbWallB"] -shape = SubResource("BoxShape3D_wall2") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="ClimbWallB"] -mesh = SubResource("BoxMesh_wall2") - -[node name="ElevG1" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 1, -143.6) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="ElevG1"] -shape = SubResource("BoxShape3D_elev2") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="ElevG1"] -mesh = SubResource("BoxMesh_elev2") - -[node name="ClimbWallC" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 3, -147.6) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="ClimbWallC"] -shape = SubResource("BoxShape3D_wall2") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="ClimbWallC"] -mesh = SubResource("BoxMesh_wall2") - -[node name="ElevG2" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 2, -151.6) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="ElevG2"] -shape = SubResource("BoxShape3D_elev4") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="ElevG2"] -mesh = SubResource("BoxMesh_elev4") - -[node name="LandingG" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, -0.5, -158.6) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="LandingG"] -shape = SubResource("BoxShape3D_walk8") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="LandingG"] -mesh = SubResource("BoxMesh_walk8") - -[node name="IslandH1" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, -0.5, -165.1) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="IslandH1"] -shape = SubResource("BoxShape3D_island") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="IslandH1"] -mesh = SubResource("BoxMesh_island") - -[node name="IslandH2" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.5, -0.5, -169.1) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="IslandH2"] -shape = SubResource("BoxShape3D_island") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="IslandH2"] -mesh = SubResource("BoxMesh_island") - -[node name="WalkH" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, -0.5, -175.1) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="WalkH"] -shape = SubResource("BoxShape3D_walk8") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="WalkH"] -mesh = SubResource("BoxMesh_walk8") - -[node name="WideI" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, -0.5, -193.1) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="WideI"] -shape = SubResource("BoxShape3D_wide28") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="WideI"] -mesh = SubResource("BoxMesh_wide28") - -[node name="ConnJ" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, -0.5, -209.1) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="ConnJ"] -shape = SubResource("BoxShape3D_conn4") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="ConnJ"] -mesh = SubResource("BoxMesh_conn4") +[node name="Bridge" type="Node3D" parent="."] [node name="EndPlatform" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, -0.5, -215.1) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, -68) [node name="CollisionShape3D" type="CollisionShape3D" parent="EndPlatform"] shape = SubResource("BoxShape3D_platform8") @@ -432,7 +102,7 @@ shape = SubResource("BoxShape3D_platform8") mesh = SubResource("BoxMesh_platform8") [node name="Wren" type="StaticBody3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, -184) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -16) [node name="CollisionShape3D" type="CollisionShape3D" parent="Wren"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.9, 0) @@ -455,7 +125,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.8, 0) [node name="Checkpoints" type="Node3D" parent="."] [node name="Checkpoint1" type="Area3D" parent="Checkpoints"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -5) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -2) collision_layer = 0 collision_mask = 2 @@ -463,71 +133,45 @@ collision_mask = 2 shape = SubResource("BoxShape3D_checkpoint") [node name="Checkpoint2" type="Area3D" parent="Checkpoints"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -25) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -30) collision_layer = 0 collision_mask = 2 [node name="CollisionShape3D" type="CollisionShape3D" parent="Checkpoints/Checkpoint2"] shape = SubResource("BoxShape3D_checkpoint") -[node name="Checkpoint3" type="Area3D" parent="Checkpoints"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 1, -48) -collision_layer = 0 -collision_mask = 2 - -[node name="CollisionShape3D" type="CollisionShape3D" parent="Checkpoints/Checkpoint3"] -shape = SubResource("BoxShape3D_checkpoint") - -[node name="Checkpoint4" type="Area3D" parent="Checkpoints"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, -62) -collision_layer = 0 -collision_mask = 2 - -[node name="CollisionShape3D" type="CollisionShape3D" parent="Checkpoints/Checkpoint4"] -shape = SubResource("BoxShape3D_checkpoint") - -[node name="Checkpoint5" type="Area3D" parent="Checkpoints"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -97) -collision_layer = 0 -collision_mask = 2 - -[node name="CollisionShape3D" type="CollisionShape3D" parent="Checkpoints/Checkpoint5"] -shape = SubResource("BoxShape3D_checkpoint") - -[node name="Checkpoint6" type="Area3D" parent="Checkpoints"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 1, -134) -collision_layer = 0 -collision_mask = 2 - -[node name="CollisionShape3D" type="CollisionShape3D" parent="Checkpoints/Checkpoint6"] -shape = SubResource("BoxShape3D_checkpoint") - -[node name="Checkpoint7" type="Area3D" parent="Checkpoints"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 1, -157) -collision_layer = 0 -collision_mask = 2 - -[node name="CollisionShape3D" type="CollisionShape3D" parent="Checkpoints/Checkpoint7"] -shape = SubResource("BoxShape3D_checkpoint") - -[node name="Checkpoint8" type="Area3D" parent="Checkpoints"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 1, -181) -collision_layer = 0 -collision_mask = 2 - -[node name="CollisionShape3D" type="CollisionShape3D" parent="Checkpoints/Checkpoint8"] -shape = SubResource("BoxShape3D_checkpoint") - [node name="KillZone" type="Area3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, -10, -108) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -8, -34) collision_layer = 0 collision_mask = 2 [node name="CollisionShape3D" type="CollisionShape3D" parent="KillZone"] shape = SubResource("BoxShape3D_killzone") +[node name="WindController" type="Node" parent="."] +script = ExtResource("6_wind") + +[node name="WeatherController" type="Node3D" parent="."] +script = ExtResource("7_weather") + +[node name="RainParticles" type="CPUParticles3D" parent="WeatherController"] +emitting = false +amount = 240 +lifetime = 1.2 +mesh = SubResource("BoxMesh_rain") +emission_shape = 3 +emission_box_extents = Vector3(9, 0.5, 9) +direction = Vector3(0, -1, 0) +spread = 6.0 +gravity = Vector3(0, -50, 0) +initial_velocity_min = 10.0 +initial_velocity_max = 18.0 + +[node name="BalanceQTE" type="CanvasLayer" parent="."] +script = ExtResource("8_qte") + [node name="EndTrigger" type="Area3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 1, -216) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -70) collision_layer = 0 collision_mask = 2 script = ExtResource("4_zone") diff --git a/scripts/gameplay/balance_qte.gd b/scripts/gameplay/balance_qte.gd new file mode 100644 index 0000000..f16459f --- /dev/null +++ b/scripts/gameplay/balance_qte.gd @@ -0,0 +1,167 @@ +extends CanvasLayer +## Rutsch-QTE des Viadukts (CR-001). +## +## Lauscht auf die Böen des WindControllers. Pro Bö wird mit +## slip_chance = slip_base_chance * gust_factor * rain_factor gewürfelt, ob +## der Spieler ins Rutschen gerät. Beim Rutschen friert die Steuerung ein +## (greybox-Realisierung des Slow-Motion-Moments — bewusst KEIN globales +## Engine.time_scale, das den Rest bräche: der Spieler steht still und +## konzentriert sich auf das Gegensteuern), ein Prompt zeigt die +## Gegensteuer-Taste, und der Spieler muss innerhalb von qte_window in die +## Gegenrichtung drücken (A/move_left bzw. D/move_right — Tastatur wie +## linker Stick, da an dieselben Actions gebunden). Bei stärkeren Böen sind +## über qte_tap_count mehrere abwechselnde Taps nötig. Erfolg: der +## Charakter fängt sich. Fehlschlag (falsche Taste oder zu spät): der +## Spieler wird vom schmalen Steg gestoßen und stürzt in die KillZone — die +## bestehende Death/Respawn-Logik des Viadukts übernimmt. + +signal slip_triggered(direction: int) +signal qte_succeeded +signal qte_failed + +const GUST_REFERENCE := 2.75 + +@export var slip_base_chance := 0.55 +@export var qte_window := 0.9 +@export var qte_tap_count := 1 +@export var bridge_width := 0.8 +@export var fall_push := 1.2 + +var _player: CharacterBody3D +var _weather: Node +var _is_active := false +var _last_input_dir := 0 +var _label: Label + + +## Verknüpft Spieler, Wetter-Controller und Steg-Breite und baut den +## Prompt auf. +func setup(player: CharacterBody3D, weather: Node, width: float) -> void: + _player = player + _weather = weather + bridge_width = width + _build_ui() + + +## Verbindet die Böen des WindControllers mit dem Rutsch-Wurf. +func connect_wind(wind: Node) -> void: + wind.gust_started.connect(_on_gust_started) + + +## Meldet, ob gerade ein QTE läuft (auch für Tests). +func is_active() -> bool: + return _is_active + + +## Zeichnet während eines aktiven QTE die zuletzt gedrückte Seitenrichtung +## auf; der Player ist dann gesperrt, sodass die Eingabe hier ankommt. +func _unhandled_input(event: InputEvent) -> void: + if not _is_active: + return + if event.is_action_pressed("move_left"): + _last_input_dir = -1 + elif event.is_action_pressed("move_right"): + _last_input_dir = 1 + + +## Würfelt bei einer Bö, ob der Spieler rutscht, und startet dann das QTE. +func _on_gust_started(direction: int, strength_mult: float) -> void: + if _is_active or _player == null: + return + if DialogueSystem.is_dialogue_active or _player.is_control_locked(): + return + var rain_factor := 1.0 + if _weather != null: + rain_factor = _weather.slip_multiplier() + var slip := clampf(slip_base_chance * (strength_mult / GUST_REFERENCE) * rain_factor, 0.0, 0.95) + if randf() > slip: + return + _run_qte(direction) + + +## Spielt das QTE als Coroutine ab: Steuerung sperren, je Tap die +## Gegensteuer-Taste anzeigen und im Zeitfenster abfragen, dann auflösen. +func _run_qte(slip_dir: int) -> void: + _is_active = true + slip_triggered.emit(slip_dir) + _player.set_control_locked(true) + var window := qte_window + if _weather != null: + window *= _weather.window_multiplier() + var counter := -slip_dir + var taps: int = maxi(qte_tap_count, 1) + for i in taps: + _last_input_dir = 0 + _show_prompt(counter) + var is_ok := await _await_tap(counter, window) + if not is_ok: + _fail(slip_dir) + return + counter = -counter + _succeed() + + +## Wartet innerhalb des Fensters auf den korrekten Gegensteuer-Tap; die +## falsche Richtung scheitert sofort, Ablauf des Fensters ebenfalls. +func _await_tap(expected: int, window: float) -> bool: + var start := Time.get_ticks_msec() + while float(Time.get_ticks_msec() - start) / 1000.0 < window: + if _last_input_dir == expected: + return true + if _last_input_dir == -expected: + return false + await get_tree().physics_frame + return false + + +## Erfolg: Prompt aus, Steuerung frei, der Charakter fängt sich. +func _succeed() -> void: + _hide_prompt() + _is_active = false + _player.set_control_locked(false) + qte_succeeded.emit() + + +## Fehlschlag: Prompt aus, Steuerung frei, und der Spieler wird über die +## schmale Stegkante gestoßen — er fällt in die KillZone, die die +## bestehende Death/Respawn-Logik auslöst. +func _fail(slip_dir: int) -> void: + _hide_prompt() + _is_active = false + _player.set_control_locked(false) + qte_failed.emit() + _player.external_push = Vector3.ZERO + _player.velocity = Vector3.ZERO + _player.global_position.x += float(slip_dir) * (bridge_width * 0.5 + fall_push) + + +## Baut die zentrierte Prompt-Anzeige (versteckt). +func _build_ui() -> void: + layer = 3 + var root := Control.new() + root.set_anchors_preset(Control.PRESET_FULL_RECT) + root.mouse_filter = Control.MOUSE_FILTER_IGNORE + _label = Label.new() + _label.set_anchors_preset(Control.PRESET_CENTER) + _label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER + _label.add_theme_font_size_override("font_size", 40) + _label.add_theme_color_override("font_color", Color(1, 0.85, 0.4)) + _label.add_theme_color_override("font_outline_color", Color.BLACK) + _label.add_theme_constant_override("outline_size", 8) + _label.visible = false + root.add_child(_label) + add_child(root) + + +## Zeigt die Gegensteuer-Aufforderung mit Tastatur- und Controller-Hinweis. +func _show_prompt(counter: int) -> void: + if counter < 0: + _label.text = "◄ GEGENSTEUERN — A / Stick links" + else: + _label.text = "GEGENSTEUERN ► — D / Stick rechts" + _label.visible = true + + +## Blendet die Prompt-Anzeige aus. +func _hide_prompt() -> void: + _label.visible = false diff --git a/scripts/gameplay/balance_qte.gd.uid b/scripts/gameplay/balance_qte.gd.uid new file mode 100644 index 0000000..9f33d57 --- /dev/null +++ b/scripts/gameplay/balance_qte.gd.uid @@ -0,0 +1 @@ +uid://bnt5y8egemhk5 diff --git a/scripts/gameplay/epilogue.gd b/scripts/gameplay/epilogue.gd index 4dc5ac1..4c2320c 100644 --- a/scripts/gameplay/epilogue.gd +++ b/scripts/gameplay/epilogue.gd @@ -62,8 +62,10 @@ func _show_end_screen() -> void: var root := ColorRect.new() root.set_anchors_preset(Control.PRESET_FULL_RECT) root.color = Color(0.05, 0.06, 0.08, 0.92) + var center := CenterContainer.new() + center.set_anchors_preset(Control.PRESET_FULL_RECT) + root.add_child(center) var box := VBoxContainer.new() - box.set_anchors_preset(Control.PRESET_CENTER) box.add_theme_constant_override("separation", 18) var title := Label.new() title.text = "WINDGESCHWOREN" @@ -80,7 +82,7 @@ func _show_end_screen() -> void: _menu_button.custom_minimum_size = Vector2(280, 48) _menu_button.pressed.connect(_on_menu_pressed) box.add_child(_menu_button) - root.add_child(box) + center.add_child(box) _end_layer.add_child(root) add_child(_end_layer) _menu_button.grab_focus.call_deferred() diff --git a/scripts/gameplay/player.gd b/scripts/gameplay/player.gd index 7fd33a8..7b553d5 100644 --- a/scripts/gameplay/player.gd +++ b/scripts/gameplay/player.gd @@ -55,6 +55,7 @@ const PAN_DURATION := 3.0 var _state := MovementState.NORMAL var _is_dialogue_locked := false var _is_panning := false +var external_push := Vector3.ZERO var _target_zoom := 9.0 var _gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity") var _slide_direction := Vector3.ZERO @@ -141,6 +142,12 @@ func set_control_locked(is_locked: bool) -> void: _is_dialogue_locked = is_locked +## Gibt zurück, ob die Steuerung gerade gesperrt ist (Dialog, Kamera- +## Schwenk, QTE). Das Wind-/Balance-System des Viadukts pausiert dann. +func is_control_locked() -> bool: + return _is_dialogue_locked + + ## Spielt einen kurzen cineastischen Kamera-Schwenk für Set-Pieces ## (SPEC Abschnitt 2): Die Kamera startet weit draußen und seitlich und ## fährt weich in die Standard-Third-Person-Ansicht zurück; die Steuerung @@ -207,6 +214,8 @@ func _process_normal(delta: float) -> void: else: velocity.x = move_toward(velocity.x, 0.0, STOP_SPEED * delta) velocity.z = move_toward(velocity.z, 0.0, STOP_SPEED * delta) + velocity.x += external_push.x + velocity.z += external_push.z move_and_slide() if is_on_floor() and Input.is_action_just_pressed("slide"): _try_start_slide() diff --git a/scripts/gameplay/viaduct.gd b/scripts/gameplay/viaduct.gd index 65ced2c..49b3723 100644 --- a/scripts/gameplay/viaduct.gd +++ b/scripts/gameplay/viaduct.gd @@ -1,44 +1,88 @@ extends Node3D -## Ablauf-Steuerung des Viadukt-Set-Pieces (Phase 3 + Change Requests, -## STORY.md Prolog). +## Ablauf-Steuerung des Viadukts (CR-001: buchgetreuer Umbau, STORY.md +## Prolog). ## -## Spielt beim Betreten den cineastischen Kamera-Schwenk (SPEC Abschnitt -## 2), verwaltet die Segment-Checkpoints und die KillZone unter dem Steg: -## Bei Permadeath AN führt ein Sturz zum Game Over (zurück ins -## Hauptmenü), bei Permadeath AUS zum Respawn am zuletzt erreichten -## Checkpoint. Wren läuft vor dem Spieler das Viadukt entlang und bleibt -## an der kippenden Platte stehen; holt Tyrveil ihn ein -## (WREN_TRIGGER_DISTANCE), löst das Straucheln als nicht abbrechbarer -## Dialog aus (viaduct_wren.json) — beide Optionen retten Wren, die Wahl -## landet als Story-Flag im GameState. Der Übergang am Ende ist ein -## Platzhalter Richtung Reiterquadrant. +## Buchnah nach Fourth Wing: ein schmaler Steinsteg ohne Geländer über +## einer Nebelschlucht — Absturz bedeutet Tod. Der Steg wird prozedural +## aus bridge_width/bridge_length gebaut, damit die Breite im Editor +## tunebar bleibt (0.45 m ist buchgetreu, aber brutal; Startwert 0.8 m). +## Drei eigenständige Komponenten am Szenen-Root steuern die Gefahr: +## WindController (konstanter Seitenwind + Böen), WeatherController +## (Regen-Chance verschärft Balance) und BalanceQTE (Rutsch-QTE mit +## Gegensteuern). Beim Betreten läuft der cineastische Kamera-Schwenk +## (SPEC Abschnitt 2). Wren läuft voraus und strauchelt beim Einholen +## (nicht abbrechbarer Dialog, Story-Flag viaduct_wren_rescue). Ein Sturz +## in die KillZone bedeutet bei Permadeath AN Game Over, sonst Respawn am +## letzten Checkpoint. Optionaler Vorlauf (250-Stufen-Turmaufstieg vor dem +## Steg) ist bewusst NICHT Teil dieses CR — bei Bedarf eigener CR. const MAIN_MENU_SCENE := "res://scenes/ui/main_menu.tscn" const WREN_DIALOGUE_PATH := "res://data/dialogue/viaduct_wren.json" const WREN_WALK_SPEED := 1.2 -const WREN_STALL_Z := -202.0 +const WREN_STALL_Z := -44.0 const WREN_TRIGGER_DISTANCE := 3.5 +const BRIDGE_FRONT_Z := -4.0 + +@export var bridge_width := 0.8 +@export var bridge_length := 60.0 var _checkpoint_position := Vector3.ZERO var _has_wren_triggered := false var _player: CharacterBody3D @onready var _wren: Node3D = $Wren +@onready var _wind: Node = $WindController +@onready var _weather: Node3D = $WeatherController +@onready var _qte: CanvasLayer = $BalanceQTE -## Merkt den Startpunkt als ersten Checkpoint, verbindet Checkpoints und -## KillZone und spielt den Kamera-Schwenk. +## Baut den Steg, merkt den Startpunkt als Checkpoint, verbindet +## Checkpoints und KillZone, verdrahtet Wind/Wetter/QTE und spielt den +## Kamera-Schwenk. func _ready() -> void: + _build_bridge() _player = get_tree().get_first_node_in_group("player") - if _player != null: - _checkpoint_position = _player.global_position - _player.play_camera_pan() for checkpoint in $Checkpoints.get_children(): checkpoint.body_entered.connect(_on_checkpoint_entered.bind(checkpoint)) $KillZone.body_entered.connect(_on_kill_zone_entered) + if _player == null: + return + _checkpoint_position = _player.global_position + var bridge_end_z := BRIDGE_FRONT_Z - bridge_length + _wind.setup(_player, BRIDGE_FRONT_Z + 1.0, bridge_end_z - 1.0) + _weather.setup(_player) + _qte.setup(_player, _weather, bridge_width) + _qte.connect_wind(_wind) + _weather.roll_weather() + _player.play_camera_pan() -## Lässt Wren das Viadukt entlanggehen, bis er an der kippenden Platte +## Erzeugt die schmale Steg-Geometrie (Kollision + Mesh) prozedural aus +## bridge_width/bridge_length, damit die Breite tunebar bleibt. +func _build_bridge() -> void: + var center_z := BRIDGE_FRONT_Z - bridge_length / 2.0 + var body := StaticBody3D.new() + body.name = "BridgeSpan" + body.position = Vector3(0.0, -0.5, center_z) + var shape := CollisionShape3D.new() + shape.name = "CollisionShape3D" + var box := BoxShape3D.new() + box.size = Vector3(bridge_width, 1.0, bridge_length) + shape.shape = box + body.add_child(shape) + var mesh_instance := MeshInstance3D.new() + mesh_instance.name = "MeshInstance3D" + var box_mesh := BoxMesh.new() + box_mesh.size = Vector3(bridge_width, 1.0, bridge_length) + var material := StandardMaterial3D.new() + material.albedo_color = Color(0.45, 0.44, 0.42) + box_mesh.material = material + mesh_instance.mesh = box_mesh + body.add_child(mesh_instance) + $Bridge.add_child(body) + + +## Lässt Wren den Steg entlanggehen, bis er an der schwankenden Stelle ## stehen bleibt, und löst das Straucheln aus, sobald Tyrveil ihn einholt. func _physics_process(delta: float) -> void: if _has_wren_triggered or _player == null: @@ -55,15 +99,15 @@ func _physics_process(delta: float) -> void: }) -## Setzt den Respawn-Punkt auf den erreichten Segment-Checkpoint. +## Setzt den Respawn-Punkt auf den erreichten Checkpoint. func _on_checkpoint_entered(body: Node3D, checkpoint: Area3D) -> void: if not body.is_in_group("player"): return _checkpoint_position = Vector3(checkpoint.global_position.x, 0.1, checkpoint.global_position.z) -## Sturz in den Abgrund: Game Over bei Permadeath AN, sonst Respawn am -## letzten Checkpoint. +## Sturz in die Nebelschlucht: Game Over bei Permadeath AN, sonst Respawn +## am letzten Checkpoint (bestehende Death/Respawn-Logik). func _on_kill_zone_entered(body: Node3D) -> void: if not body.is_in_group("player"): return @@ -72,5 +116,6 @@ func _on_kill_zone_entered(body: Node3D) -> void: Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) get_tree().change_scene_to_file.call_deferred(MAIN_MENU_SCENE) return + body.external_push = Vector3.ZERO body.velocity = Vector3.ZERO body.global_position = _checkpoint_position diff --git a/scripts/gameplay/weather_controller.gd b/scripts/gameplay/weather_controller.gd new file mode 100644 index 0000000..72ccbee --- /dev/null +++ b/scripts/gameplay/weather_controller.gd @@ -0,0 +1,49 @@ +extends Node3D +## Regen-System des Viadukts (CR-001). +## +## Würfelt beim Betreten des Viadukts einmalig, ob es regnet (rain_chance). +## Bei Regen laufen die Regenpartikel (folgen dem Spieler) und der nasse +## Stein verschärft das Balance-QTE: höhere Rutsch-Wahrscheinlichkeit +## (slip_multiplier) und kürzeres Reaktionsfenster (window_multiplier). +## Der Regen-Status wird per rain_started gemeldet, damit andere Systeme +## reagieren können. + +signal rain_started + +@export var rain_chance := 0.3 +@export var rain_slip_mult := 1.6 +@export var rain_window_mult := 0.7 + +var is_raining := false +var _player: CharacterBody3D + +@onready var _particles: CPUParticles3D = $RainParticles + + +## Verknüpft den Spieler (die Partikel folgen ihm). +func setup(player: CharacterBody3D) -> void: + _player = player + + +## Würfelt das Wetter für diesen Durchlauf und startet ggf. den Regen. +func roll_weather() -> void: + is_raining = randf() < rain_chance + if is_raining: + _particles.emitting = true + rain_started.emit() + + +## Rutsch-Multiplikator für das QTE (nasser Stein = rutschiger). +func slip_multiplier() -> float: + return rain_slip_mult if is_raining else 1.0 + + +## Reaktionsfenster-Multiplikator für das QTE (Regen verkürzt das Fenster). +func window_multiplier() -> float: + return rain_window_mult if is_raining else 1.0 + + +## Lässt die Regenpartikel über dem Spieler mitwandern. +func _process(_delta: float) -> void: + if _player != null and is_raining: + global_position = Vector3(_player.global_position.x, _player.global_position.y + 8.0, _player.global_position.z) diff --git a/scripts/gameplay/weather_controller.gd.uid b/scripts/gameplay/weather_controller.gd.uid new file mode 100644 index 0000000..cd96c72 --- /dev/null +++ b/scripts/gameplay/weather_controller.gd.uid @@ -0,0 +1 @@ +uid://b45k5lnpsxup0 diff --git a/scripts/gameplay/wind_controller.gd b/scripts/gameplay/wind_controller.gd new file mode 100644 index 0000000..217733e --- /dev/null +++ b/scripts/gameplay/wind_controller.gd @@ -0,0 +1,80 @@ +extends Node +## Seitenwind-System des Viadukts (CR-001). +## +## Übt eine konstante seitliche Grundkraft auf den Spieler aus, solange er +## auf dem Steg ist, und löst in Intervallen Böen aus. Der Wind schiebt +## über player.external_push (eine Zusatz-Geschwindigkeit, die der Player- +## Controller vor move_and_slide addiert). Während Dialogen, Kamera- +## Schwenk oder abseits des Stegs ruht der Wind. Die Böen melden sich per +## gust_started an das Balance-QTE. Alle Werte sind im Editor tunebar. + +signal gust_started(direction: int, strength_mult: float) +signal gust_ended + +@export var base_wind_force := 0.7 +@export var gust_strength_mult := 2.75 +@export var gust_interval_min := 3.0 +@export var gust_interval_max := 6.0 +@export var gust_duration := 1.2 + +var _player: CharacterBody3D +var _start_z := 0.0 +var _end_z := 0.0 +var _base_dir := 1 +var _gust_timer := 0.0 +var _gust_remaining := 0.0 +var _gust_dir := 1 +var _is_gusting := false + + +## Verknüpft Spieler und Steg-Grenzen (z-Bereich, in dem der Wind wirkt) +## und würfelt Grundrichtung sowie erstes Bö-Intervall. +func setup(player: CharacterBody3D, start_z: float, end_z: float) -> void: + _player = player + _start_z = start_z + _end_z = end_z + _gust_timer = randf_range(gust_interval_min, gust_interval_max) + _base_dir = 1 if randf() < 0.5 else -1 + + +## Gibt zurück, ob gerade eine Bö aktiv ist. +func is_gusting() -> bool: + return _is_gusting + + +## Wendet Grund- und Bö-Kraft an und steuert die Bö-Intervalle; abseits +## des Stegs oder bei gesperrter Steuerung ruht der Wind. +func _physics_process(delta: float) -> void: + if _player == null: + return + if not _is_on_bridge() or DialogueSystem.is_dialogue_active or _player.is_control_locked(): + _player.external_push = Vector3.ZERO + return + var force := base_wind_force * float(_base_dir) + if _is_gusting: + force = base_wind_force * gust_strength_mult * float(_gust_dir) + _gust_remaining -= delta + if _gust_remaining <= 0.0: + _is_gusting = false + gust_ended.emit() + else: + _gust_timer -= delta + if _gust_timer <= 0.0: + trigger_gust(_base_dir if randf() < 0.7 else -_base_dir) + _gust_timer = randf_range(gust_interval_min, gust_interval_max) + _player.external_push = Vector3(force, 0.0, 0.0) + + +## Löst sofort eine Bö in die angegebene Richtung aus (öffentlich, damit +## Skript und Tests sie deterministisch anstoßen können). +func trigger_gust(direction: int) -> void: + _gust_dir = direction + _is_gusting = true + _gust_remaining = gust_duration + gust_started.emit(direction, gust_strength_mult) + + +## Prüft, ob der Spieler im Wind-wirksamen z-Bereich des Stegs steht. +func _is_on_bridge() -> bool: + var z := _player.global_position.z + return z <= _start_z and z >= _end_z diff --git a/scripts/gameplay/wind_controller.gd.uid b/scripts/gameplay/wind_controller.gd.uid new file mode 100644 index 0000000..4891bdb --- /dev/null +++ b/scripts/gameplay/wind_controller.gd.uid @@ -0,0 +1 @@ +uid://bp65qc13lm1go