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 | |
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 '')
-rw-r--r-- | OpenSim/Framework/General/Interfaces/IClientAPI.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/General/NullClientAPI.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.API.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | 5 | ||||
-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 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 1 |
9 files changed, 73 insertions, 2 deletions
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index 8337a81..e30a49c 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs | |||
@@ -88,6 +88,7 @@ namespace OpenSim.Framework.Interfaces | |||
88 | public delegate void FetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID); | 88 | public delegate void FetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID); |
89 | public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID); | 89 | public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID); |
90 | public delegate void UpdateInventoryItemTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID); | 90 | public delegate void UpdateInventoryItemTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID); |
91 | public delegate void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID); | ||
91 | 92 | ||
92 | public delegate void UDPAssetUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data); | 93 | public delegate void UDPAssetUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data); |
93 | public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data); | 94 | public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data); |
@@ -146,6 +147,7 @@ namespace OpenSim.Framework.Interfaces | |||
146 | event UDPAssetUploadRequest OnAssetUploadRequest; | 147 | event UDPAssetUploadRequest OnAssetUploadRequest; |
147 | event XferReceive OnXferReceive; | 148 | event XferReceive OnXferReceive; |
148 | event RequestXfer OnRequestXfer; | 149 | event RequestXfer OnRequestXfer; |
150 | event RezScript OnRezScript; | ||
149 | 151 | ||
150 | event UUIDNameRequest OnNameFromUUIDRequest; | 152 | event UUIDNameRequest OnNameFromUUIDRequest; |
151 | 153 | ||
diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs index e6749fc..55a3f0b 100644 --- a/OpenSim/Framework/General/NullClientAPI.cs +++ b/OpenSim/Framework/General/NullClientAPI.cs | |||
@@ -62,6 +62,7 @@ namespace OpenSim.Framework | |||
62 | public event UDPAssetUploadRequest OnAssetUploadRequest; | 62 | public event UDPAssetUploadRequest OnAssetUploadRequest; |
63 | public event XferReceive OnXferReceive; | 63 | public event XferReceive OnXferReceive; |
64 | public event RequestXfer OnRequestXfer; | 64 | public event RequestXfer OnRequestXfer; |
65 | public event RezScript OnRezScript; | ||
65 | 66 | ||
66 | public event UUIDNameRequest OnNameFromUUIDRequest; | 67 | public event UUIDNameRequest OnNameFromUUIDRequest; |
67 | 68 | ||
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 8729b58..cee18fe 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs | |||
@@ -91,6 +91,7 @@ namespace OpenSim.Region.ClientStack | |||
91 | public event UDPAssetUploadRequest OnAssetUploadRequest; | 91 | public event UDPAssetUploadRequest OnAssetUploadRequest; |
92 | public event XferReceive OnXferReceive; | 92 | public event XferReceive OnXferReceive; |
93 | public event RequestXfer OnRequestXfer; | 93 | public event RequestXfer OnRequestXfer; |
94 | public event RezScript OnRezScript; | ||
94 | 95 | ||
95 | public event UUIDNameRequest OnNameFromUUIDRequest; | 96 | public event UUIDNameRequest OnNameFromUUIDRequest; |
96 | 97 | ||
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 592254a..579b824 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | |||
@@ -472,6 +472,11 @@ namespace OpenSim.Region.ClientStack | |||
472 | break; | 472 | break; |
473 | case PacketType.RezScript: | 473 | case PacketType.RezScript: |
474 | //Console.WriteLine(Pack.ToString()); | 474 | //Console.WriteLine(Pack.ToString()); |
475 | RezScriptPacket rezScript = (RezScriptPacket)Pack; | ||
476 | if (OnRezScript != null) | ||
477 | { | ||
478 | OnRezScript(this, rezScript.InventoryBlock.ItemID, rezScript.UpdateBlock.ObjectLocalID); | ||
479 | } | ||
475 | break; | 480 | break; |
476 | case PacketType.MapLayerRequest: | 481 | case PacketType.MapLayerRequest: |
477 | this.RequestMapLayer(); | 482 | this.RequestMapLayer(); |
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> |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 577eb93..4a9e652 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -76,6 +76,7 @@ namespace SimpleApp | |||
76 | public event UDPAssetUploadRequest OnAssetUploadRequest; | 76 | public event UDPAssetUploadRequest OnAssetUploadRequest; |
77 | public event XferReceive OnXferReceive; | 77 | public event XferReceive OnXferReceive; |
78 | public event RequestXfer OnRequestXfer; | 78 | public event RequestXfer OnRequestXfer; |
79 | public event RezScript OnRezScript; | ||
79 | 80 | ||
80 | public event UUIDNameRequest OnNameFromUUIDRequest; | 81 | public event UUIDNameRequest OnNameFromUUIDRequest; |
81 | 82 | ||