aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorgareth2007-03-01 01:38:41 +0000
committergareth2007-03-01 01:38:41 +0000
commit0eabb4b98ccff663de034ac666bfcb531edb7a30 (patch)
treebe42c12a9ff9ef0b72830e006943788d7e1503c2
parentBrought in newer libsl (diff)
downloadopensim-SC-0eabb4b98ccff663de034ac666bfcb531edb7a30.zip
opensim-SC-0eabb4b98ccff663de034ac666bfcb531edb7a30.tar.gz
opensim-SC-0eabb4b98ccff663de034ac666bfcb531edb7a30.tar.bz2
opensim-SC-0eabb4b98ccff663de034ac666bfcb531edb7a30.tar.xz
Broken asset code + ObjectUpdate FIXME
-rw-r--r--bin/avatar-template.datbin0 -> 552 bytes
-rw-r--r--src/OpenSimClient.cs7
-rw-r--r--src/world/Avatar.cs54
-rw-r--r--src/world/World.cs2
4 files changed, 59 insertions, 4 deletions
diff --git a/bin/avatar-template.dat b/bin/avatar-template.dat
new file mode 100644
index 0000000..286b75d
--- /dev/null
+++ b/bin/avatar-template.dat
Binary files differ
diff --git a/src/OpenSimClient.cs b/src/OpenSimClient.cs
index af4ce0e..8f07065 100644
--- a/src/OpenSimClient.cs
+++ b/src/OpenSimClient.cs
@@ -137,6 +137,7 @@ namespace OpenSim
137 break; 137 break;
138 case PacketType.RegionHandshakeReply: 138 case PacketType.RegionHandshakeReply:
139 OpenSim_Main.local_world.SendLayerData(this); 139 OpenSim_Main.local_world.SendLayerData(this);
140 ClientAvatar.SendInitialPosition();
140 break; 141 break;
141 case PacketType.AgentWearablesRequest: 142 case PacketType.AgentWearablesRequest:
142 ClientAvatar.SendInitialAppearance(); 143 ClientAvatar.SendInitialAppearance();
@@ -147,7 +148,6 @@ namespace OpenSim
147 TransferRequestPacket transfer = (TransferRequestPacket)Pack; 148 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
148 AssetRequests.Enqueue(transfer); 149 AssetRequests.Enqueue(transfer);
149 Thread AssetLoaderThread = new Thread(new ThreadStart(AssetLoader)); 150 Thread AssetLoaderThread = new Thread(new ThreadStart(AssetLoader));
150 AssetLoaderThread.IsBackground = true;
151 AssetLoaderThread.Start(); 151 AssetLoaderThread.Start();
152 break; 152 break;
153 } 153 }
@@ -210,7 +210,8 @@ namespace OpenSim
210 210
211 private void AckTimer_Elapsed(object sender, ElapsedEventArgs ea) 211 private void AckTimer_Elapsed(object sender, ElapsedEventArgs ea)
212 { 212 {
213 SendAcks(); ResendUnacked(); 213 SendAcks();
214 ResendUnacked();
214 } 215 }
215 216
216 public void ProcessOutPacket(Packet Pack) { 217 public void ProcessOutPacket(Packet Pack) {
@@ -230,7 +231,7 @@ namespace OpenSim
230 Pack.Header.Sequence = Sequence; 231 Pack.Header.Sequence = Sequence;
231 } 232 }
232 233
233 if (Pack.Header.Reliable) 234 if (Pack.Header.Reliable) //DIRTY HACK
234 { 235 {
235 lock (NeedAck) 236 lock (NeedAck)
236 { 237 {
diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs
index 6177f6e..d579463 100644
--- a/src/world/Avatar.cs
+++ b/src/world/Avatar.cs
@@ -1,5 +1,6 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.IO;
3using System.Text; 4using System.Text;
4using libsecondlife; 5using libsecondlife;
5using libsecondlife.Packets; 6using libsecondlife.Packets;
@@ -11,12 +12,42 @@ namespace OpenSim.world
11 public string firstname; 12 public string firstname;
12 public string lastname; 13 public string lastname;
13 public OpenSimClient ControllingClient; 14 public OpenSimClient ControllingClient;
15 private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
14 16
15 public Avatar(OpenSimClient TheClient) { 17 public Avatar(OpenSimClient TheClient) {
16 Console.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); 18 Console.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
17 ControllingClient=TheClient; 19 ControllingClient=TheClient;
20 SetupTemplate("avatar-template.dat");
18 } 21 }
19 22
23 private void SetupTemplate(string name)
24 {
25
26 int i = 0;
27 FileInfo fInfo = new FileInfo(name);
28 long numBytes = fInfo.Length;
29 FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
30 BinaryReader br = new BinaryReader(fStream);
31 byte [] data1 = br.ReadBytes((int)numBytes);
32 br.Close();
33 fStream.Close();
34
35 libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
36
37 System.Text.Encoding enc = System.Text.Encoding.ASCII;
38 libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
39 pos.X = 100f;
40 objdata.ID = 8880000;
41 objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0");
42 libsecondlife.LLVector3 pos2 = new LLVector3(13.981f,100.0f,20.0f);
43 //objdata.FullID=user.AgentID;
44 byte[] pb = pos.GetBytes();
45 Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);
46
47 AvatarTemplate = objdata;
48
49 }
50
20 public void CompleteMovement(World RegionInfo) { 51 public void CompleteMovement(World RegionInfo) {
21 Console.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet"); 52 Console.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet");
22 AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); 53 AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
@@ -33,6 +64,29 @@ namespace OpenSim.world
33 } 64 }
34 65
35 public void SendInitialPosition() { 66 public void SendInitialPosition() {
67 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
68
69
70 //send a objectupdate packet with information about the clients avatar
71 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
72 objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle;
73 objupdate.RegionData.TimeDilation = 64096;
74 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
75
76 objupdate.ObjectData[0] = AvatarTemplate;
77 //give this avatar object a local id and assign the user a name
78 objupdate.ObjectData[0].ID = 8880000 + OpenSim_Main.local_world._localNumber;
79 //User_info.name="Test"+this.local_numer+" User";
80 objupdate.ObjectData[0].FullID = ControllingClient.AgentID;
81 objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0");
82
83 libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 22.0f);
84
85 byte[] pb = pos2.GetBytes();
86
87 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
88 OpenSim_Main.local_world._localNumber++;
89 this.ControllingClient.OutPacket(objupdate);
36 } 90 }
37 91
38 public void SendInitialAppearance() { 92 public void SendInitialAppearance() {
diff --git a/src/world/World.cs b/src/world/World.cs
index d7e3370..ccc34ea 100644
--- a/src/world/World.cs
+++ b/src/world/World.cs
@@ -12,7 +12,7 @@ namespace OpenSim.world
12 public float[] LandMap; 12 public float[] LandMap;
13 public ScriptEngine Scripts; 13 public ScriptEngine Scripts;
14 public TerrainDecode terrainengine = new TerrainDecode(); 14 public TerrainDecode terrainengine = new TerrainDecode();
15 15 public uint _localNumber=0;
16 16
17 public World() 17 public World()
18 { 18 {