[Client] Fix ID_PLAYER_POSITION spam

0.6.1
Koncord 8 years ago
parent 3905e0dae9
commit 2ef1e26233

@ -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…
Cancel
Save