From cc9e294cc08715fb68fc8fad407e8c2707446aa7 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Fri, 13 Jul 2018 22:34:36 +0300 Subject: [PATCH] [Client] Send ActorAI packet for new cell after being followed to it --- apps/openmw/mwworld/actionteleport.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/openmw/mwworld/actionteleport.cpp b/apps/openmw/mwworld/actionteleport.cpp index 3ceff70ec..bf4506fe6 100644 --- a/apps/openmw/mwworld/actionteleport.cpp +++ b/apps/openmw/mwworld/actionteleport.cpp @@ -11,6 +11,7 @@ #include "../mwmp/Networking.hpp" #include "../mwmp/ActorList.hpp" #include "../mwmp/CellController.hpp" +#include "../mwmp/MechanicsHelper.hpp" /* End of tes3mp addition */ @@ -112,6 +113,10 @@ namespace MWWorld Send ActorCellChange packets when an actor follows us across cells, regardless of whether we're the cell authority or not; the server can decide if it wants to comply with them + + Afterwards, send an ActorAI packet about this actor being our follower, to ensure + they remain our follower even if the destination cell has another player as its + cell authority */ mwmp::BaseActor baseActor; baseActor.refNum = actor.getCellRef().getRefNum().mIndex; @@ -132,6 +137,13 @@ namespace MWWorld actorList->addCellChangeActor(baseActor); actorList->sendCellChangeActors(); + + // Send ActorAI to bring all players in the new cell up to speed with this follower + actorList->cell = baseActor.cell; + baseActor.aiAction = mwmp::BaseActorList::FOLLOW; + baseActor.aiTarget = MechanicsHelper::getTarget(world->getPlayerPtr()); + actorList->addAiActor(baseActor); + actorList->sendAiActors(); /* End of tes3mp addition */