Started working on dialogue

This commit is contained in:
2026-01-23 21:28:25 +03:00
parent 1d358d206e
commit 8320b14358
7 changed files with 184 additions and 82 deletions

View File

@@ -656,7 +656,8 @@ PhysicsModule::PhysicsModule(flecs::world &ecs)
}
// gr.velocity.y = 0.0f;
// v.y = 0.0f;
ch->SetLinearVelocity(JoltPhysics::convert(v));
ch->SetLinearVelocity(
JoltPhysics::convert<JPH::Vec3>(v));
gr.velocity = Ogre::Vector3::ZERO;
});
ecs.system<const EngineData, CharacterBase, const CharacterBody,

View File

@@ -151,6 +151,36 @@ struct LuaNarrationHandler : GUI::NarrationHandler {
},
1);
lua_setfield(L, -2, "_finish");
lua_pushlightuserdata(L, this);
lua_pushcclosure(
L,
[](lua_State *L) {
LuaNarrationHandler *handler =
static_cast<LuaNarrationHandler *>(
lua_touserdata(
L,
lua_upvalueindex(1)));
int answer = handler->getNarrationAnswer();
lua_pushinteger(L, answer);
return 1;
},
1);
lua_setfield(L, -2, "_get_narration_answer");
lua_pushlightuserdata(L, this);
lua_pushcclosure(
L,
[](lua_State *L) {
LuaNarrationHandler *handler =
static_cast<LuaNarrationHandler *>(
lua_touserdata(
L,
lua_upvalueindex(1)));
lua_pushstring(
L, handler->getProperties().c_str());
return 1;
},
1);
lua_setfield(L, -2, "_get_properties");
lua_pop(L, 1);
}
void finish() override
@@ -177,8 +207,6 @@ struct LuaNarrationHandler : GUI::NarrationHandler {
OgreAssert(false, "lua error");
lua_pop(L, 1);
}
// _narration("Greetings...", {});
// std::cout << getPropsJSON().dump(4) << std::endl;
}
void event(const Ogre::String &evt) override
{
@@ -233,25 +261,6 @@ PlayerActionModule::PlayerActionModule(flecs::world &ecs)
alist.busy = false;
})
.add(flecs::Singleton);
#if 0
ecs.system<ActionNodeList>("testNodeList")
.kind(flecs::OnUpdate)
.each([](ActionNodeList &list) {
if (list.nodes.size() > 0) {
Ogre::Vector3 queryPos =
ECS::get<Camera>()
.mCameraNode
->_getDerivedPosition();
std::vector<size_t> points;
list.query(queryPos, points);
for (auto &p : points)
std::cout << p << std::endl
<< list.nodes[p].props.dump()
<< std::endl;
OgreAssert(points.size() == 0, "got result");
}
});
#endif
ecs.system<ActionNodeList>("updateNodeList")
.kind(flecs::OnUpdate)
.each([](ActionNodeList &list) {
@@ -314,8 +323,6 @@ PlayerActionModule::PlayerActionModule(flecs::world &ecs)
if (!ECS::get<GUI>().enabled)
list.busy = false;
});
// SimpleWordHandler *handler = OGRE_NEW SimpleWordHandler;
// addWordHandler("talk", handler);
}
void PlayerActionModule::addWordHandler(const Ogre::String &word,