mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-30 07:36:46 +00:00
Send ID_WORLD_OBJECT_UNLOCK from ingame scripts and regular unlocking
This commit is contained in:
parent
08ea5163c4
commit
3a5a5e73a1
3 changed files with 20 additions and 0 deletions
|
@ -1,5 +1,10 @@
|
||||||
#include "security.hpp"
|
#include "security.hpp"
|
||||||
|
|
||||||
|
#include <components/openmw-mp/Base/WorldEvent.hpp>
|
||||||
|
#include "../mwmp/Main.hpp"
|
||||||
|
|
||||||
|
#include "../mwworld/cellstore.hpp"
|
||||||
|
|
||||||
#include <components/misc/rng.hpp>
|
#include <components/misc/rng.hpp>
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
@ -52,6 +57,13 @@ namespace MWMechanics
|
||||||
MWBase::Environment::get().getMechanicsManager()->objectOpened(mActor, lock);
|
MWBase::Environment::get().getMechanicsManager()->objectOpened(mActor, lock);
|
||||||
if (Misc::Rng::roll0to99() <= x)
|
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);
|
lock.getClass().unlock(lock);
|
||||||
resultMessage = "#{sLockSuccess}";
|
resultMessage = "#{sLockSuccess}";
|
||||||
resultSound = "Open Lock";
|
resultSound = "Open Lock";
|
||||||
|
|
|
@ -212,6 +212,13 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = R()(runtime);
|
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);
|
ptr.getClass().unlock (ptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <components/openmw-mp/Base/WorldEvent.hpp>
|
#include <components/openmw-mp/Base/WorldEvent.hpp>
|
||||||
#include "../mwmp/Main.hpp"
|
#include "../mwmp/Main.hpp"
|
||||||
|
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
Loading…
Reference in a new issue