aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorMW2007-03-07 20:18:20 +0000
committerMW2007-03-07 20:18:20 +0000
commit48b05c6784e8e3c647b4efc8ffdee7c51b59251f (patch)
tree74b45ca30273152b2ee5b1cfc3a73cc3c8f4b4e8 /src
parentfixed genvers.sh (diff)
downloadopensim-SC_OLD-48b05c6784e8e3c647b4efc8ffdee7c51b59251f.zip
opensim-SC_OLD-48b05c6784e8e3c647b4efc8ffdee7c51b59251f.tar.gz
opensim-SC_OLD-48b05c6784e8e3c647b4efc8ffdee7c51b59251f.tar.bz2
opensim-SC_OLD-48b05c6784e8e3c647b4efc8ffdee7c51b59251f.tar.xz
Hopefully fixed the Session logout bug.
Should now see avatars for other users connected to the same sim.
Diffstat (limited to 'src')
-rw-r--r--src/OpenSimClient.cs11
-rw-r--r--src/world/Avatar.cs69
-rw-r--r--src/world/Primitive.cs5
-rw-r--r--src/world/World.cs7
4 files changed, 80 insertions, 12 deletions
diff --git a/src/OpenSimClient.cs b/src/OpenSimClient.cs
index 8021d59..5f68806 100644
--- a/src/OpenSimClient.cs
+++ b/src/OpenSimClient.cs
@@ -90,6 +90,14 @@ namespace OpenSim
90 break; 90 break;
91 case PacketType.AgentWearablesRequest: 91 case PacketType.AgentWearablesRequest:
92 ClientAvatar.SendInitialAppearance(); 92 ClientAvatar.SendInitialAppearance();
93 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
94 if(client.AgentID != this.AgentID)
95 {
96 ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket();
97 this.OutPacket(objupdate);
98 client.ClientAvatar.SendAppearanceToOtherAgent(this);
99 }
100 }
93 break; 101 break;
94 case PacketType.ObjectAdd: 102 case PacketType.ObjectAdd:
95 OpenSim_Main.local_world.AddNewPrim((ObjectAddPacket)Pack, this); 103 OpenSim_Main.local_world.AddNewPrim((ObjectAddPacket)Pack, this);
@@ -104,11 +112,11 @@ namespace OpenSim
104 break; 112 break;
105 case PacketType.LogoutRequest: 113 case PacketType.LogoutRequest:
106 ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request"); 114 ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request");
115 OpenSim_Main.gridServers.GridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
107 lock(OpenSim_Main.local_world.Entities) { 116 lock(OpenSim_Main.local_world.Entities) {
108 OpenSim_Main.local_world.Entities.Remove(this.AgentID); 117 OpenSim_Main.local_world.Entities.Remove(this.AgentID);
109 } 118 }
110 //need to do other cleaning up here too 119 //need to do other cleaning up here too
111 OpenSim_Main.gridServers.GridServer.LogoutSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
112 this.ClientThread.Abort(); 120 this.ClientThread.Abort();
113 break; 121 break;
114 case PacketType.ChatFromViewer: 122 case PacketType.ChatFromViewer:
@@ -254,6 +262,7 @@ namespace OpenSim
254 } 262 }
255 } 263 }
256 264
265 //ServerConsole.MainConsole.Instance.WriteLine("OUT: \n" + Pack.ToString());
257 266
258 byte[] ZeroOutBuffer = new byte[4096]; 267 byte[] ZeroOutBuffer = new byte[4096];
259 byte[] sendbuffer; 268 byte[] sendbuffer;
diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs
index c8469f8..1a53acc 100644
--- a/src/world/Avatar.cs
+++ b/src/world/Avatar.cs
@@ -15,7 +15,7 @@ namespace OpenSim.world
15 public string lastname; 15 public string lastname;
16 public OpenSimClient ControllingClient; 16 public OpenSimClient ControllingClient;
17 private PhysicsActor _physActor; 17 private PhysicsActor _physActor;
18 private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; 18 private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
19 private bool updateflag; 19 private bool updateflag;
20 private bool walking; 20 private bool walking;
21 private List<NewForce> forcesList = new List<NewForce>(); 21 private List<NewForce> forcesList = new List<NewForce>();
@@ -24,7 +24,6 @@ namespace OpenSim.world
24 public Avatar(OpenSimClient TheClient) { 24 public Avatar(OpenSimClient TheClient) {
25 ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); 25 ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
26 ControllingClient=TheClient; 26 ControllingClient=TheClient;
27 SetupTemplate("avatar-template.dat");
28 position = new LLVector3(100.0f,100.0f,30.0f); 27 position = new LLVector3(100.0f,100.0f,30.0f);
29 position.Z = OpenSim_Main.local_world.LandMap[(int)position.Y * 256 + (int)position.X]+1; 28 position.Z = OpenSim_Main.local_world.LandMap[(int)position.Y * 256 + (int)position.X]+1;
30 } 29 }
@@ -103,7 +102,7 @@ namespace OpenSim.world
103 } 102 }
104 } 103 }
105 104
106 private void SetupTemplate(string name) 105 public static void SetupTemplate(string name)
107 { 106 {
108 107
109 int i = 0; 108 int i = 0;
@@ -127,7 +126,7 @@ namespace OpenSim.world
127 byte[] pb = pos.GetBytes(); 126 byte[] pb = pos.GetBytes();
128 Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); 127 Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);
129 128
130 AvatarTemplate = objdata; 129 Avatar.AvatarTemplate = objdata;
131 130
132 } 131 }
133 132
@@ -166,7 +165,16 @@ namespace OpenSim.world
166 165
167 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); 166 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
168 OpenSim_Main.local_world._localNumber++; 167 OpenSim_Main.local_world._localNumber++;
169 this.ControllingClient.OutPacket(objupdate); 168
169 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values)
170 {
171 client.OutPacket(objupdate);
172 if(client.AgentID != ControllingClient.AgentID)
173 {
174 SendAppearanceToOtherAgent(client);
175 }
176 }
177 //this.ControllingClient.OutPacket(objupdate);
170 } 178 }
171 179
172 public void SendInitialAppearance() { 180 public void SendInitialAppearance() {
@@ -182,7 +190,8 @@ namespace OpenSim.world
182 awb.ItemID = LLUUID.Random(); 190 awb.ItemID = LLUUID.Random();
183 aw.WearableData[0] = awb; 191 aw.WearableData[0] = awb;
184 192
185 for(int i=1; i<13; i++) { 193 for(int i=1; i<13; i++)
194 {
186 awb = new AgentWearablesUpdatePacket.WearableDataBlock(); 195 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
187 awb.WearableType = (byte)i; 196 awb.WearableType = (byte)i;
188 awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); 197 awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
@@ -193,6 +202,54 @@ namespace OpenSim.world
193 ControllingClient.OutPacket(aw); 202 ControllingClient.OutPacket(aw);
194 } 203 }
195 204
205 public ObjectUpdatePacket CreateUpdatePacket()
206 {
207 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
208 //send a objectupdate packet with information about the clients avatar
209 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
210 objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle;
211 objupdate.RegionData.TimeDilation = 64096;
212 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
213
214 objupdate.ObjectData[0] = AvatarTemplate;
215 //give this avatar object a local id and assign the user a name
216 objupdate.ObjectData[0].ID = this.localid;
217 objupdate.ObjectData[0].FullID = ControllingClient.AgentID;
218 objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0");
219
220 libsecondlife.LLVector3 pos2 = new LLVector3((float)this._physActor.Position.X, (float)this._physActor.Position.Y, (float)this._physActor.Position.Z);
221
222 byte[] pb = pos2.GetBytes();
223
224 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
225 return objupdate;
226 }
227
228 public void SendAppearanceToOtherAgent(OpenSimClient userInfo)
229 {
230 AvatarAppearancePacket avp = new AvatarAppearancePacket();
231
232
233 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
234 //avp.ObjectData.TextureEntry=this.avatar_template.TextureEntry;// br.ReadBytes((int)numBytes);
235
236 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-0000-000000000005"));
237 avp.ObjectData.TextureEntry = ntex.ToBytes();
238
239 AvatarAppearancePacket.VisualParamBlock avblock = null;
240 for(int i = 0; i < 218; i++)
241 {
242 avblock = new AvatarAppearancePacket.VisualParamBlock();
243 avblock.ParamValue = (byte)100;
244 avp.VisualParam[i] = avblock;
245 }
246
247 avp.Sender.IsTrial = false;
248 avp.Sender.ID = ControllingClient.AgentID;
249 userInfo.OutPacket(avp);
250
251 }
252
196 public void HandleUpdate(AgentUpdatePacket pack) { 253 public void HandleUpdate(AgentUpdatePacket pack) {
197 if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) !=0) { 254 if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) !=0) {
198 if(!walking) 255 if(!walking)
diff --git a/src/world/Primitive.cs b/src/world/Primitive.cs
index 31ef533..7b1f69a 100644
--- a/src/world/Primitive.cs
+++ b/src/world/Primitive.cs
@@ -55,7 +55,7 @@ namespace OpenSim.world
55 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; 55 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
56 PrimData PData = new PrimData(); 56 PrimData PData = new PrimData();
57 this.primData = PData; 57 this.primData = PData;
58 objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();//OpenSim_Main.local_world.PrimTemplate; 58 objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();
59 objupdate.ObjectData[0].PSBlock = new byte[0]; 59 objupdate.ObjectData[0].PSBlock = new byte[0];
60 objupdate.ObjectData[0].ExtraParams = new byte[1]; 60 objupdate.ObjectData[0].ExtraParams = new byte[1];
61 objupdate.ObjectData[0].MediaURL = new byte[0]; 61 objupdate.ObjectData[0].MediaURL = new byte[0];
@@ -67,7 +67,7 @@ namespace OpenSim.world
67 objupdate.ObjectData[0].JointPivot = new LLVector3(0,0,0); 67 objupdate.ObjectData[0].JointPivot = new LLVector3(0,0,0);
68 objupdate.ObjectData[0].Material = 3; 68 objupdate.ObjectData[0].Material = 3;
69 objupdate.ObjectData[0].UpdateFlags=32+65536+131072+256+4+8+2048+524288+268435456; 69 objupdate.ObjectData[0].UpdateFlags=32+65536+131072+256+4+8+2048+524288+268435456;
70 objupdate.ObjectData[0].TextureAnim = new byte[0]; 70 objupdate.ObjectData[0].TextureAnim = new byte[0];
71 objupdate.ObjectData[0].Sound = LLUUID.Zero; 71 objupdate.ObjectData[0].Sound = LLUUID.Zero;
72 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); 72 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
73 objupdate.ObjectData[0].TextureEntry = ntex.ToBytes(); 73 objupdate.ObjectData[0].TextureEntry = ntex.ToBytes();
@@ -89,6 +89,7 @@ namespace OpenSim.world
89 PData.ProfileCurve = objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve; 89 PData.ProfileCurve = objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve;
90 PData.ParentID = objupdate.ObjectData[0].ParentID = 0; 90 PData.ParentID = objupdate.ObjectData[0].ParentID = 0;
91 PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow; 91 PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow;
92
92 //finish off copying rest of shape data 93 //finish off copying rest of shape data
93 94
94 objupdate.ObjectData[0].ID = (uint)(localID); 95 objupdate.ObjectData[0].ID = (uint)(localID);
diff --git a/src/world/World.cs b/src/world/World.cs
index 8427a38..41a7a34 100644
--- a/src/world/World.cs
+++ b/src/world/World.cs
@@ -3,6 +3,7 @@ using libsecondlife;
3using libsecondlife.Packets; 3using libsecondlife.Packets;
4using System.Collections.Generic; 4using System.Collections.Generic;
5using System.Text; 5using System.Text;
6using System.IO;
6using PhysicsSystem; 7using PhysicsSystem;
7 8
8namespace OpenSim.world 9namespace OpenSim.world
@@ -27,7 +28,8 @@ namespace OpenSim.world
27 28
28 ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); 29 ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating LandMap");
29 TerrainManager = new TerrainManager(new SecondLife()); 30 TerrainManager = new TerrainManager(new SecondLife());
30 31 Avatar.SetupTemplate("avatar-template.dat");
32
31 // ServerConsole.MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); 33 // ServerConsole.MainConsole.Instance.WriteLine("World.cs - Creating script engine instance");
32 // Initialise this only after the world has loaded 34 // Initialise this only after the world has loaded
33 // Scripts = new ScriptEngine(this); 35 // Scripts = new ScriptEngine(this);
@@ -111,7 +113,6 @@ namespace OpenSim.world
111 113
112 return false; 114 return false;
113 } 115 }
114 116
115
116 } 117 }
117} 118}