send less world sync requests, fix spectator sync again

This commit is contained in:
bgkillas 2024-08-30 12:55:52 -04:00
parent 27bb197d2b
commit d451849fde

View file

@ -69,7 +69,7 @@ local function get_all_chunks(ocx, ocy, priority)
end
end
net.proxy_bin_send(KEY_WORLD_END, string.char(priority))
elseif GameGetFrameNum() % (ctx.proxy_opt.world_sync_interval * 2) == 1 then
elseif GameGetFrameNum() % (ctx.proxy_opt.world_sync_interval * 3) == 1 then
local nx = ocx
if iter_fast then
nx = nx - 2
@ -83,7 +83,7 @@ local function get_all_chunks(ocx, ocy, priority)
end
net.proxy_bin_send(KEY_WORLD_END, string.char(priority + 1))
iter_fast = not iter_fast
elseif GameGetFrameNum() % (ctx.proxy_opt.world_sync_interval * 3) == 3 then
elseif GameGetFrameNum() % (ctx.proxy_opt.world_sync_interval * 6) == 3 then
local nx = ocx
if iter_slow == 1 or iter_slow == 2 then
nx = nx - 3
@ -120,11 +120,13 @@ function world_sync.on_world_update()
local ocx, ocy = round(px / CHUNK_SIZE), round(py / CHUNK_SIZE)
if math.abs(cx - ocx) > 2 or math.abs(cy - ocy) > 2 then
if iter_cam then
get_all_chunks(cx, cy, 4)
get_all_chunks(cx, cy, 16)
else
get_all_chunks(ocx, ocy, 4)
get_all_chunks(ocx, ocy, 16)
end
if GameGetFrameNum() % (ctx.proxy_opt.world_sync_interval * 6) == 3 then
iter_cam = not iter_cam
end
else
get_all_chunks(ocx, ocy, 0)
end