Phase 4a: Unterrichts-Stationen, FactionSystem, Permadeath-Toggle
- training_station.gd: drei Stationen (Kampftraining -> Kraft, Landnavigation -> Schnelligkeit im Reiterquadranten; Geschichte & RSC -> Verstand im Klassenraum), je +2 auf den Stat (an STAT_MAX geklemmt), Rueckmeldung per Sprechblase, Doppel-Eingabe-Schutz - TimeSystem.try_spend_slot(): erster echter Verbraucher von advance_slot() - Vormittag/Nachmittag ruecken vor, der Abend wird als verbraucht markiert und blockiert weitere Aktivitaeten bis zum Schlafsaal; Slot-Freigabe bei Slot-Wechsel/Reset - FactionSystem als Fassade ueber neues gespeichertes GameState.faction_standings (-100..100, Signal faction_standing_changed), Fraktions-ID gezeichnete; Story-Logik folgt in 4b/4c - Permadeath-Toggle im Hauptmenue (fokus-navigierbar, Text synchron); GameState.reset() laesst is_permadeath_enabled bewusst unangetastet (Menue-Option), Save/Load stellt den Zustand wieder her - Debug-Overlay: Gezeichnete-Standing sichtbar, F9/F10 verschieben es testweise (reine Overlay-Debug-Hilfe ohne Input-Action) - Headless verifiziert (29 Checks): Slot-Kette Vormittag->Nachmittag-> Abend->blockiert->Schlafen, Stat-Zuwaechse aller drei Stationen, Faction-Signal + Save/Load-Roundtrip, Toggle inkl. Reset- und Persistenz-Semantik Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
2ee3c3f782
commit
ef60c96735
10 changed files with 345 additions and 10 deletions
78
scripts/gameplay/training_station.gd
Normal file
78
scripts/gameplay/training_station.gd
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
extends StaticBody3D
|
||||
## Unterrichts-Station als Tagesaktivität (Phase 4a, SPEC.md Abschnitte 6
|
||||
## und 7).
|
||||
##
|
||||
## Interaktion über die interact-Action in Reichweite (Area3D am Root).
|
||||
## Eine Aktivität verbraucht den aktuellen Tages-Slot über
|
||||
## TimeSystem.try_spend_slot() — der erste echte Verbraucher von
|
||||
## advance_slot(): Vormittag -> Nachmittag -> Abend; nach der
|
||||
## Abend-Aktivität geht nichts mehr, bis der Schlafsaal den Tag beendet.
|
||||
## Der Stat-Zuwachs (stat_gain, Standard +2) läuft über
|
||||
## GameState.increase_stat() und ist dort am STAT_MAX geklemmt.
|
||||
## Rückmeldung über die Sprechblase der Station — bewusst kein voller
|
||||
## Dialogbaum, das ist eine Aktivität, kein NPC-Gespräch. Ein kurzer
|
||||
## Cooldown schützt vor versehentlichen Doppel-Eingaben.
|
||||
|
||||
const STAT_LABELS := {
|
||||
"strength": "Kraft",
|
||||
"agility": "Schnelligkeit",
|
||||
"intellect": "Verstand",
|
||||
}
|
||||
const INPUT_COOLDOWN_MS := 800
|
||||
|
||||
@export var station_name := "Training"
|
||||
@export var stat_name := "strength"
|
||||
@export var stat_gain := 2
|
||||
@export var success_line := "Das sitzt. Weiter im Plan."
|
||||
@export var exhausted_line := "Für heute reicht es — der Schlafsaal wartet."
|
||||
|
||||
var _is_player_in_range := false
|
||||
var _last_use_ms := -INPUT_COOLDOWN_MS
|
||||
|
||||
@onready var _prompt_label: Label3D = $PromptLabel
|
||||
@onready var _interaction_area: Area3D = $InteractionArea
|
||||
@onready var _bubble: Node3D = $SpeechBubble
|
||||
|
||||
|
||||
## Verbindet die Reichweiten-Signale des Interaktions-Triggers.
|
||||
func _ready() -> void:
|
||||
_interaction_area.body_entered.connect(_on_body_entered)
|
||||
_interaction_area.body_exited.connect(_on_body_exited)
|
||||
|
||||
|
||||
## Startet die Aktivität bei interact in Reichweite, außerhalb laufender
|
||||
## Dialoge und nach Ablauf des Doppel-Eingabe-Schutzes.
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if not _is_player_in_range:
|
||||
return
|
||||
if DialogueSystem.is_dialogue_active:
|
||||
return
|
||||
if not event.is_action_pressed("interact"):
|
||||
return
|
||||
if Time.get_ticks_msec() - _last_use_ms < INPUT_COOLDOWN_MS:
|
||||
return
|
||||
_last_use_ms = Time.get_ticks_msec()
|
||||
_train()
|
||||
|
||||
|
||||
## Verbraucht den Tages-Slot und erhöht den Stat; ist der Slot schon
|
||||
## verbraucht, gibt es nur die Absage-Zeile.
|
||||
func _train() -> void:
|
||||
if not TimeSystem.try_spend_slot():
|
||||
_bubble.show_line(exhausted_line)
|
||||
return
|
||||
GameState.increase_stat(stat_name, stat_gain)
|
||||
var stat_label: String = STAT_LABELS.get(stat_name, stat_name)
|
||||
_bubble.show_line("%s (%s +%d)" % [success_line, stat_label, stat_gain])
|
||||
|
||||
|
||||
## 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 = true
|
||||
|
||||
|
||||
## 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/training_station.gd.uid
Normal file
1
scripts/gameplay/training_station.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dkadufpy8ooaj
|
||||
Loading…
Add table
Add a link
Reference in a new issue