By-hand cold-start test showed 3 phrases before the response; 1.5x the cadence so each line stays on screen a touch longer. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
45 lines
1.1 KiB
GDScript
45 lines
1.1 KiB
GDScript
class_name ConsideringIndicator
|
|
extends Node
|
|
## Thin node shim (charter §13). While a call is in flight it rotates an authored
|
|
## ConsideringPhrases line onto a Label every ROTATE_SECONDS, reframing the wait
|
|
## as the GM thinking. The phrase logic is the pure, tested ConsideringPhrases;
|
|
## the Timer/tree wiring here is the untested shim (verified by running the
|
|
## harness). One instance persists on the harness so the rotation index is not
|
|
## reset per call (spec decision 4).
|
|
|
|
const ROTATE_SECONDS := 3.0
|
|
|
|
var _phrases: ConsideringPhrases
|
|
var _timer: Timer
|
|
var _label: Label
|
|
|
|
|
|
func _init(phrases: ConsideringPhrases = null) -> void:
|
|
_phrases = phrases if phrases != null else ConsideringPhrases.new()
|
|
|
|
|
|
func _ready() -> void:
|
|
_timer = Timer.new()
|
|
_timer.wait_time = ROTATE_SECONDS
|
|
_timer.one_shot = false
|
|
_timer.timeout.connect(_advance)
|
|
add_child(_timer)
|
|
|
|
|
|
func start(label: Label) -> void:
|
|
_label = label
|
|
_advance() # show a phrase immediately, don't wait ROTATE_SECONDS
|
|
_timer.start()
|
|
|
|
|
|
func stop() -> void:
|
|
_timer.stop()
|
|
if _label != null:
|
|
_label.text = ""
|
|
_label = null
|
|
|
|
|
|
func _advance() -> void:
|
|
if _label != null:
|
|
_label.text = _phrases.next()
|