aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs163
1 files changed, 51 insertions, 112 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 3d8c714..bfe8d2c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -65,6 +65,7 @@ namespace OpenSim.Region.Framework.Scenes
65 #region Fields 65 #region Fields
66 66
67 public bool EmergencyMonitoring = false; 67 public bool EmergencyMonitoring = false;
68 public bool DEBUG = false;
68 69
69 public SynchronizeSceneHandler SynchronizeScene; 70 public SynchronizeSceneHandler SynchronizeScene;
70 public SimStatsReporter StatsReporter; 71 public SimStatsReporter StatsReporter;
@@ -599,23 +600,6 @@ namespace OpenSim.Region.Framework.Scenes
599 "reload estate", 600 "reload estate",
600 "Reload the estate data", HandleReloadEstate); 601 "Reload the estate data", HandleReloadEstate);
601 602
602 MainConsole.Instance.Commands.AddCommand("region", false, "delete object owner",
603 "delete object owner <UUID>",
604 "Delete object by owner", HandleDeleteObject);
605 MainConsole.Instance.Commands.AddCommand("region", false, "delete object creator",
606 "delete object creator <UUID>",
607 "Delete object by creator", HandleDeleteObject);
608 MainConsole.Instance.Commands.AddCommand("region", false, "delete object uuid",
609 "delete object uuid <UUID>",
610 "Delete object by uuid", HandleDeleteObject);
611 MainConsole.Instance.Commands.AddCommand("region", false, "delete object name",
612 "delete object name <name>",
613 "Delete object by name", HandleDeleteObject);
614
615 MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside",
616 "delete object outside",
617 "Delete all objects outside boundaries", HandleDeleteObject);
618
619 //Bind Storage Manager functions to some land manager functions for this scene 603 //Bind Storage Manager functions to some land manager functions for this scene
620 EventManager.OnLandObjectAdded += 604 EventManager.OnLandObjectAdded +=
621 new EventManager.LandObjectAdded(simDataService.StoreLandObject); 605 new EventManager.LandObjectAdded(simDataService.StoreLandObject);
@@ -1942,6 +1926,7 @@ namespace OpenSim.Region.Framework.Scenes
1942 /// If true, the object is made persistent into the scene. 1926 /// If true, the object is made persistent into the scene.
1943 /// If false, the object will not persist over server restarts 1927 /// If false, the object will not persist over server restarts
1944 /// </param> 1928 /// </param>
1929 /// <returns>true if the object was added. false if not</returns>
1945 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) 1930 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
1946 { 1931 {
1947 return AddNewSceneObject(sceneObject, attachToBackup, true); 1932 return AddNewSceneObject(sceneObject, attachToBackup, true);
@@ -1959,6 +1944,7 @@ namespace OpenSim.Region.Framework.Scenes
1959 /// If true, updates for the new scene object are sent to all viewers in range. 1944 /// If true, updates for the new scene object are sent to all viewers in range.
1960 /// If false, it is left to the caller to schedule the update 1945 /// If false, it is left to the caller to schedule the update
1961 /// </param> 1946 /// </param>
1947 /// <returns>true if the object was added. false if not</returns>
1962 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) 1948 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
1963 { 1949 {
1964 if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) 1950 if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates))
@@ -2528,7 +2514,7 @@ namespace OpenSim.Region.Framework.Scenes
2528 sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); 2514 sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
2529 m_eventManager.TriggerOnNewPresence(sp); 2515 m_eventManager.TriggerOnNewPresence(sp);
2530 2516
2531 sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags; 2517 sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags;
2532 2518
2533 // The first agent upon login is a root agent by design. 2519 // The first agent upon login is a root agent by design.
2534 // For this agent we will have to rez the attachments. 2520 // For this agent we will have to rez the attachments.
@@ -3070,11 +3056,11 @@ namespace OpenSim.Region.Framework.Scenes
3070 public override void RemoveClient(UUID agentID, bool closeChildAgents) 3056 public override void RemoveClient(UUID agentID, bool closeChildAgents)
3071 { 3057 {
3072 CheckHeartbeat(); 3058 CheckHeartbeat();
3073 bool childagentYN = false; 3059 bool isChildAgent = false;
3074 ScenePresence avatar = GetScenePresence(agentID); 3060 ScenePresence avatar = GetScenePresence(agentID);
3075 if (avatar != null) 3061 if (avatar != null)
3076 { 3062 {
3077 childagentYN = avatar.IsChildAgent; 3063 isChildAgent = avatar.IsChildAgent;
3078 3064
3079 if (avatar.ParentID != 0) 3065 if (avatar.ParentID != 0)
3080 { 3066 {
@@ -3085,9 +3071,9 @@ namespace OpenSim.Region.Framework.Scenes
3085 { 3071 {
3086 m_log.DebugFormat( 3072 m_log.DebugFormat(
3087 "[SCENE]: Removing {0} agent {1} from region {2}", 3073 "[SCENE]: Removing {0} agent {1} from region {2}",
3088 (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); 3074 (isChildAgent ? "child" : "root"), agentID, RegionInfo.RegionName);
3089 3075
3090 m_sceneGraph.removeUserCount(!childagentYN); 3076 m_sceneGraph.removeUserCount(!isChildAgent);
3091 3077
3092 // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop 3078 // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop
3093 // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI 3079 // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI
@@ -3117,8 +3103,18 @@ namespace OpenSim.Region.Framework.Scenes
3117 { 3103 {
3118 m_eventManager.TriggerOnRemovePresence(agentID); 3104 m_eventManager.TriggerOnRemovePresence(agentID);
3119 3105
3120 if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc) 3106 if (AttachmentsModule != null && !isChildAgent && avatar.PresenceType != PresenceType.Npc)
3121 AttachmentsModule.SaveChangedAttachments(avatar); 3107 {
3108 IUserManagement uMan = RequestModuleInterface<IUserManagement>();
3109 // Don't save attachments for HG visitors, it
3110 // messes up their inventory. When a HG visitor logs
3111 // out on a foreign grid, their attachments will be
3112 // reloaded in the state they were in when they left
3113 // the home grid. This is best anyway as the visited
3114 // grid may use an incompatible script engine.
3115 if (uMan == null || uMan.IsLocalGridUser(avatar.UUID))
3116 AttachmentsModule.SaveChangedAttachments(avatar, false);
3117 }
3122 3118
3123 ForEachClient( 3119 ForEachClient(
3124 delegate(IClientAPI client) 3120 delegate(IClientAPI client)
@@ -3333,7 +3329,7 @@ namespace OpenSim.Region.Framework.Scenes
3333 { 3329 {
3334 // Let the SP know how we got here. This has a lot of interesting 3330 // Let the SP know how we got here. This has a lot of interesting
3335 // uses down the line. 3331 // uses down the line.
3336 sp.TeleportFlags = (TeleportFlags)teleportFlags; 3332 sp.TeleportFlags = (TPFlags)teleportFlags;
3337 3333
3338 if (sp.IsChildAgent) 3334 if (sp.IsChildAgent)
3339 { 3335 {
@@ -4867,93 +4863,6 @@ namespace OpenSim.Region.Framework.Scenes
4867 } 4863 }
4868 } 4864 }
4869 4865
4870 private void HandleDeleteObject(string module, string[] cmd)
4871 {
4872 if (cmd.Length < 3)
4873 return;
4874
4875 string mode = cmd[2];
4876 string o = "";
4877
4878 if (mode != "outside")
4879 {
4880 if (cmd.Length < 4)
4881 return;
4882
4883 o = cmd[3];
4884 }
4885
4886 List<SceneObjectGroup> deletes = new List<SceneObjectGroup>();
4887
4888 UUID match;
4889
4890 switch (mode)
4891 {
4892 case "owner":
4893 if (!UUID.TryParse(o, out match))
4894 return;
4895 ForEachSOG(delegate (SceneObjectGroup g)
4896 {
4897 if (g.OwnerID == match && !g.IsAttachment)
4898 deletes.Add(g);
4899 });
4900 break;
4901 case "creator":
4902 if (!UUID.TryParse(o, out match))
4903 return;
4904 ForEachSOG(delegate (SceneObjectGroup g)
4905 {
4906 if (g.RootPart.CreatorID == match && !g.IsAttachment)
4907 deletes.Add(g);
4908 });
4909 break;
4910 case "uuid":
4911 if (!UUID.TryParse(o, out match))
4912 return;
4913 ForEachSOG(delegate (SceneObjectGroup g)
4914 {
4915 if (g.UUID == match && !g.IsAttachment)
4916 deletes.Add(g);
4917 });
4918 break;
4919 case "name":
4920 ForEachSOG(delegate (SceneObjectGroup g)
4921 {
4922 if (g.RootPart.Name == o && !g.IsAttachment)
4923 deletes.Add(g);
4924 });
4925 break;
4926 case "outside":
4927 ForEachSOG(delegate (SceneObjectGroup g)
4928 {
4929 SceneObjectPart rootPart = g.RootPart;
4930 bool delete = false;
4931
4932 if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0)
4933 {
4934 delete = true;
4935 }
4936 else
4937 {
4938 ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y);
4939
4940 if (parcel == null || parcel.LandData.Name == "NO LAND")
4941 delete = true;
4942 }
4943
4944 if (delete && !g.IsAttachment && !deletes.Contains(g))
4945 deletes.Add(g);
4946 });
4947 break;
4948 }
4949
4950 foreach (SceneObjectGroup g in deletes)
4951 {
4952 m_log.InfoFormat("[SCENE]: Deleting object {0}", g.UUID);
4953 DeleteSceneObject(g, false);
4954 }
4955 }
4956
4957 private void HandleReloadEstate(string module, string[] cmd) 4866 private void HandleReloadEstate(string module, string[] cmd)
4958 { 4867 {
4959 if (MainConsole.Instance.ConsoleScene == null || 4868 if (MainConsole.Instance.ConsoleScene == null ||
@@ -5076,6 +4985,36 @@ namespace OpenSim.Region.Framework.Scenes
5076 } 4985 }
5077 } 4986 }
5078 4987
4988 if (position == Vector3.Zero) // Teleport
4989 {
4990 if (!RegionInfo.EstateSettings.AllowDirectTeleport)
4991 {
4992 SceneObjectGroup telehub;
4993 if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject)) != null)
4994 {
4995 List<SpawnPoint> spawnPoints = RegionInfo.RegionSettings.SpawnPoints();
4996 bool banned = true;
4997 foreach (SpawnPoint sp in spawnPoints)
4998 {
4999 Vector3 spawnPoint = sp.GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
5000 ILandObject land = LandChannel.GetLandObject(spawnPoint.X, spawnPoint.Y);
5001 if (land == null)
5002 continue;
5003 if (land.IsEitherBannedOrRestricted(agentID))
5004 continue;
5005 banned = false;
5006 break;
5007 }
5008
5009 if (banned)
5010 {
5011 reason = "No suitable landing point found";
5012 return false;
5013 }
5014 }
5015 }
5016 }
5017
5079 reason = String.Empty; 5018 reason = String.Empty;
5080 return true; 5019 return true;
5081 } 5020 }