From 8f274afd49ea194f27467d1c9c882e2a36af723c Mon Sep 17 00:00:00 2001 From: MysterD Date: Mon, 27 Mar 2023 23:08:54 -0700 Subject: [PATCH] Only send debug sync packet if no lag is detected --- src/pc/network/packets/packet_debug_sync.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pc/network/packets/packet_debug_sync.c b/src/pc/network/packets/packet_debug_sync.c index d8afe3cb..b5d33e6d 100644 --- a/src/pc/network/packets/packet_debug_sync.c +++ b/src/pc/network/packets/packet_debug_sync.c @@ -21,7 +21,13 @@ void print_sync_object_table(void) { } void network_send_debug_sync(void) { - return; + // check for lag + for (int i = 0; i < MAX_PLAYERS; i++) { + struct NetworkPlayer* np = &gNetworkPlayers[i]; + if (!np->connected) { continue; } + if (np->ping > 250) { return; } + } + for (struct SyncObject* so = sync_object_get_first(); so != NULL; so = sync_object_get_next()) { if (!so || !so->o) { continue; } u32 behaviorId = get_id_from_behavior((so->behavior == NULL) ? so->behavior : so->o->behavior);