private static void OnRemoveSplit(MySyncGrid grid, ref RemoveSplitMsg msg, MyNetworkClient sender) { MyCubeGrid m_grid; if (MyEntities.TryGetEntityById(msg.GridEntityId, out m_grid)) { m_tmpBlockListReceive.Clear(); foreach (var position in msg.RemovedBlocks) { var block = m_grid.GetCubeBlock(position); Debug.Assert(block != null, "Block was null when trying to remove a grid split. Desync?"); if (block == null) { MySandboxGame.Log.WriteLine("Block was null when trying to remove a grid split. Desync?"); continue; } m_tmpBlockListReceive.Add(block); } MyCubeGrid.RemoveSplit(m_grid, m_tmpBlockListReceive, 0, m_tmpBlockListReceive.Count, sync: false); m_tmpBlockListReceive.Clear(); } }
public void AnnounceRemoveSplit(List<MySlimBlock> blocks) { var msg = new RemoveSplitMsg(); msg.GridEntityId = Entity.EntityId; m_tmpPositionListSend.Clear(); msg.RemovedBlocks = m_tmpPositionListSend; foreach (var block in blocks) { msg.RemovedBlocks.Add(block.Position); } Sync.Layer.SendMessageToAll(ref msg); }