From 2ce1e8afbced13fbe420bf20f207aa8ae2ff42c7 Mon Sep 17 00:00:00 2001 From: BrunoMine Date: Sat, 4 Nov 2017 12:39:52 -0200 Subject: [PATCH] Convert to .MD docs --- ...ons_and_tasks.txt => actions_and_tasks.md} | 23 ++++++++++++------- doc/{api.txt => api.md} | 12 ++++++---- 2 files changed, 22 insertions(+), 13 deletions(-) rename doc/{actions_and_tasks.txt => actions_and_tasks.md} (69%) rename doc/{api.txt => api.md} (95%) diff --git a/doc/actions_and_tasks.txt b/doc/actions_and_tasks.md similarity index 69% rename from doc/actions_and_tasks.txt rename to doc/actions_and_tasks.md index 56c79f7..4a5dd74 100644 --- a/doc/actions_and_tasks.txt +++ b/doc/actions_and_tasks.md @@ -3,20 +3,26 @@ Advanced_NPC Alpha-2 (DEV) ========================== IMPORTANT: In this documentation is only the explanation of the particular operation of each predefined -action and task. Read reference documentation for details about API operation at `API.txt`. +action and task. Read reference documentation for details about API operation at `api.md`. Action (`add_action`) --------------------- -* `SET_INTERVAL` : Set the interval at which the `action` are executed. - args = { +Definition tables +----------------- + +#### `SET_INTERVAL` +Set the interval at which the `action` are executed. + + { interval = 1, -- A decimal number, in seconds (default is 1 second) freeze = false, -- if true, mobs_redo API will not execute until interval is set } -* `FREEZE` : This action allows to stop/execute mobs_redo API. - This is good for stopping the NPC from fighting, wandering, etc. - Arguments table definition +#### `FREEZE` +This action allows to stop/execute mobs_redo API. +This is good for stopping the NPC from fighting, wandering, etc. + { freeze = false, -- Boolean, if true, mobs_redo API will not execute. } @@ -24,8 +30,9 @@ Action (`add_action`) Tasks (`add_task`) ------------------ -* `USE_BED` : Sequence of actions that allows the NPC to use a bed. - Arguments table definition +#### `USE_BED` +Sequence of actions that allows the NPC to use a bed. + { pos = {x=0,y=0,z=0}, -- Position of bed to be used. action = action, --[[ diff --git a/doc/api.txt b/doc/api.md similarity index 95% rename from doc/api.txt rename to doc/api.md index 370d8d5..cdeca60 100644 --- a/doc/api.txt +++ b/doc/api.md @@ -3,7 +3,7 @@ Advanced_NPC API Reference Alpha-2 (DEV) * More information at IMPORTANT: This WIP & unfinished file contains the definitions of current advanced_npc functions -(Some documentation is lacking, so please bear in mind that this WIP file is just to enhance it.) +(Some documentation is lacking, so please bear in mind that this WIP file is just to enhance it) Introduction ------------ @@ -42,8 +42,8 @@ Or after add in the world NPC Steps --------- -The API works with NPC steps, then then `on_step` callback need -run the `npc.on_step(luaentity)`. This function process the NPC actions +The API works with NPC steps, then `on_step` callback need run the +`npc.on_step(luaentity)`. This function process the NPC actions and return the freeze state, which is used for stop mobs_redo behavior. Example: @@ -58,9 +58,9 @@ Here is a recommended code. do_custom = function(self, dtime) - -- Here is my "do_custom" code + -- Here is my "do_custom" code - -- Process the NPC action and return freeze state + -- Process the NPC action and return freeze state return npc.on_step(self) end @@ -163,12 +163,14 @@ Definition tables Examples: Syntax example 1: + npc.dialogue.register_dialogue({ text = "Hello.", -- "Hello." will be said by the NPC upon rightclick and displayed in the messages section. tags = {"unisex", "phase1"} -- The flags that define the conditions of who and what can say the text. }) Syntax example 2: + npc.dialogue.register_dialogue({ text = "Hello again." -- The tags object is excluded, meaning that any NPC can say "Hello again." upon rightclick under no condition.