示例#1
0
		private static void Entities_OnCloseAll()
		{
			MyAPIGateway.Entities.OnCloseAll -= Entities_OnCloseAll;
			staticLogger = null;
			Thread = null;
			AllGuidedMissiles = null;
			lock_AllGuidedMissiles = null;
			s_missileOwners = null;
		}
示例#2
0
            public Activity(VRage.FastResourceLock fastLock, string message)
            {
                this.m_message          = message;
                this.m_owned            = fastLock.Owned;
                this.m_sharedOwners     = fastLock.SharedOwners;
                this.m_exclusiveWaiters = fastLock.ExclusiveWaiters;
                this.m_sharedWaiters    = fastLock.SharedWaiters;
                this.m_time             = DateTime.Now;
#if STACK_TRACE
                this.m_stackTrace = new StackTrace();
#endif
            }
        public void InitWriteCache(int prealloc = 128)
        {
            //Debug.Assert(m_cachedChunks == null, "Error: Cache already initialized"); disabled due to shared storages

            if (m_cachedChunks != null) return;

            if (OperationsComponent != null)
                CachedWrites = true;
            else
                return;

            m_cachedChunks = new MyConcurrentDictionary<Vector3I, VoxelChunk>(prealloc, Vector3I.Comparer);
            m_pendingChunksToWrite = new MyConcurrentQueue<Vector3I>(prealloc / 10);
            m_chunksbyAge = new MyQueue<Vector3I>(prealloc);

            m_cacheMap = new MyDynamicAABBTree(Vector3.Zero);

            m_cacheLock = new FastResourceLock();

            OperationsComponent.Add(this);
        }
