diff options
Diffstat (limited to 'OpenSim/Region')
7 files changed, 74 insertions, 7 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 5aa0f2e..e3efb42 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -242,6 +242,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
242 | private ObjectBuy handlerObjectBuy = null; | 242 | private ObjectBuy handlerObjectBuy = null; |
243 | //private BuyObjectInventory handlerBuyObjectInventory = null; | 243 | //private BuyObjectInventory handlerBuyObjectInventory = null; |
244 | private ObjectDeselect handlerObjectDetach = null; | 244 | private ObjectDeselect handlerObjectDetach = null; |
245 | private ObjectDrop handlerObjectDrop = null; | ||
245 | private AgentSit handlerOnUndo = null; | 246 | private AgentSit handlerOnUndo = null; |
246 | 247 | ||
247 | private ForceReleaseControls handlerForceReleaseControls = null; | 248 | private ForceReleaseControls handlerForceReleaseControls = null; |
@@ -848,6 +849,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
848 | public event UUIDNameRequest OnDetachAttachmentIntoInv; | 849 | public event UUIDNameRequest OnDetachAttachmentIntoInv; |
849 | public event ObjectAttach OnObjectAttach; | 850 | public event ObjectAttach OnObjectAttach; |
850 | public event ObjectDeselect OnObjectDetach; | 851 | public event ObjectDeselect OnObjectDetach; |
852 | public event ObjectDrop OnObjectDrop; | ||
851 | public event GenericCall2 OnCompleteMovementToRegion; | 853 | public event GenericCall2 OnCompleteMovementToRegion; |
852 | public event UpdateAgent OnAgentUpdate; | 854 | public event UpdateAgent OnAgentUpdate; |
853 | public event AgentRequestSit OnAgentRequestSit; | 855 | public event AgentRequestSit OnAgentRequestSit; |
@@ -4296,6 +4298,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4296 | } | 4298 | } |
4297 | 4299 | ||
4298 | break; | 4300 | break; |
4301 | case PacketType.ObjectDrop: | ||
4302 | ObjectDropPacket dropp = (ObjectDropPacket)Pack; | ||
4303 | for (int j = 0; j < dropp.ObjectData.Length; j++) | ||
4304 | { | ||
4305 | uint obj = dropp.ObjectData[j].ObjectLocalID; | ||
4306 | handlerObjectDrop = OnObjectDrop; | ||
4307 | if (handlerObjectDrop != null) | ||
4308 | { | ||
4309 | handlerObjectDrop(obj, this); | ||
4310 | } | ||
4311 | } | ||
4312 | break; | ||
4299 | case PacketType.SetAlwaysRun: | 4313 | case PacketType.SetAlwaysRun: |
4300 | SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack; | 4314 | SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack; |
4301 | 4315 | ||
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 33eade2..3d3d41c 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs | |||
@@ -171,6 +171,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC | |||
171 | public event UUIDNameRequest OnDetachAttachmentIntoInv; | 171 | public event UUIDNameRequest OnDetachAttachmentIntoInv; |
172 | public event ObjectAttach OnObjectAttach; | 172 | public event ObjectAttach OnObjectAttach; |
173 | public event ObjectDeselect OnObjectDetach; | 173 | public event ObjectDeselect OnObjectDetach; |
174 | public event ObjectDrop OnObjectDrop; | ||
174 | public event StartAnim OnStartAnim; | 175 | public event StartAnim OnStartAnim; |
175 | public event StopAnim OnStopAnim; | 176 | public event StopAnim OnStopAnim; |
176 | public event LinkObjects OnLinkObjects; | 177 | public event LinkObjects OnLinkObjects; |
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 | } |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index fa6ff22..c8d542c 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -66,6 +66,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
66 | public event UUIDNameRequest OnDetachAttachmentIntoInv; | 66 | public event UUIDNameRequest OnDetachAttachmentIntoInv; |
67 | public event ObjectAttach OnObjectAttach; | 67 | public event ObjectAttach OnObjectAttach; |
68 | public event ObjectDeselect OnObjectDetach; | 68 | public event ObjectDeselect OnObjectDetach; |
69 | public event ObjectDrop OnObjectDrop; | ||
69 | public event StartAnim OnStartAnim; | 70 | public event StartAnim OnStartAnim; |
70 | public event StopAnim OnStopAnim; | 71 | public event StopAnim OnStopAnim; |
71 | public event LinkObjects OnLinkObjects; | 72 | public event LinkObjects OnLinkObjects; |