Allows you to register lua TreeNodes, Conditions, Filters and ISteerings. More...
#include <LUAAIRegistry.h>
Public Member Functions | |
lua_State * | getLuaState () |
Access to the lua state. More... | |
int | pushAIMetatable () |
Pushes the AI metatable onto the stack. This allows anyone to modify it to provide own functions and data that is applied to the ai parameters of the lua functions. More... | |
int | pushCharacterMetatable () |
Pushes the character metatable onto the stack. This allows anyone to modify it to provide own functions and data that is applied to the ai:character() value. | |
bool | init () |
void | shutdown () |
bool | evaluate (const std::string &str) |
bool | evaluate (const char *luaBuffer, size_t size) |
Load your lua scripts into the lua state of the registry. This can be called multiple times to e.g. load multiple files. More... | |
Public Member Functions inherited from ai::AIRegistry | |
bool | registerNodeFactory (const std::string &type, const ITreeNodeFactory &factory) |
Registers a tree node factory of the given type . More... | |
bool | unregisterNodeFactory (const std::string &type) |
Unregisters a tree node factory of the given type . This can also be used to replace a built-in type with a user provided type. More... | |
bool | registerSteerNodeFactory (const std::string &type, const ISteerNodeFactory &factory) |
bool | unregisterSteerNodeFactory (const std::string &type) |
Unregisters a tree node factory of the given type . This can also be used to replace a built-in type with a user provided type. More... | |
bool | registerSteeringFactory (const std::string &type, const ISteeringFactory &factory) |
bool | unregisterSteeringFactory (const std::string &type) |
bool | registerFilterFactory (const std::string &type, const IFilterFactory &factory) |
bool | unregisterFilterFactory (const std::string &type) |
Unregisters a filter factory of the given type . This can also be used to replace a built-in type with a user provided type. More... | |
bool | registerConditionFactory (const std::string &type, const IConditionFactory &factory) |
bool | unregisterConditionFactory (const std::string &type) |
Unregisters a condition factory of the given type . This can also be used to replace a built-in type with a user provided type. More... | |
TreeNodePtr | createNode (const std::string &type, const TreeNodeFactoryContext &ctx) const override |
Allocates a new TreeNode for the given type . The type must be registered in the AIRegistry for this to work. | |
TreeNodePtr | createSteerNode (const std::string &type, const SteerNodeFactoryContext &ctx) const override |
Allocates a new TreeNode for the given type . The type must be registered in the AIRegistry for this to work. | |
FilterPtr | createFilter (const std::string &type, const FilterFactoryContext &ctx) const override |
Allocates a new IFilter for the given type . The type must be registered in the AIRegistry for this to work. | |
ConditionPtr | createCondition (const std::string &type, const ConditionFactoryContext &ctx) const override |
Allocates a new ICondition for the given type . The type must be registered in the AIRegistry for this to work. | |
SteeringPtr | createSteering (const std::string &type, const SteeringFactoryContext &ctx) const override |
Creates a new ISteering for the given type . The type must be registered in the AIRegistry for this to work. | |
Static Public Member Functions | |
static int | luaAI_aisetfilteredentities (lua_State *s) |
static int | luaAI_aiaddfilteredentity (lua_State *s) |
Protected Types | |
using | LuaNodeFactory = LUATreeNode::LUATreeNodeFactory |
typedef std::shared_ptr < LuaNodeFactory > | LUATreeNodeFactoryPtr |
typedef std::map< std::string, LUATreeNodeFactoryPtr > | TreeNodeFactoryMap |
using | LuaConditionFactory = LUACondition::LUAConditionFactory |
typedef std::shared_ptr < LuaConditionFactory > | LUAConditionFactoryPtr |
typedef std::map< std::string, LUAConditionFactoryPtr > | ConditionFactoryMap |
using | LuaFilterFactory = LUAFilter::LUAFilterFactory |
typedef std::shared_ptr < LuaFilterFactory > | LUAFilterFactoryPtr |
typedef std::map< std::string, LUAFilterFactoryPtr > | FilterFactoryMap |
using | LuaSteeringFactory = movement::LUASteering::LUASteeringFactory |
typedef std::shared_ptr < LuaSteeringFactory > | LUASteeringFactoryPtr |
typedef std::map< std::string, LUASteeringFactoryPtr > | SteeringFactoryMap |
Static Protected Member Functions | |
static LUAAIRegistry * | luaAI_toregistry (lua_State *s) |
static LuaNodeFactory * | luaAI_tonodefactory (lua_State *s, int n) |
static LuaConditionFactory * | luaAI_toconditionfactory (lua_State *s, int n) |
static LuaFilterFactory * | luaGetFilterFactoryContext (lua_State *s, int n) |
static LuaSteeringFactory * | luaAI_tosteeringfactory (lua_State *s, int n) |
static int | luaAI_nodeemptyexecute (lua_State *s) |
static int | luaAI_nodetostring (lua_State *s) |
static int | luaAI_createnode (lua_State *s) |
static int | luaAI_conditionemptyevaluate (lua_State *s) |
static int | luaAI_conditiontostring (lua_State *s) |
static int | luaAI_createcondition (lua_State *s) |
static int | luaAI_filteremptyfilter (lua_State *s) |
static int | luaAI_filtertostring (lua_State *s) |
static int | luaAI_createfilter (lua_State *s) |
static int | luaAI_steeringemptyexecute (lua_State *s) |
static int | luaAI_steeringtostring (lua_State *s) |
static int | luaAI_createsteering (lua_State *s) |
Protected Attributes | |
lua_State * | _s = nullptr |
ReadWriteLock | _lock {"luaregistry"} |
TreeNodeFactoryMap | _treeNodeFactories |
ConditionFactoryMap | _conditionFactories |
FilterFactoryMap | _filterFactories |
SteeringFactoryMap | _steeringFactories |
Protected Attributes inherited from ai::AIRegistry | |
TreeNodeFactory | _treeNodeFactory |
SteerNodeFactory | _steerNodeFactory |
SteeringFactory | _steeringFactory |
FilterFactory | _filterFactory |
ConditionFactory | _conditionFactory |
Allows you to register lua TreeNodes, Conditions, Filters and ISteerings.
Use SomeName
later on in your behaviour trees to use this ICondition
Use SomeName
later on in your behaviour trees to use this ICondition
|
inline |
Load your lua scripts into the lua state of the registry. This can be called multiple times to e.g. load multiple files.
true
if the lua script was loaded, false
otherwise
|
inline |
Access to the lua state.
|
inline |
|
inline |
|
inline |
std::vector<luaL_Reg> ai::LUAAIRegistry::aggroMgrFuncs |
std::vector<luaL_Reg> ai::LUAAIRegistry::aiFuncs |
std::vector<luaL_Reg> ai::LUAAIRegistry::characterFuncs |
std::vector<luaL_Reg> ai::LUAAIRegistry::groupMgrFuncs |
std::vector<luaL_Reg> ai::LUAAIRegistry::registryFuncs |
std::vector<luaL_Reg> ai::LUAAIRegistry::vecFuncs |
std::vector<luaL_Reg> ai::LUAAIRegistry::zoneFuncs |