private static void OnBonesReceived(MySyncGrid sync, ref BonesMsg msg, MyNetworkClient sender) { sync.Entity.Skeleton.DeserializePart(msg.MinBone, msg.MaxBone, sync.Entity.GridSize, msg.Bones); Vector3I minCube = Vector3I.Zero; Vector3I maxCube = Vector3I.Zero; // To hit incident cubes Vector3I min = msg.MinBone;// -Vector3I.One; Vector3I max = msg.MaxBone;// +Vector3I.One; sync.Entity.Skeleton.Wrap(ref minCube, ref min); sync.Entity.Skeleton.Wrap(ref maxCube, ref max); minCube -= Vector3I.One; maxCube += Vector3I.One; Vector3I pos; for (pos.X = minCube.X; pos.X <= maxCube.X; pos.X++) { for (pos.Y = minCube.Y; pos.Y <= maxCube.Y; pos.Y++) { for (pos.Z = minCube.Z; pos.Z <= maxCube.Z; pos.Z++) { sync.Entity.SetCubeDirty(pos); } } } }
public void SendDirtyBones(Vector3I minBone, Vector3I maxBone, MyGridSkeleton skeleton) { if (Sync.IsServer) { m_boneByteList.Clear(); skeleton.SerializePart(minBone, maxBone, Entity.GridSize, m_boneByteList); if (m_boneByteList.Count > 0) { var msg = new BonesMsg(); msg.GridEntityId = Entity.EntityId; msg.MinBone = minBone; msg.MaxBone = maxBone; msg.Bones = m_boneByteList; Sync.Layer.SendMessageToAll(ref msg); } } }