aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/InnerScene.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-04-27 20:10:28 +0000
committerTeravus Ovares2008-04-27 20:10:28 +0000
commit911e63765c7cea748b5ae2227f5c1d6ff131d329 (patch)
treef95eeffb4974a9b3f6ded4a46bdc240278a336b0 /OpenSim/Region/Environment/Scenes/InnerScene.cs
parentMinor svn, formatting cleanup. (diff)
downloadopensim-SC-911e63765c7cea748b5ae2227f5c1d6ff131d329.zip
opensim-SC-911e63765c7cea748b5ae2227f5c1d6ff131d329.tar.gz
opensim-SC-911e63765c7cea748b5ae2227f5c1d6ff131d329.tar.bz2
opensim-SC-911e63765c7cea748b5ae2227f5c1d6ff131d329.tar.xz
* Single Attachments now work from inventory. You can attach from inventory and detach from inventory.
* Detaching from right clicking in world, detaches to your inventory. * If you go up to a prim and attach it from in world, it appears in your inventory. * Attachment placement is saved when you detach them. * Choosing wear remembers your last attachment point from inventory. * Wrote a method to update an inventory item's asset and sends the updated inventory item to the Client * Wrote a recursive method to find the folder of a known existing inventory item. * Removed a block on physics object position on creation. This might crash a region or two, let us know via Mantis if your region crashes because of a physics out of bounds error. * Drop doesn't work. The menu item doesn't even come up. Don't know why :P.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/InnerScene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs70
1 files changed, 57 insertions, 13 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index e76cf70..104ae48 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -304,7 +304,9 @@ namespace OpenSim.Region.Environment.Scenes
304 if (((SceneObjectGroup)obj).LocalId == objectLocalID) 304 if (((SceneObjectGroup)obj).LocalId == objectLocalID)
305 { 305 {
306 SceneObjectGroup group = (SceneObjectGroup)obj; 306 SceneObjectGroup group = (SceneObjectGroup)obj;
307 group.DetachToGround(); 307
308 //group.DetachToGround();
309 DetachSingleAttachmentToInv(group.GetFromAssetID(),remoteClient);
308 } 310 }
309 } 311 }
310 } 312 }
@@ -339,6 +341,33 @@ namespace OpenSim.Region.Environment.Scenes
339 341
340 } 342 }
341 343
344 // What makes this method odd and unique is it tries to detach using an LLUUID.... Yay for standards.
345 // To LocalId or LLUUID, *THAT* is the question. How now Brown LLUUID??
346 public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient)
347 {
348
349 if (itemID == LLUUID.Zero) // If this happened, someone made a mistake....
350 return;
351
352 List<EntityBase> EntityList = GetEntities();
353
354 foreach (EntityBase obj in EntityList)
355 {
356 if (obj is SceneObjectGroup)
357 {
358 if (((SceneObjectGroup)obj).GetFromAssetID() == itemID)
359 {
360 SceneObjectGroup group = (SceneObjectGroup)obj;
361 group.DetachToInventoryPrep();
362 m_log.Debug("[DETACH]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
363 m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(),group.OwnerID);
364 m_parentScene.DeleteSceneObjectGroup(group);
365 }
366 }
367 }
368
369 }
370
342 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot, LLVector3 attachPos) 371 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot, LLVector3 attachPos)
343 { 372 {
344 List<EntityBase> EntityList = GetEntities(); 373 List<EntityBase> EntityList = GetEntities();
@@ -349,21 +378,36 @@ namespace OpenSim.Region.Environment.Scenes
349 if (((SceneObjectGroup)obj).LocalId == objectLocalID) 378 if (((SceneObjectGroup)obj).LocalId == objectLocalID)
350 { 379 {
351 SceneObjectGroup group = (SceneObjectGroup)obj; 380 SceneObjectGroup group = (SceneObjectGroup)obj;
381
382 // If the attachment point isn't the same as the one previously used
383 // set it's offset position = 0 so that it appears on the attachment point
384 // and not in a weird location somewhere unknown.
385 if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
386 {
387
388 attachPos = LLVector3.Zero;
389 }
390
391 // AttachmentPt 0 means the client chose to 'wear' the attachment.
352 if (AttachmentPt == 0) 392 if (AttachmentPt == 0)
353 { 393 {
394
354 // Check object for stored attachment point 395 // Check object for stored attachment point
355 AttachmentPt = (uint)group.GetAttachmentPoint(); 396 AttachmentPt = (uint)group.GetAttachmentPoint();
397
356 398
399 }
357 400
358 // if we still didn't find a suitable attachment point....... 401 // if we still didn't find a suitable attachment point.......
359 if (AttachmentPt == 0) 402 if (AttachmentPt == 0)
360 { 403 {
361 AttachmentPt = (uint)AttachmentPoint.LeftHand; 404 // Stick it on left hand with Zero Offset from the attachment point.
362 attachPos = LLVector3.Zero; 405 AttachmentPt = (uint)AttachmentPoint.LeftHand;
363 } 406 attachPos = LLVector3.Zero;
364
365
366 } 407 }
408 m_log.Debug("[ATTACH]: Using attachpoint: " + AttachmentPt.ToString());
409
410
367 411
368 // Saves and gets assetID 412 // Saves and gets assetID
369 if (group.GetFromAssetID() == LLUUID.Zero) 413 if (group.GetFromAssetID() == LLUUID.Zero)
@@ -1071,12 +1115,12 @@ namespace OpenSim.Region.Environment.Scenes
1071 if (group != null) 1115 if (group != null)
1072 { 1116 {
1073 LLVector3 oldPos = group.AbsolutePosition; 1117 LLVector3 oldPos = group.AbsolutePosition;
1074 if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos)) 1118 if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment)
1075 { 1119 {
1076 group.SendGroupTerseUpdate(); 1120 group.SendGroupTerseUpdate();
1077 return; 1121 return;
1078 } 1122 }
1079 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) 1123 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment)
1080 { 1124 {
1081 group.UpdateSinglePosition(pos, localID); 1125 group.UpdateSinglePosition(pos, localID);
1082 } 1126 }
@@ -1102,12 +1146,12 @@ namespace OpenSim.Region.Environment.Scenes
1102 } 1146 }
1103 else 1147 else
1104 { 1148 {
1105 if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos)) 1149 if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment)
1106 { 1150 {
1107 group.SendGroupTerseUpdate(); 1151 group.SendGroupTerseUpdate();
1108 return; 1152 return;
1109 } 1153 }
1110 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) 1154 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment)
1111 { 1155 {
1112 group.UpdateGroupPosition(pos); 1156 group.UpdateGroupPosition(pos);
1113 } 1157 }