aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
diff options
context:
space:
mode:
authorMW2007-08-21 21:03:18 +0000
committerMW2007-08-21 21:03:18 +0000
commit921ac14e86fab329c3135b24b2a1be83813fce1b (patch)
tree867f42c3f5b9984b2281df2e6b40f7f56349d297 /OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
parentchanged the comment lines from # to ; in opensim.ini. (diff)
downloadopensim-SC-921ac14e86fab329c3135b24b2a1be83813fce1b.zip
opensim-SC-921ac14e86fab329c3135b24b2a1be83813fce1b.tar.gz
opensim-SC-921ac14e86fab329c3135b24b2a1be83813fce1b.tar.bz2
opensim-SC-921ac14e86fab329c3135b24b2a1be83813fce1b.tar.xz
Added OnRezScript event to Scene.EventManager.Which the script engine should subscribe to. This is triggered whenever a script is moved into a primitive (and includes the localid of the prim and the script text as params) . Currently though the script item isn't deleted from a users inventory, nor does it actually show up in the objects inventory (this will be fixed soon.) So that means that it isn't currently possible to edit a script (or delete it) once it has been added to a primitive.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs44
1 files changed, 42 insertions, 2 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 3e2a97a..765fafc 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -111,8 +111,8 @@ namespace OpenSim.Region.Environment.Scenes
111 { 111 {
112 asset.Name = item.inventoryName; 112 asset.Name = item.inventoryName;
113 asset.Description = item.inventoryDescription; 113 asset.Description = item.inventoryDescription;
114 asset.InvType = (sbyte) item.invType; 114 asset.InvType = (sbyte)item.invType;
115 asset.Type = (sbyte) item.assetType; 115 asset.Type = (sbyte)item.assetType;
116 item.assetID = asset.FullID; 116 item.assetID = asset.FullID;
117 117
118 if (addToCache) 118 if (addToCache)
@@ -205,6 +205,44 @@ namespace OpenSim.Region.Environment.Scenes
205 } 205 }
206 } 206 }
207 207
208 public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID)
209 {
210 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
211 if (userInfo != null)
212 {
213 if (userInfo.RootFolder != null)
214 {
215 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
216 if (item != null)
217 {
218 bool isTexture = false;
219 if (item.invType == 0)
220 {
221 isTexture = true;
222 }
223 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
224 if (rezAsset != null)
225 {
226 string script = Util.FieldToString(rezAsset.Data);
227 //Console.WriteLine("rez script "+script);
228 this.EventManager.TriggerRezScript(localID, script);
229 }
230 else
231 {
232 //lets try once more incase the asset cache is being slow getting the asset from server
233 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
234 if (rezAsset != null)
235 {
236 string script = Util.FieldToString(rezAsset.Data);
237 // Console.WriteLine("rez script " + script);
238 this.EventManager.TriggerRezScript(localID, script);
239 }
240 }
241 }
242 }
243 }
244 }
245
208 /// <summary> 246 /// <summary>
209 /// 247 ///
210 /// </summary> 248 /// </summary>
@@ -320,6 +358,8 @@ namespace OpenSim.Region.Environment.Scenes
320 this.AddEntity(group); 358 this.AddEntity(group);
321 group.AbsolutePosition = pos; 359 group.AbsolutePosition = pos;
322 } 360 }
361
362
323 } 363 }
324 364
325} 365}