diff options
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9aa9bf5..13b4cbc 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -611,6 +611,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
611 | "delete object name <name>", | 611 | "delete object name <name>", |
612 | "Delete object by name", HandleDeleteObject); | 612 | "Delete object by name", HandleDeleteObject); |
613 | 613 | ||
614 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside", | ||
615 | "delete object outside", | ||
616 | "Delete all objects outside boundaries", HandleDeleteObject); | ||
617 | |||
614 | //Bind Storage Manager functions to some land manager functions for this scene | 618 | //Bind Storage Manager functions to some land manager functions for this scene |
615 | EventManager.OnLandObjectAdded += | 619 | EventManager.OnLandObjectAdded += |
616 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); | 620 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); |
@@ -4941,11 +4945,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
4941 | 4945 | ||
4942 | private void HandleDeleteObject(string module, string[] cmd) | 4946 | private void HandleDeleteObject(string module, string[] cmd) |
4943 | { | 4947 | { |
4944 | if (cmd.Length < 4) | 4948 | if (cmd.Length < 3) |
4945 | return; | 4949 | return; |
4946 | 4950 | ||
4947 | string mode = cmd[2]; | 4951 | string mode = cmd[2]; |
4948 | string o = cmd[3]; | 4952 | string o = ""; |
4953 | |||
4954 | if (mode != "outside") | ||
4955 | { | ||
4956 | if (cmd.Length < 4) | ||
4957 | return; | ||
4958 | |||
4959 | o = cmd[3]; | ||
4960 | } | ||
4949 | 4961 | ||
4950 | List<SceneObjectGroup> deletes = new List<SceneObjectGroup>(); | 4962 | List<SceneObjectGroup> deletes = new List<SceneObjectGroup>(); |
4951 | 4963 | ||
@@ -4987,10 +4999,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
4987 | deletes.Add(g); | 4999 | deletes.Add(g); |
4988 | }); | 5000 | }); |
4989 | break; | 5001 | break; |
5002 | case "outside": | ||
5003 | ForEachSOG(delegate (SceneObjectGroup g) | ||
5004 | { | ||
5005 | SceneObjectPart rootPart = g.RootPart; | ||
5006 | bool delete = false; | ||
5007 | |||
5008 | if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0) | ||
5009 | { | ||
5010 | delete = true; | ||
5011 | } else { | ||
5012 | ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y); | ||
5013 | |||
5014 | if (parcel == null || parcel.LandData.Name == "NO LAND") | ||
5015 | delete = true; | ||
5016 | } | ||
5017 | |||
5018 | if (delete && !rootPart.IsAttachment && !deletes.Contains(g)) | ||
5019 | deletes.Add(g); | ||
5020 | }); | ||
5021 | break; | ||
4990 | } | 5022 | } |
4991 | 5023 | ||
4992 | foreach (SceneObjectGroup g in deletes) | 5024 | foreach (SceneObjectGroup g in deletes) |
5025 | { | ||
5026 | m_log.InfoFormat("[SCENE]: Deleting object {0}", g.UUID); | ||
4993 | DeleteSceneObject(g, false); | 5027 | DeleteSceneObject(g, false); |
5028 | } | ||
4994 | } | 5029 | } |
4995 | 5030 | ||
4996 | private void HandleReloadEstate(string module, string[] cmd) | 5031 | private void HandleReloadEstate(string module, string[] cmd) |