diff --git a/apps/openmw/mwmechanics/security.cpp b/apps/openmw/mwmechanics/security.cpp index 97878db87..25e032e2e 100644 --- a/apps/openmw/mwmechanics/security.cpp +++ b/apps/openmw/mwmechanics/security.cpp @@ -1,5 +1,10 @@ #include "security.hpp" +#include +#include "../mwmp/Main.hpp" + +#include "../mwworld/cellstore.hpp" + #include #include "../mwworld/class.hpp" @@ -52,6 +57,13 @@ namespace MWMechanics MWBase::Environment::get().getMechanicsManager()->objectOpened(mActor, lock); if (Misc::Rng::roll0to99() <= x) { + // Added by tes3mp + mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent(); + event->cell = *lock.getCell()->getCell(); + event->cellRef.mRefID = lock.getCellRef().getRefId(); + event->cellRef.mRefNum = lock.getCellRef().getRefNum(); + mwmp::Main::get().getNetworking()->GetWorldPacket(ID_WORLD_OBJECT_UNLOCK)->Send(event); + lock.getClass().unlock(lock); resultMessage = "#{sLockSuccess}"; resultSound = "Open Lock"; diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index 31a8126b0..209e8397d 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -212,6 +212,13 @@ namespace MWScript { MWWorld::Ptr ptr = R()(runtime); + // Added by tes3mp + mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent(); + event->cell = *ptr.getCell()->getCell(); + event->cellRef.mRefID = ptr.getCellRef().getRefId(); + event->cellRef.mRefNum = ptr.getCellRef().getRefNum(); + mwmp::Main::get().getNetworking()->GetWorldPacket(ID_WORLD_OBJECT_UNLOCK)->Send(event); + ptr.getClass().unlock (ptr); } }; diff --git a/apps/openmw/mwworld/actiontake.cpp b/apps/openmw/mwworld/actiontake.cpp index d057ad071..4be82030f 100644 --- a/apps/openmw/mwworld/actiontake.cpp +++ b/apps/openmw/mwworld/actiontake.cpp @@ -2,6 +2,7 @@ #include #include "../mwmp/Main.hpp" + #include "../mwworld/cellstore.hpp" #include "../mwbase/environment.hpp"