Every change here started life as a workaround in a game and is really the same finding: a fact about an entity had nowhere to live, so the domain built machinery around the gap. Character.Label / Character.Voice — a tape is a character that speaks into the log, not a second spelling of Say. VoiceOf and CharacterLabel read them; Say obeys them. Game.Do — a real action queue, in order, so a widget can start an action. queueAction no longer drops what arrives while the runner is busy; it queues it. Widget.When + Gated + WidgetVisible — a widget declares when it is on screen. Nothing ticks, draws or blocks a click while its condition is false, so a HUD is hidden for a cutscene without a wrapper per widget. TopBar.NoteVar — the title was already discovered; the note beside it no longer needs a domain widget to push it in. Game.UseWithFail — the pair nobody authored is content, and belongs to the domain, exactly like ExitLook and ExitTake. Game.Player / Game.Walkboxes — a scene that names no cast and no floor means "the usual", instead of a defaults pass rewriting every scene. Game.WindowScale — Run's 4× is now a default, not a decision. SceneNav — the dev widget every game was writing. Colour text: DrawText paints in the colour it is handed, and GlyphW/H, TextWidth, WrapText and ClipText are the library's, not each game's. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+9
-3
@@ -213,6 +213,7 @@ type sayRunner struct {
|
||||
elapsed float64
|
||||
duration float64
|
||||
started bool
|
||||
bubble bool
|
||||
}
|
||||
|
||||
func Say(speaker, text string) Action { return &sayAction{speaker: speaker, text: text} }
|
||||
@@ -223,8 +224,11 @@ func (r *sayRunner) Tick(ctx *Ctx) Status {
|
||||
if !r.started {
|
||||
r.started = true
|
||||
// duration scales with text length, with a 1.2s floor
|
||||
r.duration = 1.2 + float64(len(r.spec.text))*0.05
|
||||
ctx.Game.SetSpeech(r.spec.speaker, r.spec.text)
|
||||
r.duration = 1.2 + float64(len([]rune(r.spec.text)))*0.05
|
||||
r.bubble = ctx.Game.VoiceOf(r.spec.speaker) == VoiceBubble
|
||||
if r.bubble {
|
||||
ctx.Game.SetSpeech(r.spec.speaker, r.spec.text)
|
||||
}
|
||||
ctx.Game.LogResponse(r.spec.speaker, r.spec.text)
|
||||
}
|
||||
r.elapsed += ctx.DT
|
||||
@@ -233,7 +237,9 @@ func (r *sayRunner) Tick(ctx *Ctx) Status {
|
||||
r.elapsed = r.duration
|
||||
}
|
||||
if r.elapsed >= r.duration {
|
||||
ctx.Game.ClearSpeech()
|
||||
if r.bubble {
|
||||
ctx.Game.ClearSpeech()
|
||||
}
|
||||
return StatusDone
|
||||
}
|
||||
return StatusRunning
|
||||
|
||||
Reference in New Issue
Block a user