aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs108
1 files changed, 54 insertions, 54 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2b58795..436a544 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -396,10 +396,12 @@ namespace OpenSim.Region.Framework.Scenes
396 if (value) 396 if (value)
397 { 397 {
398 if (!m_active) 398 if (!m_active)
399 Start(); 399 Start(false);
400 } 400 }
401 else 401 else
402 { 402 {
403 // This appears assymetric with Start() above but is not - setting m_active = false stops the loops
404 // XXX: Possibly this should be in an explicit Stop() method for symmetry.
403 m_active = false; 405 m_active = false;
404 } 406 }
405 } 407 }
@@ -1361,10 +1363,18 @@ namespace OpenSim.Region.Framework.Scenes
1361 } 1363 }
1362 } 1364 }
1363 1365
1366 public override void Start()
1367 {
1368 Start(true);
1369 }
1370
1364 /// <summary> 1371 /// <summary>
1365 /// Start the scene 1372 /// Start the scene
1366 /// </summary> 1373 /// </summary>
1367 public void Start() 1374 /// <param name='startScripts'>
1375 /// Start the scripts within the scene.
1376 /// </param>
1377 public void Start(bool startScripts)
1368 { 1378 {
1369 m_active = true; 1379 m_active = true;
1370 1380
@@ -1401,6 +1411,8 @@ namespace OpenSim.Region.Framework.Scenes
1401 m_heartbeatThread 1411 m_heartbeatThread
1402 = Watchdog.StartThread( 1412 = Watchdog.StartThread(
1403 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); 1413 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
1414
1415 StartScripts();
1404 } 1416 }
1405 1417
1406 /// <summary> 1418 /// <summary>
@@ -1557,6 +1569,8 @@ namespace OpenSim.Region.Framework.Scenes
1557 1569
1558 try 1570 try
1559 { 1571 {
1572 EventManager.TriggerRegionHeartbeatStart(this);
1573
1560 // Apply taints in terrain module to terrain in physics scene 1574 // Apply taints in terrain module to terrain in physics scene
1561 if (Frame % m_update_terrain == 0) 1575 if (Frame % m_update_terrain == 0)
1562 { 1576 {
@@ -3001,7 +3015,9 @@ namespace OpenSim.Region.Framework.Scenes
3001 // client is for a root or child agent. 3015 // client is for a root or child agent.
3002 client.SceneAgent = sp; 3016 client.SceneAgent = sp;
3003 3017
3004 // Cache the user's name 3018 // This is currently also being done earlier in NewUserConnection for real users to see if this
3019 // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other
3020 // places. However, we still need to do it here for NPCs.
3005 CacheUserName(sp, aCircuit); 3021 CacheUserName(sp, aCircuit);
3006 3022
3007 EventManager.TriggerOnNewClient(client); 3023 EventManager.TriggerOnNewClient(client);
@@ -3025,7 +3041,7 @@ namespace OpenSim.Region.Framework.Scenes
3025 { 3041 {
3026 string first = aCircuit.firstname, last = aCircuit.lastname; 3042 string first = aCircuit.firstname, last = aCircuit.lastname;
3027 3043
3028 if (sp.PresenceType == PresenceType.Npc) 3044 if (sp != null && sp.PresenceType == PresenceType.Npc)
3029 { 3045 {
3030 UserManagementModule.AddUser(aCircuit.AgentID, first, last); 3046 UserManagementModule.AddUser(aCircuit.AgentID, first, last);
3031 } 3047 }
@@ -3242,7 +3258,6 @@ namespace OpenSim.Region.Framework.Scenes
3242 { 3258 {
3243 //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; 3259 //client.OnNameFromUUIDRequest += HandleUUIDNameRequest;
3244 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; 3260 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
3245 client.OnSetStartLocationRequest += SetHomeRezPoint;
3246 client.OnRegionHandleRequest += RegionHandleRequest; 3261 client.OnRegionHandleRequest += RegionHandleRequest;
3247 } 3262 }
3248 3263
@@ -3369,7 +3384,6 @@ namespace OpenSim.Region.Framework.Scenes
3369 { 3384 {
3370 //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; 3385 //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest;
3371 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; 3386 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest;
3372 client.OnSetStartLocationRequest -= SetHomeRezPoint;
3373 client.OnRegionHandleRequest -= RegionHandleRequest; 3387 client.OnRegionHandleRequest -= RegionHandleRequest;
3374 } 3388 }
3375 3389
@@ -3496,33 +3510,6 @@ namespace OpenSim.Region.Framework.Scenes
3496 } 3510 }
3497 3511
3498 /// <summary> 3512 /// <summary>
3499 /// Sets the Home Point. The LoginService uses this to know where to put a user when they log-in
3500 /// </summary>
3501 /// <param name="remoteClient"></param>
3502 /// <param name="regionHandle"></param>
3503 /// <param name="position"></param>
3504 /// <param name="lookAt"></param>
3505 /// <param name="flags"></param>
3506 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
3507 {
3508 //Add half the avatar's height so that the user doesn't fall through prims
3509 ScenePresence presence;
3510 if (TryGetScenePresence(remoteClient.AgentId, out presence))
3511 {
3512 if (presence.Appearance != null)
3513 {
3514 position.Z = position.Z + (presence.Appearance.AvatarHeight / 2);
3515 }
3516 }
3517
3518 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
3519 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
3520 m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
3521 else
3522 m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed.");
3523 }
3524
3525 /// <summary>
3526 /// Get the avatar apperance for the given client. 3513 /// Get the avatar apperance for the given client.
3527 /// </summary> 3514 /// </summary>
3528 /// <param name="client"></param> 3515 /// <param name="client"></param>
@@ -3618,15 +3605,12 @@ namespace OpenSim.Region.Framework.Scenes
3618 if (closeChildAgents && CapsModule != null) 3605 if (closeChildAgents && CapsModule != null)
3619 CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode); 3606 CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode);
3620 3607
3621// // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
3622// // this method is doing is HORRIBLE!!!
3623 // Commented pending deletion since this method no longer appears to do anything at all
3624// avatar.Scene.NeedSceneCacheClear(avatar.UUID);
3625
3626 if (closeChildAgents && !isChildAgent) 3608 if (closeChildAgents && !isChildAgent)
3627 { 3609 {
3628 List<ulong> regions = avatar.KnownRegionHandles; 3610 List<ulong> regions = avatar.KnownRegionHandles;
3629 regions.Remove(RegionInfo.RegionHandle); 3611 regions.Remove(RegionInfo.RegionHandle);
3612
3613 // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours.
3630 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); 3614 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions);
3631 } 3615 }
3632 3616
@@ -3644,7 +3628,7 @@ namespace OpenSim.Region.Framework.Scenes
3644 delegate(IClientAPI client) 3628 delegate(IClientAPI client)
3645 { 3629 {
3646 //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway 3630 //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway
3647 try { client.SendKillObject(avatar.RegionHandle, new List<uint> { avatar.LocalId }); } 3631 try { client.SendKillObject(new List<uint> { avatar.LocalId }); }
3648 catch (NullReferenceException) { } 3632 catch (NullReferenceException) { }
3649 }); 3633 });
3650 } 3634 }
@@ -3725,7 +3709,8 @@ namespace OpenSim.Region.Framework.Scenes
3725 } 3709 }
3726 deleteIDs.Add(localID); 3710 deleteIDs.Add(localID);
3727 } 3711 }
3728 ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, deleteIDs); }); 3712
3713 ForEachClient(c => c.SendKillObject(deleteIDs));
3729 } 3714 }
3730 3715
3731 #endregion 3716 #endregion
@@ -3881,7 +3866,13 @@ namespace OpenSim.Region.Framework.Scenes
3881 3866
3882 lock (agent) 3867 lock (agent)
3883 { 3868 {
3884 //On login test land permisions 3869 // Optimistic: add or update the circuit data with the new agent circuit data and teleport flags.
3870 // We need the circuit data here for some of the subsequent checks. (groups, for example)
3871 // If the checks fail, we remove the circuit.
3872 agent.teleportFlags = teleportFlags;
3873 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
3874
3875 // On login test land permisions
3885 if (vialogin) 3876 if (vialogin)
3886 { 3877 {
3887 IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); 3878 IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>();
@@ -3890,6 +3881,7 @@ namespace OpenSim.Region.Framework.Scenes
3890 if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) 3881 if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y))
3891 { 3882 {
3892 m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); 3883 m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString());
3884 m_authenticateHandler.RemoveCircuit(agent.circuitcode);
3893 return false; 3885 return false;
3894 } 3886 }
3895 } 3887 }
@@ -3901,11 +3893,17 @@ namespace OpenSim.Region.Framework.Scenes
3901 try 3893 try
3902 { 3894 {
3903 if (!VerifyUserPresence(agent, out reason)) 3895 if (!VerifyUserPresence(agent, out reason))
3896 {
3897 m_authenticateHandler.RemoveCircuit(agent.circuitcode);
3904 return false; 3898 return false;
3905 } catch (Exception e) 3899 }
3900 }
3901 catch (Exception e)
3906 { 3902 {
3907 m_log.ErrorFormat( 3903 m_log.ErrorFormat(
3908 "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); 3904 "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace);
3905
3906 m_authenticateHandler.RemoveCircuit(agent.circuitcode);
3909 return false; 3907 return false;
3910 } 3908 }
3911 } 3909 }
@@ -3918,6 +3916,7 @@ namespace OpenSim.Region.Framework.Scenes
3918 { 3916 {
3919 if (!AuthorizeUser(agent, out reason)) 3917 if (!AuthorizeUser(agent, out reason))
3920 { 3918 {
3919 m_authenticateHandler.RemoveCircuit(agent.circuitcode);
3921 return false; 3920 return false;
3922 } 3921 }
3923 } 3922 }
@@ -3926,6 +3925,8 @@ namespace OpenSim.Region.Framework.Scenes
3926 { 3925 {
3927 m_log.ErrorFormat( 3926 m_log.ErrorFormat(
3928 "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); 3927 "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace);
3928
3929 m_authenticateHandler.RemoveCircuit(agent.circuitcode);
3929 return false; 3930 return false;
3930 } 3931 }
3931 3932
@@ -3953,11 +3954,12 @@ namespace OpenSim.Region.Framework.Scenes
3953 CapsModule.SetAgentCapsSeeds(agent); 3954 CapsModule.SetAgentCapsSeeds(agent);
3954 } 3955 }
3955 } 3956 }
3956 }
3957 3957
3958 // In all cases, add or update the circuit data with the new agent circuit data and teleport flags 3958 // Try caching an incoming user name much earlier on to see if this helps with an issue
3959 agent.teleportFlags = teleportFlags; 3959 // where HG users are occasionally seen by others as "Unknown User" because their UUIDName
3960 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 3960 // request for the HG avatar appears to trigger before the user name is cached.
3961 CacheUserName(null, agent);
3962 }
3961 3963
3962 if (CapsModule != null) 3964 if (CapsModule != null)
3963 { 3965 {
@@ -4365,8 +4367,6 @@ namespace OpenSim.Region.Framework.Scenes
4365 m_log.DebugFormat( 4367 m_log.DebugFormat(
4366 "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); 4368 "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName);
4367 4369
4368 // XPTO: if this agent is not allowed here as root, always return false
4369
4370 // We have to wait until the viewer contacts this region after receiving EAC. 4370 // We have to wait until the viewer contacts this region after receiving EAC.
4371 // That calls AddNewClient, which finally creates the ScenePresence 4371 // That calls AddNewClient, which finally creates the ScenePresence
4372 int flags = GetUserFlags(cAgentData.AgentID); 4372 int flags = GetUserFlags(cAgentData.AgentID);
@@ -5655,12 +5655,12 @@ Environment.Exit(1);
5655 List<SceneObjectGroup> objects, 5655 List<SceneObjectGroup> objects,
5656 out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) 5656 out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ)
5657 { 5657 {
5658 minX = 256; 5658 minX = float.MaxValue;
5659 maxX = -256; 5659 maxX = float.MinValue;
5660 minY = 256; 5660 minY = float.MaxValue;
5661 maxY = -256; 5661 maxY = float.MinValue;
5662 minZ = 8192; 5662 minZ = float.MaxValue;
5663 maxZ = -256; 5663 maxZ = float.MinValue;
5664 5664
5665 List<Vector3> offsets = new List<Vector3>(); 5665 List<Vector3> offsets = new List<Vector3>();
5666 5666