public static RevealedGridsResponse FromBytes(byte[] bytes)
        {
            VRage.ByteStream stream = new VRage.ByteStream(bytes, bytes.Length);
            RevealedGridsResponse response = new RevealedGridsResponse();
            response.LoadFromByteStream(stream);

            RevealedGrid grid;
            ushort count = stream.getUShort();
            //Log.Trace("Retrieving " + count + " grids from response", "ToBytes");
            for (int i = 0; i < count; i++) {
                grid = new RevealedGrid(stream);
                response.RevealedGrids.Add(grid);
                //Log.Trace("Added grid " + grid.EntityId, "ToBytes");
            }

            return response;
        }
Пример #2
0
 private void UpdateRememberedGridPosition(RevealedGrid e)
 {
     GridTree.Move(e);
 }
Пример #3
0
        private void RememberGrid(RevealedGrid e)
        {
            long id = e.EntityId;
            if (Grids.ContainsKey(id)) {
                Log.Error("Already added " + id, "RememberGrid");
                return;
            }

            Log.Trace("Adding " + id, "RememberGrid");
            Grids.Add(id, e);
            GridTree.Add(e);
        }
Пример #4
0
        private void ForgetGrid(RevealedGrid e)
        {
            long id = e.EntityId;
            if (!Grids.ContainsKey(id)) {
                Log.Error("Not stored " + id, "ForgetGrid");
                return;
            }

            Log.Trace("Removing " + id, "ForgetGrid");
            Grids.Remove(id);
            GridTree.Remove(e);
        }
        public bool QueueConceal(RevealedGrid grid)
        {
            if (!grid.IsConcealable) {
                Log.Warning("Is not concealable: " + grid.EntityId, "QueueConceal");
                return false;
            }

            Log.Trace("Equeuing grid for conceal " + grid.EntityId, "QueueConceal");
            GridConcealQueue.Enqueue(grid);
            ConcealQueuedMessage msg = new ConcealQueuedMessage(grid.EntityId);
            msg.SendToAll();

            return true;
        }