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.cs189
1 files changed, 118 insertions, 71 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index a9a4cda..3e11db3 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -103,6 +103,7 @@ namespace OpenSim.Region.Framework.Scenes
103 public bool m_trustBinaries; 103 public bool m_trustBinaries;
104 public bool m_allowScriptCrossings; 104 public bool m_allowScriptCrossings;
105 public bool m_useFlySlow; 105 public bool m_useFlySlow;
106 public bool m_useTrashOnDelete = true;
106 107
107 /// <summary> 108 /// <summary>
108 /// Temporarily setting to trigger appearance resends at 60 second intervals. 109 /// Temporarily setting to trigger appearance resends at 60 second intervals.
@@ -458,6 +459,7 @@ namespace OpenSim.Region.Framework.Scenes
458 { 459 {
459 if (m_simulationService == null) 460 if (m_simulationService == null)
460 m_simulationService = RequestModuleInterface<ISimulationService>(); 461 m_simulationService = RequestModuleInterface<ISimulationService>();
462
461 return m_simulationService; 463 return m_simulationService;
462 } 464 }
463 } 465 }
@@ -589,6 +591,15 @@ namespace OpenSim.Region.Framework.Scenes
589 get { return m_sceneGraph.Entities; } 591 get { return m_sceneGraph.Entities; }
590 } 592 }
591 593
594 // can be closest/random/sequence
595 private string m_SpawnPointRouting = "closest";
596 // used in sequence see: SpawnPoint()
597 private int m_SpawnPoint;
598 public string SpawnPointRouting
599 {
600 get { return m_SpawnPointRouting; }
601 }
602
592 #endregion Properties 603 #endregion Properties
593 604
594 #region Constructors 605 #region Constructors
@@ -606,7 +617,7 @@ namespace OpenSim.Region.Framework.Scenes
606 617
607 Random random = new Random(); 618 Random random = new Random();
608 619
609 m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4); 620 m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4);
610 m_moduleLoader = moduleLoader; 621 m_moduleLoader = moduleLoader;
611 m_authenticateHandler = authen; 622 m_authenticateHandler = authen;
612 m_sceneGridService = sceneGridService; 623 m_sceneGridService = sceneGridService;
@@ -726,6 +737,8 @@ namespace OpenSim.Region.Framework.Scenes
726 m_maxPhys = RegionInfo.PhysPrimMax; 737 m_maxPhys = RegionInfo.PhysPrimMax;
727 } 738 }
728 739
740 m_SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
741
729 // Here, if clamping is requested in either global or 742 // Here, if clamping is requested in either global or
730 // local config, it will be used 743 // local config, it will be used
731 // 744 //
@@ -735,6 +748,7 @@ namespace OpenSim.Region.Framework.Scenes
735 m_clampPrimSize = true; 748 m_clampPrimSize = true;
736 } 749 }
737 750
751 m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete);
738 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); 752 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
739 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); 753 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
740 m_dontPersistBefore = 754 m_dontPersistBefore =
@@ -833,13 +847,11 @@ namespace OpenSim.Region.Framework.Scenes
833 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; 847 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
834 } 848 }
835 849
836 /// <summary>
837 /// Mock constructor for scene group persistency unit tests.
838 /// SceneObjectGroup RegionId property is delegated to Scene.
839 /// </summary>
840 /// <param name="regInfo"></param>
841 public Scene(RegionInfo regInfo) 850 public Scene(RegionInfo regInfo)
842 { 851 {
852 PhysicalPrims = true;
853 CollidablePrims = true;
854
843 BordersLocked = true; 855 BordersLocked = true;
844 Border northBorder = new Border(); 856 Border northBorder = new Border();
845 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<--- 857 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<---
@@ -866,8 +878,6 @@ namespace OpenSim.Region.Framework.Scenes
866 m_eventManager = new EventManager(); 878 m_eventManager = new EventManager();
867 879
868 m_permissions = new ScenePermissions(this); 880 m_permissions = new ScenePermissions(this);
869
870// m_lastUpdate = Util.EnvironmentTickCount();
871 } 881 }
872 882
873 #endregion 883 #endregion
@@ -1404,6 +1414,14 @@ namespace OpenSim.Region.Framework.Scenes
1404 1414
1405 try 1415 try
1406 { 1416 {
1417 // Apply taints in terrain module to terrain in physics scene
1418 if (Frame % m_update_terrain == 0)
1419 {
1420 terMS = Util.EnvironmentTickCount();
1421 UpdateTerrain();
1422 terrainMS = Util.EnvironmentTickCountSubtract(terMS);
1423 }
1424
1407 tmpPhysicsMS2 = Util.EnvironmentTickCount(); 1425 tmpPhysicsMS2 = Util.EnvironmentTickCount();
1408 if ((Frame % m_update_physics == 0) && m_physics_enabled) 1426 if ((Frame % m_update_physics == 0) && m_physics_enabled)
1409 m_sceneGraph.UpdatePreparePhysics(); 1427 m_sceneGraph.UpdatePreparePhysics();
@@ -1468,13 +1486,6 @@ namespace OpenSim.Region.Framework.Scenes
1468 backupMS = Util.EnvironmentTickCountSubtract(backMS); 1486 backupMS = Util.EnvironmentTickCountSubtract(backMS);
1469 } 1487 }
1470 1488
1471 if (Frame % m_update_terrain == 0)
1472 {
1473 terMS = Util.EnvironmentTickCount();
1474 UpdateTerrain();
1475 terrainMS = Util.EnvironmentTickCountSubtract(terMS);
1476 }
1477
1478 //if (Frame % m_update_land == 0) 1489 //if (Frame % m_update_land == 0)
1479 //{ 1490 //{
1480 // int ldMS = Util.EnvironmentTickCount(); 1491 // int ldMS = Util.EnvironmentTickCount();
@@ -2684,10 +2695,10 @@ namespace OpenSim.Region.Framework.Scenes
2684 { 2695 {
2685 SceneObjectGroup grp = sceneObject; 2696 SceneObjectGroup grp = sceneObject;
2686 2697
2687 m_log.DebugFormat( 2698// m_log.DebugFormat(
2688 "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); 2699// "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID);
2689 m_log.DebugFormat( 2700// m_log.DebugFormat(
2690 "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); 2701// "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
2691 2702
2692 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2703 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2693 2704
@@ -3382,8 +3393,8 @@ namespace OpenSim.Region.Framework.Scenes
3382 try 3393 try
3383 { 3394 {
3384 m_log.DebugFormat( 3395 m_log.DebugFormat(
3385 "[SCENE]: Removing {0} agent {1} from region {2}", 3396 "[SCENE]: Removing {0} agent {1} {2} from region {3}",
3386 (isChildAgent ? "child" : "root"), agentID, RegionInfo.RegionName); 3397 (isChildAgent ? "child" : "root"), avatar.Name, agentID, RegionInfo.RegionName);
3387 3398
3388 m_sceneGraph.removeUserCount(!isChildAgent); 3399 m_sceneGraph.removeUserCount(!isChildAgent);
3389 3400
@@ -3554,7 +3565,7 @@ namespace OpenSim.Region.Framework.Scenes
3554 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup) 3565 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup)
3555 { 3566 {
3556 bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || 3567 bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 ||
3557 (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); 3568 (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0);
3558 bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0); 3569 bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0);
3559 bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0); 3570 bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0);
3560 3571
@@ -3570,8 +3581,17 @@ namespace OpenSim.Region.Framework.Scenes
3570 // Don't disable this log message - it's too helpful 3581 // Don't disable this log message - it's too helpful
3571 m_log.DebugFormat( 3582 m_log.DebugFormat(
3572 "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})", 3583 "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})",
3573 RegionInfo.RegionName, (agent.child ? "child" : "root"),agent.firstname, agent.lastname, 3584 RegionInfo.RegionName,
3574 agent.AgentID, agent.circuitcode, agent.IPAddress, agent.Viewer, ((TPFlags)teleportFlags).ToString(), agent.startpos); 3585 (agent.child ? "child" : "root"),
3586 agent.firstname,
3587 agent.lastname,
3588 agent.AgentID,
3589 agent.circuitcode,
3590 agent.IPAddress,
3591 agent.Viewer,
3592 ((TPFlags)teleportFlags).ToString(),
3593 agent.startpos
3594 );
3575 3595
3576 if (LoginsDisabled) 3596 if (LoginsDisabled)
3577 { 3597 {
@@ -3586,7 +3606,11 @@ namespace OpenSim.Region.Framework.Scenes
3586 // We have a zombie from a crashed session. 3606 // We have a zombie from a crashed session.
3587 // Or the same user is trying to be root twice here, won't work. 3607 // Or the same user is trying to be root twice here, won't work.
3588 // Kill it. 3608 // Kill it.
3589 m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName); 3609 m_log.DebugFormat(
3610 "[SCENE]: Zombie scene presence detected for {0} in {1}",
3611 agent.AgentID,
3612 RegionInfo.RegionName
3613 );
3590 sp.ControllingClient.Close(); 3614 sp.ControllingClient.Close();
3591 sp = null; 3615 sp = null;
3592 } 3616 }
@@ -3613,8 +3637,7 @@ namespace OpenSim.Region.Framework.Scenes
3613 { 3637 {
3614 if (!VerifyUserPresence(agent, out reason)) 3638 if (!VerifyUserPresence(agent, out reason))
3615 return false; 3639 return false;
3616 } 3640 } catch (Exception e)
3617 catch (Exception e)
3618 { 3641 {
3619 m_log.ErrorFormat( 3642 m_log.ErrorFormat(
3620 "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); 3643 "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace);
@@ -3649,8 +3672,7 @@ namespace OpenSim.Region.Framework.Scenes
3649 CapsModule.SetAgentCapsSeeds(agent); 3672 CapsModule.SetAgentCapsSeeds(agent);
3650 CapsModule.CreateCaps(agent.AgentID); 3673 CapsModule.CreateCaps(agent.AgentID);
3651 } 3674 }
3652 } 3675 } else
3653 else
3654 { 3676 {
3655 // Let the SP know how we got here. This has a lot of interesting 3677 // Let the SP know how we got here. This has a lot of interesting
3656 // uses down the line. 3678 // uses down the line.
@@ -3673,7 +3695,7 @@ namespace OpenSim.Region.Framework.Scenes
3673 agent.teleportFlags = teleportFlags; 3695 agent.teleportFlags = teleportFlags;
3674 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 3696 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
3675 3697
3676 if (vialogin) 3698 if (vialogin)
3677 { 3699 {
3678// CleanDroppedAttachments(); 3700// CleanDroppedAttachments();
3679 3701
@@ -3714,8 +3736,7 @@ namespace OpenSim.Region.Framework.Scenes
3714 agent.startpos.Z = 720; 3736 agent.startpos.Z = 720;
3715 } 3737 }
3716 } 3738 }
3717 } 3739 } else
3718 else
3719 { 3740 {
3720 if (agent.startpos.X > EastBorders[0].BorderLine.Z) 3741 if (agent.startpos.X > EastBorders[0].BorderLine.Z)
3721 { 3742 {
@@ -3741,10 +3762,19 @@ namespace OpenSim.Region.Framework.Scenes
3741 SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); 3762 SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject);
3742 // Can have multiple SpawnPoints 3763 // Can have multiple SpawnPoints
3743 List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints(); 3764 List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints();
3744 if ( spawnpoints.Count > 1) 3765 if (spawnpoints.Count > 1)
3745 { 3766 {
3746 // We have multiple SpawnPoints, Route the agent to a random one 3767 // We have multiple SpawnPoints, Route the agent to a random or sequential one
3747 agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count)].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); 3768 if (SpawnPointRouting == "random")
3769 agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation(
3770 telehub.AbsolutePosition,
3771 telehub.GroupRotation
3772 );
3773 else
3774 agent.startpos = spawnpoints[SpawnPoint()].GetLocation(
3775 telehub.AbsolutePosition,
3776 telehub.GroupRotation
3777 );
3748 } 3778 }
3749 else 3779 else
3750 { 3780 {
@@ -3981,41 +4011,41 @@ namespace OpenSim.Region.Framework.Scenes
3981 return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc); 4011 return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc);
3982 } 4012 }
3983 4013
3984 /// <summary> 4014// /// <summary>
3985 /// The Grid has requested that we log-off a user. Log them off. 4015// /// The Grid has requested that we log-off a user. Log them off.
3986 /// </summary> 4016// /// </summary>
3987 /// <param name="AvatarID">Unique ID of the avatar to log-off</param> 4017// /// <param name="AvatarID">Unique ID of the avatar to log-off</param>
3988 /// <param name="RegionSecret">SecureSessionID of the user, or the RegionSecret text when logging on to the grid</param> 4018// /// <param name="RegionSecret">SecureSessionID of the user, or the RegionSecret text when logging on to the grid</param>
3989 /// <param name="message">message to display to the user. Reason for being logged off</param> 4019// /// <param name="message">message to display to the user. Reason for being logged off</param>
3990 public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) 4020// public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message)
3991 { 4021// {
3992 ScenePresence loggingOffUser = GetScenePresence(AvatarID); 4022// ScenePresence loggingOffUser = GetScenePresence(AvatarID);
3993 if (loggingOffUser != null) 4023// if (loggingOffUser != null)
3994 { 4024// {
3995 UUID localRegionSecret = UUID.Zero; 4025// UUID localRegionSecret = UUID.Zero;
3996 bool parsedsecret = UUID.TryParse(m_regInfo.regionSecret, out localRegionSecret); 4026// bool parsedsecret = UUID.TryParse(m_regInfo.regionSecret, out localRegionSecret);
3997 4027//
3998 // Region Secret is used here in case a new sessionid overwrites an old one on the user server. 4028// // Region Secret is used here in case a new sessionid overwrites an old one on the user server.
3999 // Will update the user server in a few revisions to use it. 4029// // Will update the user server in a few revisions to use it.
4000 4030//
4001 if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId || (parsedsecret && RegionSecret == localRegionSecret)) 4031// if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId || (parsedsecret && RegionSecret == localRegionSecret))
4002 { 4032// {
4003 m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, loggingOffUser.KnownRegionHandles); 4033// m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, loggingOffUser.KnownRegionHandles);
4004 loggingOffUser.ControllingClient.Kick(message); 4034// loggingOffUser.ControllingClient.Kick(message);
4005 // Give them a second to receive the message! 4035// // Give them a second to receive the message!
4006 Thread.Sleep(1000); 4036// Thread.Sleep(1000);
4007 loggingOffUser.ControllingClient.Close(); 4037// loggingOffUser.ControllingClient.Close();
4008 } 4038// }
4009 else 4039// else
4010 { 4040// {
4011 m_log.Info("[USERLOGOFF]: System sending the LogOff user message failed to sucessfully authenticate"); 4041// m_log.Info("[USERLOGOFF]: System sending the LogOff user message failed to sucessfully authenticate");
4012 } 4042// }
4013 } 4043// }
4014 else 4044// else
4015 { 4045// {
4016 m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString()); 4046// m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString());
4017 } 4047// }
4018 } 4048// }
4019 4049
4020 /// <summary> 4050 /// <summary>
4021 /// Triggered when an agent crosses into this sim. Also happens on initial login. 4051 /// Triggered when an agent crosses into this sim. Also happens on initial login.
@@ -4071,7 +4101,10 @@ namespace OpenSim.Region.Framework.Scenes
4071 ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); 4101 ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2);
4072 if (nearestParcel == null) 4102 if (nearestParcel == null)
4073 { 4103 {
4074 m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: no allowed parcel", cAgentData.AgentID); 4104 m_log.DebugFormat(
4105 "[SCENE]: Denying root agent entry to {0} in {1}: no allowed parcel",
4106 cAgentData.AgentID, RegionInfo.RegionName);
4107
4075 return false; 4108 return false;
4076 } 4109 }
4077 4110
@@ -5637,5 +5670,19 @@ Environment.Exit(1);
5637 } 5670 }
5638 } 5671 }
5639 } 5672 }
5673
5674 // manage and select spawn points in sequence
5675 public int SpawnPoint()
5676 {
5677 int spawnpoints = RegionInfo.RegionSettings.SpawnPoints().Count;
5678
5679 if (spawnpoints == 0)
5680 return 0;
5681
5682 m_SpawnPoint++;
5683 if (m_SpawnPoint > spawnpoints)
5684 m_SpawnPoint = 1;
5685 return m_SpawnPoint - 1;
5686 }
5640 } 5687 }
5641} 5688}