diff --git a/fs_edit_preconditions.lua b/fs_edit_preconditions.lua index a9ed50f..9e16c6c 100644 --- a/fs_edit_preconditions.lua +++ b/fs_edit_preconditions.lua @@ -1,31 +1,60 @@ -- TODO: check inscription of a sign? +-- TODO: check mesecons related things? -- Which diffrent types of preconditions are available? -- -> The following fields are part of a precondition: -- p_id the ID/key of the precondition/prerequirement --- p_type selected from values_what; the staffs allow to use other --- types like "function" or "has_item" - but that is not --- supported here (cannot be edited or created; only be shown) +-- p_type selected from values_what -- p_value used to store the subtype of p_type -- --- a state/variable: +-- a state/variable ("state"): -- p_variable name of a variable the player has read access to; -- dropdown list with allowed options -- p_operator selected from values_operator -- p_var_cmp_value can be set freely by the player -- --- a block in the world: +-- a block in the world ("block"): -- p_pos a position in the world; determined by asking the player -- to punch the block -- p_node (follows from p_pos) -- p_param2 (follows from p_pos) -- --- a trade defined as an action: no variables needed (buy and pay stack follow --- from the trade set as action) +-- a trade defined as an action ("trade"): no variables needed (buy and pay stack +-- follow from the trade set as action) -- --- an inventory: +-- an inventory: ("player_inv", "npc_inv" or "block_inv") -- p_itemstack an itemstack; needs to be a minetest.registered_item[..]; -- size/count is also checked +-- +-- the inventory of a block on the map: ("block_inv", in addition to the ones above) +-- p_pos a position in the world; determined by asking the player +-- to punch the block +-- p_inv_list_name name of the inventory list of the block +-- +-- the player offered/gave the NPC an item: ("player_offered_item"): +-- p_value an itemstack; needs to be a minetest.registered_item[..]; +-- size/count is checked for some subtypes +-- p_match_stack_size does the NPC expect exactly one stack size - or is +-- more or less etc. also ok? +-- p_item_group are items of this group instead of the exact item name +-- also acceptable? +-- p_item_desc the description of the itemstack (set by another quest NPC +-- so that the player can distinguish it from other itemstacks +-- with the same item name; see action "npc_gives") +-- p_item_quest_id Special ID to make sure that it is really the *right* +-- item and not just something the player faked with an +-- engraving table or something similar +-- +-- a function ("function"): requires npc_master to create and edit +-- p_value the lua code to execute and evaulate +-- +-- a custom function ("custon"): +-- p_value parameter for the custom function +-- +-- depends on another option: +-- p_value name of the other option of this dialog that is considered +-- p_fulfilled shall option p_value be true or false? + -- some helper lists for creating the formspecs and evaulating -- the player's answers: @@ -46,9 +75,10 @@ local check_what = { } -- how to store these as p_type in the precondition: -local values_what = {"", "state", "block", "trade", "player_inv", "npc_inv", - "block_inv", "player_offered_item", - -- requires npc_master priv +local values_what = {"", "state", "block", "trade", + "player_inv", "npc_inv", "block_inv", + "player_offered_item", + -- "function" requires npc_master priv: "function", -- custom function (does not require npc_master priv) "custom",