Merge branch 'master' of /home/opensim/var/repo/opensim
						commit
						bc0cfa4468
					
				|  | @ -740,14 +740,21 @@ namespace OpenSim.Framework | ||||||
|         /// </summary> |         /// </summary> | ||||||
|         string Name { get; } |         string Name { get; } | ||||||
| 
 | 
 | ||||||
|         /// <value> |         /// <summary> | ||||||
|         /// Determines whether the client thread is doing anything or not. |         /// True if the client is active (sending and receiving new UDP messages).  False if the client is being closed. | ||||||
|         /// </value> |         /// </summary> | ||||||
|         bool IsActive { get; set; } |         bool IsActive { get; set; } | ||||||
| 
 | 
 | ||||||
|         /// <value> |         /// <summary> | ||||||
|         /// Determines whether the client is or has been removed from a given scene |         /// Set if the client is closing due to a logout request | ||||||
|         /// </value> |         /// </summary> | ||||||
|  |         /// <remarks> | ||||||
|  |         /// Do not use this flag if you want to know if the client is closing, since it will not be set in other | ||||||
|  |         /// circumstances (e.g. if a child agent is closed or the agent is kicked off the simulator).  Use IsActive | ||||||
|  |         /// instead with a IClientAPI.SceneAgent.IsChildAgent check if necessary. | ||||||
|  |         /// | ||||||
|  |         /// Only set for root agents. | ||||||
|  |         /// </remarks> | ||||||
|         bool IsLoggingOut { get; set; } |         bool IsLoggingOut { get; set; } | ||||||
|          |          | ||||||
|         bool SendLogoutPacketWhenClosing { set; } |         bool SendLogoutPacketWhenClosing { set; } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,7 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| using System; | using System; | ||||||
|  | using OpenMetaverse; | ||||||
| 
 | 
 | ||||||
