예제 #1
0
 public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
 {
     handlerObjectDeGrab = OnObjectDeGrab;
     if (handlerObjectDeGrab != null)
     {
         handlerObjectDeGrab(localID, originalID, remoteClient, surfaceArgs);
     }
 }
예제 #2
0
        public void touch_end(uint localID, uint originalID, IClientAPI remoteClient,
                              SurfaceTouchEventArgs surfaceArgs)
        {
            // Add to queue for all scripts in ObjectID object
            DetectParams[] det = new DetectParams[1];
            det[0] = new DetectParams();
            det[0].Key = remoteClient.AgentId;
            det[0].Populate(myScriptEngine.World);

            if (originalID == 0)
            {
                SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(localID);
                if (part == null)
                    return;

                det[0].LinkNum = part.LinkNum;
            }
            else
            {
                SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID);
                det[0].LinkNum = originalPart.LinkNum;
            }

            if (surfaceArgs != null)
            {
                det[0].SurfaceTouchArgs = surfaceArgs;
            }

            myScriptEngine.PostObjectEvent(localID, new EventParams(
                    "touch_end", new Object[] { new LSL_Types.LSLInteger(1) },
                    det));
        }
예제 #3
0
 public bool Touch(UUID target)
 {
     SceneObjectPart part = m_scene.GetSceneObjectPart(target);
     if (part == null)
         return false;
     bool objectTouchable = hasTouchEvents(part); // Only touch an object that is scripted to respond
     if (!objectTouchable && !part.IsRoot)
         objectTouchable = hasTouchEvents(part.ParentGroup.RootPart);
     if (!objectTouchable)
         return false;
     // Set up the surface args as if the touch is from a client that does not support this
     SurfaceTouchEventArgs surfaceArgs = new SurfaceTouchEventArgs();
     surfaceArgs.FaceIndex = -1; // TOUCH_INVALID_FACE
     surfaceArgs.Binormal =  Vector3.Zero; // TOUCH_INVALID_VECTOR
     surfaceArgs.Normal =  Vector3.Zero; // TOUCH_INVALID_VECTOR
     surfaceArgs.STCoord = new Vector3(-1.0f, -1.0f, 0.0f); // TOUCH_INVALID_TEXCOORD
     surfaceArgs.UVCoord = surfaceArgs.STCoord; // TOUCH_INVALID_TEXCOORD
     List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>();
     touchArgs.Add(surfaceArgs);
     Vector3 offset = part.OffsetPosition * -1.0f;
     if (OnGrabObject == null)
         return false;
     OnGrabObject(part.LocalId, offset, this, touchArgs);
     if (OnGrabUpdate != null)
         OnGrabUpdate(part.UUID, offset, part.ParentGroup.RootPart.GroupPosition, this, touchArgs);
     if (OnDeGrabObject != null)
         OnDeGrabObject(part.LocalId, this, touchArgs);
     return true;
 }
예제 #4
0
 public override bool ConvertIn(RegionSyncModule pRegionContext)
 {
     bool ret = false;
     if (base.ConvertIn(pRegionContext))
     {
     AgentID = DataMap["agentID"].AsUUID();
     PrimID = DataMap["primID"].AsUUID();
     OriginalPrimID = DataMap["originalPrimID"].AsUUID();
     OffsetPos = DataMap["offsetPos"].AsVector3();
     SurfaceArgs = new SurfaceTouchEventArgs();
     SurfaceArgs.Binormal = DataMap["binormal"].AsVector3();
     SurfaceArgs.FaceIndex = DataMap["faceIndex"].AsInteger();
     SurfaceArgs.Normal = DataMap["normal"].AsVector3();
     SurfaceArgs.Position = DataMap["position"].AsVector3();
     SurfaceArgs.STCoord = DataMap["stCoord"].AsVector3();
     SurfaceArgs.UVCoord = DataMap["uvCoord"].AsVector3();
     ret = true;
     }
     return ret;
 }
예제 #5
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);
        }
예제 #6
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)
             {
                 m_log.ErrorFormat (
                     "[EVENT MANAGER]: Delegate for TriggerObjectDeGrab failed - continuing.  {0} {1}",
                     e.ToString (), e.StackTrace);
             }
         }
     }
 }
 public TouchCallback(UUID obj, UUID req, UUID avt, Vector3 off, SurfaceTouchEventArgs ev)
 {
     ObjectID = obj;
     RequestID = req;
     AvatarID = avt;
     OffsetPosition = off;
     TouchEvent = ev;
 }
예제 #8
0
        public bool TouchObject(UUID objectID)
        {
            if (m_frozenUser)
                return false;

            SurfaceTouchEventArgs surfaceArg = new SurfaceTouchEventArgs();

            ScenePresence sp = m_scene.GetScenePresence(AgentID);
            if (sp == null)
                return false;

            SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
            if (part == null)
                return false;

            m_scene.ProcessObjectGrab(part.LocalId, Vector3.Zero, this, null);
            m_scene.ProcessObjectDeGrab(part.LocalId, this, null);
            return true;
        }
예제 #9
0
 public void TriggerObjectGrab (ISceneChildEntity part, ISceneChildEntity child, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
 {
     ObjectGrabDelegate handlerObjectGrab = OnObjectGrab;
     if (handlerObjectGrab != null)
     {
         foreach (ObjectGrabDelegate d in handlerObjectGrab.GetInvocationList ())
         {
             try
             {
                 d (part, child, offsetPos, remoteClient, surfaceArgs);
             }
             catch (Exception e)
             {
                 MainConsole.Instance.ErrorFormat (
                     "[EVENT MANAGER]: Delegate for TriggerObjectGrab failed - continuing.  {0} {1}",
                     e, e.StackTrace);
             }
         }
     }
 }
예제 #10
0
        void EventManager_OnObjectGrabUpdate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
        {
            // Add to queue for all scripts in ObjectID object
            DetectParams[] det = new DetectParams[1];
            det[0] = new DetectParams();
            det[0].Key = remoteClient.AgentId;
            det[0].Populate(myScriptEngine.World);
            det[0].OffsetPos = offsetPos;

            if (originalID == 0)
            {
                SceneObjectPart part =
                        myScriptEngine.World.GetSceneObjectPart(localID);

                if (part == null)
                    return;

                det[0].LinkNum = part.LinkNum;
            }
            else
            {
                SceneObjectPart originalPart =
                        myScriptEngine.World.GetSceneObjectPart(originalID);
                det[0].LinkNum = originalPart.LinkNum;
            }
            if (surfaceArgs != null)
            {
                det[0].SurfaceTouchArgs = surfaceArgs;
            }

            myScriptEngine.UpdateTouchData(localID, det);
        }
예제 #11
0
 //(uint localID, Vector3 offsetPos, IClientAPI remoteClient)
 public void touch_start(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
 {
     string EventParams = "\"touch_start\"," + localID.ToString() + "," + "\"" + remoteClient.AgentId.ToString() + "\"";
     m_scriptEngine.ExecutePythonCommand("CreateEventWithName(" + EventParams + ")");
 }
예제 #12
0
        /// <summary>
        ///   Handles piping the proper stuff to The script engine for touching
        ///   Including DetectedParams
        /// </summary>
        /// <param name = "part"></param>
        /// <param name = "child"></param>
        /// <param name = "offsetPos"></param>
        /// <param name = "remoteClient"></param>
        /// <param name = "surfaceArgs"></param>
        public void touch_start(ISceneChildEntity part, ISceneChildEntity child, 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 {Key = remoteClient.AgentId};

            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_start";
            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
        }
        /// -----------------------------------------------------------------
        /// <summary>
        /// </summary>
        /// -----------------------------------------------------------------
        public void touch_start(uint localID, uint originalID, Vector3 offsetPos,
                IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
        {
            m_log.DebugFormat("[EventHandlers] Touch event received");

            // Find the object UUID associated with the localID/originalID
            UUID objectID;
            if (originalID == 0)
            {
                SceneObjectPart part = m_scene.GetSceneObjectPart(localID);
                if (part == null)
                    return;
                objectID = part.ParentGroup.UUID;
            }
            else
            {
                SceneObjectPart part = m_scene.GetSceneObjectPart(originalID);
                if (part == null)
                    return;
                objectID = part.ParentGroup.UUID;
            }

            // And grab the callbacks we need to send
            List<EventCallback> cblist = null;
            lock (m_objectRegistry)
            {
                if (! m_objectRegistry.TryGetValue(objectID, out cblist))
                    return;
            }

            // Send the callback
            TouchCallback touch = new RemoteControl.Messages.TouchCallback(objectID,UUID.Zero,remoteClient.AgentId,offsetPos,surfaceArgs);
            foreach (EventCallback cb in cblist)
            {
                EndPoint ep = m_dispatcher.LookupEndPoint(cb.EndPointID);
                if (ep == null)
                {
                    m_log.WarnFormat("[EventHandlers] unable to locate endpoint {0}",cb.RequestID);
                    return;
                }

                touch.RequestID = cb.RequestID;
                ep.Send(touch);
            }
        }
예제 #14
0
 public SyncMsgObjectGrabbing(RegionSyncModule pRegionContext, UUID pAgentID, UUID pPrimID, UUID pOrigPrimID, Vector3 pOffset, SurfaceTouchEventArgs pTouchArgs)
     : base(MsgType.ObjectGrabbing, pRegionContext, pAgentID, pPrimID, pOrigPrimID, pOffset, pTouchArgs)
 {
 }
예제 #15
0
 public void TriggerObjectGrabbing(SceneObjectPart part, SceneObjectPart child, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
 {
     ObjectGrabDelegate handlerObjectGrabbing = OnObjectGrabbing;
     if (handlerObjectGrabbing != null)
     {
         foreach (ObjectGrabDelegate d in handlerObjectGrabbing.GetInvocationList())
         {
             try
             {
                 d(part, child, offsetPos, remoteClient, surfaceArgs);
             }
             catch (Exception e)
             {
                 m_log.ErrorFormat(
                     "[EVENT MANAGER]: Delegate for TriggerObjectGrabbing failed - continuing.  {0} {1}",
                     e.ToString(), e.StackTrace);
             }
         }
     }
 }
예제 #16
0
        public void touch(SceneObjectPart part, 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();
            detparam.Key = remoteClient.AgentId;
            detparam.OffsetPos = new LSL_Types.Vector3(offsetPos.X,
                                                     offsetPos.Y,
                                                     offsetPos.Z);

            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";
            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);
            }
        }
예제 #17
0
        private void OnObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
        {
            // Add to queue for all scripts in ObjectID object
            DetectParams[] det = new DetectParams[1];
            det[0] = new DetectParams();
            det[0].Key = remoteClient.AgentId;
            //det[0].Populate(World);

            if (originalID == 0)
            {
                SceneObjectPart part =
                        CurrentRegion.Scene.GetSceneObjectPart(localID);

                if (part == null)
                    return;

                det[0].LinkNum = part.LinkNum;
            }
            else
            {
                SceneObjectPart originalPart =
                        CurrentRegion.Scene.GetSceneObjectPart(originalID);
                det[0].LinkNum = originalPart.LinkNum;
            }
            if (surfaceArgs != null)
            {
                det[0].SurfaceTouchArgs = surfaceArgs;
            }
            Shared.EventParams ep =
                new Shared.EventParams(localID, "touch_start", new Object[] {new LSL_Types.LSLInteger(1)}, det);
            CurrentRegion.Executors_Execute(ep);
                
        }
예제 #18
0
 public void TriggerObjectGrabUpdate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
 {
     ObjectGrabUpdateDelegate handler = OnObjectGrabUpdate;
     if (handler != null)
     {
         handler(localID, originalID, offsetPos, remoteClient, surfaceArgs);
     }
 }
예제 #19
0
 public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
 {
     ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab;
     if (handlerObjectDeGrab != null)
     {
         foreach (ObjectDeGrabDelegate d in handlerObjectDeGrab.GetInvocationList())
         {
             try
             {
                 d(localID, originalID, remoteClient, surfaceArgs);
             }
             catch (Exception e)
             {
                 m_log.ErrorFormat(
                     "[EVENT MANAGER]: Delegate for TriggerObjectDeGrab failed - continuing.  {0} {1}", 
                     e.Message, e.StackTrace);
             }
         }
     }
 }
예제 #20
0
        void EventManager_OnObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
        {
            if (_OnTouchActive && m_localID == localID)
            {
                TouchEventArgs e = new TouchEventArgs();
                e.Avatar = new SPAvatar(m_rootScene, remoteClient.AgentId, m_security);
                e.TouchBiNormal = surfaceArgs.Binormal;
                e.TouchMaterialIndex = surfaceArgs.FaceIndex;
                e.TouchNormal = surfaceArgs.Normal;
                e.TouchPosition = surfaceArgs.Position;
                e.TouchST = new Vector2(surfaceArgs.STCoord.X, surfaceArgs.STCoord.Y);
                e.TouchUV = new Vector2(surfaceArgs.UVCoord.X, surfaceArgs.UVCoord.Y);

                IObject sender = this;

                if (_OnTouch != null)
                    _OnTouch(sender, e);
            }
        }
예제 #21
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;
        }
예제 #22
0
 public SyncMsgEventGrabber(MsgType pMType, RegionSyncModule pRegionContext, UUID pAgentID, UUID pPrimID, UUID pOrigPrimID, Vector3 pOffset, SurfaceTouchEventArgs pTouchArgs)
     : base(pMType, pRegionContext)
 {
     AgentID = pAgentID;
     PrimID = pPrimID;
     OriginalPrimID = pOrigPrimID;
     OffsetPos = pOffset;
     SurfaceArgs = pTouchArgs;
 }