From 47c6d8ae8f85f07a16390f0130180a1b0521b6a1 Mon Sep 17 00:00:00 2001
From: MW
Date: Wed, 22 Aug 2007 18:36:47 +0000
Subject: Added OnRemoveScript(uint localID, LLUUID itemID) event , trigged
when a script in a primitive is deleted.
---
.../Region/Environment/Scenes/Scene.Inventory.cs | 20 ++++++++++++++++++++
OpenSim/Region/Environment/Scenes/Scene.cs | 1 +
OpenSim/Region/Environment/Scenes/SceneEvents.cs | 10 ++++++++++
.../Region/Environment/Scenes/SceneObjectGroup.cs | 10 ++++++++++
.../Region/Environment/Scenes/SceneObjectPart.cs | 22 ++++++++++++++++++++--
5 files changed, 61 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Environment/Scenes')
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
}
}
+ public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID)
+ {
+ bool hasPrim = false;
+ foreach (EntityBase ent in Entities.Values)
+ {
+ if (ent is SceneObjectGroup)
+ {
+ hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
+ if (hasPrim != false)
+ {
+ int type = ((SceneObjectGroup)ent).RemoveInventoryItem(remoteClient, localID, itemID);
+ if (type == 10)
+ {
+ this.EventManager.TriggerRemoveScript(localID, itemID);
+ }
+ }
+ }
+ }
+ }
+
public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID)
{
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
client.OnRequestXfer += xferManager.RequestXfer;
client.OnConfirmXfer += xferManager.AckPacket;
client.OnRezScript += RezScript;
+ client.OnRemoveTaskItem += RemoveTaskInventory;
client.OnRequestAvatarProperties += RequestAvatarProperty;
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
public delegate void NewRezScript(uint localID, LLUUID itemID, string script);
public event NewRezScript OnRezScript;
+ public delegate void RemoveScript(uint localID, LLUUID itemID);
+ public event RemoveScript OnRemoveScript;
public void TriggerPermissionError(LLUUID user, string reason)
{
@@ -117,5 +119,13 @@ namespace OpenSim.Region.Environment.Scenes
OnRezScript(localID, itemID, script);
}
}
+
+ public void TriggerRemoveScript(uint localID, LLUUID itemID)
+ {
+ if (OnRemoveScript != null)
+ {
+ OnRemoveScript(localID, itemID);
+ }
+ }
}
}
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
}
+ public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID)
+ {
+ SceneObjectPart part = this.GetChildPart(localID);
+ if (part != null)
+ {
+ return part.RemoveInventoryItem(remoteClient, localID, itemID);
+ }
+ return -1;
+ }
+
///
///
///
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
this.m_inventorySerial++;
}
- public void RemoveInventoryItem()
+ public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID)
{
-
+ if (localID == this.LocalID)
+ {
+ if (this.TaskInventory.ContainsKey(itemID))
+ {
+ string type = TaskInventory[itemID].inv_type;
+ this.TaskInventory.Remove(itemID);
+ this.m_inventorySerial++;
+ if (type == "lsltext")
+ {
+ return 10;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ }
+ return -1;
}
+
///
///
///
--
cgit v1.1