@@ -318,16 +318,30 @@ void CNetAPI::DoPulse()
318318 // Are in a vehicle?
319319 if (pVehicle)
320320 {
321- // Send a puresync packet
322- NetBitStreamInterface* pBitStream = g_pNet->AllocateNetBitStream ();
323- if (pBitStream)
321+ // Are we getting out and physically left the car
322+ if (pPlayer->GetVehicleInOutState () == VEHICLE_INOUT_GETTING_OUT && !pPlayer->GetRealOccupiedVehicle ())
324323 {
325- // Write our data
326- WriteVehiclePuresync (pPlayer, pVehicle, *pBitStream);
324+ // Send a player puresync packet
325+ NetBitStreamInterface* pBitStream = g_pNet->AllocateNetBitStream ();
326+ if (pBitStream)
327+ {
328+ WritePlayerPuresync (pPlayer, *pBitStream);
327329
328- // Send the packet and destroy it
329- g_pNet->SendPacket (PACKET_ID_PLAYER_VEHICLE_PURESYNC, pBitStream, PACKET_PRIORITY_MEDIUM, PACKET_RELIABILITY_UNRELIABLE_SEQUENCED);
330- g_pNet->DeallocateNetBitStream (pBitStream);
330+ g_pNet->SendPacket (PACKET_ID_PLAYER_PURESYNC, pBitStream, PACKET_PRIORITY_MEDIUM, PACKET_RELIABILITY_UNRELIABLE_SEQUENCED);
331+ g_pNet->DeallocateNetBitStream (pBitStream);
332+ }
333+ }
334+ else
335+ {
336+ // Send a vehicle puresync packet
337+ NetBitStreamInterface* pBitStream = g_pNet->AllocateNetBitStream ();
338+ if (pBitStream)
339+ {
340+ WriteVehiclePuresync (pPlayer, pVehicle, *pBitStream);
341+ 342+ g_pNet->SendPacket (PACKET_ID_PLAYER_VEHICLE_PURESYNC, pBitStream, PACKET_PRIORITY_MEDIUM, PACKET_RELIABILITY_UNRELIABLE_SEQUENCED);
343+ g_pNet->DeallocateNetBitStream (pBitStream);
344+ }
331345 }
332346
333347 // Sync its damage model too
@@ -962,13 +976,9 @@ void CNetAPI::ReadPlayerPuresync(CClientPlayer* pPlayer, NetBitStreamInterface&
962976 position.data .vecPosition -= vecTempPos;
963977 }
964978
965- // If the player is working on leaving a vehicle, don't set any target position
966- if (pPlayer->GetVehicleInOutState () == VEHICLE_INOUT_NONE || pPlayer->GetVehicleInOutState () == VEHICLE_INOUT_GETTING_IN ||
967- pPlayer->GetVehicleInOutState () == VEHICLE_INOUT_JACKING)
968- {
969- pPlayer->SetTargetPosition (position.data .vecPosition , TICK_RATE, pContactEntity);
970- pPlayer->SetTargetRotation (rotation.data .fRotation );
971- }
979+ // Set position and rotation
980+ pPlayer->SetTargetPosition (position.data .vecPosition , TICK_RATE, pContactEntity);
981+ pPlayer->SetTargetRotation (rotation.data .fRotation );
972982
973983 // Set move speed, controller state and camera rotation + duck state
974984 pPlayer->SetControllerState (ControllerState);
0 commit comments