예제 #1
0
        /// <summary>
        /// Add event to event execution queue
        /// </summary>
        /// <param name="localID">Region object ID</param>
        /// <param name="itemID">Region script ID</param>
        /// <param name="FunctionName">Name of the function, will be state + "_event_" + FunctionName</param>
        /// <param name="param">Array of parameters to match event mask</param>
        public bool AddToScriptQueue(uint localID, UUID itemID, string FunctionName, DetectParams[] qParams, params object[] param)
        {
            List <UUID> keylist = m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID);

            if (!keylist.Contains(itemID)) // We don't manage that script
            {
                return(false);
            }

            lock (eventQueue)
            {
                if (eventQueue.Count >= EventExecutionMaxQueueSize)
                {
                    m_log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: ERROR: Event execution queue item count is at " + eventQueue.Count + ". Config variable \"EventExecutionMaxQueueSize\" is set to " + EventExecutionMaxQueueSize + ", so ignoring new event.");
                    m_log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Event ignored: localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
                    return(false);
                }

                InstanceData id = m_ScriptEngine.m_ScriptManager.GetScript(
                    localID, itemID);

                // Create a structure and add data
                QueueItemStruct QIS = new QueueItemStruct();
                QIS.localID        = localID;
                QIS.itemID         = itemID;
                QIS.functionName   = FunctionName;
                QIS.llDetectParams = qParams;
                QIS.param          = param;
                if (id != null)
                {
                    QIS.LineMap = id.LineMap;
                }

                // Add it to queue
                eventQueue.Enqueue(QIS);
            }
            return(true);
        }
예제 #2
0
        /// <summary>
        /// Add event to event execution queue
        /// </summary>
        /// <param name="localID">Region object ID</param>
        /// <param name="itemID">Region script ID</param>
        /// <param name="FunctionName">Name of the function, will be state + "_event_" + FunctionName</param>
        /// <param name="param">Array of parameters to match event mask</param>
        public bool AddToScriptQueue(uint localID, UUID itemID, string FunctionName, DetectParams[] qParams, params object[] param)
        {
            List<UUID> keylist = m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID);

            if (!keylist.Contains(itemID)) // We don't manage that script
            {
                return false;
            }

            lock (eventQueue)
            {
                if (eventQueue.Count >= EventExecutionMaxQueueSize)
                {
                    m_log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: ERROR: Event execution queue item count is at " + eventQueue.Count + ". Config variable \"EventExecutionMaxQueueSize\" is set to " + EventExecutionMaxQueueSize + ", so ignoring new event.");
                    m_log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Event ignored: localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
                    return false;
                }

                InstanceData id = m_ScriptEngine.m_ScriptManager.GetScript(
                        localID, itemID);

                // Create a structure and add data
                QueueItemStruct QIS = new QueueItemStruct();
                QIS.localID = localID;
                QIS.itemID = itemID;
                QIS.functionName = FunctionName;
                QIS.llDetectParams = qParams;
                QIS.param = param;
                if (id != null)
                    QIS.LineMap = id.LineMap;

                // Add it to queue
                eventQueue.Enqueue(QIS);
            }
            return true;
        }