aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Tests
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-07-09 23:08:41 +0100
committerJustin Clark-Casey (justincc)2012-07-09 23:08:41 +0100
commitc8af20f966e005fb512869299d80be6b83cb70bf (patch)
treecdab2bc5b186b55c0ce8fcf51919eaca5f3bb5a1 /OpenSim/Region/ScriptEngine/Shared/Tests
parentDon't allow a prim to be sat upon if its part of an attachment (diff)
downloadopensim-SC_OLD-c8af20f966e005fb512869299d80be6b83cb70bf.zip
opensim-SC_OLD-c8af20f966e005fb512869299d80be6b83cb70bf.tar.gz
opensim-SC_OLD-c8af20f966e005fb512869299d80be6b83cb70bf.tar.bz2
opensim-SC_OLD-c8af20f966e005fb512869299d80be6b83cb70bf.tar.xz
This script allows an object to be attached directly from prim inventory to another avatar in the scene.
Very useful in serious game/environment scenarios where its only allowed for trusted creators. Threat level Severe
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Tests')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs53
1 files changed, 53 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
index 78db2c6..f5aa518 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
@@ -174,5 +174,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
174 List<AvatarAttachment> attachmentsInAppearance = sp.Appearance.GetAttachments(); 174 List<AvatarAttachment> attachmentsInAppearance = sp.Appearance.GetAttachments();
175 Assert.That(attachmentsInAppearance.Count, Is.EqualTo(0)); 175 Assert.That(attachmentsInAppearance.Count, Is.EqualTo(0));
176 } 176 }
177
178 [Test]
179 public void TestOsForceAttachToOtherAvatarFromInventory()
180 {
181 TestHelpers.InMethod();
182 TestHelpers.EnableLogging();
183
184 string taskInvObjItemName = "sphere";
185 UUID taskInvObjItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
186 AttachmentPoint attachPoint = AttachmentPoint.Chin;
187
188 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, "user", "one", 0x1, "pass");
189 UserAccount ua2 = UserAccountHelpers.CreateUserWithInventory(m_scene, "user", "two", 0x2, "pass");
190
191 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1);
192 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
193 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart);
194
195 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem);
196 OSSL_Api osslApi = new OSSL_Api();
197 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem);
198
199 // Create an object embedded inside the first
200 TaskInventoryHelpers.AddSceneObject(m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID);
201
202 ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2);
203
204 osslApi.osForceAttachToOtherAvatarFromInventory(sp2.UUID.ToString(), taskInvObjItemName, (int)attachPoint);
205
206 // Check scene presence status
207 Assert.That(sp.HasAttachments(), Is.False);
208 List<SceneObjectGroup> attachments = sp.GetAttachments();
209 Assert.That(attachments.Count, Is.EqualTo(0));
210
211 Assert.That(sp2.HasAttachments(), Is.True);
212 List<SceneObjectGroup> attachments2 = sp2.GetAttachments();
213 Assert.That(attachments2.Count, Is.EqualTo(1));
214 SceneObjectGroup attSo = attachments2[0];
215 Assert.That(attSo.Name, Is.EqualTo(taskInvObjItemName));
216 Assert.That(attSo.OwnerID, Is.EqualTo(ua2.PrincipalID));
217 Assert.That(attSo.AttachmentPoint, Is.EqualTo((uint)attachPoint));
218 Assert.That(attSo.IsAttachment);
219 Assert.That(attSo.UsesPhysics, Is.False);
220 Assert.That(attSo.IsTemporary, Is.False);
221
222 // Check appearance status
223 List<AvatarAttachment> attachmentsInAppearance = sp.Appearance.GetAttachments();
224 Assert.That(attachmentsInAppearance.Count, Is.EqualTo(0));
225
226 List<AvatarAttachment> attachmentsInAppearance2 = sp2.Appearance.GetAttachments();
227 Assert.That(attachmentsInAppearance2.Count, Is.EqualTo(1));
228 Assert.That(sp2.Appearance.GetAttachpoint(attachmentsInAppearance2[0].ItemID), Is.EqualTo((uint)attachPoint));
229 }
177 } 230 }
178} \ No newline at end of file 231} \ No newline at end of file