improved documentation of fs_edit_preconditions.lua

This commit is contained in:
Sokomine 2021-06-07 04:43:04 +02:00
parent ba31a932ad
commit 80c25fb9fa

View File

@ -1,6 +1,35 @@
-- TODO: check inscription of a sign?
-- TODO: invlist as dropdown of inventory lists at detected position
-- TODO: variable as dropdown of allowed variables
-- 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_value used to store the subtype of p_type
--
-- a state/variable:
-- p_variable TODO
-- p_operator selected from values_operator
-- p_var_cmp_value can be set freely by the player
--
-- a block in the world:
-- 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)
--
-- an inventory:
-- p_itemstack an itemstack; needs to be a minetest.registered_item[..];
-- size/count is also checked
-- some helper lists for creating the formspecs and evaulating
-- the player's answers
-- the player's answers:
-- general direction of what a prerequirement may be about
local check_what = {
@ -77,23 +106,6 @@ local check_variable = {
}
-- TODO: check inscription of a sign?
-- TODO: invlist as dropdown of inventory lists at detected position
-- TODO: variable as dropdown of allowed variables
-- which diffrent types of preconditions are available?
-- possible variables:
-- item an inventory item or block (check if it exists)
-- -> needs to be a minetest.registered_item[ item ]
-- text some text
-- pos a position in the world (not too far from the NPC)
-- -> determined by punching
-- variable name of a variable
--
-- TODO: may all boil down to automaticly setting some lua code?
-- -> better write a function for each one that can be called when needed
-- returns a human-readable text as description of the precondition
-- (as shown in the edit options dialog and in the edit precondition formspec)
yl_speak_up.show_precondition = function(p)