forked from teamnwah/openmw-tes3coop
Sneak: Added support for state checking
I need advice one what I should do in order to pass mActors over to the player. Particularly line 139 in player.cpp
This commit is contained in:
parent
3484df0743
commit
c3e08916da
4 changed files with 23 additions and 2 deletions
|
@ -164,6 +164,9 @@ namespace MWBase
|
||||||
///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;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -989,4 +989,9 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
return mActors.getActorsFollowing(actor);
|
return mActors.getActorsFollowing(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MWMechanics::Actors& MechanicsManager::getActors()
|
||||||
|
{
|
||||||
|
return *mActors;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,6 +137,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include <components/esm/defs.hpp>
|
#include <components/esm/defs.hpp>
|
||||||
#include <components/esm/loadbsgn.hpp>
|
#include <components/esm/loadbsgn.hpp>
|
||||||
|
|
||||||
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
@ -16,6 +18,8 @@
|
||||||
|
|
||||||
#include "../mwmechanics/movement.hpp"
|
#include "../mwmechanics/movement.hpp"
|
||||||
#include "../mwmechanics/npcstats.hpp"
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
#include "../mwmechanics/actors.hpp"
|
||||||
|
#include "../mwmechanics/mechanicsmanagerimp.hpp"
|
||||||
|
|
||||||
#include "class.hpp"
|
#include "class.hpp"
|
||||||
#include "ptr.hpp"
|
#include "ptr.hpp"
|
||||||
|
@ -130,8 +134,15 @@ namespace MWWorld
|
||||||
|
|
||||||
ptr.getClass().getCreatureStats(ptr).setMovementFlag(MWMechanics::CreatureStats::Flag_Sneak, sneak);
|
ptr.getClass().getCreatureStats(ptr).setMovementFlag(MWMechanics::CreatureStats::Flag_Sneak, sneak);
|
||||||
|
|
||||||
// TODO show sneak indicator only when the player is not detected by any actor
|
// Find all the actors who might be able to see the player
|
||||||
MWBase::Environment::get().getWindowManager()->setSneakVisibility(sneak);
|
std::vector<MWWorld::Ptr> neighbors;
|
||||||
|
MWBase::Environment::get().getMechanicsManager()->getActors().getObjectsInRange( Ogre::Vector3(ptr.getRefData().getPosition().pos),
|
||||||
|
esmStore.get<ESM::GameSetting>().find("fSneakUseDist")->getInt(), neighbors);
|
||||||
|
for (std::vector<MWWorld::Ptr>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
|
||||||
|
if ( MechanicsManager::awarenessCheck(ptr, *it) )
|
||||||
|
MWBase::Environment::get().getWindowManager()->setSneakVisibility(sneak);
|
||||||
|
if (!neighbors)
|
||||||
|
MWBase::Environment::get().getWindowManager()->setSneakVisibility(sneak);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::yaw(float yaw)
|
void Player::yaw(float yaw)
|
||||||
|
|
Loading…
Reference in a new issue