#ifndef PLAYERACTIONMODULE_H #define PLAYERACTIONMODULE_H #include #include #include #include namespace ECS { struct ActionNodeList { struct indexObject; struct ActionNode { Ogre::String action; Ogre::String action_text; Ogre::Vector3 position; Ogre::Quaternion rotation; float height; float radius; nlohmann::json props; }; std::vector nodes, dynamicNodes; std::shared_ptr indexObj; std::vector points; std::vector distances; int selected; bool dirty; bool busy; void build(); bool query(const Ogre::Vector3 &position, std::vector &points, std::vector &distances); int addNode(struct ActionNodeList::ActionNode &node) { int index = nodes.size(); nodes.push_back(node); dirty = true; return index; } void removeNode(int index) { nodes.erase(nodes.begin() + index); } }; struct NPCActionNodes { std::vector anodes; }; struct PlayerActionModule { struct ActionWordHandler { virtual void operator()(flecs::entity town, int index, const Ogre::String &word) = 0; }; std::multimap actionWords; PlayerActionModule(flecs::world &ecs); void addWordHandler(const Ogre::String &word, ActionWordHandler *handler); void removeWordHandler(const Ogre::String &word, ActionWordHandler *handler); void addLuaWordHandler(const Ogre::String &word, lua_State *L, int ref); void removeLuaWordHandler(const Ogre::String &word, lua_State *L, int ref); int setupLuaActionHandler(lua_State *L); }; } #endif // PLAYERACTIONMODULE_H