diff options
author | MW | 2007-08-21 21:03:18 +0000 |
---|---|---|
committer | MW | 2007-08-21 21:03:18 +0000 |
commit | 921ac14e86fab329c3135b24b2a1be83813fce1b (patch) | |
tree | 867f42c3f5b9984b2281df2e6b40f7f56349d297 /OpenSim/Region/Environment | |
parent | changed the comment lines from # to ; in opensim.ini. (diff) | |
download | opensim-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')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 44 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneEvents.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 9 |
4 files changed, 63 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 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index cdf6788..d625dec 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -711,6 +711,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
711 | client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest; | 711 | client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest; |
712 | client.OnXferReceive += commsManager.TransactionsManager.HandleXfer; | 712 | client.OnXferReceive += commsManager.TransactionsManager.HandleXfer; |
713 | // client.OnRequestXfer += RequestXfer; | 713 | // client.OnRequestXfer += RequestXfer; |
714 | client.OnRezScript += RezScript; | ||
714 | 715 | ||
715 | client.OnRequestAvatarProperties += RequestAvatarProperty; | 716 | client.OnRequestAvatarProperties += RequestAvatarProperty; |
716 | 717 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index 050207c..89aeda6 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs | |||
@@ -37,6 +37,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
37 | public event ObjectGrabDelegate OnObjectGrab; | 37 | public event ObjectGrabDelegate OnObjectGrab; |
38 | public event OnPermissionErrorDelegate OnPermissionError; | 38 | public event OnPermissionErrorDelegate OnPermissionError; |
39 | 39 | ||
40 | public delegate void NewRezScript(uint localID, string script); | ||
41 | public event NewRezScript OnRezScript; | ||
42 | |||
40 | 43 | ||
41 | public void TriggerPermissionError(LLUUID user, string reason) | 44 | public void TriggerPermissionError(LLUUID user, string reason) |
42 | { | 45 | { |
@@ -106,5 +109,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
106 | if (OnObjectGrab != null) | 109 | if (OnObjectGrab != null) |
107 | OnObjectGrab(localID, offsetPos, remoteClient); | 110 | OnObjectGrab(localID, offsetPos, remoteClient); |
108 | } | 111 | } |
112 | |||
113 | public void TriggerRezScript(uint localID, string script) | ||
114 | { | ||
115 | if (OnRezScript != null) | ||
116 | { | ||
117 | OnRezScript(localID, script); | ||
118 | } | ||
119 | } | ||
109 | } | 120 | } |
110 | } | 121 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index de3ad38..904b158 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -396,6 +396,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
396 | #endregion | 396 | #endregion |
397 | 397 | ||
398 | #region Inventory | 398 | #region Inventory |
399 | public void AddInventoryItem() | ||
400 | { | ||
401 | |||
402 | } | ||
403 | |||
404 | public void RemoveInventoryItem() | ||
405 | { | ||
406 | |||
407 | } | ||
399 | /// <summary> | 408 | /// <summary> |
400 | /// | 409 | /// |
401 | /// </summary> | 410 | /// </summary> |