コード例 #1
0
        public void touch_end(ISceneChildEntity part, ISceneChildEntity child, IClientAPI remoteClient,
                              SurfaceTouchEventArgs surfaceArgs)
        {
            Dictionary <UUID, DetectParams> det = new Dictionary <UUID, DetectParams>();

            if (!CoalescedTouchEvents.TryGetValue(part.LocalId, out det))
            {
                det = new Dictionary <UUID, DetectParams>();
            }

            // Add to queue for all scripts in ObjectID object
            DetectParams detparam = new DetectParams();

            detparam     = new DetectParams();
            detparam.Key = remoteClient.AgentId;

            detparam.Populate(m_scriptEngine.findPrimsScene(part.LocalId));
            detparam.LinkNum = child.LinkNum;

            if (surfaceArgs != null)
            {
                detparam.SurfaceTouchArgs = surfaceArgs;
            }

            det[remoteClient.AgentId]          = detparam;
            CoalescedTouchEvents[part.LocalId] = det;

            ScriptData[] datas = ScriptEngine.ScriptProtection.GetScripts(part.UUID);

            if (datas == null || datas.Length == 0)
            {
                return;
            }

            string functionName = "touch_end";

            object[] param = new Object[] { new LSL_Types.LSLInteger(1) };

            foreach (ScriptData ID in datas)
            {
                if (CheckIfEventShouldFire(ID, functionName, param))
                {
                    m_scriptEngine.AddToScriptQueue(ID, functionName, new List <DetectParams>(det.Values).ToArray(), ID.VersionID, param);
                }
            }
            //Remove us from the det param list
            det.Remove(remoteClient.AgentId);
            CoalescedTouchEvents[part.LocalId] = det;
        }
