Better narration processing
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define PLAYERACTIONMODULE_H
|
||||
#include <flecs.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <lua.h>
|
||||
#include <Ogre.h>
|
||||
|
||||
namespace ECS {
|
||||
@@ -13,13 +14,19 @@ struct ActionNodeList {
|
||||
Ogre::String action_text;
|
||||
Ogre::Vector3 position;
|
||||
Ogre::Quaternion rotation;
|
||||
float height;
|
||||
float radius;
|
||||
nlohmann::json props;
|
||||
};
|
||||
std::vector<ActionNode> nodes;
|
||||
std::vector<ActionNode> nodes, dynamicNodes;
|
||||
std::shared_ptr<indexObject> indexObj;
|
||||
std::vector<size_t> points;
|
||||
std::vector<float> distances;
|
||||
int selected;
|
||||
bool dirty;
|
||||
bool busy;
|
||||
void build();
|
||||
bool query(const Ogre::Vector3 &position, std::vector<size_t> &points);
|
||||
bool query(const Ogre::Vector3 &position, std::vector<size_t> &points, std::vector<float> &distances);
|
||||
int addNode(struct ActionNodeList::ActionNode &node)
|
||||
{
|
||||
int index = nodes.size();
|
||||
@@ -32,10 +39,24 @@ struct ActionNodeList {
|
||||
nodes.erase(nodes.begin() + index);
|
||||
}
|
||||
};
|
||||
struct NPCActionNodes {
|
||||
std::vector<ActionNodeList::ActionNode> anodes;
|
||||
};
|
||||
struct PlayerActionModule {
|
||||
struct ActionWordHandler {
|
||||
virtual void operator()(flecs::entity town, int index,
|
||||
const Ogre::String &word) = 0;
|
||||
};
|
||||
|
||||
std::multimap<Ogre::String, ActionWordHandler *>
|
||||
actionWords;
|
||||
|
||||
struct PlayerActionModule
|
||||
{
|
||||
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);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user