X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fserver%2Fnet.cpp;h=38224ec9a57e879e2a84357a77456b30253f3f1c;hb=150d065f431d665326fd8028748c48a74ad956bb;hp=e739922b60268062f4c6a708d0de334d03e401cf;hpb=660c4216fc61c0d99987adbfea057af07b511a23;p=blank.git diff --git a/src/server/net.cpp b/src/server/net.cpp index e739922..38224ec 100644 --- a/src/server/net.cpp +++ b/src/server/net.cpp @@ -247,7 +247,6 @@ void ClientConnection::Update(int dt) { } SendUpdates(); - input->Update(dt); CheckPlayerFix(); CheckChunkQueue(); } @@ -317,10 +316,12 @@ void ClientConnection::QueueUpdate(SpawnStatus &status) { } void ClientConnection::SendUpdates() { + auto base = PlayerChunks().Base(); auto pack = Prepare(); + pack.WriteChunkBase(base); int entity_pos = 0; for (SpawnStatus *status : entity_updates) { - pack.WriteEntity(*status->entity, entity_pos); + pack.WriteEntity(*status->entity, base, entity_pos); ++entity_pos; if (entity_pos == Packet::EntityUpdate::MAX_ENTITIES) { pack.WriteEntityCount(entity_pos); @@ -548,21 +549,17 @@ void ClientConnection::On(const Packet::PlayerUpdate &pack) { return; } glm::vec3 movement(0.0f); - float pitch = 0.0f; - float yaw = 0.0f; uint8_t new_actions; uint8_t slot; player_update_pack = pack.Seq(); pack.ReadPredictedState(player_update_state); pack.ReadMovement(movement); - pack.ReadPitch(pitch); - pack.ReadYaw(yaw); pack.ReadActions(new_actions); pack.ReadSlot(slot); input->SetMovement(movement); - input->TurnHead(pitch - input->GetPitch(), yaw - input->GetYaw()); + input->TurnHead(player_update_state.pitch - input->GetPitch(), player_update_state.yaw - input->GetYaw()); input->SelectInventory(slot); if ((new_actions & 0x01) && !(old_actions & 0x01)) {