aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs21
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs31
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs12
4 files changed, 58 insertions, 7 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 65fa544..869111c 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -358,6 +358,24 @@ namespace OpenSim.Region.Environment.Scenes
358 m_activeScripts += number; 358 m_activeScripts += number;
359 } 359 }
360 360
361 protected internal void DropObject(uint objectLocalID, IClientAPI remoteClient)
362 {
363 List<EntityBase> EntityList = GetEntities();
364
365 foreach (EntityBase obj in EntityList)
366 {
367 if (obj is SceneObjectGroup)
368 {
369 if (((SceneObjectGroup)obj).LocalId == objectLocalID)
370 {
371 SceneObjectGroup group = (SceneObjectGroup)obj;
372
373 m_parentScene.DetachSingleAttachmentToGround(group.UUID,remoteClient);
374 }
375 }
376 }
377 }
378
361 protected internal void DetachObject(uint objectLocalID, IClientAPI remoteClient) 379 protected internal void DetachObject(uint objectLocalID, IClientAPI remoteClient)
362 { 380 {
363 List<EntityBase> EntityList = GetEntities(); 381 List<EntityBase> EntityList = GetEntities();
@@ -441,10 +459,11 @@ namespace OpenSim.Region.Environment.Scenes
441 (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer), 459 (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer),
442 (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer), 460 (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer),
443 ItemFlags, false, false, remoteClient.AgentId, true); 461 ItemFlags, false, false, remoteClient.AgentId, true);
444 objatt.SetAttachmentPoint(Convert.ToByte(AttachmentPt));
445 462
446 if (objatt != null) 463 if (objatt != null)
447 { 464 {
465 objatt.SetAttachmentPoint(Convert.ToByte(AttachmentPt));
466
448 AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition); 467 AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition);
449 objatt.ScheduleGroupForFullUpdate(); 468 objatt.ScheduleGroupForFullUpdate();
450 } 469 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index a7bce49..c139fd9 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -2293,6 +2293,37 @@ namespace OpenSim.Region.Environment.Scenes
2293 m_innerScene.AttachObject(controllingClient, localID, attachPoint, rot, pos); 2293 m_innerScene.AttachObject(controllingClient, localID, attachPoint, rot, pos);
2294 } 2294 }
2295 2295
2296 public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient)
2297 {
2298 SceneObjectPart part = GetSceneObjectPart(itemID);
2299 if(part == null || part.ParentGroup == null)
2300 return;
2301
2302 UUID inventoryID = part.ParentGroup.GetFromAssetID();
2303
2304 ScenePresence presence;
2305 if (TryGetAvatar(remoteClient.AgentId, out presence))
2306 {
2307 if(!ExternalChecks.ExternalChecksCanRezObject(part.ParentGroup.Children.Count, remoteClient.AgentId, presence.AbsolutePosition))
2308 return;
2309
2310 presence.Appearance.DetachAttachment(itemID);
2311 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>();
2312 if (ava != null)
2313 {
2314 ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
2315 }
2316 part.ParentGroup.DetachToGround();
2317 CachedUserInfo userInfo =
2318 CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
2319 if (userInfo != null)
2320 {
2321 userInfo.DeleteItem(inventoryID);
2322 remoteClient.SendRemoveInventoryItem(inventoryID);
2323 }
2324 }
2325 }
2326
2296 public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) 2327 public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient)
2297 { 2328 {
2298 ScenePresence presence; 2329 ScenePresence presence;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 5ab40cc..f90c6fb 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2172,6 +2172,7 @@ namespace OpenSim.Region.Environment.Scenes
2172 client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv; 2172 client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv;
2173 client.OnObjectAttach += m_innerScene.AttachObject; 2173 client.OnObjectAttach += m_innerScene.AttachObject;
2174 client.OnObjectDetach += m_innerScene.DetachObject; 2174 client.OnObjectDetach += m_innerScene.DetachObject;
2175 client.OnObjectDrop += m_innerScene.DropObject;
2175 client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; 2176 client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest;
2176 client.OnObjectDescription += m_innerScene.PrimDescription; 2177 client.OnObjectDescription += m_innerScene.PrimDescription;
2177 client.OnObjectName += m_innerScene.PrimName; 2178 client.OnObjectName += m_innerScene.PrimName;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 6cd0bae..18322ee 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -766,19 +766,19 @@ namespace OpenSim.Region.Environment.Scenes
766 { 766 {
767 ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar); 767 ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar);
768 Vector3 detachedpos = new Vector3(127f,127f,127f); 768 Vector3 detachedpos = new Vector3(127f,127f,127f);
769 if (avatar != null) 769 if (avatar == null)
770 { 770 return;
771 detachedpos = avatar.AbsolutePosition; 771
772 avatar.RemoveAttachment(this); 772 detachedpos = avatar.AbsolutePosition;
773 } 773
774 AbsolutePosition = detachedpos; 774 AbsolutePosition = detachedpos;
775 m_rootPart.AttachedAvatar = UUID.Zero; 775 m_rootPart.AttachedAvatar = UUID.Zero;
776 m_rootPart.SetParentLocalId(0); 776 m_rootPart.SetParentLocalId(0);
777 SetAttachmentPoint((byte)0); 777 SetAttachmentPoint((byte)0);
778 m_rootPart.IsAttachment = false;
779 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); 778 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim);
780 HasGroupChanged = true; 779 HasGroupChanged = true;
781 AttachToBackup(); 780 AttachToBackup();
781 m_scene.EventManager.TriggerParcelPrimCountTainted();
782 m_rootPart.ScheduleFullUpdate(); 782 m_rootPart.ScheduleFullUpdate();
783 m_rootPart.ClearUndoState(); 783 m_rootPart.ClearUndoState();
784 } 784 }