From 0eabb4b98ccff663de034ac666bfcb531edb7a30 Mon Sep 17 00:00:00 2001 From: gareth Date: Thu, 1 Mar 2007 01:38:41 +0000 Subject: [PATCH] Broken asset code + ObjectUpdate FIXME --- bin/avatar-template.dat | Bin 0 -> 552 bytes src/OpenSimClient.cs | 7 +++--- src/world/Avatar.cs | 54 ++++++++++++++++++++++++++++++++++++++++ src/world/World.cs | 2 +- 4 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 bin/avatar-template.dat diff --git a/bin/avatar-template.dat b/bin/avatar-template.dat new file mode 100644 index 0000000000000000000000000000000000000000..286b75d79bb14be68d2161bd26aacb0b5e5141ec GIT binary patch literal 552 zcmcbu!p7WGQ2G?si?{h$4l`X#jE4G;H^x2-~9YaB&z@QdrRC z7#XY?+%k)bOZ*aZQx$?kf;|1)6@tPQg2NPiGm|q?xqK3_$+>4HCFSQ8qnM^2qW`W_>}JiBv^O^XY>%Q8lf%P!NaNyp?^y2@Enhlku}@nyy{Ca8 z+~eMvZ<=m0v&f2s}(_Xs| zxvgqp;19j?PBoutIZN0ommO{lpPCqg74-~#8t>|FzV3hew1~ESBST;2w&j_+m*zcj zj9Jio#^Am~fqkCJ!rzh&Yu0D&SUD^Ds=~Hi!TYxEpCzv+sd($>45v8)HH&Ba?3Hwz zx&Hf4`wO;q)f}lx&wa%b{OY$c=6f7WomI}Fb9Gj!ocyJ!k8UrM`qP}Xo9WdLv0Yae lxSPloKD55lvvnrpPc^ZkfQWfN4jl3LV#O_X1v4CAA^=UAp49*V literal 0 HcmV?d00001 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() {