Skip to content

Commit

Permalink
add node to dialogue elements
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiEven committed Feb 17, 2024
1 parent 0cffac5 commit 23c4555
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ type DialogueRunner struct {

// DialogueElement represents a step of a dialogue as it is presented in a game.
// Either Line or Options holds a value.
// Node holds the name of the dialogue node that contains the element.
type DialogueElement struct {
Node string
Line *markup.ParseResult
Options []DialogueOption
}
Expand Down Expand Up @@ -118,6 +120,7 @@ func (dr *DialogueRunner) Next(choice int) (*DialogueElement, error) {
return nil, fmt.Errorf("failed to prepare line: %w", err)
}
return &DialogueElement{
Node: dr.currentNode,
Line: markupResult,
}, nil
case nextStatement.ShortcutOptionStatement != nil:
Expand All @@ -143,6 +146,7 @@ func (dr *DialogueRunner) Next(choice int) (*DialogueElement, error) {
})
}
return &DialogueElement{
Node: dr.currentNode,
Options: options,
}, nil
case nextStatement.SetStatement != nil:
Expand Down
2 changes: 1 addition & 1 deletion snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ysgo

import "github.com/remieven/ysgo/variable"

// Snapshot holds data that represents the current state of a dialogue, so it can be restored later
// Snapshot holds data that represents the current state of a dialogue, so it can be restored later.
type Snapshot struct {
Variables map[string]variable.Value

Expand Down

0 comments on commit 23c4555

Please sign in to comment.