local O=require("\064\115\104\097\114\101\100\047\102\114\097\109\101")local c=require("\064\110\101\116\047\115\101\114\118\101\114")local M=require("\064\115\104\097\114\101\100\047\119\111\114\108\100")local y=require("\064\115\101\114\118\101\114\047\099\104\097\114\097\099\116\101\114\115")local w=require("\064\115\104\097\114\101\100\047\099\111\109\112\111\110\101\110\116\115")return O.on("\105\110\099\111\109\105\110\103\095\110\101\116",function()for O,c,J in c.send_local_position.iter()do local X=y.from_player(c)if not X then continue end local N=J.position local u=J.y_rot local z,V=math.sin(u),math.cos(u)local B=CFrame.new(N.X,N.Y,N.Z,V,0,z,0,1,0,-z,0,V)M:set(X,w.Transform,B)end end)
local frame = require("@shared/frame")
local network = require("@net/server")
local world = require("@shared/world")
local characters = require("@server/characters")
local components = require("@shared/components")

return frame.on("incoming_net", function()
	for _, player, transform in network.send_local_position.iter() do
		local ent = characters.from_player(player)
		if not ent then
			continue
		end

		local position = transform.position
		local rotation = transform.y_rot
		local sin, cos = math.sin(rotation), math.cos(rotation)

		--stylua: ignore
		local coordinate_frame = CFrame.new(
			position.X, position.Y, position.Z,
			cos, 0, sin,
			0, 1, 0,
			-sin, 0, cos
		)
		--stylua: endignore

		world:set(ent, components.Transform, coordinate_frame)
	end
end)
