Utterance award + requirement, and branching dialogue seeding
A dialogue line can award an achievement when reached (granted server-side, validated against the player's current node so it can't be forged) and an option can require an achievement to be offered (filtered out of the resolved tree otherwise). authorGraph gains a branching form (utterance key/parent/ terminal) so option trees — not just linear lines — can be seeded. This is gaps 1 & 2 for the Barricelli Dobby/Glitch-Hunter dialogues; phone dialing stays stubbed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -508,6 +508,14 @@ app.post('/api/playthroughs/:id/achievements', async (req, res, next) => {
|
||||
result.ok ? res.json({ earned: result.earned }) : res.status(result.error === 'Playthrough not found' ? 404 : 400).json({ error: result.error })
|
||||
} catch (error) { next(error) }
|
||||
})
|
||||
// A dialogue line was reached in play — grant its authored achievement (validated
|
||||
// server-side against the player's current node, so players can't forge flags).
|
||||
app.post('/api/playthroughs/:id/utterances/:uid/reach', async (req, res, next) => {
|
||||
try {
|
||||
const result = await narrative.reachUtterance(String(req.params.id), String(req.params.uid))
|
||||
result.ok ? res.json({ earned: result.earned ?? false }) : res.status(404).json({ error: 'Not found' })
|
||||
} catch (error) { next(error) }
|
||||
})
|
||||
// Dev teleport: jump the playthrough to an explicit story node. Powers /node/:id.
|
||||
app.post('/api/playthroughs/:id/goto', async (req, res, next) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user