コード例 #2
0
        public void touch(ISceneChildEntity part, ISceneChildEntity child, Vector3 offsetPos,
                          IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
        {
            Dictionary <UUID, DetectParams> det = new Dictionary <UUID, DetectParams>();

            if (!CoalescedTouchEvents.TryGetValue(part.LocalId, out det))
            {
                det = new Dictionary <UUID, DetectParams>();
            }

            // Add to queue for all scripts in ObjectID object
            DetectParams detparam = new DetectParams();

            detparam = new DetectParams
            {
                Key       = remoteClient.AgentId,
                OffsetPos = new LSL_Types.Vector3(offsetPos.X,
                                                  offsetPos.Y,
                                                  offsetPos.Z)
            };

            detparam.Populate(part.ParentEntity.Scene);
            detparam.LinkNum = child.LinkNum;

            if (surfaceArgs != null)
            {
                detparam.SurfaceTouchArgs = surfaceArgs;
            }

            det[remoteClient.AgentId]          = detparam;
            CoalescedTouchEvents[part.LocalId] = det;

            ScriptData[] datas = ScriptEngine.ScriptProtection.GetScripts(part.UUID);

            if (datas == null || datas.Length == 0)
            {
                return;
            }

            string functionName = "touch";

            object[] param = new Object[] { new LSL_Types.LSLInteger(det.Count) };

            foreach (ScriptData ID in datas)
            {
                m_scriptEngine.AddToScriptQueue(ID, functionName, new List <DetectParams>(det.Values).ToArray(),
                                                EventPriority.FirstStart, param);
            }
        }
コード例 #3
0
        public void land_collision_end(ISceneChildEntity part, ColliderArgs col)
        {
            List <DetectParams> det = new List <DetectParams>();

            foreach (DetectedObject detobj in col.Colliders)
            {
                DetectParams d = new DetectParams();
                d.Position = new LSL_Types.Vector3(detobj.posVector.X,
                                                   detobj.posVector.Y,
                                                   detobj.posVector.Z);
                d.Key = detobj.keyUUID;
                d.Populate(part.ParentEntity.Scene);
                d.LinkNum = part.LinkNum;
                det.Add(d);
            }
            if (det.Count != 0)
            {
                ScriptData[] datas = ScriptEngine.ScriptProtection.GetScripts(part.UUID);

                if (datas == null || datas.Length == 0)
                {
                    //datas = ScriptEngine.ScriptProtection.GetScripts(part.ParentGroup.RootPart.UUID);
                    //if (datas == null || datas.Length == 0)
                    return;
                }
                string   functionName = "land_collision_end";
                object[] param        = new Object[] { new LSL_Types.Vector3(det[0].Position) };

                foreach (ScriptData ID in datas)
                {
                    if (CheckIfEventShouldFire(ID, functionName, param))
                    {
                        m_scriptEngine.AddToScriptQueue(ID, functionName, det.ToArray(), ID.VersionID, param);
                    }
                }
            }
        }
コード例 #4
0
        public void collision_start(ISceneChildEntity part, ColliderArgs col)
        {
            // Add to queue for all scripts in ObjectID object
            List <DetectParams> det = new List <DetectParams>();

            foreach (DetectedObject detobj in col.Colliders)
            {
                DetectParams d = new DetectParams();
                d.Key = detobj.keyUUID;
                d.Populate(part.ParentEntity.Scene);
                d.LinkNum = part.LinkNum;
                det.Add(d);
            }

            if (det.Count > 0)
            {
                ScriptData[] datas = ScriptEngine.ScriptProtection.GetScripts(part.UUID);

                if (datas == null || datas.Length == 0)
                {
                    //datas = ScriptEngine.ScriptProtection.GetScripts(part.ParentGroup.RootPart.UUID);
                    //if (datas == null || datas.Length == 0)
                    return;
                }
                string   functionName = "collision_start";
                object[] param        = new Object[] { new LSL_Types.LSLInteger(det.Count) };

                foreach (ScriptData ID in datas)
                {
                    if (CheckIfEventShouldFire(ID, functionName, param))
                    {
                        m_scriptEngine.AddToScriptQueue(ID, functionName, det.ToArray(), ID.VersionID, param);
                    }
                }
            }
        }
コード例 #5
0
        public void land_collision_end (ISceneChildEntity part, ColliderArgs col)
        {
            List<DetectParams> det = new List<DetectParams>();

            foreach (DetectedObject detobj in col.Colliders)
            {
                DetectParams d = new DetectParams();
                d.Position = new LSL_Types.Vector3(detobj.posVector.X,
                    detobj.posVector.Y,
                    detobj.posVector.Z);
                d.Key = detobj.keyUUID;
                d.Populate(part.ParentEntity.Scene);
                d.LinkNum = part.LinkNum;
                det.Add(d);
            }
            if (det.Count != 0)
            {
                ScriptData[] datas = ScriptEngine.ScriptProtection.GetScripts(part.UUID);

                if (datas == null || datas.Length == 0)
                {
                    //datas = ScriptEngine.ScriptProtection.GetScripts(part.ParentGroup.RootPart.UUID);
                    //if (datas == null || datas.Length == 0)
                        return;
                }
                string functionName = "land_collision_end";
                object[] param = new Object[] { new LSL_Types.Vector3(det[0].Position) };

                foreach (ScriptData ID in datas)
                {
                    if (CheckIfEventShouldFire(ID, functionName, param))
                        m_scriptEngine.AddToScriptQueue(ID, functionName, det.ToArray(), EventPriority.FirstStart, param);
                }
            }
        }
コード例 #6
0
        public void collision_start (ISceneChildEntity part, ColliderArgs col)
        {
            // Add to queue for all scripts in ObjectID object
            List<DetectParams> det = new List<DetectParams>();

            foreach (DetectedObject detobj in col.Colliders)
            {
                DetectParams d = new DetectParams();
                d.Key = detobj.keyUUID;
                d.Populate(part.ParentEntity.Scene);
                d.LinkNum = part.LinkNum;
                det.Add(d);
            }

            if (det.Count > 0)
            {
                ScriptData[] datas = ScriptEngine.ScriptProtection.GetScripts(part.UUID);

                if (datas == null || datas.Length == 0)
                {
                    //datas = ScriptEngine.ScriptProtection.GetScripts(part.ParentGroup.RootPart.UUID);
                    //if (datas == null || datas.Length == 0)
                        return;
                }
                string functionName = "collision_start";
                object[] param = new Object[] { new LSL_Types.LSLInteger(det.Count) };

                foreach (ScriptData ID in datas)
                {
                    if (CheckIfEventShouldFire(ID, functionName, param))
                        m_scriptEngine.AddToScriptQueue(ID, functionName, det.ToArray(), EventPriority.FirstStart, param);
                }
            }
        }
コード例 #7
0
        public void touch_end (ISceneChildEntity part, ISceneChildEntity child, IClientAPI remoteClient,
                              SurfaceTouchEventArgs surfaceArgs)
        {
            Dictionary<UUID, DetectParams> det = new Dictionary<UUID, DetectParams>();
            if (!CoalescedTouchEvents.TryGetValue(part.LocalId, out det))
                det = new Dictionary<UUID, DetectParams>();

            // Add to queue for all scripts in ObjectID object
            DetectParams detparam = new DetectParams();
            detparam = new DetectParams();
            detparam.Key = remoteClient.AgentId;

            detparam.Populate(m_scriptEngine.findPrimsScene(part.LocalId));
            detparam.LinkNum = child.LinkNum;

            if (surfaceArgs != null)
                detparam.SurfaceTouchArgs = surfaceArgs;

            det[remoteClient.AgentId] = detparam;
            CoalescedTouchEvents[part.LocalId] = det;

            ScriptData[] datas = ScriptEngine.ScriptProtection.GetScripts(part.UUID);

            if (datas == null || datas.Length == 0)
                return; 
            
            string functionName = "touch_end";
            object[] param = new Object[] { new LSL_Types.LSLInteger (det.Count) };

            foreach (ScriptData ID in datas)
            {
                if (CheckIfEventShouldFire(ID, functionName, param))
                    m_scriptEngine.AddToScriptQueue(ID, functionName, new List<DetectParams>(det.Values).ToArray(), EventPriority.FirstStart, param);
            }
            //Remove us from the det param list
            det.Remove(remoteClient.AgentId);
            CoalescedTouchEvents[part.LocalId] = det;
        }
コード例 #8
0
        public void touch(ISceneChildEntity part, ISceneChildEntity child, Vector3 offsetPos,
                          IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
        {
            Dictionary<UUID, DetectParams> det = new Dictionary<UUID, DetectParams>();
            if (!CoalescedTouchEvents.TryGetValue(part.LocalId, out det))
                det = new Dictionary<UUID, DetectParams>();

            // Add to queue for all scripts in ObjectID object
            DetectParams detparam = new DetectParams();
            detparam = new DetectParams
                           {
                               Key = remoteClient.AgentId,
                               OffsetPos = new LSL_Types.Vector3(offsetPos.X,
                                                                 offsetPos.Y,
                                                                 offsetPos.Z)
                           };

            detparam.Populate(part.ParentEntity.Scene);
            detparam.LinkNum = child.LinkNum;

            if (surfaceArgs != null)
                detparam.SurfaceTouchArgs = surfaceArgs;

            det[remoteClient.AgentId] = detparam;
            CoalescedTouchEvents[part.LocalId] = det;

            ScriptData[] datas = ScriptEngine.ScriptProtection.GetScripts(part.UUID);

            if (datas == null || datas.Length == 0)
                return;

            string functionName = "touch";
            object[] param = new Object[] {new LSL_Types.LSLInteger(det.Count)};

#if (!ISWIN)
            foreach (ScriptData ID in datas)
            {
                if (CheckIfEventShouldFire(ID, functionName, param))
                {
                    m_scriptEngine.AddToScriptQueue(ID, functionName, new List<DetectParams>(det.Values).ToArray(), EventPriority.FirstStart, param);
                }
            }
#else
            foreach (ScriptData ID in datas.Where(ID => CheckIfEventShouldFire(ID, functionName, param)))
            {
                m_scriptEngine.AddToScriptQueue(ID, functionName, new List<DetectParams>(det.Values).ToArray(),
                                                EventPriority.FirstStart, param);
            }
#endif
        }
コード例 #9
0
ファイル: EventManager.cs プロジェクト: shangcheng/Aurora
        /// <summary>
        /// Handles piping the proper stuff to The script engine for touching
        /// Including DetectedParams
        /// </summary>
        /// <param name="localID"></param>
        /// <param name="originalID"></param>
        /// <param name="offsetPos"></param>
        /// <param name="remoteClient"></param>
        /// <param name="surfaceArgs"></param>
        public void touch_start(SceneObjectPart part, Vector3 offsetPos,
                IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
        {
            // Add to queue for all scripts in ObjectID object
            Dictionary<UUID, DetectParams> det = new Dictionary<UUID, DetectParams>();
            if (!CoalescedTouchEvents.TryGetValue(part.LocalId, out det))
                det = new Dictionary<UUID, DetectParams>();

            DetectParams detparam = new DetectParams();
            detparam.Key = remoteClient.AgentId;

            detparam.Populate(part.ParentGroup.Scene);
            detparam.LinkNum = part.LinkNum;
            
            if (surfaceArgs != null)
            {
                detparam.SurfaceTouchArgs = surfaceArgs;
            }

            det[remoteClient.AgentId] = detparam;
            CoalescedTouchEvents[part.LocalId] = det;

            ScriptData[] datas = ScriptEngine.ScriptProtection.GetScripts(part.UUID);

            if (datas == null || datas.Length == 0)
                return;

            string functionName = "touch_start";
            object[] param = new Object[] { new LSL_Types.LSLInteger(1) };

            foreach (ScriptData ID in datas)
            {
                if (CheckIfEventShouldFire(ID, functionName, param))
                    m_scriptEngine.AddToScriptQueue(ID, functionName, new List<DetectParams>(det.Values).ToArray(), ID.VersionID, EventPriority.FirstStart, param);
            }
        }