mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-04 02:45:35 +00:00
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
|
||||
/// \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));
|
||||
|
||||
action->setSound(openSound);
|
||||
|
||||
return action;
|
||||
}
|
||||
/*}
|
||||
else
|
||||
{
|
||||
// another NPC or a creature is using the door
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/action.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -64,19 +65,11 @@ bool MWMechanics::AiActivate::execute (const MWWorld::Ptr& actor,float duration)
|
|||
{
|
||||
mCellX = cell->mData.mX;
|
||||
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;
|
||||
dest.mX = targetPos.pos[0];
|
||||
dest.mY = targetPos.pos[0];
|
||||
dest.mZ = targetPos.pos[0];
|
||||
dest.mY = targetPos.pos[1];
|
||||
dest.mZ = targetPos.pos[2];
|
||||
|
||||
ESM::Pathgrid::Point start;
|
||||
start.mX = pos.pos[0];
|
||||
|
@ -92,7 +85,8 @@ bool MWMechanics::AiActivate::execute (const MWWorld::Ptr& actor,float duration)
|
|||
{
|
||||
movement.mPosition[1] = 0;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -100,7 +94,8 @@ bool MWMechanics::AiActivate::execute (const MWWorld::Ptr& actor,float duration)
|
|||
{
|
||||
movement.mPosition[1] = 0;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue