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); }
public void touch(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { touches(localID, originalID, offsetPos, remoteClient, surfaceArgs, "touch"); }
public void touch_end(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { touches(localID, originalID, zeroVec3, remoteClient, surfaceArgs, "touch_end"); }
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); } }
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); } } }
/// <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); } }
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")); }
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)); }
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); }
public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { handlerObjectGrab = OnObjectGrab; if (handlerObjectGrab != null) { handlerObjectGrab(localID, originalID, offsetPos, remoteClient, surfaceArgs); } }