aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
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/Common/Helpers/TaskInventoryHelpers.cs
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 '')
-rw-r--r--OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs47
1 files changed, 42 insertions, 5 deletions
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>