forked from mirror/openmw-tes3mp
aiactivate works. Bug when you try to use it on a reference that doesn't exist. Need to clran up door.cpp
This commit is contained in:
parent
7c6e27e4f9
commit
a315d5cc2b
2 changed files with 11 additions and 16 deletions
|
@ -117,19 +117,19 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
// teleport door
|
// teleport door
|
||||||
/// \todo remove this if clause once ActionTeleport can also support other actors
|
/// \todo remove this if clause once ActionTeleport can also support other actors
|
||||||
if (MWBase::Environment::get().getWorld()->getPlayerPtr()==actor)
|
//if (MWBase::Environment::get().getWorld()->getPlayerPtr()==actor)
|
||||||
{
|
//{
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ref->mRef.mDestCell, ref->mRef.mDoorDest));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ref->mRef.mDestCell, ref->mRef.mDoorDest));
|
||||||
|
|
||||||
action->setSound(openSound);
|
action->setSound(openSound);
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
}
|
/*}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// another NPC or a creature is using the door
|
// another NPC or a creature is using the door
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
#include "../mwworld/action.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -64,19 +65,11 @@ bool MWMechanics::AiActivate::execute (const MWWorld::Ptr& actor,float duration)
|
||||||
{
|
{
|
||||||
mCellX = cell->mData.mX;
|
mCellX = cell->mData.mX;
|
||||||
mCellY = cell->mData.mY;
|
mCellY = cell->mData.mY;
|
||||||
float xCell = 0;
|
|
||||||
float yCell = 0;
|
|
||||||
|
|
||||||
if(cell->isExterior())
|
|
||||||
{
|
|
||||||
xCell = cell->mData.mX * ESM::Land::REAL_SIZE;
|
|
||||||
yCell = cell->mData.mY * ESM::Land::REAL_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ESM::Pathgrid::Point dest;
|
ESM::Pathgrid::Point dest;
|
||||||
dest.mX = targetPos.pos[0];
|
dest.mX = targetPos.pos[0];
|
||||||
dest.mY = targetPos.pos[0];
|
dest.mY = targetPos.pos[1];
|
||||||
dest.mZ = targetPos.pos[0];
|
dest.mZ = targetPos.pos[2];
|
||||||
|
|
||||||
ESM::Pathgrid::Point start;
|
ESM::Pathgrid::Point start;
|
||||||
start.mX = pos.pos[0];
|
start.mX = pos.pos[0];
|
||||||
|
@ -92,7 +85,8 @@ bool MWMechanics::AiActivate::execute (const MWWorld::Ptr& actor,float duration)
|
||||||
{
|
{
|
||||||
movement.mPosition[1] = 0;
|
movement.mPosition[1] = 0;
|
||||||
MWWorld::Ptr target = world->getPtr(mObjectId,false);
|
MWWorld::Ptr target = world->getPtr(mObjectId,false);
|
||||||
MWWorld::Class::get(target).activate(target,actor);
|
MWWorld::Class::get(target).activate(target,actor).get()->execute(actor);
|
||||||
|
std::cout << "activated";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +94,8 @@ bool MWMechanics::AiActivate::execute (const MWWorld::Ptr& actor,float duration)
|
||||||
{
|
{
|
||||||
movement.mPosition[1] = 0;
|
movement.mPosition[1] = 0;
|
||||||
MWWorld::Ptr target = world->getPtr(mObjectId,false);
|
MWWorld::Ptr target = world->getPtr(mObjectId,false);
|
||||||
MWWorld::Class::get(target).activate(target,actor);
|
MWWorld::Class::get(target).activate(target,actor).get()->execute(actor);
|
||||||
|
std::cout << "activated";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue