Skip to content

Commit 1e47cc9

Browse files
authored
Merge pull request #2 from astrochili/development
Development
2 parents 458387a + a4dde19 commit 1e47cc9

4 files changed

Lines changed: 14 additions & 4 deletions

File tree

narrator/parser.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ end
341341

342342
function Constructor:addConstant(constant, value)
343343
local value = lume.deserialize(value)
344-
self.book.constants[constant] = lume.deserialize(value)
344+
self.book.constants[constant] = value
345345
end
346346

347347
function Constructor:addKnot(knot)

narrator/story.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ end
4646
--- Start a story.
4747
-- Generate the first chunk of paragraphs and choices.
4848
function Story:begin()
49-
if #self.paragraphs == 0 and #self.choices == 0 and not self.isOver then
50-
self:readPath({ })
49+
if #self.paragraphs > 0 or #self.choices > 0 then
50+
return
5151
end
52+
53+
self:jumpTo('_')
5254
end
5355

5456
--- Does the story have paragraphs to output or not.
@@ -151,6 +153,8 @@ end
151153
function Story:jumpTo(pathString)
152154
assert(pathString, 'The pathString can\'t be nil')
153155

156+
self.choices = { }
157+
154158
if pathString == 'END' or pathString == 'DONE' then
155159
self.isOver = true
156160
return

test/units/constants.ink

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1+
CONST STRING_EXAMPLE = "This is the string constant"
2+
CONST BOOLEAN_EXAMLPE_TRUE = true
3+
CONST BOOLEAN_EXAMLPE_FALSE = false
4+
15
CONST LOBBY = 1
26
CONST STAIRCASE = 2
37
CONST HALLWAY = 3
4-
58
CONST HELD_BY_AGENT = -1
69

710
VAR secret_agent_location = LOBBY
811
VAR suitcase_location = HALLWAY
912

13+
{ STRING_EXAMPLE }. One is { BOOLEAN_EXAMLPE_TRUE }. Zero is { BOOLEAN_EXAMLPE_FALSE }.
14+
1015
-> report_progress
1116

1217
=== report_progress ===

test/units/constants.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
This is the string constant. One is 1. Zero is 0.
12
The secret agent moves forward.
23
The secret agent moves forward.
34
The secret agent grabs the suitcase!

0 commit comments

Comments
 (0)