1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:23:52 +00:00

Don't assume only players activate doors

This commit is contained in:
Chris Robinson 2013-08-09 01:35:29 -07:00
parent 46bc7bd9c8
commit 72a399054f

View file

@ -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,12 +90,13 @@ 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)
{ {
if(actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer())
MWBase::Environment::get().getWindowManager()->messageBox(keyName + " #{sKeyUsed}"); 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