From cbec17c142336f7e89db2073a17d997e8e7e6450 Mon Sep 17 00:00:00 2001 From: bgkillas Date: Tue, 19 Nov 2024 23:34:03 -0500 Subject: [PATCH] fix spamming request item --- quant.ew/files/system/item_sync.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/quant.ew/files/system/item_sync.lua b/quant.ew/files/system/item_sync.lua index 3ee2a796..a50bcf5c 100644 --- a/quant.ew/files/system/item_sync.lua +++ b/quant.ew/files/system/item_sync.lua @@ -184,6 +184,8 @@ function item_sync.host_localize_item(gid, peer_id) rpc.item_localize(peer_id, gid) end +local wait_for_gid = {} + function item_sync.make_item_global(item, instant, give_authority_to) EntityAddTag(item, "ew_global_item") async(function() @@ -484,6 +486,7 @@ end rpc.opts_reliable() function rpc.item_globalize(item_data) + wait_for_gid[item_data.gid] = nil if is_safe_to_remove() then item_sync.remove_item_with_id_now(item_data.gid) end @@ -559,7 +562,10 @@ function rpc.update_positions(position_data) end else util.log("Requesting again "..gid) - rpc.request_send_again(gid) + if wait_for_gid[gid] == nil then + rpc.request_send_again(gid) + wait_for_gid[gid] = true + end end end end