示例#4
0
        public VoxelMapMaterialManager( VoxelMap parent, Object backingObject )
        {
            m_parent = parent;
            m_backingObject = backingObject;

            m_resourceLock = new FastResourceLock( );
            m_materialTotals = new Dictionary<MyVoxelMaterialDefinition, float>( );
        }
        protected ChatManager( )
        {
            m_instance = this;

            m_chatMessages = new List<string>( );
            m_chatHistory = new List<ChatEvent>( );
            m_chatHandlerSetup = false;
            m_resourceLock = new FastResourceLock( );
            m_chatEvents = new List<ChatEvent>( );
            m_chatCommands = new Dictionary<ChatCommand, Guid>( );

            ChatCommand deleteCommand = new ChatCommand( "delete", Command_Delete, true );

            ChatCommand tpCommand = new ChatCommand( "tp", Command_Teleport, true );

            ChatCommand stopCommand = new ChatCommand( "stop", Command_Stop, true );

            ChatCommand getIdCommand = new ChatCommand( "getid", Command_GetId, true );

            ChatCommand saveCommand = new ChatCommand( "save", Command_Save, true );

            ChatCommand ownerCommand = new ChatCommand( "owner", Command_Owner, true );

            ChatCommand exportCommand = new ChatCommand( "export", Command_Export, true );

            ChatCommand importCommand = new ChatCommand( "import", Command_Import, true );

            ChatCommand spawnCommand = new ChatCommand( "spawn", Command_Spawn, true );

            ChatCommand clearCommand = new ChatCommand( "clear", Command_Clear, true );

            ChatCommand listCommand = new ChatCommand( "list", Command_List, true );

            ChatCommand kickCommand = new ChatCommand( "kick", Command_Kick, true );

            ChatCommand onCommand = new ChatCommand( "on", Command_On, true );

            ChatCommand offCommand = new ChatCommand( "off", Command_Off, true );

            ChatCommand banCommand = new ChatCommand( "ban", Command_Ban, true );

            ChatCommand unbanCommand = new ChatCommand( "unban", Command_Unban, true );

            ChatCommand asyncSaveCommand = new ChatCommand( "savesync", Command_SyncSave, true );

            RegisterChatCommand( offCommand );
            RegisterChatCommand( onCommand );
            RegisterChatCommand( deleteCommand );
            RegisterChatCommand( tpCommand );
            RegisterChatCommand( stopCommand );
            RegisterChatCommand( getIdCommand );
            RegisterChatCommand( saveCommand );
            RegisterChatCommand( ownerCommand );
            RegisterChatCommand( exportCommand );
            RegisterChatCommand( importCommand );
            RegisterChatCommand( spawnCommand );
            RegisterChatCommand( clearCommand );
            RegisterChatCommand( listCommand );
            RegisterChatCommand( kickCommand );
            RegisterChatCommand( banCommand );
            RegisterChatCommand( unbanCommand );
            RegisterChatCommand( asyncSaveCommand );

            ApplicationLog.BaseLog.Info( "Finished loading ChatManager" );
        }
        public override void LoadData()
        {
            base.LoadData();

            if (MyPerGameSettings.EnableAi)
            {
                Sync.Players.NewPlayerRequestSucceeded += PlayerCreated;
                Sync.Players.LocalPlayerLoaded += LocalPlayerLoaded;
                Sync.Players.NewPlayerRequestFailed += Players_NewPlayerRequestFailed;
                if (Sync.IsServer)
                {
                    Sync.Players.PlayerRemoved += Players_PlayerRemoved;
                    Sync.Players.PlayerRequesting += Players_PlayerRequesting;
                }

                m_pathfinding = new MyPathfinding();
                m_behaviorTreeCollection = new MyBehaviorTreeCollection();
                m_botCollection = new MyBotCollection(m_behaviorTreeCollection);
                m_loadedLocalPlayers = new List<int>();
                m_loadedBotObjectBuildersByHandle = new Dictionary<int, MyObjectBuilder_Bot>();
                m_agentsToSpawn = new Dictionary<int, AgentSpawnData>();
                m_removeQueue = new MyConcurrentQueue<BotRemovalRequest>();
                m_maxBotNotification = new MyHudNotification(MyCommonTexts.NotificationMaximumNumberBots, 2000, MyFontEnum.Red);
                m_processQueue = new MyConcurrentQueue<AgentSpawnData>();
                m_lock = new FastResourceLock();

#if !XB1
                if (MyFakes.ENABLE_BEHAVIOR_TREE_TOOL_COMMUNICATION)
                {
                    MyMessageLoop.AddMessageHandler(MyWMCodes.BEHAVIOR_GAME_UPLOAD_TREE, OnUploadNewTree);
                    MyMessageLoop.AddMessageHandler(MyWMCodes.BEHAVIOR_GAME_STOP_SENDING, OnBreakDebugging);
                    MyMessageLoop.AddMessageHandler(MyWMCodes.BEHAVIOR_GAME_RESUME_SENDING, OnResumeDebugging);
                }
#endif

                MyToolbarComponent.CurrentToolbar.SelectedSlotChanged += CurrentToolbar_SelectedSlotChanged;
                MyToolbarComponent.CurrentToolbar.SlotActivated += CurrentToolbar_SlotActivated;
                MyToolbarComponent.CurrentToolbar.Unselected += CurrentToolbar_Unselected;
            }
        }
示例#7
0
 private void Entities_OnCloseAll()
 {
     MyAPIGateway.Entities.OnCloseAll -= Entities_OnCloseAll;
     myLogger.debugLog("stopping thread", "Entities_OnCloseAll()", Logger.severity.INFO);
     ActionQueue = null;
     lock_ActionQueue = null;
 }
示例#8
0
 private static void Entities_OnCloseAll()
 {
     MyAPIGateway.Entities.OnCloseAll -= Entities_OnCloseAll;
     lock_search = null;
     s_logger = null;
 }
