diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
8 files changed, 206 insertions, 44 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs index d942e87..5ec0ea9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs | |||
@@ -141,7 +141,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
141 | client.FirstName+" "+client.LastName, | 141 | client.FirstName+" "+client.LastName, |
142 | destID, (byte)211, false, | 142 | destID, (byte)211, false, |
143 | String.Empty, | 143 | String.Empty, |
144 | transactionID, false, new Vector3(), new byte[0]), | 144 | transactionID, false, new Vector3(), new byte[0], true), |
145 | delegate(bool success) {} ); | 145 | delegate(bool success) {} ); |
146 | } | 146 | } |
147 | } | 147 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 91eda19..33b4839 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -297,6 +297,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
297 | }); | 297 | }); |
298 | } | 298 | } |
299 | } | 299 | } |
300 | |||
301 | // XXX: This code was placed here to try and accomdate RLV which moves given folders named #RLV/~<name> | ||
302 | // to a folder called name in #RLV. However, this approach may not be ultimately correct - from analysis | ||
303 | // of Firestorm 4.2.2 on sending an InventoryOffered instead of TaskInventoryOffered (as was previously | ||
304 | // done), the viewer itself would appear to move and rename the folder, rather than the simulator doing it here. | ||
300 | else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) | 305 | else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) |
301 | { | 306 | { |
302 | UUID destinationFolderID = UUID.Zero; | 307 | UUID destinationFolderID = UUID.Zero; |
@@ -308,6 +313,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
308 | 313 | ||
309 | if (destinationFolderID != UUID.Zero) | 314 | if (destinationFolderID != UUID.Zero) |
310 | { | 315 | { |
316 | InventoryFolderBase destinationFolder = new InventoryFolderBase(destinationFolderID, client.AgentId); | ||
317 | if (destinationFolder == null) | ||
318 | { | ||
319 | m_log.WarnFormat( | ||
320 | "[INVENTORY TRANSFER]: TaskInventoryAccepted message from {0} in {1} specified folder {2} which does not exist", | ||
321 | client.Name, scene.Name, destinationFolderID); | ||
322 | |||
323 | return; | ||
324 | } | ||
325 | |||
311 | IInventoryService invService = scene.InventoryService; | 326 | IInventoryService invService = scene.InventoryService; |
312 | 327 | ||
313 | UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip | 328 | UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip |
@@ -315,9 +330,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
315 | InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); | 330 | InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); |
316 | item = invService.GetItem(item); | 331 | item = invService.GetItem(item); |
317 | InventoryFolderBase folder = null; | 332 | InventoryFolderBase folder = null; |
333 | UUID? previousParentFolderID = null; | ||
318 | 334 | ||
319 | if (item != null) // It's an item | 335 | if (item != null) // It's an item |
320 | { | 336 | { |
337 | previousParentFolderID = item.Folder; | ||
321 | item.Folder = destinationFolderID; | 338 | item.Folder = destinationFolderID; |
322 | 339 | ||
323 | invService.DeleteItems(item.Owner, new List<UUID>() { item.ID }); | 340 | invService.DeleteItems(item.Owner, new List<UUID>() { item.ID }); |
@@ -330,10 +347,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
330 | 347 | ||
331 | if (folder != null) // It's a folder | 348 | if (folder != null) // It's a folder |
332 | { | 349 | { |
350 | previousParentFolderID = folder.ParentID; | ||
333 | folder.ParentID = destinationFolderID; | 351 | folder.ParentID = destinationFolderID; |
334 | invService.MoveFolder(folder); | 352 | invService.MoveFolder(folder); |
335 | } | 353 | } |
336 | } | 354 | } |
355 | |||
356 | // Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code). | ||
357 | if (previousParentFolderID != null) | ||
358 | { | ||
359 | InventoryFolderBase previousParentFolder | ||
360 | = new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId); | ||
361 | previousParentFolder = invService.GetFolder(previousParentFolder); | ||
362 | scene.SendInventoryUpdate(client, previousParentFolder, true, true); | ||
363 | |||
364 | scene.SendInventoryUpdate(client, destinationFolder, true, true); | ||
365 | } | ||
337 | } | 366 | } |
338 | } | 367 | } |
339 | else if ( | 368 | else if ( |
@@ -354,9 +383,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
354 | InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); | 383 | InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); |
355 | item = invService.GetItem(item); | 384 | item = invService.GetItem(item); |
356 | InventoryFolderBase folder = null; | 385 | InventoryFolderBase folder = null; |
386 | UUID? previousParentFolderID = null; | ||
357 | 387 | ||
358 | if (item != null && trashFolder != null) | 388 | if (item != null && trashFolder != null) |
359 | { | 389 | { |
390 | previousParentFolderID = item.Folder; | ||
360 | item.Folder = trashFolder.ID; | 391 | item.Folder = trashFolder.ID; |
361 | 392 | ||
362 | // Diva comment: can't we just update this item??? | 393 | // Diva comment: can't we just update this item??? |
@@ -372,6 +403,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
372 | 403 | ||
373 | if (folder != null & trashFolder != null) | 404 | if (folder != null & trashFolder != null) |
374 | { | 405 | { |
406 | previousParentFolderID = folder.ParentID; | ||
375 | folder.ParentID = trashFolder.ID; | 407 | folder.ParentID = trashFolder.ID; |
376 | invService.MoveFolder(folder); | 408 | invService.MoveFolder(folder); |
377 | } | 409 | } |
@@ -391,6 +423,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
391 | client.SendAgentAlertMessage("Unable to delete "+ | 423 | client.SendAgentAlertMessage("Unable to delete "+ |
392 | "received inventory" + reason, false); | 424 | "received inventory" + reason, false); |
393 | } | 425 | } |
426 | // Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code). | ||
427 | else if (previousParentFolderID != null) | ||
428 | { | ||
429 | InventoryFolderBase previousParentFolder | ||
430 | = new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId); | ||
431 | previousParentFolder = invService.GetFolder(previousParentFolder); | ||
432 | scene.SendInventoryUpdate(client, previousParentFolder, true, true); | ||
433 | |||
434 | scene.SendInventoryUpdate(client, trashFolder, true, true); | ||
435 | } | ||
394 | 436 | ||
395 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); | 437 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); |
396 | 438 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs index 92cf9d1..9c369f6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs | |||
@@ -186,7 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
186 | client.FirstName+" "+client.LastName, targetid, | 186 | client.FirstName+" "+client.LastName, targetid, |
187 | (byte)InstantMessageDialog.RequestTeleport, false, | 187 | (byte)InstantMessageDialog.RequestTeleport, false, |
188 | message, sessionID, false, presence.AbsolutePosition, | 188 | message, sessionID, false, presence.AbsolutePosition, |
189 | new Byte[0]); | 189 | new Byte[0], true); |
190 | m.RegionID = client.Scene.RegionInfo.RegionID.Guid; | 190 | m.RegionID = client.Scene.RegionInfo.RegionID.Guid; |
191 | 191 | ||
192 | m_log.DebugFormat("[HG LURE MODULE]: RequestTeleport sessionID={0}, regionID={1}, message={2}", m.imSessionID, m.RegionID, m.message); | 192 | m_log.DebugFormat("[HG LURE MODULE]: RequestTeleport sessionID={0}, regionID={1}, message={2}", m.imSessionID, m.RegionID, m.message); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index 2d4cffd..6ce9556 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | |||
@@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
169 | client.FirstName+" "+client.LastName, targetid, | 169 | client.FirstName+" "+client.LastName, targetid, |
170 | (byte)InstantMessageDialog.RequestTeleport, false, | 170 | (byte)InstantMessageDialog.RequestTeleport, false, |
171 | message, dest, false, presence.AbsolutePosition, | 171 | message, dest, false, presence.AbsolutePosition, |
172 | new Byte[0]); | 172 | new Byte[0], true); |
173 | 173 | ||
174 | if (m_TransferModule != null) | 174 | if (m_TransferModule != null) |
175 | { | 175 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index b51570f..617a350 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1068,6 +1068,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1068 | Scene initiatingScene) | 1068 | Scene initiatingScene) |
1069 | { | 1069 | { |
1070 | Thread.Sleep(10000); | 1070 | Thread.Sleep(10000); |
1071 | |||
1071 | IMessageTransferModule im = initiatingScene.RequestModuleInterface<IMessageTransferModule>(); | 1072 | IMessageTransferModule im = initiatingScene.RequestModuleInterface<IMessageTransferModule>(); |
1072 | if (im != null) | 1073 | if (im != null) |
1073 | { | 1074 | { |
@@ -1080,11 +1081,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1080 | (uint)(int)position.X, | 1081 | (uint)(int)position.X, |
1081 | (uint)(int)position.Y, | 1082 | (uint)(int)position.Y, |
1082 | (uint)(int)position.Z); | 1083 | (uint)(int)position.Z); |
1083 | GridInstantMessage m = new GridInstantMessage(initiatingScene, UUID.Zero, | 1084 | |
1084 | "Region", agent.UUID, | 1085 | GridInstantMessage m |
1085 | (byte)InstantMessageDialog.GodLikeRequestTeleport, false, | 1086 | = new GridInstantMessage( |
1086 | "", gotoLocation, false, new Vector3(127, 0, 0), | 1087 | initiatingScene, |
1087 | new Byte[0]); | 1088 | UUID.Zero, |
1089 | "Region", | ||
1090 | agent.UUID, | ||
1091 | (byte)InstantMessageDialog.GodLikeRequestTeleport, | ||
1092 | false, | ||
1093 | "", | ||
1094 | gotoLocation, | ||
1095 | false, | ||
1096 | new Vector3(127, 0, 0), | ||
1097 | new Byte[0], | ||
1098 | false); | ||
1099 | |||
1088 | im.SendInstantMessage(m, delegate(bool success) | 1100 | im.SendInstantMessage(m, delegate(bool success) |
1089 | { | 1101 | { |
1090 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Client Initiating Teleport sending IM success = {0}", success); | 1102 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Client Initiating Teleport sending IM success = {0}", success); |
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs index e135c21..e411585 100644 --- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs | |||
@@ -95,14 +95,14 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
95 | { | 95 | { |
96 | foreach (IMonitor monitor in m_staticMonitors) | 96 | foreach (IMonitor monitor in m_staticMonitors) |
97 | { | 97 | { |
98 | m_log.InfoFormat( | 98 | MainConsole.Instance.OutputFormat( |
99 | "[MONITOR MODULE]: {0} reports {1} = {2}", | 99 | "[MONITOR MODULE]: {0} reports {1} = {2}", |
100 | m_scene.RegionInfo.RegionName, monitor.GetFriendlyName(), monitor.GetFriendlyValue()); | 100 | m_scene.RegionInfo.RegionName, monitor.GetFriendlyName(), monitor.GetFriendlyValue()); |
101 | } | 101 | } |
102 | 102 | ||
103 | foreach (KeyValuePair<string, float> tuple in m_scene.StatsReporter.GetExtraSimStats()) | 103 | foreach (KeyValuePair<string, float> tuple in m_scene.StatsReporter.GetExtraSimStats()) |
104 | { | 104 | { |
105 | m_log.InfoFormat( | 105 | MainConsole.Instance.OutputFormat( |
106 | "[MONITOR MODULE]: {0} reports {1} = {2}", | 106 | "[MONITOR MODULE]: {0} reports {1} = {2}", |
107 | m_scene.RegionInfo.RegionName, tuple.Key, tuple.Value); | 107 | m_scene.RegionInfo.RegionName, tuple.Key, tuple.Value); |
108 | } | 108 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 36c84c7..b4811da 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -31,6 +31,7 @@ using System.Reflection; | |||
31 | 31 | ||
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Console; | 33 | using OpenSim.Framework.Console; |
34 | using OpenSim.Region.ClientStack.LindenUDP; | ||
34 | using OpenSim.Region.Framework; | 35 | using OpenSim.Region.Framework; |
35 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index 09f6758..6e39e9a 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | |||
@@ -126,6 +126,25 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
126 | m_console.Commands.AddCommand( | 126 | m_console.Commands.AddCommand( |
127 | "Objects", | 127 | "Objects", |
128 | false, | 128 | false, |
129 | "show object pos", | ||
130 | "show object pos <start-coord> to <end-coord>", | ||
131 | "Show details of scene objects within the given area.", | ||
132 | "Each component of the coord is comma separated. There must be no spaces between the commas.\n" | ||
133 | + "If you don't care about the z component you can simply omit it.\n" | ||
134 | + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n" | ||
135 | + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n" | ||
136 | + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n" | ||
137 | + "e.g.\n" | ||
138 | + "show object pos 20,20,20 to 40,40,40\n" | ||
139 | + "show object pos 20,20 to 40,40\n" | ||
140 | + "show object pos ,20,20 to ,40,40\n" | ||
141 | + "show object pos ,,30 to ,,~\n" | ||
142 | + "show object pos ,,-~ to ,,30", | ||
143 | HandleShowObjectByPos); | ||
144 | |||
145 | m_console.Commands.AddCommand( | ||
146 | "Objects", | ||
147 | false, | ||
129 | "show part uuid", | 148 | "show part uuid", |
130 | "show part uuid <UUID>", | 149 | "show part uuid <UUID>", |
131 | "Show details of a scene object parts with the given UUID", HandleShowPartByUuid); | 150 | "Show details of a scene object parts with the given UUID", HandleShowPartByUuid); |
@@ -138,6 +157,25 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
138 | "Show details of scene object parts with the given name.", | 157 | "Show details of scene object parts with the given name.", |
139 | "If --regex is specified then the name is treatead as a regular expression", | 158 | "If --regex is specified then the name is treatead as a regular expression", |
140 | HandleShowPartByName); | 159 | HandleShowPartByName); |
160 | |||
161 | m_console.Commands.AddCommand( | ||
162 | "Objects", | ||
163 | false, | ||
164 | "show part pos", | ||
165 | "show part pos <start-coord> to <end-coord>", | ||
166 | "Show details of scene object parts within the given area.", | ||
167 | "Each component of the coord is comma separated. There must be no spaces between the commas.\n" | ||
168 | + "If you don't care about the z component you can simply omit it.\n" | ||
169 | + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n" | ||
170 | + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n" | ||
171 | + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n" | ||
172 | + "e.g.\n" | ||
173 | + "show object pos 20,20,20 to 40,40,40\n" | ||
174 | + "show object pos 20,20 to 40,40\n" | ||
175 | + "show object pos ,20,20 to ,40,40\n" | ||
176 | + "show object pos ,,30 to ,,~\n" | ||
177 | + "show object pos ,,-~ to ,,30", | ||
178 | HandleShowPartByPos); | ||
141 | } | 179 | } |
142 | 180 | ||
143 | public void RemoveRegion(Scene scene) | 181 | public void RemoveRegion(Scene scene) |
@@ -150,6 +188,43 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
150 | // m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | 188 | // m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); |
151 | } | 189 | } |
152 | 190 | ||
191 | private void OutputSogsToConsole(Predicate<SceneObjectGroup> searchPredicate) | ||
192 | { | ||
193 | List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups().FindAll(searchPredicate); | ||
194 | |||
195 | StringBuilder sb = new StringBuilder(); | ||
196 | |||
197 | foreach (SceneObjectGroup so in sceneObjects) | ||
198 | { | ||
199 | AddSceneObjectReport(sb, so); | ||
200 | sb.Append("\n"); | ||
201 | } | ||
202 | |||
203 | sb.AppendFormat("{0} object(s) found in {1}\n", sceneObjects.Count, m_scene.Name); | ||
204 | |||
205 | m_console.OutputFormat(sb.ToString()); | ||
206 | } | ||
207 | |||
208 | private void OutputSopsToConsole(Predicate<SceneObjectPart> searchPredicate) | ||
209 | { | ||
210 | List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups(); | ||
211 | List<SceneObjectPart> parts = new List<SceneObjectPart>(); | ||
212 | |||
213 | sceneObjects.ForEach(so => parts.AddRange(Array.FindAll<SceneObjectPart>(so.Parts, searchPredicate))); | ||
214 | |||
215 | StringBuilder sb = new StringBuilder(); | ||
216 | |||
217 | foreach (SceneObjectPart part in parts) | ||
218 | { | ||
219 | AddScenePartReport(sb, part); | ||
220 | sb.Append("\n"); | ||
221 | } | ||
222 | |||
223 | sb.AppendFormat("{0} parts found in {1}\n", parts.Count, m_scene.Name); | ||
224 | |||
225 | m_console.OutputFormat(sb.ToString()); | ||
226 | } | ||
227 | |||
153 | private void HandleShowObjectByUuid(string module, string[] cmd) | 228 | private void HandleShowObjectByUuid(string module, string[] cmd) |
154 | { | 229 | { |
155 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | 230 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) |
@@ -200,36 +275,54 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
200 | 275 | ||
201 | string name = mainParams[3]; | 276 | string name = mainParams[3]; |
202 | 277 | ||
203 | List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); | 278 | Predicate<SceneObjectGroup> searchPredicate; |
204 | Action<SceneObjectGroup> searchAction; | ||
205 | 279 | ||
206 | if (useRegex) | 280 | if (useRegex) |
207 | { | 281 | { |
208 | Regex nameRegex = new Regex(name); | 282 | Regex nameRegex = new Regex(name); |
209 | searchAction = so => { if (nameRegex.IsMatch(so.Name)) { sceneObjects.Add(so); }}; | 283 | searchPredicate = so => nameRegex.IsMatch(so.Name); |
210 | } | 284 | } |
211 | else | 285 | else |
212 | { | 286 | { |
213 | searchAction = so => { if (so.Name == name) { sceneObjects.Add(so); }}; | 287 | searchPredicate = so => so.Name == name; |
214 | } | 288 | } |
215 | 289 | ||
216 | m_scene.ForEachSOG(searchAction); | 290 | OutputSogsToConsole(searchPredicate); |
291 | } | ||
217 | 292 | ||
218 | if (sceneObjects.Count == 0) | 293 | private void HandleShowObjectByPos(string module, string[] cmdparams) |
294 | { | ||
295 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | ||
296 | return; | ||
297 | |||
298 | if (cmdparams.Length < 5) | ||
219 | { | 299 | { |
220 | m_console.OutputFormat("No objects with name {0} found in {1}", name, m_scene.RegionInfo.RegionName); | 300 | m_console.OutputFormat("Usage: show object pos <start-coord> to <end-coord>"); |
221 | return; | 301 | return; |
222 | } | 302 | } |
223 | 303 | ||
224 | StringBuilder sb = new StringBuilder(); | 304 | string rawConsoleStartVector = cmdparams[3]; |
305 | Vector3 startVector; | ||
225 | 306 | ||
226 | foreach (SceneObjectGroup so in sceneObjects) | 307 | if (!ConsoleUtil.TryParseConsoleMinVector(rawConsoleStartVector, out startVector)) |
227 | { | 308 | { |
228 | AddSceneObjectReport(sb, so); | 309 | m_console.OutputFormat("Error: Start vector {0} does not have a valid format", rawConsoleStartVector); |
229 | sb.Append("\n"); | 310 | return; |
230 | } | 311 | } |
231 | 312 | ||
232 | m_console.OutputFormat(sb.ToString()); | 313 | string rawConsoleEndVector = cmdparams[5]; |
314 | Vector3 endVector; | ||
315 | |||
316 | if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector)) | ||
317 | { | ||
318 | m_console.OutputFormat("Error: End vector {0} does not have a valid format", rawConsoleEndVector); | ||
319 | return; | ||
320 | } | ||
321 | |||
322 | Predicate<SceneObjectGroup> searchPredicate | ||
323 | = so => Util.IsInsideBox(so.AbsolutePosition, startVector, endVector); | ||
324 | |||
325 | OutputSogsToConsole(searchPredicate); | ||
233 | } | 326 | } |
234 | 327 | ||
235 | private void HandleShowPartByUuid(string module, string[] cmd) | 328 | private void HandleShowPartByUuid(string module, string[] cmd) |
@@ -264,6 +357,38 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
264 | m_console.OutputFormat(sb.ToString()); | 357 | m_console.OutputFormat(sb.ToString()); |
265 | } | 358 | } |
266 | 359 | ||
360 | private void HandleShowPartByPos(string module, string[] cmdparams) | ||
361 | { | ||
362 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | ||
363 | return; | ||
364 | |||
365 | if (cmdparams.Length < 5) | ||
366 | { | ||
367 | m_console.OutputFormat("Usage: show part pos <start-coord> to <end-coord>"); | ||
368 | return; | ||
369 | } | ||
370 | |||
371 | string rawConsoleStartVector = cmdparams[3]; | ||
372 | Vector3 startVector; | ||
373 | |||
374 | if (!ConsoleUtil.TryParseConsoleMinVector(rawConsoleStartVector, out startVector)) | ||
375 | { | ||
376 | m_console.OutputFormat("Error: Start vector {0} does not have a valid format", rawConsoleStartVector); | ||
377 | return; | ||
378 | } | ||
379 | |||
380 | string rawConsoleEndVector = cmdparams[5]; | ||
381 | Vector3 endVector; | ||
382 | |||
383 | if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector)) | ||
384 | { | ||
385 | m_console.OutputFormat("Error: End vector {0} does not have a valid format", rawConsoleEndVector); | ||
386 | return; | ||
387 | } | ||
388 | |||
389 | OutputSopsToConsole(sop => Util.IsInsideBox(sop.AbsolutePosition, startVector, endVector)); | ||
390 | } | ||
391 | |||
267 | private void HandleShowPartByName(string module, string[] cmdparams) | 392 | private void HandleShowPartByName(string module, string[] cmdparams) |
268 | { | 393 | { |
269 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | 394 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) |
@@ -282,37 +407,19 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
282 | 407 | ||
283 | string name = mainParams[3]; | 408 | string name = mainParams[3]; |
284 | 409 | ||
285 | List<SceneObjectPart> parts = new List<SceneObjectPart>(); | 410 | Predicate<SceneObjectPart> searchPredicate; |
286 | |||
287 | Action<SceneObjectGroup> searchAction; | ||
288 | 411 | ||
289 | if (useRegex) | 412 | if (useRegex) |
290 | { | 413 | { |
291 | Regex nameRegex = new Regex(name); | 414 | Regex nameRegex = new Regex(name); |
292 | searchAction = so => so.ForEachPart(sop => { if (nameRegex.IsMatch(sop.Name)) { parts.Add(sop); } }); | 415 | searchPredicate = sop => nameRegex.IsMatch(sop.Name); |
293 | } | 416 | } |
294 | else | 417 | else |
295 | { | 418 | { |
296 | searchAction = so => so.ForEachPart(sop => { if (sop.Name == name) { parts.Add(sop); } }); | 419 | searchPredicate = sop => sop.Name == name; |
297 | } | 420 | } |
298 | 421 | ||
299 | m_scene.ForEachSOG(searchAction); | 422 | OutputSopsToConsole(searchPredicate); |
300 | |||
301 | if (parts.Count == 0) | ||
302 | { | ||
303 | m_console.OutputFormat("No parts with name {0} found in {1}", name, m_scene.RegionInfo.RegionName); | ||
304 | return; | ||
305 | } | ||
306 | |||
307 | StringBuilder sb = new StringBuilder(); | ||
308 | |||
309 | foreach (SceneObjectPart part in parts) | ||
310 | { | ||
311 | AddScenePartReport(sb, part); | ||
312 | sb.Append("\n"); | ||
313 | } | ||
314 | |||
315 | m_console.OutputFormat(sb.ToString()); | ||
316 | } | 423 | } |
317 | 424 | ||
318 | private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so) | 425 | private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so) |