Don't assume only players activate doors

actorid
Chris Robinson 12 years ago
parent 46bc7bd9c8
commit 72a399054f

@ -67,16 +67,14 @@ namespace MWClass
boost::shared_ptr<MWWorld::Action> Door::activate (const MWWorld::Ptr& ptr, boost::shared_ptr<MWWorld::Action> Door::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const const MWWorld::Ptr& actor) const
{ {
MWWorld::LiveCellRef<ESM::Door> *ref = MWWorld::LiveCellRef<ESM::Door> *ref = ptr.get<ESM::Door>();
ptr.get<ESM::Door>();
const std::string &openSound = ref->mBase->mOpenSound; const std::string &openSound = ref->mBase->mOpenSound;
const std::string &closeSound = ref->mBase->mCloseSound; const std::string &closeSound = ref->mBase->mCloseSound;
const std::string lockedSound = "LockedDoor"; const std::string lockedSound = "LockedDoor";
const std::string trapActivationSound = "Disarm Trap Fail"; const std::string trapActivationSound = "Disarm Trap Fail";
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer(); MWWorld::ContainerStore &invStore = get(actor).getContainerStore(actor);
MWWorld::InventoryStore& invStore = MWWorld::Class::get(player).getInventoryStore(player);
bool needKey = ptr.getCellRef().mLockLevel>0; bool needKey = ptr.getCellRef().mLockLevel>0;
bool hasKey = false; bool hasKey = false;
@ -92,13 +90,14 @@ namespace MWClass
if (refId == keyId) if (refId == keyId)
{ {
hasKey = true; hasKey = true;
keyName = MWWorld::Class::get(*it).getName(*it); keyName = get(*it).getName(*it);
} }
} }
if (needKey && hasKey) if (needKey && hasKey)
{ {
MWBase::Environment::get().getWindowManager ()->messageBox (keyName + " #{sKeyUsed}"); if(actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer())
MWBase::Environment::get().getWindowManager()->messageBox(keyName + " #{sKeyUsed}");
ptr.getCellRef().mLockLevel = 0; ptr.getCellRef().mLockLevel = 0;
// using a key disarms the trap // using a key disarms the trap
ptr.getCellRef().mTrap = ""; ptr.getCellRef().mTrap = "";

Loading…
Cancel
Save