| namespace OpenSim.Framework | namespace OpenSim.Framework | ||||||
| { | { | ||||||
|  | @ -71,5 +72,11 @@ namespace OpenSim.Framework | ||||||
|         /// This includes scene object data and the appearance data of other avatars. |         /// This includes scene object data and the appearance data of other avatars. | ||||||
|         /// </remarks> |         /// </remarks> | ||||||
|         void SendInitialDataToMe(); |         void SendInitialDataToMe(); | ||||||
|  | 
 | ||||||
|  |         /// <summary> | ||||||
|  |         /// Direction in which the scene presence is looking. | ||||||
|  |         /// </summary> | ||||||
|  |         /// <remarks>Will be Vector3.Zero for a child agent.</remarks> | ||||||
|  |         Vector3 Lookat { get; }         | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -490,12 +490,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | ||||||
|         /// </summary> |         /// </summary> | ||||||
|         public void Close() |         public void Close() | ||||||
|         { |         { | ||||||
|  |             IsActive = false; | ||||||
|  | 
 | ||||||
|             m_log.DebugFormat( |             m_log.DebugFormat( | ||||||
|                 "[CLIENT]: Close has been called for {0} attached to scene {1}", |                 "[CLIENT]: Close has been called for {0} attached to scene {1}", | ||||||
|                 Name, m_scene.RegionInfo.RegionName); |                 Name, m_scene.RegionInfo.RegionName); | ||||||
| 
 | 
 | ||||||
|             IsActive = false; |  | ||||||
| 
 |  | ||||||
|             // Shutdown the image manager |             // Shutdown the image manager | ||||||
|             ImageManager.Close(); |             ImageManager.Close(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -555,12 +555,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | ||||||
|             if (udpClient.IsPaused) |             if (udpClient.IsPaused) | ||||||
|                 timeoutTicks = m_pausedAckTimeout; |                 timeoutTicks = m_pausedAckTimeout; | ||||||
| 
 | 
 | ||||||
|             if (!client.IsLoggingOut && |             if (client.IsActive && | ||||||
|                 (Environment.TickCount & Int32.MaxValue) - udpClient.TickLastPacketReceived > timeoutTicks) |                 (Environment.TickCount & Int32.MaxValue) - udpClient.TickLastPacketReceived > timeoutTicks) | ||||||
|             { |             { | ||||||
|                 m_log.Warn("[LLUDPSERVER]: Ack timeout, disconnecting " + udpClient.AgentID); |                 // We must set IsActive synchronously so that we can stop the packet loop reinvoking this method, even | ||||||
|                 StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); |                 // though it's set later on by LLClientView.Close() | ||||||
|                 RemoveClient(client); |                 client.IsActive = false; | ||||||
|  | 
 | ||||||
|  |                 // Fire this out on a different thread so that we don't hold up outgoing packet processing for | ||||||
|  |                 // everybody else if this is being called due to an ack timeout. | ||||||
|  |                 // This is the same as processing as the async process of a logout request. | ||||||
|  |                 Util.FireAndForget(o => DeactivateClientDueToTimeout(client)); | ||||||
| 
 | 
 | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|  | @ -1110,15 +1115,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP | ||||||
|             return client; |             return client; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private void RemoveClient(IClientAPI client) |         /// <summary> | ||||||
|  |         /// Deactivates the client if we don't receive any packets within a certain amount of time (default 60 seconds). | ||||||
|  |         /// </summary> | ||||||
|  |         /// <remarks> | ||||||
|  |         /// If a connection is active then we will always receive packets even if nothing else is happening, due to | ||||||
|  |         /// regular client pings. | ||||||
|  |         /// </remarks> | ||||||
|  |         /// <param name='client'></param> | ||||||
|  |         private void DeactivateClientDueToTimeout(IClientAPI client) | ||||||
|         { |         { | ||||||
|             // We must set IsLoggingOut synchronously so that we can stop the packet loop reinvoking this method. |             // We must set IsActive synchronously so that we can stop the packet loop reinvoking this method, even | ||||||
|             client.IsLoggingOut = true; |             // though it's set later on by LLClientView.Close() | ||||||
|  |             client.IsActive = false; | ||||||
| 
 | 
 | ||||||
|             // Fire this out on a different thread so that we don't hold up outgoing packet processing for |             m_log.WarnFormat( | ||||||
|             // everybody else if this is being called due to an ack timeout. |                 "[LLUDPSERVER]: Ack timeout, disconnecting {0} agent for {1} in {2}", | ||||||
|             // This is the same as processing as the async process of a logout request. |                 client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, m_scene.RegionInfo.RegionName); | ||||||
|             Util.FireAndForget(o => client.Close()); | 
 | ||||||
|  |             StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); | ||||||
|  | 
 | ||||||
|  |             if (!client.SceneAgent.IsChildAgent) | ||||||
|  |                  client.Kick("Simulator logged you out due to connection timeout"); | ||||||
|  | 
 | ||||||
|  |             client.Close(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private void IncomingPacketHandler() |         private void IncomingPacketHandler() | ||||||
|  | @ -1432,8 +1452,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | ||||||
|         protected void LogoutHandler(IClientAPI client) |         protected void LogoutHandler(IClientAPI client) | ||||||
|         { |         { | ||||||
|             client.SendLogoutPacket(); |             client.SendLogoutPacket(); | ||||||
|  | 
 | ||||||
|             if (!client.IsLoggingOut) |             if (!client.IsLoggingOut) | ||||||
|                 RemoveClient(client); |             { | ||||||
|  |                 client.IsLoggingOut = true; | ||||||
|  |                 client.Close(); | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -325,34 +325,30 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | ||||||
| 
 | 
 | ||||||
|         void OnConnectionClosed(IClientAPI obj) |         void OnConnectionClosed(IClientAPI obj) | ||||||
|         { |         { | ||||||
|             if (obj.IsLoggingOut) |             if (obj.SceneAgent.IsChildAgent) | ||||||
|  |                 return; | ||||||
|  | 
 | ||||||
|  |             // Let's find out if this is a foreign user or a local user | ||||||
|  |             IUserManagement uMan = Scene.RequestModuleInterface<IUserManagement>(); | ||||||
|  | //          UserAccount account = Scene.UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, obj.AgentId); | ||||||
|  | 
 | ||||||
|  |             if (uMan != null && uMan.IsLocalGridUser(obj.AgentId)) | ||||||
|             { |             { | ||||||
|                 object sp = null; |                 // local grid user | ||||||
|                 if (obj.Scene.TryGetScenePresence(obj.AgentId, out sp)) |                 return; | ||||||
|                 { |             } | ||||||
|                     if (((ScenePresence)sp).IsChildAgent) |  | ||||||
|                         return; |  | ||||||
|                 } |  | ||||||
| 
 | 
 | ||||||
|                 // Let's find out if this is a foreign user or a local user |             AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode); | ||||||
|                 IUserManagement uMan = Scene.RequestModuleInterface<IUserManagement>(); |  | ||||||
| //                UserAccount account = Scene.UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, obj.AgentId); |  | ||||||
|                 if (uMan != null && uMan.IsLocalGridUser(obj.AgentId)) |  | ||||||
|                 { |  | ||||||
|                     // local grid user |  | ||||||
|                     return; |  | ||||||
|                 } |  | ||||||
| 
 | 
 | ||||||
|                 AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode); |             if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | ||||||
| 
 |             { | ||||||
|                 if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) |                 string url = aCircuit.ServiceURLs["HomeURI"].ToString(); | ||||||
|                 { |                 IUserAgentService security = new UserAgentServiceConnector(url); | ||||||
|                     string url = aCircuit.ServiceURLs["HomeURI"].ToString(); |                 security.LogoutAgent(obj.AgentId, obj.SessionId); | ||||||
|                     IUserAgentService security = new UserAgentServiceConnector(url); |                 //m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Sent logout call to UserAgentService @ {0}", url); | ||||||
|                     security.LogoutAgent(obj.AgentId, obj.SessionId); |             } | ||||||
|                     //m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Sent logout call to UserAgentService @ {0}", url); |             else | ||||||
|                 } |             { | ||||||
|                 else |  | ||||||
|                     m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: HomeURI not found for agent {0} logout", obj.AgentId); |                     m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: HomeURI not found for agent {0} logout", obj.AgentId); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -341,6 +341,14 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | ||||||
|                     m => m.Scene.StatsReporter.LastReportedSimStats[11], |                     m => m.Scene.StatsReporter.LastReportedSimStats[11], | ||||||
|                     m => string.Format("{0} ms", m.GetValue()))); |                     m => string.Format("{0} ms", m.GetValue()))); | ||||||
| 
 | 
 | ||||||
|  |             m_staticMonitors.Add( | ||||||
|  |                 new GenericMonitor( | ||||||
|  |                     m_scene, | ||||||
|  |                     "SpareFrameTimeMonitor", | ||||||
|  |                     "Spare Frame Time", | ||||||
|  |                     m => m.Scene.StatsReporter.LastReportedSimStats[21], | ||||||
|  |                     m => string.Format("{0} ms", m.GetValue()))); | ||||||
|  | 
 | ||||||
|             m_alerts.Add(new DeadlockAlert(m_staticMonitors.Find(x => x is LastFrameTimeMonitor) as LastFrameTimeMonitor)); |             m_alerts.Add(new DeadlockAlert(m_staticMonitors.Find(x => x is LastFrameTimeMonitor) as LastFrameTimeMonitor)); | ||||||
| 
 | 
 | ||||||
|             foreach (IAlert alert in m_alerts) |             foreach (IAlert alert in m_alerts) | ||||||
|  |  | ||||||
|  | @ -79,29 +79,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | ||||||
| 
 | 
 | ||||||
|         public void OnConnectionClose(IClientAPI client) |         public void OnConnectionClose(IClientAPI client) | ||||||
|         { |         { | ||||||
|             if (client.IsLoggingOut) |             if (client.SceneAgent.IsChildAgent) | ||||||
|             { |                 return; | ||||||
|                 object sp = null; |  | ||||||
|                 Vector3 position = new Vector3(128, 128, 0); |  | ||||||
|                 Vector3 lookat = new Vector3(0, 1, 0); |  | ||||||
| 
 |  | ||||||
|                 if (client.Scene.TryGetScenePresence(client.AgentId, out sp)) |  | ||||||
|                 { |  | ||||||
|                     if (sp is ScenePresence) |  | ||||||
|                     { |  | ||||||
|                         if (((ScenePresence)sp).IsChildAgent) |  | ||||||
|                             return; |  | ||||||
| 
 |  | ||||||
|                         position = ((ScenePresence)sp).AbsolutePosition; |  | ||||||
|                         lookat = ((ScenePresence)sp).Lookat; |  | ||||||
|                     } |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
| //                m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); |  | ||||||
|                 m_GridUserService.LoggedOut(client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, position, lookat); |  | ||||||
|             } |  | ||||||
| 
 | 
 | ||||||
|  | //            m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); | ||||||
|  |             m_GridUserService.LoggedOut( | ||||||
|  |                 client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, | ||||||
|  |                 client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat); | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -64,7 +64,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | ||||||
|             scene.EventManager.OnNewClient -= OnNewClient; |             scene.EventManager.OnNewClient -= OnNewClient; | ||||||
| 
 | 
 | ||||||
|             m_PresenceService.LogoutRegionAgents(scene.RegionInfo.RegionID); |             m_PresenceService.LogoutRegionAgents(scene.RegionInfo.RegionID); | ||||||
| 
 |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public void OnMakeRootAgent(ScenePresence sp) |         public void OnMakeRootAgent(ScenePresence sp) | ||||||
|  | @ -80,18 +79,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | ||||||
| 
 | 
 | ||||||
|         public void OnConnectionClose(IClientAPI client) |         public void OnConnectionClose(IClientAPI client) | ||||||
|         { |         { | ||||||
|             if (client.IsLoggingOut) |             if (!client.SceneAgent.IsChildAgent) | ||||||
|             { |             { | ||||||
|                 object sp = null; |  | ||||||
|                 if (client.Scene.TryGetScenePresence(client.AgentId, out sp)) |  | ||||||
|                 { |  | ||||||
|                     if (sp is ScenePresence) |  | ||||||
|                     { |  | ||||||
|                         if (((ScenePresence)sp).IsChildAgent) |  | ||||||
|                             return; |  | ||||||
|                     } |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
| //                m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); | //                m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); | ||||||
|                 m_PresenceService.LogoutAgent(client.SessionId); |                 m_PresenceService.LogoutAgent(client.SessionId); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  | @ -137,7 +137,7 @@ namespace OpenSim.Region.Framework.Scenes | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 if (fh.Client.IsLoggingOut) |                 if (!fh.Client.IsActive) | ||||||
|                     continue; |                     continue; | ||||||
| 
 | 
 | ||||||
| //                m_log.DebugFormat( | //                m_log.DebugFormat( | ||||||
|  |  | ||||||
|  | @ -3463,10 +3463,9 @@ namespace OpenSim.Region.Framework.Scenes | ||||||
|                 // Or the same user is trying to be root twice here, won't work. |                 // Or the same user is trying to be root twice here, won't work. | ||||||
|                 // Kill it. |                 // Kill it. | ||||||
|                 m_log.DebugFormat( |                 m_log.DebugFormat( | ||||||
|                     "[SCENE]: Zombie scene presence detected for {0} in {1}", |                     "[SCENE]: Zombie scene presence detected for {0} {1} in {2}", | ||||||
|                     agent.AgentID, |                     sp.Name, sp.UUID, RegionInfo.RegionName); | ||||||
|                     RegionInfo.RegionName | 
 | ||||||
|                 ); |  | ||||||
|                 sp.ControllingClient.Close(); |                 sp.ControllingClient.Close(); | ||||||
|                 sp = null; |                 sp = null; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  | @ -1899,9 +1899,9 @@ namespace OpenSim.Region.Framework.Scenes | ||||||
|             { |             { | ||||||
|                 if (SitTargetUnOccupied) |                 if (SitTargetUnOccupied) | ||||||
|                 { |                 { | ||||||
|                     m_log.DebugFormat( | //                    m_log.DebugFormat( | ||||||
|                         "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is set and unoccupied", | //                        "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is set and unoccupied", | ||||||
|                         Name, part.Name, part.LocalId); | //                        Name, part.Name, part.LocalId); | ||||||
| 
 | 
 | ||||||
|                     part.SitTargetAvatar = UUID; |                     part.SitTargetAvatar = UUID; | ||||||
|                     offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); |                     offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); | ||||||
|  | @ -1913,9 +1913,9 @@ namespace OpenSim.Region.Framework.Scenes | ||||||
|             { |             { | ||||||
|                 if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) |                 if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) | ||||||
|                 { |                 { | ||||||
|                     m_log.DebugFormat( | //                    m_log.DebugFormat( | ||||||
|                         "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is unset and within 10m", | //                        "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is unset and within 10m", | ||||||
|                         Name, part.Name, part.LocalId); | //                        Name, part.Name, part.LocalId); | ||||||
| 
 | 
 | ||||||
|                     AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight); |                     AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight); | ||||||
|                     canSit = true; |                     canSit = true; | ||||||
|  |  | ||||||
|  | @ -4169,6 +4169,100 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | ||||||
|             ScriptSleep(5000); |             ScriptSleep(5000); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         public void llTeleportAgent(string agent, string destination, LSL_Vector pos, LSL_Vector lookAt) | ||||||
|  |         { | ||||||
|  |             m_host.AddScriptLPS(1); | ||||||
|  |             UUID agentId = new UUID(); | ||||||
|  | 
 | ||||||
|  |             Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); | ||||||
|  |             Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z); | ||||||
|  | 
 | ||||||
|  |             if (UUID.TryParse(agent, out agentId)) | ||||||
|  |             { | ||||||
|  |                 ScenePresence presence = World.GetScenePresence(agentId); | ||||||
|  |                 if (presence != null && presence.PresenceType != PresenceType.Npc) | ||||||
|  |                 { | ||||||
|  |                     // agent must not be a god | ||||||
|  |                     if (presence.GodLevel >= 200) return; | ||||||
|  | 
 | ||||||
|  |                     if (destination == String.Empty) | ||||||
|  |                         destination = World.RegionInfo.RegionName; | ||||||
|  | 
 | ||||||
|  |                     // agent must be over the owners land | ||||||
|  |                     if (m_host.OwnerID == World.LandChannel.GetLandObject( | ||||||
|  |                             presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | ||||||
|  |                     { | ||||||
|  |                         DoLLTeleport(presence, destination, targetPos, targetLookAt); | ||||||
|  |                     } | ||||||
|  |                     else // or must be wearing the prim | ||||||
|  |                     { | ||||||
|  |                         if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID) | ||||||
|  |                         { | ||||||
|  |                             DoLLTeleport(presence, destination, targetPos, targetLookAt); | ||||||
|  |                         } | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector pos, LSL_Vector lookAt) | ||||||
|  |         { | ||||||
|  |             m_host.AddScriptLPS(1); | ||||||
|  |             UUID agentId = new UUID(); | ||||||
|  | 
 | ||||||
|  |             ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y); | ||||||
|  | 
 | ||||||
|  |             Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); | ||||||
|  |             Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z); | ||||||
|  |             if (UUID.TryParse(agent, out agentId)) | ||||||
|  |             { | ||||||
|  |                 ScenePresence presence = World.GetScenePresence(agentId); | ||||||
|  |                 if (presence != null && presence.PresenceType != PresenceType.Npc) | ||||||
|  |                 { | ||||||
|  |                     // agent must not be a god | ||||||
|  |                     if (presence.GodLevel >= 200) return; | ||||||
|  | 
 | ||||||
|  |                     // agent must be over the owners land | ||||||
|  |                     if (m_host.OwnerID == World.LandChannel.GetLandObject( | ||||||
|  |                             presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | ||||||
|  |                     { | ||||||
|  |                         World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); | ||||||
|  |                     } | ||||||
|  |                     else // or must be wearing the prim | ||||||
|  |                     { | ||||||
|  |                         if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID) | ||||||
|  |                         { | ||||||
|  |                             World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); | ||||||
|  |                         } | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         private void DoLLTeleport(ScenePresence sp, string destination, Vector3 targetPos, Vector3 targetLookAt) | ||||||
|  |         { | ||||||
|  |             UUID assetID = KeyOrName(destination); | ||||||
|  | 
 | ||||||
|  |             // The destinaion is not an asset ID and also doesn't name a landmark. | ||||||
|  |             // Use it as a sim name | ||||||
|  |             if (assetID == UUID.Zero) | ||||||
|  |             { | ||||||
|  |                 World.RequestTeleportLocation(sp.ControllingClient, destination, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             AssetBase lma = World.AssetService.Get(assetID.ToString()); | ||||||
|  |             if (lma == null) | ||||||
|  |                 return; | ||||||
|  | 
 | ||||||
|  |             if (lma.Type != (sbyte)AssetType.Landmark) | ||||||
|  |                 return; | ||||||
|  | 
 | ||||||
|  |             AssetLandmark lm = new AssetLandmark(lma); | ||||||
|  | 
 | ||||||
|  |             World.RequestTeleportLocation(sp.ControllingClient, lm.RegionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         public void llTextBox(string agent, string message, int chatChannel) |         public void llTextBox(string agent, string message, int chatChannel) | ||||||
|         { |         { | ||||||
|             IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); |             IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); | ||||||
|  |  | ||||||
|  | @ -403,6 +403,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | ||||||
|               void llTargetOmega(LSL_Vector axis, double spinrate, double gain); |               void llTargetOmega(LSL_Vector axis, double spinrate, double gain); | ||||||
|               void llTargetRemove(int number); |               void llTargetRemove(int number); | ||||||
|               void llTeleportAgentHome(string agent); |               void llTeleportAgentHome(string agent); | ||||||
|  |               void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt); | ||||||
|  |               void llTeleportAgentGlobalCoords(string agent, LSL_Vector global, LSL_Vector pos, LSL_Vector lookAt); | ||||||
|               void llTextBox(string avatar, string message, int chat_channel); |               void llTextBox(string avatar, string message, int chat_channel); | ||||||
|         LSL_String llToLower(string source); |         LSL_String llToLower(string source); | ||||||
|         LSL_String llToUpper(string source); |         LSL_String llToUpper(string source); | ||||||
|  |  | ||||||
|  | @ -1833,6 +1833,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | ||||||
|             m_LSL_Functions.llTargetRemove(number); |             m_LSL_Functions.llTargetRemove(number); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         public void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt) | ||||||
|  |         { | ||||||
|  |             m_LSL_Functions.llTeleportAgent(agent, simname, pos, lookAt); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global, LSL_Vector pos, LSL_Vector lookAt) | ||||||
|  |         { | ||||||
|  |             m_LSL_Functions.llTeleportAgentGlobalCoords(agent, global, pos, lookAt); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         public void llTeleportAgentHome(string agent) |         public void llTeleportAgentHome(string agent) | ||||||
|         { |         { | ||||||
|             m_LSL_Functions.llTeleportAgentHome(agent); |             m_LSL_Functions.llTeleportAgentHome(agent); | ||||||
|  |  | ||||||
|  | @ -79,27 +79,13 @@ namespace OpenSim.Services.Connectors.SimianGrid | ||||||
| 
 | 
 | ||||||
|         public void OnConnectionClose(IClientAPI client) |         public void OnConnectionClose(IClientAPI client) | ||||||
|         { |         { | ||||||
|             if (client.IsLoggingOut) |             if (client.SceneAgent.IsChildAgent) | ||||||
|             { |                 return; | ||||||
|                 object sp = null; |  | ||||||
|                 Vector3 position = new Vector3(128, 128, 0); |  | ||||||
|                 Vector3 lookat = new Vector3(0, 1, 0); |  | ||||||
| 
 | 
 | ||||||
|                 if (client.Scene.TryGetScenePresence(client.AgentId, out sp)) | //            m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); | ||||||
|                 { |             m_GridUserService.LoggedOut( | ||||||
|                     if (sp is ScenePresence) |                 client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, | ||||||
|                     { |                 client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat); | ||||||
|                         if (((ScenePresence)sp).IsChildAgent) |  | ||||||
|                             return; |  | ||||||
| 
 |  | ||||||
|                         position = ((ScenePresence)sp).AbsolutePosition; |  | ||||||
|                         lookat = ((ScenePresence)sp).Lookat; |  | ||||||
|                     } |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
| //                m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); |  | ||||||
|                 m_GridUserService.LoggedOut(client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, position, lookat); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID) |         void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID) | ||||||
|  | @ -111,4 +97,4 @@ namespace OpenSim.Services.Connectors.SimianGrid | ||||||
|             }); |             }); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -1153,6 +1153,8 @@ | ||||||
|     ; currently unused |     ; currently unused | ||||||
|     ; AllowosConsoleCommand=false |     ; AllowosConsoleCommand=false | ||||||
| 
 | 
 | ||||||
|  |     ; Are god functions such as llSetObjectPermMask() allowed?  If true then gods and only gods have access to these functions. | ||||||
|  |     ; If false then gods cannot execute these functions either. | ||||||
|     AllowGodFunctions = false |     AllowGodFunctions = false | ||||||
| 
 | 
 | ||||||
|     ; Maximum number of llListen events we allow over the entire region. |     ; Maximum number of llListen events we allow over the entire region. | ||||||
|  |  | ||||||
|  | @ -185,7 +185,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 | ||||||
|     ;; This switch creates the minimum set of body parts and avatar entries for a viewer 2  |     ;; This switch creates the minimum set of body parts and avatar entries for a viewer 2  | ||||||
|     ;; to show a default "Ruth" avatar rather than a cloud for a newly created user. |     ;; to show a default "Ruth" avatar rather than a cloud for a newly created user. | ||||||
|     ;; Default is false |     ;; Default is false | ||||||
|     ; CreateDefaultAvatarEntries = false |     CreateDefaultAvatarEntries = true | ||||||
| 
 | 
 | ||||||
|     ;; Allow the service to process HTTP createuser calls. |     ;; Allow the service to process HTTP createuser calls. | ||||||
|     ;; Default is false. |     ;; Default is false. | ||||||
|  |  | ||||||
|  | @ -166,7 +166,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 | ||||||
|     ;; This switch creates the minimum set of body parts and avatar entries for a viewer 2  |     ;; This switch creates the minimum set of body parts and avatar entries for a viewer 2  | ||||||
|     ;; to show a default "Ruth" avatar rather than a cloud for a newly created user. |     ;; to show a default "Ruth" avatar rather than a cloud for a newly created user. | ||||||
|     ;; Default is false |     ;; Default is false | ||||||
|     ; CreateDefaultAvatarEntries = false |     CreateDefaultAvatarEntries = true | ||||||
| 
 | 
 | ||||||
|     ;; Allow the service to process HTTP createuser calls. |     ;; Allow the service to process HTTP createuser calls. | ||||||
|     ;; Default is false. |     ;; Default is false. | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 BlueWall
						BlueWall