示例#9
0
 public static MyExclusiveLock AcquireExclusiveUsing(this FastResourceLock lockObject)
 {
     return(new MyExclusiveLock(lockObject));
 }
		protected ChatManager()
		{
			m_instance = this;

			m_chatMessages = new List<string>();
			m_chatHistory = new List<ChatEvent>();
			m_chatHandlerSetup = false;
			m_resourceLock = new FastResourceLock();
			m_chatEvents = new List<ChatEvent>();
			m_chatCommands = new Dictionary<ChatCommand, Guid>();

			ChatCommand deleteCommand = new ChatCommand();
			deleteCommand.command = "delete";
			deleteCommand.callback = Command_Delete;
			deleteCommand.requiresAdmin = true;

			ChatCommand tpCommand = new ChatCommand();
			tpCommand.command = "tp";
			tpCommand.callback = Command_Teleport;
			tpCommand.requiresAdmin = true;

			ChatCommand stopCommand = new ChatCommand();
			stopCommand.command = "stop";
			stopCommand.callback = Command_Stop;
			stopCommand.requiresAdmin = true;

			ChatCommand getIdCommand = new ChatCommand();
			getIdCommand.command = "getid";
			getIdCommand.callback = Command_GetId;
			getIdCommand.requiresAdmin = true;

			ChatCommand saveCommand = new ChatCommand();
			saveCommand.command = "save";
			saveCommand.callback = Command_Save;
			saveCommand.requiresAdmin = true;

			ChatCommand ownerCommand = new ChatCommand();
			ownerCommand.command = "owner";
			ownerCommand.callback = Command_Owner;
			ownerCommand.requiresAdmin = true;

			ChatCommand exportCommand = new ChatCommand();
			exportCommand.command = "export";
			exportCommand.callback = Command_Export;
			exportCommand.requiresAdmin = true;

			ChatCommand importCommand = new ChatCommand();
			importCommand.command = "import";
			importCommand.callback = Command_Import;
			importCommand.requiresAdmin = true;

			ChatCommand spawnCommand = new ChatCommand();
			spawnCommand.command = "spawn";
			spawnCommand.callback = Command_Spawn;
			spawnCommand.requiresAdmin = true;

			ChatCommand clearCommand = new ChatCommand();
			clearCommand.command = "clear";
			clearCommand.callback = Command_Clear;
			clearCommand.requiresAdmin = true;

			ChatCommand listCommand = new ChatCommand();
			listCommand.command = "list";
			listCommand.callback = Command_List;
			listCommand.requiresAdmin = true;

			ChatCommand offCommand = new ChatCommand();
			offCommand.command = "off";
			offCommand.callback = Command_Off;
			offCommand.requiresAdmin = true;

			ChatCommand kickCommand = new ChatCommand();
			kickCommand.command = "kick";
			kickCommand.callback = Command_Kick;
			kickCommand.requiresAdmin = true;

			ChatCommand banCommand = new ChatCommand();
			banCommand.command = "ban";
			banCommand.callback = Command_Ban;
			banCommand.requiresAdmin = true;

			ChatCommand unbanCommand = new ChatCommand();
			unbanCommand.command = "unban";
			unbanCommand.callback = Command_Unban;
			unbanCommand.requiresAdmin = true;

			RegisterChatCommand(deleteCommand);
			RegisterChatCommand(tpCommand);
			RegisterChatCommand(stopCommand);
			RegisterChatCommand(getIdCommand);
			RegisterChatCommand(saveCommand);
			RegisterChatCommand(ownerCommand);
			RegisterChatCommand(exportCommand);
			RegisterChatCommand(importCommand);
			RegisterChatCommand(spawnCommand);
			RegisterChatCommand(clearCommand);
			RegisterChatCommand(listCommand);
			RegisterChatCommand(offCommand);
			RegisterChatCommand(kickCommand);

			SetupWCFService();
		    SetupSLWCFService();

			Console.WriteLine("Finished loading ChatManager");
		}
示例#11
0
 public static MySharedLock AcquireSharedUsing(this FastResourceLock lockObject)
 {
     return(new MySharedLock(lockObject));
 }
示例#12
0
 public MyExclusiveLock(FastResourceLock lockObject)
 {
     m_lockObject = lockObject;
     m_lockObject.AcquireExclusive();
 }
示例#13
0
 public MySharedLock(FastResourceLock lockObject)
 {
     m_lockObject = lockObject;
     m_lockObject.AcquireShared();
 }
 public MyExclusiveLock(FastResourceLock lockObject)
 {
     m_lockObject = lockObject;
     m_lockObject.AcquireExclusive();
 }
 public MySharedLock(FastResourceLock lockObject)
 {
     m_lockObject = lockObject;
     m_lockObject.AcquireShared();
 }