preparations for on_failure effect

This commit is contained in:
Sokomine 2021-06-09 00:56:50 +02:00
parent fab84ca4a0
commit 2d233a16e7
2 changed files with 8 additions and 5 deletions

View File

@ -22,7 +22,8 @@
--
-- a craft receipe: TODO
--
-- on_failure: TODO
-- on_failure: TODO implement
-- r_value alternate target dialog if the action failed
--
-- Unlike in preconditions, trade (the trade action already happened) and
-- inventory actions are not supported as effects.
@ -37,10 +38,11 @@ local check_what = {
"an internal state (i.e. of a quest)", -- 2
"a block somewhere", -- 3
"NPC crafts soemthing", -- 4
"go to other dialog if the action (i.e. trade) failed", -- 5
}
-- how to store these as r_type in the precondition:
local values_what = {"", "state", "block", "craft"}
local values_what = {"", "state", "block", "craft", "on_failure"}
-- unlike in the preconditions, the "I cannot punch it" option is
-- not offered here - because the player (and later the NPC) needs
@ -49,9 +51,9 @@ local check_block = {
"- please select -", -- 1
"If there is air: Place a block so that it looks like now.", -- 2
"If there is a block: Dig it.", -- 3
-- TODO: not sure if this is possible without bugs
-- TODO: not sure if punching a block (as an npc) is possible without bugs
"Punch the block.", -- 4
-- TODO: not sure if this is possible without bugs
-- TODO: not sure if right-clicking a block (as an npc) is possible without bugs
"Right-click the block.", -- 5
}
@ -133,6 +135,8 @@ yl_speak_up.show_effect = function(r)
end
elseif(r.r_type == "craft") then
return "TODO. Crafting is not yet supported."
elseif(r.r_type == "on_failure") then
return "If the action (i.e. trade) failed, go to dialog \""..tostring(r.r_value).. "\"."
end
-- fallback
return tostring(r.r_value)

View File

@ -7,7 +7,6 @@
-- contain only wrappers.
-- TODO implement crafting handling in input_
-- TODO store somewhere if working on p_ or r_ (because otherwise the function cannot distinguish them)
yl_speak_up.input_fs_edit_option_related = function(player, formname, fields,
id_prefix, element_list_name, max_entries_allowed,