Action and task programs
Opened this issue · 2 comments
I am already working on updating the documentation with the new tasks and actions that will work in program format.
I would like to use this issue for explanations on some programs.
Can you explain more details about the IDLE ("advanced_npc:idle"
) program? To better understand ways it can be used.
The "advanced_npc:idle" program is a program meant to be run when NPC are doing nothing and standing idle. It has two main features (as-of the moment, more planned):
- Acknowledge nearby objects by looking at them, with configurable object search interval and radius
- Trigger wandering with configurable chance (1-100 chance of wander) and radius (how many nodes to wander from starting point)
Both features above are disabable.
Idle program doesn't loops, it is meant to be executed as a state program (which is scheduled continously as long as the process queue is empty)
About "advanced_npc:node_query"
program, can this be used like any program?
Is this documentation completely correct?
#### `NODE QUERY` (advanced_npc:node_query)
Check and run a program with nodes found near.
{
range = 2, -- Range of checked area in blocks.
count = 20, -- How many checks will be performed.
random_execution_times = true, --[[
^ Randomizes the number of checks that will be performed.
^ min_count and max_count is required ]]
min_count = 20, -- minimum of checks
max_count = 25, -- maximum of checks
nodes = {"itemstring1", "itemstring2"}, --[[
^ Nodes to be found for the actions.
^ When a node is found, it is add in the npc place map
with the place name "schedule_target_pos"
prefer_last_acted_upon_node = true, -- If prefer to act on nodes already acted upon
walkable_nodes = {"itemstring1", "itemstring2"}, -- Walkable nodes
on_found_executables = { --[[
^ Table where index is a itemstring of the node to be found,
and value is an array of programs to be performed
when found the node. ]]
["itemstring1"] = {
[1] = <program>,
[2] = <program>,
[3] = <program>
},
["itemstring2"] = {
[1] = <program>,
[2] = <program>
}
},
on_not_found_executables = { --[[
^ An array of programs to be performed when not found any node.
[1] = <program>,
[2] = <program>
},
state_program_on_finished = <program> --[[
^ [OPTIONAL]
^ A state program performed after ending all check counts ]]
}
EDIT: state_program_on_finished included