Removed mBodyNode from CharacterBase
This commit is contained in:
@@ -188,17 +188,16 @@ public:
|
||||
int update(float delta) override
|
||||
{
|
||||
if (npc.e.is_valid()) {
|
||||
Ogre::SceneNode *n =
|
||||
ECS::get<CharacterModule>()
|
||||
.characterNodes.at(npc.e);
|
||||
Ogre::Vector3 position =
|
||||
npc.e.get<CharacterBase>()
|
||||
.mBodyNode
|
||||
->_getDerivedPosition();
|
||||
n->_getDerivedPosition();
|
||||
if (position.squaredDistance(targetPosition) >=
|
||||
radius * radius) {
|
||||
if (npc.e.is_valid())
|
||||
npc.e.get<CharacterBase>()
|
||||
.mBodyNode
|
||||
->_setDerivedPosition(
|
||||
targetPosition);
|
||||
n->_setDerivedPosition(
|
||||
targetPosition);
|
||||
npc.position = targetPosition;
|
||||
return BUSY;
|
||||
}
|
||||
@@ -588,11 +587,13 @@ CharacterAIModule::CharacterAIModule(flecs::world &ecs)
|
||||
it++) {
|
||||
auto &npc = npcs.npcs.at(it->first);
|
||||
if (npc.e.is_valid() &&
|
||||
npc.e.has<CharacterBase>())
|
||||
npc.position =
|
||||
npc.e.get<CharacterBase>()
|
||||
.mBodyNode
|
||||
->_getDerivedPosition();
|
||||
npc.e.has<CharacterBase>()) {
|
||||
Ogre::SceneNode *n =
|
||||
ECS::get<CharacterModule>()
|
||||
.characterNodes.at(
|
||||
npc.e);
|
||||
npc.position = n->_getDerivedPosition();
|
||||
}
|
||||
}
|
||||
});
|
||||
ecs.system<ActionNodeList, TownAI, TownNPCs>("UpdateBlackboards")
|
||||
@@ -1214,11 +1215,12 @@ void Blackboard::query_ai()
|
||||
const float distance = 10000.0f;
|
||||
Ogre::Vector3 position(0, 0, 0);
|
||||
if (npcs.npcs.at(index).e.is_valid() &&
|
||||
npcs.npcs.at(index).e.has<CharacterBase>())
|
||||
position = npcs.npcs.at(index)
|
||||
.e.get<CharacterBase>()
|
||||
.mBodyNode->_getDerivedPosition();
|
||||
else
|
||||
npcs.npcs.at(index).e.has<CharacterBase>()) {
|
||||
Ogre::SceneNode *n =
|
||||
ECS::get<CharacterModule>().characterNodes.at(
|
||||
npcs.npcs.at(index).e);
|
||||
position = n->_getDerivedPosition();
|
||||
} else
|
||||
from_json(npcs.npcs.at(index).props["position"], position);
|
||||
this->position = position;
|
||||
ActionNodeList &alist = ECS::get_mut<ActionNodeList>();
|
||||
|
||||
Reference in New Issue
Block a user