diff options
Added OnRemoveScript(uint localID, LLUUID itemID) event , trigged when a script in a primitive is deleted.
Diffstat (limited to 'OpenSim/Region')
8 files changed, 70 insertions, 2 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 6570a82..6209beb 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs | |||
@@ -94,6 +94,7 @@ namespace OpenSim.Region.ClientStack | |||
94 | public event ConfirmXfer OnConfirmXfer; | 94 | public event ConfirmXfer OnConfirmXfer; |
95 | public event RezScript OnRezScript; | 95 | public event RezScript OnRezScript; |
96 | public event UpdateTaskInventory OnUpdateTaskInventory; | 96 | public event UpdateTaskInventory OnUpdateTaskInventory; |
97 | public event RemoveTaskInventory OnRemoveTaskItem; | ||
97 | 98 | ||
98 | public event UUIDNameRequest OnNameFromUUIDRequest; | 99 | public event UUIDNameRequest OnNameFromUUIDRequest; |
99 | 100 | ||
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 383c7a9..0163528 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | |||
@@ -484,6 +484,13 @@ namespace OpenSim.Region.ClientStack | |||
484 | } | 484 | } |
485 | } | 485 | } |
486 | break; | 486 | break; |
487 | case PacketType.RemoveTaskInventory: | ||
488 | RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket)Pack; | ||
489 | if (OnRemoveTaskItem != null) | ||
490 | { | ||
491 | OnRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID); | ||
492 | } | ||
493 | break; | ||
487 | case PacketType.MoveTaskInventory: | 494 | case PacketType.MoveTaskInventory: |
488 | //Console.WriteLine(Pack.ToString()); | 495 | //Console.WriteLine(Pack.ToString()); |
489 | break; | 496 | break; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index fa1b865..9cbd65b 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -208,6 +208,26 @@ namespace OpenSim.Region.Environment.Scenes | |||
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) | ||
212 | { | ||
213 | bool hasPrim = false; | ||
214 | foreach (EntityBase ent in Entities.Values) | ||
215 | { | ||
216 | if (ent is SceneObjectGroup) | ||
217 | { | ||
218 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); | ||
219 | if (hasPrim != false) | ||
220 | { | ||
221 | int type = ((SceneObjectGroup)ent).RemoveInventoryItem(remoteClient, localID, itemID); | ||
222 | if (type == 10) | ||
223 | { | ||
224 | this.EventManager.TriggerRemoveScript(localID, itemID); | ||
225 | } | ||
226 | } | ||
227 | } | ||
228 | } | ||
229 | } | ||
230 | |||
211 | public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) | 231 | public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) |
212 | { | 232 | { |
213 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | 233 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 62eb547..91ff0a8 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -716,6 +716,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
716 | client.OnRequestXfer += xferManager.RequestXfer; | 716 | client.OnRequestXfer += xferManager.RequestXfer; |
717 | client.OnConfirmXfer += xferManager.AckPacket; | 717 | client.OnConfirmXfer += xferManager.AckPacket; |
718 | client.OnRezScript += RezScript; | 718 | client.OnRezScript += RezScript; |
719 | client.OnRemoveTaskItem += RemoveTaskInventory; | ||
719 | 720 | ||
720 | client.OnRequestAvatarProperties += RequestAvatarProperty; | 721 | client.OnRequestAvatarProperties += RequestAvatarProperty; |
721 | 722 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index 09a7f21..3c6b277 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs | |||
@@ -40,6 +40,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
40 | public delegate void NewRezScript(uint localID, LLUUID itemID, string script); | 40 | public delegate void NewRezScript(uint localID, LLUUID itemID, string script); |
41 | public event NewRezScript OnRezScript; | 41 | public event NewRezScript OnRezScript; |
42 | 42 | ||
43 | public delegate void RemoveScript(uint localID, LLUUID itemID); | ||
44 | public event RemoveScript OnRemoveScript; | ||
43 | 45 | ||
44 | public void TriggerPermissionError(LLUUID user, string reason) | 46 | public void TriggerPermissionError(LLUUID user, string reason) |
45 | { | 47 | { |
@@ -117,5 +119,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
117 | OnRezScript(localID, itemID, script); | 119 | OnRezScript(localID, itemID, script); |
118 | } | 120 | } |
119 | } | 121 | } |
122 | |||
123 | public void TriggerRemoveScript(uint localID, LLUUID itemID) | ||
124 | { | ||
125 | if (OnRemoveScript != null) | ||
126 | { | ||
127 | OnRemoveScript(localID, itemID); | ||
128 | } | ||
129 | } | ||
120 | } | 130 | } |
121 | } | 131 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index c50809f..c3d70ea 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -643,6 +643,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
643 | 643 | ||
644 | } | 644 | } |
645 | 645 | ||
646 | public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) | ||
647 | { | ||
648 | SceneObjectPart part = this.GetChildPart(localID); | ||
649 | if (part != null) | ||
650 | { | ||
651 | return part.RemoveInventoryItem(remoteClient, localID, itemID); | ||
652 | } | ||
653 | return -1; | ||
654 | } | ||
655 | |||
646 | /// <summary> | 656 | /// <summary> |
647 | /// | 657 | /// |
648 | /// </summary> | 658 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 8a59d88..567681a 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -422,10 +422,28 @@ namespace OpenSim.Region.Environment.Scenes | |||
422 | this.m_inventorySerial++; | 422 | this.m_inventorySerial++; |
423 | } | 423 | } |
424 | 424 | ||
425 | public void RemoveInventoryItem() | 425 | public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) |
426 | { | 426 | { |
427 | 427 | if (localID == this.LocalID) | |
428 | { | ||
429 | if (this.TaskInventory.ContainsKey(itemID)) | ||
430 | { | ||
431 | string type = TaskInventory[itemID].inv_type; | ||
432 | this.TaskInventory.Remove(itemID); | ||
433 | this.m_inventorySerial++; | ||
434 | if (type == "lsltext") | ||
435 | { | ||
436 | return 10; | ||
437 | } | ||
438 | else | ||
439 | { | ||
440 | return 0; | ||
441 | } | ||
442 | } | ||
443 | } | ||
444 | return -1; | ||
428 | } | 445 | } |
446 | |||
429 | /// <summary> | 447 | /// <summary> |
430 | /// | 448 | /// |
431 | /// </summary> | 449 | /// </summary> |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 0e898a2..003d3d4 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -79,6 +79,7 @@ namespace SimpleApp | |||
79 | public event ConfirmXfer OnConfirmXfer; | 79 | public event ConfirmXfer OnConfirmXfer; |
80 | public event RezScript OnRezScript; | 80 | public event RezScript OnRezScript; |
81 | public event UpdateTaskInventory OnUpdateTaskInventory; | 81 | public event UpdateTaskInventory OnUpdateTaskInventory; |
82 | public event RemoveTaskInventory OnRemoveTaskItem; | ||
82 | 83 | ||
83 | public event UUIDNameRequest OnNameFromUUIDRequest; | 84 | public event UUIDNameRequest OnNameFromUUIDRequest; |
84 | 85 | ||