mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-21 05:44:06 +00:00
[Client] Finish drag and drops when arrested or teleported by server
This commit is contained in:
parent
ebf88d12a3
commit
535fba0cb3
6 changed files with 53 additions and 12 deletions
|
@ -198,6 +198,17 @@ namespace MWBase
|
||||||
virtual void getMousePosition(int &x, int &y) = 0;
|
virtual void getMousePosition(int &x, int &y) = 0;
|
||||||
virtual void getMousePosition(float &x, float &y) = 0;
|
virtual void getMousePosition(float &x, float &y) = 0;
|
||||||
virtual void setDragDrop(bool dragDrop) = 0;
|
virtual void setDragDrop(bool dragDrop) = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Start of tes3mp addition
|
||||||
|
|
||||||
|
Allow the completion of a drag and drop from elsewhere in the code
|
||||||
|
*/
|
||||||
|
virtual void finishDragDrop() = 0;
|
||||||
|
/*
|
||||||
|
End of tes3mp addition
|
||||||
|
*/
|
||||||
|
|
||||||
virtual bool getWorldMouseOver() = 0;
|
virtual bool getWorldMouseOver() = 0;
|
||||||
|
|
||||||
virtual bool toggleFogOfWar() = 0;
|
virtual bool toggleFogOfWar() = 0;
|
||||||
|
|
|
@ -1204,6 +1204,20 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getInputManager()->setDragDrop(dragDrop);
|
MWBase::Environment::get().getInputManager()->setDragDrop(dragDrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Start of tes3mp addition
|
||||||
|
|
||||||
|
Allow the completion of a drag and drop from elsewhere in the code
|
||||||
|
*/
|
||||||
|
void WindowManager::finishDragDrop()
|
||||||
|
{
|
||||||
|
if (mDragAndDrop->mIsOnDragAndDrop)
|
||||||
|
mDragAndDrop->finish();
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
End of tes3mp addition
|
||||||
|
*/
|
||||||
|
|
||||||
void WindowManager::setCursorVisible(bool visible)
|
void WindowManager::setCursorVisible(bool visible)
|
||||||
{
|
{
|
||||||
mCursorVisible = visible;
|
mCursorVisible = visible;
|
||||||
|
|
|
@ -231,6 +231,17 @@ namespace MWGui
|
||||||
virtual void getMousePosition(int &x, int &y);
|
virtual void getMousePosition(int &x, int &y);
|
||||||
virtual void getMousePosition(float &x, float &y);
|
virtual void getMousePosition(float &x, float &y);
|
||||||
virtual void setDragDrop(bool dragDrop);
|
virtual void setDragDrop(bool dragDrop);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Start of tes3mp addition
|
||||||
|
|
||||||
|
Allow the completion of a drag and drop from elsewhere in the code
|
||||||
|
*/
|
||||||
|
virtual void finishDragDrop();
|
||||||
|
/*
|
||||||
|
End of tes3mp addition
|
||||||
|
*/
|
||||||
|
|
||||||
virtual bool getWorldMouseOver();
|
virtual bool getWorldMouseOver();
|
||||||
|
|
||||||
virtual bool toggleFogOfWar();
|
virtual bool toggleFogOfWar();
|
||||||
|
|
|
@ -83,18 +83,20 @@ bool AiPursue::execute (const MWWorld::Ptr& actor, CharacterController& characte
|
||||||
|
|
||||||
|
|
||||||
if (pathTo(actor, dest, duration, 100)) {
|
if (pathTo(actor, dest, duration, 100)) {
|
||||||
target.getClass().activate(target,actor).get()->execute(actor); //Arrest player when reached
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Start of tes3mp addition
|
Start of tes3mp addition
|
||||||
|
|
||||||
Record that the player has not died since the last attempt to arrest them
|
Record that the player has not died since the last attempt to arrest them
|
||||||
|
|
||||||
|
Close the player's inventory or open container and cancel any drag and drops
|
||||||
*/
|
*/
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "After being pursued by %s, diedSinceArrestAttempt is now false", actor.getCellRef().getRefId().c_str());
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "After being pursued by %s, diedSinceArrestAttempt is now false", actor.getCellRef().getRefId().c_str());
|
||||||
mwmp::Main::get().getLocalPlayer()->diedSinceArrestAttempt = false;
|
mwmp::Main::get().getLocalPlayer()->diedSinceArrestAttempt = false;
|
||||||
|
mwmp::Main::get().getLocalPlayer()->closeInventoryWindows();
|
||||||
/*
|
/*
|
||||||
End of tes3mp addition
|
End of tes3mp addition
|
||||||
*/
|
*/
|
||||||
|
target.getClass().activate(target,actor).get()->execute(actor); //Arrest player when reached
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
//
|
|
||||||
// Created by koncord on 14.01.16.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <components/esm/esmwriter.hpp>
|
#include <components/esm/esmwriter.hpp>
|
||||||
#include <components/openmw-mp/Log.hpp>
|
#include <components/openmw-mp/Log.hpp>
|
||||||
|
|
||||||
|
@ -765,6 +761,15 @@ void LocalPlayer::removeSpells()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocalPlayer::closeInventoryWindows()
|
||||||
|
{
|
||||||
|
if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Container) ||
|
||||||
|
MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Inventory))
|
||||||
|
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWindowManager()->cancelDragDrop();
|
||||||
|
}
|
||||||
|
|
||||||
void LocalPlayer::setDynamicStats()
|
void LocalPlayer::setDynamicStats()
|
||||||
{
|
{
|
||||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
|
@ -877,12 +882,8 @@ void LocalPlayer::setCell()
|
||||||
MWWorld::Ptr ptrPlayer = world->getPlayerPtr();
|
MWWorld::Ptr ptrPlayer = world->getPlayerPtr();
|
||||||
ESM::Position pos;
|
ESM::Position pos;
|
||||||
|
|
||||||
// To avoid crashes, close any container menus this player may be in
|
// To avoid crashes, close container windows this player may be in
|
||||||
if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Container))
|
closeInventoryWindows();
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Container);
|
|
||||||
MWBase::Environment::get().getWindowManager()->setDragDrop(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
world->getPlayer().setTeleported(true);
|
world->getPlayer().setTeleported(true);
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,8 @@ namespace mwmp
|
||||||
void removeItems();
|
void removeItems();
|
||||||
void removeSpells();
|
void removeSpells();
|
||||||
|
|
||||||
|
void closeInventoryWindows();
|
||||||
|
|
||||||
void setDynamicStats();
|
void setDynamicStats();
|
||||||
void setAttributes();
|
void setAttributes();
|
||||||
void setSkills();
|
void setSkills();
|
||||||
|
|
Loading…
Reference in a new issue