Scripts are now copied into a prim (ie new copy placed in the prim) rather than moved into there.

afrisby
MW 2007-08-24 11:42:44 +00:00
parent a53125aae0
commit df73446bee
3 changed files with 34 additions and 9 deletions

View File

@ -233,6 +233,7 @@ namespace OpenSim.Region.Environment.Scenes
public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID)
{ {
CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
LLUUID copyID = LLUUID.Random();
if (userInfo != null) if (userInfo != null)
{ {
if (userInfo.RootFolder != null) if (userInfo.RootFolder != null)
@ -251,7 +252,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
string script = Util.FieldToString(rezAsset.Data); string script = Util.FieldToString(rezAsset.Data);
//Console.WriteLine("rez script "+script); //Console.WriteLine("rez script "+script);
this.EventManager.TriggerRezScript(localID, itemID, script); this.EventManager.TriggerRezScript(localID, copyID, script);
rezzed = true; rezzed = true;
} }
else else
@ -262,7 +263,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
string script = Util.FieldToString(rezAsset.Data); string script = Util.FieldToString(rezAsset.Data);
// Console.WriteLine("rez script " + script); // Console.WriteLine("rez script " + script);
this.EventManager.TriggerRezScript(localID, itemID, script); this.EventManager.TriggerRezScript(localID, copyID, script);
rezzed = true; rezzed = true;
} }
} }
@ -277,13 +278,10 @@ namespace OpenSim.Region.Environment.Scenes
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
if (hasPrim != false) if (hasPrim != false)
{ {
bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item);
bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID);
((SceneObjectGroup)ent).GetProperites(remoteClient); ((SceneObjectGroup)ent).GetProperites(remoteClient);
if (added)
{
userInfo.DeleteItem(remoteClient.AgentId, item);
remoteClient.SendRemoveInventoryItem(itemID);
}
} }
} }
} }

View File

@ -655,6 +655,33 @@ namespace OpenSim.Region.Environment.Scenes
} }
public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID)
{
if (copyItemID != LLUUID.Zero)
{
SceneObjectPart part = this.GetChildPart(localID);
if (part != null)
{
SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem();
taskItem.item_id = copyItemID;
taskItem.asset_id = item.assetID;
taskItem.name = item.inventoryName;
taskItem.desc = item.inventoryDescription;
taskItem.owner_id = new LLUUID(item.avatarID.ToString());
taskItem.creator_id = new LLUUID(item.creatorsID.ToString());
taskItem.type = SceneObjectPart.TaskInventoryItem.Types[item.assetType];
taskItem.inv_type = SceneObjectPart.TaskInventoryItem.Types[item.invType];
part.AddInventoryItem(taskItem);
return true;
}
}
else
{
return AddInventoryItem(remoteClient, localID, item);
}
return false;
}
public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID)
{ {
SceneObjectPart part = this.GetChildPart(localID); SceneObjectPart part = this.GetChildPart(localID);

View File

@ -83,7 +83,7 @@ namespace OpenSim.Region.Environment.Scenes
set { m_name = value; } set { m_name = value; }
} }
protected LLObject.ObjectFlags m_flags = (LLObject.ObjectFlags)32 + 65536 + 131072 + 256 + 4 + 8 + 268435456 + 128; protected LLObject.ObjectFlags m_flags = (LLObject.ObjectFlags)32 + 65536 + 131072 + 256 + 4 + 8 + 268435456 + 128 + (uint)LLObject.ObjectFlags.Physics;
public uint ObjectFlags public uint ObjectFlags
{ {
get { return (uint)m_flags; } get { return (uint)m_flags; }