Better narration processing

This commit is contained in:
2026-01-22 17:15:19 +03:00
parent 4b24d85123
commit cd91174f5d
23 changed files with 1301 additions and 367 deletions

View File

@@ -655,3 +655,54 @@ setup_handler(function(event, trigger_entity, what_entity)
--]]
end
end)
--[[
active_dialogues = {}
setup_action_handler("talk", function(town, index, word)
local ret = ""
local choices = {}
local have_choice = false
local have_paragraph = false
local book = narrator.parse_file('stories.talk')
local story = narrator.init_story(book)
if story == nil then
crash()
end
story:begin()
narrate("Boo!!!!")
if story.can_continue() then
local paragraph = story:continue(1)
print(dump(paragraph))
if story:can_choose() then
have_choice = true
local ch = story:get_choices()
for i, choice in ipairs(ch) do
table.insert(choices, choice.text)
print(i, dump(choice))
end
if #choices == 1 and choices[1] == "Ascend" then
story:choose(1)
choices = {}
end
if #choices == 1 and choices[1] == "Continue" then
this.story:choose(1)
choices = {}
end
end
end
if (#choices > 0) then
print("choices!!!")
narrate(ret, choices)
else
narrate(ret)
end
if not have_choice and not have_paragraph then
-- complete
crash()
else
print("can continue")
end
end)
]]--