diff --git a/bin/avatar-template.dat b/bin/avatar-template.dat new file mode 100644 index 0000000000..286b75d79b Binary files /dev/null and b/bin/avatar-template.dat differ diff --git a/src/OpenSimClient.cs b/src/OpenSimClient.cs index af4ce0eba2..8f07065c06 100644 --- a/src/OpenSimClient.cs +++ b/src/OpenSimClient.cs @@ -137,6 +137,7 @@ namespace OpenSim break; case PacketType.RegionHandshakeReply: OpenSim_Main.local_world.SendLayerData(this); + ClientAvatar.SendInitialPosition(); break; case PacketType.AgentWearablesRequest: ClientAvatar.SendInitialAppearance(); @@ -147,7 +148,6 @@ namespace OpenSim TransferRequestPacket transfer = (TransferRequestPacket)Pack; AssetRequests.Enqueue(transfer); Thread AssetLoaderThread = new Thread(new ThreadStart(AssetLoader)); - AssetLoaderThread.IsBackground = true; AssetLoaderThread.Start(); break; } @@ -210,7 +210,8 @@ namespace OpenSim private void AckTimer_Elapsed(object sender, ElapsedEventArgs ea) { - SendAcks(); ResendUnacked(); + SendAcks(); + ResendUnacked(); } public void ProcessOutPacket(Packet Pack) { @@ -230,7 +231,7 @@ namespace OpenSim Pack.Header.Sequence = Sequence; } - if (Pack.Header.Reliable) + if (Pack.Header.Reliable) //DIRTY HACK { lock (NeedAck) { diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs index 6177f6ef48..d5794634dd 100644 --- a/src/world/Avatar.cs +++ b/src/world/Avatar.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Text; using libsecondlife; using libsecondlife.Packets; @@ -11,12 +12,42 @@ namespace OpenSim.world public string firstname; public string lastname; public OpenSimClient ControllingClient; + private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; public Avatar(OpenSimClient TheClient) { Console.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); ControllingClient=TheClient; + SetupTemplate("avatar-template.dat"); } + private void SetupTemplate(string name) + { + + int i = 0; + FileInfo fInfo = new FileInfo(name); + long numBytes = fInfo.Length; + FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); + BinaryReader br = new BinaryReader(fStream); + byte [] data1 = br.ReadBytes((int)numBytes); + br.Close(); + fStream.Close(); + + libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); + + System.Text.Encoding enc = System.Text.Encoding.ASCII; + libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16); + pos.X = 100f; + objdata.ID = 8880000; + objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0"); + libsecondlife.LLVector3 pos2 = new LLVector3(13.981f,100.0f,20.0f); + //objdata.FullID=user.AgentID; + byte[] pb = pos.GetBytes(); + Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); + + AvatarTemplate = objdata; + + } + public void CompleteMovement(World RegionInfo) { Console.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet"); AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); @@ -33,6 +64,29 @@ namespace OpenSim.world } public void SendInitialPosition() { + System.Text.Encoding _enc = System.Text.Encoding.ASCII; + + + //send a objectupdate packet with information about the clients avatar + ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); + objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; + objupdate.RegionData.TimeDilation = 64096; + objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; + + objupdate.ObjectData[0] = AvatarTemplate; + //give this avatar object a local id and assign the user a name + objupdate.ObjectData[0].ID = 8880000 + OpenSim_Main.local_world._localNumber; + //User_info.name="Test"+this.local_numer+" User"; + objupdate.ObjectData[0].FullID = ControllingClient.AgentID; + objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0"); + + libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 22.0f); + + byte[] pb = pos2.GetBytes(); + + Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); + OpenSim_Main.local_world._localNumber++; + this.ControllingClient.OutPacket(objupdate); } public void SendInitialAppearance() { diff --git a/src/world/World.cs b/src/world/World.cs index d7e3370d44..ccc34ea098 100644 --- a/src/world/World.cs +++ b/src/world/World.cs @@ -12,7 +12,7 @@ namespace OpenSim.world public float[] LandMap; public ScriptEngine Scripts; public TerrainDecode terrainengine = new TerrainDecode(); - + public uint _localNumber=0; public World() {