mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-01 00:39:40 +00:00
[Client] Fix ID_PLAYER_POSITION spam
This commit is contained in:
parent
3905e0dae9
commit
2ef1e26233
2 changed files with 9 additions and 4 deletions
|
@ -117,7 +117,7 @@ void DedicatedPlayer::move(float dt)
|
|||
world->moveObject(ptr, position.pos[0], position.pos[1], position.pos[2]);
|
||||
}
|
||||
|
||||
world->rotateObject(ptr, position.rot[0], position.rot[1], position.rot[2]);
|
||||
world->rotateObject(ptr, position.rot[0], 0, position.rot[2]);
|
||||
|
||||
MWMechanics::Movement *move = &ptr.getClass().getMovementSettings(ptr);
|
||||
move->mPosition[0] = direction.pos[0];
|
||||
|
|
|
@ -321,19 +321,24 @@ void LocalPlayer::updatePosition(bool forceUpdate)
|
|||
static bool posWasChanged = false;
|
||||
static bool isJumping = false;
|
||||
static bool sentJumpEnd = true;
|
||||
static float oldRot[2] = {0};
|
||||
|
||||
position = player.getRefData().getPosition();
|
||||
|
||||
bool posIsChanging = (direction.pos[0] != 0 || direction.pos[1] != 0 || direction.pos[2] != 0 ||
|
||||
position.rot[0] != 0 || position.rot[1] != 0 || position.rot[2] != 0);
|
||||
position.rot[0] != oldRot[0] || position.rot[2] != oldRot[1]);
|
||||
|
||||
if (forceUpdate || posIsChanging || posWasChanged)
|
||||
{
|
||||
|
||||
oldRot[0] = position.rot[0];
|
||||
oldRot[1] = position.rot[2];
|
||||
|
||||
posWasChanged = posIsChanging;
|
||||
|
||||
if (!isJumping && !world->isOnGround(player) && !world->isFlying(player))
|
||||
isJumping = true;
|
||||
|
||||
position = player.getRefData().getPosition();
|
||||
|
||||
getNetworking()->getPlayerPacket(ID_PLAYER_POSITION)->setPlayer(this);
|
||||
getNetworking()->getPlayerPacket(ID_PLAYER_POSITION)->Send();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue