Пример #1
0
        protected override bool Conceal()
        {
            Log.Trace("Concealing.", "Conceal");

            if (Grid.SyncObject == null)
            {
                Log.Error("SyncObject missing, aborting", "Conceal");
                return(false);
            }

            ConcealedGrid concealed = new ConcealedGrid(this);

            if (!concealed.IsXMLSerializable)
            {
                Log.Error("Won't be able to save this grid, aborting conceal.",
                          "Conceal");
                return(false);
            }

            if (!ServerConcealSession.Instance.Manager.Concealed.AddGrid(concealed))
            {
                Log.Error("Unable to add to concealed sector, aborting", "Conceal");
                return(false);
            }

            // Remove it from the world
            Grid.SyncObject.SendCloseRequest();
            return(true);
        }
        public static ConcealedGridsResponse FromBytes(byte[] bytes)
        {
            VRage.ByteStream stream = new VRage.ByteStream(bytes, bytes.Length);
            ConcealedGridsResponse response = new ConcealedGridsResponse();
            response.LoadFromByteStream(stream);

            ConcealedGrid grid;
            ushort count = stream.getUShort();
            for (int i = 0; i < count; i++) {
                grid = new ConcealedGrid(stream);
                response.ConcealedGrids.Add(grid);
            }

            return response;
        }
Пример #3
0
 public void RemoveGrid(ConcealedGrid concealed)
 {
     Grids.Remove(concealed.EntityId);
     GridTree.Remove(concealed);
     NeedsSave = true;
 }
Пример #4
0
        public bool CanRemoveGrid(ConcealedGrid concealed)
        {
            if (!Grids.ContainsKey(concealed.EntityId)) {
                Log.Error("Failed to find in list " + concealed.EntityId,
                    "RemoveGrid");
                return false;
            }

            return true;
        }
Пример #5
0
        public bool AddGrid(ConcealedGrid concealed)
        {
            // Track it
            if (Grids.ContainsKey(concealed.EntityId)) {
                Log.Error("Attempting to store already-stored entity id " +
                    concealed.EntityId, "ConcealGrid");
                return false;
            }

            Grids.Add(concealed.EntityId, concealed);
            //GridBuilders.Add(concealed.EntityId, concealed.Builder);
            GridTree.Add(concealed);

            NeedsSave = true;
            return true;
        }
Пример #6
0
        protected override bool Conceal()
        {
            Log.Trace("Concealing.", "Conceal");

            if (Grid.SyncObject == null) {
                Log.Error("SyncObject missing, aborting", "Conceal");
                return false;
            }

            ConcealedGrid concealed = new ConcealedGrid(this);

            if (!concealed.IsXMLSerializable) {
                Log.Error("Won't be able to save this grid, aborting conceal.",
                    "Conceal");
                return false;
            }

            if (!ServerConcealSession.Instance.Manager.Concealed.AddGrid(concealed)) {
                Log.Error("Unable to add to concealed sector, aborting", "Conceal");
                return false;
            }

            // Remove it from the world
            Grid.SyncObject.SendCloseRequest();
            return true;
        }
        public bool QueueReveal(ConcealedGrid grid)
        {
            if (!grid.IsRevealable) {
                Log.Warning("Is not revealable: " + grid.EntityId, "QueueReveal");
                return false;
            }

            Log.Trace("Equeuing grid for reveal " + grid.EntityId, "QueueReveal");
            GridRevealQueue.Enqueue(grid);
            return true;
        }