forked from your-land-mirror/yl_speak_up
export to ink: add effect list to the action knot success option where it belongs
This commit is contained in:
parent
0cd28dcb54
commit
7ce56ca733
@ -160,7 +160,8 @@ end
|
||||
-- Parameter:
|
||||
-- a action
|
||||
yl_speak_up.export_to_ink.print_action_knot = function(lines, use_prefix, d_id, o_id, start_dialog,
|
||||
a, alternate_text_on_success, next_target, dialog_names)
|
||||
a, alternate_text_on_success, next_target, dialog_names,
|
||||
e_list_on_success)
|
||||
local action_prefix = use_prefix.."action_"..tostring(a.a_id).."_"..tostring(o_id).."_"
|
||||
local knot_name = ink_export.print_knot_name(lines, d_id, action_prefix, dialog_names)
|
||||
|
||||
@ -168,10 +169,11 @@ yl_speak_up.export_to_ink.print_action_knot = function(lines, use_prefix, d_id,
|
||||
table.insert(lines, a.a_id)
|
||||
table.insert(lines, " ")
|
||||
table.insert(lines, yl_speak_up.show_action(a))
|
||||
table.insert(lines, "A: "..minetest.serialize(a or {})..".")
|
||||
|
||||
ink_export.print_choice(lines, "Action was successful", use_prefix, start_dialog,
|
||||
alternate_text_on_success, next_target, false, nil,
|
||||
nil, nil, dialog_names)
|
||||
nil, e_list_on_success, dialog_names)
|
||||
|
||||
ink_export.print_choice(lines, "Action failed", use_prefix, start_dialog,
|
||||
a.alternate_text, a.a_on_failure, false, nil,
|
||||
@ -488,6 +490,9 @@ yl_speak_up.export_to_ink_language = function(dialog, n_id)
|
||||
alternate_text_on_success,
|
||||
sorted_e_list, o_data.o_results, 1)
|
||||
|
||||
-- if it is an action knot then the effects have to go to the action knot
|
||||
local e_list = ink_export.translate_effect_list(dialog, o_data.o_results,
|
||||
vars_used)
|
||||
-- iterate backwards through the actions (though usually only one is supported)
|
||||
for k = #sorted_a_list, 1, -1 do
|
||||
local a_id = sorted_a_list[k]
|
||||
@ -496,7 +501,8 @@ yl_speak_up.export_to_ink_language = function(dialog, n_id)
|
||||
target_dialog = ink_export.print_action_knot(tmp2,
|
||||
use_prefix, d_id, o_id, start_dialog,
|
||||
a,
|
||||
alternate_text_on_success, target_dialog, dialog_names)
|
||||
alternate_text_on_success, target_dialog, dialog_names,
|
||||
e_list)
|
||||
-- has been dealt with
|
||||
alternate_text_on_success = ""
|
||||
end
|
||||
@ -504,8 +510,6 @@ yl_speak_up.export_to_ink_language = function(dialog, n_id)
|
||||
-- which preconditions can be translated to ink?
|
||||
local p_list = ink_export.translate_precondition_list(dialog, o_data.o_prerequisites,
|
||||
vars_used, use_prefix, dialog_names)
|
||||
local e_list = ink_export.translate_effect_list(dialog, o_data.o_results,
|
||||
vars_used)
|
||||
|
||||
-- what remains is to print the option/choice itself
|
||||
local o_text = o_data.o_text_when_prerequisites_met
|
||||
@ -517,6 +521,11 @@ yl_speak_up.export_to_ink_language = function(dialog, n_id)
|
||||
o_text = "[Automaticly selected if preconditions are met]"
|
||||
o_prefix = "automaticly_"
|
||||
end
|
||||
-- if the target is an action knot: do not print the effect list as that belongs
|
||||
-- to the action knot!
|
||||
if(#sorted_a_list > 0) then
|
||||
e_list = {}
|
||||
end
|
||||
ink_export.print_choice(tmp,
|
||||
o_text, use_prefix, start_dialog,
|
||||
alternate_text_on_success, target_dialog,
|
||||
|
Loading…
Reference in New Issue
Block a user