Can now Rez and DeRez objects (take to and from inventory).
Very much a work in progress and likely to be a number of bugs.0.1-prestable
parent
b72edaa109
commit
af93263a3b
|
@ -157,6 +157,27 @@ namespace OpenSim.Framework.Inventory
|
|||
return (null);
|
||||
}
|
||||
}
|
||||
|
||||
public bool DeleteFromInventory(LLUUID itemID)
|
||||
{
|
||||
bool res = false;
|
||||
if (this.InventoryItems.ContainsKey(itemID))
|
||||
{
|
||||
InventoryItem item = this.InventoryItems[itemID];
|
||||
this.InventoryItems.Remove(itemID);
|
||||
foreach (InventoryFolder fold in InventoryFolders.Values)
|
||||
{
|
||||
if (fold.Items.Contains(item))
|
||||
{
|
||||
fold.Items.Remove(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
res = true;
|
||||
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
public class InventoryFolder
|
||||
|
|
|
@ -7,6 +7,8 @@ namespace OpenSim.Framework.Assets
|
|||
{
|
||||
public class PrimData
|
||||
{
|
||||
private const uint FULL_MASK_PERMISSIONS = 2147483647;
|
||||
|
||||
public LLUUID OwnerID;
|
||||
public byte PCode;
|
||||
public byte PathBegin;
|
||||
|
@ -30,10 +32,18 @@ namespace OpenSim.Framework.Assets
|
|||
public sbyte PathTwist;
|
||||
public sbyte PathTwistBegin;
|
||||
public byte[] Texture;
|
||||
|
||||
|
||||
public Int32 CreationDate;
|
||||
public uint OwnerMask = FULL_MASK_PERMISSIONS;
|
||||
public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
|
||||
public uint GroupMask = FULL_MASK_PERMISSIONS;
|
||||
public uint EveryoneMask = FULL_MASK_PERMISSIONS;
|
||||
public uint BaseMask = FULL_MASK_PERMISSIONS;
|
||||
|
||||
//following only used during prim storage
|
||||
public LLVector3 Position;
|
||||
public LLQuaternion Rotation;
|
||||
public LLQuaternion Rotation = new LLQuaternion(0,1,0,0);
|
||||
public uint LocalID;
|
||||
public LLUUID FullID;
|
||||
|
||||
|
@ -41,5 +51,114 @@ namespace OpenSim.Framework.Assets
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
public PrimData(byte[] data)
|
||||
{
|
||||
int i =0;
|
||||
|
||||
this.OwnerID = new LLUUID(data, i); i += 16;
|
||||
this.PCode = data[i++];
|
||||
this.PathBegin = data[i++];
|
||||
this.PathEnd = data[i++];
|
||||
this.PathScaleX = data[i++];
|
||||
this.PathScaleY = data[i++];
|
||||
this.PathShearX = data[i++];
|
||||
this.PathShearY = data[i++];
|
||||
this.PathSkew = (sbyte)data[i++];
|
||||
this.ProfileBegin = data[i++];
|
||||
this.ProfileEnd = data[i++];
|
||||
this.Scale = new LLVector3(data, i); i += 12;
|
||||
this.PathCurve = data[i++];
|
||||
this.ProfileCurve = data[i++];
|
||||
this.ParentID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
|
||||
this.ProfileHollow = data[i++];
|
||||
this.PathRadiusOffset = (sbyte)data[i++];
|
||||
this.PathRevolutions = data[i++];
|
||||
this.PathTaperX = (sbyte)data[i++];
|
||||
this.PathTaperY =(sbyte) data[i++];
|
||||
this.PathTwist = (sbyte) data[i++];
|
||||
this.PathTwistBegin = (sbyte) data[i++];
|
||||
ushort length = (ushort)(data[i++] + (data[i++] << 8));
|
||||
this.Texture = new byte[length];
|
||||
Array.Copy(data, i, Texture, 0, length); i += length;
|
||||
this.CreationDate = (Int32)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
|
||||
this.OwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
|
||||
this.NextOwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
|
||||
this.GroupMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
|
||||
this.EveryoneMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
|
||||
this.BaseMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
|
||||
this.Position = new LLVector3(data, i); i += 12;
|
||||
this.Rotation = new LLQuaternion(data,i, true); i += 12;
|
||||
this.LocalID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
|
||||
this.FullID = new LLUUID(data, i); i += 16;
|
||||
|
||||
}
|
||||
|
||||
public byte[] ToBytes()
|
||||
{
|
||||
int i = 0;
|
||||
byte[] bytes = new byte[121 + Texture.Length];
|
||||
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
|
||||
bytes[i++] = this.PCode;
|
||||
bytes[i++] = this.PathBegin;
|
||||
bytes[i++] = this.PathEnd;
|
||||
bytes[i++] = this.PathScaleX;
|
||||
bytes[i++] = this.PathScaleY;
|
||||
bytes[i++] = this.PathShearX;
|
||||
bytes[i++] = this.PathShearY;
|
||||
bytes[i++] = (byte)this.PathSkew;
|
||||
bytes[i++] = this.ProfileBegin;
|
||||
bytes[i++] = this.ProfileEnd;
|
||||
Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12;
|
||||
bytes[i++] = this.PathCurve;
|
||||
bytes[i++] = this.ProfileCurve;
|
||||
bytes[i++] = (byte)(ParentID % 256);
|
||||
bytes[i++] = (byte)((ParentID >> 8) % 256);
|
||||
bytes[i++] = (byte)((ParentID >> 16) % 256);
|
||||
bytes[i++] = (byte)((ParentID >> 24) % 256);
|
||||
bytes[i++] = this.ProfileHollow;
|
||||
bytes[i++] = ((byte)this.PathRadiusOffset);
|
||||
bytes[i++] = this.PathRevolutions;
|
||||
bytes[i++] = ((byte) this.PathTaperX);
|
||||
bytes[i++] = ((byte) this.PathTaperY);
|
||||
bytes[i++] = ((byte) this.PathTwist);
|
||||
bytes[i++] = ((byte) this.PathTwistBegin);
|
||||
bytes[i++] = (byte)(Texture.Length % 256);
|
||||
bytes[i++] = (byte)((Texture.Length >> 8) % 256);
|
||||
Array.Copy(Texture, 0, bytes, i, Texture.Length); i += Texture.Length;
|
||||
bytes[i++] = (byte)(this.CreationDate % 256);
|
||||
bytes[i++] = (byte)((this.CreationDate >> 8) % 256);
|
||||
bytes[i++] = (byte)((this.CreationDate >> 16) % 256);
|
||||
bytes[i++] = (byte)((this.CreationDate >> 24) % 256);
|
||||
bytes[i++] = (byte)(this.OwnerMask % 256);
|
||||
bytes[i++] = (byte)((this.OwnerMask >> 8) % 256);
|
||||
bytes[i++] = (byte)((this.OwnerMask >> 16) % 256);
|
||||
bytes[i++] = (byte)((this.OwnerMask >> 24) % 256);
|
||||
bytes[i++] = (byte)(this.NextOwnerMask % 256);
|
||||
bytes[i++] = (byte)((this.NextOwnerMask >> 8) % 256);
|
||||
bytes[i++] = (byte)((this.NextOwnerMask >> 16) % 256);
|
||||
bytes[i++] = (byte)((this.NextOwnerMask >> 24) % 256);
|
||||
bytes[i++] = (byte)(this.GroupMask % 256);
|
||||
bytes[i++] = (byte)((this.GroupMask >> 8) % 256);
|
||||
bytes[i++] = (byte)((this.GroupMask >> 16) % 256);
|
||||
bytes[i++] = (byte)((this.GroupMask >> 24) % 256);
|
||||
bytes[i++] = (byte)(this.EveryoneMask % 256);
|
||||
bytes[i++] = (byte)((this.EveryoneMask >> 8) % 256);
|
||||
bytes[i++] = (byte)((this.EveryoneMask >> 16) % 256);
|
||||
bytes[i++] = (byte)((this.EveryoneMask >> 24) % 256);
|
||||
bytes[i++] = (byte)(this.BaseMask % 256);
|
||||
bytes[i++] = (byte)((this.BaseMask >> 8) % 256);
|
||||
bytes[i++] = (byte)((this.BaseMask >> 16) % 256);
|
||||
bytes[i++] = (byte)((this.BaseMask >> 24) % 256);
|
||||
Array.Copy(this.Position.GetBytes(), 0, bytes, i, 12); i += 12;
|
||||
Array.Copy(this.Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
|
||||
bytes[i++] = (byte)(this.LocalID % 256);
|
||||
bytes[i++] = (byte)((this.LocalID >> 8) % 256);
|
||||
bytes[i++] = (byte)((this.LocalID >> 16) % 256);
|
||||
bytes[i++] = (byte)((this.LocalID >> 24) % 256);
|
||||
Array.Copy(FullID.GetBytes(), 0, bytes, i, 16); i += 16;
|
||||
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace OpenSim
|
|||
|
||||
public void HandleUploadPacket(AssetUploadRequestPacket pack, LLUUID assetID)
|
||||
{
|
||||
|
||||
Console.Write("asset upload request , type = " + pack.AssetBlock.Type.ToString());
|
||||
AssetBase asset = null;
|
||||
if (pack.AssetBlock.Type == 0)
|
||||
{
|
||||
|
|
|
@ -140,6 +140,26 @@ namespace OpenSim.Assets
|
|||
|
||||
return newItem;
|
||||
}
|
||||
public bool DeleteInventoryItem(SimClient remoteClient, LLUUID itemID)
|
||||
{
|
||||
bool res = false;
|
||||
if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
|
||||
{
|
||||
res = this._agentsInventory[remoteClient.AgentID].DeleteFromInventory(itemID);
|
||||
if (res)
|
||||
{
|
||||
RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket();
|
||||
remove.AgentData.AgentID = remoteClient.AgentID;
|
||||
remove.AgentData.SessionID = remoteClient.SessionID;
|
||||
remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1];
|
||||
remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock();
|
||||
remove.InventoryData[0].ItemID = itemID;
|
||||
remoteClient.OutPacket(remove);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public bool UpdateInventoryItemAsset(SimClient remoteClient, LLUUID itemID, OpenSim.Framework.Assets.AssetBase asset)
|
||||
{
|
||||
|
|
|
@ -128,6 +128,8 @@ namespace OpenSim
|
|||
m_console.WriteLine("Initialising world");
|
||||
LocalWorld = new World(ClientThreads, Cfg.RegionHandle, Cfg.RegionName, Cfg);
|
||||
LocalWorld.LandMap = Cfg.LoadWorld();
|
||||
LocalWorld.InventoryCache = InventoryCache;
|
||||
LocalWorld.AssetCache = AssetCache;
|
||||
|
||||
this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
|
||||
this.physManager.LoadPlugins();
|
||||
|
|
|
@ -112,6 +112,7 @@ namespace OpenSim
|
|||
protected virtual void ProcessInPacket(Packet Pack)
|
||||
{
|
||||
ack_pack(Pack);
|
||||
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||
if (debug)
|
||||
{
|
||||
if (Pack.Type != PacketType.AgentUpdate)
|
||||
|
@ -166,7 +167,6 @@ namespace OpenSim
|
|||
cachedresp.WearableData[i].TextureID = LLUUID.Zero;
|
||||
cachedresp.WearableData[i].HostName = new byte[0];
|
||||
}
|
||||
|
||||
this.OutPacket(cachedresp);
|
||||
break;
|
||||
case PacketType.ObjectAdd:
|
||||
|
@ -293,7 +293,7 @@ namespace OpenSim
|
|||
ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack;
|
||||
if (Helpers.FieldToString(inchatpack.ChatData.Message) == "") break;
|
||||
|
||||
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||
|
||||
libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
|
||||
reply.ChatData.Audible = 1;
|
||||
reply.ChatData.Message = inchatpack.ChatData.Message;
|
||||
|
@ -363,6 +363,7 @@ namespace OpenSim
|
|||
}
|
||||
else
|
||||
{
|
||||
Console.Write(Pack.ToString());
|
||||
this.CreateInventoryItem(createItem);
|
||||
}
|
||||
break;
|
||||
|
@ -424,6 +425,10 @@ namespace OpenSim
|
|||
//OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Received DeRezObject packet");
|
||||
m_world.DeRezObject((DeRezObjectPacket)Pack, this);
|
||||
break;
|
||||
case PacketType.RezObject:
|
||||
//Console.WriteLine(Pack.ToString());
|
||||
m_world.RezObject(this, (RezObjectPacket)Pack);
|
||||
break;
|
||||
case PacketType.ModifyLand:
|
||||
ModifyLandPacket modify = (ModifyLandPacket)Pack;
|
||||
//Console.WriteLine("terraform: number of parcel data blocks" + modify.ParcelData.Length);
|
||||
|
@ -464,6 +469,61 @@ namespace OpenSim
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case PacketType.RequestTaskInventory:
|
||||
// Console.WriteLine(Pack.ToString());
|
||||
RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
|
||||
ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
|
||||
bool foundent = false;
|
||||
foreach (Entity ent in m_world.Entities.Values)
|
||||
{
|
||||
if (ent.localid == requesttask.InventoryData.LocalID)
|
||||
{
|
||||
replytask.InventoryData.TaskID = ent.uuid;
|
||||
replytask.InventoryData.Serial = 0;
|
||||
replytask.InventoryData.Filename = new byte[0];
|
||||
foundent = true;
|
||||
}
|
||||
}
|
||||
if (foundent)
|
||||
{
|
||||
this.OutPacket(replytask);
|
||||
}
|
||||
break;
|
||||
case PacketType.UUIDNameRequest:
|
||||
//System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||
Console.WriteLine(Pack.ToString());
|
||||
UUIDNameRequestPacket nameRequest = (UUIDNameRequestPacket)Pack;
|
||||
UUIDNameReplyPacket nameReply = new UUIDNameReplyPacket();
|
||||
nameReply.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[nameRequest.UUIDNameBlock.Length];
|
||||
|
||||
for (int i = 0; i < nameRequest.UUIDNameBlock.Length; i++)
|
||||
{
|
||||
nameReply.UUIDNameBlock[i] = new UUIDNameReplyPacket.UUIDNameBlockBlock();
|
||||
nameReply.UUIDNameBlock[i].ID = nameRequest.UUIDNameBlock[i].ID;
|
||||
nameReply.UUIDNameBlock[i].FirstName = _enc.GetBytes("Who\0"); //for now send any name
|
||||
nameReply.UUIDNameBlock[i].LastName = _enc.GetBytes("Knows\0"); //in future need to look it up
|
||||
}
|
||||
this.OutPacket(nameReply);
|
||||
break;
|
||||
case PacketType.AgentAnimation:
|
||||
//Console.WriteLine(Pack.ToString());
|
||||
break;
|
||||
case PacketType.ObjectSelect:
|
||||
ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
|
||||
for (int i = 0; i < incomingselect.ObjectData.Length; i++)
|
||||
{
|
||||
foreach (Entity ent in m_world.Entities.Values)
|
||||
{
|
||||
if (ent.localid == incomingselect.ObjectData[i].ObjectLocalID)
|
||||
{
|
||||
((OpenSim.world.Primitive)ent).GetProperites(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ namespace OpenSim.world
|
|||
private Dictionary<uint, SimClient> m_clientThreads;
|
||||
private ulong m_regionHandle;
|
||||
private World m_world;
|
||||
private const uint FULL_MASK_PERMISSIONS = 2147483647;
|
||||
|
||||
public bool PhysicsEnabled
|
||||
{
|
||||
|
@ -94,6 +95,40 @@ namespace OpenSim.world
|
|||
return mesh;
|
||||
}
|
||||
|
||||
public byte[] GetByteArray()
|
||||
{
|
||||
return this.primData.ToBytes();
|
||||
}
|
||||
|
||||
public void GetProperites(SimClient client)
|
||||
{
|
||||
ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
|
||||
proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
|
||||
proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
|
||||
proper.ObjectData[0].ItemID = LLUUID.Zero; // this.uuid;
|
||||
proper.ObjectData[0].CreationDate = (ulong) this.primData.CreationDate;
|
||||
proper.ObjectData[0].CreatorID = this.primData.OwnerID;
|
||||
proper.ObjectData[0].FolderID = LLUUID.Zero;
|
||||
proper.ObjectData[0].FromTaskID = LLUUID.Zero;
|
||||
proper.ObjectData[0].GroupID = LLUUID.Zero;
|
||||
proper.ObjectData[0].InventorySerial = 0;
|
||||
proper.ObjectData[0].LastOwnerID = LLUUID.Zero;
|
||||
proper.ObjectData[0].ObjectID = this.uuid;
|
||||
proper.ObjectData[0].OwnerID = primData.OwnerID;
|
||||
proper.ObjectData[0].TouchName = new byte[0];
|
||||
proper.ObjectData[0].TextureID = new byte[0];
|
||||
proper.ObjectData[0].SitName = new byte[0];
|
||||
proper.ObjectData[0].Name = new byte[0];
|
||||
proper.ObjectData[0].Description = new byte[0];
|
||||
proper.ObjectData[0].OwnerMask = this.primData.OwnerMask;
|
||||
proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask;
|
||||
proper.ObjectData[0].GroupMask = this.primData.GroupMask;
|
||||
proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask;
|
||||
proper.ObjectData[0].BaseMask = this.primData.BaseMask;
|
||||
|
||||
client.OutPacket(proper);
|
||||
}
|
||||
|
||||
public void UpdatePosition(LLVector3 pos)
|
||||
{
|
||||
this.position = pos;
|
||||
|
@ -125,9 +160,45 @@ namespace OpenSim.world
|
|||
}
|
||||
if (this.newPrimFlag)
|
||||
{
|
||||
/* ObjectOwnerPacket objown = new ObjectOwnerPacket();
|
||||
objown.HeaderData.GroupID = LLUUID.Zero;
|
||||
objown.HeaderData.Override = false;
|
||||
objown.HeaderData.OwnerID = LLUUID.Zero;
|
||||
objown.ObjectData = new ObjectOwnerPacket.ObjectDataBlock[1];
|
||||
objown.ObjectData[0] = new ObjectOwnerPacket.ObjectDataBlock();
|
||||
objown.ObjectData[0].ObjectLocalID = this.localid;
|
||||
ObjectGroupPacket objgroup = new ObjectGroupPacket();
|
||||
objgroup.ObjectData = new ObjectGroupPacket.ObjectDataBlock[1];
|
||||
objgroup.ObjectData[0] = new ObjectGroupPacket.ObjectDataBlock();
|
||||
objgroup.ObjectData[0].ObjectLocalID = this.localid;
|
||||
ObjectPermissionsPacket objper = new ObjectPermissionsPacket();
|
||||
objper.HeaderData.Override = false;
|
||||
objper.ObjectData = new ObjectPermissionsPacket.ObjectDataBlock[3];
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
objper.ObjectData[i] = new ObjectPermissionsPacket.ObjectDataBlock();
|
||||
objper.ObjectData[i].ObjectLocalID = this.localid;
|
||||
objper.ObjectData[i].Set = 1;
|
||||
objper.ObjectData[i].Field = 0;
|
||||
}
|
||||
objper.ObjectData[0].Mask = 8192;
|
||||
objper.ObjectData[1].Mask = 16384;
|
||||
objper.ObjectData[2].Mask = 32768;*/
|
||||
|
||||
foreach (SimClient client in m_clientThreads.Values)
|
||||
{
|
||||
client.OutPacket(OurPacket);
|
||||
/* objown.AgentData.AgentID = client.AgentID;
|
||||
objown.AgentData.SessionID = client.SessionID;
|
||||
objown.HeaderData.OwnerID = client.AgentID;
|
||||
client.OutPacket(objown);
|
||||
objgroup.AgentData.AgentID = client.AgentID;
|
||||
objgroup.AgentData.GroupID = LLUUID.Zero;
|
||||
objgroup.AgentData.SessionID = client.SessionID;
|
||||
client.OutPacket(objgroup);
|
||||
objper.AgentData.AgentID = client.AgentID;
|
||||
objper.AgentData.SessionID = client.SessionID;
|
||||
client.OutPacket(objper);*/
|
||||
}
|
||||
this.newPrimFlag = false;
|
||||
}
|
||||
|
@ -286,18 +357,18 @@ namespace OpenSim.world
|
|||
{
|
||||
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||
objupdate.RegionData.RegionHandle = m_regionHandle;
|
||||
objupdate.RegionData.TimeDilation = 64096;
|
||||
objupdate.RegionData.TimeDilation = 64096;
|
||||
|
||||
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||
PrimData PData = new PrimData();
|
||||
this.primData = PData;
|
||||
this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
|
||||
objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();
|
||||
objupdate.ObjectData[0].PSBlock = new byte[0];
|
||||
objupdate.ObjectData[0].ExtraParams = new byte[1];
|
||||
objupdate.ObjectData[0].MediaURL = new byte[0];
|
||||
objupdate.ObjectData[0].NameValue = new byte[2];
|
||||
objupdate.ObjectData[0].NameValue[0] = (byte)'t';
|
||||
objupdate.ObjectData[0].NameValue[1] = (byte)'o';
|
||||
objupdate.ObjectData[0].NameValue = new byte[0];
|
||||
objupdate.ObjectData[0].Text = new byte[0];
|
||||
objupdate.ObjectData[0].TextColor = new byte[4];
|
||||
objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0);
|
||||
|
@ -307,7 +378,7 @@ namespace OpenSim.world
|
|||
objupdate.ObjectData[0].TextureAnim = new byte[0];
|
||||
objupdate.ObjectData[0].Sound = LLUUID.Zero;
|
||||
LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
|
||||
objupdate.ObjectData[0].TextureEntry = ntex.ToBytes();
|
||||
this.primData.Texture = objupdate.ObjectData[0].TextureEntry = ntex.ToBytes();
|
||||
objupdate.ObjectData[0].State = 0;
|
||||
objupdate.ObjectData[0].Data = new byte[0];
|
||||
PData.OwnerID = objupdate.ObjectData[0].OwnerID = agentID;
|
||||
|
@ -326,14 +397,12 @@ namespace OpenSim.world
|
|||
PData.ProfileCurve = objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve;
|
||||
PData.ParentID = objupdate.ObjectData[0].ParentID = 0;
|
||||
PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow;
|
||||
|
||||
PData.PathRadiusOffset = objupdate.ObjectData[0].PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
|
||||
PData.PathRevolutions = objupdate.ObjectData[0].PathRevolutions = addPacket.ObjectData.PathRevolutions;
|
||||
PData.PathTaperX = objupdate.ObjectData[0].PathTaperX = addPacket.ObjectData.PathTaperX;
|
||||
PData.PathTaperY = objupdate.ObjectData[0].PathTaperY = addPacket.ObjectData.PathTaperY;
|
||||
PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist;
|
||||
PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
|
||||
|
||||
objupdate.ObjectData[0].ID = (uint)(localID);
|
||||
objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID - 702000).ToString("00000"));
|
||||
objupdate.ObjectData[0].ObjectData = new byte[60];
|
||||
|
@ -343,15 +412,19 @@ namespace OpenSim.world
|
|||
//update position
|
||||
byte[] pb = pos1.GetBytes();
|
||||
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length);
|
||||
|
||||
this.newPrimFlag = true;
|
||||
this.uuid = objupdate.ObjectData[0].FullID;
|
||||
this.primData.FullID = this.uuid = objupdate.ObjectData[0].FullID;
|
||||
this.localid = objupdate.ObjectData[0].ID;
|
||||
this.position = pos1;
|
||||
this.primData.Position = this.position = pos1;
|
||||
this.OurPacket = objupdate;
|
||||
}
|
||||
|
||||
public void CreateFromStorage(PrimData store)
|
||||
{
|
||||
this.CreateFromStorage(store, store.Position, store.LocalID, false);
|
||||
}
|
||||
|
||||
public void CreateFromStorage(PrimData store, LLVector3 posi, uint localID, bool newprim)
|
||||
{
|
||||
//need to clean this up as it shares a lot of code with CreateFromPacket()
|
||||
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||
|
@ -410,13 +483,13 @@ namespace OpenSim.world
|
|||
objupdate.ObjectData[0].PathTwist = this.primData.PathTwist;
|
||||
objupdate.ObjectData[0].PathTwistBegin = this.primData.PathTwistBegin;
|
||||
|
||||
objupdate.ObjectData[0].ID = (uint)store.LocalID;
|
||||
objupdate.ObjectData[0].ID = localID; // (uint)store.LocalID;
|
||||
objupdate.ObjectData[0].FullID = store.FullID;
|
||||
|
||||
objupdate.ObjectData[0].ObjectData = new byte[60];
|
||||
objupdate.ObjectData[0].ObjectData[46] = 128;
|
||||
objupdate.ObjectData[0].ObjectData[47] = 63;
|
||||
LLVector3 pos1 = store.Position;
|
||||
LLVector3 pos1 = posi; // store.Position;
|
||||
//update position
|
||||
byte[] pb = pos1.GetBytes();
|
||||
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length);
|
||||
|
@ -425,8 +498,12 @@ namespace OpenSim.world
|
|||
this.localid = objupdate.ObjectData[0].ID;
|
||||
this.position = pos1;
|
||||
this.OurPacket = objupdate;
|
||||
|
||||
if (newprim)
|
||||
{
|
||||
this.newPrimFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock()
|
||||
{
|
||||
uint ID = this.localid;
|
||||
|
|
|
@ -9,6 +9,8 @@ using OpenSim.Physics.Manager;
|
|||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Assets;
|
||||
using OpenSim.Framework.Terrain;
|
||||
using OpenSim.Framework.Inventory;
|
||||
using OpenSim.Assets;
|
||||
|
||||
namespace OpenSim.world
|
||||
{
|
||||
|
@ -30,6 +32,8 @@ namespace OpenSim.world
|
|||
private ulong m_regionHandle;
|
||||
private string m_regionName;
|
||||
private SimConfig m_cfg;
|
||||
private InventoryCache _inventoryCache;
|
||||
private AssetCache _assetCache;
|
||||
|
||||
public World(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, string regionName, SimConfig cfg)
|
||||
{
|
||||
|
@ -50,6 +54,21 @@ namespace OpenSim.world
|
|||
Avatar.LoadAnims();
|
||||
}
|
||||
|
||||
public InventoryCache InventoryCache
|
||||
{
|
||||
set
|
||||
{
|
||||
this._inventoryCache = value;
|
||||
}
|
||||
}
|
||||
|
||||
public AssetCache AssetCache
|
||||
{
|
||||
set
|
||||
{
|
||||
this._assetCache = value;
|
||||
}
|
||||
}
|
||||
public PhysicsScene PhysScene
|
||||
{
|
||||
set
|
||||
|
@ -291,44 +310,109 @@ namespace OpenSim.world
|
|||
|
||||
public void DeRezObject(DeRezObjectPacket DeRezPacket, SimClient AgentClient)
|
||||
{
|
||||
// Console.WriteLine(DeRezPacket);
|
||||
//Needs to delete object from physics at a later date
|
||||
|
||||
libsecondlife.LLUUID[] DeRezEnts;
|
||||
DeRezEnts = new libsecondlife.LLUUID[DeRezPacket.ObjectData.Length];
|
||||
int i = 0;
|
||||
foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
|
||||
if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
|
||||
{
|
||||
//OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
|
||||
foreach (Entity ent in this.Entities.Values)
|
||||
libsecondlife.LLUUID[] DeRezEnts;
|
||||
DeRezEnts = new libsecondlife.LLUUID[DeRezPacket.ObjectData.Length];
|
||||
int i = 0;
|
||||
foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
|
||||
{
|
||||
if (ent.localid == Data.ObjectLocalID)
|
||||
|
||||
//OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
|
||||
foreach (Entity ent in this.Entities.Values)
|
||||
{
|
||||
DeRezEnts[i++] = ent.uuid;
|
||||
this.localStorage.RemovePrim(ent.uuid);
|
||||
if (ent.localid == Data.ObjectLocalID)
|
||||
{
|
||||
DeRezEnts[i++] = ent.uuid;
|
||||
this.localStorage.RemovePrim(ent.uuid);
|
||||
KillObjectPacket kill = new KillObjectPacket();
|
||||
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
|
||||
kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
|
||||
kill.ObjectData[0].ID = ent.localid;
|
||||
foreach (SimClient client in m_clientThreads.Values)
|
||||
{
|
||||
client.OutPacket(kill);
|
||||
}
|
||||
//Uncommenting this means an old UUID will be re-used, thus crashing the asset server
|
||||
//Uncomment when prim/object UUIDs are random or such
|
||||
//2007-03-22 - Randomskk
|
||||
//this._primCount--;
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Deleted UUID " + ent.uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (libsecondlife.LLUUID uuid in DeRezEnts)
|
||||
{
|
||||
lock (Entities)
|
||||
{
|
||||
Entities.Remove(uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
|
||||
{
|
||||
Entity selectedEnt = null;
|
||||
//OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
|
||||
foreach (Entity ent in this.Entities.Values)
|
||||
{
|
||||
if (ent.localid == Data.ObjectLocalID)
|
||||
{
|
||||
AssetBase primAsset = new AssetBase();
|
||||
primAsset.FullID = LLUUID.Random();//DeRezPacket.AgentBlock.TransactionID.Combine(LLUUID.Zero); //should be combining with securesessionid
|
||||
primAsset.InvType = 6;
|
||||
primAsset.Type = 6;
|
||||
primAsset.Name = "Prim";
|
||||
primAsset.Description = "";
|
||||
primAsset.Data = ((Primitive)ent).GetByteArray();
|
||||
this._assetCache.AddAsset(primAsset);
|
||||
this._inventoryCache.AddNewInventoryItem(AgentClient, DeRezPacket.AgentBlock.DestinationID, primAsset);
|
||||
selectedEnt = ent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selectedEnt != null)
|
||||
{
|
||||
this.localStorage.RemovePrim(selectedEnt.uuid);
|
||||
KillObjectPacket kill = new KillObjectPacket();
|
||||
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
|
||||
kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
|
||||
kill.ObjectData[0].ID = ent.localid;
|
||||
kill.ObjectData[0].ID = selectedEnt.localid;
|
||||
foreach (SimClient client in m_clientThreads.Values)
|
||||
{
|
||||
client.OutPacket(kill);
|
||||
}
|
||||
//Uncommenting this means an old UUID will be re-used, thus crashing the asset server
|
||||
//Uncomment when prim/object UUIDs are random or such
|
||||
//2007-03-22 - Randomskk
|
||||
//this._primCount--;
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Deleted UUID " + ent.uuid);
|
||||
lock (Entities)
|
||||
{
|
||||
Entities.Remove(selectedEnt.uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (libsecondlife.LLUUID uuid in DeRezEnts)
|
||||
}
|
||||
|
||||
public void RezObject(SimClient remoteClient, RezObjectPacket packet)
|
||||
{
|
||||
AgentInventory inven =this._inventoryCache.GetAgentsInventory(remoteClient.AgentID);
|
||||
if(inven != null)
|
||||
{
|
||||
lock (Entities)
|
||||
if (inven.InventoryItems.ContainsKey(packet.InventoryData.ItemID))
|
||||
{
|
||||
Entities.Remove(uuid);
|
||||
AssetBase asset = this._assetCache.GetAsset(inven.InventoryItems[packet.InventoryData.ItemID].AssetID);
|
||||
if (asset != null)
|
||||
{
|
||||
PrimData primd = new PrimData(asset.Data);
|
||||
Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this);
|
||||
nPrim.CreateFromStorage(primd, packet.RezData.RayEnd, this._primCount, true);
|
||||
this.Entities.Add(nPrim.uuid, nPrim);
|
||||
this._primCount++;
|
||||
this._inventoryCache.DeleteInventoryItem(remoteClient, packet.InventoryData.ItemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public bool Backup()
|
||||
|
|
Loading…
Reference in New Issue