diff options
Diffstat (limited to 'OpenSim/Region')
3 files changed, 207 insertions, 106 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4f09d8f..d126f5f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -9316,9 +9316,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9316 | { | 9316 | { |
9317 | param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); | 9317 | param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); |
9318 | } | 9318 | } |
9319 | catch (Exception ex) | 9319 | catch |
9320 | { | 9320 | { |
9321 | |||
9322 | } | 9321 | } |
9323 | } | 9322 | } |
9324 | 9323 | ||
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs new file mode 100644 index 0000000..57c109e --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | |||
@@ -0,0 +1,206 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Text; | ||
32 | using log4net; | ||
33 | using Mono.Addins; | ||
34 | using Nini.Config; | ||
35 | using OpenMetaverse; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Console; | ||
38 | using OpenSim.Framework.Statistics; | ||
39 | using OpenSim.Region.Framework.Interfaces; | ||
40 | using OpenSim.Region.Framework.Scenes; | ||
41 | |||
42 | namespace OpenSim.Region.CoreModules.World.Objects.Commands | ||
43 | { | ||
44 | /// <summary> | ||
45 | /// A module that holds commands for manipulating objects in the scene. | ||
46 | /// </summary> | ||
47 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ObjectCommandsModule")] | ||
48 | public class ObjectCommandsModule : INonSharedRegionModule | ||
49 | { | ||
50 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
51 | |||
52 | private Scene m_scene; | ||
53 | |||
54 | public string Name { get { return "Object Commands Module"; } } | ||
55 | |||
56 | public Type ReplaceableInterface { get { return null; } } | ||
57 | |||
58 | public void Initialise(IConfigSource source) | ||
59 | { | ||
60 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: INITIALIZED MODULE"); | ||
61 | } | ||
62 | |||
63 | public void PostInitialise() | ||
64 | { | ||
65 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: POST INITIALIZED MODULE"); | ||
66 | } | ||
67 | |||
68 | public void Close() | ||
69 | { | ||
70 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: CLOSED MODULE"); | ||
71 | } | ||
72 | |||
73 | public void AddRegion(Scene scene) | ||
74 | { | ||
75 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); | ||
76 | |||
77 | m_scene = scene; | ||
78 | } | ||
79 | |||
80 | public void RemoveRegion(Scene scene) | ||
81 | { | ||
82 | // m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); | ||
83 | } | ||
84 | |||
85 | public void RegionLoaded(Scene scene) | ||
86 | { | ||
87 | // m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | ||
88 | |||
89 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object owner", | ||
90 | "delete object owner <UUID>", | ||
91 | "Delete object by owner", HandleDeleteObject); | ||
92 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object creator", | ||
93 | "delete object creator <UUID>", | ||
94 | "Delete object by creator", HandleDeleteObject); | ||
95 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object uuid", | ||
96 | "delete object uuid <UUID>", | ||
97 | "Delete object by uuid", HandleDeleteObject); | ||
98 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object name", | ||
99 | "delete object name <name>", | ||
100 | "Delete object by name", HandleDeleteObject); | ||
101 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside", | ||
102 | "delete object outside", | ||
103 | "Delete all objects outside boundaries", HandleDeleteObject); | ||
104 | } | ||
105 | |||
106 | private void HandleDeleteObject(string module, string[] cmd) | ||
107 | { | ||
108 | if (cmd.Length < 3) | ||
109 | return; | ||
110 | |||
111 | string mode = cmd[2]; | ||
112 | string o = ""; | ||
113 | |||
114 | if (mode != "outside") | ||
115 | { | ||
116 | if (cmd.Length < 4) | ||
117 | return; | ||
118 | |||
119 | o = cmd[3]; | ||
120 | } | ||
121 | |||
122 | List<SceneObjectGroup> deletes = new List<SceneObjectGroup>(); | ||
123 | |||
124 | UUID match; | ||
125 | |||
126 | switch (mode) | ||
127 | { | ||
128 | case "owner": | ||
129 | if (!UUID.TryParse(o, out match)) | ||
130 | return; | ||
131 | |||
132 | m_scene.ForEachSOG(delegate (SceneObjectGroup g) | ||
133 | { | ||
134 | if (g.OwnerID == match && !g.IsAttachment) | ||
135 | deletes.Add(g); | ||
136 | }); | ||
137 | |||
138 | break; | ||
139 | |||
140 | case "creator": | ||
141 | if (!UUID.TryParse(o, out match)) | ||
142 | return; | ||
143 | |||
144 | m_scene.ForEachSOG(delegate (SceneObjectGroup g) | ||
145 | { | ||
146 | if (g.RootPart.CreatorID == match && !g.IsAttachment) | ||
147 | deletes.Add(g); | ||
148 | }); | ||
149 | |||
150 | break; | ||
151 | |||
152 | case "uuid": | ||
153 | if (!UUID.TryParse(o, out match)) | ||
154 | return; | ||
155 | |||
156 | m_scene.ForEachSOG(delegate (SceneObjectGroup g) | ||
157 | { | ||
158 | if (g.UUID == match && !g.IsAttachment) | ||
159 | deletes.Add(g); | ||
160 | }); | ||
161 | |||
162 | break; | ||
163 | |||
164 | case "name": | ||
165 | m_scene.ForEachSOG(delegate (SceneObjectGroup g) | ||
166 | { | ||
167 | if (g.RootPart.Name == o && !g.IsAttachment) | ||
168 | deletes.Add(g); | ||
169 | }); | ||
170 | |||
171 | break; | ||
172 | |||
173 | case "outside": | ||
174 | m_scene.ForEachSOG(delegate (SceneObjectGroup g) | ||
175 | { | ||
176 | SceneObjectPart rootPart = g.RootPart; | ||
177 | bool delete = false; | ||
178 | |||
179 | if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0) | ||
180 | { | ||
181 | delete = true; | ||
182 | } | ||
183 | else | ||
184 | { | ||
185 | ILandObject parcel | ||
186 | = m_scene.LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y); | ||
187 | |||
188 | if (parcel == null || parcel.LandData.Name == "NO LAND") | ||
189 | delete = true; | ||
190 | } | ||
191 | |||
192 | if (delete && !g.IsAttachment && !deletes.Contains(g)) | ||
193 | deletes.Add(g); | ||
194 | }); | ||
195 | |||
196 | break; | ||
197 | } | ||
198 | |||
199 | foreach (SceneObjectGroup g in deletes) | ||
200 | { | ||
201 | MainConsole.Instance.OutputFormat("Deleting object {0}", g.UUID); | ||
202 | m_scene.DeleteSceneObject(g, false); | ||
203 | } | ||
204 | } | ||
205 | } | ||
206 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9b31fac..273d8bd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -623,23 +623,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
623 | "reload estate", | 623 | "reload estate", |
624 | "Reload the estate data", HandleReloadEstate); | 624 | "Reload the estate data", HandleReloadEstate); |
625 | 625 | ||
626 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object owner", | ||
627 | "delete object owner <UUID>", | ||
628 | "Delete object by owner", HandleDeleteObject); | ||
629 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object creator", | ||
630 | "delete object creator <UUID>", | ||
631 | "Delete object by creator", HandleDeleteObject); | ||
632 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object uuid", | ||
633 | "delete object uuid <UUID>", | ||
634 | "Delete object by uuid", HandleDeleteObject); | ||
635 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object name", | ||
636 | "delete object name <name>", | ||
637 | "Delete object by name", HandleDeleteObject); | ||
638 | |||
639 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside", | ||
640 | "delete object outside", | ||
641 | "Delete all objects outside boundaries", HandleDeleteObject); | ||
642 | |||
643 | //Bind Storage Manager functions to some land manager functions for this scene | 626 | //Bind Storage Manager functions to some land manager functions for this scene |
644 | EventManager.OnLandObjectAdded += | 627 | EventManager.OnLandObjectAdded += |
645 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); | 628 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); |
@@ -5079,93 +5062,6 @@ Environment.Exit(1); | |||
5079 | } | 5062 | } |
5080 | } | 5063 | } |
5081 | 5064 | ||
5082 | private void HandleDeleteObject(string module, string[] cmd) | ||
5083 | { | ||
5084 | if (cmd.Length < 3) | ||
5085 | return; | ||
5086 | |||
5087 | string mode = cmd[2]; | ||
5088 | string o = ""; | ||
5089 | |||
5090 | if (mode != "outside") | ||
5091 | { | ||
5092 | if (cmd.Length < 4) | ||
5093 | return; | ||
5094 | |||
5095 | o = cmd[3]; | ||
5096 | } | ||
5097 | |||
5098 | List<SceneObjectGroup> deletes = new List<SceneObjectGroup>(); | ||
5099 | |||
5100 | UUID match; | ||
5101 | |||
5102 | switch (mode) | ||
5103 | { | ||
5104 | case "owner": | ||
5105 | if (!UUID.TryParse(o, out match)) | ||
5106 | return; | ||
5107 | ForEachSOG(delegate (SceneObjectGroup g) | ||
5108 | { | ||
5109 | if (g.OwnerID == match && !g.IsAttachment) | ||
5110 | deletes.Add(g); | ||
5111 | }); | ||
5112 | break; | ||
5113 | case "creator": | ||
5114 | if (!UUID.TryParse(o, out match)) | ||
5115 | return; | ||
5116 | ForEachSOG(delegate (SceneObjectGroup g) | ||
5117 | { | ||
5118 | if (g.RootPart.CreatorID == match && !g.IsAttachment) | ||
5119 | deletes.Add(g); | ||
5120 | }); | ||
5121 | break; | ||
5122 | case "uuid": | ||
5123 | if (!UUID.TryParse(o, out match)) | ||
5124 | return; | ||
5125 | ForEachSOG(delegate (SceneObjectGroup g) | ||
5126 | { | ||
5127 | if (g.UUID == match && !g.IsAttachment) | ||
5128 | deletes.Add(g); | ||
5129 | }); | ||
5130 | break; | ||
5131 | case "name": | ||
5132 | ForEachSOG(delegate (SceneObjectGroup g) | ||
5133 | { | ||
5134 | if (g.RootPart.Name == o && !g.IsAttachment) | ||
5135 | deletes.Add(g); | ||
5136 | }); | ||
5137 | break; | ||
5138 | case "outside": | ||
5139 | ForEachSOG(delegate (SceneObjectGroup g) | ||
5140 | { | ||
5141 | SceneObjectPart rootPart = g.RootPart; | ||
5142 | bool delete = false; | ||
5143 | |||
5144 | if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0) | ||
5145 | { | ||
5146 | delete = true; | ||
5147 | } | ||
5148 | else | ||
5149 | { | ||
5150 | ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y); | ||
5151 | |||
5152 | if (parcel == null || parcel.LandData.Name == "NO LAND") | ||
5153 | delete = true; | ||
5154 | } | ||
5155 | |||
5156 | if (delete && !g.IsAttachment && !deletes.Contains(g)) | ||
5157 | deletes.Add(g); | ||
5158 | }); | ||
5159 | break; | ||
5160 | } | ||
5161 | |||
5162 | foreach (SceneObjectGroup g in deletes) | ||
5163 | { | ||
5164 | m_log.InfoFormat("[SCENE]: Deleting object {0}", g.UUID); | ||
5165 | DeleteSceneObject(g, false); | ||
5166 | } | ||
5167 | } | ||
5168 | |||
5169 | private void HandleReloadEstate(string module, string[] cmd) | 5065 | private void HandleReloadEstate(string module, string[] cmd) |
5170 | { | 5066 | { |
5171 | if (MainConsole.Instance.ConsoleScene == null || | 5067 | if (MainConsole.Instance.ConsoleScene == null || |