Пример #1
0
        public override void StartStorage()
        {
            m_TerrainListener = m_SimulationDataStorage.GetTerrainListener(ID);
            m_TerrainListener.StartStorageThread();
            Terrain.TerrainListeners.Add(m_TerrainListener);

            m_SceneListener = m_SimulationDataStorage.GetSceneListener(ID);
            m_SceneListener.StartStorageThread();
            SceneListeners.Add(m_SceneListener);
        }
Пример #2
0
        protected void RemoveScene(SceneInterface s)
        {
            ScriptThreadPool.Shutdown();
            m_ParcelAccessManager.Stop();
            Environment.OnEnvironmentControllerChangeParams -= StoreEnvironmentControllerData;
            Environment.Stop();
            PathfindingService?.Stop();
            int serializedcount = 0;

            foreach (ObjectPart part in Primitives)
            {
                foreach (ObjectPartInventoryItem item in part.Inventory.Values)
                {
                    IScriptState state = item.ScriptState;
                    if (state != null)
                    {
                        try
                        {
                            m_SimulationDataStorage.ScriptStates[ID, part.ID, item.ID] = state.ToDbSerializedState();
                            if (++serializedcount % 50 == 0)
                            {
                                m_Log.InfoFormat("Serialized {0} script states", serializedcount);
                            }
                        }
                        catch (Exception e)
                        {
                            m_Log.ErrorFormat("Script state serialization failed for {0} ({1}): prim {2} ({3}): item {4} ({5}): {6}: {7}\n{8}",
                                              Name, ID, part.Name, part.ID, item.Name, item.ID, e.GetType().FullName, e.Message, e.StackTrace);
                        }
                    }
                }
            }

            if (serializedcount == 1)
            {
                m_Log.InfoFormat("Serialized {0} script state", serializedcount);
            }
            else if (serializedcount % 50 != 0)
            {
                m_Log.InfoFormat("Serialized {0} script states", serializedcount);
            }

            m_RestartObject = null;

            if (m_NeighborService != null)
            {
                RegionInfo rInfo = s.GetRegionInfo();
                rInfo.Flags &= ~RegionFlags.RegionOnline;
                m_NeighborService.NotifyNeighborStatus(rInfo);
            }

            if (m_SceneListener != null)
            {
                m_SceneListener.StopStorageThread();
                SceneListeners.Remove(m_SceneListener);
            }

            if (m_TerrainListener != null)
            {
                m_TerrainListener.StopStorageThread();
                Terrain.TerrainListeners.Remove(m_TerrainListener);
            }

            if (m_IMRouter != null)
            {
                m_IMRouter.SceneIM.Remove(IMSend);
            }
            UDPCircuitsManager udpServer = m_UDPServer;

            udpServer?.Shutdown();
            m_UDPServer = null;
        }