diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Objects')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | 92 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | 120 |
2 files changed, 131 insertions, 81 deletions
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 2abc910..6a8f4c0 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | |||
@@ -45,38 +45,38 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BuySellModule")] | 45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BuySellModule")] |
46 | public class BuySellModule : IBuySellModule, INonSharedRegionModule | 46 | public class BuySellModule : IBuySellModule, INonSharedRegionModule |
47 | { | 47 | { |
48 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
50 | protected Scene m_scene = null; | 50 | protected Scene m_scene = null; |
51 | protected IDialogModule m_dialogModule; | 51 | protected IDialogModule m_dialogModule; |
52 | 52 | ||
53 | public string Name { get { return "Object BuySell Module"; } } | 53 | public string Name { get { return "Object BuySell Module"; } } |
54 | public Type ReplaceableInterface { get { return null; } } | 54 | public Type ReplaceableInterface { get { return null; } } |
55 | 55 | ||
56 | public void Initialise(IConfigSource source) {} | 56 | public void Initialise(IConfigSource source) {} |
57 | 57 | ||
58 | public void AddRegion(Scene scene) | 58 | public void AddRegion(Scene scene) |
59 | { | 59 | { |
60 | m_scene = scene; | 60 | m_scene = scene; |
61 | m_scene.RegisterModuleInterface<IBuySellModule>(this); | 61 | m_scene.RegisterModuleInterface<IBuySellModule>(this); |
62 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | 62 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; |
63 | } | 63 | } |
64 | 64 | ||
65 | public void RemoveRegion(Scene scene) | 65 | public void RemoveRegion(Scene scene) |
66 | { | 66 | { |
67 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; | 67 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; |
68 | } | 68 | } |
69 | 69 | ||
70 | public void RegionLoaded(Scene scene) | 70 | public void RegionLoaded(Scene scene) |
71 | { | 71 | { |
72 | m_dialogModule = scene.RequestModuleInterface<IDialogModule>(); | 72 | m_dialogModule = scene.RequestModuleInterface<IDialogModule>(); |
73 | } | 73 | } |
74 | 74 | ||
75 | public void Close() | 75 | public void Close() |
76 | { | 76 | { |
77 | RemoveRegion(m_scene); | 77 | RemoveRegion(m_scene); |
78 | } | 78 | } |
79 | 79 | ||
80 | public void SubscribeToClientEvents(IClientAPI client) | 80 | public void SubscribeToClientEvents(IClientAPI client) |
81 | { | 81 | { |
82 | client.OnObjectSaleInfo += ObjectSaleInfo; | 82 | client.OnObjectSaleInfo += ObjectSaleInfo; |
@@ -89,18 +89,23 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
89 | if (part == null) | 89 | if (part == null) |
90 | return; | 90 | return; |
91 | 91 | ||
92 | if (part.ParentGroup.IsDeleted) | 92 | SceneObjectGroup sog = part.ParentGroup; |
93 | if (sog == null || sog.IsDeleted) | ||
93 | return; | 94 | return; |
94 | 95 | ||
95 | if (part.OwnerID != client.AgentId && (!m_scene.Permissions.IsGod(client.AgentId))) | 96 | // Does the user have the power to put the object on sale? |
97 | if (!m_scene.Permissions.CanSellObject(client, sog, saleType)) | ||
98 | { | ||
99 | client.SendAgentAlertMessage("You don't have permission to set object on sale", false); | ||
96 | return; | 100 | return; |
101 | } | ||
97 | 102 | ||
98 | part = part.ParentGroup.RootPart; | 103 | part = sog.RootPart; |
99 | 104 | ||
100 | part.ObjectSaleType = saleType; | 105 | part.ObjectSaleType = saleType; |
101 | part.SalePrice = salePrice; | 106 | part.SalePrice = salePrice; |
102 | 107 | ||
103 | part.ParentGroup.HasGroupChanged = true; | 108 | sog.HasGroupChanged = true; |
104 | 109 | ||
105 | part.SendPropertiesToClient(client); | 110 | part.SendPropertiesToClient(client); |
106 | } | 111 | } |
@@ -113,11 +118,16 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
113 | return false; | 118 | return false; |
114 | 119 | ||
115 | SceneObjectGroup group = part.ParentGroup; | 120 | SceneObjectGroup group = part.ParentGroup; |
121 | if(group == null || group.IsDeleted || group.inTransit) | ||
122 | return false; | ||
123 | |||
124 | // make sure we are not buying a child part | ||
125 | part = group.RootPart; | ||
116 | 126 | ||
117 | switch (saleType) | 127 | switch (saleType) |
118 | { | 128 | { |
119 | case 1: // Sell as original (in-place sale) | 129 | case 1: // Sell as original (in-place sale) |
120 | uint effectivePerms = group.GetEffectivePermissions(); | 130 | uint effectivePerms = group.EffectiveOwnerPerms; |
121 | 131 | ||
122 | if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) | 132 | if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) |
123 | { | 133 | { |
@@ -126,8 +136,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
126 | return false; | 136 | return false; |
127 | } | 137 | } |
128 | 138 | ||
129 | group.SetOwnerId(remoteClient.AgentId); | 139 | group.SetOwner(remoteClient.AgentId, remoteClient.ActiveGroupId); |
130 | group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId); | ||
131 | 140 | ||
132 | if (m_scene.Permissions.PropagatePermissions()) | 141 | if (m_scene.Permissions.PropagatePermissions()) |
133 | { | 142 | { |
@@ -137,6 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
137 | child.TriggerScriptChangedEvent(Changed.OWNER); | 146 | child.TriggerScriptChangedEvent(Changed.OWNER); |
138 | child.ApplyNextOwnerPermissions(); | 147 | child.ApplyNextOwnerPermissions(); |
139 | } | 148 | } |
149 | group.InvalidateDeepEffectivePerms(); | ||
140 | } | 150 | } |
141 | 151 | ||
142 | part.ObjectSaleType = 0; | 152 | part.ObjectSaleType = 0; |
@@ -152,19 +162,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
152 | break; | 162 | break; |
153 | 163 | ||
154 | case 2: // Sell a copy | 164 | case 2: // Sell a copy |
155 | Vector3 inventoryStoredPosition = new Vector3( | 165 | uint perms = group.EffectiveOwnerPerms; |
156 | Math.Min(group.AbsolutePosition.X, m_scene.RegionInfo.RegionSizeX - 6), | ||
157 | Math.Min(group.AbsolutePosition.Y, m_scene.RegionInfo.RegionSizeY - 6), | ||
158 | group.AbsolutePosition.Z); | ||
159 | |||
160 | Vector3 originalPosition = group.AbsolutePosition; | ||
161 | |||
162 | group.AbsolutePosition = inventoryStoredPosition; | ||
163 | |||
164 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
165 | group.AbsolutePosition = originalPosition; | ||
166 | |||
167 | uint perms = group.GetEffectivePermissions(); | ||
168 | 166 | ||
169 | if ((perms & (uint)PermissionMask.Transfer) == 0) | 167 | if ((perms & (uint)PermissionMask.Transfer) == 0) |
170 | { | 168 | { |
@@ -173,6 +171,15 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
173 | return false; | 171 | return false; |
174 | } | 172 | } |
175 | 173 | ||
174 | if ((perms & (uint)PermissionMask.Copy) == 0) | ||
175 | { | ||
176 | if (m_dialogModule != null) | ||
177 | m_dialogModule.SendAlertToUser(remoteClient, "This sale has been blocked by the permissions system"); | ||
178 | return false; | ||
179 | } | ||
180 | |||
181 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
182 | |||
176 | AssetBase asset = m_scene.CreateAsset( | 183 | AssetBase asset = m_scene.CreateAsset( |
177 | group.GetPartName(localID), | 184 | group.GetPartName(localID), |
178 | group.GetPartDescription(localID), | 185 | group.GetPartDescription(localID), |
@@ -193,16 +200,21 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
193 | item.AssetType = asset.Type; | 200 | item.AssetType = asset.Type; |
194 | item.InvType = (int)InventoryType.Object; | 201 | item.InvType = (int)InventoryType.Object; |
195 | item.Folder = categoryID; | 202 | item.Folder = categoryID; |
203 | |||
204 | perms = group.CurrentAndFoldedNextPermissions(); | ||
205 | // apply parts inventory next perms | ||
206 | PermissionsUtil.ApplyNoModFoldedPermissions(perms, ref perms); | ||
207 | // change to next owner perms | ||
208 | perms &= part.NextOwnerMask; | ||
209 | // update folded | ||
210 | perms = PermissionsUtil.FixAndFoldPermissions(perms); | ||
211 | |||
212 | item.BasePermissions = perms; | ||
213 | item.CurrentPermissions = perms; | ||
214 | item.NextPermissions = part.NextOwnerMask & perms; | ||
215 | item.EveryOnePermissions = part.EveryoneMask & perms; | ||
216 | item.GroupPermissions = part.GroupMask & perms; | ||
196 | 217 | ||
197 | PermissionsUtil.ApplyFoldedPermissions(perms, ref perms); | ||
198 | |||
199 | item.BasePermissions = perms & part.NextOwnerMask; | ||
200 | item.CurrentPermissions = perms & part.NextOwnerMask; | ||
201 | item.NextPermissions = part.NextOwnerMask; | ||
202 | item.EveryOnePermissions = part.EveryoneMask & | ||
203 | part.NextOwnerMask; | ||
204 | item.GroupPermissions = part.GroupMask & | ||
205 | part.NextOwnerMask; | ||
206 | item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | 218 | item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; |
207 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 219 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
208 | 220 | ||
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index e77f0aa..3d786dd 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | |||
@@ -53,30 +53,30 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ObjectCommandsModule")] | 53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ObjectCommandsModule")] |
54 | public class ObjectCommandsModule : INonSharedRegionModule | 54 | public class ObjectCommandsModule : INonSharedRegionModule |
55 | { | 55 | { |
56 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 56 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
57 | 57 | ||
58 | private Scene m_scene; | 58 | private Scene m_scene; |
59 | private ICommandConsole m_console; | 59 | private ICommandConsole m_console; |
60 | 60 | ||
61 | public string Name { get { return "Object Commands Module"; } } | 61 | public string Name { get { return "Object Commands Module"; } } |
62 | 62 | ||
63 | public Type ReplaceableInterface { get { return null; } } | 63 | public Type ReplaceableInterface { get { return null; } } |
64 | 64 | ||
65 | public void Initialise(IConfigSource source) | 65 | public void Initialise(IConfigSource source) |
66 | { | 66 | { |
67 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: INITIALIZED MODULE"); | 67 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: INITIALIZED MODULE"); |
68 | } | 68 | } |
69 | 69 | ||
70 | public void PostInitialise() | 70 | public void PostInitialise() |
71 | { | 71 | { |
72 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: POST INITIALIZED MODULE"); | 72 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: POST INITIALIZED MODULE"); |
73 | } | 73 | } |
74 | 74 | ||
75 | public void Close() | 75 | public void Close() |
76 | { | 76 | { |
77 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: CLOSED MODULE"); | 77 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: CLOSED MODULE"); |
78 | } | 78 | } |
79 | 79 | ||
80 | public void AddRegion(Scene scene) | 80 | public void AddRegion(Scene scene) |
81 | { | 81 | { |
82 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); | 82 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); |
@@ -123,8 +123,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
123 | "Objects", | 123 | "Objects", |
124 | false, | 124 | false, |
125 | "delete object pos", | 125 | "delete object pos", |
126 | "delete object pos <start-coord> to <end-coord>", | 126 | "delete object pos <start x, start y , start z> <end x, end y, end z>", |
127 | "Delete scene objects within the given area.", | 127 | "Delete scene objects within the given volume.", |
128 | ConsoleUtil.CoordHelp, | 128 | ConsoleUtil.CoordHelp, |
129 | HandleDeleteObject); | 129 | HandleDeleteObject); |
130 | 130 | ||
@@ -152,9 +152,18 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
152 | m_console.Commands.AddCommand( | 152 | m_console.Commands.AddCommand( |
153 | "Objects", | 153 | "Objects", |
154 | false, | 154 | false, |
155 | "show object owner", | ||
156 | "show object owner [--full] <OwnerID>", | ||
157 | "Show details of scene objects with given owner.", | ||
158 | "The --full option will print out information on all the parts of the object.\n", | ||
159 | HandleShowObjectByOwnerID); | ||
160 | |||
161 | m_console.Commands.AddCommand( | ||
162 | "Objects", | ||
163 | false, | ||
155 | "show object pos", | 164 | "show object pos", |
156 | "show object pos [--full] <start-coord> to <end-coord>", | 165 | "show object pos [--full] <start x, start y , start z> <end x, end y, end z>", |
157 | "Show details of scene objects within the given area.", | 166 | "Show details of scene objects within give volume", |
158 | "The --full option will print out information on all the parts of the object.\n" | 167 | "The --full option will print out information on all the parts of the object.\n" |
159 | + "For yet more detailed part information, use the \"show part\" commands.\n" | 168 | + "For yet more detailed part information, use the \"show part\" commands.\n" |
160 | + ConsoleUtil.CoordHelp, | 169 | + ConsoleUtil.CoordHelp, |
@@ -180,8 +189,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
180 | "Objects", | 189 | "Objects", |
181 | false, | 190 | false, |
182 | "show part pos", | 191 | "show part pos", |
183 | "show part pos <start-coord> to <end-coord>", | 192 | "show part pos <start x, start y , start z> <end x, end y, end z>", |
184 | "Show details of scene object parts within the given area.", | 193 | "Show details of scene object parts within the given volume.", |
185 | ConsoleUtil.CoordHelp, | 194 | ConsoleUtil.CoordHelp, |
186 | HandleShowPartByPos); | 195 | HandleShowPartByPos); |
187 | 196 | ||
@@ -325,6 +334,32 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
325 | OutputSogsToConsole(searchPredicate, showFull); | 334 | OutputSogsToConsole(searchPredicate, showFull); |
326 | } | 335 | } |
327 | 336 | ||
337 | private void HandleShowObjectByOwnerID(string module, string[] cmdparams) | ||
338 | { | ||
339 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | ||
340 | return; | ||
341 | |||
342 | bool showFull = false; | ||
343 | OptionSet options = new OptionSet().Add("full", v => showFull = v != null); | ||
344 | |||
345 | List<string> mainParams = options.Parse(cmdparams); | ||
346 | |||
347 | if (mainParams.Count < 4) | ||
348 | { | ||
349 | m_console.OutputFormat("Usage: show object owner <OwnerID>"); | ||
350 | return; | ||
351 | } | ||
352 | |||
353 | UUID ownerID; | ||
354 | if (!ConsoleUtil.TryParseConsoleUuid(m_console, mainParams[3], out ownerID)) | ||
355 | return; | ||
356 | |||
357 | Predicate<SceneObjectGroup> searchPredicate | ||
358 | = so => so.OwnerID == ownerID && !so.IsAttachment; | ||
359 | |||
360 | OutputSogsToConsole(searchPredicate, showFull); | ||
361 | } | ||
362 | |||
328 | private void HandleShowObjectByPos(string module, string[] cmdparams) | 363 | private void HandleShowObjectByPos(string module, string[] cmdparams) |
329 | { | 364 | { |
330 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | 365 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) |
@@ -504,13 +539,13 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
504 | 539 | ||
505 | if (!ConsoleUtil.CheckFileDoesNotExist(m_console, fileName)) | 540 | if (!ConsoleUtil.CheckFileDoesNotExist(m_console, fileName)) |
506 | return; | 541 | return; |
507 | 542 | ||
508 | using (XmlTextWriter xtw = new XmlTextWriter(fileName, Encoding.UTF8)) | 543 | using (XmlTextWriter xtw = new XmlTextWriter(fileName, Encoding.UTF8)) |
509 | { | 544 | { |
510 | xtw.Formatting = Formatting.Indented; | 545 | xtw.Formatting = Formatting.Indented; |
511 | SceneObjectSerializer.ToOriginalXmlFormat(so, xtw, true); | 546 | SceneObjectSerializer.ToOriginalXmlFormat(so, xtw, true); |
512 | } | 547 | } |
513 | 548 | ||
514 | m_console.OutputFormat("Object dumped to file {0}", fileName); | 549 | m_console.OutputFormat("Object dumped to file {0}", fileName); |
515 | } | 550 | } |
516 | 551 | ||
@@ -590,7 +625,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
590 | cdl.AddRow("FlexiSoftness", s.FlexiSoftness); | 625 | cdl.AddRow("FlexiSoftness", s.FlexiSoftness); |
591 | cdl.AddRow("HollowShape", s.HollowShape); | 626 | cdl.AddRow("HollowShape", s.HollowShape); |
592 | cdl.AddRow( | 627 | cdl.AddRow( |
593 | "LightColor", | 628 | "LightColor", |
594 | string.Format("<{0},{1},{2},{3}>", s.LightColorR, s.LightColorB, s.LightColorG, s.LightColorA)); | 629 | string.Format("<{0},{1},{2},{3}>", s.LightColorR, s.LightColorB, s.LightColorG, s.LightColorA)); |
595 | cdl.AddRow("LightCutoff", s.LightCutoff); | 630 | cdl.AddRow("LightCutoff", s.LightCutoff); |
596 | cdl.AddRow("LightEntry", s.LightEntry); | 631 | cdl.AddRow("LightEntry", s.LightEntry); |
@@ -624,7 +659,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
624 | cdl.AddRow("Rotation (World)", sop.GetWorldRotation()); | 659 | cdl.AddRow("Rotation (World)", sop.GetWorldRotation()); |
625 | cdl.AddRow("Scale", s.Scale); | 660 | cdl.AddRow("Scale", s.Scale); |
626 | cdl.AddRow( | 661 | cdl.AddRow( |
627 | "SculptData", | 662 | "SculptData", |
628 | string.Format("{0} bytes", s.SculptData != null ? s.SculptData.Length.ToString() : "n/a")); | 663 | string.Format("{0} bytes", s.SculptData != null ? s.SculptData.Length.ToString() : "n/a")); |
629 | cdl.AddRow("SculptEntry", s.SculptEntry); | 664 | cdl.AddRow("SculptEntry", s.SculptEntry); |
630 | cdl.AddRow("SculptTexture", s.SculptTexture); | 665 | cdl.AddRow("SculptTexture", s.SculptTexture); |
@@ -633,7 +668,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
633 | 668 | ||
634 | // TODO, need to display more information about textures but in a compact format | 669 | // TODO, need to display more information about textures but in a compact format |
635 | // to stop output becoming huge. | 670 | // to stop output becoming huge. |
636 | for (int i = 0; i < sop.GetNumberOfSides(); i++) | 671 | for (int i = 0; i < sop.GetNumberOfSides(); i++) |
637 | { | 672 | { |
638 | Primitive.TextureEntryFace teFace = s.Textures.FaceTextures[i]; | 673 | Primitive.TextureEntryFace teFace = s.Textures.FaceTextures[i]; |
639 | 674 | ||
@@ -730,12 +765,12 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
730 | if (g.OwnerID == match && !g.IsAttachment) | 765 | if (g.OwnerID == match && !g.IsAttachment) |
731 | deletes.Add(g); | 766 | deletes.Add(g); |
732 | }); | 767 | }); |
733 | 768 | ||
734 | // if (deletes.Count == 0) | 769 | // if (deletes.Count == 0) |
735 | // m_console.OutputFormat("No objects were found with owner {0}", match); | 770 | // m_console.OutputFormat("No objects were found with owner {0}", match); |
736 | 771 | ||
737 | break; | 772 | break; |
738 | 773 | ||
739 | case "creator": | 774 | case "creator": |
740 | if (!UUID.TryParse(o, out match)) | 775 | if (!UUID.TryParse(o, out match)) |
741 | return; | 776 | return; |
@@ -747,12 +782,12 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
747 | if (g.RootPart.CreatorID == match && !g.IsAttachment) | 782 | if (g.RootPart.CreatorID == match && !g.IsAttachment) |
748 | deletes.Add(g); | 783 | deletes.Add(g); |
749 | }); | 784 | }); |
750 | 785 | ||
751 | // if (deletes.Count == 0) | 786 | // if (deletes.Count == 0) |
752 | // m_console.OutputFormat("No objects were found with creator {0}", match); | 787 | // m_console.OutputFormat("No objects were found with creator {0}", match); |
753 | 788 | ||
754 | break; | 789 | break; |
755 | 790 | ||
756 | case "id": | 791 | case "id": |
757 | UUID uuid; | 792 | UUID uuid; |
758 | uint localId; | 793 | uint localId; |
@@ -768,18 +803,21 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
768 | else | 803 | else |
769 | so = m_scene.GetSceneObjectGroup(localId); | 804 | so = m_scene.GetSceneObjectGroup(localId); |
770 | 805 | ||
771 | if (!so.IsAttachment) | 806 | if (so!= null) |
772 | deletes.Add(so); | 807 | { |
773 | 808 | deletes.Add(so); | |
774 | // if (deletes.Count == 0) | 809 | if(so.IsAttachment) |
775 | // m_console.OutputFormat("No objects were found with uuid {0}", match); | 810 | { |
776 | 811 | requireConfirmation = true; | |
812 | m_console.OutputFormat("Warning: object with uuid {0} is a attachment", uuid); | ||
813 | } | ||
814 | } | ||
777 | break; | 815 | break; |
778 | 816 | ||
779 | case "name": | 817 | case "name": |
780 | deletes = GetDeleteCandidatesByName(module, cmd); | 818 | deletes = GetDeleteCandidatesByName(module, cmd); |
781 | break; | 819 | break; |
782 | 820 | ||
783 | case "outside": | 821 | case "outside": |
784 | deletes = new List<SceneObjectGroup>(); | 822 | deletes = new List<SceneObjectGroup>(); |
785 | 823 | ||
@@ -787,7 +825,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
787 | { | 825 | { |
788 | SceneObjectPart rootPart = g.RootPart; | 826 | SceneObjectPart rootPart = g.RootPart; |
789 | bool delete = false; | 827 | bool delete = false; |
790 | 828 | ||
791 | if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0) | 829 | if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0) |
792 | { | 830 | { |
793 | delete = true; | 831 | delete = true; |
@@ -796,18 +834,18 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
796 | { | 834 | { |
797 | ILandObject parcel | 835 | ILandObject parcel |
798 | = m_scene.LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y); | 836 | = m_scene.LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y); |
799 | 837 | ||
800 | if (parcel == null || parcel.LandData.Name == "NO LAND") | 838 | if (parcel == null || parcel.LandData.Name == "NO LAND") |
801 | delete = true; | 839 | delete = true; |
802 | } | 840 | } |
803 | 841 | ||
804 | if (delete && !g.IsAttachment && !deletes.Contains(g)) | 842 | if (delete && !g.IsAttachment && !deletes.Contains(g)) |
805 | deletes.Add(g); | 843 | deletes.Add(g); |
806 | }); | 844 | }); |
807 | 845 | ||
808 | if (deletes.Count == 0) | 846 | if (deletes.Count == 0) |
809 | m_console.OutputFormat("No objects were found outside region bounds"); | 847 | m_console.OutputFormat("No objects were found outside region bounds"); |
810 | 848 | ||
811 | break; | 849 | break; |
812 | 850 | ||
813 | case "pos": | 851 | case "pos": |
@@ -829,7 +867,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
829 | "Are you sure that you want to delete {0} objects from {1}", | 867 | "Are you sure that you want to delete {0} objects from {1}", |
830 | deletes.Count, m_scene.RegionInfo.RegionName), | 868 | deletes.Count, m_scene.RegionInfo.RegionName), |
831 | "y/N"); | 869 | "y/N"); |
832 | 870 | ||
833 | if (response.ToLower() != "y") | 871 | if (response.ToLower() != "y") |
834 | { | 872 | { |
835 | MainConsole.Instance.OutputFormat( | 873 | MainConsole.Instance.OutputFormat( |
@@ -869,11 +907,11 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
869 | if (useRegex) | 907 | if (useRegex) |
870 | { | 908 | { |
871 | Regex nameRegex = new Regex(name); | 909 | Regex nameRegex = new Regex(name); |
872 | searchAction = so => { if (nameRegex.IsMatch(so.Name)) { sceneObjects.Add(so); }}; | 910 | searchAction = so => { if (nameRegex.IsMatch(so.Name)) {if(!so.IsAttachment) sceneObjects.Add(so);}}; |
873 | } | 911 | } |
874 | else | 912 | else |
875 | { | 913 | { |
876 | searchAction = so => { if (so.Name == name) { sceneObjects.Add(so); }}; | 914 | searchAction = so => { if (so.Name == name) {if(!so.IsAttachment) sceneObjects.Add(so);}}; |
877 | } | 915 | } |
878 | 916 | ||
879 | m_scene.ForEachSOG(searchAction); | 917 | m_scene.ForEachSOG(searchAction); |
@@ -916,11 +954,11 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
916 | { | 954 | { |
917 | m_console.OutputFormat("Error: Start vector '{0}' does not have a valid format", rawConsoleStartVector); | 955 | m_console.OutputFormat("Error: Start vector '{0}' does not have a valid format", rawConsoleStartVector); |
918 | endVector = Vector3.Zero; | 956 | endVector = Vector3.Zero; |
919 | 957 | ||
920 | return false; | 958 | return false; |
921 | } | 959 | } |
922 | 960 | ||
923 | string rawConsoleEndVector = rawComponents.Skip(2).Take(1).Single(); | 961 | string rawConsoleEndVector = rawComponents.Skip(1).Take(1).Single(); |
924 | 962 | ||
925 | if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector)) | 963 | if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector)) |
926 | { | 964 | { |