Example #1
0
 public void TriggerObjectDeGrab(ISceneChildEntity part, ISceneChildEntity child, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
 {
     ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab;
     if (handlerObjectDeGrab != null)
     {
         foreach (ObjectDeGrabDelegate d in handlerObjectDeGrab.GetInvocationList())
         {
             try
             {
                 d(part, child, remoteClient, surfaceArgs);
             }
             catch (Exception e)
             {
                 MainConsole.Instance.ErrorFormat(
                     "[EVENT MANAGER]: Delegate for TriggerObjectDeGrab failed - continuing.  {0} {1}",
                     e, e.StackTrace);
             }
         }
     }
 }
Example #2
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 {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)};

#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
            //Remove us from the det param list
            det.Remove(remoteClient.AgentId);
            CoalescedTouchEvents[part.LocalId] = det;
        }
Example #3
0
        public void botTouchObject(string bot, string objectID)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botTouchObject", m_host, "bot", m_itemID))
                return;
            SurfaceTouchEventArgs touchArgs = new SurfaceTouchEventArgs();

            IScenePresence sp = World.GetScenePresence(UUID.Parse(bot));
            if (sp == null)
                return;
            ISceneChildEntity child = World.GetSceneObjectPart(UUID.Parse(objectID));
            if (child == null)
                throw new Exception("Failed to find entity to touch");

            World.EventManager.TriggerObjectGrab(child.ParentEntity.RootChild, child, Vector3.Zero, sp.ControllingClient,
                                                 touchArgs);
            World.EventManager.TriggerObjectGrabbing(child.ParentEntity.RootChild, child, Vector3.Zero,
                                                     sp.ControllingClient, touchArgs);
            World.EventManager.TriggerObjectDeGrab(child.ParentEntity.RootChild, child, sp.ControllingClient, touchArgs);
        }
Example #4
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);
            }
        }
Example #5
0
        private void EventManager_OnObjectGrab(ISceneChildEntity part, ISceneChildEntity child, Vector3 offsetPos,
                                               IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
        {
            if (_OnTouchActive && m_localID == part.LocalId)
            {
                TouchEventArgs e = new TouchEventArgs
                                       {
                                           Avatar = new SPAvatar(m_rootScene, remoteClient.AgentId, m_security),
                                           TouchBiNormal = surfaceArgs.Binormal,
                                           TouchMaterialIndex = surfaceArgs.FaceIndex,
                                           TouchNormal = surfaceArgs.Normal,
                                           TouchPosition = surfaceArgs.Position,
                                           TouchST = new Vector2(surfaceArgs.STCoord.X, surfaceArgs.STCoord.Y),
                                           TouchUV = new Vector2(surfaceArgs.UVCoord.X, surfaceArgs.UVCoord.Y)
                                       };

                IObject sender = this;

                if (_OnTouch != null)
                    _OnTouch(sender, e);
            }
        }