aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-07-05 00:05:06 +0100
committerJustin Clark-Casey (justincc)2012-07-05 00:05:06 +0100
commit951b45b80fd504b4874b9ec3e0fbff49a25cb46f (patch)
tree29b59d97d8b8ce8ee00227c41227d824d6694efa /OpenSim/Tests
parentUse GetInventoryItem() in llRezAtRoot rather than iterating through a cloned ... (diff)
downloadopensim-SC-951b45b80fd504b4874b9ec3e0fbff49a25cb46f.zip
opensim-SC-951b45b80fd504b4874b9ec3e0fbff49a25cb46f.tar.gz
opensim-SC-951b45b80fd504b4874b9ec3e0fbff49a25cb46f.tar.bz2
opensim-SC-951b45b80fd504b4874b9ec3e0fbff49a25cb46f.tar.xz
Add OSSL function osForceAttachToAvatarFromInventory()
This works like osForceAttachToAvatar() but allows an object to be directly specified from the script object's inventory rather than forcing it to be rezzed in the scene first. Still only attaches objects to the owner of the script. This allows one to bypass the complicated co-ordination of first rezzing objects in the scene before attaching them. Threat level high.
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs10
-rw-r--r--OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs47
2 files changed, 47 insertions, 10 deletions
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index 239afc0..3a2e420 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -564,7 +564,7 @@ namespace OpenSim.Tests.Common
564 /// </summary> 564 /// </summary>
565 /// <param name="scene"></param> 565 /// <param name="scene"></param>
566 /// <returns></returns> 566 /// <returns></returns>
567 public static SceneObjectPart AddSceneObject(Scene scene) 567 public static SceneObjectGroup AddSceneObject(Scene scene)
568 { 568 {
569 return AddSceneObject(scene, "Test Object", UUID.Zero); 569 return AddSceneObject(scene, "Test Object", UUID.Zero);
570 } 570 }
@@ -576,16 +576,16 @@ namespace OpenSim.Tests.Common
576 /// <param name="name"></param> 576 /// <param name="name"></param>
577 /// <param name="ownerId"></param> 577 /// <param name="ownerId"></param>
578 /// <returns></returns> 578 /// <returns></returns>
579 public static SceneObjectPart AddSceneObject(Scene scene, string name, UUID ownerId) 579 public static SceneObjectGroup AddSceneObject(Scene scene, string name, UUID ownerId)
580 { 580 {
581 SceneObjectPart part = CreateSceneObjectPart(name, UUID.Random(), ownerId); 581 SceneObjectGroup so = new SceneObjectGroup(CreateSceneObjectPart(name, UUID.Random(), ownerId));
582 582
583 //part.UpdatePrimFlags(false, false, true); 583 //part.UpdatePrimFlags(false, false, true);
584 //part.ObjectFlags |= (uint)PrimFlags.Phantom; 584 //part.ObjectFlags |= (uint)PrimFlags.Phantom;
585 585
586 scene.AddNewSceneObject(new SceneObjectGroup(part), false); 586 scene.AddNewSceneObject(so, false);
587 587
588 return part; 588 return so;
589 } 589 }
590 590
591 /// <summary> 591 /// <summary>
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
index 7058d1e..9607f1f 100644
--- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
@@ -45,20 +45,23 @@ namespace OpenSim.Tests.Common
45 /// </summary> 45 /// </summary>
46 /// <param name="scene"></param> 46 /// <param name="scene"></param>
47 /// <param name="part"></param> 47 /// <param name="part"></param>
48 /// <param name="itemName"></param>
49 /// <param name="itemID"></param>
50 /// <param name="assetID"></param>
48 /// <returns>The item that was added</returns> 51 /// <returns>The item that was added</returns>
49 public static TaskInventoryItem AddNotecard(Scene scene, SceneObjectPart part) 52 public static TaskInventoryItem AddNotecard(Scene scene, SceneObjectPart part, string itemName, UUID itemID, UUID assetID)
50 { 53 {
51 AssetNotecard nc = new AssetNotecard(); 54 AssetNotecard nc = new AssetNotecard();
52 nc.BodyText = "Hello World!"; 55 nc.BodyText = "Hello World!";
53 nc.Encode(); 56 nc.Encode();
54 UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); 57
55 UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
56 AssetBase ncAsset 58 AssetBase ncAsset
57 = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); 59 = AssetHelpers.CreateAsset(assetID, AssetType.Notecard, nc.AssetData, UUID.Zero);
58 scene.AssetService.Store(ncAsset); 60 scene.AssetService.Store(ncAsset);
61
59 TaskInventoryItem ncItem 62 TaskInventoryItem ncItem
60 = new TaskInventoryItem 63 = new TaskInventoryItem
61 { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid, 64 { Name = itemName, AssetID = assetID, ItemID = itemID,
62 Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard }; 65 Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard };
63 part.Inventory.AddInventoryItem(ncItem, true); 66 part.Inventory.AddInventoryItem(ncItem, true);
64 67
@@ -66,8 +69,42 @@ namespace OpenSim.Tests.Common
66 } 69 }
67 70
68 /// <summary> 71 /// <summary>
72 /// Add a blank script to the given part.
73 /// </summary>
74 /// <remarks>
75 /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these
76 /// functions more than once in a test.
77 /// </remarks>
78 /// <param name="scene"></param>
79 /// <param name="part"></param>
80 /// <returns>The item that was added</returns>
81 public static TaskInventoryItem AddScript(Scene scene, SceneObjectPart part)
82 {
83 AssetScriptText ast = new AssetScriptText();
84 ast.Encode();
85
86 UUID assetUuid = new UUID("00000000-0000-0000-1000-000000000000");
87 UUID itemUuid = new UUID("00000000-0000-0000-1100-000000000000");
88 AssetBase asset
89 = AssetHelpers.CreateAsset(assetUuid, AssetType.LSLText, ast.AssetData, UUID.Zero);
90 scene.AssetService.Store(asset);
91 TaskInventoryItem item
92 = new TaskInventoryItem
93 { Name = "scriptItem", AssetID = assetUuid, ItemID = itemUuid,
94 Type = (int)AssetType.LSLText, InvType = (int)InventoryType.LSL };
95 part.Inventory.AddInventoryItem(item, true);
96
97 return item;
98 }
99
100 /// <summary>
69 /// Add a scene object item to the given part. 101 /// Add a scene object item to the given part.
70 /// </summary> 102 /// </summary>
103 /// <remarks>
104 /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these
105 /// functions more than once in a test.
106 /// </remarks>
107 ///
71 /// <param name="scene"></param> 108 /// <param name="scene"></param>
72 /// <param name="sop"></param> 109 /// <param name="sop"></param>
73 /// <param name="itemName"></param> 110 /// <param name="itemName"></param>