mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
[Server] Send cell changes before position changes, and prioritize both
Previously, a script changing a player's cell and position at the same time would end up sending a position packet first and then a cell change packet that overrode the former, with the player ending up at the center of the destination cell instead of at the correct position.
This commit is contained in:
parent
80be664139
commit
4cc0216e0a
1 changed files with 16 additions and 16 deletions
|
@ -123,6 +123,22 @@ void Player::update()
|
|||
packet->Send(true);
|
||||
}
|
||||
|
||||
// Make sure we send a cell change before we send the position so the position isn't overridden
|
||||
if (cellAPI.isChangedCell())
|
||||
{
|
||||
auto packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_CELL_CHANGE);
|
||||
packet->setPlayer(this);
|
||||
packet->Send(/*toOthers*/ false);
|
||||
cellAPI.resetChangedCell();
|
||||
}
|
||||
|
||||
if (positionChanged)
|
||||
{
|
||||
auto packet = plPCtrl->GetPacket(ID_PLAYER_POSITION);
|
||||
packet->setPlayer(basePlayer);
|
||||
packet->Send(false);
|
||||
}
|
||||
|
||||
// The character class can override values from below on the client, so send it first
|
||||
cClass.update();
|
||||
|
||||
|
@ -142,13 +158,6 @@ void Player::update()
|
|||
packet->Send(true);
|
||||
}
|
||||
|
||||
if (positionChanged)
|
||||
{
|
||||
auto packet = plPCtrl->GetPacket(ID_PLAYER_POSITION);
|
||||
packet->setPlayer(basePlayer);
|
||||
packet->Send(false);
|
||||
}
|
||||
|
||||
if (attributesChanged)
|
||||
{
|
||||
auto packet = plPCtrl->GetPacket(ID_PLAYER_ATTRIBUTE);
|
||||
|
@ -190,20 +199,11 @@ void Player::update()
|
|||
changedMap = false;
|
||||
}
|
||||
|
||||
if (cellAPI.isChangedCell())
|
||||
{
|
||||
auto packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_CELL_CHANGE);
|
||||
packet->setPlayer(this);
|
||||
packet->Send(/*toOthers*/ false);
|
||||
cellAPI.resetChangedCell();
|
||||
}
|
||||
|
||||
settings.update();
|
||||
books.update();
|
||||
gui.update();
|
||||
dialogue.update();
|
||||
factions.update();
|
||||
cellAPI.update();
|
||||
quests.update();
|
||||
spells.update();
|
||||
|
||||
|
|
Loading…
Reference in a new issue