Added OnRemoveScript(uint localID, LLUUID itemID) event , trigged when a script in a primitive is deleted.

afrisby
MW 2007-08-22 18:36:47 +00:00
parent 5a86fd2c31
commit 47c6d8ae8f
10 changed files with 73 additions and 2 deletions

View File

@ -90,6 +90,7 @@ namespace OpenSim.Framework.Interfaces
public delegate void UpdateInventoryItemTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID);
public delegate void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID);
public delegate void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, uint localID);
public delegate void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID);
public delegate void UDPAssetUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data);
public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data);
@ -152,6 +153,7 @@ namespace OpenSim.Framework.Interfaces
event ConfirmXfer OnConfirmXfer;
event RezScript OnRezScript;
event UpdateTaskInventory OnUpdateTaskInventory;
event RemoveTaskInventory OnRemoveTaskItem;
event UUIDNameRequest OnNameFromUUIDRequest;

View File

@ -65,6 +65,7 @@ namespace OpenSim.Framework
public event ConfirmXfer OnConfirmXfer;
public event RezScript OnRezScript;
public event UpdateTaskInventory OnUpdateTaskInventory;
public event RemoveTaskInventory OnRemoveTaskItem;
public event UUIDNameRequest OnNameFromUUIDRequest;

View File

@ -94,6 +94,7 @@ namespace OpenSim.Region.ClientStack
public event ConfirmXfer OnConfirmXfer;
public event RezScript OnRezScript;
public event UpdateTaskInventory OnUpdateTaskInventory;
public event RemoveTaskInventory OnRemoveTaskItem;
public event UUIDNameRequest OnNameFromUUIDRequest;

View File

@ -484,6 +484,13 @@ namespace OpenSim.Region.ClientStack
}
}
break;
case PacketType.RemoveTaskInventory:
RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket)Pack;
if (OnRemoveTaskItem != null)
{
OnRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID);
}
break;
case PacketType.MoveTaskInventory:
//Console.WriteLine(Pack.ToString());
break;

View File

@ -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);

View File

@ -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;

View File

@ -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);
}
}
}
}

View File

@ -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;
}
/// <summary>
///
/// </summary>

View File

@ -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;
}
/// <summary>
///
/// </summary>

View File

@ -79,6 +79,7 @@ namespace SimpleApp
public event ConfirmXfer OnConfirmXfer;
public event RezScript OnRezScript;
public event UpdateTaskInventory OnUpdateTaskInventory;
public event RemoveTaskInventory OnRemoveTaskItem;
public event UUIDNameRequest OnNameFromUUIDRequest;