mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-20 19:39:41 +00:00
[Client] Send ObjectLock whenever using spells or keys to unlock objects
This commit is contained in:
parent
870fd9a78b
commit
b1264cca92
4 changed files with 74 additions and 2 deletions
|
@ -1,5 +1,17 @@
|
|||
#include "container.hpp"
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Include additional headers for multiplayer purposes
|
||||
*/
|
||||
#include "../mwmp/Main.hpp"
|
||||
#include "../mwmp/Networking.hpp"
|
||||
#include "../mwmp/WorldEvent.hpp"
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
#include <components/esm/loadcont.hpp>
|
||||
#include <components/esm/containerstate.hpp>
|
||||
|
||||
|
@ -174,6 +186,22 @@ namespace MWClass
|
|||
MWBase::SoundManager::Play_Normal);
|
||||
isTrapped = false;
|
||||
}
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Send an ID_OBJECT_LOCK packet every time a container is unlocked here
|
||||
*/
|
||||
if (isLocked)
|
||||
{
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->reset();
|
||||
worldEvent->addObjectLock(ptr, 0);
|
||||
worldEvent->sendObjectLock();
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
#include "door.hpp"
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Include additional headers for multiplayer purposes
|
||||
*/
|
||||
#include "../mwmp/Main.hpp"
|
||||
#include "../mwmp/Networking.hpp"
|
||||
#include "../mwmp/WorldEvent.hpp"
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
#include <components/esm/loaddoor.hpp>
|
||||
#include <components/esm/doorstate.hpp>
|
||||
|
||||
|
@ -159,6 +171,22 @@ namespace MWClass
|
|||
MWBase::SoundManager::Play_Normal);
|
||||
isTrapped = false;
|
||||
}
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Send an ID_OBJECT_LOCK packet every time a door is unlocked here
|
||||
*/
|
||||
if (isLocked)
|
||||
{
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->reset();
|
||||
worldEvent->addObjectLock(ptr, 0);
|
||||
worldEvent->sendObjectLock();
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
}
|
||||
|
||||
if (!isLocked || hasKey)
|
||||
|
|
|
@ -66,10 +66,12 @@ namespace MWMechanics
|
|||
MWBase::Environment::get().getMechanicsManager()->objectOpened(mActor, lock);
|
||||
if (Misc::Rng::roll0to99() <= x)
|
||||
{
|
||||
lock.getClass().unlock(lock);
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Send an ID_OBJECT_LOCK packet every time an object is unlocked
|
||||
Send an ID_OBJECT_LOCK packet every time an object is unlocked here
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->reset();
|
||||
|
@ -79,7 +81,6 @@ namespace MWMechanics
|
|||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
lock.getClass().unlock(lock);
|
||||
resultMessage = "#{sLockSuccess}";
|
||||
resultSound = "Open Lock";
|
||||
mActor.getClass().skillUsageSucceeded(mActor, ESM::Skill::Security, 1);
|
||||
|
|
|
@ -15,8 +15,10 @@
|
|||
*/
|
||||
#include <components/openmw-mp/Log.hpp>
|
||||
#include "../mwmp/Main.hpp"
|
||||
#include "../mwmp/Networking.hpp"
|
||||
#include "../mwmp/PlayerList.hpp"
|
||||
#include "../mwmp/LocalPlayer.hpp"
|
||||
#include "../mwmp/WorldEvent.hpp"
|
||||
#include "../mwmp/MechanicsHelper.hpp"
|
||||
/*
|
||||
End of tes3mp addition
|
||||
|
@ -639,6 +641,19 @@ namespace MWMechanics
|
|||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicOpenSuccess}");
|
||||
}
|
||||
target.getClass().unlock(target);
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Send an ID_OBJECT_LOCK packet every time an object is unlocked here
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->reset();
|
||||
worldEvent->addObjectLock(target, 0);
|
||||
worldEvent->sendObjectLock();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
}
|
||||
else
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(target, "Open Lock Fail", 1.f, 1.f);
|
||||
|
|
Loading…
Reference in a new issue