feat(npc-dialogue): add a descriptive narrative presentation to event nodes
An event node's text could only render as the amber left-barred line. Some beats are the narrator setting a scene rather than the contact speaking, and that styling made them read as dialogue. Event nodes now carry a presentation: the existing event line, or a centered muted descriptive narrative with no speaker and no accent bar. Rendering only: the walker, the effect and the tokens behave the same. The canvas card shows a narrative tag so the two are distinguishable while authoring.
This commit is contained in:
parent
04bbc66edc
commit
b0457a17b3
5 changed files with 63 additions and 6 deletions
|
|
@ -499,13 +499,11 @@ export function NodeEditDialog({
|
||||||
{node.type === "event" && (
|
{node.type === "event" && (
|
||||||
<div className="flex flex-col gap-4">
|
<div className="flex flex-col gap-4">
|
||||||
<div className="flex flex-col gap-1.5">
|
<div className="flex flex-col gap-1.5">
|
||||||
<Label className="text-[10px] uppercase tracking-wider text-white/50">
|
<Label className="text-[10px] uppercase tracking-wider text-white/50">Text</Label>
|
||||||
Narration
|
|
||||||
</Label>
|
|
||||||
<MarkupEditor
|
<MarkupEditor
|
||||||
value={draft.body ?? ""}
|
value={draft.body ?? ""}
|
||||||
onChange={(next) => patch({ body: next || undefined })}
|
onChange={(next) => patch({ body: next || undefined })}
|
||||||
placeholder="Describe what happens. Shown as a speaker-less narrative line."
|
placeholder="Describe what happens, or what the contact says."
|
||||||
rows={3}
|
rows={3}
|
||||||
className="rounded bg-zinc-800 border border-white/20 px-2 py-1.5 text-sm text-white placeholder:text-white/30 resize-y"
|
className="rounded bg-zinc-800 border border-white/20 px-2 py-1.5 text-sm text-white placeholder:text-white/30 resize-y"
|
||||||
/>
|
/>
|
||||||
|
|
@ -514,6 +512,29 @@ export function NodeEditDialog({
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="flex flex-col gap-1.5">
|
||||||
|
<Label className="text-[10px] uppercase tracking-wider text-white/50">
|
||||||
|
Presentation
|
||||||
|
</Label>
|
||||||
|
<select
|
||||||
|
value={draft.presentation ?? "event"}
|
||||||
|
onChange={(e) =>
|
||||||
|
patch({
|
||||||
|
presentation:
|
||||||
|
e.target.value === "narration" ? "narration" : undefined,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
className="bg-zinc-800 border border-white/20 rounded px-2 py-1 text-sm text-white"
|
||||||
|
>
|
||||||
|
<option value="event">Event line (amber, left aligned)</option>
|
||||||
|
<option value="narration">Descriptive narrative (centered, muted)</option>
|
||||||
|
</select>
|
||||||
|
<p className="text-[10px] text-white/40">
|
||||||
|
Descriptive narrative reads as the narrator describing a scene, with no
|
||||||
|
speaker and no accent bar.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-col gap-1.5">
|
<div className="flex flex-col gap-1.5">
|
||||||
<Label className="text-[10px] uppercase tracking-wider text-white/50">Effect</Label>
|
<Label className="text-[10px] uppercase tracking-wider text-white/50">Effect</Label>
|
||||||
<select
|
<select
|
||||||
|
|
|
||||||
|
|
@ -140,8 +140,19 @@ export function NpcDialogueNode({ data, type, selected }: NodeProps) {
|
||||||
|
|
||||||
{nodeType === "event" && (
|
{nodeType === "event" && (
|
||||||
<div className="text-sm">
|
<div className="text-sm">
|
||||||
|
{d.presentation === "narration" && (
|
||||||
|
<span className="mb-1 inline-block rounded-sm bg-white/10 px-1 py-px font-mono text-[9px] uppercase tracking-wider text-white/50">
|
||||||
|
narrative
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
{d.body && (
|
{d.body && (
|
||||||
<p className="line-clamp-3 italic text-amber-100/80">
|
<p
|
||||||
|
className={
|
||||||
|
d.presentation === "narration"
|
||||||
|
? "line-clamp-3 text-center italic text-white/55"
|
||||||
|
: "line-clamp-3 italic text-amber-100/80"
|
||||||
|
}
|
||||||
|
>
|
||||||
<DialogueText text={d.body} />
|
<DialogueText text={d.body} />
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -481,10 +481,23 @@ function TimelineEntry({
|
||||||
const { node, resolved } = entry;
|
const { node, resolved } = entry;
|
||||||
|
|
||||||
if (node.type === "event") {
|
if (node.type === "event") {
|
||||||
// Narration: no speaker, styled like a mission briefing line.
|
|
||||||
const body = resolved?.body ?? node.data.body;
|
const body = resolved?.body ?? node.data.body;
|
||||||
const message = resolved?.message ?? node.data.effect?.message;
|
const message = resolved?.message ?? node.data.effect?.message;
|
||||||
const text = body || message || "An event unfolds…";
|
const text = body || message || "An event unfolds…";
|
||||||
|
if (node.data.presentation === "narration") {
|
||||||
|
// Descriptive narrative: the narrator's voice, not the NPC's. Centered
|
||||||
|
// and muted with no accent bar so it reads as scene-setting rather than
|
||||||
|
// as something the contact said.
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col items-center gap-2 py-1 text-center">
|
||||||
|
<p className="max-w-[42rem] text-sm italic leading-relaxed text-white/55">
|
||||||
|
<DialogueText text={text} />
|
||||||
|
</p>
|
||||||
|
<DialogueAttachments attachments={resolved?.attachments} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// Narration: no speaker, styled like a mission briefing line.
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<p className="border-l-2 border-amber-500/50 pl-3 text-sm italic text-amber-100/80">
|
<p className="border-l-2 border-amber-500/50 pl-3 text-sm italic text-amber-100/80">
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,11 @@ Node types: `dialogue`, `choice`, `event`, `end`, `delay`, `condition`. Effects
|
||||||
executed by `triggerNpcDialogueEvent`, which re-reads the stored node rather than
|
executed by `triggerNpcDialogueEvent`, which re-reads the stored node rather than
|
||||||
trusting the client.
|
trusting the client.
|
||||||
|
|
||||||
|
An `event` node carries `presentation`: `event` (default, the amber left-barred
|
||||||
|
line with no speaker) or `narration` (centered, muted, for a narrator describing
|
||||||
|
a scene rather than the contact speaking). It changes rendering only; the walker
|
||||||
|
and the effect run identically.
|
||||||
|
|
||||||
Availability is double-gated: `game-npcs.canMessage` on the contact, and the
|
Availability is double-gated: `game-npcs.canMessage` on the contact, and the
|
||||||
`entryGate` / `priority` on the dialogue document selecting which of an NPC's
|
`entryGate` / `priority` on the dialogue document selecting which of an NPC's
|
||||||
conversations is offered.
|
conversations is offered.
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,13 @@ export type DialogueNodeData = {
|
||||||
speaker?: string;
|
speaker?: string;
|
||||||
/** The spoken line (dialogue) or narrative description (event nodes). */
|
/** The spoken line (dialogue) or narrative description (event nodes). */
|
||||||
body?: string;
|
body?: string;
|
||||||
|
/**
|
||||||
|
* How an `event` node's body is presented to the player. `event` (default) is
|
||||||
|
* the spoken-style amber line with the NPC's name above it; `narration` is a
|
||||||
|
* centered, muted description with no speaker, for scene-setting beats the
|
||||||
|
* NPC is not saying out loud. Ignored by every other node type.
|
||||||
|
*/
|
||||||
|
presentation?: "event" | "narration";
|
||||||
/** Branching options (choice nodes). */
|
/** Branching options (choice nodes). */
|
||||||
choices?: DialogueNext[];
|
choices?: DialogueNext[];
|
||||||
/** Optional lead-in text before the choices. */
|
/** Optional lead-in text before the choices. */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue