Vendor libs/hump, sfxrlua, json4lua, narrator as real files
These were committed as empty submodule gitlinks with no .gitmodules, so the folders were never populated and the game could not load (require of libs/hump/timer, libs/sfxrlua/sfxr, narrator.narrator). Checked out each at its pinned commit and vendored the files, matching the existing bundled-libs convention. Removed the junk libs/libs/ tree. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
e73f63b5d4
commit
03532d29e4
219 changed files with 20254 additions and 252 deletions
59
libs/narrator/test/runtime/save-load.lua
Normal file
59
libs/narrator/test/runtime/save-load.lua
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
local narrator, describe, it, assert = ...
|
||||
|
||||
local content = [[
|
||||
VAR x = 1
|
||||
* (choice) [Hello]
|
||||
- (hello) Hello world!
|
||||
-> knot
|
||||
=== knot
|
||||
= stitch
|
||||
~ x = 2
|
||||
~ temp y = 3
|
||||
A line 1
|
||||
A line 2
|
||||
A line 3
|
||||
* Just a road to hell -> END
|
||||
* The best road to hell -> END
|
||||
]]
|
||||
|
||||
local book = narrator.parse_content(content)
|
||||
|
||||
local saved_state
|
||||
|
||||
it('Saving', function()
|
||||
local story = narrator.init_story(book)
|
||||
story:begin()
|
||||
story:continue()
|
||||
story:choose(1)
|
||||
story:continue(2)
|
||||
|
||||
saved_state = story:save_state()
|
||||
|
||||
local expected_path = { knot = 'knot', stitch = 'stitch' }
|
||||
assert.are.same(saved_state.path, expected_path)
|
||||
assert.equal(saved_state.variables['x'], 2)
|
||||
assert.equal(saved_state.temp['y'], 3)
|
||||
assert.equal(saved_state.visits._._.hello, 1)
|
||||
assert.equal(#saved_state.output, 2)
|
||||
assert.equal(#saved_state.paragraphs, 2)
|
||||
assert.equal(#saved_state.choices, 2)
|
||||
end)
|
||||
|
||||
it('Loading.', function()
|
||||
local story = narrator.init_story(book)
|
||||
story:begin()
|
||||
story:load_state(saved_state)
|
||||
|
||||
local expected_path = { knot = 'knot', stitch = 'stitch' }
|
||||
assert.are.same(story.current_path, expected_path)
|
||||
assert.equal(story.variables['x'], 2)
|
||||
assert.equal(story.temp['y'], 3)
|
||||
assert.equal(story:get_visits('hello'), 1)
|
||||
assert.equal(#story.output, 2)
|
||||
|
||||
local paragraphs = story:continue()
|
||||
local choices = story:get_choices()
|
||||
|
||||
assert.equal(#paragraphs, 2)
|
||||
assert.equal(#choices, 2)
|
||||
end)
|
||||
Loading…
Add table
Add a link
Reference in a new issue