From f3892d697b1670ed448b502890d14a3ed9e8df1d Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sun, 8 Jul 2018 00:06:01 +0300 Subject: [PATCH] [Client] Disable clientside locking and unlocking of objects --- apps/openmw/mwclass/container.cpp | 15 +++++++++++++-- apps/openmw/mwclass/door.cpp | 15 +++++++++++++-- apps/openmw/mwmechanics/security.cpp | 11 ++++++++++- apps/openmw/mwmechanics/spellcasting.cpp | 24 ++++++++++++++++++++++-- apps/openmw/mwscript/miscextensions.cpp | 22 ++++++++++++++++++++-- 5 files changed, 78 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp index db3dab28a..38d31a7ce 100644 --- a/apps/openmw/mwclass/container.cpp +++ b/apps/openmw/mwclass/container.cpp @@ -172,8 +172,19 @@ namespace MWClass if ((isLocked || isTrapped) && hasKey) { MWBase::Environment::get().getWindowManager ()->messageBox (keyName + " #{sKeyUsed}"); - if(isLocked) - unlock(ptr); + + /* + Start of tes3mp change (major) + + Disable unilateral unlocking on this client and expect the server's reply to our + packet to do it instead + */ + //if(isLocked) + // unlock(ptr); + /* + End of tes3mp change (major) + */ + // using a key disarms the trap if(isTrapped) { diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index 8e7f02d60..306af2f45 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -171,8 +171,19 @@ namespace MWClass { if(actor == MWMechanics::getPlayer()) MWBase::Environment::get().getWindowManager()->messageBox(keyName + " #{sKeyUsed}"); - if(isLocked) - unlock(ptr); //Call the function here. because that makes sense. + + /* + Start of tes3mp change (major) + + Disable unilateral unlocking on this client and expect the server's reply to our + packet to do it instead + */ + //if(isLocked) + // unlock(ptr); //Call the function here. because that makes sense. + /* + End of tes3mp change (major) + */ + // using a key disarms the trap if(isTrapped) { diff --git a/apps/openmw/mwmechanics/security.cpp b/apps/openmw/mwmechanics/security.cpp index 0b36c4774..4d930b576 100644 --- a/apps/openmw/mwmechanics/security.cpp +++ b/apps/openmw/mwmechanics/security.cpp @@ -68,7 +68,16 @@ namespace MWMechanics MWBase::Environment::get().getMechanicsManager()->objectOpened(mActor, lock); if (Misc::Rng::roll0to99() <= x) { - lock.getClass().unlock(lock); + /* + Start of tes3mp change (major) + + Disable unilateral locking on this client and expect the server's reply to our + packet to do it instead + */ + //lock.getClass().unlock(lock); + /* + End of tes3mp change (major) + */ /* Start of tes3mp addition diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index e4d5a7843..7ec2afbaf 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -692,7 +692,17 @@ namespace MWMechanics { if (caster == getPlayer()) MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicLockSuccess}"); - target.getClass().lock(target, static_cast(magnitude)); + + /* + Start of tes3mp change (major) + + Disable unilateral locking on this client and expect the server's reply to our + packet to do it instead + */ + //target.getClass().lock(target, static_cast(magnitude)); + /* + End of tes3mp change (major) + */ /* Start of tes3mp addition @@ -728,7 +738,17 @@ namespace MWMechanics if (caster == getPlayer()) MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicOpenSuccess}"); } - target.getClass().unlock(target); + + /* + Start of tes3mp change (major) + + Disable unilateral locking on this client and expect the server's reply to our + packet to do it instead + */ + //target.getClass().unlock(target); + /* + End of tes3mp change (major) + */ /* Start of tes3mp addition diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index cceaf0a07..f3c26edf6 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -221,7 +221,16 @@ namespace MWScript End of tes3mp addition */ - ptr.getClass().lock (ptr, lockLevel); + /* + Start of tes3mp change (major) + + Disable unilateral locking on this client and expect the server's reply to our + packet to do it instead + */ + //ptr.getClass().lock (ptr, lockLevel); + /* + End of tes3mp change (major) + */ // Instantly reset door to closed state // This is done when using Lock in scripts, but not when using Lock spells. @@ -261,7 +270,16 @@ namespace MWScript End of tes3mp addition */ - ptr.getClass().unlock (ptr); + /* + Start of tes3mp change (major) + + Disable unilateral unlocking on this client and expect the server's reply to our + packet to do it instead + */ + //ptr.getClass().unlock (ptr); + /* + End of tes3mp change (major) + */ } };