@@ -2551,7 +2551,9 @@ void NPC::tick(Microseconds elapsed, TimePoint now)
25512551 {
25522552 if (playback_ && playback_->isValid ())
25532553 {
2554- processPlayback (now);
2554+ // Used to process playback here, but I've moved it out put generate update rate to down below
2555+ // Keeping this here as a reminder that playbacks already have their own timestamps so they're not
2556+ // Oversent or overprocessed
25552557 }
25562558 else
25572559 {
@@ -2822,39 +2824,46 @@ void NPC::tick(Microseconds elapsed, TimePoint now)
28222824 }
28232825 }
28242826
2825- if (duration_cast<Milliseconds>(now - lastFootSyncUpdate_). count () > npcComponent_-> getFootSyncRate ())
2827+ if (playback_ && playback_-> isValid ())
28262828 {
2827- if (!vehicle_ || vehicleSeat_ == SEAT_NONE)
2828- {
2829- sendFootSync ();
2830- }
2831-
2832- lastFootSyncUpdate_ = now;
2829+ processPlayback (now);
28332830 }
2834-
2835- if (duration_cast<Milliseconds>(now - lastVehicleSyncUpdate_).count () > npcComponent_->getVehicleSyncRate ())
2831+ else
28362832 {
2837- if (vehicle_ && vehicleSeat_ != SEAT_NONE )
2833+ if (duration_cast<Milliseconds>(now - lastFootSyncUpdate_). count () > npcComponent_-> getFootSyncRate () )
28382834 {
2839- if (vehicleSeat_ == 0 ) // driver
2835+ if (!vehicle_ || vehicleSeat_ == SEAT_NONE)
28402836 {
2841- sendDriverSync ();
2837+ sendFootSync ();
28422838 }
2843- else
2839+
2840+ lastFootSyncUpdate_ = now;
2841+ }
2842+
2843+ if (duration_cast<Milliseconds>(now - lastVehicleSyncUpdate_).count () > npcComponent_->getVehicleSyncRate ())
2844+ {
2845+ if (vehicle_ && vehicleSeat_ != SEAT_NONE)
28442846 {
2845- sendPassengerSync ();
2847+ if (vehicleSeat_ == 0 ) // driver
2848+ {
2849+ sendDriverSync ();
2850+ }
2851+ else
2852+ {
2853+ sendPassengerSync ();
2854+ }
28462855 }
2847- }
28482856
2849- lastVehicleSyncUpdate_ = now;
2850- }
2857+ lastVehicleSyncUpdate_ = now;
2858+ }
28512859
2852- if (duration_cast<Milliseconds>(now - lastAimSyncUpdate_).count () > npcComponent_->getAimSyncRate ())
2853- {
2854- sendAimSync ();
2855- updateAim ();
2860+ if (duration_cast<Milliseconds>(now - lastAimSyncUpdate_).count () > npcComponent_->getAimSyncRate ())
2861+ {
2862+ sendAimSync ();
2863+ updateAim ();
28562864
2857- lastAimSyncUpdate_ = now;
2865+ lastAimSyncUpdate_ = now;
2866+ }
28582867 }
28592868 }
28602869}
0 commit comments