make and enable chunk map on clients

This commit is contained in:
bgkillas 2025-03-09 15:10:07 -04:00
parent eaa74dd772
commit 3dcd6b4ec8
5 changed files with 147 additions and 90 deletions

View file

@ -3,6 +3,18 @@ local module = {}
local ptt = 0
function module.on_world_update()
if GameGetFrameNum() % 8 == 7 then
local s = ""
for peer, data in pairs(ctx.players) do
local x, y = EntityGetTransform(data.entity)
if x == nil then
return
end
s = s .. " " .. tostring(peer) .. " " .. math.floor(x) .. " " .. math.floor(y)
end
net.proxy_send("players_pos", string.sub(s, 2, -1))
end
if GameGetFrameNum() % 4 ~= 2 then
return
end
@ -62,19 +74,4 @@ function module.on_world_update()
)
end
function module.on_world_update_host()
if GameGetFrameNum() % 8 ~= 2 then
return
end
local s = ""
for peer, data in pairs(ctx.players) do
local x, y = EntityGetTransform(data.entity)
if x == nil then
return
end
s = s .. " " .. tostring(peer) .. " " .. math.floor(x) .. " " .. math.floor(y)
end
net.proxy_send("players_pos", string.sub(s, 2, -1))
end
return module