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.
parent
73a67feaa3
commit
921ac14e86
|
@ -88,6 +88,7 @@ namespace OpenSim.Framework.Interfaces
|
|||
public delegate void FetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID);
|
||||
public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID);
|
||||
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 UDPAssetUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data);
|
||||
public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data);
|
||||
|
@ -146,6 +147,7 @@ namespace OpenSim.Framework.Interfaces
|
|||
event UDPAssetUploadRequest OnAssetUploadRequest;
|
||||
event XferReceive OnXferReceive;
|
||||
event RequestXfer OnRequestXfer;
|
||||
event RezScript OnRezScript;
|
||||
|
||||
event UUIDNameRequest OnNameFromUUIDRequest;
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace OpenSim.Framework
|
|||
public event UDPAssetUploadRequest OnAssetUploadRequest;
|
||||
public event XferReceive OnXferReceive;
|
||||
public event RequestXfer OnRequestXfer;
|
||||
public event RezScript OnRezScript;
|
||||
|
||||
public event UUIDNameRequest OnNameFromUUIDRequest;
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ namespace OpenSim.Region.ClientStack
|
|||
public event UDPAssetUploadRequest OnAssetUploadRequest;
|
||||
public event XferReceive OnXferReceive;
|
||||
public event RequestXfer OnRequestXfer;
|
||||
public event RezScript OnRezScript;
|
||||
|
||||
public event UUIDNameRequest OnNameFromUUIDRequest;
|
||||
|
||||
|
|
|
@ -472,6 +472,11 @@ namespace OpenSim.Region.ClientStack
|
|||
break;
|
||||
case PacketType.RezScript:
|
||||
//Console.WriteLine(Pack.ToString());
|
||||
RezScriptPacket rezScript = (RezScriptPacket)Pack;
|
||||
if (OnRezScript != null)
|
||||
{
|
||||
OnRezScript(this, rezScript.InventoryBlock.ItemID, rezScript.UpdateBlock.ObjectLocalID);
|
||||
}
|
||||
break;
|
||||
case PacketType.MapLayerRequest:
|
||||
this.RequestMapLayer();
|
||||
|
|
|
@ -111,8 +111,8 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
asset.Name = item.inventoryName;
|
||||
asset.Description = item.inventoryDescription;
|
||||
asset.InvType = (sbyte) item.invType;
|
||||
asset.Type = (sbyte) item.assetType;
|
||||
asset.InvType = (sbyte)item.invType;
|
||||
asset.Type = (sbyte)item.assetType;
|
||||
item.assetID = asset.FullID;
|
||||
|
||||
if (addToCache)
|
||||
|
@ -205,6 +205,44 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID)
|
||||
{
|
||||
CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
|
||||
if (userInfo != null)
|
||||
{
|
||||
if (userInfo.RootFolder != null)
|
||||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
|
||||
if (item != null)
|
||||
{
|
||||
bool isTexture = false;
|
||||
if (item.invType == 0)
|
||||
{
|
||||
isTexture = true;
|
||||
}
|
||||
AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
|
||||
if (rezAsset != null)
|
||||
{
|
||||
string script = Util.FieldToString(rezAsset.Data);
|
||||
//Console.WriteLine("rez script "+script);
|
||||
this.EventManager.TriggerRezScript(localID, script);
|
||||
}
|
||||
else
|
||||
{
|
||||
//lets try once more incase the asset cache is being slow getting the asset from server
|
||||
rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
|
||||
if (rezAsset != null)
|
||||
{
|
||||
string script = Util.FieldToString(rezAsset.Data);
|
||||
// Console.WriteLine("rez script " + script);
|
||||
this.EventManager.TriggerRezScript(localID, script);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
@ -320,6 +358,8 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
this.AddEntity(group);
|
||||
group.AbsolutePosition = pos;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -711,6 +711,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest;
|
||||
client.OnXferReceive += commsManager.TransactionsManager.HandleXfer;
|
||||
// client.OnRequestXfer += RequestXfer;
|
||||
client.OnRezScript += RezScript;
|
||||
|
||||
client.OnRequestAvatarProperties += RequestAvatarProperty;
|
||||
|
||||
|
|
|
@ -37,6 +37,9 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
public event ObjectGrabDelegate OnObjectGrab;
|
||||
public event OnPermissionErrorDelegate OnPermissionError;
|
||||
|
||||
public delegate void NewRezScript(uint localID, string script);
|
||||
public event NewRezScript OnRezScript;
|
||||
|
||||
|
||||
public void TriggerPermissionError(LLUUID user, string reason)
|
||||
{
|
||||
|
@ -106,5 +109,13 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
if (OnObjectGrab != null)
|
||||
OnObjectGrab(localID, offsetPos, remoteClient);
|
||||
}
|
||||
|
||||
public void TriggerRezScript(uint localID, string script)
|
||||
{
|
||||
if (OnRezScript != null)
|
||||
{
|
||||
OnRezScript(localID, script);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -396,6 +396,15 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
#endregion
|
||||
|
||||
#region Inventory
|
||||
public void AddInventoryItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RemoveInventoryItem()
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -76,6 +76,7 @@ namespace SimpleApp
|
|||
public event UDPAssetUploadRequest OnAssetUploadRequest;
|
||||
public event XferReceive OnXferReceive;
|
||||
public event RequestXfer OnRequestXfer;
|
||||
public event RezScript OnRezScript;
|
||||
|
||||
public event UUIDNameRequest OnNameFromUUIDRequest;
|
||||
|
||||
|
|
Loading…
Reference in New Issue