forked from mirror/openmw-tes3mp
Reworked the accusation of actors
This commit is contained in:
parent
c3e08916da
commit
42b879a9a5
4 changed files with 13 additions and 14 deletions
|
@ -160,13 +160,11 @@ namespace MWBase
|
||||||
virtual bool isAIActive() = 0;
|
virtual bool isAIActive() = 0;
|
||||||
|
|
||||||
virtual void getObjectsInRange (const Ogre::Vector3& position, float radius, std::vector<MWWorld::Ptr>& objects) = 0;
|
virtual void getObjectsInRange (const Ogre::Vector3& position, float radius, std::vector<MWWorld::Ptr>& objects) = 0;
|
||||||
|
virtual void getActorsInRange(const Ogre::Vector3 &position, float radius, std::vector<MWWorld::Ptr> &objects) = 0;
|
||||||
|
|
||||||
///return the list of actors which are following the given actor (ie AiFollow is active and the target is the actor)
|
///return the list of actors which are following the given actor (ie AiFollow is active and the target is the actor)
|
||||||
virtual std::list<MWWorld::Ptr> getActorsFollowing(const MWWorld::Ptr& actor) = 0;
|
virtual std::list<MWWorld::Ptr> getActorsFollowing(const MWWorld::Ptr& actor) = 0;
|
||||||
|
|
||||||
///return the list of actors
|
|
||||||
virtual MWMechanics::Actors& getActors() = 0;
|
|
||||||
|
|
||||||
virtual void playerLoaded() = 0;
|
virtual void playerLoaded() = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -985,13 +985,13 @@ namespace MWMechanics
|
||||||
mObjects.getObjectsInRange(position, radius, objects);
|
mObjects.getObjectsInRange(position, radius, objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MechanicsManager::getActorsInRange(const Ogre::Vector3 &position, float radius, std::vector<MWWorld::Ptr> &objects)
|
||||||
|
{
|
||||||
|
mActors.getObjectsInRange(position, radius, objects);
|
||||||
|
}
|
||||||
|
|
||||||
std::list<MWWorld::Ptr> MechanicsManager::getActorsFollowing(const MWWorld::Ptr& actor)
|
std::list<MWWorld::Ptr> MechanicsManager::getActorsFollowing(const MWWorld::Ptr& actor)
|
||||||
{
|
{
|
||||||
return mActors.getActorsFollowing(actor);
|
return mActors.getActorsFollowing(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
MWMechanics::Actors& MechanicsManager::getActors()
|
|
||||||
{
|
|
||||||
return *mActors;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,11 +134,10 @@ namespace MWMechanics
|
||||||
virtual void updateMagicEffects (const MWWorld::Ptr& ptr);
|
virtual void updateMagicEffects (const MWWorld::Ptr& ptr);
|
||||||
|
|
||||||
virtual void getObjectsInRange (const Ogre::Vector3& position, float radius, std::vector<MWWorld::Ptr>& objects);
|
virtual void getObjectsInRange (const Ogre::Vector3& position, float radius, std::vector<MWWorld::Ptr>& objects);
|
||||||
|
virtual void getActorsInRange(const Ogre::Vector3 &position, float radius, std::vector<MWWorld::Ptr> &objects);
|
||||||
|
|
||||||
virtual std::list<MWWorld::Ptr> getActorsFollowing(const MWWorld::Ptr& actor);
|
virtual std::list<MWWorld::Ptr> getActorsFollowing(const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
virtual MWMechanics::Actors& getActors();
|
|
||||||
|
|
||||||
virtual void toggleAI();
|
virtual void toggleAI();
|
||||||
virtual bool isAIActive();
|
virtual bool isAIActive();
|
||||||
|
|
||||||
|
|
|
@ -134,14 +134,16 @@ namespace MWWorld
|
||||||
|
|
||||||
ptr.getClass().getCreatureStats(ptr).setMovementFlag(MWMechanics::CreatureStats::Flag_Sneak, sneak);
|
ptr.getClass().getCreatureStats(ptr).setMovementFlag(MWMechanics::CreatureStats::Flag_Sneak, sneak);
|
||||||
|
|
||||||
|
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
// Find all the actors who might be able to see the player
|
// Find all the actors who might be able to see the player
|
||||||
std::vector<MWWorld::Ptr> neighbors;
|
std::vector<MWWorld::Ptr> neighbors;
|
||||||
MWBase::Environment::get().getMechanicsManager()->getActors().getObjectsInRange( Ogre::Vector3(ptr.getRefData().getPosition().pos),
|
MWBase::Environment::get().getMechanicsManager()->getActorsInRange( Ogre::Vector3(ptr.getRefData().getPosition().pos),
|
||||||
esmStore.get<ESM::GameSetting>().find("fSneakUseDist")->getInt(), neighbors);
|
esmStore.get<ESM::GameSetting>().find("fSneakUseDist")->getInt(), neighbors);
|
||||||
for (std::vector<MWWorld::Ptr>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
|
for (std::vector<MWWorld::Ptr>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
|
||||||
if ( MechanicsManager::awarenessCheck(ptr, *it) )
|
if ( MWBase::Environment::get().getMechanicsManager()->awarenessCheck(ptr, *it) )
|
||||||
MWBase::Environment::get().getWindowManager()->setSneakVisibility(sneak);
|
MWBase::Environment::get().getWindowManager()->setSneakVisibility(sneak);
|
||||||
if (!neighbors)
|
if (!neighbors.size())
|
||||||
MWBase::Environment::get().getWindowManager()->setSneakVisibility(sneak);
|
MWBase::Environment::get().getWindowManager()->setSneakVisibility(sneak);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue