From 2d233a16e794fe58616eca29a8b9d44081831c48 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Wed, 9 Jun 2021 00:56:50 +0200 Subject: [PATCH] preparations for on_failure effect --- fs_edit_effects.lua | 12 ++++++++---- fs_edit_general.lua | 1 - 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/fs_edit_effects.lua b/fs_edit_effects.lua index 00f5ef1..b4ae2e3 100644 --- a/fs_edit_effects.lua +++ b/fs_edit_effects.lua @@ -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) diff --git a/fs_edit_general.lua b/fs_edit_general.lua index 04a68d2..6e34a29 100644 --- a/fs_edit_general.lua +++ b/fs_edit_general.lua @@ -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,