aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorSignpostMarv2012-07-31 14:45:23 +0100
committerJustin Clark-Casey (justincc)2012-10-02 22:14:46 +0100
commit35b7c80e0ba876649c606d5d047fcb59754372ea (patch)
tree127ca02385e606d3c6dea61fe9646104c410409a /OpenSim
parentstring format arguments in wrong order (diff)
downloadopensim-SC_OLD-35b7c80e0ba876649c606d5d047fcb59754372ea.zip
opensim-SC_OLD-35b7c80e0ba876649c606d5d047fcb59754372ea.tar.gz
opensim-SC_OLD-35b7c80e0ba876649c606d5d047fcb59754372ea.tar.bz2
opensim-SC_OLD-35b7c80e0ba876649c606d5d047fcb59754372ea.tar.xz
implementing osDropAttachment & osDropAttachmentAt
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs11
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs33
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs10
5 files changed, 72 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 130c869..2a513e9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -407,6 +407,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
407 407
408 public void DetachSingleAttachmentToGround(IScenePresence sp, uint soLocalId) 408 public void DetachSingleAttachmentToGround(IScenePresence sp, uint soLocalId)
409 { 409 {
410 DetachSingleAttachmentToGround(sp, soLocalId, sp.AbsolutePosition, Quaternion.Identity);
411 }
412
413 public void DetachSingleAttachmentToGround(IScenePresence sp, uint soLocalId, Vector3 absolutePos, Quaternion absoluteRot)
414 {
410 if (!Enabled) 415 if (!Enabled)
411 return; 416 return;
412 417
@@ -448,7 +453,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
448 so.FromItemID = UUID.Zero; 453 so.FromItemID = UUID.Zero;
449 454
450 SceneObjectPart rootPart = so.RootPart; 455 SceneObjectPart rootPart = so.RootPart;
451 so.AbsolutePosition = sp.AbsolutePosition; 456 so.AbsolutePosition = absolutePos;
457 if (absoluteRot != Quaternion.Identity)
458 {
459 so.UpdateGroupRotationR(absoluteRot);
460 }
452 so.AttachedAvatar = UUID.Zero; 461 so.AttachedAvatar = UUID.Zero;
453 rootPart.SetParentLocalId(0); 462 rootPart.SetParentLocalId(0);
454 so.ClearPartAttachmentData(); 463 so.ClearPartAttachmentData();
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 8155eab..620ec22 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -109,6 +109,15 @@ namespace OpenSim.Region.Framework.Interfaces
109 void DetachSingleAttachmentToGround(IScenePresence sp, uint objectLocalID); 109 void DetachSingleAttachmentToGround(IScenePresence sp, uint objectLocalID);
110 110
111 /// <summary> 111 /// <summary>
112 /// Detach the given item to the ground at the specified coordinates & rotation
113 /// </summary>
114 /// <param name="sp"></param>
115 /// <param name="objectLocalID"></param>
116 /// <param name="absolutePos"></param>
117 /// <param name="absoluteRot"></param>
118 void DetachSingleAttachmentToGround(IScenePresence sp, uint objectLocalID, Vector3 absolutePos, Quaternion absoluteRot);
119
120 /// <summary>
112 /// Detach the given attachment so that it remains in the user's inventory. 121 /// Detach the given attachment so that it remains in the user's inventory.
113 /// </summary> 122 /// </summary>
114 /// <param name="sp">/param> 123 /// <param name="sp">/param>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 8b73cd9..fec8a67 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3549,6 +3549,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3549 if (m_UrlModule != null) 3549 if (m_UrlModule != null)
3550 m_UrlModule.HttpContentType(new UUID(id),type); 3550 m_UrlModule.HttpContentType(new UUID(id),type);
3551 } 3551 }
3552 3552
3553 } 3553 public void osDropAttachment()
3554 {
3555 CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment");
3556 m_host.AddScriptLPS(1);
3557
3558 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3559 ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID);
3560
3561 if (attachmentsModule != null && sp != null)
3562 {
3563 attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId);
3564 }
3565 }
3566
3567 public void osDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot)
3568 {
3569 CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment");
3570 m_host.AddScriptLPS(1);
3571
3572 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3573 ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID);
3574
3575 if (attachmentsModule != null && sp != null)
3576 {
3577 Vector3 omvPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
3578 Quaternion omvRot = LSL_Api.Rot2Quaternion(rot);
3579 attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId, omvPos, omvRot);
3580 }
3581 }
3582 }
3554} \ No newline at end of file 3583} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 3985e66..e28473d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -394,5 +394,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
394 /// </summary> 394 /// </summary>
395 /// <returns></returns> 395 /// <returns></returns>
396 void osSetContentType(LSL_Key id, string type); 396 void osSetContentType(LSL_Key id, string type);
397
398 /// <summary>
399 /// Attempts to drop an attachment to the ground
400 /// </summary>
401 void osDropAttachment();
402
403 /// <summary>
404 /// Attempts to drop an attachment at the specified coordinates.
405 /// </summary>
406 /// <param name="pos"></param>
407 /// <param name="rot"></param>
408 void osDropAttachmentAt(vector pos, rotation rot);
397 } 409 }
398} 410}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 52ca3da..bae5594 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -972,5 +972,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
972 { 972 {
973 m_OSSL_Functions.osSetContentType(id,type); 973 m_OSSL_Functions.osSetContentType(id,type);
974 } 974 }
975
976 public void osDropAttachment()
977 {
978 m_OSSL_Functions.osDropAttachment();
979 }
980
981 public void osDropAttachmentAt(vector pos, rotation rot)
982 {
983 m_OSSL_Functions.osDropAttachmentAt(pos, rot);
984 }
975 } 985 }
976} 986}