Files
settled-reach/client/ui/monologue_display.gd
T
jpmschweitzerandClaude Opus 4.6 3368231396 fix(client): address PR review — input bug, bounds checks, fixture tests
- Fix input_mapper double-check bug (redundant InputEventKey + pressed filter)
- Add bounds checking for position arrays in entity_renderer and game_state
- Make test snapshot deterministic (incrementing counter, not wall clock)
- Fix tween overlap in monologue_display (cancel active tween before new one)
- Extract TILE_SIZE constant from magic number 32
- Add 5 D-030 Layer 1 fixture tests for snapshot parsing (7/7 total passing)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 17:53:24 +01:00

49 lines
1.3 KiB
GDScript

extends Control
# Internal monologue display (per D-015)
# Shows character's internal thoughts as text overlay
@onready var text_panel: PanelContainer = $PanelContainer
@onready var text_label: RichTextLabel = $PanelContainer/MarginContainer/RichTextLabel
var fade_timer: float = 0.0
var fade_duration: float = 5.0 # Display duration before fade
var is_visible: bool = false
var _active_tween: Tween = null
func _ready() -> void:
print("MonologueDisplay: Initialized")
text_panel.modulate.a = 0.0
is_visible = false
func _process(delta: float) -> void:
# Auto-fade after display
if is_visible:
fade_timer += delta
if fade_timer >= fade_duration:
_fade_out()
# Show internal monologue text
func show_monologue(text: String, duration: float = 5.0) -> void:
text_label.text = text
fade_duration = duration
fade_timer = 0.0
is_visible = true
# Cancel any active tween before starting a new one
if _active_tween and _active_tween.is_valid():
_active_tween.kill()
_active_tween = create_tween()
_active_tween.tween_property(text_panel, "modulate:a", 1.0, 0.3)
# Fade out the monologue
func _fade_out() -> void:
if not is_visible:
return
is_visible = false
if _active_tween and _active_tween.is_valid():
_active_tween.kill()
_active_tween = create_tween()
_active_tween.tween_property(text_panel, "modulate:a", 0.0, 0.5)