forked from teamnwah/openmw-tes3coop
[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);
|
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
|
// The character class can override values from below on the client, so send it first
|
||||||
cClass.update();
|
cClass.update();
|
||||||
|
|
||||||
|
@ -142,13 +158,6 @@ void Player::update()
|
||||||
packet->Send(true);
|
packet->Send(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (positionChanged)
|
|
||||||
{
|
|
||||||
auto packet = plPCtrl->GetPacket(ID_PLAYER_POSITION);
|
|
||||||
packet->setPlayer(basePlayer);
|
|
||||||
packet->Send(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (attributesChanged)
|
if (attributesChanged)
|
||||||
{
|
{
|
||||||
auto packet = plPCtrl->GetPacket(ID_PLAYER_ATTRIBUTE);
|
auto packet = plPCtrl->GetPacket(ID_PLAYER_ATTRIBUTE);
|
||||||
|
@ -190,20 +199,11 @@ void Player::update()
|
||||||
changedMap = false;
|
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();
|
settings.update();
|
||||||
books.update();
|
books.update();
|
||||||
gui.update();
|
gui.update();
|
||||||
dialogue.update();
|
dialogue.update();
|
||||||
factions.update();
|
factions.update();
|
||||||
cellAPI.update();
|
|
||||||
quests.update();
|
quests.update();
|
||||||
spells.update();
|
spells.update();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue