Exemplo n.º 1
0
        public void botTouchObject (string bot, string objectID)
        {
            ScriptProtection.CheckThreatLevel (ThreatLevel.Moderate, "botTouchObject", m_host, "bot");
            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);
        }
Exemplo n.º 2
0
 public void touch(uint localID, uint originalID, Vector3 offsetPos,
                   IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
 {
     touches(localID, originalID, offsetPos, remoteClient, surfaceArgs, "touch");
 }
Exemplo n.º 3
0
 public void touch_end(uint localID, uint originalID, IClientAPI remoteClient,
                       SurfaceTouchEventArgs surfaceArgs)
 {
     touches(localID, originalID, zeroVec3, remoteClient, surfaceArgs, "touch_end");
 }
Exemplo n.º 4
0
        void EventManager_OnObjectGrab (ISceneChildEntity part, ISceneChildEntity child, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
        {
            if (_OnTouchActive && m_localID == part.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);
            }
        }
Exemplo n.º 5
0
        void EventManager_OnObjectGrab(ISceneChildEntity part, ISceneChildEntity child, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
        {
            if (_OnTouchActive && m_localID == part.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);
                }
            }
        }
Exemplo n.º 6
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)};

            foreach (ScriptData ID in datas)
            {
                m_scriptEngine.AddToScriptQueue(ID, functionName, new List<DetectParams>(det.Values).ToArray(),
                                                EventPriority.FirstStart, param);
            }
        }
Exemplo n.º 7
0
        protected void OnOsTouch(
            uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
        {
            if (!m_localIds.Contains(originalID))
            {
                return;
            }

            lock (m_interactions)
            {
                if (m_interactions.ContainsKey(remoteClient.AgentId))
                {
                    m_interactions[remoteClient.AgentId].Close();
                    m_interactions.Remove(remoteClient.AgentId);
                }

                AbstractInteraction interaction = CreateInteraction(remoteClient);

                // Not all clickable buttons implement interactions
                // FIXME: May change this at some stage for simplicity.
                if (interaction != null)
                {
                    m_interactions.Add(remoteClient.AgentId, interaction);
                }
            }

            if (OnClick != null)
            {
                foreach (OnClickDelegate d in OnClick.GetInvocationList())
                {
                    try
                    {
                        d(offsetPos, remoteClient, surfaceArgs);
                    }
                    catch (Exception e)
                    {
                        m_log.ErrorFormat(
                            "[WATER WARS]: Delegate for OnOsTouch failed - continuing.  {0}{1}",
                            e.Message, e.StackTrace);
                    }
                }
            }

//            m_log.InfoFormat(
//                "[OS WIDGETS]: Fired OnTouch() with localID {0}, originalID {1} (part has localID {2}, Text {3})",
//                localID, originalID, m_part.LocalId, DisplayBehaviour.Text.Replace("\n", @"\n"));
        }
Exemplo n.º 8
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);
                if (originalPart == null)
                {
                    return;
                }
                det[0].LinkNum = originalPart.LinkNum;
            }

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

            myScriptEngine.PostObjectEvent(localID, new EventParams(
                                               "touch_end", new Object[] { 1 },
                                               det));
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
 public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
 {
     handlerObjectGrab = OnObjectGrab;
     if (handlerObjectGrab != null)
     {
         handlerObjectGrab(localID, originalID, offsetPos, remoteClient, surfaceArgs);
     }
 }